From 26cb890e9b4d33af88099d8caae2193236dfaaa9 Mon Sep 17 00:00:00 2001 From: stevejpurves Date: Thu, 5 Sep 2024 15:08:08 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20jupyter-?= =?UTF-8?q?book/thebe@80dfbb92afaa7b3bc3135fc00cce14ebe2b11c15=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 2 +- index.js.map | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index e493e73e..88be9f5f 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,3 @@ /*! For license information please see index.js.LICENSE.txt */ -(()=>{var __webpack_modules__={678:(e,t,n)=>{"use strict";n.d(t,{FI:()=>g,JV:()=>f});var i=n(7998),r=n(5764),s=n(7991);function o(e){const t=new Uint8Array(e.length/2);for(let n=0;n/g,">");for(navigator&&"Microsoft Internet Explorer"===navigator.appName&&(s=s.replace(/(%[^\n]*)\n/g,"$1
\n"));t>e;)r[t]="",t--;return r[e]="@@"+i.length+"@@",n&&(s=n(s)),i.push(s),r}var c=n(7521),h=n.n(c);const p=i.PROTOCOL_VERSION.split(".",1)[0];class g{constructor(){this.comm_target_name="jupyter.widget",this._models=Object.create(null)}setViewOptions(e={}){return e}create_view(e,t={}){const n=(0,i.uuid)(),r=e.state_change=e.state_change.then((async()=>{const r=e.get("_view_name"),s=e.get("_view_module");try{const i=new(await this.loadViewClass(r,s,e.get("_view_module_version")))({model:e,options:this.setViewOptions(t)});return i.listenTo(e,"destroy",i.remove),await i.render(),i.once("remove",(()=>{e.views&&delete e.views[n]})),i}catch(n){console.error(`Could not create a view for model id ${e.model_id}`);const o=`Failed to create view for '${r}' from module '${s}' with model '${e.name}' from module '${e.module}'`,a=new(i.createErrorWidgetModel(n,o)),l=new i.ErrorWidgetView({model:a,options:this.setViewOptions(t)});return await l.render(),l}}));return e.views&&(e.views[n]=r),r}callbacks(e){return{}}async get_model(e){const t=this._models[e];if(void 0===t)throw new Error("widget model not found");return t}has_model(e){return void 0!==this._models[e]}handle_comm_open(e,t){const n=(t.metadata||{}).version||"";if(n.split(".",1)[0]!==p){const e=`Wrong widget protocol version: received protocol version '${n}', but was expecting major version '${p}'`;return console.error(e),Promise.reject(e)}const r=t.content.data,s=r.buffer_paths||[],o=t.buffers||[];return(0,i.put_buffers)(r.state,s,o),this.new_model({model_name:r.state._model_name,model_module:r.state._model_module,model_module_version:r.state._model_module_version,comm:e},r.state).catch((0,i.reject)("Could not create a model.",!0))}new_widget(e,t={}){let n;if(void 0===e.view_name||void 0===e.view_module||void 0===e.view_module_version)return Promise.reject("new_widget(...) must be given view information in the options.");n=e.comm?Promise.resolve(e.comm):this._create_comm(this.comm_target_name,e.model_id,{state:{_model_module:e.model_module,_model_module_version:e.model_module_version,_model_name:e.model_name,_view_module:e.view_module,_view_module_version:e.view_module_version,_view_name:e.view_name}},{version:i.PROTOCOL_VERSION});const r=Object.assign({},e);return n.then((e=>(r.comm=e,this.new_model(r,t).then((e=>(e.sync("create",e),e))))),(()=>(r.model_id||(r.model_id=(0,i.uuid)()),this.new_model(r,t))))}register_model(e,t){this._models[e]=t,t.then((t=>{t.once("comm:close",(()=>{delete this._models[e]}))}))}async new_model(e,t={}){var n,i;const r=null!==(n=e.model_id)&&void 0!==n?n:null===(i=e.comm)||void 0===i?void 0:i.comm_id;if(!r)throw new Error("Neither comm nor model_id provided in options object. At least one must exist.");e.model_id=r;const s=this._make_model(e,t);return this.register_model(r,s),await s}async _loadFromKernel(){let e,t;try{const n=await this._create_comm("jupyter.widget.control",(0,i.uuid)(),{},{version:"1.0.0"});await new Promise(((i,r)=>{n.on_msg((n=>{e=n.content.data,"update_states"===e.method?(t=(n.buffers||[]).map((e=>e instanceof DataView?e:new DataView(e instanceof ArrayBuffer?e:e.buffer))),i(null)):console.warn(`\n Unknown ${e.method} message on the Control channel\n `)})),n.on_close((()=>r("Control comm was closed too early"))),n.send({method:"request_states"},{}),setTimeout((()=>r("Control comm did not respond in time")),4e3)})),n.close()}catch(e){return console.warn('Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason:',e),this._loadFromKernelModels()}const n=e.states,r={},s={};for(let n=0;n({widget_id:e,comm:this.has_model(e)?void 0:await this._create_comm("jupyter.widget",e)}))));await Promise.all(o.map((async({widget_id:e,comm:t})=>{const o=n[e];e in r&&(0,i.put_buffers)(o,r[e],s[e]);try{if(t)await this.new_model({model_name:o.model_name,model_module:o.model_module,model_module_version:o.model_module_version,model_id:e,comm:t},o.state);else{const t=await this.get_model(e),n=await t.constructor._deserialize_state(o.state,this);t.set_state(n)}}catch(e){console.error(e)}})))}async _loadFromKernelModels(){const e=await this._get_comm_info(),t=await Promise.all(Object.keys(e).map((async e=>{if(this.has_model(e))return;const t=await this._create_comm(this.comm_target_name,e);let n="";const s=new r.PromiseDelegate;return t.on_msg((e=>{if(e.parent_header.msg_id===n&&"comm_msg"===e.header.msg_type&&"update"===e.content.data.method){const n=e.content.data,r=n.buffer_paths||[],o=e.buffers||[];(0,i.put_buffers)(n.state,r,o),s.resolve({comm:t,msg:e})}})),n=t.send({method:"request_state"},this.callbacks(void 0)),s.promise})));await Promise.all(t.map((async e=>{if(!e)return;const t=e.msg.content;await this.new_model({model_name:t.data.state._model_name,model_module:t.data.state._model_module,model_module_version:t.data.state._model_module_version,comm:e.comm},t.data.state)})))}async _make_model(e,t={}){const n=e.model_id,r=this.loadModelClass(e.model_name,e.model_module,e.model_module_version);let s;const o=(e,t)=>new(i.createErrorWidgetModel(e,t));try{s=await r}catch(e){const t="Could not instantiate widget";return console.error(t),o(e,t)}if(!s){const t="Could not instantiate widget";return console.error(t),o(new Error(`Cannot find model module ${e.model_module}@${e.model_module_version}, ${e.model_name}`),t)}let a;try{const i=await s._deserialize_state(t,this);a=new s(i,{widget_manager:this,model_id:n,comm:e.comm})}catch(t){console.error(t),a=o(t,`Model class '${e.model_name}' from module '${e.model_module}' is loaded but can not be instantiated`)}return a.name=e.model_name,a.module=e.model_module,a}clear_state(){return(0,i.resolvePromisesDict)(this._models).then((e=>{Object.keys(e).forEach((t=>e[t].close())),this._models=Object.create(null)}))}get_state(e={}){const t=Object.keys(this._models).map((e=>this._models[e]));return Promise.all(t).then((t=>f(t,e)))}set_state(e){if(!(e.version_major&&e.version_major<=2))throw"Unsupported widget state format";const t=e.state;return this._get_comm_info().then((e=>Promise.all(Object.keys(t).map((n=>{const r={base64:l,hex:o},s=t[n],a=s.state;if(s.buffers){const e=s.buffers.map((e=>e.path)),t=s.buffers.map((e=>new DataView(r[e.encoding](e.data))));(0,i.put_buffers)(s.state,e,t)}if(this.has_model(n))return this.get_model(n).then((e=>e.constructor._deserialize_state(a||{},this).then((t=>(e.set_state(t),e)))));const d={model_id:n,model_name:s.model_name,model_module:s.model_module,model_module_version:s.model_module_version};return Object.prototype.hasOwnProperty.call(e,"model_id")?this._create_comm(this.comm_target_name,n).then((e=>(d.comm=e,this.new_model(d)))):this.new_model(d,a)})))))}disconnect(){Object.keys(this._models).forEach((e=>{this._models[e].then((e=>{e.comm_live=!1}))}))}resolveUrl(e){return Promise.resolve(e)}inline_sanitize(e){const t=function(e){const t=[];let n,i=null,r=null,s=null,o=0;/`/.test(e)?(e=e.replace(/~/g,"~T").replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm,(e=>e.replace(/\$/g,"~D"))),n=e=>e.replace(/~([TD])/g,((e,t)=>"T"===t?"~":"$"))):n=e=>e;let a=e.replace(/\r\n?/g,"\n").split(d);for(let e=1,l=a.length;e{let n=r[t];return"\\\\("===n.substr(0,3)&&"\\\\)"===n.substr(n.length-3)?n="\\("+n.substring(3,n.length-3)+"\\)":"\\\\["===n.substr(0,3)&&"\\\\]"===n.substr(n.length-3)&&(n="\\["+n.substring(3,n.length-3)+"\\]"),n}))}async loadModelClass(e,t,n){try{const i=this.loadClass(e,t,n);return await i,i}catch(n){console.error(n);const r=`Failed to load model class '${e}' from module '${t}'`;return i.createErrorWidgetModel(n,r)}}async loadViewClass(e,t,n){try{const i=this.loadClass(e,t,n);return await i,i}catch(n){console.error(n);const r=`Failed to load view class '${e}' from module '${t}'`;return i.createErrorWidgetView(n,r)}}filterExistingModelState(e){let t=e.state;return t=Object.keys(t).filter((e=>!this.has_model(e))).reduce(((e,n)=>(e[n]=t[n],e)),{}),Object.assign(Object.assign({},e),{state:t})}}function f(e,t={}){const n={};return e.forEach((e=>{const r=e.model_id,s=(0,i.remove_buffers)(e.serialize(e.get_state(t.drop_defaults))),o=s.buffers.map(((e,t)=>({data:a(e),path:s.buffer_paths[t],encoding:"base64"})));n[r]={model_name:e.name,model_module:e.module,model_module_version:e.get("_model_module_version"),state:s.state},o.length>0&&(n[r].buffers=o)})),{version_major:2,version_minor:0,state:n}}},7998:(e,t,n)=>{"use strict";n.r(t),n.d(t,{BROKEN_FILE_SVG_ICON:()=>m,DOMWidgetModel:()=>j,DOMWidgetView:()=>L,ErrorWidgetView:()=>G,IJupyterWidgetRegistry:()=>$,JUPYTER_WIDGETS_VERSION:()=>D,JupyterLuminoPanelWidget:()=>R,JupyterLuminoWidget:()=>I,JupyterPhosphorWidget:()=>P,LayoutModel:()=>F,LayoutView:()=>z,PROTOCOL_VERSION:()=>S,StyleModel:()=>U,StyleView:()=>W,ViewList:()=>V,WidgetModel:()=>M,WidgetView:()=>O,assign:()=>l,createErrorWidgetModel:()=>q,createErrorWidgetView:()=>K,difference:()=>o,isEqual:()=>a,isObject:()=>g,isSerializable:()=>p,pack_models:()=>B,put_buffers:()=>h,reject:()=>c,remove_buffers:()=>f,resolvePromisesDict:()=>u,shims:()=>H,unpack_models:()=>k,uuid:()=>d});var i=n(5764),r=n(6343),s=n.n(r);function o(e,t){return e.filter((e=>-1===t.indexOf(e)))}function a(e,t){return s()(e,t)}const l=Object.assign||function(e,...t){for(let n=1;n{const n={};for(let i=0;i=0&&t.item(n)!==this;);return n>-1};class C extends b.View{_removeElement(){this.undelegateEvents(),this.el.parentNode&&this.el.parentNode.removeChild(this.el)}_setElement(e){this.el=e}_setAttributes(e){for(const t in e)t in this.el?this.el[t]=e[t]:this.el.setAttribute(t,e[t])}delegate(e,t,n){"string"!=typeof t&&(n=t,t=null),void 0===this._domEvents&&(this._domEvents=[]);const i=this.el,r=t?function(e){let r=e.target||e.srcElement;for(;r&&r!==i;r=r.parentNode)if(w.call(r,t))return e.delegateTarget=r,n.handleEvent?n.handleEvent(e):n(e)}:n;return this.el.addEventListener(e,r,!1),this._domEvents.push({eventName:e,handler:r,listener:n,selector:t}),r}undelegate(e,t,n){if("function"==typeof t&&(n=t,t=null),this.el&&this._domEvents){const i=this._domEvents.slice();let r=i.length;for(;r--;){const s=i[r];!(s.eventName!==e||n&&s.listener!==n||t&&s.selector!==t)&&(this.el.removeEventListener(s.eventName,s.handler,!1),this._domEvents.splice(r,1))}}return this}undelegateEvents(){if(this.el&&this._domEvents){const e=this._domEvents.length;for(let t=0;tthis.views[e].then((e=>e.remove()))));return delete this.views,Promise.all(e).then((()=>{}))}return Promise.resolve()}_handle_comm_closed(e){this.trigger("comm:close"),this.close(!0)}_handle_comm_msg(e){const t=e.content.data,n=t.method;switch(n){case"update":case"echo_update":return this.state_change=this.state_change.then((()=>{var i,r,s;const o=t.state,a=null!==(i=t.buffer_paths)&&void 0!==i?i:[],l=null!==(s=null===(r=e.buffers)||void 0===r?void 0:r.slice(0,a.length))&&void 0!==s?s:[];if(h(o,a,l),e.parent_header&&"echo_update"===n){const t=e.parent_header.msg_id;Object.keys(o).filter((e=>this._expectedEchoMsgIds.has(e))).forEach((e=>{this._expectedEchoMsgIds.get(e)!==t?delete o[e]:(this._expectedEchoMsgIds.delete(e),null!==this._msg_buffer&&Object.prototype.hasOwnProperty.call(this._msg_buffer,e)&&delete o[e])}))}return this.constructor._deserialize_state(o,this.widget_manager)})).then((e=>{this.set_state(e)})).catch(c(`Could not process update msg for model id: ${this.model_id}`,!0)),this.state_change;case"custom":return this.trigger("msg:custom",t.content,e.buffers),Promise.resolve()}return Promise.resolve()}set_state(e){this._state_lock=e;try{this.set(e)}catch(e){console.error(`Error setting state: ${e instanceof Error?e.message:e}`)}finally{this._state_lock=null}}get_state(e){const t=this.attributes;if(e){const e=this.defaults,n="function"==typeof e?e.call(this):e,i={};return Object.keys(t).forEach((e=>{a(t[e],n[e])||(i[e]=t[e])})),i}return Object.assign({},t)}_handle_status(e){if(void 0!==this.comm&&"idle"===e.content.execution_state&&(this._pending_msgs--,this._pending_msgs<0&&(console.error(`Jupyter Widgets message throttle: Pending messages < 0 (=${this._pending_msgs}), which is unexpected. Resetting to 0 to continue.`),this._pending_msgs=0),null!==this._msg_buffer&&this._pending_msgs<1)){const e=this.send_sync_message(this._msg_buffer,this._msg_buffer_callbacks);this.rememberLastUpdateFor(e),this._msg_buffer=null,this._msg_buffer_callbacks=null}}callbacks(e){return this.widget_manager.callbacks(e)}set(e,t,n){const i=v.call(this,e,t,n);if(void 0!==this._buffered_state_diff){const e=this.changedAttributes()||{};if(this._state_lock)for(const t of Object.keys(this._state_lock))e[t]===this._state_lock[t]&&delete e[t];if(this._buffered_state_diff_synced)for(const t of Object.keys(this._buffered_state_diff_synced))e[t]===this._buffered_state_diff_synced[t]&&delete e[t];this._buffered_state_diff=l(this._buffered_state_diff,e)}return!1===this._changing&&(this._buffered_state_diff_synced={}),i}sync(e,t,n={}){if(void 0===this.comm)throw"Syncing error: no comm channel defined";const i="patch"===e?n.attrs:t.get_state(n.drop_defaults);if(this._state_lock)for(const e of Object.keys(this._state_lock))i[e]===this._state_lock[e]&&delete i[e];Object.keys(i).forEach((e=>{this._attrsToUpdate.add(e)}));const r=this.serialize(i);if(Object.keys(r).length>0){const t=n.callbacks||this.callbacks();if(this._pending_msgs>=1){switch(e){case"patch":this._msg_buffer=l(this._msg_buffer||{},r);break;case"update":case"create":this._msg_buffer=r;break;default:throw"unrecognized syncing method"}this._msg_buffer_callbacks=t}else{const e=this.send_sync_message(i,t);this.rememberLastUpdateFor(e)}}}rememberLastUpdateFor(e){this._attrsToUpdate.forEach((t=>{this._expectedEchoMsgIds.set(t,e)})),this._attrsToUpdate=new Set}serialize(e){const t=this.constructor.serializers||i.JSONExt.emptyObject;for(const n of Object.keys(e))try{t[n]&&t[n].serialize?e[n]=t[n].serialize(e[n],this):e[n]=JSON.parse(JSON.stringify(e[n])),e[n]&&e[n].toJSON&&(e[n]=e[n].toJSON())}catch(e){throw console.error("Error serializing widget state attribute: ",n),e}return e}send_sync_message(e,t={}){if(!this.comm)return"";try{const n=(t={shell:Object.assign({},t.shell),iopub:Object.assign({},t.iopub),input:t.input}).iopub.status;t.iopub.status=e=>{this._handle_status(e),n&&n(e)};const i=f(e),r=this.comm.send({method:"update",state:i.state,buffer_paths:i.buffer_paths},t,{},i.buffers);return this._pending_msgs++,r}catch(e){console.error("Could not send widget sync message",e)}return""}save_changes(e){if(this.comm_live){const t={patch:!0};e&&(t.callbacks=e),this.save(this._buffered_state_diff,t),this._changing&&l(this._buffered_state_diff_synced,this._buffered_state_diff),this._buffered_state_diff={}}}on_some_change(e,t,n){this.on("change",((...i)=>{e.some(this.hasChanged,this)&&t.apply(n,i)}),this)}toJSON(e){return`IPY_MODEL_${this.model_id}`}static _deserialize_state(e,t){const n=this.serializers;let i;if(n){i={};for(const r in e)n[r]&&n[r].deserialize?i[r]=n[r].deserialize(e[r],t):i[r]=e[r]}else i=e;return u(i)}}class j extends M{defaults(){return l(super.defaults(),{_dom_classes:[],tabbable:null,tooltip:null})}}j.serializers=Object.assign(Object.assign({},M.serializers),{layout:{deserialize:k},style:{deserialize:k}});class O extends C{constructor(e){super(e)}initialize(e){this.listenTo(this.model,"change",((e,t)=>{const n=Object.keys(this.model.changedAttributes()||{});"_view_count"===n[0]&&1===n.length||this.update(t)})),this.options=e.options,this.once("remove",(()=>{"number"==typeof this.model.get("_view_count")&&(this.model.set("_view_count",this.model.get("_view_count")-1),this.model.save_changes())})),this.once("displayed",(()=>{"number"==typeof this.model.get("_view_count")&&(this.model.set("_view_count",this.model.get("_view_count")+1),this.model.save_changes())})),this.displayed=new Promise(((e,t)=>{this.once("displayed",e),this.model.on("msg:custom",this.handle_message.bind(this))}))}handle_message(e){"focus"===e.do?this.el.focus():"blur"===e.do&&this.el.blur()}update(e){}render(){}create_child_view(e,t={}){return t=Object.assign({parent:this},t),this.model.widget_manager.create_view(e,t).catch(c("Could not create child view",!0))}callbacks(){return this.model.callbacks(this)}send(e,t){this.model.send(e,this.callbacks(),t)}touch(){this.model.save_changes(this.callbacks())}remove(){return super.remove(),this.trigger("remove"),this}}class I extends x.x0{constructor(e){const t=e.view;delete e.view,super(e),this._view=t}dispose(){this.isDisposed||(super.dispose(),this._view.remove(),this._view=null)}processMessage(e){super.processMessage(e),this._view.processLuminoMessage(e)}}const P=I;class R extends x.Zk{constructor(e){const t=e.view;delete e.view,super(e),this._view=t}processMessage(e){super.processMessage(e),this._view.processLuminoMessage(e)}dispose(){var e;this.isDisposed||(super.dispose(),null===(e=this._view)||void 0===e||e.remove(),this._view=null)}}class L extends O{initialize(e){super.initialize(e),this.listenTo(this.model,"change:_dom_classes",((e,t)=>{const n=e.previous("_dom_classes");this.update_classes(n,t)})),this.layoutPromise=Promise.resolve(),this.listenTo(this.model,"change:layout",((e,t)=>{this.setLayout(t,e.previous("layout"))})),this.stylePromise=Promise.resolve(),this.listenTo(this.model,"change:style",((e,t)=>{this.setStyle(t,e.previous("style"))})),this.displayed.then((()=>{this.update_classes([],this.model.get("_dom_classes")),this.setLayout(this.model.get("layout")),this.setStyle(this.model.get("style"))})),this._comm_live_update(),this.listenTo(this.model,"comm_live_update",(()=>{this._comm_live_update()})),this.listenTo(this.model,"change:tooltip",this.updateTooltip),this.updateTooltip()}setLayout(e,t){e&&(this.layoutPromise=this.layoutPromise.then((t=>(t&&(t.unlayout(),this.stopListening(t.model),t.remove()),this.create_child_view(e).then((e=>this.displayed.then((()=>(e.trigger("displayed"),this.listenTo(e.model,"change",(()=>{E.Mu.postMessage(this.luminoWidget,x.x0.ResizeMessage.UnknownSize)})),E.Mu.postMessage(this.luminoWidget,x.x0.ResizeMessage.UnknownSize),this.trigger("layout-changed"),e))))).catch(c("Could not add LayoutView to DOMWidgetView",!0))))))}setStyle(e,t){e&&(this.stylePromise=this.stylePromise.then((t=>(t&&(t.unstyle(),this.stopListening(t.model),t.remove()),this.create_child_view(e).then((e=>this.displayed.then((()=>(e.trigger("displayed"),this.trigger("style-changed"),e))))).catch(c("Could not add styleView to DOMWidgetView",!0))))))}updateTooltip(){const e=this.model.get("tooltip");e?0===this.model.get("description").length&&this.el.setAttribute("title",e):this.el.removeAttribute("title")}update_classes(e,t,n){void 0===n&&(n=this.el),o(e,t).map((function(e){n.classList?n.classList.remove(e):n.setAttribute("class",n.getAttribute("class").replace(e,""))})),o(t,e).map((function(e){n.classList?n.classList.add(e):n.setAttribute("class",n.getAttribute("class").concat(" ",e))}))}update_mapped_classes(e,t,n){let i=this.model.previous(t);const r=e[i]?e[i]:[];i=this.model.get(t);const s=e[i]?e[i]:[];this.update_classes(r,s,n||this.el)}set_mapped_classes(e,t,n){const i=this.model.get(t),r=e[i]?e[i]:[];this.update_classes([],r,n||this.el)}_setElement(e){this.luminoWidget&&this.luminoWidget.dispose(),this.$el=e instanceof y()?e:y()(e),this.el=this.$el[0],this.luminoWidget=new I({node:e,view:this})}remove(){return this.luminoWidget&&this.luminoWidget.dispose(),super.remove()}processLuminoMessage(e){switch(e.type){case"after-attach":this.trigger("displayed");break;case"show":this.trigger("shown")}}_comm_live_update(){this.model.comm_live?this.luminoWidget.removeClass("jupyter-widgets-disconnected"):this.luminoWidget.addClass("jupyter-widgets-disconnected")}updateTabindex(){const e=this.model.get("tabbable");!0===e?this.el.setAttribute("tabIndex","0"):!1===e?this.el.setAttribute("tabIndex","-1"):null===e&&this.el.removeAttribute("tabIndex")}get pWidget(){return this.luminoWidget}}const N={align_content:null,align_items:null,align_self:null,border_top:null,border_right:null,border_bottom:null,border_left:null,bottom:null,display:null,flex:null,flex_flow:null,height:null,justify_content:null,justify_items:null,left:null,margin:null,max_height:null,max_width:null,min_height:null,min_width:null,overflow:null,order:null,padding:null,right:null,top:null,visibility:null,width:null,object_fit:null,object_position:null,grid_auto_columns:null,grid_auto_flow:null,grid_auto_rows:null,grid_gap:null,grid_template_rows:null,grid_template_columns:null,grid_template_areas:null,grid_row:null,grid_column:null,grid_area:null};class F extends M{defaults(){return l(super.defaults(),{_model_name:"LayoutModel",_view_name:"LayoutView"},N)}}class z extends O{initialize(e){this._traitNames=[],super.initialize(e);for(const e of Object.keys(N))this.registerTrait(e)}registerTrait(e){this._traitNames.push(e),this.listenTo(this.model,"change:"+e,((t,n)=>{this.handleChange(e,n)})),this.handleChange(e,this.model.get(e))}css_name(e){return e.replace(/_/g,"-")}handleChange(e,t){const n=this.options.parent;n?null===t?n.el.style.removeProperty(this.css_name(e)):n.el.style.setProperty(this.css_name(e),t):console.warn("Style not applied because a parent view does not exist")}unlayout(){const e=this.options.parent;this._traitNames.forEach((t=>{e?e.el.style.removeProperty(this.css_name(t)):console.warn("Style not removed because a parent view does not exist")}),this)}}class U extends M{defaults(){const e=this.constructor;return l(super.defaults(),{_model_name:"StyleModel",_view_name:"StyleView"},Object.keys(e.styleProperties).reduce(((t,n)=>(t[n]=e.styleProperties[n].default,t)),{}))}}U.styleProperties={};class W extends O{initialize(e){this._traitNames=[],super.initialize(e);const t=this.model.constructor;for(const e of Object.keys(t.styleProperties))this.registerTrait(e);this.style()}registerTrait(e){this._traitNames.push(e),this.listenTo(this.model,"change:"+e,((t,n)=>{this.handleChange(e,n)}))}handleChange(e,t){const n=this.options.parent;if(n){const i=this.model.constructor.styleProperties,r=i[e].attribute,s=i[e].selector,o=s?n.el.querySelectorAll(s):[n.el];if(null===t)for(let e=0;e!==o.length;++e)o[e].style.removeProperty(r);else for(let e=0;e!==o.length;++e)o[e].style.setProperty(r,t)}else console.warn("Style not applied because a parent view does not exist")}style(){for(const e of this._traitNames)this.handleChange(e,this.model.get(e))}unstyle(){const e=this.options.parent,t=this.model.constructor.styleProperties;this._traitNames.forEach((n=>{if(e){const i=t[n].attribute,r=t[n].selector,s=r?e.el.querySelectorAll(r):[e.el];for(let e=0;e!==s.length;++e)s[e].style.removeProperty(i)}else console.warn("Style not removed because a parent view does not exist")}),this)}}var H;!function(e){let t;!function(e){e.CommManager=class{constructor(e){this.targets=Object.create(null),this.comms=Object.create(null),this.init_kernel(e)}init_kernel(e){this.kernel=e,this.jsServicesKernel=e}async new_comm(e,n,i,r,s,o){const a=this.jsServicesKernel.createComm(e,s),l=new t(a);return this.register_comm(l),l.open(n,i,r,o),l}register_target(e,n){const i=this.jsServicesKernel.registerCommTarget(e,((e,i)=>{const r=new t(e);this.register_comm(r);try{return n(r,i)}catch(e){r.close(),console.error(e),console.error(new Error("Exception opening new comm"))}}));this.targets[e]=i}unregister_target(e,t){this.targets[e].dispose(),delete this.targets[e]}register_comm(e){return this.comms[e.comm_id]=Promise.resolve(e),e.kernel=this.kernel,e.comm_id}};class t{constructor(e){this.jsServicesComm=e}get comm_id(){return this.jsServicesComm.commId}get target_name(){return this.jsServicesComm.targetName}open(e,t,n,i){const r=this.jsServicesComm.open(e,n,i);return this._hookupCallbacks(r,t),r.msg.header.msg_id}send(e,t,n,i){const r=this.jsServicesComm.send(e,n,i);return this._hookupCallbacks(r,t),r.msg.header.msg_id}close(e,t,n,i){const r=this.jsServicesComm.close(e,n,i);return this._hookupCallbacks(r,t),r.msg.header.msg_id}on_msg(e){this.jsServicesComm.onMsg=e.bind(this)}on_close(e){this.jsServicesComm.onClose=e.bind(this)}_hookupCallbacks(e,t){t&&(e.onReply=function(e){t.shell&&t.shell.reply&&t.shell.reply(e)},e.onStdin=function(e){t.input&&t.input(e)},e.onIOPub=function(e){if(t.iopub)if(t.iopub.status&&"status"===e.header.msg_type)t.iopub.status(e);else if(t.iopub.clear_output&&"clear_output"===e.header.msg_type)t.iopub.clear_output(e);else if(t.iopub.output)switch(e.header.msg_type){case"display_data":case"execute_result":case"stream":case"error":t.iopub.output(e)}})}}e.Comm=t}(t=e.services||(e.services={}))}(H||(H={}));class V{constructor(e,t,n){this.initialize(e,t,n)}initialize(e,t,n){this._handler_context=n||this,this._models=[],this.views=[],this._create_view=e,this._remove_view=t||function(e){e.remove()}}update(e,t,n,i){const r=n||this._remove_view,s=t||this._create_view;i=i||this._handler_context;let o=0;for(;o=this._models.length||e[o]!==this._models[o]);o++);const a=o,l=this.views.splice(a,this.views.length-a);for(let e=0;e{e.forEach((e=>this._remove_view.call(this._handler_context,e))),this.views=[],this._models=[]}))}dispose(){this.views=null,this._models=null}}const $=new i.Token("jupyter.extensions.jupyterWidgetRegistry");function q(e,t){return class extends j{constructor(n,i){super(n=Object.assign(Object.assign({},n),{_view_name:"ErrorWidgetView",_view_module:"@jupyter-widgets/base",_model_module_version:D,_view_module_version:D,msg:t,error:e}),i),this.comm_live=!0}}}class G extends L{generateErrorMessage(){return{msg:this.model.get("msg"),stack:String(this.model.get("error").stack)}}render(){const{msg:e,stack:t}=this.generateErrorMessage();this.el.classList.add("jupyter-widgets");const n=document.createElement("div");n.classList.add("jupyter-widgets-error-widget","icon-error"),n.innerHTML=m;const i=document.createElement("pre");let r,s;i.style.textAlign="center",i.innerText="Click to show javascript error.",n.append(i),this.el.appendChild(n),this.el.onclick=()=>{n.classList.contains("icon-error")&&(s=s||n.clientHeight,r=r||n.clientWidth,n.classList.remove("icon-error"),n.innerHTML=`\n
[Open Browser Console for more detailed log - Double click to close this message]\n${e}\n${t}
\n `,n.style.height=`${s}px`,n.style.width=`${r}px`,n.classList.add("text-error"))},this.el.ondblclick=()=>{n.classList.contains("text-error")&&(n.classList.remove("text-error"),n.innerHTML=m,n.append(i),n.classList.add("icon-error"))}}}function K(e,t){return class extends G{generateErrorMessage(){return{msg:t,stack:String(e instanceof Error?e.stack:e)}}}}},7529:(e,t,n)=>{"use strict";n.d(t,{Us:()=>r,L1:()=>s,Ni:()=>o});var i=n(7998);const r="1.0.0";class s extends i.DOMWidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"OutputModel",_view_name:"OutputView",_model_module:"@jupyter-widgets/output",_view_module:"@jupyter-widgets/output",_model_module_version:r,_view_module_version:r})}}class o extends i.DOMWidgetView{}},1530:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.attributeNames=t.elementNames=void 0,t.elementNames=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map((function(e){return[e.toLowerCase(),e]}))),t.attributeNames=new Map(["definitionURL","attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map((function(e){return[e.toLowerCase(),e]})))},5552:function(e,t,n){"use strict";var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n");case a.Comment:return"\x3c!--".concat(e.data,"--\x3e");case a.CDATA:return function(e){return"")}(e);case a.Script:case a.Style:case a.Tag:return function(e,t){var n;"foreign"===t.xmlMode&&(e.name=null!==(n=d.elementNames.get(e.name))&&void 0!==n?n:e.name,e.parent&&f.has(e.parent.name)&&(t=i(i({},t),{xmlMode:!1}))),!t.xmlMode&&m.has(e.name)&&(t=i(i({},t),{xmlMode:"foreign"}));var r="<".concat(e.name),s=function(e,t){var n;if(e){var i=!1===(null!==(n=t.encodeEntities)&&void 0!==n?n:t.decodeEntities)?c:t.xmlMode||"utf8"!==t.encodeEntities?l.encodeXML:l.escapeAttribute;return Object.keys(e).map((function(n){var r,s,o=null!==(r=e[n])&&void 0!==r?r:"";return"foreign"===t.xmlMode&&(n=null!==(s=d.attributeNames.get(n))&&void 0!==s?s:n),t.emptyAttrs||t.xmlMode||""!==o?"".concat(n,'="').concat(i(o),'"'):n})).join(" ")}}(e.attribs,t);return s&&(r+=" ".concat(s)),0===e.children.length&&(t.xmlMode?!1!==t.selfClosingTags:t.selfClosingTags&&h.has(e.name))?(t.xmlMode||(r+=" "),r+="/>"):(r+=">",e.children.length>0&&(r+=p(e.children,t)),!t.xmlMode&&h.has(e.name)||(r+=""))),r}(e,t);case a.Text:return function(e,t){var n,i=e.data||"";return!1===(null!==(n=t.encodeEntities)&&void 0!==n?n:t.decodeEntities)||!t.xmlMode&&e.parent&&u.has(e.parent.name)||(i=t.xmlMode||"utf8"!==t.encodeEntities?(0,l.encodeXML)(i):(0,l.escapeText)(i)),i}(e,t)}}t.render=p,t.default=p;var f=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignObject","desc","title"]),m=new Set(["svg","math"])},2159:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.DomHandler=void 0;var s=n(3338),o=n(4879);r(n(4879),t);var a={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},l=function(){function e(e,t,n){this.dom=[],this.root=new o.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,"function"==typeof t&&(n=t,t=a),"object"==typeof e&&(t=e,e=void 0),this.callback=null!=e?e:null,this.options=null!=t?t:a,this.elementCB=null!=n?n:null}return e.prototype.onparserinit=function(e){this.parser=e},e.prototype.onreset=function(){this.dom=[],this.root=new o.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},e.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},e.prototype.onerror=function(e){this.handleCallback(e)},e.prototype.onclosetag=function(){this.lastNode=null;var e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)},e.prototype.onopentag=function(e,t){var n=this.options.xmlMode?s.ElementType.Tag:void 0,i=new o.Element(e,t,void 0,n);this.addNode(i),this.tagStack.push(i)},e.prototype.ontext=function(e){var t=this.lastNode;if(t&&t.type===s.ElementType.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{var n=new o.Text(e);this.addNode(n),this.lastNode=n}},e.prototype.oncomment=function(e){if(this.lastNode&&this.lastNode.type===s.ElementType.Comment)this.lastNode.data+=e;else{var t=new o.Comment(e);this.addNode(t),this.lastNode=t}},e.prototype.oncommentend=function(){this.lastNode=null},e.prototype.oncdatastart=function(){var e=new o.Text(""),t=new o.CDATA([e]);this.addNode(t),e.parent=t,this.lastNode=e},e.prototype.oncdataend=function(){this.lastNode=null},e.prototype.onprocessinginstruction=function(e,t){var n=new o.ProcessingInstruction(e,t);this.addNode(n)},e.prototype.handleCallback=function(e){if("function"==typeof this.callback)this.callback(e,this.dom);else if(e)throw e},e.prototype.addNode=function(e){var t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null},e}();t.DomHandler=l,t.default=l},4879:function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),t}(a);t.NodeWithChildren=h;var p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=o.ElementType.CDATA,t}return r(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),t}(h);t.CDATA=p;var g=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=o.ElementType.Root,t}return r(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),t}(h);t.Document=g;var f=function(e){function t(t,n,i,r){void 0===i&&(i=[]),void 0===r&&(r="script"===t?o.ElementType.Script:"style"===t?o.ElementType.Style:o.ElementType.Tag);var s=e.call(this,i)||this;return s.name=t,s.attribs=n,s.type=r,s}return r(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map((function(t){var n,i;return{name:t,value:e.attribs[t],namespace:null===(n=e["x-attribsNamespace"])||void 0===n?void 0:n[t],prefix:null===(i=e["x-attribsPrefix"])||void 0===i?void 0:i[t]}}))},enumerable:!1,configurable:!0}),t}(h);function m(e){return(0,o.isTag)(e)}function v(e){return e.type===o.ElementType.CDATA}function b(e){return e.type===o.ElementType.Text}function A(e){return e.type===o.ElementType.Comment}function y(e){return e.type===o.ElementType.Directive}function _(e){return e.type===o.ElementType.Root}function w(e,t){var n;if(void 0===t&&(t=!1),b(e))n=new d(e.data);else if(A(e))n=new u(e.data);else if(m(e)){var i=t?C(e.children):[],r=new f(e.name,s({},e.attribs),i);i.forEach((function(e){return e.parent=r})),null!=e.namespace&&(r.namespace=e.namespace),e["x-attribsNamespace"]&&(r["x-attribsNamespace"]=s({},e["x-attribsNamespace"])),e["x-attribsPrefix"]&&(r["x-attribsPrefix"]=s({},e["x-attribsPrefix"])),n=r}else if(v(e)){i=t?C(e.children):[];var o=new p(i);i.forEach((function(e){return e.parent=o})),n=o}else if(_(e)){i=t?C(e.children):[];var a=new g(i);i.forEach((function(e){return e.parent=a})),e["x-mode"]&&(a["x-mode"]=e["x-mode"]),n=a}else{if(!y(e))throw new Error("Not implemented yet: ".concat(e.type));var l=new c(e.name,e.data);null!=e["x-name"]&&(l["x-name"]=e["x-name"],l["x-publicId"]=e["x-publicId"],l["x-systemId"]=e["x-systemId"]),n=l}return n.startIndex=e.startIndex,n.endIndex=e.endIndex,null!=e.sourceCodeLocation&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function C(e){for(var t=e.map((function(e){return w(e,!0)})),n=1;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFeed=void 0;var i=n(1523),r=n(2839);t.getFeed=function(e){var t=l(c,e);return t?"feed"===t.name?function(e){var t,n=e.children,i={type:"atom",items:(0,r.getElementsByTagName)("entry",n).map((function(e){var t,n=e.children,i={media:a(n)};u(i,"id","id",n),u(i,"title","title",n);var r=null===(t=l("link",n))||void 0===t?void 0:t.attribs.href;r&&(i.link=r);var s=d("summary",n)||d("content",n);s&&(i.description=s);var o=d("updated",n);return o&&(i.pubDate=new Date(o)),i}))};u(i,"id","id",n),u(i,"title","title",n);var s=null===(t=l("link",n))||void 0===t?void 0:t.attribs.href;s&&(i.link=s),u(i,"description","subtitle",n);var o=d("updated",n);return o&&(i.updated=new Date(o)),u(i,"author","email",n,!0),i}(t):function(e){var t,n,i=null!==(n=null===(t=l("channel",e.children))||void 0===t?void 0:t.children)&&void 0!==n?n:[],s={type:e.name.substr(0,3),id:"",items:(0,r.getElementsByTagName)("item",e.children).map((function(e){var t=e.children,n={media:a(t)};u(n,"id","guid",t),u(n,"title","title",t),u(n,"link","link",t),u(n,"description","description",t);var i=d("pubDate",t)||d("dc:date",t);return i&&(n.pubDate=new Date(i)),n}))};u(s,"title","title",i),u(s,"link","link",i),u(s,"description","description",i);var o=d("lastBuildDate",i);return o&&(s.updated=new Date(o)),u(s,"author","managingEditor",i,!0),s}(t):null};var s=["url","type","lang"],o=["fileSize","bitrate","framerate","samplingrate","channels","duration","height","width"];function a(e){return(0,r.getElementsByTagName)("media:content",e).map((function(e){for(var t=e.attribs,n={medium:t.medium,isDefault:!!t.isDefault},i=0,r=s;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uniqueSort=t.compareDocumentPosition=t.DocumentPosition=t.removeSubsets=void 0;var i,r=n(2159);function s(e,t){var n=[],s=[];if(e===t)return 0;for(var o=(0,r.hasChildren)(e)?e:e.parent;o;)n.unshift(o),o=o.parent;for(o=(0,r.hasChildren)(t)?t:t.parent;o;)s.unshift(o),o=o.parent;for(var a=Math.min(n.length,s.length),l=0;lu.indexOf(h)?d===t?i.FOLLOWING|i.CONTAINED_BY:i.FOLLOWING:d===e?i.PRECEDING|i.CONTAINS:i.PRECEDING}t.removeSubsets=function(e){for(var t=e.length;--t>=0;){var n=e[t];if(t>0&&e.lastIndexOf(n,t-1)>=0)e.splice(t,1);else for(var i=n.parent;i;i=i.parent)if(e.includes(i)){e.splice(t,1);break}}return e},function(e){e[e.DISCONNECTED=1]="DISCONNECTED",e[e.PRECEDING=2]="PRECEDING",e[e.FOLLOWING=4]="FOLLOWING",e[e.CONTAINS=8]="CONTAINS",e[e.CONTAINED_BY=16]="CONTAINED_BY"}(i=t.DocumentPosition||(t.DocumentPosition={})),t.compareDocumentPosition=s,t.uniqueSort=function(e){return(e=e.filter((function(e,t,n){return!n.includes(e,t+1)}))).sort((function(e,t){var n=s(e,t);return n&i.PRECEDING?-1:n&i.FOLLOWING?1:0})),e}},9086:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.hasChildren=t.isDocument=t.isComment=t.isText=t.isCDATA=t.isTag=void 0,r(n(1523),t),r(n(4484),t),r(n(7549),t),r(n(1480),t),r(n(2839),t),r(n(2591),t),r(n(2615),t);var s=n(2159);Object.defineProperty(t,"isTag",{enumerable:!0,get:function(){return s.isTag}}),Object.defineProperty(t,"isCDATA",{enumerable:!0,get:function(){return s.isCDATA}}),Object.defineProperty(t,"isText",{enumerable:!0,get:function(){return s.isText}}),Object.defineProperty(t,"isComment",{enumerable:!0,get:function(){return s.isComment}}),Object.defineProperty(t,"isDocument",{enumerable:!0,get:function(){return s.isDocument}}),Object.defineProperty(t,"hasChildren",{enumerable:!0,get:function(){return s.hasChildren}})},2839:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getElementsByTagType=t.getElementsByTagName=t.getElementById=t.getElements=t.testElement=void 0;var i=n(2159),r=n(1480),s={tag_name:function(e){return"function"==typeof e?function(t){return(0,i.isTag)(t)&&e(t.name)}:"*"===e?i.isTag:function(t){return(0,i.isTag)(t)&&t.name===e}},tag_type:function(e){return"function"==typeof e?function(t){return e(t.type)}:function(t){return t.type===e}},tag_contains:function(e){return"function"==typeof e?function(t){return(0,i.isText)(t)&&e(t.data)}:function(t){return(0,i.isText)(t)&&t.data===e}}};function o(e,t){return"function"==typeof t?function(n){return(0,i.isTag)(n)&&t(n.attribs[e])}:function(n){return(0,i.isTag)(n)&&n.attribs[e]===t}}function a(e,t){return function(n){return e(n)||t(n)}}function l(e){var t=Object.keys(e).map((function(t){var n=e[t];return Object.prototype.hasOwnProperty.call(s,t)?s[t](n):o(t,n)}));return 0===t.length?null:t.reduce(a)}t.testElement=function(e,t){var n=l(e);return!n||n(t)},t.getElements=function(e,t,n,i){void 0===i&&(i=1/0);var s=l(e);return s?(0,r.filter)(s,t,n,i):[]},t.getElementById=function(e,t,n){return void 0===n&&(n=!0),Array.isArray(t)||(t=[t]),(0,r.findOne)(o("id",e),t,n)},t.getElementsByTagName=function(e,t,n,i){return void 0===n&&(n=!0),void 0===i&&(i=1/0),(0,r.filter)(s.tag_name(e),t,n,i)},t.getElementsByTagType=function(e,t,n,i){return void 0===n&&(n=!0),void 0===i&&(i=1/0),(0,r.filter)(s.tag_type(e),t,n,i)}},7549:(e,t)=>{"use strict";function n(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){var t=e.parent.children,n=t.lastIndexOf(e);n>=0&&t.splice(n,1)}e.next=null,e.prev=null,e.parent=null}Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=t.prependChild=t.append=t.appendChild=t.replaceElement=t.removeElement=void 0,t.removeElement=n,t.replaceElement=function(e,t){var n=t.prev=e.prev;n&&(n.next=t);var i=t.next=e.next;i&&(i.prev=t);var r=t.parent=e.parent;if(r){var s=r.children;s[s.lastIndexOf(e)]=t,e.parent=null}},t.appendChild=function(e,t){if(n(t),t.next=null,t.parent=e,e.children.push(t)>1){var i=e.children[e.children.length-2];i.next=t,t.prev=i}else t.prev=null},t.append=function(e,t){n(t);var i=e.parent,r=e.next;if(t.next=r,t.prev=e,e.next=t,t.parent=i,r){if(r.prev=t,i){var s=i.children;s.splice(s.lastIndexOf(r),0,t)}}else i&&i.children.push(t)},t.prependChild=function(e,t){if(n(t),t.parent=e,t.prev=null,1!==e.children.unshift(t)){var i=e.children[1];i.prev=t,t.next=i}else t.next=null},t.prepend=function(e,t){n(t);var i=e.parent;if(i){var r=i.children;r.splice(r.indexOf(e),0,t)}e.prev&&(e.prev.next=t),t.parent=i,t.prev=e.prev,t.next=e,e.prev=t}},1480:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findAll=t.existsOne=t.findOne=t.findOneChild=t.find=t.filter=void 0;var i=n(2159);function r(e,t,n,r){for(var s=[],o=[t],a=[0];;)if(a[0]>=o[0].length){if(1===a.length)return s;o.shift(),a.shift()}else{var l=o[0][a[0]++];if(e(l)&&(s.push(l),--r<=0))return s;n&&(0,i.hasChildren)(l)&&l.children.length>0&&(a.unshift(0),o.unshift(l.children))}}t.filter=function(e,t,n,i){return void 0===n&&(n=!0),void 0===i&&(i=1/0),r(e,Array.isArray(t)?t:[t],n,i)},t.find=r,t.findOneChild=function(e,t){return t.find(e)},t.findOne=function e(t,n,r){void 0===r&&(r=!0);for(var s=null,o=0;o0&&(s=e(t,a.children,!0)))}return s},t.existsOne=function e(t,n){return n.some((function(n){return(0,i.isTag)(n)&&(t(n)||e(t,n.children))}))},t.findAll=function(e,t){for(var n=[],r=[t],s=[0];;)if(s[0]>=r[0].length){if(1===r.length)return n;r.shift(),s.shift()}else{var o=r[0][s[0]++];(0,i.isTag)(o)&&(e(o)&&n.push(o),o.children.length>0&&(s.unshift(0),r.unshift(o.children)))}}},1523:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.innerText=t.textContent=t.getText=t.getInnerHTML=t.getOuterHTML=void 0;var r=n(2159),s=i(n(5552)),o=n(3338);function a(e,t){return(0,s.default)(e,t)}t.getOuterHTML=a,t.getInnerHTML=function(e,t){return(0,r.hasChildren)(e)?e.children.map((function(e){return a(e,t)})).join(""):""},t.getText=function e(t){return Array.isArray(t)?t.map(e).join(""):(0,r.isTag)(t)?"br"===t.name?"\n":e(t.children):(0,r.isCDATA)(t)?e(t.children):(0,r.isText)(t)?t.data:""},t.textContent=function e(t){return Array.isArray(t)?t.map(e).join(""):(0,r.hasChildren)(t)&&!(0,r.isComment)(t)?e(t.children):(0,r.isText)(t)?t.data:""},t.innerText=function e(t){return Array.isArray(t)?t.map(e).join(""):(0,r.hasChildren)(t)&&(t.type===o.ElementType.Tag||(0,r.isCDATA)(t))?e(t.children):(0,r.isText)(t)?t.data:""}},4484:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prevElementSibling=t.nextElementSibling=t.getName=t.hasAttrib=t.getAttributeValue=t.getSiblings=t.getParent=t.getChildren=void 0;var i=n(2159);function r(e){return(0,i.hasChildren)(e)?e.children:[]}function s(e){return e.parent||null}t.getChildren=r,t.getParent=s,t.getSiblings=function(e){var t=s(e);if(null!=t)return r(t);for(var n=[e],i=e.prev,o=e.next;null!=i;)n.unshift(i),i=i.prev;for(;null!=o;)n.push(o),o=o.next;return n},t.getAttributeValue=function(e,t){var n;return null===(n=e.attribs)||void 0===n?void 0:n[t]},t.hasAttrib=function(e,t){return null!=e.attribs&&Object.prototype.hasOwnProperty.call(e.attribs,t)&&null!=e.attribs[t]},t.getName=function(e){return e.name},t.nextElementSibling=function(e){for(var t=e.next;null!==t&&!(0,i.isTag)(t);)t=t.next;return t},t.prevElementSibling=function(e){for(var t=e.prev;null!==t&&!(0,i.isTag)(t);)t=t.prev;return t}},4896:e=>{"use strict";e.exports=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}},2978:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Parser=void 0;var o=s(n(8544)),a=n(3379),l=new Set(["input","option","optgroup","select","button","datalist","textarea"]),d=new Set(["p"]),u=new Set(["thead","tbody"]),c=new Set(["dd","dt"]),h=new Set(["rt","rp"]),p=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",d],["h1",d],["h2",d],["h3",d],["h4",d],["h5",d],["h6",d],["select",l],["input",l],["output",l],["button",l],["datalist",l],["textarea",l],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",c],["dt",c],["address",d],["article",d],["aside",d],["blockquote",d],["details",d],["div",d],["dl",d],["fieldset",d],["figcaption",d],["figure",d],["footer",d],["form",d],["header",d],["hr",d],["main",d],["nav",d],["ol",d],["pre",d],["section",d],["table",d],["ul",d],["rt",h],["rp",h],["tbody",u],["tfoot",u]]),g=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),f=new Set(["math","svg"]),m=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),v=/\s|\//,b=function(){function e(e,t){var n,i,r,s,a;void 0===t&&(t={}),this.options=t,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.foreignContext=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=null!=e?e:{},this.lowerCaseTagNames=null!==(n=t.lowerCaseTags)&&void 0!==n?n:!t.xmlMode,this.lowerCaseAttributeNames=null!==(i=t.lowerCaseAttributeNames)&&void 0!==i?i:!t.xmlMode,this.tokenizer=new(null!==(r=t.Tokenizer)&&void 0!==r?r:o.default)(this.options,this),null===(a=(s=this.cbs).onparserinit)||void 0===a||a.call(s,this)}return e.prototype.ontext=function(e,t){var n,i,r=this.getSlice(e,t);this.endIndex=t-1,null===(i=(n=this.cbs).ontext)||void 0===i||i.call(n,r),this.startIndex=t},e.prototype.ontextentity=function(e){var t,n,i=this.tokenizer.getSectionStart();this.endIndex=i-1,null===(n=(t=this.cbs).ontext)||void 0===n||n.call(t,(0,a.fromCodePoint)(e)),this.startIndex=i},e.prototype.isVoidElement=function(e){return!this.options.xmlMode&&g.has(e)},e.prototype.onopentagname=function(e,t){this.endIndex=t;var n=this.getSlice(e,t);this.lowerCaseTagNames&&(n=n.toLowerCase()),this.emitOpenTag(n)},e.prototype.emitOpenTag=function(e){var t,n,i,r;this.openTagStart=this.startIndex,this.tagname=e;var s=!this.options.xmlMode&&p.get(e);if(s)for(;this.stack.length>0&&s.has(this.stack[this.stack.length-1]);){var o=this.stack.pop();null===(n=(t=this.cbs).onclosetag)||void 0===n||n.call(t,o,!0)}this.isVoidElement(e)||(this.stack.push(e),f.has(e)?this.foreignContext.push(!0):m.has(e)&&this.foreignContext.push(!1)),null===(r=(i=this.cbs).onopentagname)||void 0===r||r.call(i,e),this.cbs.onopentag&&(this.attribs={})},e.prototype.endOpenTag=function(e){var t,n;this.startIndex=this.openTagStart,this.attribs&&(null===(n=(t=this.cbs).onopentag)||void 0===n||n.call(t,this.tagname,this.attribs,e),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""},e.prototype.onopentagend=function(e){this.endIndex=e,this.endOpenTag(!1),this.startIndex=e+1},e.prototype.onclosetag=function(e,t){var n,i,r,s,o,a;this.endIndex=t;var l=this.getSlice(e,t);if(this.lowerCaseTagNames&&(l=l.toLowerCase()),(f.has(l)||m.has(l))&&this.foreignContext.pop(),this.isVoidElement(l))this.options.xmlMode||"br"!==l||(null===(i=(n=this.cbs).onopentagname)||void 0===i||i.call(n,"br"),null===(s=(r=this.cbs).onopentag)||void 0===s||s.call(r,"br",{},!0),null===(a=(o=this.cbs).onclosetag)||void 0===a||a.call(o,"br",!1));else{var d=this.stack.lastIndexOf(l);if(-1!==d)if(this.cbs.onclosetag)for(var u=this.stack.length-d;u--;)this.cbs.onclosetag(this.stack.pop(),0!==u);else this.stack.length=d;else this.options.xmlMode||"p"!==l||(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=t+1},e.prototype.onselfclosingtag=function(e){this.endIndex=e,this.options.xmlMode||this.options.recognizeSelfClosing||this.foreignContext[this.foreignContext.length-1]?(this.closeCurrentTag(!1),this.startIndex=e+1):this.onopentagend(e)},e.prototype.closeCurrentTag=function(e){var t,n,i=this.tagname;this.endOpenTag(e),this.stack[this.stack.length-1]===i&&(null===(n=(t=this.cbs).onclosetag)||void 0===n||n.call(t,i,!e),this.stack.pop())},e.prototype.onattribname=function(e,t){this.startIndex=e;var n=this.getSlice(e,t);this.attribname=this.lowerCaseAttributeNames?n.toLowerCase():n},e.prototype.onattribdata=function(e,t){this.attribvalue+=this.getSlice(e,t)},e.prototype.onattribentity=function(e){this.attribvalue+=(0,a.fromCodePoint)(e)},e.prototype.onattribend=function(e,t){var n,i;this.endIndex=t,null===(i=(n=this.cbs).onattribute)||void 0===i||i.call(n,this.attribname,this.attribvalue,e===o.QuoteType.Double?'"':e===o.QuoteType.Single?"'":e===o.QuoteType.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""},e.prototype.getInstructionName=function(e){var t=e.search(v),n=t<0?e:e.substr(0,t);return this.lowerCaseTagNames&&(n=n.toLowerCase()),n},e.prototype.ondeclaration=function(e,t){this.endIndex=t;var n=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){var i=this.getInstructionName(n);this.cbs.onprocessinginstruction("!".concat(i),"!".concat(n))}this.startIndex=t+1},e.prototype.onprocessinginstruction=function(e,t){this.endIndex=t;var n=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){var i=this.getInstructionName(n);this.cbs.onprocessinginstruction("?".concat(i),"?".concat(n))}this.startIndex=t+1},e.prototype.oncomment=function(e,t,n){var i,r,s,o;this.endIndex=t,null===(r=(i=this.cbs).oncomment)||void 0===r||r.call(i,this.getSlice(e,t-n)),null===(o=(s=this.cbs).oncommentend)||void 0===o||o.call(s),this.startIndex=t+1},e.prototype.oncdata=function(e,t,n){var i,r,s,o,a,l,d,u,c,h;this.endIndex=t;var p=this.getSlice(e,t-n);this.options.xmlMode||this.options.recognizeCDATA?(null===(r=(i=this.cbs).oncdatastart)||void 0===r||r.call(i),null===(o=(s=this.cbs).ontext)||void 0===o||o.call(s,p),null===(l=(a=this.cbs).oncdataend)||void 0===l||l.call(a)):(null===(u=(d=this.cbs).oncomment)||void 0===u||u.call(d,"[CDATA[".concat(p,"]]")),null===(h=(c=this.cbs).oncommentend)||void 0===h||h.call(c)),this.startIndex=t+1},e.prototype.onend=function(){var e,t;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(var n=this.stack.length;n>0;this.cbs.onclosetag(this.stack[--n],!0));}null===(t=(e=this.cbs).onend)||void 0===t||t.call(e)},e.prototype.reset=function(){var e,t,n,i;null===(t=(e=this.cbs).onreset)||void 0===t||t.call(e),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,null===(i=(n=this.cbs).onparserinit)||void 0===i||i.call(n,this),this.buffers.length=0,this.bufferOffset=0,this.writeIndex=0,this.ended=!1},e.prototype.parseComplete=function(e){this.reset(),this.end(e)},e.prototype.getSlice=function(e,t){for(;e-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();for(var n=this.buffers[0].slice(e-this.bufferOffset,t-this.bufferOffset);t-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),n+=this.buffers[0].slice(0,t-this.bufferOffset);return n},e.prototype.shiftBuffer=function(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()},e.prototype.write=function(e){var t,n;this.ended?null===(n=(t=this.cbs).onerror)||void 0===n||n.call(t,new Error(".write() after done!")):(this.buffers.push(e),this.tokenizer.running&&(this.tokenizer.write(e),this.writeIndex++))},e.prototype.end=function(e){var t,n;this.ended?null===(n=(t=this.cbs).onerror)||void 0===n||n.call(t,new Error(".end() after done!")):(e&&this.write(e),this.ended=!0,this.tokenizer.end())},e.prototype.pause=function(){this.tokenizer.pause()},e.prototype.resume=function(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QuoteType=void 0;var i,r,s,o=n(3379);function a(e){return e===i.Space||e===i.NewLine||e===i.Tab||e===i.FormFeed||e===i.CarriageReturn}function l(e){return e===i.Slash||e===i.Gt||a(e)}function d(e){return e>=i.Zero&&e<=i.Nine}!function(e){e[e.Tab=9]="Tab",e[e.NewLine=10]="NewLine",e[e.FormFeed=12]="FormFeed",e[e.CarriageReturn=13]="CarriageReturn",e[e.Space=32]="Space",e[e.ExclamationMark=33]="ExclamationMark",e[e.Number=35]="Number",e[e.Amp=38]="Amp",e[e.SingleQuote=39]="SingleQuote",e[e.DoubleQuote=34]="DoubleQuote",e[e.Dash=45]="Dash",e[e.Slash=47]="Slash",e[e.Zero=48]="Zero",e[e.Nine=57]="Nine",e[e.Semi=59]="Semi",e[e.Lt=60]="Lt",e[e.Eq=61]="Eq",e[e.Gt=62]="Gt",e[e.Questionmark=63]="Questionmark",e[e.UpperA=65]="UpperA",e[e.LowerA=97]="LowerA",e[e.UpperF=70]="UpperF",e[e.LowerF=102]="LowerF",e[e.UpperZ=90]="UpperZ",e[e.LowerZ=122]="LowerZ",e[e.LowerX=120]="LowerX",e[e.OpeningSquareBracket=91]="OpeningSquareBracket"}(i||(i={})),function(e){e[e.Text=1]="Text",e[e.BeforeTagName=2]="BeforeTagName",e[e.InTagName=3]="InTagName",e[e.InSelfClosingTag=4]="InSelfClosingTag",e[e.BeforeClosingTagName=5]="BeforeClosingTagName",e[e.InClosingTagName=6]="InClosingTagName",e[e.AfterClosingTagName=7]="AfterClosingTagName",e[e.BeforeAttributeName=8]="BeforeAttributeName",e[e.InAttributeName=9]="InAttributeName",e[e.AfterAttributeName=10]="AfterAttributeName",e[e.BeforeAttributeValue=11]="BeforeAttributeValue",e[e.InAttributeValueDq=12]="InAttributeValueDq",e[e.InAttributeValueSq=13]="InAttributeValueSq",e[e.InAttributeValueNq=14]="InAttributeValueNq",e[e.BeforeDeclaration=15]="BeforeDeclaration",e[e.InDeclaration=16]="InDeclaration",e[e.InProcessingInstruction=17]="InProcessingInstruction",e[e.BeforeComment=18]="BeforeComment",e[e.CDATASequence=19]="CDATASequence",e[e.InSpecialComment=20]="InSpecialComment",e[e.InCommentLike=21]="InCommentLike",e[e.BeforeSpecialS=22]="BeforeSpecialS",e[e.SpecialStartSequence=23]="SpecialStartSequence",e[e.InSpecialTag=24]="InSpecialTag",e[e.BeforeEntity=25]="BeforeEntity",e[e.BeforeNumericEntity=26]="BeforeNumericEntity",e[e.InNamedEntity=27]="InNamedEntity",e[e.InNumericEntity=28]="InNumericEntity",e[e.InHexEntity=29]="InHexEntity"}(r||(r={})),function(e){e[e.NoValue=0]="NoValue",e[e.Unquoted=1]="Unquoted",e[e.Single=2]="Single",e[e.Double=3]="Double"}(s=t.QuoteType||(t.QuoteType={}));var u={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101])},c=function(){function e(e,t){var n=e.xmlMode,i=void 0!==n&&n,s=e.decodeEntities,a=void 0===s||s;this.cbs=t,this.state=r.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=r.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.trieIndex=0,this.trieCurrent=0,this.entityResult=0,this.entityExcess=0,this.xmlMode=i,this.decodeEntities=a,this.entityTrie=i?o.xmlDecodeTree:o.htmlDecodeTree}return e.prototype.reset=function(){this.state=r.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=r.Text,this.currentSequence=void 0,this.running=!0,this.offset=0},e.prototype.write=function(e){this.offset+=this.buffer.length,this.buffer=e,this.parse()},e.prototype.end=function(){this.running&&this.finish()},e.prototype.pause=function(){this.running=!1},e.prototype.resume=function(){this.running=!0,this.indexthis.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=r.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===i.Amp&&(this.state=r.BeforeEntity)},e.prototype.stateSpecialStartSequence=function(e){var t=this.sequenceIndex===this.currentSequence.length;if(t?l(e):(32|e)===this.currentSequence[this.sequenceIndex]){if(!t)return void this.sequenceIndex++}else this.isSpecial=!1;this.sequenceIndex=0,this.state=r.InTagName,this.stateInTagName(e)},e.prototype.stateInSpecialTag=function(e){if(this.sequenceIndex===this.currentSequence.length){if(e===i.Gt||a(e)){var t=this.index-this.currentSequence.length;if(this.sectionStart=i.LowerA&&e<=i.LowerZ||e>=i.UpperA&&e<=i.UpperZ}(e)},e.prototype.startSpecial=function(e,t){this.isSpecial=!0,this.currentSequence=e,this.sequenceIndex=t,this.state=r.SpecialStartSequence},e.prototype.stateBeforeTagName=function(e){if(e===i.ExclamationMark)this.state=r.BeforeDeclaration,this.sectionStart=this.index+1;else if(e===i.Questionmark)this.state=r.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(e)){var t=32|e;this.sectionStart=this.index,this.xmlMode||t!==u.TitleEnd[2]?this.state=this.xmlMode||t!==u.ScriptEnd[2]?r.InTagName:r.BeforeSpecialS:this.startSpecial(u.TitleEnd,3)}else e===i.Slash?this.state=r.BeforeClosingTagName:(this.state=r.Text,this.stateText(e))},e.prototype.stateInTagName=function(e){l(e)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=r.BeforeAttributeName,this.stateBeforeAttributeName(e))},e.prototype.stateBeforeClosingTagName=function(e){a(e)||(e===i.Gt?this.state=r.Text:(this.state=this.isTagStartChar(e)?r.InClosingTagName:r.InSpecialComment,this.sectionStart=this.index))},e.prototype.stateInClosingTagName=function(e){(e===i.Gt||a(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=r.AfterClosingTagName,this.stateAfterClosingTagName(e))},e.prototype.stateAfterClosingTagName=function(e){(e===i.Gt||this.fastForwardTo(i.Gt))&&(this.state=r.Text,this.baseState=r.Text,this.sectionStart=this.index+1)},e.prototype.stateBeforeAttributeName=function(e){e===i.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=r.InSpecialTag,this.sequenceIndex=0):this.state=r.Text,this.baseState=this.state,this.sectionStart=this.index+1):e===i.Slash?this.state=r.InSelfClosingTag:a(e)||(this.state=r.InAttributeName,this.sectionStart=this.index)},e.prototype.stateInSelfClosingTag=function(e){e===i.Gt?(this.cbs.onselfclosingtag(this.index),this.state=r.Text,this.baseState=r.Text,this.sectionStart=this.index+1,this.isSpecial=!1):a(e)||(this.state=r.BeforeAttributeName,this.stateBeforeAttributeName(e))},e.prototype.stateInAttributeName=function(e){(e===i.Eq||l(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=-1,this.state=r.AfterAttributeName,this.stateAfterAttributeName(e))},e.prototype.stateAfterAttributeName=function(e){e===i.Eq?this.state=r.BeforeAttributeValue:e===i.Slash||e===i.Gt?(this.cbs.onattribend(s.NoValue,this.index),this.state=r.BeforeAttributeName,this.stateBeforeAttributeName(e)):a(e)||(this.cbs.onattribend(s.NoValue,this.index),this.state=r.InAttributeName,this.sectionStart=this.index)},e.prototype.stateBeforeAttributeValue=function(e){e===i.DoubleQuote?(this.state=r.InAttributeValueDq,this.sectionStart=this.index+1):e===i.SingleQuote?(this.state=r.InAttributeValueSq,this.sectionStart=this.index+1):a(e)||(this.sectionStart=this.index,this.state=r.InAttributeValueNq,this.stateInAttributeValueNoQuotes(e))},e.prototype.handleInAttributeValue=function(e,t){e===t||!this.decodeEntities&&this.fastForwardTo(t)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(t===i.DoubleQuote?s.Double:s.Single,this.index),this.state=r.BeforeAttributeName):this.decodeEntities&&e===i.Amp&&(this.baseState=this.state,this.state=r.BeforeEntity)},e.prototype.stateInAttributeValueDoubleQuotes=function(e){this.handleInAttributeValue(e,i.DoubleQuote)},e.prototype.stateInAttributeValueSingleQuotes=function(e){this.handleInAttributeValue(e,i.SingleQuote)},e.prototype.stateInAttributeValueNoQuotes=function(e){a(e)||e===i.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(s.Unquoted,this.index),this.state=r.BeforeAttributeName,this.stateBeforeAttributeName(e)):this.decodeEntities&&e===i.Amp&&(this.baseState=this.state,this.state=r.BeforeEntity)},e.prototype.stateBeforeDeclaration=function(e){e===i.OpeningSquareBracket?(this.state=r.CDATASequence,this.sequenceIndex=0):this.state=e===i.Dash?r.BeforeComment:r.InDeclaration},e.prototype.stateInDeclaration=function(e){(e===i.Gt||this.fastForwardTo(i.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=r.Text,this.sectionStart=this.index+1)},e.prototype.stateInProcessingInstruction=function(e){(e===i.Gt||this.fastForwardTo(i.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=r.Text,this.sectionStart=this.index+1)},e.prototype.stateBeforeComment=function(e){e===i.Dash?(this.state=r.InCommentLike,this.currentSequence=u.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=r.InDeclaration},e.prototype.stateInSpecialComment=function(e){(e===i.Gt||this.fastForwardTo(i.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=r.Text,this.sectionStart=this.index+1)},e.prototype.stateBeforeSpecialS=function(e){var t=32|e;t===u.ScriptEnd[3]?this.startSpecial(u.ScriptEnd,4):t===u.StyleEnd[3]?this.startSpecial(u.StyleEnd,4):(this.state=r.InTagName,this.stateInTagName(e))},e.prototype.stateBeforeEntity=function(e){this.entityExcess=1,this.entityResult=0,e===i.Number?this.state=r.BeforeNumericEntity:e===i.Amp||(this.trieIndex=0,this.trieCurrent=this.entityTrie[0],this.state=r.InNamedEntity,this.stateInNamedEntity(e))},e.prototype.stateInNamedEntity=function(e){if(this.entityExcess+=1,this.trieIndex=(0,o.determineBranch)(this.entityTrie,this.trieCurrent,this.trieIndex+1,e),this.trieIndex<0)return this.emitNamedEntity(),void this.index--;this.trieCurrent=this.entityTrie[this.trieIndex];var t=this.trieCurrent&o.BinTrieFlags.VALUE_LENGTH;if(t){var n=(t>>14)-1;if(this.allowLegacyEntity()||e===i.Semi){var r=this.index-this.entityExcess+1;r>this.sectionStart&&this.emitPartial(this.sectionStart,r),this.entityResult=this.trieIndex,this.trieIndex+=n,this.entityExcess=0,this.sectionStart=this.index+1,0===n&&this.emitNamedEntity()}else this.trieIndex+=n}},e.prototype.emitNamedEntity=function(){if(this.state=this.baseState,0!==this.entityResult)switch((this.entityTrie[this.entityResult]&o.BinTrieFlags.VALUE_LENGTH)>>14){case 1:this.emitCodePoint(this.entityTrie[this.entityResult]&~o.BinTrieFlags.VALUE_LENGTH);break;case 2:this.emitCodePoint(this.entityTrie[this.entityResult+1]);break;case 3:this.emitCodePoint(this.entityTrie[this.entityResult+1]),this.emitCodePoint(this.entityTrie[this.entityResult+2])}},e.prototype.stateBeforeNumericEntity=function(e){(32|e)===i.LowerX?(this.entityExcess++,this.state=r.InHexEntity):(this.state=r.InNumericEntity,this.stateInNumericEntity(e))},e.prototype.emitNumericEntity=function(e){var t=this.index-this.entityExcess-1;t+2+Number(this.state===r.InHexEntity)!==this.index&&(t>this.sectionStart&&this.emitPartial(this.sectionStart,t),this.sectionStart=this.index+Number(e),this.emitCodePoint((0,o.replaceCodePoint)(this.entityResult))),this.state=this.baseState},e.prototype.stateInNumericEntity=function(e){e===i.Semi?this.emitNumericEntity(!0):d(e)?(this.entityResult=10*this.entityResult+(e-i.Zero),this.entityExcess++):(this.allowLegacyEntity()?this.emitNumericEntity(!1):this.state=this.baseState,this.index--)},e.prototype.stateInHexEntity=function(e){e===i.Semi?this.emitNumericEntity(!0):d(e)?(this.entityResult=16*this.entityResult+(e-i.Zero),this.entityExcess++):function(e){return e>=i.UpperA&&e<=i.UpperF||e>=i.LowerA&&e<=i.LowerF}(e)?(this.entityResult=16*this.entityResult+((32|e)-i.LowerA+10),this.entityExcess++):(this.allowLegacyEntity()?this.emitNumericEntity(!1):this.state=this.baseState,this.index--)},e.prototype.allowLegacyEntity=function(){return!this.xmlMode&&(this.baseState===r.Text||this.baseState===r.InSpecialTag)},e.prototype.cleanup=function(){this.running&&this.sectionStart!==this.index&&(this.state===r.Text||this.state===r.InSpecialTag&&0===this.sequenceIndex?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):this.state!==r.InAttributeValueDq&&this.state!==r.InAttributeValueSq&&this.state!==r.InAttributeValueNq||(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))},e.prototype.shouldContinue=function(){return this.index{"use strict";function n(e){return"[object Object]"===Object.prototype.toString.call(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.isPlainObject=function(e){var t,i;return!1!==n(e)&&(void 0===(t=e.constructor)||!1!==n(i=t.prototype)&&!1!==i.hasOwnProperty("isPrototypeOf"))}},1622:(e,t,n)=>{const i=n(4493),r=n(4896),{isPlainObject:s}=n(9244),o=n(2743),a=n(8287),{parse:l}=n(1412),d=["img","audio","video","picture","svg","object","map","iframe","embed"],u=["script","style"];function c(e,t){e&&Object.keys(e).forEach((function(n){t(e[n],n)}))}function h(e,t){return{}.hasOwnProperty.call(e,t)}function p(e,t){const n=[];return c(e,(function(e){t(e)&&n.push(e)})),n}e.exports=f;const g=/^[^\0\t\n\f\r /<=>]+$/;function f(e,t,n){if(null==e)return"";"number"==typeof e&&(e=e.toString());let v="",b="";function A(e,t){const n=this;this.tag=e,this.attribs=t||{},this.tagPosition=v.length,this.text="",this.mediaChildren=[],this.updateParentNodeText=function(){B.length&&(B[B.length-1].text+=n.text)},this.updateParentNodeMediaChildren=function(){B.length&&d.includes(this.tag)&&B[B.length-1].mediaChildren.push(this.tag)}}(t=Object.assign({},f.defaults,t)).parser=Object.assign({},m,t.parser);const y=function(e){return!1===t.allowedTags||(t.allowedTags||[]).indexOf(e)>-1};u.forEach((function(e){y(e)&&!t.allowVulnerableTags&&console.warn(`\n\n⚠️ Your \`allowedTags\` option includes, \`${e}\`, which is inherently\nvulnerable to XSS attacks. Please remove it from \`allowedTags\`.\nOr, to disable this warning, add the \`allowVulnerableTags\` option\nand ensure you are accounting for this risk.\n\n`)}));const _=t.nonTextTags||["script","style","textarea","option"];let w,C;t.allowedAttributes&&(w={},C={},c(t.allowedAttributes,(function(e,t){w[t]=[];const n=[];e.forEach((function(e){"string"==typeof e&&e.indexOf("*")>=0?n.push(r(e).replace(/\\\*/g,".*")):w[t].push(e)})),n.length&&(C[t]=new RegExp("^("+n.join("|")+")$"))})));const E={},x={},D={};c(t.allowedClasses,(function(e,t){if(w&&(h(w,t)||(w[t]=[]),w[t].push("class")),E[t]=e,Array.isArray(e)){const n=[];E[t]=[],D[t]=[],e.forEach((function(e){"string"==typeof e&&e.indexOf("*")>=0?n.push(r(e).replace(/\\\*/g,".*")):e instanceof RegExp?D[t].push(e):E[t].push(e)})),n.length&&(x[t]=new RegExp("^("+n.join("|")+")$"))}}));const S={};let T,k,B,M,j,O,I;c(t.transformTags,(function(e,t){let n;"function"==typeof e?n=e:"string"==typeof e&&(n=f.simpleTransform(e)),"*"===t?T=n:S[t]=n}));let P=!1;L();const R=new i.Parser({onopentag:function(e,n){if(t.enforceHtmlBoundary&&"html"===e&&L(),O)return void I++;const i=new A(e,n);B.push(i);let r=!1;const d=!!i.text;let u;if(h(S,e)&&(u=S[e](e,n),i.attribs=n=u.attribs,void 0!==u.text&&(i.innerText=u.text),e!==u.tagName&&(i.name=e=u.tagName,j[k]=u.tagName)),T&&(u=T(e,n),i.attribs=n=u.attribs,e!==u.tagName&&(i.name=e=u.tagName,j[k]=u.tagName)),(!y(e)||"recursiveEscape"===t.disallowedTagsMode&&!function(e){for(const t in e)if(h(e,t))return!1;return!0}(M)||null!=t.nestingLimit&&k>=t.nestingLimit)&&(r=!0,M[k]=!0,"discard"===t.disallowedTagsMode&&-1!==_.indexOf(e)&&(O=!0,I=1),M[k]=!0),k++,r){if("discard"===t.disallowedTagsMode)return;b=v,v=""}v+="<"+e,"script"===e&&(t.allowedScriptHostnames||t.allowedScriptDomains)&&(i.innerText=""),(!w||h(w,e)||w["*"])&&c(n,(function(n,r){if(!g.test(r))return void delete i.attribs[r];if(""===n&&!t.allowedEmptyAttributes.includes(r)&&(t.nonBooleanAttributes.includes(r)||t.nonBooleanAttributes.includes("*")))return void delete i.attribs[r];let d=!1;if(!w||h(w,e)&&-1!==w[e].indexOf(r)||w["*"]&&-1!==w["*"].indexOf(r)||h(C,e)&&C[e].test(r)||C["*"]&&C["*"].test(r))d=!0;else if(w&&w[e])for(const t of w[e])if(s(t)&&t.name&&t.name===r){d=!0;let e="";if(!0===t.multiple){const i=n.split(" ");for(const n of i)-1!==t.values.indexOf(n)&&(""===e?e=n:e+=" "+n)}else t.values.indexOf(n)>=0&&(e=n);n=e}if(d){if(-1!==t.allowedSchemesAppliedToAttributes.indexOf(r)&&F(e,n))return void delete i.attribs[r];if("script"===e&&"src"===r){let e=!0;try{const i=z(n);if(t.allowedScriptHostnames||t.allowedScriptDomains){const n=(t.allowedScriptHostnames||[]).find((function(e){return e===i.url.hostname})),r=(t.allowedScriptDomains||[]).find((function(e){return i.url.hostname===e||i.url.hostname.endsWith(`.${e}`)}));e=n||r}}catch(t){e=!1}if(!e)return void delete i.attribs[r]}if("iframe"===e&&"src"===r){let e=!0;try{const i=z(n);if(i.isRelativeUrl)e=h(t,"allowIframeRelativeUrls")?t.allowIframeRelativeUrls:!t.allowedIframeHostnames&&!t.allowedIframeDomains;else if(t.allowedIframeHostnames||t.allowedIframeDomains){const n=(t.allowedIframeHostnames||[]).find((function(e){return e===i.url.hostname})),r=(t.allowedIframeDomains||[]).find((function(e){return i.url.hostname===e||i.url.hostname.endsWith(`.${e}`)}));e=n||r}}catch(t){e=!1}if(!e)return void delete i.attribs[r]}if("srcset"===r)try{let e=a(n);if(e.forEach((function(e){F("srcset",e.url)&&(e.evil=!0)})),e=p(e,(function(e){return!e.evil})),!e.length)return void delete i.attribs[r];n=p(e,(function(e){return!e.evil})).map((function(e){if(!e.url)throw new Error("URL missing");return e.url+(e.w?` ${e.w}w`:"")+(e.h?` ${e.h}h`:"")+(e.d?` ${e.d}x`:"")})).join(", "),i.attribs[r]=n}catch(e){return void delete i.attribs[r]}if("class"===r){const t=E[e],s=E["*"],a=x[e],l=D[e],d=[a,x["*"]].concat(l).filter((function(e){return e}));if(!(u=n,c=t&&s?o(t,s):t||s,f=d,n=c?(u=u.split(/\s+/)).filter((function(e){return-1!==c.indexOf(e)||f.some((function(t){return t.test(e)}))})).join(" "):u).length)return void delete i.attribs[r]}if("style"===r)if(t.parseStyleAttributes)try{if(n=function(e){return e.nodes[0].nodes.reduce((function(e,t){return e.push(`${t.prop}:${t.value}${t.important?" !important":""}`),e}),[]).join(";")}(function(e,t){if(!t)return e;const n=e.nodes[0];let i;return i=t[n.selector]&&t["*"]?o(t[n.selector],t["*"]):t[n.selector]||t["*"],i&&(e.nodes[0].nodes=n.nodes.reduce(function(e){return function(t,n){return h(e,n.prop)&&e[n.prop].some((function(e){return e.test(n.value)}))&&t.push(n),t}}(i),[])),e}(l(e+" {"+n+"}",{map:!1}),t.allowedStyles)),0===n.length)return void delete i.attribs[r]}catch(t){return"undefined"!=typeof window&&console.warn('Failed to parse "'+e+" {"+n+"}\", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547"),void delete i.attribs[r]}else if(t.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.");v+=" "+r,n&&n.length?v+='="'+N(n,!0)+'"':t.allowedEmptyAttributes.includes(r)&&(v+='=""')}else delete i.attribs[r];var u,c,f})),-1!==t.selfClosing.indexOf(e)?v+=" />":(v+=">",!i.innerText||d||t.textFilter||(v+=N(i.innerText),P=!0)),r&&(v=b+N(v),b="")},ontext:function(e){if(O)return;const n=B[B.length-1];let i;if(n&&(i=n.tag,e=void 0!==n.innerText?n.innerText:e),"discard"!==t.disallowedTagsMode||"script"!==i&&"style"!==i){const n=N(e,!1);t.textFilter&&!P?v+=t.textFilter(n,i):P||(v+=n)}else v+=e;B.length&&(B[B.length-1].text+=e)},onclosetag:function(e,n){if(O){if(I--,I)return;O=!1}const i=B.pop();if(!i)return;if(i.tag!==e)return void B.push(i);O=!!t.enforceHtmlBoundary&&"html"===e,k--;const r=M[k];if(r){if(delete M[k],"discard"===t.disallowedTagsMode)return void i.updateParentNodeText();b=v,v=""}j[k]&&(e=j[k],delete j[k]),t.exclusiveFilter&&t.exclusiveFilter(i)?v=v.substr(0,i.tagPosition):(i.updateParentNodeMediaChildren(),i.updateParentNodeText(),-1!==t.selfClosing.indexOf(e)||n&&!y(e)&&["escape","recursiveEscape"].indexOf(t.disallowedTagsMode)>=0?r&&(v=b,b=""):(v+="",r&&(v=b+N(v),b=""),P=!1))}},t.parser);return R.write(e),R.end(),v;function L(){v="",k=0,B=[],M={},j={},O=!1,I=0}function N(e,n){return"string"!=typeof e&&(e+=""),t.parser.decodeEntities&&(e=e.replace(/&/g,"&").replace(//g,">"),n&&(e=e.replace(/"/g,"""))),e=e.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&").replace(//g,">"),n&&(e=e.replace(/"/g,""")),e}function F(e,n){for(n=n.replace(/[\x00-\x20]+/g,"");;){const e=n.indexOf("\x3c!--");if(-1===e)break;const t=n.indexOf("--\x3e",e+4);if(-1===t)break;n=n.substring(0,e)+n.substring(t+3)}const i=n.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!i)return!!n.match(/^[/\\]{2}/)&&!t.allowProtocolRelative;const r=i[1].toLowerCase();return h(t.allowedSchemesByTag,e)?-1===t.allowedSchemesByTag[e].indexOf(r):!t.allowedSchemes||-1===t.allowedSchemes.indexOf(r)}function z(e){if((e=e.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//")).startsWith("relative:"))throw new Error("relative: exploit attempt");let t="relative://relative-site";for(let e=0;e<100;e++)t+=`/${e}`;const n=new URL(e,t);return{isRelativeUrl:n&&"relative-site"===n.hostname&&"relative:"===n.protocol,url:n}}}const m={decodeEntities:!0};f.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","main","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0},f.simpleTransform=function(e,t,n){return n=void 0===n||n,t=t||{},function(i,r){let s;if(n)for(s in t)r[s]=t[s];else r=t;return{tagName:e,attribs:r}}}},9704:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActivityMonitor=void 0;const i=n(8571);t.ActivityMonitor=class{constructor(e){this._timer=-1,this._timeout=-1,this._isDisposed=!1,this._activityStopped=new i.Signal(this),e.signal.connect(this._onSignalFired,this),this._timeout=e.timeout||1e3}get activityStopped(){return this._activityStopped}get timeout(){return this._timeout}set timeout(e){this._timeout=e}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,i.Signal.clearData(this))}_onSignalFired(e,t){clearTimeout(this._timer),this._sender=e,this._args=t,this._timer=setTimeout((()=>{this._activityStopped.emit({sender:this._sender,args:this._args})}),this._timeout)}}},8925:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(9704),t),r(n(9269),t),r(n(1232),t),r(n(9547),t),r(n(5964),t),r(n(9830),t),r(n(7361),t),r(n(8126),t),r(n(1796),t),r(n(1692),t)},9269:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1232:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LruCache=void 0,t.LruCache=class{constructor(e={}){this._map=new Map,this._maxSize=(null==e?void 0:e.maxSize)||128}get size(){return this._map.size}clear(){this._map.clear()}get(e){const t=this._map.get(e)||null;return null!=t&&(this._map.delete(e),this._map.set(e,t)),t}set(e,t){this._map.size>=this._maxSize&&this._map.delete(this._map.keys().next().value),this._map.set(e,t)}}},9547:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.MarkdownCodeBlocks=void 0,function(e){e.CODE_BLOCK_MARKER="```";const t=[".markdown",".mdown",".mkdn",".md",".mkd",".mdwn",".mdtxt",".mdtext",".text",".txt",".Rmd"];class n{constructor(e){this.startLine=e,this.code="",this.endLine=-1}}e.MarkdownCodeBlock=n,e.isMarkdown=function(e){return t.indexOf(e)>-1},e.findMarkdownCodeBlocks=function(t){if(!t||""===t)return[];const i=t.split("\n"),r=[];let s=null;for(let t=0;te===t||i&&e===i))},e.isDisabled=function(t){const n=t.indexOf(":");let i="";return-1!==n&&(i=t.slice(0,n)),e.disabled.some((e=>e===t||i&&e===i))}}(Extension=PageConfig.Extension||(PageConfig.Extension={}))})(PageConfig||(exports.PageConfig=PageConfig={}))},9830:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PathExt=void 0;const i=n(9942);var r;!function(e){function t(e){return 0===e.indexOf("/")&&(e=e.slice(1)),e}e.join=function(...e){const n=i.posix.join(...e);return"."===n?"":t(n)},e.joinWithLeadingSlash=function(...e){const t=i.posix.join(...e);return"."===t?"":t},e.basename=function(e,t){return i.posix.basename(e,t)},e.dirname=function(e){const n=t(i.posix.dirname(e));return"."===n?"":n},e.extname=function(e){return i.posix.extname(e)},e.normalize=function(e){return""===e?"":t(i.posix.normalize(e))},e.resolve=function(...e){return t(i.posix.resolve(...e))},e.relative=function(e,n){return t(i.posix.relative(e,n))},e.normalizeExtension=function(e){return e.length>0&&0!==e.indexOf(".")&&(e=`.${e}`),e},e.removeSlash=t}(r||(t.PathExt=r={}))},7361:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.signalToPromise=void 0;const i=n(5764);t.signalToPromise=function(e,t){const n=new i.PromiseDelegate;function r(){e.disconnect(s)}function s(e,t){r(),n.resolve([e,t])}return e.connect(s),(null!=t?t:0)>0&&setTimeout((()=>{r(),n.reject(`Signal not emitted within ${t} ms.`)}),t),n.promise}},8126:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Text=void 0,function(e){e.jsIndexToCharIndex=function(e,t){return e},e.charIndexToJsIndex=function(e,t){return e},e.camelCase=function(e,t=!1){return e.replace(/^(\w)|[\s-_:]+(\w)/g,(function(e,n,i){return i?i.toUpperCase():t?n.toUpperCase():n.toLowerCase()}))},e.titleCase=function(e){return(e||"").toLowerCase().split(" ").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" ")}}(n||(t.Text=n={}))},1796:(e,t)=>{},1692:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.URLExt=void 0;const r=n(9942),s=i(n(2225));var o;!function(e){function t(e){if("undefined"!=typeof document&&document){const t=document.createElement("a");return t.href=e,t}return(0,s.default)(e)}function n(...e){let t=(0,s.default)(e[0],{});const n=""===t.protocol&&t.slashes;n&&(t=(0,s.default)(e[0],"https:"+e[0]));const i=`${n?"":t.protocol}${t.slashes?"//":""}${t.auth}${t.auth?"@":""}${t.host}`,o=r.posix.join(`${i&&"/"!==t.pathname[0]?"/":""}${t.pathname}`,...e.slice(1));return`${i}${"."===o?"":o}`}e.parse=t,e.getHostName=function(e){return(0,s.default)(e).hostname},e.normalize=function(e){return e&&t(e).toString()},e.join=n,e.encodeParts=function(e){return n(...e.split("/").map(encodeURIComponent))},e.objectToQueryString=function(e){const t=Object.keys(e).filter((e=>e.length>0));return t.length?"?"+t.map((t=>{const n=encodeURIComponent(String(e[t]));return t+(n?"="+n:"")})).join("&"):""},e.queryStringToObject=function(e){return e.replace(/^\?/,"").split("&").reduce(((e,t)=>{const[n,i]=t.split("=");return n.length>0&&(e[n]=decodeURIComponent(i||"")),e}),{})},e.isLocal=function(e,n=!1){const{protocol:i}=t(e);return(!i||0!==e.toLowerCase().indexOf(i))&&(n?0!==e.indexOf("//"):0!==e.indexOf("/"))}}(o||(t.URLExt=o={}))},6008:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{es:()=>rendererFactory});var _jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5865);const TEXT_JAVASCRIPT_MIMETYPE="text/javascript",APPLICATION_JAVASCRIPT_MIMETYPE="application/javascript";function evalInContext(code,element,document,window){return eval(code)}class ExperimentalRenderedJavascript extends _jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_0__.TS{render(e){const t=this.translator.load("jupyterlab"),n=()=>{try{const t=e.data[this.mimeType];return t&&evalInContext(t,this.node,document,window),Promise.resolve()}catch(e){return Promise.reject(e)}};if(!e.trusted){const e=document.createElement("pre");e.textContent=t.__("Are you sure that you want to run arbitrary Javascript within your JupyterLab session?");const i=document.createElement("button");return i.textContent=t.__("Run"),this.node.appendChild(e),this.node.appendChild(i),i.onclick=e=>{this.node.textContent="",n()},Promise.resolve()}return n()}}const rendererFactory={safe:!1,mimeTypes:[TEXT_JAVASCRIPT_MIMETYPE,APPLICATION_JAVASCRIPT_MIMETYPE],createRenderer:e=>new ExperimentalRenderedJavascript(e)},extension={id:"@jupyterlab/javascript-extension:factory",description:"Adds renderer for JavaScript content.",rendererFactory,rank:0,dataType:"string"};var __WEBPACK_DEFAULT_EXPORT__=extension},3328:function(e,t){!function(e){"use strict";e.JSONExt=void 0,function(e){function t(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e}function n(e){return Array.isArray(e)}function i(e,r){if(e===r)return!0;if(t(e)||t(r))return!1;var s=n(e),o=n(r);return s===o&&(s&&o?function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var n=0,r=e.length;n>>0),e[n]=255&t,t>>>=8}e.Random=void 0,(e.Random||(e.Random={})).getRandomValues=function(){var e="undefined"!=typeof window&&(window.crypto||window.msCrypto)||null;return e&&"function"==typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:r}(),e.UUID=void 0,(e.UUID||(e.UUID={})).uuid4=function(e){for(var t=new Uint8Array(16),n=new Array(256),i=0;i<16;++i)n[i]="0"+i.toString(16);for(i=16;i<256;++i)n[i]=i.toString(16);return function(){return e(t),t[6]=64|15&t[6],t[8]=128|63&t[8],n[t[0]]+n[t[1]]+n[t[2]]+n[t[3]]+"-"+n[t[4]]+n[t[5]]+"-"+n[t[6]]+n[t[7]]+"-"+n[t[8]]+n[t[9]]+"-"+n[t[10]]+n[t[11]]+n[t[12]]+n[t[13]]+n[t[14]]+n[t[15]]}}(e.Random.getRandomValues),e.MimeData=t,e.PromiseDelegate=n,e.Token=i,Object.defineProperty(e,"__esModule",{value:!0})}(t)},478:(e,t,n)=>{"use strict";n.d(t,{c:()=>D});var i,r,s,o=n(5764);function a(e){return"execute_result"===e.output_type}function l(e){return"display_data"===e.output_type}function d(e){return"stream"===e.output_type}!function(e){function t(e,t,n=0,i=-1){let r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(i||(i={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(s||(s={}));var u,c,h,p,g,f,m,v,b,A=n(8571);class y{constructor(e={}){if(this._array=[],this._isDisposed=!1,this._changed=new A.Signal(this),e.values)for(const t of e.values)this._array.push(t);this._itemCmp=e.itemCmp||u.itemCmp}get type(){return"List"}get changed(){return this._changed}get length(){return this._array.length}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,A.Signal.clearData(this),this.clear())}[Symbol.iterator](){return this._array[Symbol.iterator]()}get(e){return this._array[e]}set(e,t){const n=this._array[e];if(void 0===t)throw new Error("Cannot set an undefined item");(0,this._itemCmp)(n,t)||(this._array[e]=t,this._changed.emit({type:"set",oldIndex:e,newIndex:e,oldValues:[n],newValues:[t]}))}push(e){const t=this._array.push(e);return this._changed.emit({type:"add",oldIndex:-1,newIndex:this.length-1,oldValues:[],newValues:[e]}),t}insert(e,t){e===this._array.length?this._array.push(t):i.insert(this._array,e,t),this._changed.emit({type:"add",oldIndex:-2,newIndex:e,oldValues:[],newValues:[t]})}removeValue(e){const t=this._itemCmp,n=i.findFirstIndex(this._array,(n=>t(n,e)));return this.remove(n),n}remove(e){const t=i.removeAt(this._array,e);if(void 0!==t)return this._changed.emit({type:"remove",oldIndex:e,newIndex:-1,newValues:[],oldValues:[t]}),t}clear(){const e=this._array.slice();this._array.length=0,this._changed.emit({type:"remove",oldIndex:0,newIndex:0,newValues:[],oldValues:e})}move(e,t){if(this.length<=1||e===t)return;const n=[this._array[e]];i.move(this._array,e,t),this._changed.emit({type:"move",oldIndex:e,newIndex:t,oldValues:n,newValues:n})}pushAll(e){const t=this.length;for(const t of e)this._array.push(t);return this._changed.emit({type:"add",oldIndex:-1,newIndex:t,oldValues:[],newValues:Array.from(e)}),this.length}insertAll(e,t){const n=e;for(const n of t)i.insert(this._array,e++,n);this._changed.emit({type:"add",oldIndex:-2,newIndex:n,oldValues:[],newValues:Array.from(t)})}removeRange(e,t){const n=this._array.slice(e,t);for(let n=e;n{let t=!1;return r.then((()=>!t&&e())),()=>{t=!0}});var r;function s(e,t){let n=a.get(e);if(!n||0===n.length)return void c(e,t);let i=function(e,t){let n=0;for(const i of e)if(!1===t(i,n++))return!1;return!0}(function*(e){if("function"==typeof e.retro)yield*e.retro();else for(let t=e.length-1;t>-1;t--)yield e[t]}(n),(n=>!n||function(e,t,n){let i=!0;try{i="function"==typeof e?e(t,n):e.messageHook(t,n)}catch(e){d(e)}return i}(n,e,t)));i&&c(e,t)}e.sendMessage=s,e.postMessage=function(e,t){t.isConflatable&&function(n,i){for(const i of n)if((r=i).handler===e&&r.msg&&r.msg.type===t.type&&r.msg.isConflatable&&r.msg.conflate(t))return!0;var r;return!1}(o)||h(e,t)},e.installMessageHook=function(e,t){let n=a.get(e);n&&-1!==n.indexOf(t)||(n?n.push(t):a.set(e,[t]))},e.removeMessageHook=function(e,t){let n=a.get(e);if(!n)return;let i=n.indexOf(t);-1!==i&&(n[i]=null,g(n))},e.clearData=function(e){let t=a.get(e);t&&t.length>0&&(i.fill(t,null),g(t));for(const t of o)t.handler===e&&(t.handler=null,t.msg=null)},e.flush=function(){u||null===t||(t(),t=null,u=!0,p(),u=!1)},e.getExceptionHandler=function(){return d},e.setExceptionHandler=function(e){let t=d;return d=e,t};const o=new _,a=new WeakMap,l=new Set;let d=e=>{console.error(e)},u=!1;function c(e,t){try{e.processMessage(t)}catch(e){d(e)}}function h(e,i){o.addLast({handler:e,msg:i}),null===t&&(t=n(p))}function p(){if(t=null,o.isEmpty)return;let e={handler:null,msg:null};for(o.addLast(e);;){let t=o.removeFirst();if(t===e)return;t.handler&&t.msg&&s(t.handler,t.msg)}}function g(e){0===l.size&&n(f),l.add(e)}function f(){l.forEach(m),l.clear()}function m(e){i.removeAllWhere(e,v)}function v(e){return null===e}}(h||(h={}));class C{constructor(e={}){if(this._map=new Map,this._changed=new A.Signal(this),this._isDisposed=!1,this._itemCmp=e.itemCmp||p.itemCmp,e.values)for(const t in e.values)this._map.set(t,e.values[t])}get type(){return"Map"}get changed(){return this._changed}get isDisposed(){return this._isDisposed}get size(){return this._map.size}set(e,t){const n=this._map.get(e);if(void 0===t)throw Error("Cannot set an undefined value, use remove");const i=this._itemCmp;return void 0!==n&&i(n,t)||(this._map.set(e,t),this._changed.emit({type:n?"change":"add",key:e,oldValue:n,newValue:t})),n}get(e){return this._map.get(e)}has(e){return this._map.has(e)}keys(){const e=[];return this._map.forEach(((t,n)=>{e.push(n)})),e}values(){const e=[];return this._map.forEach(((t,n)=>{e.push(t)})),e}delete(e){const t=this._map.get(e);return this._map.delete(e)&&this._changed.emit({type:"remove",key:e,oldValue:t,newValue:void 0}),t}clear(){const e=this.keys();for(let t=0;t=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(f||(f={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(v||(v={}));class D{constructor(e={}){if(this.clearNext=!1,this._lastStream="",this._trusted=!1,this._isDisposed=!1,this._stateChanged=new A.Signal(this),this._changed=new A.Signal(this),this._trusted=!!e.trusted,this.contentFactory=e.contentFactory||D.defaultContentFactory,this.list=new y,e.values)for(const t of e.values){const e=this._add(t)-1;this.list.get(e).changed.connect(this._onGenericChange,this)}this.list.changed.connect(this._onListChanged,this)}get stateChanged(){return this._stateChanged}get changed(){return this._changed}get length(){return this.list?this.list.length:0}get trusted(){return this._trusted}set trusted(e){if(e===this._trusted)return;const t=this._trusted=e;for(let e=0;e{e.changed.connect(this._onGenericChange,this)}));break;case"remove":t.oldValues.forEach((e=>{e.changed.disconnect(this._onGenericChange,this)}));break;case"set":t.newValues.forEach((e=>{e.changed.connect(this._onGenericChange,this)})),t.oldValues.forEach((e=>{e.changed.disconnect(this._onGenericChange,this)}))}this._changed.emit(t)}_onGenericChange(e){let t,n=null;for(t=0;t-1;){const t=e.match(/^(.*)\r+/m)[1];let n=e.match(/\r+(.*)$/m)[1];n+=t.slice(n.length,t.length),e=e.replace(/\r+.*$/m,"\r").replace(/^.*\r/m,n)}return e}(function(e){let t=e;do{t=(e=t).replace(/[^\n]\x08/gm,"")}while(t.length{"use strict";n.d(t,{Bw:()=>g});var i=n(1670),r=n(8571),s=n(5070);class o{constructor(e){this._currentChanged=new r.Signal(this),this._deferred=null,this._isDisposed=!1,this._widgetAdded=new r.Signal(this),this._widgetUpdated=new r.Signal(this);const t=this._focusTracker=new s.$x,n=this._pool=new i.RestorablePool(e);this.namespace=e.namespace,t.currentChanged.connect(((e,t)=>{t.newValue!==this.currentWidget&&(n.current=t.newValue)}),this),n.added.connect(((e,t)=>{this._widgetAdded.emit(t)}),this),n.currentChanged.connect(((e,i)=>{null===i&&t.currentWidget?n.current=t.currentWidget:(this.onCurrentChanged(i),this._currentChanged.emit(i))}),this),n.updated.connect(((e,t)=>{this._widgetUpdated.emit(t)}),this)}get currentChanged(){return this._currentChanged}get currentWidget(){return this._pool.current||null}get restored(){return this._deferred?Promise.resolve():this._pool.restored}get size(){return this._pool.size}get widgetAdded(){return this._widgetAdded}get widgetUpdated(){return this._widgetUpdated}async add(e){this._focusTracker.add(e),await this._pool.add(e),this._focusTracker.activeWidget||(this._pool.current=e)}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this._pool.dispose(),this._focusTracker.dispose(),r.Signal.clearData(this))}find(e){return this._pool.find(e)}forEach(e){return this._pool.forEach(e)}filter(e){return this._pool.filter(e)}inject(e){return this._pool.inject(e)}has(e){return this._pool.has(e)}async restore(e){const t=this._deferred;return t?(this._deferred=null,this._pool.restore(t)):e?this._pool.restore(e):void console.warn("No options provided to restore the tracker.")}defer(e){this._deferred=e}async save(e){return this._pool.save(e)}onCurrentChanged(e){}}var a=n(7883),l=n(509),d=n(5764),u=n(6573);const c="jp-OutputArea-child",h="jp-OutputArea-output",p="jp-OutputArea-prompt";class g extends s.x0{constructor(e){var t,n,i,a;super(),this.outputLengthChanged=new r.Signal(this),this._onIOPub=e=>{const t=this.model,n=e.header.msg_type;let i;const r=(e.content.transient||{}).display_id;let s;switch(n){case"execute_result":case"display_data":case"stream":case"error":i={...e.content,output_type:n},t.add(i);break;case"clear_output":{const n=e.content.wait;t.clear(n);break}case"update_display_data":if(i={...e.content,output_type:"display_data"},s=this._displayIdMap.get(r),s)for(const e of s)t.set(e,i);break;case"status":"idle"===e.content.execution_state&&(this._pendingInput=!1)}r&&"display_data"===n&&(s=this._displayIdMap.get(r)||[],s.push(t.length-1),this._displayIdMap.set(r,s))},this._onExecuteReply=e=>{const t=this.model,n=e.content;if("ok"!==n.status)return;const i=n&&n.payload;if(!i||!i.length)return;const r=i.filter((e=>"page"===e.source));if(!r.length)return;const s={output_type:"display_data",data:JSON.parse(JSON.stringify(r[0])).data,metadata:{}};t.add(s)},this._displayIdMap=new Map,this._minHeightTimeout=null,this._inputRequested=new r.Signal(this),this._toggleScrolling=new r.Signal(this),this._initialize=new r.Signal(this),this._outputTracker=new o({namespace:d.UUID.uuid4()}),this._inputHistoryScope="global",this._pendingInput=!1,super.layout=new s.DG,this.addClass("jp-OutputArea"),this.contentFactory=null!==(t=e.contentFactory)&&void 0!==t?t:g.defaultContentFactory,this.rendermime=e.rendermime,this._maxNumberOutputs=null!==(n=e.maxNumberOutputs)&&void 0!==n?n:1/0,this._translator=null!==(i=e.translator)&&void 0!==i?i:l.wK,this._inputHistoryScope=null!==(a=e.inputHistoryScope)&&void 0!==a?a:"global";const u=this.model=e.model;for(let e=0;e{this._pendingInput=!1})).catch((()=>{})),this.model.clear(),this.widgets.length&&(this._clear(),this.outputLengthChanged.emit(Math.min(this.model.length,this._maxNumberOutputs))),e.onIOPub=this._onIOPub,e.onReply=this._onExecuteReply,e.onStdin=t=>{a.KernelMessage.isInputRequestMsg(t)&&this.onInputRequest(t,e)})}get inputRequested(){return this._inputRequested}get pendingInput(){return this._pendingInput}get maxNumberOutputs(){return this._maxNumberOutputs}set maxNumberOutputs(e){if(e<=0)return void console.warn("OutputArea.maxNumberOutputs must be strictly positive.");const t=this._maxNumberOutputs;this._maxNumberOutputs=e,t{this._toggleScrolling.emit()})),this.node.appendChild(e),requestAnimationFrame((()=>{this._initialize.emit()}))}_moveDisplayIdIndices(e,t){this._displayIdMap.forEach((n=>{const i=e+t;for(let r=n.length-1;r>=0;--r){const s=n[r];s>=e&&s=i&&(n[r]-=t)}}))}onStateChanged(e,t){const n=Math.min(this.model.length,this._maxNumberOutputs);if(t){if(t>=this._maxNumberOutputs)return;this._setOutput(t,this.model.get(t))}else for(let e=0;e{this.isDisposed||(this.node.style.minHeight="")}),50)}onInputRequest(e,t){const n=this.contentFactory,i=e.content.prompt,r=e.content.password,o=new s.Zk;o.addClass(c),o.addClass("jp-OutputArea-stdin-item");const a=n.createOutputPrompt();a.addClass(p),o.addWidget(a),this._pendingInput=!0;const l=n.createStdin({parent_header:e.header,prompt:i,password:r,future:t,translator:this._translator,inputHistoryScope:this._inputHistoryScope});l.addClass(h),o.addWidget(l),this.model.length>=this.maxNumberOutputs&&(this.maxNumberOutputs=this.model.length),this._inputRequested.emit(l);const d=l.node.getElementsByTagName("input")[0];l.value.then((e=>{this.model.length>=this.maxNumberOutputs&&(this.maxNumberOutputs=this.model.length+1),o.addClass("jp-OutputArea-stdin-hiding"),this.model.add({output_type:"stream",name:"stdin",text:e+"\n"}),d.focus(),this._pendingInput=!1,window.setTimeout((()=>{const e=document.activeElement;o.dispose(),e&&e instanceof HTMLElement&&e.focus()}),500)})),this.layout.addWidget(o)}_setOutput(e,t){if(e>=this._maxNumberOutputs)return;const n=this.layout.widgets[e],i=n.widgets?n.widgets.filter((e=>"renderModel"in e)).pop():n,r=this.rendermime.preferredMimeType(t.data,t.trusted?"any":"ensure");v.currentPreferredMimetype.get(i)===r&&g.isIsolated(r,t.metadata)===i instanceof v.IsolatedRenderer?i.renderModel(t):(this.layout.widgets[e].dispose(),this._insertOutput(e,t))}_insertOutput(e,t){if(e>this._maxNumberOutputs)return;const n=this.layout;if(e===this._maxNumberOutputs){const t=new v.TrimmedOutputs(this._maxNumberOutputs,(()=>{const e=this._maxNumberOutputs;this._maxNumberOutputs=1/0,this._showTrimmedOutputs(e)}));n.insertWidget(e,this._wrappedOutput(t))}else{let i=this.createOutputItem(t);i?i.toggleClass("jp-OutputArea-executeResult",null!==t.executionCount):i=new s.x0,this._outputTracker.has(i)||this._outputTracker.add(i),n.insertWidget(e,i)}}get outputTracker(){return this._outputTracker}_showTrimmedOutputs(e){this.widgets[e].dispose();for(let t=e;t{const t=document.createElement("pre"),i=this._translator.load("jupyterlab");t.textContent=i.__("Javascript Error: %1",e.message),n.node.appendChild(t),n.node.className="lm-Widget jp-RenderedText",n.node.setAttribute("data-mime-type","application/vnd.jupyter.stderr")})),n}_wrappedOutput(e,t=null){const n=new v.OutputPanel;n.addClass(c);const i=this.contentFactory.createOutputPrompt();return i.executionCount=t,i.addClass(p),n.addWidget(i),e.addClass(h),n.addWidget(e),n}}!function(e){e.execute=async function(e,t,n,i){var r;let s=!0;i&&Array.isArray(i.tags)&&-1!==i.tags.indexOf("raises-exception")&&(s=!1);const o={code:e,stop_on_error:s},a=null===(r=n.session)||void 0===r?void 0:r.kernel;if(!a)throw new Error("Session has no kernel.");const l=a.requestExecute(o,!1,i);return t.future=l,l.done},e.isIsolated=function(e,t){const n=t[e];return n&&void 0!==n.isolated?!!n.isolated:!!t.isolated};class t{createOutputPrompt(){return new f}createStdin(e){return new m(e)}}e.ContentFactory=t,e.defaultContentFactory=new t}(g||(g={}));class f extends s.x0{constructor(){super(),this._executionCount=null,this.addClass("jp-OutputPrompt")}get executionCount(){return this._executionCount}set executionCount(e){this._executionCount=e,this.node.textContent=null===e?"":`[${e}]:`}}class m extends s.x0{static _historyIx(e,t){const n=m._history.get(e);if(!n)return;const i=n.length;return t<=0?i+t:void 0}static _historyAt(e,t){const n=m._history.get(e);if(!n)return;const i=n.length,r=m._historyIx(e,t);return void 0!==r&&r1e3&&n.shift()}static _historySearch(e,t,n,i=!0){const r=m._history.get(e),s=r.length,o=m._historyIx(e,n),a=e=>-1!==e.search(t);if(void 0!==o)if(i){if(0===o)return;const e=r.slice(0,o).findLastIndex(a);if(-1!==e)return e-s}else{if(o>=s-1)return;const e=r.slice(o+1).findIndex(a);if(-1!==e)return e-s+o+1}}constructor(e){var t;super({node:v.createInputWidgetNode(e.prompt,e.password)}),this._promise=new d.PromiseDelegate,this._resolved=!1,this.addClass("jp-Stdin"),this._future=e.future,this._historyIndex=0,this._historyKey="session"===e.inputHistoryScope?e.parent_header.session:"",this._historyPat="",this._parentHeader=e.parent_header,this._password=e.password,this._trans=(null!==(t=e.translator)&&void 0!==t?t:l.wK).load("jupyterlab"),this._value=e.prompt+" ",this._input=this.node.getElementsByTagName("input")[0],this._password?this._input.placeholder="":this._input.placeholder=this._trans.__("↑↓ for history. Search history with c-↑/c-↓"),m._history.has(this._historyKey)||m._history.set(this._historyKey,[])}get value(){return this._promise.promise.then((()=>this._value))}handleEvent(e){if(this._resolved)return void e.preventDefault();const t=this._input;if("keydown"===e.type)if("Enter"===e.key)this.resetSearch(),this._future.sendInputReply({status:"ok",value:t.value},this._parentHeader),this._password?this._value+="········":(this._value+=t.value,m._historyPush(this._historyKey,t.value)),this._resolved=!0,this._promise.resolve(void 0);else if("Escape"===e.key)this.resetSearch(),t.blur();else if(!e.ctrlKey||"ArrowUp"!==e.key&&"ArrowDown"!==e.key){if("ArrowUp"===e.key){this.resetSearch();const n=m._historyAt(this._historyKey,this._historyIndex-1);n&&(0===this._historyIndex&&(this._valueCache=t.value),this._setInputValue(n),--this._historyIndex,e.preventDefault())}else if("ArrowDown"===e.key)if(this.resetSearch(),0===this._historyIndex);else if(-1===this._historyIndex)this._setInputValue(this._valueCache),++this._historyIndex;else{const e=m._historyAt(this._historyKey,this._historyIndex+1);e&&(this._setInputValue(e),++this._historyIndex)}}else{""===this._historyPat&&(this._historyPat=t.value);const n="ArrowUp"===e.key,i=m._historySearch(this._historyKey,this._historyPat,this._historyIndex,n);if(void 0!==i){const n=m._historyAt(this._historyKey,i);void 0!==n&&(0===this._historyIndex&&(this._valueCache=t.value),this._setInputValue(n),this._historyIndex=i,e.preventDefault())}}}resetSearch(){this._historyPat=""}onAfterAttach(e){this._input.addEventListener("keydown",this),this._input.focus()}onBeforeDetach(e){this._input.removeEventListener("keydown",this)}_setInputValue(e){this._input.value=e,this._input.setSelectionRange(e.length,e.length)}}var v;m._history=new Map,function(e){e.createInputWidgetNode=function(e,t){const n=document.createElement("div"),i=document.createElement("pre");i.className="jp-Stdin-prompt",i.textContent=e;const r=document.createElement("input");return r.className="jp-Stdin-input",t&&(r.type="password"),n.appendChild(i),i.appendChild(r),n};class t extends s.x0{constructor(e){super({node:document.createElement("iframe")}),this.addClass("jp-mod-isolated"),this._wrapped=e;const t=this.node;t.frameBorder="0",t.scrolling="auto",t.addEventListener("load",(()=>{t.contentDocument.open(),t.contentDocument.write(this._wrapped.node.innerHTML),t.contentDocument.close();const e=t.contentDocument.body;t.style.height=`${e.scrollHeight}px`,t.heightChangeObserver=new ResizeObserver((()=>{t.style.height=`${e.scrollHeight}px`})),t.heightChangeObserver.observe(e)}))}renderModel(e){return this._wrapped.renderModel(e)}}e.IsolatedRenderer=t,e.currentPreferredMimetype=new u.AttachedProperty({name:"preferredMimetype",create:e=>""});class n extends s.Zk{constructor(e){super(e)}_onContext(e){this.node.focus()}onAfterAttach(e){super.onAfterAttach(e),this.node.addEventListener("contextmenu",this._onContext.bind(this))}onBeforeDetach(e){super.onAfterDetach(e),this.node.removeEventListener("contextmenu",this._onContext.bind(this))}}e.OutputPanel=n;class i extends s.x0{constructor(e,t){const n=document.createElement("div"),i=`The first ${e} are displayed`;n.insertAdjacentHTML("afterbegin",`\n
Show more outputs
\n
`),super({node:n}),this._onClick=t,this.addClass("jp-TrimmedOutputs"),this.addClass("jp-RenderedHTMLCommon")}handleEvent(e){"click"===e.type&&this._onClick(e)}onAfterAttach(e){super.onAfterAttach(e),this.node.addEventListener("click",this)}onBeforeDetach(e){super.onBeforeDetach(e),this.node.removeEventListener("click",this)}}e.TrimmedOutputs=i}(v||(v={}))},5865:(e,t,n)=>{"use strict";n.d(t,{A6:()=>k,TH:()=>C,vf:()=>x,TS:()=>B,Kc:()=>E,jL:()=>D,Yk:()=>S,Vx:()=>T});var i=n(509),r=n(5070),s=n(8925),o=n(9452),a=n.n(o);const l=/(\$\$?|\\(?:begin|end)\{[a-z]*\*?\}|\\[{}$]|[{}]|(?:\n\s*)+|@@\d+@@|\\\\(?:\(|\)|\[|\]))/i;function d(e,t,n,i,r){let s=r.slice(e,t+1).join("").replace(/&/g,"&").replace(//g,">");for(navigator&&"Microsoft Internet Explorer"===navigator.appName&&(s=s.replace(/(%[^\n]*)\n/g,"$1
\n"));t>e;)r[t]="",t--;return r[e]="@@"+i.length+"@@",n&&(s=n(s)),i.push(s),r}function u(e){let{host:t,source:n,trusted:r,sanitizer:s,resolver:o,linkHandler:a,shouldTypeset:l,latexTypesetter:d,translator:u}=e;u=u||i.wK;const c=null==u?void 0:u.load("jupyterlab");let h,g=n;if(!n)return t.textContent="",Promise.resolve(void 0);if(r||(g=`${n}`,n=s.sanitize(n)),t.innerHTML=n,t.getElementsByTagName("script").length>0)if(r)p.evalInnerHTMLScriptTags(t);else{const e=document.createElement("div"),n=document.createElement("pre");n.textContent=c.__("This HTML output contains inline scripts. Are you sure that you want to run arbitrary Javascript within your JupyterLab session?");const i=document.createElement("button");i.textContent=c.__("Run"),i.onclick=e=>{t.innerHTML=g,p.evalInnerHTMLScriptTags(t),t.firstChild&&t.removeChild(t.firstChild)},e.appendChild(n),e.appendChild(i),t.insertBefore(e,t.firstChild)}return p.handleDefaults(t,o),h=o?p.handleUrls(t,o,a):Promise.resolve(void 0),h.then((()=>{l&&d&&d.typeset(t)}))}async function c(e){const{host:t,source:n,markdownParser:i,...r}=e;if(!n)return void(t.textContent="");let s="";if(i){const e=function(e){const t=[];let n,i=null,r=null,s=null,o=0;e.includes("`")||e.includes("~~~")?(e=e.replace(/~/g,"~T").replace(/^(?`{3,}|(~T){3,})[^`\n]*\n([\s\S]*?)^\k`*$/gm,(e=>e.replace(/\$/g,"~D"))).replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm,(e=>e.replace(/\$/g,"~D"))),n=e=>e.replace(/~([TD])/g,((e,t)=>"T"===t?"~":"$"))):n=e=>e;let a=e.replace(/\r\n?/g,"\n").split(l);for(let e=1,l=a.length;e{let n=a[t];return"\\\\("===n.substr(0,3)&&"\\\\)"===n.substr(n.length-3)?n="\\("+n.substring(3,n.length-3)+"\\)":"\\\\["===n.substr(0,3)&&"\\\\]"===n.substr(n.length-3)&&(n="\\["+n.substring(3,n.length-3)+"\\]"),n}))}else s=`
${n}
`;var o,a;await u({host:t,source:s,...r}),p.headerAnchors(t)}var h,p;!function(e){e.createHeaderId=function(e){var t;return(null!==(t=e.textContent)&&void 0!==t?t:"").replace(/ /g,"-")}}(c||(c={})),function(e){const t="\\u0000-\\u0020\\u007f-\\u009f";e.webLinkRegex=new RegExp("(?(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\\/\\/|data:|www\\.)[^\\s"+t+'"]{2,}[^\\s'+t+"\"'(){}\\[\\],:;.!?])","ug");const n=new RegExp(`(${/(?:[a-zA-Z]:(?:(?:\\|\/)[\w\.-]*)+)/.source}|${/(?:(?:\~|\.)(?:(?:\\|\/)[\w\.-]*)+)/.source})`),i=navigator.userAgent.indexOf("Windows")>=0;e.pathLinkRegex=new RegExp(`(?${i?n.source:/((?:\~|\.)?(?:\/[\w\.-]*)+)/.source})${/(?:(?:\:|", line )(?[\d]+))?(?:\:(?[\d]+))?/.source}`,"g")}(h||(h={}));class g{constructor(){this.regex=h.webLinkRegex}createAnchor(e,t){const n=document.createElement("a");return n.href=e.startsWith("www.")?"https://"+e:e,n.rel="noopener",n.target="_blank",n.appendChild(document.createTextNode(t)),n}processPath(e){const t=e.slice(-1),n=-1!==[">","<"].indexOf(t)?e.length-1:e.length;return e.slice(0,n)}processLabel(e){return this.processPath(e)}}class f{constructor(){this.regex=h.pathLinkRegex}createAnchor(e,t,n){const i=document.createElement("a");i.dataset.path=e;const r=parseInt(n.line,10);let s=isNaN(r)?"":"line="+(r-1);return i.dataset.locator=s,i.appendChild(document.createTextNode(t)),i}}function m(e,t){const n=[];t.checkWeb&&n.push(new g),t.checkPaths&&n.push(new f);const i=[],r=(e,t)=>{if(t>=n.length)return void i.push(document.createTextNode(e));const s=n[t];let o,a=0;const l=s.regex;for(l.lastIndex=0;null!=(o=l.exec(e));){const n=e.substring(a,o.index);n&&r(n,t+1);const{path:l,...d}=o.groups,u=s.processPath?s.processPath(l):l,c=s.processLabel?s.processLabel(o[0]):o[0];i.push(s.createAnchor(u,c,d)),a=o.index+c.length}const d=e.substring(a);d&&r(d,t+1)};return r(e,0),i}function v(e,t){var n,i;const r=e.cloneNode();r.textContent=null===(n=e.textContent)||void 0===n?void 0:n.slice(0,t);const s=e.cloneNode();return s.textContent=null===(i=e.textContent)||void 0===i?void 0:i.slice(t),{pre:r,post:s}}function*b(e){var t;let n,i=0;for(let r of e)n=i+((null===(t=r.textContent)||void 0===t?void 0:t.length)||0),yield{node:r,start:i,end:n,isText:r.nodeType===Node.TEXT_NODE},i=n}function A(e){var t,n;const{host:i,sanitizer:r,source:s}=e,o=r.sanitize(p.ansiSpan(s),{allowedTags:["span"]}),a=document.createElement("pre");a.innerHTML=o;const l=a.textContent;let d;if(l){const e=null===(n=null===(t=r.getAutolink)||void 0===t?void 0:t.call(r))||void 0===n||n?m(l,{checkWeb:!0,checkPaths:!1}):[document.createTextNode(o)];d=y(Array.from(a.childNodes),e)}else d=document.createElement("pre");return i.appendChild(d),Promise.resolve(void 0)}function y(e,t){const n=document.createElement("pre");let i=!1;const r=[];for(let n of function*(e,t){var n,i;let r=b(e),s=b(t),o=r.next(),a=s.next();for(;!o.done&&!a.done;){let e=o.value,t=a.value;if(e.isText&&e.start<=t.start&&e.end>=t.end)yield[null,t.node],a=s.next();else if(t.isText&&t.start<=e.start&&t.end>=e.end)yield[e.node,null],o=r.next();else if(e.end===t.end&&e.start===t.start)yield[e.node,t.node],o=r.next(),a=s.next();else if(e.end>t.end){let{pre:i,post:r}=v(e.node,t.end-e.start);t.starte.end))throw new Error(`Unexpected intersection: ${JSON.stringify(e)} ${JSON.stringify(t)}`);{let{pre:n,post:s}=v(t.node,e.end-t.start);e.start{const r=decodeURIComponent(i);return n&&n.handleLink(e,r,o),t.getDownloadUrl(i)})).then((t=>{e.href=t+o})).catch((t=>{e.href=""}))}async function i(e,t,n){let i=e.dataset.path||"",r=e.dataset.locator?"#"+e.dataset.locator:"";delete e.dataset.path,delete e.dataset.locator;const o=!0,a=t.isLocal?t.isLocal(i,o):s.URLExt.isLocal(i,o);if(!(i&&a&&t.resolvePath&&n&&n.handlePath))return e.replaceWith(...e.childNodes),Promise.resolve(void 0);try{const s=await t.resolvePath(i);if(!s)return console.log("Path resolution bailing: does not exist"),Promise.resolve(void 0);n.handlePath(e,s.path,s.scope,r),e.href=s.path+r}catch(t){console.warn("Path anchor error:",t),e.href="#linking-failed-see-console"}}e.evalInnerHTMLScriptTags=function(e){const t=Array.from(e.getElementsByTagName("script"));for(const e of t){if(!e.parentNode)continue;const t=document.createElement("script"),n=e.attributes;for(let e=0,i=n.length;e{}))},e.handlePaths=async function(e,t,n){const r=e.getElementsByTagName("a");for(let e=0;e"),a.push(e),a.push("")):a.push(e)}}function l(e){let t,n,i;const r=e.shift();if(2===r&&e.length>=3){if(t=e.shift(),n=e.shift(),i=e.shift(),[t,n,i].some((e=>e<0||255=1))throw new RangeError("Invalid extended color specification");{const r=e.shift();if(r<0)throw new RangeError("Color index must be >= 0");if(r<16)return r;if(r<232)t=Math.floor((r-16)/36),t=t>0?55+40*t:0,n=Math.floor((r-16)%36/6),n=n>0?55+40*n:0,i=(r-16)%6,i=i>0?55+40*i:0;else{if(!(r<256))throw new RangeError("Color index must be < 256");t=n=i=10*(r-232)+8}}}return[t,n,i]}e.ansiSpan=function(e){const t=/\x1b\[(.*?)([@-~])/g;let n,i=[],r=[],s=!1,d=!1,u=!1;const c=[],h=[];let p=0;for(e=a()(e),e+="";n=t.exec(e);){if("m"===n[2]){const e=n[1].split(";");for(let t=0;t{this.latexTypesetter&&this.latexTypesetter.typeset(this.node)})).catch(console.warn)}}class E extends _{constructor(e){super(e),this._rendered=Promise.resolve(),this.addClass("jp-RenderedLatex")}render(e){return this._rendered=function(e){const{host:t,source:n,shouldTypeset:i,latexTypesetter:r}=e;return t.textContent=n,i&&r&&r.typeset(t),Promise.resolve(void 0)}({host:this.node,source:String(e.data[this.mimeType]),shouldTypeset:this.isAttached,latexTypesetter:this.latexTypesetter})}onAfterAttach(e){this._rendered.then((()=>{this.latexTypesetter&&this.latexTypesetter.typeset(this.node)})).catch(console.warn)}}class x extends _{constructor(e){super(e),this.addClass("jp-RenderedImage")}render(e){const t=e.metadata[this.mimeType];return function(e){const{host:t,mimeType:n,source:i,width:r,height:s,needsBackground:o,unconfined:a}=e;t.textContent="";const l=document.createElement("img");return l.src=`data:${n};base64,${i}`,"number"==typeof s&&(l.height=s),"number"==typeof r&&(l.width=r),"light"===o?l.classList.add("jp-needs-light-background"):"dark"===o&&l.classList.add("jp-needs-dark-background"),!0===a&&l.classList.add("jp-mod-unconfined"),t.appendChild(l),Promise.resolve(void 0)}({host:this.node,mimeType:this.mimeType,source:String(e.data[this.mimeType]),width:t&&t.width,height:t&&t.height,needsBackground:e.metadata.needs_background,unconfined:t&&t.unconfined})}}class D extends w{constructor(e){super(e),this._rendered=Promise.resolve(),this.addClass("jp-RenderedMarkdown")}render(e){return this._rendered=c({host:this.node,source:String(e.data[this.mimeType]),trusted:e.trusted,resolver:this.resolver,sanitizer:this.sanitizer,linkHandler:this.linkHandler,shouldTypeset:this.isAttached,latexTypesetter:this.latexTypesetter,markdownParser:this.markdownParser,translator:this.translator})}async renderModel(e){await super.renderModel(e,!0)}onAfterAttach(e){this._rendered.then((()=>{this.latexTypesetter&&this.latexTypesetter.typeset(this.node)})).catch(console.warn)}}class S extends _{constructor(e){super(e),this._rendered=Promise.resolve(),this.addClass("jp-RenderedSVG")}render(e){const t=e.metadata[this.mimeType];return this._rendered=function(e){let{host:t,source:n,trusted:i,unconfined:r}=e;if(!n)return t.textContent="",Promise.resolve(void 0);if(!i)return t.textContent="Cannot display an untrusted SVG. Maybe you need to run the cell?",Promise.resolve(void 0);n.search("]+xmlns=[^>]+svg")<0&&(n=n.replace("{this.latexTypesetter&&this.latexTypesetter.typeset(this.node)})).catch(console.warn)}}class T extends _{constructor(e){super(e),this.addClass("jp-RenderedText")}render(e){return A({host:this.node,sanitizer:this.sanitizer,source:String(e.data[this.mimeType]),translator:this.translator})}}class k extends _{constructor(e){super(e),this.addClass("jp-RenderedText")}render(e){return function(e){var t,n;const{host:i,linkHandler:r,sanitizer:s,resolver:o,source:a}=e,l=s.sanitize(p.ansiSpan(a),{allowedTags:["span"]}),d=document.createElement("pre");d.innerHTML=l;const u=d.textContent;let c,h;if(u){const e=null===(n=null===(t=s.getAutolink)||void 0===t?void 0:t.call(s))||void 0===n||n?m(u,{checkWeb:!0,checkPaths:!0}):[document.createTextNode(l)];c=y(Array.from(d.childNodes),e)}else c=document.createElement("pre");return i.appendChild(c),h=o?p.handlePaths(i,o,r):Promise.resolve(void 0),h}({host:this.node,sanitizer:this.sanitizer,source:String(e.data[this.mimeType]),linkHandler:this.linkHandler,resolver:this.resolver,translator:this.translator})}}class B extends _{constructor(e){super(e),this.addClass("jp-RenderedJavaScript")}render(e){const t=this.translator.load("jupyterlab");return A({host:this.node,sanitizer:this.sanitizer,source:t.__("JavaScript output is disabled in JupyterLab"),translator:this.translator})}}},3867:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseManager=void 0;const i=n(8571),r=n(2920);t.BaseManager=class{constructor(e){var t;this._isDisposed=!1,this._disposed=new i.Signal(this),this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:r.ServerConnection.makeSettings()}get disposed(){return this._disposed}get isDisposed(){return this._isDisposed}get isActive(){return!0}dispose(){this.isDisposed||(this._disposed.emit(void 0),i.Signal.clearData(this))}}},4219:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BuildManager=void 0;const i=n(8925),r=n(2920);t.BuildManager=class{constructor(e={}){var t;this._url="",this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:r.ServerConnection.makeSettings();const{baseUrl:n,appUrl:s}=this.serverSettings;this._url=i.URLExt.join(n,s,"api/build")}get isAvailable(){return"true"===i.PageConfig.getOption("buildAvailable").toLowerCase()}get shouldCheck(){return"true"===i.PageConfig.getOption("buildCheck").toLowerCase()}getStatus(){const{_url:e,serverSettings:t}=this;return r.ServerConnection.makeRequest(e,{},t).then((e=>{if(200!==e.status)throw new r.ServerConnection.ResponseError(e);return e.json()})).then((e=>{if("string"!=typeof e.status)throw new Error("Invalid data");if("string"!=typeof e.message)throw new Error("Invalid data");return e}))}build(){const{_url:e,serverSettings:t}=this;return r.ServerConnection.makeRequest(e,{method:"POST"},t).then((e=>{if(400===e.status)throw new r.ServerConnection.ResponseError(e,"Build aborted");if(200!==e.status){const t=`Build failed with ${e.status}.\n\n If you are experiencing the build failure after installing an extension (or trying to include previously installed extension after updating JupyterLab) please check the extension repository for new installation instructions as many extensions migrated to the prebuilt extensions system which no longer requires rebuilding JupyterLab (but uses a different installation procedure, typically involving a package manager such as 'pip' or 'conda').\n\n If you specifically intended to install a source extension, please run 'jupyter lab build' on the server for full output.`;throw new r.ServerConnection.ResponseError(e,t)}}))}cancel(){const{_url:e,serverSettings:t}=this;return r.ServerConnection.makeRequest(e,{method:"DELETE"},t).then((e=>{if(204!==e.status)throw new r.ServerConnection.ResponseError(e)}))}}},2170:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigWithDefaults=t.ConfigSection=void 0;const i=n(8925),r=n(7883);(t.ConfigSection||(t.ConfigSection={})).create=function(e){const t=new s(e);return t.load().then((()=>t))};class s{constructor(e){var t;this._url="unknown";const n=this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:r.ServerConnection.makeSettings();this._url=i.URLExt.join(n.baseUrl,"api/config",encodeURIComponent(e.name))}get data(){return this._data}async load(){const e=await r.ServerConnection.makeRequest(this._url,{},this.serverSettings);if(200!==e.status)throw await r.ServerConnection.ResponseError.create(e);this._data=await e.json()}async update(e){this._data={...this._data,...e};const t={method:"PATCH",body:JSON.stringify(e)},n=await r.ServerConnection.makeRequest(this._url,t,this.serverSettings);if(200!==n.status)throw await r.ServerConnection.ResponseError.create(n);return this._data=await n.json(),this._data}}t.ConfigWithDefaults=class{constructor(e){var t,n;this._className="",this._section=e.section,this._defaults=null!==(t=e.defaults)&&void 0!==t?t:{},this._className=null!==(n=e.className)&&void 0!==n?n:""}get(e){const t=this._classData();return e in t?t[e]:this._defaults[e]}set(e,t){const n={};if(n[e]=t,this._className){const e={};return e[this._className]=n,this._section.update(e)}return this._section.update(n)}_classData(){const e=this._section.data;return this._className&&this._className in e?e[this._className]:e}}},8790:(e,t)=>{},9480:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventManager=void 0;const i=n(8925),r=n(6049),s=n(8571),o=n(2920),a="api/events";t.EventManager=class{constructor(e={}){var t;this._socket=null,this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:o.ServerConnection.makeSettings(),this._poll=new r.Poll({factory:()=>this._subscribe()}),this._stream=new s.Stream(this),this._poll.start()}get isDisposed(){return this._poll.isDisposed}get stream(){return this._stream}dispose(){if(this.isDisposed)return;this._poll.dispose();const e=this._socket;e&&(this._socket=null,e.onopen=()=>{},e.onerror=()=>{},e.onmessage=()=>{},e.onclose=()=>{},e.close()),s.Signal.clearData(this),this._stream.stop()}async emit(e){const{serverSettings:t}=this,{baseUrl:n,token:r}=t,{makeRequest:s,ResponseError:l}=o.ServerConnection,d=i.URLExt.join(n,a)+(r?`?token=${r}`:""),u={body:JSON.stringify(e),method:"POST"},c=await s(d,u,t);if(204!==c.status)throw new l(c)}_subscribe(){return new Promise(((e,t)=>{if(this.isDisposed)return;const{token:n,WebSocket:r,wsUrl:s}=this.serverSettings,o=i.URLExt.join(s,a,"subscribe")+(n?`?token=${encodeURIComponent(n)}`:""),l=this._socket=new r(o),d=this._stream;l.onclose=()=>t(new Error("EventManager socket closed")),l.onmessage=e=>e.data&&d.emit(JSON.parse(e.data))}))}}},7883:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(3867),t),r(n(2170),t),r(n(8790),t),r(n(9480),t),r(n(973),t),r(n(2946),t),r(n(9740),t),r(n(2920),t),r(n(7668),t),r(n(7780),t),r(n(9040),t),r(n(9191),t),r(n(8053),t),r(n(8683),t)},7489:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CommHandler=void 0;const o=n(7556),a=s(n(9909));class l extends o.DisposableDelegate{constructor(e,t,n,i){super(i),this._target="",this._id="",this._id=t,this._target=e,this._kernel=n}get commId(){return this._id}get targetName(){return this._target}get onClose(){return this._onClose}set onClose(e){this._onClose=e}get onMsg(){return this._onMsg}set onMsg(e){this._onMsg=e}open(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot open");const i=a.createMessage({msgType:"comm_open",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,target_name:this._target,data:null!=e?e:{}},metadata:t,buffers:n});return this._kernel.sendShellMessage(i,!1,!0)}send(e,t,n=[],i=!0){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot send");const r=a.createMessage({msgType:"comm_msg",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:e},metadata:t,buffers:n});return this._kernel.sendShellMessage(r,!1,i)}close(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot close");const i=a.createMessage({msgType:"comm_close",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:null!=e?e:{}},metadata:t,buffers:n}),r=this._kernel.sendShellMessage(i,!1,!0),s=this._onClose;return s&&s(a.createMessage({msgType:"comm_close",channel:"iopub",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:null!=e?e:{}},metadata:t,buffers:n})),this.dispose(),r}}t.CommHandler=l},2456:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelConnection=void 0;const o=n(8925),a=n(5764),l=n(8571),d=n(7883),u=n(7489),c=s(n(9909)),h=n(134),p=n(7179),g=s(n(5855)),f=n(2946),m=s(n(8235)),v="_RESTARTING_";class b{constructor(e){var t,n,i,r;this._createSocket=(e=!0)=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");const t=this.serverSettings,n=o.URLExt.join(t.wsUrl,m.KERNEL_SERVICE_URL,encodeURIComponent(this._id)),i=n.replace(/^((?:\w+:)?\/\/)(?:[^@\/]+@)/,"$1");console.debug(`Starting WebSocket: ${i}`);let r=o.URLExt.join(n,"channels?session_id="+encodeURIComponent(this._clientId));const s=t.token;t.appendToken&&""!==s&&(r+=`&token=${encodeURIComponent(s)}`);const a=e?this._supportedProtocols:[];this._ws=new t.WebSocket(r,a),this._ws.binaryType="arraybuffer";let l=!1;const u=async e=>{var n,i;if(!this._isDisposed){this._reason="",this._model=void 0;try{const n=await m.getKernelModel(this._id,t);this._model=n,"dead"===(null==n?void 0:n.execution_state)?this._updateStatus("dead"):this._onWSClose(e)}catch(t){if(t instanceof d.ServerConnection.NetworkError||503===(null===(n=t.response)||void 0===n?void 0:n.status)||424===(null===(i=t.response)||void 0===i?void 0:i.status)){const t=1e3*A.getRandomIntInclusive(10,30);setTimeout(u,t,e)}else this._reason="Kernel died unexpectedly",this._updateStatus("dead")}}},c=async e=>{l||(l=!0,await u(e))};this._ws.onmessage=this._onWSMessage,this._ws.onopen=this._onWSOpen,this._ws.onclose=c,this._ws.onerror=c},this._onWSOpen=e=>{if(""!==this._ws.protocol&&!this._supportedProtocols.includes(this._ws.protocol))throw console.log("Server selected unknown kernel wire protocol:",this._ws.protocol),this._updateStatus("dead"),new Error(`Unknown kernel wire protocol: ${this._ws.protocol}`);this._selectedProtocol=this._ws.protocol,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose,this._updateConnectionStatus("connected")},this._onWSMessage=e=>{let t;try{t=(0,p.deserialize)(e.data,this._ws.protocol),g.validateMessage(t)}catch(e){throw e.message=`Kernel message validation error: ${e.message}`,e}this._kernelSession=t.header.session,this._msgChain=this._msgChain.then((()=>this._handleMessage(t))).catch((e=>{e.message.startsWith("Canceled future for ")&&console.error(e)})),this._anyMessage.emit({msg:t,direction:"recv"})},this._onWSClose=e=>{this.isDisposed||this._reconnect()},this._id="",this._name="",this._status="unknown",this._connectionStatus="connecting",this._kernelSession="",this._isDisposed=!1,this._ws=null,this._username="",this._reconnectLimit=7,this._reconnectAttempt=0,this._reconnectTimeout=null,this._supportedProtocols=Object.values(c.supportedKernelWebSocketProtocols),this._selectedProtocol="",this._futures=new Map,this._comms=new Map,this._targetRegistry=Object.create(null),this._info=new a.PromiseDelegate,this._pendingMessages=[],this._statusChanged=new l.Signal(this),this._connectionStatusChanged=new l.Signal(this),this._disposed=new l.Signal(this),this._iopubMessage=new l.Signal(this),this._anyMessage=new l.Signal(this),this._pendingInput=new l.Signal(this),this._unhandledMessage=new l.Signal(this),this._displayIdToParentIds=new Map,this._msgIdToDisplayIds=new Map,this._msgChain=Promise.resolve(),this._hasPendingInput=!1,this._reason="",this._noOp=()=>{},this._name=e.model.name,this._id=e.model.id,this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:d.ServerConnection.makeSettings(),this._clientId=null!==(n=e.clientId)&&void 0!==n?n:a.UUID.uuid4(),this._username=null!==(i=e.username)&&void 0!==i?i:"",this.handleComms=null===(r=e.handleComms)||void 0===r||r,this._createSocket()}get disposed(){return this._disposed}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get model(){return this._model||{id:this.id,name:this.name,reason:this._reason}}get anyMessage(){return this._anyMessage}get pendingInput(){return this._pendingInput}get id(){return this._id}get name(){return this._name}get username(){return this._username}get clientId(){return this._clientId}get status(){return this._status}get connectionStatus(){return this._connectionStatus}get isDisposed(){return this._isDisposed}get info(){return this._info.promise}get spec(){return this._specPromise||(this._specPromise=f.KernelSpecAPI.getSpecs(this.serverSettings).then((e=>e.kernelspecs[this._name]))),this._specPromise}clone(e={}){return new b({model:this.model,username:this.username,serverSettings:this.serverSettings,handleComms:!1,...e})}dispose(){this.isDisposed||(this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearKernelState(),this._pendingMessages=[],this._clearSocket(),l.Signal.clearData(this))}sendShellMessage(e,t=!1,n=!0){return this._sendKernelShellControl(h.KernelShellFutureHandler,e,t,n)}sendControlMessage(e,t=!1,n=!0){return this._sendKernelShellControl(h.KernelControlFutureHandler,e,t,n)}_sendKernelShellControl(e,t,n=!1,i=!0){this._sendMessage(t),this._anyMessage.emit({msg:t,direction:"send"});const r=new e((()=>{const e=t.header.msg_id;this._futures.delete(e);const n=this._msgIdToDisplayIds.get(e);n&&(n.forEach((t=>{const n=this._displayIdToParentIds.get(t);if(n){const i=n.indexOf(e);if(-1===i)return;1===n.length?this._displayIdToParentIds.delete(t):(n.splice(i,1),this._displayIdToParentIds.set(t,n))}})),this._msgIdToDisplayIds.delete(e))}),t,n,i,this);return this._futures.set(t.header.msg_id,r),r}_sendMessage(e,t=!0){if("dead"===this.status)throw new Error("Kernel is dead");if((""===this._kernelSession||this._kernelSession===v)&&c.isInfoRequestMsg(e)){if("connected"===this.connectionStatus)return void this._ws.send((0,p.serialize)(e,this._ws.protocol));throw new Error("Could not send message: status is not connected")}if(t&&this._pendingMessages.length>0)this._pendingMessages.push(e);else if("connected"===this.connectionStatus&&this._kernelSession!==v)this._ws.send((0,p.serialize)(e,this._ws.protocol));else{if(!t)throw new Error("Could not send message");this._pendingMessages.push(e)}}async interrupt(){if(this.hasPendingInput=!1,"dead"===this.status)throw new Error("Kernel is dead");return m.interruptKernel(this.id,this.serverSettings)}async restart(){if("dead"===this.status)throw new Error("Kernel is dead");this._updateStatus("restarting"),this._clearKernelState(),this._kernelSession=v,await m.restartKernel(this.id,this.serverSettings),await this.reconnect(),this.hasPendingInput=!1}reconnect(){this._errorIfDisposed();const e=new a.PromiseDelegate,t=(n,i)=>{"connected"===i?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):"disconnected"===i&&(e.reject(new Error("Kernel connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}async shutdown(){"dead"!==this.status&&await m.shutdownKernel(this.id,this.serverSettings),this.handleShutdown()}handleShutdown(){this._updateStatus("dead"),this.dispose()}async requestKernelInfo(){const e=c.createMessage({msgType:"kernel_info_request",channel:"shell",username:this._username,session:this._clientId,content:{}});let t;try{t=await A.handleShellMessage(this,e)}catch(e){if(this.isDisposed)return;throw e}if(this._errorIfDisposed(),t)return void 0===t.content.status&&(t.content.status="ok"),"ok"!==t.content.status?(this._info.reject("Kernel info reply errored"),t):(this._info.resolve(t.content),this._kernelSession=t.header.session,t)}requestComplete(e){const t=c.createMessage({msgType:"complete_request",channel:"shell",username:this._username,session:this._clientId,content:e});return A.handleShellMessage(this,t)}requestInspect(e){const t=c.createMessage({msgType:"inspect_request",channel:"shell",username:this._username,session:this._clientId,content:e});return A.handleShellMessage(this,t)}requestHistory(e){const t=c.createMessage({msgType:"history_request",channel:"shell",username:this._username,session:this._clientId,content:e});return A.handleShellMessage(this,t)}requestExecute(e,t=!0,n){const i=c.createMessage({msgType:"execute_request",channel:"shell",username:this._username,session:this._clientId,content:{silent:!1,store_history:!0,user_expressions:{},allow_stdin:!0,stop_on_error:!1,...e},metadata:n});return this.sendShellMessage(i,!0,t)}requestDebug(e,t=!0){const n=c.createMessage({msgType:"debug_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestIsComplete(e){const t=c.createMessage({msgType:"is_complete_request",channel:"shell",username:this._username,session:this._clientId,content:e});return A.handleShellMessage(this,t)}requestCommInfo(e){const t=c.createMessage({msgType:"comm_info_request",channel:"shell",username:this._username,session:this._clientId,content:e});return A.handleShellMessage(this,t)}sendInputReply(e,t){const n=c.createMessage({msgType:"input_reply",channel:"stdin",username:this._username,session:this._clientId,content:e});n.parent_header=t,this._sendMessage(n),this._anyMessage.emit({msg:n,direction:"send"}),this.hasPendingInput=!1}createComm(e,t=a.UUID.uuid4()){if(!this.handleComms)throw new Error("Comms are disabled on this kernel connection");if(this._comms.has(t))throw new Error("Comm is already created");const n=new u.CommHandler(e,t,this,(()=>{this._unregisterComm(t)}));return this._comms.set(t,n),n}hasComm(e){return this._comms.has(e)}registerCommTarget(e,t){this.handleComms&&(this._targetRegistry[e]=t)}removeCommTarget(e,t){this.handleComms&&(this.isDisposed||this._targetRegistry[e]!==t||delete this._targetRegistry[e])}registerMessageHook(e,t){var n;const i=null===(n=this._futures)||void 0===n?void 0:n.get(e);i&&i.registerMessageHook(t)}removeMessageHook(e,t){var n;const i=null===(n=this._futures)||void 0===n?void 0:n.get(e);i&&i.removeMessageHook(t)}removeInputGuard(){this.hasPendingInput=!1}async _handleDisplayId(e,t){var n,i;const r=t.parent_header.msg_id;let s=this._displayIdToParentIds.get(e);if(s){const e={header:a.JSONExt.deepCopy(t.header),parent_header:a.JSONExt.deepCopy(t.parent_header),metadata:a.JSONExt.deepCopy(t.metadata),content:a.JSONExt.deepCopy(t.content),channel:t.channel,buffers:t.buffers?t.buffers.slice():[]};e.header.msg_type="update_display_data",await Promise.all(s.map((async t=>{const n=this._futures&&this._futures.get(t);n&&await n.handleMsg(e)})))}if("update_display_data"===t.header.msg_type)return!0;s=null!==(n=this._displayIdToParentIds.get(e))&&void 0!==n?n:[],-1===s.indexOf(r)&&s.push(r),this._displayIdToParentIds.set(e,s);const o=null!==(i=this._msgIdToDisplayIds.get(r))&&void 0!==i?i:[];return-1===o.indexOf(r)&&o.push(r),this._msgIdToDisplayIds.set(r,o),!1}_clearSocket(){null!==this._ws&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}_updateStatus(e){this._status!==e&&"dead"!==this._status&&(this._status=e,A.logKernelStatus(this),this._statusChanged.emit(e),"dead"===e&&this.dispose())}_sendPending(){for(;"connected"===this.connectionStatus&&this._kernelSession!==v&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}_clearKernelState(){this._kernelSession="",this._pendingMessages=[],this._futures.forEach((e=>{e.dispose()})),this._comms.forEach((e=>{e.dispose()})),this._msgChain=Promise.resolve(),this._futures=new Map,this._comms=new Map,this._displayIdToParentIds.clear(),this._msgIdToDisplayIds.clear()}_assertCurrentMessage(e){if(this._errorIfDisposed(),e.header.session!==this._kernelSession)throw new Error(`Canceling handling of old message: ${e.header.msg_type}`)}async _handleCommOpen(e){this._assertCurrentMessage(e);const t=e.content,n=new u.CommHandler(t.target_name,t.comm_id,this,(()=>{this._unregisterComm(t.comm_id)}));this._comms.set(t.comm_id,n);try{const i=await A.loadObject(t.target_name,t.target_module,this._targetRegistry);await i(n,e)}catch(e){throw n.close(),console.error("Exception opening new comm"),e}}async _handleCommClose(e){this._assertCurrentMessage(e);const t=e.content,n=this._comms.get(t.comm_id);if(!n)return void console.error("Comm not found for comm id "+t.comm_id);this._unregisterComm(n.commId);const i=n.onClose;i&&await i(e),n.dispose()}async _handleCommMsg(e){this._assertCurrentMessage(e);const t=e.content,n=this._comms.get(t.comm_id);if(!n)return;const i=n.onMsg;i&&await i(e)}_unregisterComm(e){this._comms.delete(e)}_updateConnectionStatus(e){if(this._connectionStatus!==e){if(this._connectionStatus=e,"connecting"!==e&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),"dead"!==this.status)if("connected"===e){let e=this._kernelSession===v,t=this.requestKernelInfo(),n=!1,i=()=>{n||(n=!0,e&&this._kernelSession===v&&(this._kernelSession=""),clearTimeout(r),this._pendingMessages.length>0&&this._sendPending())};t.then(i);let r=setTimeout(i,3e3)}else this._updateStatus("unknown");this._connectionStatusChanged.emit(e)}}async _handleMessage(e){var t,n;let i=!1;if(e.parent_header&&"iopub"===e.channel&&(c.isDisplayDataMsg(e)||c.isUpdateDisplayDataMsg(e)||c.isExecuteResultMsg(e))){const n=(null!==(t=e.content.transient)&&void 0!==t?t:{}).display_id;n&&(i=await this._handleDisplayId(n,e),this._assertCurrentMessage(e))}if(!i&&e.parent_header){const t=e.parent_header,i=null===(n=this._futures)||void 0===n?void 0:n.get(t.msg_id);if(i)await i.handleMsg(e),this._assertCurrentMessage(e);else{const n=t.session===this.clientId;"iopub"!==e.channel&&n&&this._unhandledMessage.emit(e)}}if("iopub"===e.channel){switch(e.header.msg_type){case"status":{const t=e.content.execution_state;"restarting"===t&&Promise.resolve().then((async()=>{this._updateStatus("autorestarting"),this._clearKernelState(),await this.reconnect()})),this._updateStatus(t);break}case"comm_open":this.handleComms&&await this._handleCommOpen(e);break;case"comm_msg":this.handleComms&&await this._handleCommMsg(e);break;case"comm_close":this.handleComms&&await this._handleCommClose(e)}this.isDisposed||(this._assertCurrentMessage(e),this._iopubMessage.emit(e))}}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt{if(t){if("undefined"==typeof requirejs)throw new Error("requirejs not found");requirejs([t],(n=>{void 0===n[e]?r(new Error(`Object '${e}' not found in module '${t}'`)):i(n[e])}),r)}else(null==n?void 0:n[e])?i(n[e]):r(new Error(`Object '${e}' not found in registry`))}))},e.getRandomIntInclusive=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}}(A||(A={}))},134:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelShellFutureHandler=t.KernelControlFutureHandler=t.KernelFutureHandler=void 0;const o=n(5764),a=n(7556),l=s(n(9909));class d extends a.DisposableDelegate{constructor(e,t,n,i,r){super(e),this._status=0,this._stdin=u.noOp,this._iopub=u.noOp,this._reply=u.noOp,this._done=new o.PromiseDelegate,this._hooks=new u.HookList,this._disposeOnDone=!0,this._msg=t,n||this._setFlag(u.KernelFutureFlag.GotReply),this._disposeOnDone=i,this._kernel=r}get msg(){return this._msg}get done(){return this._done.promise}get onReply(){return this._reply}set onReply(e){this._reply=e}get onIOPub(){return this._iopub}set onIOPub(e){this._iopub=e}get onStdin(){return this._stdin}set onStdin(e){this._stdin=e}registerMessageHook(e){if(this.isDisposed)throw new Error("Kernel future is disposed");this._hooks.add(e)}removeMessageHook(e){this.isDisposed||this._hooks.remove(e)}sendInputReply(e,t){this._kernel.sendInputReply(e,t)}dispose(){this._stdin=u.noOp,this._iopub=u.noOp,this._reply=u.noOp,this._hooks=null,this._testFlag(u.KernelFutureFlag.IsDone)||(this._done.promise.catch((()=>{})),this._done.reject(new Error(`Canceled future for ${this.msg.header.msg_type} message before replies were done`))),super.dispose()}async handleMsg(e){switch(e.channel){case"control":case"shell":e.channel===this.msg.channel&&e.parent_header.msg_id===this.msg.header.msg_id&&await this._handleReply(e);break;case"stdin":await this._handleStdin(e);break;case"iopub":await this._handleIOPub(e)}}async _handleReply(e){const t=this._reply;t&&await t(e),this._replyMsg=e,this._setFlag(u.KernelFutureFlag.GotReply),this._testFlag(u.KernelFutureFlag.GotIdle)&&this._handleDone()}async _handleStdin(e){this._kernel.hasPendingInput=!0;const t=this._stdin;t&&await t(e)}async _handleIOPub(e){const t=await this._hooks.process(e),n=this._iopub;t&&n&&await n(e),l.isStatusMsg(e)&&"idle"===e.content.execution_state&&(this._setFlag(u.KernelFutureFlag.GotIdle),this._testFlag(u.KernelFutureFlag.GotReply)&&this._handleDone())}_handleDone(){this._testFlag(u.KernelFutureFlag.IsDone)||(this._setFlag(u.KernelFutureFlag.IsDone),this._done.resolve(this._replyMsg),this._disposeOnDone&&this.dispose())}_testFlag(e){return!!(this._status&e)}_setFlag(e){this._status|=e}}var u;t.KernelFutureHandler=d,t.KernelControlFutureHandler=class extends d{},t.KernelShellFutureHandler=class extends d{},function(e){e.noOp=()=>{};const t="function"==typeof requestAnimationFrame?requestAnimationFrame:setImmediate;let n;e.HookList=class{constructor(){this._hooks=[]}add(e){this.remove(e),this._hooks.push(e)}remove(e){const t=this._hooks.indexOf(e);t>=0&&(this._hooks[t]=null,this._scheduleCompact())}async process(e){await this._processing;const t=new o.PromiseDelegate;let n;this._processing=t.promise;for(let i=this._hooks.length-1;i>=0;i--){const r=this._hooks[i];if(null!==r){try{n=await r(e)}catch(e){n=!0,console.error(e)}if(!1===n)return t.resolve(void 0),!1}}return t.resolve(void 0),!0}_scheduleCompact(){this._compactScheduled||(this._compactScheduled=!0,t((()=>{this._processing=this._processing.then((()=>{this._compactScheduled=!1,this._compact()}))})))}_compact(){let e=0;for(let t=0,n=this._hooks.length;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5198:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KernelManager=void 0;const i=n(6049),r=n(8571),s=n(7883),o=n(3867),a=n(8235),l=n(2456);class d extends o.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._kernelConnections=new Set,this._models=new Map,this._runningChanged=new r.Signal(this),this._connectionFailure=new r.Signal(this),this._pollModels=new i.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:1e4,backoff:!0,max:3e5},name:"@jupyterlab/services:KernelManager#models",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._kernelConnections.forEach((e=>e.dispose())),this._pollModels.dispose(),super.dispose())}connectTo(e){var t;const{id:n}=e.model;let i=null===(t=e.handleComms)||void 0===t||t;if(void 0===e.handleComms)for(const e of this._kernelConnections)if(e.id===n&&e.handleComms){i=!1;break}const r=new l.KernelConnection({handleComms:i,...e,serverSettings:this.serverSettings});return this._onStarted(r),this._models.has(n)||this.refreshRunning().catch((()=>{})),r}running(){return this._models.values()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e={},t={}){const n=await(0,a.startNew)(e,this.serverSettings);return this.connectTo({...t,model:n})}async shutdown(e){await(0,a.shutdownKernel)(e,this.serverSettings),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map((e=>(0,a.shutdownKernel)(e,this.serverSettings)))),await this.refreshRunning()}async findById(e){return this._models.has(e)||await this.refreshRunning(),this._models.get(e)}async requestRunning(){var e,t;let n;try{n=await(0,a.listRunning)(this.serverSettings)}catch(n){throw(n instanceof s.ServerConnection.NetworkError||503===(null===(e=n.response)||void 0===e?void 0:e.status)||424===(null===(t=n.response)||void 0===t?void 0:t.status))&&this._connectionFailure.emit(n),n}this.isDisposed||this._models.size===n.length&&n.every((e=>{const t=this._models.get(e.id);return!!t&&t.connections===e.connections&&t.execution_state===e.execution_state&&t.last_activity===e.last_activity&&t.name===e.name&&t.reason===e.reason&&t.traceback===e.traceback}))||(this._models=new Map(n.map((e=>[e.id,e]))),this._kernelConnections.forEach((e=>{this._models.has(e.id)||e.handleShutdown()})),this._runningChanged.emit(n))}_onStarted(e){this._kernelConnections.add(e),e.statusChanged.connect(this._onStatusChanged,this),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._kernelConnections.delete(e),this.refreshRunning().catch((()=>{}))}_onStatusChanged(e,t){"dead"===t&&this.refreshRunning().catch((()=>{}))}}t.KernelManager=d,function(e){e.NoopManager=class extends e{constructor(){super(...arguments),this._readyPromise=new Promise((()=>{}))}get isActive(){return!1}get parentReady(){return super.ready}async startNew(e={},t={}){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}connectTo(e){throw new Error("Not implemented in no-op Kernel Manager")}async shutdown(e){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}get ready(){return this.parentReady.then((()=>this._readyPromise))}async requestRunning(){return Promise.resolve()}}}(d=t.KernelManager||(t.KernelManager={}))},9909:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportedKernelWebSocketProtocols=t.isInputReplyMsg=t.isInputRequestMsg=t.isDebugReplyMsg=t.isDebugRequestMsg=t.isExecuteReplyMsg=t.isInfoRequestMsg=t.isCommMsgMsg=t.isCommCloseMsg=t.isCommOpenMsg=t.isDebugEventMsg=t.isClearOutputMsg=t.isStatusMsg=t.isErrorMsg=t.isExecuteResultMsg=t.isExecuteInputMsg=t.isUpdateDisplayDataMsg=t.isDisplayDataMsg=t.isStreamMsg=t.createMessage=void 0;const i=n(5764);t.createMessage=function(e){var t,n,r,s,o;return{buffers:null!==(t=e.buffers)&&void 0!==t?t:[],channel:e.channel,content:e.content,header:{date:(new Date).toISOString(),msg_id:null!==(n=e.msgId)&&void 0!==n?n:i.UUID.uuid4(),msg_type:e.msgType,session:e.session,username:null!==(r=e.username)&&void 0!==r?r:"",version:"5.2"},metadata:null!==(s=e.metadata)&&void 0!==s?s:{},parent_header:null!==(o=e.parentHeader)&&void 0!==o?o:{}}},t.isStreamMsg=function(e){return"stream"===e.header.msg_type},t.isDisplayDataMsg=function(e){return"display_data"===e.header.msg_type},t.isUpdateDisplayDataMsg=function(e){return"update_display_data"===e.header.msg_type},t.isExecuteInputMsg=function(e){return"execute_input"===e.header.msg_type},t.isExecuteResultMsg=function(e){return"execute_result"===e.header.msg_type},t.isErrorMsg=function(e){return"error"===e.header.msg_type},t.isStatusMsg=function(e){return"status"===e.header.msg_type},t.isClearOutputMsg=function(e){return"clear_output"===e.header.msg_type},t.isDebugEventMsg=function(e){return"debug_event"===e.header.msg_type},t.isCommOpenMsg=function(e){return"comm_open"===e.header.msg_type},t.isCommCloseMsg=function(e){return"comm_close"===e.header.msg_type},t.isCommMsgMsg=function(e){return"comm_msg"===e.header.msg_type},t.isInfoRequestMsg=function(e){return"kernel_info_request"===e.header.msg_type},t.isExecuteReplyMsg=function(e){return"execute_reply"===e.header.msg_type},t.isDebugRequestMsg=function(e){return"debug_request"===e.header.msg_type},t.isDebugReplyMsg=function(e){return"debug_reply"===e.header.msg_type},t.isInputRequestMsg=function(e){return"input_request"===e.header.msg_type},t.isInputReplyMsg=function(e){return"input_reply"===e.header.msg_type},(t.supportedKernelWebSocketProtocols||(t.supportedKernelWebSocketProtocols={})).v1KernelWebsocketJupyterOrg="v1.kernel.websocket.jupyter.org"},8235:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getKernelModel=t.shutdownKernel=t.interruptKernel=t.restartKernel=t.startNew=t.listRunning=t.KERNEL_SERVICE_URL=void 0;const i=n(2920),r=n(8925),s=n(5855);t.KERNEL_SERVICE_URL="api/kernels",t.listRunning=async function(e=i.ServerConnection.makeSettings()){const n=r.URLExt.join(e.baseUrl,t.KERNEL_SERVICE_URL),o=await i.ServerConnection.makeRequest(n,{},e);if(200!==o.status)throw await i.ServerConnection.ResponseError.create(o);const a=await o.json();return(0,s.validateModels)(a),a},t.startNew=async function(e={},n=i.ServerConnection.makeSettings()){const o=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL),a={method:"POST",body:JSON.stringify(e)},l=await i.ServerConnection.makeRequest(o,a,n);if(201!==l.status)throw await i.ServerConnection.ResponseError.create(l);const d=await l.json();return(0,s.validateModel)(d),d},t.restartKernel=async function(e,n=i.ServerConnection.makeSettings()){const o=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL,encodeURIComponent(e),"restart"),a=await i.ServerConnection.makeRequest(o,{method:"POST"},n);if(200!==a.status)throw await i.ServerConnection.ResponseError.create(a);const l=await a.json();(0,s.validateModel)(l)},t.interruptKernel=async function(e,n=i.ServerConnection.makeSettings()){const s=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL,encodeURIComponent(e),"interrupt"),o=await i.ServerConnection.makeRequest(s,{method:"POST"},n);if(204!==o.status)throw await i.ServerConnection.ResponseError.create(o)},t.shutdownKernel=async function(e,n=i.ServerConnection.makeSettings()){const s=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL,encodeURIComponent(e)),o=await i.ServerConnection.makeRequest(s,{method:"DELETE"},n);if(404===o.status){const t=`The kernel "${e}" does not exist on the server`;console.warn(t)}else if(204!==o.status)throw await i.ServerConnection.ResponseError.create(o)},t.getKernelModel=async function(e,n=i.ServerConnection.makeSettings()){const o=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL,encodeURIComponent(e)),a=await i.ServerConnection.makeRequest(o,{},n);if(404===a.status)return;if(200!==a.status)throw await i.ServerConnection.ResponseError.create(a);const l=await a.json();return(0,s.validateModel)(l),l}},7179:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.deserialize=t.serialize=void 0;const o=s(n(9909));var a;t.serialize=function(e,t=""){return t===o.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg?a.serializeV1KernelWebsocketJupyterOrg(e):a.serializeDefault(e)},t.deserialize=function(e,t=""){return t===o.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg?a.deserializeV1KernelWebsocketJupyterOrg(e):a.deserializeDefault(e)},function(e){e.deserializeV1KernelWebsocketJupyterOrg=function(e){let t;const n=new DataView(e),i=Number(n.getBigUint64(0,!0));let r=[];for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateModels=t.validateModel=t.validateMessage=void 0;const i=n(7441),r=["username","version","session","msg_id","msg_type"],s={stream:{name:"string",text:"string"},display_data:{data:"object",metadata:"object"},execute_input:{code:"string",execution_count:"number"},execute_result:{execution_count:"number",data:"object",metadata:"object"},error:{ename:"string",evalue:"string",traceback:"object"},status:{execution_state:["string",["starting","idle","busy","restarting","dead"]]},clear_output:{wait:"boolean"},comm_open:{comm_id:"string",target_name:"string",data:"object"},comm_msg:{comm_id:"string",data:"object"},comm_close:{comm_id:"string"},shutdown_reply:{restart:"boolean"}};function o(e){(0,i.validateProperty)(e,"name","string"),(0,i.validateProperty)(e,"id","string")}t.validateMessage=function(e){(0,i.validateProperty)(e,"metadata","object"),(0,i.validateProperty)(e,"content","object"),(0,i.validateProperty)(e,"channel","string"),function(e){for(let t=0;to(e)))}},2946:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t},o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelSpecAPI=t.KernelSpec=void 0;const a=s(n(4806));t.KernelSpec=a;const l=s(n(6492));t.KernelSpecAPI=l,o(n(733),t)},4806:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},733:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelSpecManager=void 0;const o=n(5764),a=n(6049),l=n(8571),d=s(n(6492)),u=n(3867);class c extends u.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._connectionFailure=new l.Signal(this),this._specs=null,this._specsChanged=new l.Signal(this),this._ready=Promise.all([this.requestSpecs()]).then((e=>{})).catch((e=>{})).then((()=>{this.isDisposed||(this._isReady=!0)})),this._pollSpecs=new a.Poll({auto:!1,factory:()=>this.requestSpecs(),frequency:{interval:61e3,backoff:!0,max:3e5},name:"@jupyterlab/services:KernelSpecManager#specs",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this.ready.then((()=>{this._pollSpecs.start()}))}get isReady(){return this._isReady}get ready(){return this._ready}get specs(){return this._specs}get specsChanged(){return this._specsChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshSpecs(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestSpecs(){const e=await d.getSpecs(this.serverSettings);this.isDisposed||o.JSONExt.deepEqual(e,this._specs)||(this._specs=e,this._specsChanged.emit(e))}}t.KernelSpecManager=c},6492:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSpecs=void 0;const i=n(2920),r=n(2598),s=n(8925);t.getSpecs=async function(e=i.ServerConnection.makeSettings()){const t=s.URLExt.join(e.baseUrl,"api/kernelspecs"),n=await i.ServerConnection.makeRequest(t,{},e);if(200!==n.status)throw await i.ServerConnection.ResponseError.create(n);const o=await n.json();return(0,r.validateSpecModels)(o)}},2598:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSpecModels=t.validateSpecModel=void 0;const i=n(7441);function r(e){const t=e.spec;if(!t)throw new Error("Invalid kernel spec");(0,i.validateProperty)(e,"name","string"),(0,i.validateProperty)(e,"resources","object"),(0,i.validateProperty)(t,"language","string"),(0,i.validateProperty)(t,"display_name","string"),(0,i.validateProperty)(t,"argv","array");let n=null;t.hasOwnProperty("metadata")&&((0,i.validateProperty)(t,"metadata","object"),n=t.metadata);let r=null;return t.hasOwnProperty("env")&&((0,i.validateProperty)(t,"env","object"),r=t.env),{name:e.name,resources:e.resources,language:t.language,display_name:t.display_name,argv:t.argv,metadata:n,env:r}}t.validateSpecModel=r,t.validateSpecModels=function(e){if(!e.hasOwnProperty("kernelspecs"))throw new Error("No kernelspecs found");let t=Object.keys(e.kernelspecs);const n=Object.create(null);let i=e.default;for(let i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceManager=void 0;const i=n(8571),r=n(4219),s=n(8790),o=n(9480),a=n(973),l=n(2946),d=n(8683),u=n(2920),c=n(7668),h=n(7780),p=n(9040),g=n(9191),f=n(8053);t.ServiceManager=class{constructor(e={}){var t,n;this._isDisposed=!1,this._connectionFailure=new i.Signal(this),this._isReady=!1;const m=e.defaultDrive,v=null!==(t=e.serverSettings)&&void 0!==t?t:u.ServerConnection.makeSettings(),b={defaultDrive:m,serverSettings:v,standby:null!==(n=e.standby)&&void 0!==n?n:"when-hidden"};this.serverSettings=v,this.contents=e.contents||new s.ContentsManager(b),this.events=e.events||new o.EventManager(b),this.kernels=e.kernels||new a.KernelManager(b),this.sessions=e.sessions||new c.SessionManager({...b,kernelManager:this.kernels}),this.settings=e.settings||new h.SettingManager(b),this.terminals=e.terminals||new p.TerminalManager(b),this.builder=e.builder||new r.BuildManager(b),this.workspaces=e.workspaces||new f.WorkspaceManager(b),this.nbconvert=e.nbconvert||new d.NbConvertManager(b),this.kernelspecs=e.kernelspecs||new l.KernelSpecManager(b),this.user=e.user||new g.UserManager(b),this.kernelspecs.connectionFailure.connect(this._onConnectionFailure,this),this.sessions.connectionFailure.connect(this._onConnectionFailure,this),this.terminals.connectionFailure.connect(this._onConnectionFailure,this);const A=[this.sessions.ready,this.kernelspecs.ready];this.terminals.isAvailable()&&A.push(this.terminals.ready),this._readyPromise=Promise.all(A).then((()=>{this._isReady=!0}))}get connectionFailure(){return this._connectionFailure}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,i.Signal.clearData(this),this.contents.dispose(),this.events.dispose(),this.sessions.dispose(),this.terminals.dispose())}get isReady(){return this._isReady}get ready(){return this._readyPromise}_onConnectionFailure(e,t){this._connectionFailure.emit(t)}}},8683:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NbConvertManager=void 0;const i=n(8925),r=n(2920),s=n(5764);t.NbConvertManager=class{constructor(e={}){var t;this._exportFormats=null,this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:r.ServerConnection.makeSettings()}async fetchExportFormats(){this._requestingFormats=new s.PromiseDelegate,this._exportFormats=null;const e=this.serverSettings.baseUrl,t=i.URLExt.join(e,"api/nbconvert"),{serverSettings:n}=this,o=await r.ServerConnection.makeRequest(t,{},n);if(200!==o.status)throw await r.ServerConnection.ResponseError.create(o);const a=await o.json(),l={};return Object.keys(a).forEach((function(e){const t=a[e].output_mimetype;l[e]={output_mimetype:t}})),this._exportFormats=l,this._requestingFormats.resolve(l),l}async getExportFormats(e=!0){return this._requestingFormats?this._requestingFormats.promise:e||!this._exportFormats?await this.fetchExportFormats():this._exportFormats}}},2920:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerConnection=void 0;const i=n(8925);let r;var s,o;r="undefined"==typeof window?n(7251):WebSocket,function(e){e.makeSettings=function(e){return o.makeSettings(e)},e.makeRequest=function(e,t,n){return o.handleRequest(e,t,n)};class t extends Error{static async create(e){try{const n=await e.json(),{message:i,traceback:r}=n;return r&&console.error(r),new t(e,null!=i?i:t._defaultMessage(e),null!=r?r:"")}catch(n){return console.debug(n),new t(e)}}constructor(e,n=t._defaultMessage(e),i=""){super(n),this.response=e,this.traceback=i}static _defaultMessage(e){return`Invalid response: ${e.status} ${e.statusText}`}}e.ResponseError=t;class n extends TypeError{constructor(e){super(e.message),this.stack=e.stack}}e.NetworkError=n}(s=t.ServerConnection||(t.ServerConnection={})),function(e){e.makeSettings=function(e={}){var t;const n=i.PageConfig.getBaseUrl(),s=i.PageConfig.getWsUrl(),o=i.URLExt.normalize(e.baseUrl)||n;let a=e.wsUrl;return a||o!==n||(a=s),a||0!==o.indexOf("http")||(a="ws"+o.slice(4)),a=null!=a?a:s,{init:{cache:"no-store",credentials:"same-origin"},fetch,Headers,Request,WebSocket:r,token:i.PageConfig.getToken(),appUrl:i.PageConfig.getOption("appUrl"),appendToken:"undefined"==typeof window||"undefined"!=typeof process&&void 0!==(null===(t=null===process||void 0===process?void 0:process.env)||void 0===t?void 0:t.JEST_WORKER_ID)||i.URLExt.getHostName(n)!==i.URLExt.getHostName(a),...e,baseUrl:o,wsUrl:a}},e.handleRequest=function(e,t,n){var i;if(0!==e.indexOf(n.baseUrl))throw new Error("Can only be used for notebook server requests");"no-store"===(null!==(i=t.cache)&&void 0!==i?i:n.init.cache)&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());const r=new n.Request(e,{...n.init,...t});let o=!1;if(n.token&&(o=!0,r.headers.append("Authorization",`token ${n.token}`)),"undefined"!=typeof document&&(null===document||void 0===document?void 0:document.cookie)){const e=function(e){const t=document.cookie.match("\\b_xsrf=([^;]*)\\b");return null==t?void 0:t[1]}();void 0!==e&&(o=!0,r.headers.append("X-XSRFToken",e))}return!r.headers.has("Content-Type")&&o&&r.headers.set("Content-Type","application/json"),n.fetch.call(null,r).catch((e=>{throw new s.NetworkError(e)}))}}(o||(o={}))},5341:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionConnection=void 0;const i=n(8571),r=n(7883),s=n(7570),o=n(5764);t.SessionConnection=class{constructor(e){var t,n,s,a;this._id="",this._path="",this._name="",this._type="",this._kernel=null,this._isDisposed=!1,this._disposed=new i.Signal(this),this._kernelChanged=new i.Signal(this),this._statusChanged=new i.Signal(this),this._connectionStatusChanged=new i.Signal(this),this._pendingInput=new i.Signal(this),this._iopubMessage=new i.Signal(this),this._unhandledMessage=new i.Signal(this),this._anyMessage=new i.Signal(this),this._propertyChanged=new i.Signal(this),this._id=e.model.id,this._name=e.model.name,this._path=e.model.path,this._type=e.model.type,this._username=null!==(t=e.username)&&void 0!==t?t:"",this._clientId=null!==(n=e.clientId)&&void 0!==n?n:o.UUID.uuid4(),this._connectToKernel=e.connectToKernel,this._kernelConnectionOptions=null!==(s=e.kernelConnectionOptions)&&void 0!==s?s:{},this.serverSettings=null!==(a=e.serverSettings)&&void 0!==a?a:r.ServerConnection.makeSettings(),this.setupKernel(e.model.kernel)}get disposed(){return this._disposed}get kernelChanged(){return this._kernelChanged}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get pendingInput(){return this._pendingInput}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get anyMessage(){return this._anyMessage}get propertyChanged(){return this._propertyChanged}get id(){return this._id}get kernel(){return this._kernel}get path(){return this._path}get type(){return this._type}get name(){return this._name}get model(){return{id:this.id,kernel:this.kernel&&{id:this.kernel.id,name:this.kernel.name},path:this._path,type:this._type,name:this._name}}get isDisposed(){return this._isDisposed}update(e){const t=this.model;if(this._path=e.path,this._name=e.name,this._type=e.type,null===this._kernel&&null!==e.kernel||null!==this._kernel&&null===e.kernel||null!==this._kernel&&null!==e.kernel&&this._kernel.id!==e.kernel.id){null!==this._kernel&&this._kernel.dispose();const t=this._kernel||null;this.setupKernel(e.kernel);const n=this._kernel||null;this._kernelChanged.emit({name:"kernel",oldValue:t,newValue:n})}this._handleModelChange(t)}dispose(){if(!this.isDisposed){if(this._isDisposed=!0,this._disposed.emit(),this._kernel){this._kernel.dispose();const e=this._kernel;this._kernel=null;const t=this._kernel;this._kernelChanged.emit({name:"kernel",oldValue:e,newValue:t})}i.Signal.clearData(this)}}async setPath(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({path:e})}async setName(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({name:e})}async setType(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({type:e})}async changeKernel(e){if(this.isDisposed)throw new Error("Session is disposed");return await this._patch({kernel:e}),this.kernel}async shutdown(){if(this.isDisposed)throw new Error("Session is disposed");await(0,s.shutdownSession)(this.id,this.serverSettings),this.dispose()}setupKernel(e){if(null===e)return void(this._kernel=null);const t=this._connectToKernel({...this._kernelConnectionOptions,model:e,username:this._username,clientId:this._clientId,serverSettings:this.serverSettings});this._kernel=t,t.statusChanged.connect(this.onKernelStatus,this),t.connectionStatusChanged.connect(this.onKernelConnectionStatus,this),t.pendingInput.connect(this.onPendingInput,this),t.unhandledMessage.connect(this.onUnhandledMessage,this),t.iopubMessage.connect(this.onIOPubMessage,this),t.anyMessage.connect(this.onAnyMessage,this)}onKernelStatus(e,t){this._statusChanged.emit(t)}onKernelConnectionStatus(e,t){this._connectionStatusChanged.emit(t)}onPendingInput(e,t){this._pendingInput.emit(t)}onIOPubMessage(e,t){this._iopubMessage.emit(t)}onUnhandledMessage(e,t){this._unhandledMessage.emit(t)}onAnyMessage(e,t){this._anyMessage.emit(t)}async _patch(e){const t=await(0,s.updateSession)({...e,id:this._id},this.serverSettings);return this.update(t),t}_handleModelChange(e){e.name!==this._name&&this._propertyChanged.emit("name"),e.type!==this._type&&this._propertyChanged.emit("type"),e.path!==this._path&&this._propertyChanged.emit("path")}}},7668:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t},o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.SessionAPI=t.Session=void 0;const a=s(n(7240));t.Session=a;const l=s(n(7570));t.SessionAPI=l,o(n(6919),t)},6919:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionManager=void 0;const i=n(6049),r=n(8571),s=n(2920),o=n(3867),a=n(5341),l=n(7570);class d extends o.BaseManager{constructor(e){var t;super(e),this._isReady=!1,this._sessionConnections=new Set,this._models=new Map,this._runningChanged=new r.Signal(this),this._connectionFailure=new r.Signal(this),this._connectToKernel=e=>this._kernelManager.connectTo(e),this._kernelManager=e.kernelManager,this._pollModels=new i.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:1e4,backoff:!0,max:3e5},name:"@jupyterlab/services:SessionManager#models",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._kernelManager.isActive&&await this._kernelManager.ready,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._sessionConnections.forEach((e=>e.dispose())),this._pollModels.dispose(),super.dispose())}connectTo(e){const t=new a.SessionConnection({...e,connectToKernel:this._connectToKernel,serverSettings:this.serverSettings});return this._onStarted(t),this._models.has(e.model.id)||this.refreshRunning().catch((()=>{})),t}running(){return this._models.values()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e,t={}){const n=await(0,l.startSession)(e,this.serverSettings);return await this.refreshRunning(),this.connectTo({...t,model:n})}async shutdown(e){await(0,l.shutdownSession)(e,this.serverSettings),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map((e=>(0,l.shutdownSession)(e,this.serverSettings)))),await this.refreshRunning()}async stopIfNeeded(e){try{const t=(await(0,l.listRunning)(this.serverSettings)).filter((t=>t.path===e));if(1===t.length){const e=t[0].id;await this.shutdown(e)}}catch(e){}}async findById(e){return this._models.has(e)||await this.refreshRunning(),this._models.get(e)}async findByPath(e){for(const t of this._models.values())if(t.path===e)return t;await this.refreshRunning();for(const t of this._models.values())if(t.path===e)return t}async requestRunning(){var e,t;let n;try{n=await(0,l.listRunning)(this.serverSettings)}catch(n){throw(n instanceof s.ServerConnection.NetworkError||503===(null===(e=n.response)||void 0===e?void 0:e.status)||424===(null===(t=n.response)||void 0===t?void 0:t.status))&&this._connectionFailure.emit(n),n}this.isDisposed||this._models.size===n.length&&n.every((e=>{var t,n,i,r;const s=this._models.get(e.id);return!!s&&(null===(t=s.kernel)||void 0===t?void 0:t.id)===(null===(n=e.kernel)||void 0===n?void 0:n.id)&&(null===(i=s.kernel)||void 0===i?void 0:i.name)===(null===(r=e.kernel)||void 0===r?void 0:r.name)&&s.name===e.name&&s.path===e.path&&s.type===e.type}))||(this._models=new Map(n.map((e=>[e.id,e]))),this._sessionConnections.forEach((e=>{this._models.has(e.id)?e.update(this._models.get(e.id)):e.dispose()})),this._runningChanged.emit(n))}_onStarted(e){this._sessionConnections.add(e),e.disposed.connect(this._onDisposed,this),e.propertyChanged.connect(this._onChanged,this),e.kernelChanged.connect(this._onChanged,this)}_onDisposed(e){this._sessionConnections.delete(e),this.refreshRunning().catch((()=>{}))}_onChanged(){this.refreshRunning().catch((()=>{}))}}t.SessionManager=d,function(e){e.NoopManager=class extends e{constructor(){super(...arguments),this._readyPromise=new Promise((()=>{}))}get isActive(){return!1}get parentReady(){return super.ready}async startNew(e,t={}){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}connectTo(e){throw Error("Not implemented in no-op Session Manager")}get ready(){return this.parentReady.then((()=>this._readyPromise))}async shutdown(e){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}async requestRunning(){return Promise.resolve()}}}(d=t.SessionManager||(t.SessionManager={}))},7570:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateSession=t.startSession=t.getSessionModel=t.shutdownSession=t.getSessionUrl=t.listRunning=t.SESSION_SERVICE_URL=void 0;const i=n(2920),r=n(8925),s=n(5684);function o(e,n){return r.URLExt.join(e,t.SESSION_SERVICE_URL,n)}t.SESSION_SERVICE_URL="api/sessions",t.listRunning=async function(e=i.ServerConnection.makeSettings()){const n=r.URLExt.join(e.baseUrl,t.SESSION_SERVICE_URL),o=await i.ServerConnection.makeRequest(n,{},e);if(200!==o.status)throw await i.ServerConnection.ResponseError.create(o);const a=await o.json();if(!Array.isArray(a))throw new Error("Invalid Session list");return a.forEach((e=>{(0,s.updateLegacySessionModel)(e),(0,s.validateModel)(e)})),a},t.getSessionUrl=o,t.shutdownSession=async function(e,t=i.ServerConnection.makeSettings()){var n;const r=o(t.baseUrl,e),s=await i.ServerConnection.makeRequest(r,{method:"DELETE"},t);if(404===s.status){const t=null!==(n=(await s.json()).message)&&void 0!==n?n:`The session "${e}"" does not exist on the server`;console.warn(t)}else{if(410===s.status)throw new i.ServerConnection.ResponseError(s,"The kernel was deleted but the session was not");if(204!==s.status)throw await i.ServerConnection.ResponseError.create(s)}},t.getSessionModel=async function(e,t=i.ServerConnection.makeSettings()){const n=o(t.baseUrl,e),r=await i.ServerConnection.makeRequest(n,{},t);if(200!==r.status)throw await i.ServerConnection.ResponseError.create(r);const a=await r.json();return(0,s.updateLegacySessionModel)(a),(0,s.validateModel)(a),a},t.startSession=async function(e,n=i.ServerConnection.makeSettings()){const o=r.URLExt.join(n.baseUrl,t.SESSION_SERVICE_URL),a={method:"POST",body:JSON.stringify(e)},l=await i.ServerConnection.makeRequest(o,a,n);if(201!==l.status)throw await i.ServerConnection.ResponseError.create(l);const d=await l.json();return(0,s.updateLegacySessionModel)(d),(0,s.validateModel)(d),d},t.updateSession=async function(e,t=i.ServerConnection.makeSettings()){const n=o(t.baseUrl,e.id),r={method:"PATCH",body:JSON.stringify(e)},a=await i.ServerConnection.makeRequest(n,r,t);if(200!==a.status)throw await i.ServerConnection.ResponseError.create(a);const l=await a.json();return(0,s.updateLegacySessionModel)(l),(0,s.validateModel)(l),l}},7240:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5684:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateModels=t.updateLegacySessionModel=t.validateModel=void 0;const i=n(5855),r=n(7441);function s(e){(0,r.validateProperty)(e,"id","string"),(0,r.validateProperty)(e,"type","string"),(0,r.validateProperty)(e,"name","string"),(0,r.validateProperty)(e,"path","string"),(0,r.validateProperty)(e,"kernel","object"),(0,i.validateModel)(e.kernel)}t.validateModel=s,t.updateLegacySessionModel=function(e){void 0===e.path&&void 0!==e.notebook&&(e.path=e.notebook.path,e.type="notebook",e.name="")},t.validateModels=function(e){if(!Array.isArray(e))throw new Error("Invalid session list");e.forEach((e=>s(e)))}},7780:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SettingManager=void 0;const i=n(8925),r=n(1670),s=n(2920);class o extends r.DataConnector{constructor(e={}){var t;super(),this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:s.ServerConnection.makeSettings()}async fetch(e){if(!e)throw new Error("Plugin `id` parameter is required for settings fetch.");const{serverSettings:t}=this,{baseUrl:n,appUrl:i}=t,{makeRequest:r,ResponseError:o}=s.ServerConnection,l=n+i,d=a.url(l,e),u=await r(d,{},t);if(200!==u.status)throw await o.create(u);return u.json()}async list(e){var t,n,i,r;const{serverSettings:o}=this,{baseUrl:l,appUrl:d}=o,{makeRequest:u,ResponseError:c}=s.ServerConnection,h=l+d,p=a.url(h,"","ids"===e),g=await u(p,{},o);if(200!==g.status)throw new c(g);const f=await g.json(),m=null!==(n=null===(t=null==f?void 0:f.settings)||void 0===t?void 0:t.map((e=>e.id)))&&void 0!==n?n:[];let v=[];return e||(v=null!==(r=null===(i=null==f?void 0:f.settings)||void 0===i?void 0:i.map((e=>(e.data={composite:{},user:{}},e))))&&void 0!==r?r:[]),{ids:m,values:v}}async save(e,t){const{serverSettings:n}=this,{baseUrl:i,appUrl:r}=n,{makeRequest:o,ResponseError:l}=s.ServerConnection,d=i+r,u=a.url(d,e),c={body:JSON.stringify({raw:t}),method:"PUT"},h=await o(u,c,n);if(204!==h.status)throw new l(h)}}var a;t.SettingManager=o,function(e){e.url=function(e,t,n){const r=n?i.URLExt.objectToQueryString({ids_only:!0}):"";return`${i.URLExt.join(e,"api/settings",t)}${r}`}}(a||(a={}))},7251:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=WebSocket},9040:(e,t)=>{},9191:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserManager=void 0;const i=n(8925),r=n(5764),s=n(6049),o=n(8571),a=n(2920),l=n(3867),d="@jupyterlab/services:UserManager#user";class u extends l.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._userChanged=new o.Signal(this),this._connectionFailure=new o.Signal(this),this._ready=this.requestUser().then((()=>{this.isDisposed||(this._isReady=!0)})).catch((e=>new Promise((()=>{})))),this._pollSpecs=new s.Poll({auto:!1,factory:()=>this.requestUser(),frequency:{interval:61e3,backoff:!0,max:3e5},name:d,standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this.ready.then((()=>{this._pollSpecs.start()}))}get isReady(){return this._isReady}get ready(){return this._ready}get identity(){return this._identity}get permissions(){return this._permissions}get userChanged(){return this._userChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshUser(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestUser(){if(this.isDisposed)return;const{baseUrl:e}=this.serverSettings,{makeRequest:t,ResponseError:n}=a.ServerConnection,s=i.URLExt.join(e,"api/me"),o=await t(s,{},this.serverSettings);if(200!==o.status)throw await n.create(o);const l={identity:this._identity,permissions:this._permissions},u=await o.json(),h=u.identity,{localStorage:p}=window,g=p.getItem(d);if(g&&(!h.initials||!h.color)){const e=JSON.parse(g);h.initials=h.initials||e.initials||h.name.substring(0,1),h.color=h.color||e.color||c.getRandomColor()}r.JSONExt.deepEqual(u,l)||(this._identity=h,this._permissions=u.permissions,p.setItem(d,JSON.stringify(h)),this._userChanged.emit(u))}}var c;t.UserManager=u,function(e){const t=["var(--jp-collaborator-color1)","var(--jp-collaborator-color2)","var(--jp-collaborator-color3)","var(--jp-collaborator-color4)","var(--jp-collaborator-color5)","var(--jp-collaborator-color6)","var(--jp-collaborator-color7)"];e.getRandomColor=()=>t[Math.floor(Math.random()*t.length)]}(c||(c={}))},7441:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateProperty=void 0,t.validateProperty=function(e,t,n,i=[]){if(!e.hasOwnProperty(t))throw Error(`Missing property '${t}'`);const r=e[t];if(void 0!==n){let e=!0;switch(n){case"array":e=Array.isArray(r);break;case"object":e=void 0!==r;break;default:e=typeof r===n}if(!e)throw new Error(`Property '${t}' is not of type '${n}'`);if(i.length>0){let e=!0;switch(n){case"string":case"number":case"boolean":e=i.includes(r);break;default:e=i.findIndex((e=>e===r))>=0}if(!e)throw new Error(`Property '${t}' is not one of the valid values ${JSON.stringify(i)}`)}}}},8053:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceManager=void 0;const i=n(8925),r=n(1670),s=n(2920);class o extends r.DataConnector{constructor(e={}){var t;super(),this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:s.ServerConnection.makeSettings()}async fetch(e){const{serverSettings:t}=this,{baseUrl:n,appUrl:i}=t,{makeRequest:r,ResponseError:o}=s.ServerConnection,l=n+i,d=a.url(l,e),u=await r(d,{},t);if(200!==u.status)throw await o.create(u);return u.json()}async list(){const{serverSettings:e}=this,{baseUrl:t,appUrl:n}=e,{makeRequest:i,ResponseError:r}=s.ServerConnection,o=t+n,l=a.url(o,""),d=await i(l,{},e);if(200!==d.status)throw await r.create(d);return(await d.json()).workspaces}async remove(e){const{serverSettings:t}=this,{baseUrl:n,appUrl:i}=t,{makeRequest:r,ResponseError:o}=s.ServerConnection,l=n+i,d=a.url(l,e),u=await r(d,{method:"DELETE"},t);if(204!==u.status)throw await o.create(u)}async save(e,t){const{serverSettings:n}=this,{baseUrl:i,appUrl:r}=n,{makeRequest:o,ResponseError:l}=s.ServerConnection,d=i+r,u=a.url(d,e),c={body:JSON.stringify(t),method:"PUT"},h=await o(u,c,n);if(204!==h.status)throw await l.create(h)}}var a;t.WorkspaceManager=o,function(e){e.url=function(e,t){return i.URLExt.join(e,"api/workspaces",t)}}(a||(a={}))},4949:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataConnector=void 0,t.DataConnector=class{async list(e){throw new Error("DataConnector#list method has not been implemented.")}async remove(e){throw new Error("DataConnector#remove method has not been implemented.")}async save(e,t){throw new Error("DataConnector#save method has not been implemented.")}}},1670:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(4949),t),r(n(9708),t),r(n(4025),t),r(n(2133),t),r(n(8022),t)},9708:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4025:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RestorablePool=void 0;const i=n(5764),r=n(6573),s=n(8571);var o;t.RestorablePool=class{constructor(e){this._added=new s.Signal(this),this._current=null,this._currentChanged=new s.Signal(this),this._hasRestored=!1,this._isDisposed=!1,this._objects=new Set,this._restore=null,this._restored=new i.PromiseDelegate,this._updated=new s.Signal(this),this.namespace=e.namespace}get added(){return this._added}get current(){return this._current}set current(e){this._current!==e&&null!==e&&this._objects.has(e)&&(this._current=e,this._currentChanged.emit(this._current))}get currentChanged(){return this._currentChanged}get isDisposed(){return this._isDisposed}get restored(){return this._restored.promise}get size(){return this._objects.size}get updated(){return this._updated}async add(e){var t,n;if(e.isDisposed){const t="A disposed object cannot be added.";throw console.warn(t,e),new Error(t)}if(this._objects.has(e)){const t="This object already exists in the pool.";throw console.warn(t,e),new Error(t)}if(this._objects.add(e),e.disposed.connect(this._onInstanceDisposed,this),!o.injectedProperty.get(e)){if(this._restore){const{connector:i}=this._restore,r=this._restore.name(e);if(r){const s=`${this.namespace}:${r}`,a=null===(n=(t=this._restore).args)||void 0===n?void 0:n.call(t,e);o.nameProperty.set(e,s),await i.save(s,{data:a})}}this._added.emit(e)}}dispose(){this.isDisposed||(this._current=null,this._isDisposed=!0,this._objects.clear(),s.Signal.clearData(this))}find(e){const t=this._objects.values();for(const n of t)if(e(n))return n}forEach(e){this._objects.forEach(e)}filter(e){const t=[];return this.forEach((n=>{e(n)&&t.push(n)})),t}inject(e){return o.injectedProperty.set(e,!0),this.add(e)}has(e){return this._objects.has(e)}async restore(e){if(this._hasRestored)throw new Error("This pool has already been restored.");this._hasRestored=!0;const{command:t,connector:n,registry:i,when:r}=e,s=this.namespace,o=r?[n.list(s)].concat(r):[n.list(s)];this._restore=e;const[a]=await Promise.all(o),l=await Promise.all(a.ids.map((async(e,r)=>{const s=a.values[r],o=s&&s.data;return void 0===o?n.remove(e):i.execute(t,o).catch((()=>n.remove(e)))})));return this._restored.resolve(),l}async save(e){var t,n;const i=o.injectedProperty.get(e);if(!this._restore||!this.has(e)||i)return;const{connector:r}=this._restore,s=this._restore.name(e),a=o.nameProperty.get(e),l=s?`${this.namespace}:${s}`:"";if(a&&a!==l&&await r.remove(a),o.nameProperty.set(e,l),l){const i=null===(n=(t=this._restore).args)||void 0===n?void 0:n.call(t,e);await r.save(l,{data:i})}a!==l&&this._updated.emit(e)}_onInstanceDisposed(e){if(this._objects.delete(e),e===this._current&&(this._current=null,this._currentChanged.emit(this._current)),o.injectedProperty.get(e))return;if(!this._restore)return;const{connector:t}=this._restore,n=o.nameProperty.get(e);n&&t.remove(n)}},function(e){e.injectedProperty=new r.AttachedProperty({name:"injected",create:()=>!1}),e.nameProperty=new r.AttachedProperty({name:"name",create:()=>""})}(o||(o={}))},2133:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateDB=void 0;const i=n(8571);class r{constructor(e={}){this._changed=new i.Signal(this);const{connector:t,transform:n}=e;this._connector=t||new r.Connector,this._ready=n?n.then((e=>{const{contents:t,type:n}=e;switch(n){case"cancel":default:return;case"clear":return this._clear();case"merge":return this._merge(t||{});case"overwrite":return this._overwrite(t||{})}})):Promise.resolve(void 0)}get changed(){return this._changed}async clear(){await this._ready,await this._clear()}async fetch(e){return await this._ready,this._fetch(e)}async list(e){return await this._ready,this._list(e)}async remove(e){await this._ready,await this._remove(e),this._changed.emit({id:e,type:"remove"})}async save(e,t){await this._ready,await this._save(e,t),this._changed.emit({id:e,type:"save"})}async toJSON(){await this._ready;const{ids:e,values:t}=await this._list();return t.reduce(((t,n,i)=>(t[e[i]]=n,t)),{})}async _clear(){await Promise.all((await this._list()).ids.map((e=>this._remove(e))))}async _fetch(e){const t=await this._connector.fetch(e);if(t)return JSON.parse(t).v}async _list(e=""){const{ids:t,values:n}=await this._connector.list(e);return{ids:t,values:n.map((e=>JSON.parse(e).v))}}async _merge(e){await Promise.all(Object.keys(e).map((t=>e[t]&&this._save(t,e[t]))))}async _overwrite(e){await this._clear(),await this._merge(e)}async _remove(e){return this._connector.remove(e)}async _save(e,t){return this._connector.save(e,JSON.stringify({v:t}))}}t.StateDB=r,function(e){e.Connector=class{constructor(){this._storage={}}async fetch(e){return this._storage[e]}async list(e=""){return Object.keys(this._storage).reduce(((t,n)=>(""!==e&&e!==n.split(":")[0]||(t.ids.push(n),t.values.push(this._storage[n])),t)),{ids:[],values:[]})}async remove(e){delete this._storage[e]}async save(e,t){this._storage[e]=t}}}(r||(t.StateDB=r={}))},8022:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IStateDB=void 0;const i=n(5764);t.IStateDB=new i.Token("@jupyterlab/coreutils:IStateDB",'A service for the JupyterLab state database.\n Use this if you want to store data that will persist across page loads.\n See "state database" for more information.')},509:(e,t,n)=>{"use strict";function i(e){return e.replace("-","_")}n.d(t,{sQ:()=>l,wK:()=>s});class r{constructor(e){e=e||{},this._defaults={domain:"messages",locale:document.documentElement.getAttribute("lang")||"en",pluralFunc:function(e){return{nplurals:2,plural:1!=e?1:0}},contextDelimiter:String.fromCharCode(4),stringsPrefix:""},this._locale=(e.locale||this._defaults.locale).replace("_","-"),this._domain=i(e.domain||this._defaults.domain),this._contextDelimiter=e.contextDelimiter||this._defaults.contextDelimiter,this._stringsPrefix=e.stringsPrefix||this._defaults.stringsPrefix,this._pluralFuncs={},this._dictionary={},this._pluralForms={},e.messages&&(this._dictionary[this._domain]={},this._dictionary[this._domain][this._locale]=e.messages),e.pluralForms&&(this._pluralForms[this._locale]=e.pluralForms)}setContextDelimiter(e){this._contextDelimiter=e}getContextDelimiter(){return this._contextDelimiter}setLocale(e){this._locale=e.replace("_","-")}getLocale(){return this._locale}setDomain(e){this._domain=i(e)}getDomain(){return this._domain}setStringsPrefix(e){this._stringsPrefix=e}getStringsPrefix(){return this._stringsPrefix}static strfmt(e,...t){return e.replace(/%%/g,"%% ").replace(/%(\d+)/g,(function(e,n){return t[n-1]})).replace(/%% /g,"%")}loadJSON(e,t){if(!e[""]||!e[""].language||!e[""].pluralForms)throw new Error(`Wrong jsonData, it must have an empty key ("") with "language" and "pluralForms" information: ${e}`);t=i(t);let n=e[""],r=JSON.parse(JSON.stringify(e));delete r[""],this.setMessages(t||this._defaults.domain,n.language,r,n.pluralForms)}__(e,...t){return this.gettext(e,...t)}_n(e,t,n,...i){return this.ngettext(e,t,n,...i)}_p(e,t,...n){return this.pgettext(e,t,...n)}_np(e,t,n,i,...r){return this.npgettext(e,t,n,i,...r)}gettext(e,...t){return this.dcnpgettext("","",e,"",0,...t)}ngettext(e,t,n,...i){return this.dcnpgettext("","",e,t,n,...i)}pgettext(e,t,...n){return this.dcnpgettext("",e,t,"",0,...n)}npgettext(e,t,n,i,...r){return this.dcnpgettext("",e,t,n,i,...r)}dcnpgettext(e,t,n,r,s,...o){let a;e=i(e)||this._domain;let l=t?t+this._contextDelimiter+n:n,d={pluralForm:!1},u=!1,c=this._locale,h=this.expandLocale(this._locale);for(let t in h)if(c=h[t],u=this._dictionary[e]&&this._dictionary[e][c]&&this._dictionary[e][c][l],u=r?u&&this._dictionary[e][c][l].length>1:u&&1==this._dictionary[e][c][l].length,u){d.locale=c;break}if(u?a=this._dictionary[e][c][l]:(a=[n],d.pluralFunc=this._defaults.pluralFunc),!r)return this.t(a,s,d,...o);d.pluralForm=!0;let p=u?a:[n,r];return this.t(p,s,d,...o)}expandLocale(e){let t=[e],n=e.lastIndexOf("-");for(;n>0;)e=e.slice(0,n),t.push(e),n=e.lastIndexOf("-");return t}getPluralFunc(e){if(!new RegExp("^\\s*nplurals\\s*=\\s*[0-9]+\\s*;\\s*plural\\s*=\\s*(?:\\s|[-\\?\\|&=!<>+*/%:;n0-9_()])+").test(e))throw new Error(r.strfmt('The plural form "%1" is not valid',e));return new Function("n","let plural, nplurals; "+e+" return { nplurals: nplurals, plural: (plural === true ? 1 : (plural ? plural : 0)) };")}removeContext(e){return-1!==e.indexOf(this._contextDelimiter)?e.split(this._contextDelimiter)[1]:e}t(e,t,n,...i){if(!n.pluralForm)return this._stringsPrefix+r.strfmt(this.removeContext(e[0]),...i);let s;return n.pluralFunc?s=n.pluralFunc(t):(this._pluralFuncs[n.locale||""]||(this._pluralFuncs[n.locale||""]=this.getPluralFunc(this._pluralForms[n.locale||""])),s=this._pluralFuncs[n.locale||""](t)),(void 0===!s.plural||s.plural>s.nplurals||e.length<=s.plural)&&(s.plural=0),this._stringsPrefix+r.strfmt(this.removeContext(e[s.plural]),...[t].concat(i))}setMessages(e,t,n,r){e=i(e),r&&(this._pluralForms[t]=r),this._dictionary[e]||(this._dictionary[e]={}),this._dictionary[e][t]=n}}const s=new class{constructor(e){this.languageCode="en",this._languageBundle=e}load(e){return this._languageBundle}}(new class{__(e,...t){return this.gettext(e,...t)}_n(e,t,n,...i){return this.ngettext(e,t,n,...i)}_p(e,t,...n){return this.pgettext(e,t,...n)}_np(e,t,n,i,...r){return this.npgettext(e,t,n,i,...r)}gettext(e,...t){return r.strfmt(e,...t)}ngettext(e,t,n,...i){return r.strfmt(1==n?e:t,...[n].concat(i))}pgettext(e,t,...n){return r.strfmt(t,...n)}npgettext(e,t,n,i,...r){return this.ngettext(t,n,i,...r)}dcnpgettext(e,t,n,i,r,...s){return this.ngettext(n,i,r,...s)}});var o=n(1670),a=n(5764);n(8925),n(7883),new a.Token("@jupyterlab/translation:ITranslatorConnector","A service to connect to the server translation endpoint."),o.DataConnector;const l=new a.Token("@jupyterlab/translation:ITranslator","A service to translate strings.")},8135:(e,t,n)=>{"use strict";var i;function r(e){return"function"==typeof e.iter?e.iter():new l(e)}function s(e,t){for(var n,i=0,s=r(e);void 0!==(n=s.next());)if(!1===t(n,i++))return}function o(e,t){for(var n,i=0,s=r(e);void 0!==(n=s.next());)if(!t(n,i++))return!1;return!0}function a(e,t){for(var n,i=0,s=r(e);void 0!==(n=s.next());)if(t(n,i++))return!0;return!1}n.d(t,{$0:()=>h,Ie:()=>d,Rw:()=>i,Si:()=>o,__:()=>s,zN:()=>a}),function(e){function t(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)){for(var i=e[t],r=t+1;r0;){var l=a>>1,d=o+l;n(e[d],t)<0?(o=d+1,a-=l+1):a=l}return o},e.upperBound=function(e,t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=-1);var s=e.length;if(0===s)return 0;for(var o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;a>0;){var l=a>>1,d=o+l;n(e[d],t)>0?a=l:(o=d+1,a-=l+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(var i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);for(var a=[],l=0;l=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))){var o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0!==t){var a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)}}},e.fill=function(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=e.length;if(0!==r){var s;n=n<0?Math.max(0,n+r):Math.min(n,r-1),s=(i=i<0?Math.max(0,i+r):Math.min(i,r-1))t;--r)e[r]=e[r-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=-1);var s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i,r){void 0===i&&(i=-1),void 0===r&&(r=0);var s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);for(var s=0,o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n,r){var s;void 0===n&&(n=0),void 0===r&&(r=-1);var a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n,i){var s;void 0===n&&(n=-1),void 0===i&&(i=0);var a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);for(var s=0,o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(i||(i={}));var l=function(){function e(e){this._index=0,this._source=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._source.length))return this._source[this._index++]},e}();function d(){return new c}(function(){function e(e,t){void 0===t&&(t=Object.keys(e)),this._index=0,this._source=e,this._keys=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source,this._keys);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?e:this.next()}}})(),function(){function e(e,t){void 0===t&&(t=Object.keys(e)),this._index=0,this._source=e,this._keys=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source,this._keys);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?this._source[e]:this.next()}}}(),function(){function e(e,t){void 0===t&&(t=Object.keys(e)),this._index=0,this._source=e,this._keys=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source,this._keys);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?[e,this._source[e]]:this.next()}}}(),function(){function e(e){this._fn=e}e.prototype.iter=function(){return this},e.prototype.clone=function(){throw new Error("An `FnIterator` cannot be cloned.")},e.prototype.next=function(){return this._fn.call(void 0)}}(),function(){function e(e){this._cloned=!1,this._source=e,this._active=void 0}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source.clone());return t._active=this._active&&this._active.clone(),t._cloned=!0,this._cloned=!0,t},e.prototype.next=function(){if(void 0===this._active){var e=this._source.next();if(void 0===e)return;this._active=this._cloned?e.clone():e}var t=this._active.next();return void 0!==t?t:(this._active=void 0,this.next())}}();var u,c=function(){function e(){}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e},e.prototype.next=function(){},e}();function h(e){return"function"==typeof e.retro?e.retro():new g(e)}!function(){function e(e,t){this._source=e,this._index=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._source.clone(),this._index)},e.prototype.next=function(){var e=this._source.next();if(void 0!==e)return[this._index++,e]}}(),function(){function e(e,t){this._index=0,this._source=e,this._fn=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source.clone(),this._fn);return t._index=this._index,t},e.prototype.next=function(){for(var e,t=this._fn,n=this._source;void 0!==(e=n.next());)if(t(e,this._index++))return e}}(),function(){function e(e,t){this._index=0,this._source=e,this._fn=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source.clone(),this._fn);return t._index=this._index,t},e.prototype.next=function(){var e=this._source.next();if(void 0!==e)return this._fn.call(void 0,e,this._index++)}}(),function(){function e(e,t,n){this._index=0,this._start=e,this._stop=t,this._step=n,this._length=u.rangeLength(e,t,n)}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._start,this._stop,this._step);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._length))return this._start+this._step*this._index++}}(),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||e=this._source.length))return this._source[this._index--]},e}();!function(){function e(e,t){this._source=e,this._step=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._source.clone(),this._step)},e.prototype.next=function(){for(var e=this._source.next(),t=this._step-1;t>0;--t)this._source.next();return e}}(),function(e){function t(e,t,n){void 0===n&&(n=0);for(var i=new Array(t.length),r=0,s=n,o=t.length;rt?1:0}}(p||(p={})),function(){function e(e,t){this._source=e,this._count=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._source.clone(),this._count)},e.prototype.next=function(){if(!(this._count<=0)){var e=this._source.next();if(void 0!==e)return this._count--,e}}}(),function(){function e(e){this._source=e}e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._source.map((function(e){return e.clone()})))},e.prototype.next=function(){for(var e=new Array(this._source.length),t=0,n=this._source.length;t>>0),e[n]=255&t,t>>>=8}e.Random=void 0,(e.Random||(e.Random={})).getRandomValues=(()=>{const e="undefined"!=typeof window&&(window.crypto||window.msCrypto)||null;return e&&"function"==typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:t})(),e.UUID=void 0,(e.UUID||(e.UUID={})).uuid4=function(e){const t=new Uint8Array(16),n=new Array(256);for(let e=0;e<16;++e)n[e]="0"+e.toString(16);for(let e=16;e<256;++e)n[e]=e.toString(16);return function(){return e(t),t[6]=64|15&t[6],t[8]=128|63&t[8],n[t[0]]+n[t[1]]+n[t[2]]+n[t[3]]+"-"+n[t[4]]+n[t[5]]+"-"+n[t[6]]+n[t[7]]+"-"+n[t[8]]+n[t[9]]+"-"+n[t[10]]+n[t[11]]+n[t[12]]+n[t[13]]+n[t[14]]+n[t[15]]}}(e.Random.getRandomValues),e.MimeData=class{constructor(){this._types=[],this._values=[]}types(){return this._types.slice()}hasData(e){return-1!==this._types.indexOf(e)}getData(e){let t=this._types.indexOf(e);return-1!==t?this._values[t]:void 0}setData(e,t){this.clearData(e),this._types.push(e),this._values.push(t)}clearData(e){let t=this._types.indexOf(e);-1!==t&&(this._types.splice(t,1),this._values.splice(t,1))}clear(){this._types.length=0,this._values.length=0}},e.PromiseDelegate=class{constructor(){this.promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}resolve(e){(0,this._resolve)(e)}reject(e){(0,this._reject)(e)}},e.Token=class{constructor(e,t){this.name=e,this.description=null!=t?t:"",this._tokenStructuralPropertyT=null}}}(t)},7556:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DisposableDelegate:()=>r,DisposableSet:()=>o,ObservableDisposableDelegate:()=>s,ObservableDisposableSet:()=>a});var i=n(8571);class r{constructor(e){this._fn=e}get isDisposed(){return!this._fn}dispose(){if(!this._fn)return;let e=this._fn;this._fn=null,e()}}class s extends r{constructor(){super(...arguments),this._disposed=new i.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),i.Signal.clearData(this))}}class o{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach((e=>{e.dispose()})),this._items.clear())}contains(e){return this._items.has(e)}add(e){this._items.add(e)}remove(e){this._items.delete(e)}clear(){this._items.clear()}}!function(e){e.from=function(t){let n=new e;for(const e of t)n.add(e);return n}}(o||(o={}));class a extends o{constructor(){super(...arguments),this._disposed=new i.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),i.Signal.clearData(this))}}!function(e){e.from=function(t){let n=new e;for(const e of t)n.add(e);return n}}(a||(a={}))},1621:(e,t,n)=>{"use strict";var i,r,s,o,a;n.d(t,{OD:()=>s}),function(e){e.copyText=function(e){var t=document.body,n=function(i){i.preventDefault(),i.stopPropagation(),i.clipboardData.setData("text",e),t.removeEventListener("copy",n,!0)};t.addEventListener("copy",n,!0),document.execCommand("copy")}}(i||(i={})),function(e){e.boxSizing=function(e){var t=window.getComputedStyle(e),n=parseFloat(t.borderTopWidth)||0,i=parseFloat(t.borderLeftWidth)||0,r=parseFloat(t.borderRightWidth)||0,s=parseFloat(t.borderBottomWidth)||0,o=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingLeft)||0,l=parseFloat(t.paddingRight)||0,d=parseFloat(t.paddingBottom)||0;return{borderTop:n,borderLeft:i,borderRight:r,borderBottom:s,paddingTop:o,paddingLeft:a,paddingRight:l,paddingBottom:d,horizontalSum:i+a+l+r,verticalSum:n+o+d+s}},e.sizeLimits=function(e){var t=window.getComputedStyle(e),n=parseFloat(t.minWidth)||0,i=parseFloat(t.minHeight)||0,r=parseFloat(t.maxWidth)||1/0,s=parseFloat(t.maxHeight)||1/0;return{minWidth:n,minHeight:i,maxWidth:r=Math.max(n,r),maxHeight:s=Math.max(i,s)}},e.hitTest=function(e,t,n){var i=e.getBoundingClientRect();return t>=i.left&&t=i.top&&n=n.bottom||(i.topn.bottom&&i.height>=n.height?e.scrollTop-=n.top-i.top:(i.topn.height||i.bottom>n.bottom&&i.height0;)if(h(n))t++;else if(h(i))u++;else if(h(r))u++;else if(h(o))c++;else if(h(a))u++;else if(h(s))c++;else if(!h(l))return 0;return(t=Math.min(t,255))<<16|(u=Math.min(u,255))<<8|Math.min(c,255)};var n=/^#[^\s\+>~#\.\[:]+/,i=/^\.[^\s\+>~#\.\[:]+/,r=/^\[[^\]]+\]/,s=/^[^\s\+>~#\.\[:]+/,o=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,a=/^:[^\s\+>~#\.\[:]+/,l=/^[\s\+>~\*]+/,d=/:not\(([^\)]+)\)/g}(a||(a={}))},3326:(e,t,n)=>{"use strict";n.d(t,{Mu:()=>l});var i,r=n(8135),s=function(){function e(e){this._root=new i.LeafNode,this.cmp=e}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this._root.size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._root.size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"first",{get:function(){var e=i.firstLeaf(this._root);return e.size>0?e.items[0]:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"last",{get:function(){var e=i.lastLeaf(this._root);return e.size>0?e.items[e.size-1]:void 0},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return i.iterItems(this._root)},e.prototype.retro=function(){return i.retroItems(this._root)},e.prototype.slice=function(e,t){return i.sliceItems(this._root,e,t)},e.prototype.retroSlice=function(e,t){return i.retroSliceItems(this._root,e,t)},e.prototype.at=function(e){return i.itemAt(this._root,e)},e.prototype.has=function(e,t){return i.hasItem(this._root,e,t)},e.prototype.indexOf=function(e,t){return i.indexOf(this._root,e,t)},e.prototype.get=function(e,t){return i.getItem(this._root,e,t)},e.prototype.assign=function(e){this.clear(),this.update(e)},e.prototype.insert=function(e){var t=i.insertItem(this._root,e,this.cmp);return this._root=i.maybeSplitRoot(this._root),t},e.prototype.update=function(e){var t=this;(0,r.__)(e,(function(e){t.insert(e)}))},e.prototype.delete=function(e,t){var n=i.deleteItem(this._root,e,t);return this._root=i.maybeExtractRoot(this._root),n},e.prototype.remove=function(e){var t=i.removeItem(this._root,e);return this._root=i.maybeExtractRoot(this._root),t},e.prototype.clear=function(){i.clear(this._root),this._root=new i.LeafNode},e}();!function(e){e.from=function(t,n){var i=new e(n);return i.assign(t),i}}(s||(s={})),function(e){var t=function(){function e(){this.items=[],this.sizes=[],this.children=[]}return Object.defineProperty(e.prototype,"type",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.sizes[this.sizes.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.children.length},enumerable:!0,configurable:!0}),e}();e.BranchNode=t;var n=function(){function e(){this.next=null,this.prev=null,this.items=[]}return Object.defineProperty(e.prototype,"type",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),e}();function i(e){for(;0===e.type;)e=e.children[0];return e}function s(e){for(;0===e.type;)e=e.children[e.children.length-1];return e}function o(e){0===e.type?((0,r.__)(e.children,o),e.children.length=0,e.sizes.length=0,e.items.length=0):(e.items.length=0,e.next=null,e.prev=null)}e.LeafNode=n,e.firstLeaf=i,e.lastLeaf=s,e.iterItems=function(e){var t=i(e);return new d(t,0,-1)},e.retroItems=function(e){var t=s(e);return new u(t,t.size-1,-1)},e.sliceItems=function(e,t,n){t=void 0===t?0:t<0?Math.max(0,t+e.size):Math.min(t,e.size),n=void 0===n?e.size:n<0?Math.max(0,n+e.size):Math.min(n,e.size);var i=Math.max(0,n-t);if(0===i)return(0,r.Ie)();for(;0===e.type;){var s=c(e.sizes,t);s>0&&(t-=e.sizes[s-1]),e=e.children[s]}return new d(e,t,i)},e.retroSliceItems=function(e,t,n){t=void 0===t?e.size-1:t<0?Math.max(-1,t+e.size):Math.min(t,e.size-1),n=void 0===n?-1:n<0?Math.max(-1,n+e.size):Math.min(n,e.size-1);var i=Math.max(0,t-n);if(0===i)return(0,r.Ie)();for(;0===e.type;){var s=c(e.sizes,t);s>0&&(t-=e.sizes[s-1]),e=e.children[s]}return new u(e,t,i)},e.itemAt=function(e,t){if(t<0&&(t+=e.size),!(t<0||t>=e.size)){for(;0===e.type;){var n=c(e.sizes,t);n>0&&(t-=e.sizes[n-1]),e=e.children[n]}return e.items[t]}},e.hasItem=function(e,t,n){for(;0===e.type;){var i=h(e.items,t,n);e=e.children[i]}return p(e.items,t,n)>=0},e.indexOf=function(e,t,n){for(var i=0;0===e.type;){var r=h(e.items,t,n);r>0&&(i+=e.sizes[r-1]),e=e.children[r]}var s=p(e.items,t,n);return s>=0?i+s:-i+s},e.getItem=function(e,t,n){for(;0===e.type;){var i=h(e.items,t,n);e=e.children[i]}var r=p(e.items,t,n);return r>=0?e.items[r]:void 0},e.insertItem=function e(t,n,i){if(1===t.type){var s,o=p(t.items,n,i);return o>=0?(s=t.items[o],t.items[o]=n):(s=void 0,r.Rw.insert(t.items,-o-1,n)),s}var l=h(t.items,n,i),d=t.children[l],u=d.size,c=e(d,n,i),m=d.size;if(t.items[l]=d.items[0],u===m)return c;if(d.width>a){var v=f(d);r.Rw.insert(t.children,l+1,v),r.Rw.insert(t.items,l+1,v.items[0])}return g(t,l),c},e.deleteItem=function e(t,n,i){if(1===t.type){var s=p(t.items,n,i);if(s<0)return;return r.Rw.removeAt(t.items,s)}var o=h(t.items,n,i),a=t.children[o],d=a.size,u=e(a,n,i);return d===a.size||(t.items[o]=a.items[0],a.width=t.size)){if(1===t.type)return r.Rw.removeAt(t.items,n);var i=c(t.sizes,n);i>0&&(n-=t.sizes[i]);var s=t.children[i],o=e(s,n);return t.items[i]=s.items[0],s.width1)return e;var t=e.children.pop();return o(e),t};var a=32,l=a>>1,d=function(){function e(e,t,n){this._node=e,this._index=t,this._count=n}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node,this._index,this._count)},e.prototype.next=function(){if(null!==this._node&&0!==this._count)return this._index>=this._node.size?(this._node=this._node.next,this._index=0,this.next()):(this._count>0&&this._count--,this._node.items[this._index++])},e}(),u=function(){function e(e,t,n){this._node=e,this._index=t,this._count=n}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node,this._index,this._count)},e.prototype.next=function(){if(null!==this._node&&0!==this._count)return this._index>=this._node.size&&(this._index=this._node.size-1),this._index<0?(this._node=this._node.prev,this._index=this._node?this._node.size-1:-1,this.next()):(this._count>0&&this._count--,this._node.items[this._index--])},e}();function c(e,t){for(var n=e.length,i=0;it)return i;return n-1}function h(e,t,n){for(var i=e.length,r=1;r0)return r-1;return i-1}function p(e,t,n){for(var i=e.length,r=0;r0)return-r-1}return-i-1}function g(e,t){for(var n=e.sizes,i=e.children,r=t>0?n[t-1]:0,s=i.length;tl;if(f&&m&&p){var v=h;return(b=c).items.push(v.items.shift()),e.items[t+1]=v.items[0],t}if(f&&m&&!p)return v=h,(b=c).items.unshift(v.items.pop()),e.items[t]=b.items[0],t-1;if(f&&!m&&p){var b=c;return(n=(v=h).items).unshift.apply(n,b.items),r.Rw.removeAt(e.children,t),r.Rw.removeAt(e.items,t+1),b.prev&&(b.prev.next=v),v.prev=b.prev,o(b),t}if(f&&!m&&!p)return b=c,(i=(v=h).items).push.apply(i,b.items),r.Rw.removeAt(e.children,t),r.Rw.removeAt(e.items,t),b.next&&(b.next.prev=v),v.next=b.next,o(b),t-1;if(!f&&m&&p)return v=h,(b=c).children.push(v.children.shift()),b.items.push(v.items.shift()),e.items[t+1]=v.items[0],g(b,b.width-1),g(v,0),t;if(!f&&m&&!p)return v=h,(b=c).children.unshift(v.children.pop()),b.items.unshift(v.items.pop()),e.items[t]=b.items[0],g(b,0),g(v,v.width-1),t-1;if(!f&&!m&&p)return b=c,(s=(v=h).children).unshift.apply(s,b.children),(a=v.items).unshift.apply(a,b.items),r.Rw.removeAt(e.children,t),r.Rw.removeAt(e.items,t+1),g(v,0),b.children.length=0,o(b),t;if(!f&&!m&&!p)return b=c,(d=(v=h).children).push.apply(d,b.children),(u=v.items).push.apply(u,b.items),r.Rw.removeAt(e.children,t),r.Rw.removeAt(e.items,t),g(v,0),b.children.length=0,o(b),t-1;throw"unreachable"}}(i||(i={}));var o,a=function(){function e(){this._first=null,this._last=null,this._size=0}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"first",{get:function(){return this._first?this._first.value:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"last",{get:function(){return this._last?this._last.value:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstNode",{get:function(){return this._first},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastNode",{get:function(){return this._last},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return new e.ForwardValueIterator(this._first)},e.prototype.retro=function(){return new e.RetroValueIterator(this._last)},e.prototype.nodes=function(){return new e.ForwardNodeIterator(this._first)},e.prototype.retroNodes=function(){return new e.RetroNodeIterator(this._last)},e.prototype.assign=function(e){var t=this;this.clear(),(0,r.__)(e,(function(e){t.addLast(e)}))},e.prototype.push=function(e){this.addLast(e)},e.prototype.pop=function(){return this.removeLast()},e.prototype.shift=function(e){this.addFirst(e)},e.prototype.unshift=function(){return this.removeFirst()},e.prototype.addFirst=function(e){var t=new o.LinkedListNode(this,e);return this._first?(t.next=this._first,this._first.prev=t,this._first=t):(this._first=t,this._last=t),this._size++,t},e.prototype.addLast=function(e){var t=new o.LinkedListNode(this,e);return this._last?(t.prev=this._last,this._last.next=t,this._last=t):(this._first=t,this._last=t),this._size++,t},e.prototype.insertBefore=function(e,t){if(!t||t===this._first)return this.addFirst(e);if(!(t instanceof o.LinkedListNode)||t.list!==this)throw new Error("Reference node is not owned by the list.");var n=new o.LinkedListNode(this,e),i=t,r=i.prev;return n.next=i,n.prev=r,i.prev=n,r.next=n,this._size++,n},e.prototype.insertAfter=function(e,t){if(!t||t===this._last)return this.addLast(e);if(!(t instanceof o.LinkedListNode)||t.list!==this)throw new Error("Reference node is not owned by the list.");var n=new o.LinkedListNode(this,e),i=t,r=i.next;return n.next=r,n.prev=i,i.next=n,r.prev=n,this._size++,n},e.prototype.removeFirst=function(){var e=this._first;if(e)return e===this._last?(this._first=null,this._last=null):(this._first=e.next,this._first.prev=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value},e.prototype.removeLast=function(){var e=this._last;if(e)return e===this._first?(this._first=null,this._last=null):(this._last=e.prev,this._last.next=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value},e.prototype.removeNode=function(e){if(!(e instanceof o.LinkedListNode)||e.list!==this)throw new Error("Node is not owned by the list.");var t=e;t===this._first&&t===this._last?(this._first=null,this._last=null):t===this._first?(this._first=t.next,this._first.prev=null):t===this._last?(this._last=t.prev,this._last.next=null):(t.next.prev=t.prev,t.prev.next=t.next),t.list=null,t.next=null,t.prev=null,this._size--},e.prototype.clear=function(){for(var e=this._first;e;){var t=e.next;e.list=null,e.prev=null,e.next=null,e=t}this._first=null,this._last=null,this._size=0},e}();!function(e){e.from=function(t){var n=new e;return n.assign(t),n};var t=function(){function e(e){this._node=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node)},e.prototype.next=function(){if(this._node){var e=this._node;return this._node=e.next,e.value}},e}();e.ForwardValueIterator=t;var n=function(){function e(e){this._node=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node)},e.prototype.next=function(){if(this._node){var e=this._node;return this._node=e.prev,e.value}},e}();e.RetroValueIterator=n;var i=function(){function e(e){this._node=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node)},e.prototype.next=function(){if(this._node){var e=this._node;return this._node=e.next,e}},e}();e.ForwardNodeIterator=i;var r=function(){function e(e){this._node=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node)},e.prototype.next=function(){if(this._node){var e=this._node;return this._node=e.prev,e}},e}();e.RetroNodeIterator=r}(a||(a={})),function(e){e.LinkedListNode=function(e,t){this.list=null,this.next=null,this.prev=null,this.list=e,this.value=t}}(o||(o={}));var l,d=function(e,t){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},d(e,t)};!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)})(t,e),Object.defineProperty(t.prototype,"isConflatable",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.conflate=function(e){return!0}}(function(){function e(e){this.type=e}return Object.defineProperty(e.prototype,"isConflatable",{get:function(){return!1},enumerable:!0,configurable:!0}),e.prototype.conflate=function(e){return!1},e}()),function(e){function t(e,t){var n=i.get(e);if(n&&0!==n.length){var s=(0,r.Si)((0,r.$0)(n),(function(n){return!n||function(e,t,n){var i=!0;try{i="function"==typeof e?e(t,n):e.messageHook(t,n)}catch(e){o(e)}return i}(n,e,t)}));s&&h(e,t)}else h(e,t)}e.sendMessage=t,e.postMessage=function(e,t){t.isConflatable&&(0,r.zN)(n,(function(n){return n.handler===e&&!!n.msg&&n.msg.type===t.type&&!!n.msg.isConflatable&&n.msg.conflate(t)}))||function(e,t){n.addLast({handler:e,msg:t}),0===l&&(l=u(p))}(e,t)},e.installMessageHook=function(e,t){var n=i.get(e);n&&-1!==n.indexOf(t)||(n?n.push(t):i.set(e,[t]))},e.removeMessageHook=function(e,t){var n=i.get(e);if(n){var r=n.indexOf(t);-1!==r&&(n[r]=null,g(n))}},e.clearData=function(e){var t=i.get(e);t&&t.length>0&&(r.Rw.fill(t,null),g(t)),(0,r.__)(n,(function(t){t.handler===e&&(t.handler=null,t.msg=null)}))},e.flush=function(){d||0===l||(c(l),d=!0,p(),d=!1)},e.getExceptionHandler=function(){return o},e.setExceptionHandler=function(e){var t=o;return o=e,t};var n=new a,i=new WeakMap,s=new Set,o=function(e){console.error(e)},l=0,d=!1,u="function"==typeof requestAnimationFrame?requestAnimationFrame:setImmediate,c="function"==typeof cancelAnimationFrame?cancelAnimationFrame:clearImmediate;function h(e,t){try{e.processMessage(t)}catch(e){o(e)}}function p(){if(l=0,!n.isEmpty){var e={handler:null,msg:null};for(n.addLast(e);;){var i=n.removeFirst();if(i===e)return;i.handler&&i.msg&&t(i.handler,i.msg)}}}function g(e){0===s.size&&u(f),s.add(e)}function f(){s.forEach(m),s.clear()}function m(e){r.Rw.removeAllWhere(e,v)}function v(e){return null===e}}(l||(l={}))},6049:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Debouncer:()=>l,Poll:()=>o,RateLimiter:()=>a,Throttler:()=>d});var i,r=n(5764),s=n(8571);class o{constructor(e){var t;this._disposed=new s.Signal(this),this._lingered=0,this._tick=new r.PromiseDelegate,this._ticked=new s.Signal(this),this._factory=e.factory,this._linger=null!==(t=e.linger)&&void 0!==t?t:i.DEFAULT_LINGER,this._standby=e.standby||i.DEFAULT_STANDBY,this._state={...i.DEFAULT_STATE,timestamp:(new Date).getTime()};const n=e.frequency||{},o=Math.max(n.interval||0,n.max||0,i.DEFAULT_FREQUENCY.max);this.frequency={...i.DEFAULT_FREQUENCY,...n,max:o},this.name=e.name||i.DEFAULT_NAME,"auto"in e&&!e.auto||setTimeout((()=>this.start()))}get disposed(){return this._disposed}get frequency(){return this._frequency}set frequency(e){if(this.isDisposed||r.JSONExt.deepEqual(e,this.frequency||{}))return;let{backoff:t,interval:n,max:i}=e;if(n=Math.round(n),i=Math.round(i),"number"==typeof t&&t<1)throw new Error("Poll backoff growth factor must be at least 1");if((n<0||n>i)&&n!==o.NEVER)throw new Error("Poll interval must be between 0 and max");if(i>o.MAX_INTERVAL&&i!==o.NEVER)throw new Error(`Max interval must be less than ${o.MAX_INTERVAL}`);this._frequency={backoff:t,interval:n,max:i}}get isDisposed(){return"disposed"===this.state.phase}get standby(){return this._standby}set standby(e){this.isDisposed||this.standby===e||(this._standby=e)}get state(){return this._state}get tick(){return this._tick.promise}get ticked(){return this._ticked}async*[Symbol.asyncIterator](){for(;!this.isDisposed;)yield this.state,await this.tick.catch((()=>{}))}dispose(){this.isDisposed||(this._state={...i.DISPOSED_STATE,timestamp:(new Date).getTime()},this._tick.promise.catch((e=>{})),this._tick.reject(new Error(`Poll (${this.name}) is disposed.`)),this._disposed.emit(void 0),s.Signal.clearData(this))}refresh(){return this.schedule({cancel:({phase:e})=>"refreshed"===e,interval:o.IMMEDIATE,phase:"refreshed"})}async schedule(e={}){if(this.isDisposed)return;if(e.cancel&&e.cancel(this.state))return;const t=this._tick,n=new r.PromiseDelegate,i={interval:this.frequency.interval,payload:null,phase:"standby",timestamp:(new Date).getTime(),...e};this._state=i,this._tick=n,clearTimeout(this._timeout),this._ticked.emit(this.state),t.resolve(this),await t.promise,i.interval!==o.NEVER?this._timeout=setTimeout((()=>{this.isDisposed||this.tick!==n.promise||this._execute()}),i.interval):this._timeout=void 0}start(){return this.schedule({cancel:({phase:e})=>"constructed"!==e&&"standby"!==e&&"stopped"!==e,interval:o.IMMEDIATE,phase:"started"})}stop(){return this.schedule({cancel:({phase:e})=>"stopped"===e,interval:o.NEVER,phase:"stopped"})}get hidden(){return i.hidden}_execute(){let e="function"==typeof this.standby?this.standby():this.standby;if("never"===e?e=!1:"when-hidden"===e&&(this.hidden?e=++this._lingered>this._linger:(this._lingered=0,e=!1)),e)return void this.schedule();const t=this.tick;this._factory(this.state).then((e=>{this.isDisposed||this.tick!==t||this.schedule({payload:e,phase:"rejected"===this.state.phase?"reconnected":"resolved"})})).catch((e=>{this.isDisposed||this.tick!==t||this.schedule({interval:i.sleep(this.frequency,this.state),payload:e,phase:"rejected"})}))}}!function(e){e.IMMEDIATE=0,e.MAX_INTERVAL=2147483647,e.NEVER=1/0}(o||(o={})),function(e){e.DEFAULT_BACKOFF=3,e.DEFAULT_FREQUENCY={backoff:!0,interval:1e3,max:3e4},e.DEFAULT_LINGER=1,e.DEFAULT_NAME="unknown",e.DEFAULT_STANDBY="when-hidden",e.DEFAULT_STATE={interval:o.NEVER,payload:null,phase:"constructed",timestamp:new Date(0).getTime()},e.DISPOSED_STATE={interval:o.NEVER,payload:null,phase:"disposed",timestamp:new Date(0).getTime()},e.sleep=function(t,n){const{backoff:i,interval:r,max:s}=t;if(r===o.NEVER)return r;const a=!0===i?e.DEFAULT_BACKOFF:!1===i?1:i,l=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}(r,n.interval*a);return Math.min(s,l)},e.hidden="undefined"!=typeof document&&(document.addEventListener("visibilitychange",(()=>{e.hidden="hidden"===document.visibilityState})),document.addEventListener("pagehide",(()=>{e.hidden="hidden"===document.visibilityState})),"hidden"===document.visibilityState)}(i||(i={}));class a{constructor(e,t=500){this.args=void 0,this.payload=null,this.limit=t,this.poll=new o({auto:!1,factory:async()=>{const{args:t}=this;return this.args=void 0,e(...t)},frequency:{backoff:!1,interval:o.NEVER,max:o.NEVER},standby:"never"}),this.payload=new r.PromiseDelegate,this.poll.ticked.connect(((e,t)=>{const{payload:n}=this;return"resolved"===t.phase?(this.payload=new r.PromiseDelegate,void n.resolve(t.payload)):"rejected"===t.phase||"stopped"===t.phase?(this.payload=new r.PromiseDelegate,n.promise.catch((e=>{})),void n.reject(t.payload)):void 0}),this)}get isDisposed(){return null===this.payload}dispose(){this.isDisposed||(this.args=void 0,this.payload=null,this.poll.dispose())}async stop(){return this.poll.stop()}}class l extends a{invoke(...e){return this.args=e,this.poll.schedule({interval:this.limit,phase:"invoked"}),this.payload.promise}}class d extends a{constructor(e,t){super(e,"number"==typeof t?t:t&&t.limit),this._trailing=!1,"number"!=typeof t&&t&&"trailing"===t.edge&&(this._trailing=!0),this._interval=this._trailing?this.limit:o.IMMEDIATE}invoke(...e){const t="invoked"!==this.poll.state.phase;return(t||this._trailing)&&(this.args=e),t&&this.poll.schedule({interval:this._interval,phase:"invoked"}),this.payload.promise}}},6573:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AttachedProperty:()=>i});class i{constructor(e){this._pid=r.nextPID(),this.name=e.name,this._create=e.create,this._coerce=e.coerce||null,this._compare=e.compare||null,this._changed=e.changed||null}get(e){let t,n=r.ensureMap(e);return t=this._pid in n?n[this._pid]:n[this._pid]=this._createValue(e),t}set(e,t){let n,i=r.ensureMap(e);n=this._pid in i?i[this._pid]:i[this._pid]=this._createValue(e);let s=this._coerceValue(e,t);this._maybeNotify(e,n,i[this._pid]=s)}coerce(e){let t,n=r.ensureMap(e);t=this._pid in n?n[this._pid]:n[this._pid]=this._createValue(e);let i=this._coerceValue(e,t);this._maybeNotify(e,t,n[this._pid]=i)}_createValue(e){return(0,this._create)(e)}_coerceValue(e,t){let n=this._coerce;return n?n(e,t):t}_compareValue(e,t){let n=this._compare;return n?n(e,t):e===t}_maybeNotify(e,t,n){let i=this._changed;i&&!this._compareValue(t,n)&&i(e,t,n)}}var r;!function(e){e.clearData=function(e){r.ownerData.delete(e)}}(i||(i={})),function(e){e.ownerData=new WeakMap,e.nextPID=(()=>{let e=0;return()=>`pid-${`${Math.random()}`.slice(2)}-${e++}`})(),e.ensureMap=function(t){let n=e.ownerData.get(t);return n||(n=Object.create(null),e.ownerData.set(t,n),n)}}(r||(r={}))},8571:(e,t,n)=>{"use strict";var i,r,s;n.r(t),n.d(t,{Signal:()=>l,Stream:()=>d}),function(e){function t(e,t,n=0,i=-1){let r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(i||(i={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(s||(s={}));var o,a=n(5764);class l{constructor(e){this.sender=e}connect(e,t){return o.connect(this,e,t)}disconnect(e,t){return o.disconnect(this,e,t)}emit(e){o.emit(this,e)}}!function(e){e.disconnectBetween=function(e,t){o.disconnectBetween(e,t)},e.disconnectSender=function(e){o.disconnectSender(e)},e.disconnectReceiver=function(e){o.disconnectReceiver(e)},e.disconnectAll=function(e){o.disconnectAll(e)},e.clearData=function(e){o.disconnectAll(e)},e.getExceptionHandler=function(){return o.exceptionHandler},e.setExceptionHandler=function(e){let t=o.exceptionHandler;return o.exceptionHandler=e,t}}(l||(l={}));class d extends l{constructor(){super(...arguments),this._pending=new a.PromiseDelegate}async*[Symbol.asyncIterator](){let e=this._pending;for(;;)try{const{args:t,next:n}=await e.promise;e=n,yield t}catch(e){return}}emit(e){const t=this._pending,n=this._pending=new a.PromiseDelegate;t.resolve({args:e,next:n}),super.emit(e)}stop(){this._pending.promise.catch((()=>{})),this._pending.reject("stop"),this._pending=new a.PromiseDelegate}}!function(e){function t(e){let t=r.get(e);if(t&&0!==t.length){for(const e of t){if(!e.signal)continue;let t=e.thisArg||e.slot;e.signal=null,u(s.get(t))}u(t)}}function n(e){let t=s.get(e);if(t&&0!==t.length){for(const e of t){if(!e.signal)continue;let t=e.signal.sender;e.signal=null,u(r.get(t))}u(t)}}e.exceptionHandler=e=>{console.error(e)},e.connect=function(e,t,n){n=n||void 0;let i=r.get(e.sender);if(i||(i=[],r.set(e.sender,i)),l(i,e,t,n))return!1;let o=n||t,a=s.get(o);a||(a=[],s.set(o,a));let d={signal:e,slot:t,thisArg:n};return i.push(d),a.push(d),!0},e.disconnect=function(e,t,n){n=n||void 0;let i=r.get(e.sender);if(!i||0===i.length)return!1;let o=l(i,e,t,n);if(!o)return!1;let a=n||t,d=s.get(a);return o.signal=null,u(i),u(d),!0},e.disconnectBetween=function(e,t){let n=r.get(e);if(!n||0===n.length)return;let i=s.get(t);if(i&&0!==i.length){for(const t of i)t.signal&&t.signal.sender===e&&(t.signal=null);u(n),u(i)}},e.disconnectSender=t,e.disconnectReceiver=n,e.disconnectAll=function(e){t(e),n(e)},e.emit=function(e,t){let n=r.get(e.sender);if(n&&0!==n.length)for(let i=0,r=n.length;i{"use strict";var i,r,s;function*o(){}function a(e,t){let n=0;for(const i of e)if(t(i,n++))return i}n.d(t,{$x:()=>we,Zk:()=>ie,DG:()=>H,VQ:()=>ce,x0:()=>z}),function(e){function t(e,t,n=0,i=-1){let r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(i||(i={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(s||(s={}));var l,d,u,c,h,p,g,f=n(5764);!function(e){e.copyText=function(e){const t=document.body,n=i=>{i.preventDefault(),i.stopPropagation(),i.clipboardData.setData("text",e),t.removeEventListener("copy",n,!0)};t.addEventListener("copy",n,!0),document.execCommand("copy")}}(l||(l={})),function(e){e.boxSizing=function(e){let t=window.getComputedStyle(e),n=parseFloat(t.borderTopWidth)||0,i=parseFloat(t.borderLeftWidth)||0,r=parseFloat(t.borderRightWidth)||0,s=parseFloat(t.borderBottomWidth)||0,o=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingLeft)||0,l=parseFloat(t.paddingRight)||0,d=parseFloat(t.paddingBottom)||0;return{borderTop:n,borderLeft:i,borderRight:r,borderBottom:s,paddingTop:o,paddingLeft:a,paddingRight:l,paddingBottom:d,horizontalSum:i+a+l+r,verticalSum:n+o+d+s}},e.sizeLimits=function(e){let t=window.getComputedStyle(e),n=parseFloat(t.minWidth)||0,i=parseFloat(t.minHeight)||0,r=parseFloat(t.maxWidth)||1/0,s=parseFloat(t.maxHeight)||1/0;return r=Math.max(n,r),s=Math.max(i,s),{minWidth:n,minHeight:i,maxWidth:r,maxHeight:s}},e.hitTest=function(e,t,n){let i=e.getBoundingClientRect();return t>=i.left&&t=i.top&&n=n.bottom||(i.topn.bottom&&i.height>=n.height?e.scrollTop-=n.top-i.top:(i.topn.height||i.bottom>n.bottom&&i.height{let e=Element.prototype;return e.matches||e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector||function(e){let t=this,n=t.ownerDocument?t.ownerDocument.querySelectorAll(e):[];return-1!==Array.prototype.indexOf.call(n,t)}})(),e.calculateSingle=function(e){let d=0,u=0,c=0;function h(t){let n=e.match(t);return null!==n&&(e=e.slice(n[0].length),!0)}for(e=(e=e.split(",",1)[0]).replace(l," $1 ");e.length>0;)if(h(t))d++;else if(h(n))u++;else if(h(i))u++;else if(h(s))c++;else if(h(o))u++;else if(h(r))c++;else if(!h(a))return 0;return d=Math.min(d,255),u=Math.min(u,255),c=Math.min(c,255),d<<16|u<<8|c};const t=/^#[^\s\+>~#\.\[:]+/,n=/^\.[^\s\+>~#\.\[:]+/,i=/^\[[^\]]+\]/,r=/^[^\s\+>~#\.\[:]+/,s=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,o=/^:[^\s\+>~#\.\[:]+/,a=/^[\s\+>~\*]+/,l=/:not\(([^\)]+)\)/g}(h||(h={}));class m{constructor(){this._first=null,this._last=null,this._size=0}get isEmpty(){return 0===this._size}get size(){return this._size}get length(){return this._size}get first(){return this._first?this._first.value:void 0}get last(){return this._last?this._last.value:void 0}get firstNode(){return this._first}get lastNode(){return this._last}*[Symbol.iterator](){let e=this._first;for(;e;)yield e.value,e=e.next}*retro(){let e=this._last;for(;e;)yield e.value,e=e.prev}*nodes(){let e=this._first;for(;e;)yield e,e=e.next}*retroNodes(){let e=this._last;for(;e;)yield e,e=e.prev}assign(e){this.clear();for(const t of e)this.addLast(t)}push(e){this.addLast(e)}pop(){return this.removeLast()}shift(e){this.addFirst(e)}unshift(){return this.removeFirst()}addFirst(e){let t=new p.LinkedListNode(this,e);return this._first?(t.next=this._first,this._first.prev=t,this._first=t):(this._first=t,this._last=t),this._size++,t}addLast(e){let t=new p.LinkedListNode(this,e);return this._last?(t.prev=this._last,this._last.next=t,this._last=t):(this._first=t,this._last=t),this._size++,t}insertBefore(e,t){if(!t||t===this._first)return this.addFirst(e);if(!(t instanceof p.LinkedListNode)||t.list!==this)throw new Error("Reference node is not owned by the list.");let n=new p.LinkedListNode(this,e),i=t,r=i.prev;return n.next=i,n.prev=r,i.prev=n,r.next=n,this._size++,n}insertAfter(e,t){if(!t||t===this._last)return this.addLast(e);if(!(t instanceof p.LinkedListNode)||t.list!==this)throw new Error("Reference node is not owned by the list.");let n=new p.LinkedListNode(this,e),i=t,r=i.next;return n.next=r,n.prev=i,i.next=n,r.prev=n,this._size++,n}removeFirst(){let e=this._first;if(e)return e===this._last?(this._first=null,this._last=null):(this._first=e.next,this._first.prev=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value}removeLast(){let e=this._last;if(e)return e===this._first?(this._first=null,this._last=null):(this._last=e.prev,this._last.next=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value}removeNode(e){if(!(e instanceof p.LinkedListNode)||e.list!==this)throw new Error("Node is not owned by the list.");let t=e;t===this._first&&t===this._last?(this._first=null,this._last=null):t===this._first?(this._first=t.next,this._first.prev=null):t===this._last?(this._last=t.prev,this._last.next=null):(t.next.prev=t.prev,t.prev.next=t.next),t.list=null,t.next=null,t.prev=null,this._size--}clear(){let e=this._first;for(;e;){let t=e.next;e.list=null,e.prev=null,e.next=null,e=t}this._first=null,this._last=null,this._size=0}}!function(e){e.from=function(t){let n=new e;return n.assign(t),n}}(m||(m={})),function(e){e.LinkedListNode=class{constructor(e,t){this.list=null,this.next=null,this.prev=null,this.list=e,this.value=t}}}(p||(p={}));class v{constructor(e){this.type=e}get isConflatable(){return!1}conflate(e){return!1}}class b extends v{get isConflatable(){return!0}conflate(e){return!0}}!function(e){let t=null;const n=(r=Promise.resolve(),e=>{let t=!1;return r.then((()=>!t&&e())),()=>{t=!0}});var r;function s(e,t){let n=a.get(e);if(!n||0===n.length)return void c(e,t);let i=function(e,t){let n=0;for(const i of e)if(!1===t(i,n++))return!1;return!0}(function*(e){if("function"==typeof e.retro)yield*e.retro();else for(let t=e.length-1;t>-1;t--)yield e[t]}(n),(n=>!n||function(e,t,n){let i=!0;try{i="function"==typeof e?e(t,n):e.messageHook(t,n)}catch(e){d(e)}return i}(n,e,t)));i&&c(e,t)}e.sendMessage=s,e.postMessage=function(e,t){t.isConflatable&&function(n,i){for(const i of n)if((r=i).handler===e&&r.msg&&r.msg.type===t.type&&r.msg.isConflatable&&r.msg.conflate(t))return!0;var r;return!1}(o)||h(e,t)},e.installMessageHook=function(e,t){let n=a.get(e);n&&-1!==n.indexOf(t)||(n?n.push(t):a.set(e,[t]))},e.removeMessageHook=function(e,t){let n=a.get(e);if(!n)return;let i=n.indexOf(t);-1!==i&&(n[i]=null,g(n))},e.clearData=function(e){let t=a.get(e);t&&t.length>0&&(i.fill(t,null),g(t));for(const t of o)t.handler===e&&(t.handler=null,t.msg=null)},e.flush=function(){u||null===t||(t(),t=null,u=!0,p(),u=!1)},e.getExceptionHandler=function(){return d},e.setExceptionHandler=function(e){let t=d;return d=e,t};const o=new m,a=new WeakMap,l=new Set;let d=e=>{console.error(e)},u=!1;function c(e,t){try{e.processMessage(t)}catch(e){d(e)}}function h(e,i){o.addLast({handler:e,msg:i}),null===t&&(t=n(p))}function p(){if(t=null,o.isEmpty)return;let e={handler:null,msg:null};for(o.addLast(e);;){let t=o.removeFirst();if(t===e)return;t.handler&&t.msg&&s(t.handler,t.msg)}}function g(e){0===l.size&&n(f),l.add(e)}function f(){l.forEach(v),l.clear()}function v(e){i.removeAllWhere(e,b)}function b(e){return null===e}}(g||(g={}));var A,y,_,w,C,E=n(6573),x=n(8571),D=n(1412);!function(e){function t(e,t,n=0,i=-1){let r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(A||(A={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(_||(_={}));class S{constructor(e){this.type="text",this.content=e}}class T{constructor(e,t,n,i){this.type="element",this.tag=e,this.attrs=t,this.children=n,this.renderer=i}}function k(e){let t,n={},i=[];for(let e=1,s=arguments.length;e=i;--s){const i=t[s],o=r?e.lastChild:e.childNodes[s];"text"===i.type||(i.renderer&&i.renderer.unrender?i.renderer.unrender(o,{attrs:i.attrs,children:i.children}):n(o,i.children,0,!1)),r&&e.removeChild(o)}}e.hostMap=new WeakMap,e.asContentArray=function(e){return e?e instanceof Array?e:[e]:[]},e.createDOMNode=t,e.updateContent=function e(i,s,o){if(s===o)return;let a=function(e,t){let n=e.firstChild,i=Object.create(null);for(let e of t)"element"===e.type&&e.attrs.key&&(i[e.attrs.key]={vNode:e,element:n}),n=n.nextSibling;return i}(i,s),l=s.slice(),d=i.firstChild,u=o.length;for(let n=0;n=l.length){t(o[n],i);continue}let s=l[n],u=o[n];if(s===u){d=d.nextSibling;continue}if("text"===s.type&&"text"===u.type){d.textContent!==u.content&&(d.textContent=u.content),d=d.nextSibling;continue}if("text"===s.type||"text"===u.type){A.insert(l,n,u),t(u,i,d);continue}if(!s.renderer!=!u.renderer){A.insert(l,n,u),t(u,i,d);continue}let c=u.attrs.key;if(c&&c in a){let e=a[c];e.vNode!==s&&(A.move(l,l.indexOf(e.vNode,n+1),n),i.insertBefore(e.element,d),s=e.vNode,d=e.element)}if(s===u){d=d.nextSibling;continue}let h=s.attrs.key;h&&h!==c?(A.insert(l,n,u),t(u,i,d)):s.tag===u.tag?(r(d,s.attrs,u.attrs),u.renderer?u.renderer.render(d,{attrs:u.attrs,children:u.children}):e(d,s.children,u.children),d=d.nextSibling):(A.insert(l,n,u),t(u,i,d))}n(i,l,u,!0)};const i={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};function r(e,t,n){if(t===n)return;let r;for(r in t)r in i||r in n||("on"===r.substr(0,2)?e[r]=null:e.removeAttribute(r));for(r in n)r in i||t[r]===n[r]||("on"===r.substr(0,2)?e[r]=n[r]:e.setAttribute(r,n[r]));t.className!==n.className&&(void 0!==n.className?e.setAttribute("class",n.className):e.removeAttribute("class")),t.htmlFor!==n.htmlFor&&(void 0!==n.htmlFor?e.setAttribute("for",n.htmlFor):e.removeAttribute("for")),t.dataset!==n.dataset&&function(e,t,n){for(let i in t)i in n||e.removeAttribute(`data-${i}`);for(let i in n)t[i]!==n[i]&&e.setAttribute(`data-${i}`,n[i])}(e,t.dataset||{},n.dataset||{}),t.style!==n.style&&function(e,t,n){let i,r=e.style;for(i in t)i in n||(r[i]="");for(i in n)t[i]!==n[i]&&(r[i]=n[i])}(e,t.style||{},n.style||{})}}(C||(C={})),n(7556);class M{constructor(e,t,n=[]){this.name=e,this._codes=t,this._keys=M.extractKeys(t),this._modifierKeys=M.convertToKeySet(n)}keys(){return Object.keys(this._keys)}isValidKey(e){return e in this._keys}isModifierKey(e){return e in this._modifierKeys}keyForKeydownEvent(e){return this._codes[e.keyCode]||""}}!function(e){e.extractKeys=function(e){let t=Object.create(null);for(let n in e)t[e[n]]=!0;return t},e.convertToKeySet=function(e){let t=Object(null);for(let n=0,i=e.length;n0&&(o+=n.stretch,a++)}if(t===s)return 0;if(t<=i){for(let t=0;t=r){for(let t=0;t0&&i>l;){let t=i,r=o;for(let s=0;s0&&i>l;){let t=i/d;for(let r=0;r0&&i>l;){let t=i,r=o;for(let s=0;s=n.maxSize?(i-=n.maxSize-n.size,o-=n.stretch,n.size=n.maxSize,n.done=!0,d--,a--):(i-=l,n.size+=l)}}for(;d>0&&i>l;){let t=i/d;for(let r=0;r=n.maxSize?(i-=n.maxSize-n.size,n.size=n.maxSize,n.done=!0,d--):(i-=t,n.size+=t))}}}return 0},e.adjust=function(e,t,n){0!==e.length&&0!==n&&(n>0?function(e,t,n){let i=0;for(let n=0;n<=t;++n){let t=e[n];i+=t.maxSize-t.size}let r=0;for(let n=t+1,i=e.length;n=0&&s>0;--n){let t=e[n],i=t.maxSize-t.size;i>=s?(t.sizeHint=t.size+s,s=0):(t.sizeHint=t.size+i,s-=i)}let o=n;for(let n=t+1,i=e.length;n0;++n){let t=e[n],i=t.size-t.minSize;i>=o?(t.sizeHint=t.size-o,o=0):(t.sizeHint=t.size-i,o-=i)}}(e,t,n):function(e,t,n){let i=0;for(let n=t+1,r=e.length;n0;++n){let t=e[n],i=t.maxSize-t.size;i>=s?(t.sizeHint=t.size+s,s=0):(t.sizeHint=t.size+i,s-=i)}let o=n;for(let n=t;n>=0&&o>0;--n){let t=e[n],i=t.size-t.minSize;i>=o?(t.sizeHint=t.size-o,o=0):(t.sizeHint=t.size-i,o-=i)}}(e,t,-n))}}(I||(I={}));class F{constructor(e){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new x.Signal(this),this._isDisposed=!1,this.owner=e.owner,void 0!==e.label&&(this._label=e.label),void 0!==e.mnemonic&&(this._mnemonic=e.mnemonic),void 0!==e.icon&&(this._icon=e.icon),void 0!==e.iconClass&&(this._iconClass=e.iconClass),void 0!==e.iconLabel&&(this._iconLabel=e.iconLabel),void 0!==e.caption&&(this._caption=e.caption),void 0!==e.className&&(this._className=e.className),void 0!==e.closable&&(this._closable=e.closable),this._dataset=e.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(e){this._label!==e&&(this._label=e,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(e){this._mnemonic!==e&&(this._mnemonic=e,this._changed.emit(void 0))}get icon(){return this._icon}set icon(e){this._icon!==e&&(this._icon=e,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(e){this._iconClass!==e&&(this._iconClass=e,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(e){this._iconLabel!==e&&(this._iconLabel=e,this._changed.emit(void 0))}get caption(){return this._caption}set caption(e){this._caption!==e&&(this._caption=e,this._changed.emit(void 0))}get className(){return this._className}set className(e){this._className!==e&&(this._className=e,this._changed.emit(void 0))}get closable(){return this._closable}set closable(e){this._closable!==e&&(this._closable=e,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(e){this._dataset!==e&&(this._dataset=e,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,x.Signal.clearData(this))}}class z{constructor(e={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new x.Signal(this),this._hiddenMode=z.HiddenMode.Display,this.node=P.createNode(e),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(z.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&z.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),x.Signal.clearData(this),g.clearData(this),E.AttachedProperty.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(z.Flag.IsDisposed)}get isAttached(){return this.testFlag(z.Flag.IsAttached)}get isHidden(){return this.testFlag(z.Flag.IsHidden)}get isVisible(){return this.testFlag(z.Flag.IsVisible)}get title(){return P.titleProperty.get(this)}get id(){return this.node.id}set id(e){this.node.id=e}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){this._hiddenMode!==e&&(this.isHidden&&this._toggleHidden(!1),e==z.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=e,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let e=new z.ChildMessage("child-removed",this);g.sendMessage(this._parent,e)}if(this._parent=e,this._parent&&!this._parent.isDisposed){let e=new z.ChildMessage("child-added",this);g.sendMessage(this._parent,e)}this.isDisposed||g.sendMessage(this,z.Msg.ParentChanged)}}get layout(){return this._layout}set layout(e){if(this._layout!==e){if(this.testFlag(z.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(e){for(let t=e;t;t=t._parent)if(t===this)return!0;return!1}hasClass(e){return this.node.classList.contains(e)}addClass(e){this.node.classList.add(e)}removeClass(e){this.node.classList.remove(e)}toggleClass(e,t){return!0===t?(this.node.classList.add(e),!0):!1===t?(this.node.classList.remove(e),!1):this.node.classList.toggle(e)}update(){g.postMessage(this,z.Msg.UpdateRequest)}fit(){g.postMessage(this,z.Msg.FitRequest)}activate(){g.postMessage(this,z.Msg.ActivateRequest)}close(){g.sendMessage(this,z.Msg.CloseRequest)}show(){if(this.testFlag(z.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||g.sendMessage(this,z.Msg.BeforeShow),this.clearFlag(z.Flag.IsHidden),this._toggleHidden(!1),!this.isAttached||this.parent&&!this.parent.isVisible||g.sendMessage(this,z.Msg.AfterShow),this.parent)){let e=new z.ChildMessage("child-shown",this);g.sendMessage(this.parent,e)}}hide(){if(!this.testFlag(z.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||g.sendMessage(this,z.Msg.BeforeHide),this.setFlag(z.Flag.IsHidden),this._toggleHidden(!0),!this.isAttached||this.parent&&!this.parent.isVisible||g.sendMessage(this,z.Msg.AfterHide),this.parent)){let e=new z.ChildMessage("child-hidden",this);g.sendMessage(this.parent,e)}}setHidden(e){e?this.hide():this.show()}testFlag(e){return!!(this._flags&e)}setFlag(e){this._flags|=e}clearFlag(e){this._flags&=~e}processMessage(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(z.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(z.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(z.Flag.IsVisible),this.setFlag(z.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(z.Flag.IsVisible),this.clearFlag(z.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e)}}notifyLayout(e){this._layout&&this._layout.processParentMessage(e)}onCloseRequest(e){this.parent?this.parent=null:this.isAttached&&z.detach(this)}onResize(e){}onUpdateRequest(e){}onFitRequest(e){}onActivateRequest(e){}onBeforeShow(e){}onAfterShow(e){}onBeforeHide(e){}onAfterHide(e){}onBeforeAttach(e){}onAfterAttach(e){}onBeforeDetach(e){}onAfterDetach(e){}onChildAdded(e){}onChildRemoved(e){}_toggleHidden(e){if(e)switch(this._hiddenMode){case z.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case z.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case z.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1"}else switch(this._hiddenMode){case z.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case z.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case z.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex=""}}}!function(e){var t,n,i;(t=e.HiddenMode||(e.HiddenMode={}))[t.Display=0]="Display",t[t.Scale=1]="Scale",t[t.ContentVisibility=2]="ContentVisibility",(n=e.Flag||(e.Flag={}))[n.IsDisposed=1]="IsDisposed",n[n.IsAttached=2]="IsAttached",n[n.IsHidden=4]="IsHidden",n[n.IsVisible=8]="IsVisible",n[n.DisallowLayout=16]="DisallowLayout",(i=e.Msg||(e.Msg={})).BeforeShow=new v("before-show"),i.AfterShow=new v("after-show"),i.BeforeHide=new v("before-hide"),i.AfterHide=new v("after-hide"),i.BeforeAttach=new v("before-attach"),i.AfterAttach=new v("after-attach"),i.BeforeDetach=new v("before-detach"),i.AfterDetach=new v("after-detach"),i.ParentChanged=new v("parent-changed"),i.UpdateRequest=new b("update-request"),i.FitRequest=new b("fit-request"),i.ActivateRequest=new b("activate-request"),i.CloseRequest=new b("close-request"),e.ChildMessage=class extends v{constructor(e,t){super(e),this.child=t}};class r extends v{constructor(e,t){super("resize"),this.width=e,this.height=t}}e.ResizeMessage=r,function(e){e.UnknownSize=new e(-1,-1)}(r=e.ResizeMessage||(e.ResizeMessage={})),e.attach=function(t,n,i=null){if(t.parent)throw new Error("Cannot attach a child widget.");if(t.isAttached||t.node.isConnected)throw new Error("Widget is already attached.");if(!n.isConnected)throw new Error("Host is not attached.");g.sendMessage(t,e.Msg.BeforeAttach),n.insertBefore(t.node,i),g.sendMessage(t,e.Msg.AfterAttach)},e.detach=function(t){if(t.parent)throw new Error("Cannot detach a child widget.");if(!t.isAttached||!t.node.isConnected)throw new Error("Widget is not attached.");g.sendMessage(t,e.Msg.BeforeDetach),t.node.parentNode.removeChild(t.node),g.sendMessage(t,e.Msg.AfterDetach)}}(z||(z={})),function(e){e.titleProperty=new E.AttachedProperty({name:"title",create:e=>new F({owner:e})}),e.createNode=function(e){return e.node||document.createElement(e.tag||"div")}}(P||(P={}));class U{constructor(e={}){this._disposed=!1,this._parent=null,this._fitPolicy=e.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,x.Signal.clearData(this),E.AttachedProperty.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(this._parent)throw new Error("Cannot change parent widget.");if(e.layout!==this)throw new Error("Invalid parent widget.");this._parent=e,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(e){if(this._fitPolicy!==e&&(this._fitPolicy=e,this._parent)){let e=this._parent.node.style;e.minWidth="",e.minHeight="",e.maxWidth="",e.maxHeight="",this._parent.fit()}}processParentMessage(e){switch(e.type){case"resize":this.onResize(e);break;case"update-request":this.onUpdateRequest(e);break;case"fit-request":this.onFitRequest(e);break;case"before-show":this.onBeforeShow(e);break;case"after-show":this.onAfterShow(e);break;case"before-hide":this.onBeforeHide(e);break;case"after-hide":this.onAfterHide(e);break;case"before-attach":this.onBeforeAttach(e);break;case"after-attach":this.onAfterAttach(e);break;case"before-detach":this.onBeforeDetach(e);break;case"after-detach":this.onAfterDetach(e);break;case"child-removed":this.onChildRemoved(e);break;case"child-shown":this.onChildShown(e);break;case"child-hidden":this.onChildHidden(e)}}init(){for(const e of this)e.parent=this.parent}onResize(e){for(const e of this)g.sendMessage(e,z.ResizeMessage.UnknownSize)}onUpdateRequest(e){for(const e of this)g.sendMessage(e,z.ResizeMessage.UnknownSize)}onBeforeAttach(e){for(const t of this)g.sendMessage(t,e)}onAfterAttach(e){for(const t of this)g.sendMessage(t,e)}onBeforeDetach(e){for(const t of this)g.sendMessage(t,e)}onAfterDetach(e){for(const t of this)g.sendMessage(t,e)}onBeforeShow(e){for(const t of this)t.isHidden||g.sendMessage(t,e)}onAfterShow(e){for(const t of this)t.isHidden||g.sendMessage(t,e)}onBeforeHide(e){for(const t of this)t.isHidden||g.sendMessage(t,e)}onAfterHide(e){for(const t of this)t.isHidden||g.sendMessage(t,e)}onChildRemoved(e){this.removeWidget(e.child)}onFitRequest(e){}onChildShown(e){}onChildHidden(e){}}!function(e){e.getHorizontalAlignment=function(e){return R.horizontalAlignmentProperty.get(e)},e.setHorizontalAlignment=function(e,t){R.horizontalAlignmentProperty.set(e,t)},e.getVerticalAlignment=function(e){return R.verticalAlignmentProperty.get(e)},e.setVerticalAlignment=function(e,t){R.verticalAlignmentProperty.set(e,t)}}(U||(U={}));class W{constructor(e){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=e,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let e=this.widget.node.style;e.position="",e.top="",e.left="",e.width="",e.height="",e.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let e=d.sizeLimits(this.widget.node);this._minWidth=e.minWidth,this._minHeight=e.minHeight,this._maxWidth=e.maxWidth,this._maxHeight=e.maxHeight}update(e,t,n,i){let r=Math.max(this._minWidth,Math.min(n,this._maxWidth)),s=Math.max(this._minHeight,Math.min(i,this._maxHeight));if(r"center",changed:t}),e.verticalAlignmentProperty=new E.AttachedProperty({name:"verticalAlignment",create:()=>"top",changed:t})}(R||(R={}));class H extends U{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(e){this.insertWidget(this._widgets.length,e)}insertWidget(e,t){t.parent=this.parent;let n=this._widgets.indexOf(t),r=Math.max(0,Math.min(e,this._widgets.length));if(-1===n)return i.insert(this._widgets,r,t),void(this.parent&&this.attachWidget(r,t));r===this._widgets.length&&r--,n!==r&&(i.move(this._widgets,n,r),this.parent&&this.moveWidget(n,r,t))}removeWidget(e){this.removeWidgetAt(this._widgets.indexOf(e))}removeWidgetAt(e){let t=i.removeAt(this._widgets,e);t&&this.parent&&this.detachWidget(e,t)}init(){super.init();let e=0;for(const t of this)this.attachWidget(e++,t)}attachWidget(e,t){let n=this.parent.node.children[e];this.parent.isAttached&&g.sendMessage(t,z.Msg.BeforeAttach),this.parent.node.insertBefore(t.node,n),this.parent.isAttached&&g.sendMessage(t,z.Msg.AfterAttach)}moveWidget(e,t,n){this.parent.isAttached&&g.sendMessage(n,z.Msg.BeforeDetach),this.parent.node.removeChild(n.node),this.parent.isAttached&&g.sendMessage(n,z.Msg.AfterDetach);let i=this.parent.node.children[t];this.parent.isAttached&&g.sendMessage(n,z.Msg.BeforeAttach),this.parent.node.insertBefore(n.node,i),this.parent.isAttached&&g.sendMessage(n,z.Msg.AfterAttach)}detachWidget(e,t){this.parent.isAttached&&g.sendMessage(t,z.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&g.sendMessage(t,z.Msg.AfterDetach)}}!function(e){e.clampDimension=function(e){return Math.max(0,Math.floor(e))}}(L||(L={}));var V,$,q,G,K,Y,J,X,Z,Q,ee=L;class te extends H{constructor(e){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=e.renderer,void 0!==e.orientation&&(this._orientation=e.orientation),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=L.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,this.parent&&(this.parent.dataset.orientation=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=L.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map((e=>e.size))}relativeSizes(){return V.normalize(this._sizers.map((e=>e.size)))}setRelativeSizes(e,t=!0){let n=this._sizers.length,i=e.slice(0,n);for(;i.length0&&(e.sizeHint=e.size);I.adjust(this._sizers,e,n),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,t){let n=new W(t),r=V.createHandle(this.renderer),s=V.averageSize(this._sizers),o=V.createSizer(s);i.insert(this._items,e,n),i.insert(this._sizers,e,o),i.insert(this._handles,e,r),this.parent.isAttached&&g.sendMessage(t,z.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.node.appendChild(r),this.parent.isAttached&&g.sendMessage(t,z.Msg.AfterAttach),this.parent.fit()}moveWidget(e,t,n){i.move(this._items,e,t),i.move(this._sizers,e,t),i.move(this._handles,e,t),this.parent.fit()}detachWidget(e,t){let n=i.removeAt(this._items,e),r=i.removeAt(this._handles,e);i.removeAt(this._sizers,e),this.parent.isAttached&&g.sendMessage(t,z.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.node.removeChild(r),this.parent.isAttached&&g.sendMessage(t,z.Msg.AfterDetach),n.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}updateItemPosition(e,t,n,i,r,s,o){const a=this._items[e];if(a.isHidden)return;let l=this._handles[e].style;t?(n+=this.widgetOffset,a.update(n,i,o,r),n+=o,l.top=`${i}px`,l.left=`${n}px`,l.width=`${this._spacing}px`,l.height=`${r}px`):(i+=this.widgetOffset,a.update(n,i,s,o),i+=o,l.top=`${i}px`,l.left=`${n}px`,l.width=`${s}px`,l.height=`${this._spacing}px`)}_fit(){let e=0,t=-1;for(let n=0,i=this._items.length;n0&&(s.sizeHint=s.size),t.isHidden?(s.minSize=0,s.maxSize=0):(t.fit(),s.stretch=te.getStretch(t.widget),n?(s.minSize=t.minWidth,s.maxSize=t.maxWidth,i+=t.minWidth,r=Math.max(r,t.minHeight)):(s.minSize=t.minHeight,s.maxSize=t.maxHeight,r+=t.minHeight,i=Math.max(i,t.minWidth)))}let s=this._box=d.boxSizing(this.parent.node);i+=s.horizontalSum,r+=s.verticalSum;let o=this.parent.node.style;o.minWidth=`${i}px`,o.minHeight=`${r}px`,this._dirty=!0,this.parent.parent&&g.sendMessage(this.parent.parent,z.Msg.FitRequest),this._dirty&&g.sendMessage(this.parent,z.Msg.UpdateRequest)}_update(e,t){this._dirty=!1;let n=0;for(let e=0,t=this._items.length;e0){let e;if(e=u?Math.max(0,s-this._fixed):Math.max(0,o-this._fixed),this._hasNormedSizes){for(let t of this._sizers)t.sizeHint*=e;this._hasNormedSizes=!1}let t=I.calc(this._sizers,e);if(t>0)switch(this._alignment){case"start":break;case"center":a=0,l=t/2;break;case"end":a=0,l=t;break;case"justify":a=t/n,l=0;break;default:throw"unreachable"}}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:function(e){e.parent&&e.parent.layout instanceof te&&e.parent.fit()}}),e.createSizer=function(e){let t=new N;return t.sizeHint=Math.floor(e),t},e.createHandle=function(e){let t=e.createHandle();return t.style.position="absolute",t.style.contain="style",t},e.averageSize=function(e){return e.reduce(((e,t)=>e+t.size),0)/e.length||0},e.normalize=function(e){let t=e.length;if(0===t)return[];let n=e.reduce(((e,t)=>e+Math.abs(t)),0);return 0===n?e.map((e=>1/t)):e.map((e=>e/n))}}(V||(V={}));class ne extends te{constructor(e){super({...e,orientation:e.orientation||"vertical"}),this._titles=[],this.titleSpace=e.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(e){e=ee.clampDimension(e),this.widgetOffset!==e&&(this.widgetOffset=e,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(e,t){const n=this._titles[e],i=n.classList.contains("lm-mod-expanded"),r=$.createTitle(this.renderer,t.title,i);this._titles[e]=r,this.parent.node.replaceChild(r,n)}insertWidget(e,t){t.id||(t.id=`id-${f.UUID.uuid4()}`),super.insertWidget(e,t)}attachWidget(e,t){const n=$.createTitle(this.renderer,t.title);i.insert(this._titles,e,n),this.parent.node.appendChild(n),t.node.setAttribute("role","region"),t.node.setAttribute("aria-labelledby",n.id),super.attachWidget(e,t)}moveWidget(e,t,n){i.move(this._titles,e,t),super.moveWidget(e,t,n)}detachWidget(e,t){const n=i.removeAt(this._titles,e);this.parent.node.removeChild(n),super.detachWidget(e,t)}updateItemPosition(e,t,n,i,r,s,o){const a=this._titles[e].style;a.top=`${i}px`,a.left=`${n}px`,a.height=`${this.widgetOffset}px`,a.width=t?`${r}px`:`${s}px`,super.updateItemPosition(e,t,n,i,r,s,o)}}!function(e){e.createTitle=function(e,t,n=!0){const i=e.createSectionTitle(t);return i.style.position="absolute",i.style.contain="strict",i.setAttribute("aria-label",`${t.label} Section`),i.setAttribute("aria-expanded",n?"true":"false"),i.setAttribute("aria-controls",t.owner.id),n&&i.classList.add("lm-mod-expanded"),i}}($||($={}));class ie extends z{constructor(e={}){super(),this.addClass("lm-Panel"),this.layout=q.createLayout(e)}get widgets(){return this.layout.widgets}addWidget(e){this.layout.addWidget(e)}insertWidget(e,t){this.layout.insertWidget(e,t)}}!function(e){e.createLayout=function(e){return e.layout||new H}}(q||(q={}));class re extends ie{constructor(e={}){super({layout:G.createLayout(e)}),this._handleMoved=new x.Signal(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(e){this.layout.orientation=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(e,t=!0){this.layout.setRelativeSizes(e,t)}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){e.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(e){e.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(e){this._pressData&&(e.preventDefault(),e.stopPropagation()),27===e.keyCode&&this._releaseMouse()}_evtPointerDown(e){if(0!==e.button)return;let t,n=this.layout,r=i.findFirstIndex(n.handles,(t=>t.contains(e.target)));if(-1===r)return;e.preventDefault(),e.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let s=n.handles[r],o=s.getBoundingClientRect();t="horizontal"===n.orientation?e.clientX-o.left:e.clientY-o.top;let a=window.getComputedStyle(s),l=D.Drag.overrideCursor(a.cursor);this._pressData={index:r,delta:t,override:l}}_evtPointerMove(e){let t;e.preventDefault(),e.stopPropagation();let n=this.layout,i=this.node.getBoundingClientRect();t="horizontal"===n.orientation?e.clientX-i.left-this._pressData.delta:e.clientY-i.top-this._pressData.delta,n.moveHandle(this._pressData.index,t)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}}!function(e){class t{createHandle(){let e=document.createElement("div");return e.className="lm-SplitPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t,e.getStretch=function(e){return te.getStretch(e)},e.setStretch=function(e,t){te.setStretch(e,t)}}(re||(re={})),function(e){e.createLayout=function(e){return e.layout||new te({renderer:e.renderer||re.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing})}}(G||(G={}));class se extends re{constructor(e={}){super({...e,layout:K.createLayout(e)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new x.Signal(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(e){this.layout.titleSpace=e}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(e){super.addWidget(e),e.title.changed.connect(this._onTitleChanged,this)}collapse(e){const t=this.layout.widgets[e];t&&!t.isHidden&&this._toggleExpansion(e)}expand(e){const t=this.layout.widgets[e];t&&t.isHidden&&this._toggleExpansion(e)}insertWidget(e,t){super.insertWidget(e,t),t.title.changed.connect(this._onTitleChanged,this)}handleEvent(e){switch(super.handleEvent(e),e.type){case"click":this._evtClick(e);break;case"keydown":this._eventKeyDown(e)}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(e)}onAfterDetach(e){super.onAfterDetach(e),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(e){const t=i.findFirstIndex(this.widgets,(t=>t.contains(e.owner)));t>=0&&(this.layout.updateTitle(t,e.owner),this.update())}_computeWidgetSize(e){const t=this.layout,n=t.widgets[e];if(!n)return;const i=n.isHidden,r=t.absoluteSizes(),s=(i?-1:1)*this.spacing,o=r.reduce(((e,t)=>e+t));let a=[...r];if(i){const t=this._widgetSizesCache.get(n);if(!t)return;a[e]+=t;const i=a.map((e=>e-t>0)).lastIndexOf(!0);-1===i?a.forEach(((n,i)=>{i!==e&&(a[i]-=r[i]/o*(t-s))})):a[i]-=t-s}else{const t=r[e];this._widgetSizesCache.set(n,t),a[e]=0;const i=a.map((e=>e>0)).lastIndexOf(!0);if(-1===i)return;a[i]=r[i]+t+s}return a.map((e=>e/(o+s)))}_evtClick(e){const t=e.target;if(t){const n=i.findFirstIndex(this.titles,(e=>e.contains(t)));n>=0&&(e.preventDefault(),e.stopPropagation(),this._toggleExpansion(n))}}_eventKeyDown(e){if(e.defaultPrevented)return;const t=e.target;let n=!1;if(t){const r=i.findFirstIndex(this.titles,(e=>e.contains(t)));if(r>=0){const i=e.keyCode.toString();if(e.key.match(/Space|Enter/)||i.match(/13|32/))t.click(),n=!0;else if("horizontal"===this.orientation?e.key.match(/ArrowLeft|ArrowRight/)||i.match(/37|39/):e.key.match(/ArrowUp|ArrowDown/)||i.match(/38|40/)){const t=e.key.match(/ArrowLeft|ArrowUp/)||i.match(/37|38/)?-1:1,s=this.titles.length,o=(r+s+t)%s;this.titles[o].focus(),n=!0}else"End"===e.key||"35"===i?(this.titles[this.titles.length-1].focus(),n=!0):"Home"!==e.key&&"36"!==i||(this.titles[0].focus(),n=!0)}n&&e.preventDefault()}}_toggleExpansion(e){const t=this.titles[e],n=this.layout.widgets[e],i=this._computeWidgetSize(e);i&&this.setRelativeSizes(i,!1),n.isHidden?(t.classList.add("lm-mod-expanded"),t.setAttribute("aria-expanded","true"),n.show()):(t.classList.remove("lm-mod-expanded"),t.setAttribute("aria-expanded","false"),n.hide()),this._expansionToggled.emit(e)}}!function(e){class t extends re.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++t._nInstance}createCollapseIcon(e){return document.createElement("span")}createSectionTitle(e){const t=document.createElement("h3");t.setAttribute("tabindex","0"),t.id=this.createTitleKey(e),t.className=this.titleClassName;for(const n in e.dataset)t.dataset[n]=e.dataset[n];t.appendChild(this.createCollapseIcon(e)).className="lm-AccordionPanel-titleCollapser";const n=t.appendChild(document.createElement("span"));return n.className="lm-AccordionPanel-titleLabel",n.textContent=e.label,n.title=e.caption||e.label,t}createTitleKey(e){let t=this._titleKeys.get(e);return void 0===t&&(t=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(e,t)),t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t}(se||(se={})),function(e){e.createLayout=function(e){return e.layout||new ne({renderer:e.renderer||se.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing,titleSpace:e.titleSpace})}}(K||(K={}));class oe extends H{constructor(e={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",void 0!==e.direction&&(this._direction=e.direction),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=ee.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(e){this._direction!==e&&(this._direction=e,this.parent&&(this.parent.dataset.direction=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=ee.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,t){i.insert(this._items,e,new W(t)),i.insert(this._sizers,e,new N),this.parent.isAttached&&g.sendMessage(t,z.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&g.sendMessage(t,z.Msg.AfterAttach),this.parent.fit()}moveWidget(e,t,n){i.move(this._items,e,t),i.move(this._sizers,e,t),this.parent.update()}detachWidget(e,t){let n=i.removeAt(this._items,e);i.removeAt(this._sizers,e),this.parent.isAttached&&g.sendMessage(t,z.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&g.sendMessage(t,z.Msg.AfterDetach),n.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0;for(let t=0,n=this._items.length;t0)switch(this._alignment){case"start":break;case"center":l=0,u=i/2;break;case"end":l=0,u=i;break;case"justify":l=i/n,u=0;break;default:throw"unreachable"}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.sizeBasisProperty=new E.AttachedProperty({name:"sizeBasis",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.isHorizontal=function(e){return"left-to-right"===e||"right-to-left"===e},e.clampSpacing=function(e){return Math.max(0,Math.floor(e))}}(Y||(Y={}));class ae extends ie{constructor(e={}){super({layout:J.createLayout(e)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(e){this.layout.direction=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}onChildAdded(e){e.child.addClass("lm-BoxPanel-child")}onChildRemoved(e){e.child.removeClass("lm-BoxPanel-child")}}!function(e){e.getStretch=function(e){return oe.getStretch(e)},e.setStretch=function(e,t){oe.setStretch(e,t)},e.getSizeBasis=function(e){return oe.getSizeBasis(e)},e.setSizeBasis=function(e,t){oe.setSizeBasis(e,t)}}(ae||(ae={})),function(e){e.createLayout=function(e){return e.layout||new oe(e)}}(J||(J={}));class le extends z{constructor(e){super({node:X.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(z.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||le.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(e){let t=X.createItem(this.commands,e);return this._items.push(t),this.refresh(),t}addItems(e){const t=e.map((e=>X.createItem(this.commands,e)));return t.forEach((e=>this._items.push(e))),this.refresh(),t}removeItem(e){this.removeItemAt(this._items.indexOf(e))}removeItemAt(e){i.removeAt(this._items,e)&&this.refresh()}clearItems(){0!==this._items.length&&(this._items.length=0,this.refresh())}refresh(){this._results=null,""!==this.inputNode.value?this.node.getElementsByClassName("lm-close-icon")[0].style.display="inherit":this.node.getElementsByClassName("lm-close-icon")[0].style.display="none",this.update()}handleEvent(e){switch(e.type){case"click":this._evtClick(e);break;case"keydown":this._evtKeyDown(e);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused()}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(e){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(e){this.update(),super.onAfterShow(e)}onActivateRequest(e){if(this.isAttached){let e=this.inputNode;e.focus(),e.select()}}onUpdateRequest(e){if(this.isHidden)return;let t=this.inputNode.value,n=this.contentNode,r=this._results;if(r||(r=this._results=X.search(this._items,t),this._activeIndex=t?i.findFirstIndex(r,X.canActivate):-1),!t&&0===r.length)return void w.render(null,n);if(t&&0===r.length){let e=this.renderer.renderEmptyMessage({query:t});return void w.render(e,n)}let s=this.renderer,o=this._activeIndex,a=new Array(r.length);for(let e=0,t=r.length;e=r.length)n.scrollTop=0;else{let e=n.children[o];d.scrollIntoViewIfNeeded(n,e)}}_evtClick(e){if(0!==e.button)return;if(e.target.classList.contains("lm-close-icon"))return this.inputNode.value="",void this.refresh();let t=i.findFirstIndex(this.contentNode.children,(t=>t.contains(e.target)));-1!==t&&(e.preventDefault(),e.stopPropagation(),this._execute(t))}_evtKeyDown(e){if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey))switch(e.keyCode){case 13:e.preventDefault(),e.stopPropagation(),this._execute(this._activeIndex);break;case 38:e.preventDefault(),e.stopPropagation(),this._activatePreviousItem();break;case 40:e.preventDefault(),e.stopPropagation(),this._activateNextItem()}}_activateNextItem(){if(!this._results||0===this._results.length)return;let e=this._activeIndex,t=this._results.length,n=ee-t)),c=a.slice(0,u),h=a.slice(u);for(let e=0,t=h.length;en.command===e&&f.JSONExt.deepEqual(n.args,t)))||null}}}(X||(X={}));class de extends z{constructor(e){super({node:Z.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new x.Signal(this),this._menuRequested=new x.Signal(this),this.addClass("lm-Menu"),this.setFlag(z.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||de.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let e=this;for(;e._parentMenu;)e=e._parentMenu;return e}get leafMenu(){let e=this;for(;e._childMenu;)e=e._childMenu;return e}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(e){this.activeIndex=e?this._items.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._items.length)&&(e=-1),-1===e||Z.canActivate(this._items[e])||(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let e=this._items.length,t=this._activeIndex,n=t{this.activeIndex=e}})}w.render(s,this.contentNode)}onCloseRequest(e){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let t=this._childMenu;t&&(this._childIndex=-1,this._childMenu=null,t._parentMenu=null,t.close());let n=this._parentMenu;n&&(this._parentMenu=null,n._childIndex=-1,n._childMenu=null,n.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(e)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation();let t=e.keyCode;if(13===t)return void this.triggerActiveItem();if(27===t)return void this.close();if(37===t)return void(this._parentMenu?this.close():this._menuRequested.emit("previous"));if(38===t)return void this.activatePreviousItem();if(39===t){let e=this.activeItem;return void(e&&"submenu"===e.type?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next"))}if(40===t)return void this.activateNextItem();let n=B().keyForKeydownEvent(e);if(!n)return;let i=this._activeIndex+1,r=Z.findMnemonic(this._items,n,i);-1===r.index||r.multiple?-1!==r.index?this.activeIndex=r.index:-1!==r.auto&&(this.activeIndex=r.auto):(this.activeIndex=r.index,this.triggerActiveItem())}_evtMouseUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this.triggerActiveItem())}_evtMouseMove(e){let t=i.findFirstIndex(this.contentNode.children,(t=>d.hitTest(t,e.clientX,e.clientY)));if(t===this._activeIndex)return;if(this.activeIndex=t,t=this.activeIndex,t===this._childIndex)return this._cancelOpenTimer(),void this._cancelCloseTimer();-1!==this._childIndex&&this._startCloseTimer(),this._cancelOpenTimer();let n=this.activeItem;n&&"submenu"===n.type&&n.submenu&&this._startOpenTimer()}_evtMouseEnter(e){for(let e=this._parentMenu;e;e=e._parentMenu)e._cancelOpenTimer(),e._cancelCloseTimer(),e.activeIndex=e._childIndex}_evtMouseLeave(e){if(this._cancelOpenTimer(),!this._childMenu)return void(this.activeIndex=-1);let{clientX:t,clientY:n}=e;d.hitTest(this._childMenu.node,t,n)?this._cancelCloseTimer():(this.activeIndex=-1,this._startCloseTimer())}_evtMouseDown(e){this._parentMenu||(Z.hitTestMenus(this,e.clientX,e.clientY)?(e.preventDefault(),e.stopPropagation()):this.close())}_openChildMenu(e=!1){let t=this.activeItem;if(!t||"submenu"!==t.type||!t.submenu)return void this._closeChildMenu();let n=t.submenu;if(n===this._childMenu)return;de.saveWindowData(),this._closeChildMenu(),this._childMenu=n,this._childIndex=this._activeIndex,n._parentMenu=this,g.sendMessage(this,z.Msg.UpdateRequest);let i=this.contentNode.children[this._activeIndex];Z.openSubmenu(n,i),e&&(n.activeIndex=-1,n.activateNextItem()),n.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){0===this._openTimerID&&(this._openTimerID=window.setTimeout((()=>{this._openTimerID=0,this._openChildMenu()}),Z.TIMER_DELAY))}_startCloseTimer(){0===this._closeTimerID&&(this._closeTimerID=window.setTimeout((()=>{this._closeTimerID=0,this._closeChildMenu()}),Z.TIMER_DELAY))}_cancelOpenTimer(){0!==this._openTimerID&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){0!==this._closeTimerID&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){Z.saveWindowData()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),n=this.createItemDataset(e),i=this.createItemARIA(e);return k.li({className:t,dataset:n,tabindex:"0",onfocus:e.onfocus,...i},this.renderIcon(e),this.renderLabel(e),this.renderShortcut(e),this.renderSubmenu(e))}renderIcon(e){let t=this.createIconClass(e);return k.div({className:t},e.item.icon,e.item.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return k.div({className:"lm-Menu-itemLabel"},t)}renderShortcut(e){let t=this.formatShortcut(e);return k.div({className:"lm-Menu-itemShortcut"},t)}renderSubmenu(e){return k.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(e){let t="lm-Menu-item";e.item.isEnabled||(t+=" lm-mod-disabled"),e.item.isToggled&&(t+=" lm-mod-toggled"),e.item.isVisible||(t+=" lm-mod-hidden"),e.active&&(t+=" lm-mod-active"),e.collapsed&&(t+=" lm-mod-collapsed");let n=e.item.className;return n&&(t+=` ${n}`),t}createItemDataset(e){let t,{type:n,command:i,dataset:r}=e.item;return t="command"===n?{...r,type:n,command:i}:{...r,type:n},t}createIconClass(e){let t="lm-Menu-itemIcon",n=e.item.iconClass;return n?`${t} ${n}`:t}createItemARIA(e){let t={};switch(e.item.type){case"separator":t.role="presentation";break;case"submenu":t["aria-haspopup"]="true",e.item.isEnabled||(t["aria-disabled"]="true");break;default:e.item.isEnabled||(t["aria-disabled"]="true"),t.role="menuitem"}return t}formatLabel(e){let{label:t,mnemonic:n}=e.item;if(n<0||n>=t.length)return t;let i=t.slice(0,n),r=t.slice(n+1),s=t[n];return[i,k.span({className:"lm-Menu-itemMnemonic"},s),r]}formatShortcut(e){let t=e.item.keyBinding;return t?D.CommandRegistry.formatKeystroke(t.keys):null}}e.Renderer=t,e.defaultRenderer=new t}(de||(de={})),function(e){e.TIMER_DELAY=300,e.SUBMENU_OVERLAP=3;let t=null,n=0;function r(){return n>0?(n--,t):o()}function s(e){return"separator"!==e.type&&e.isEnabled&&e.isVisible}function o(){return{pageXOffset:window.pageXOffset,pageYOffset:window.pageYOffset,clientWidth:document.documentElement.clientWidth,clientHeight:document.documentElement.clientHeight}}e.saveWindowData=function(){t=o(),n++},e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-Menu-content",e.appendChild(t),t.setAttribute("role","menu"),e.tabIndex=0,e},e.canActivate=s,e.createItem=function(e,t){return new a(e.commands,t)},e.hitTestMenus=function(e,t,n){for(let i=e;i;i=i.childMenu)if(d.hitTest(i.node,t,n))return!0;return!1},e.computeCollapsed=function(e){let t=new Array(e.length);i.fill(t,!1);let n=0,r=e.length;for(;n=0;--s){let n=e[s];if(n.isVisible){if("separator"!==n.type)break;t[s]=!0}}let o=!1;for(;++na+d&&(t=a+d-f),!s&&n+m>l+u&&(n>l+u?n=l+u-m:n-=m),p.transform=`translate(${Math.max(0,t)}px, ${Math.max(0,n)}px`,p.opacity="1"},e.openSubmenu=function(t,n){const i=r();let s=i.pageXOffset,o=i.pageYOffset,a=i.clientWidth,l=i.clientHeight;g.sendMessage(t,z.Msg.UpdateRequest);let u=l,c=t.node,h=c.style;h.opacity="0",h.maxHeight=`${u}px`,z.attach(t,document.body);let{width:p,height:f}=c.getBoundingClientRect(),m=d.boxSizing(t.node),v=n.getBoundingClientRect(),b=v.right-e.SUBMENU_OVERLAP;b+p>s+a&&(b=v.left+e.SUBMENU_OVERLAP-p);let A=v.top-m.borderTop-m.paddingTop;A+f>o+l&&(A=v.bottom+m.borderBottom+m.paddingBottom-f),h.transform=`translate(${Math.max(0,b)}px, ${Math.max(0,A)}px`,h.opacity="1"},e.findMnemonic=function(e,t,n){let i=-1,r=-1,o=!1,a=t.toUpperCase();for(let t=0,l=e.length;t=0&&hn.command===e&&f.JSONExt.deepEqual(n.args,t)))||null}return null}}}(Z||(Z={})),function(e){function t(e,t){let n=e.rank,i=t.rank;return n!==i?n=this._titles.length)&&(e=-1),this._currentIndex===e)return;let t=this._currentIndex,n=this._titles[t]||null,i=e,r=this._titles[i]||null;this._currentIndex=i,this._previousTitle=n,this.update(),this._currentChanged.emit({previousIndex:t,previousTitle:n,currentIndex:i,currentTitle:r})}get name(){return this._name}set name(e){this._name=e,e?this.contentNode.setAttribute("aria-label",e):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._releaseMouse(),this._orientation=e,this.dataset.orientation=e,this.contentNode.setAttribute("aria-orientation",e))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled!==e&&(this._addButtonEnabled=e,e?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(e){return this.insertTab(this._titles.length,e)}insertTab(e,t){this._releaseMouse();let n=he.asTitle(t),r=this._titles.indexOf(n),s=Math.max(0,Math.min(e,this._titles.length));return-1===r?(i.insert(this._titles,s,n),n.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(s,n),n):(s===this._titles.length&&s--,r===s||(i.move(this._titles,r,s),this.update(),this._adjustCurrentForMove(r,s)),n)}removeTab(e){this.removeTabAt(this._titles.indexOf(e))}removeTabAt(e){this._releaseMouse();let t=i.removeAt(this._titles,e);t&&(t.changed.disconnect(this._onTitleChanged,this),t===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(e,t))}clearTabs(){if(0===this._titles.length)return;this._releaseMouse();for(let e of this._titles)e.changed.disconnect(this._onTitleChanged,this);let e=this.currentIndex,t=this.currentTitle;this._currentIndex=-1,this._previousTitle=null,this._titles.length=0,this.update(),-1!==e&&this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}releaseMouse(){this._releaseMouse()}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"dblclick":this._evtDblClick(e);break;case"keydown":e.eventPhase===Event.CAPTURING_PHASE?this._evtKeyDownCapturing(e):this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this),this.node.addEventListener("dblclick",this),this.node.addEventListener("keydown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("dblclick",this),this.node.removeEventListener("keydown",this),this._releaseMouse()}onUpdateRequest(e){var t;let n=this._titles,i=this.renderer,r=this.currentTitle,s=new Array(n.length);const o=null!==(t=this._getCurrentTabindex())&&void 0!==t?t:this._currentIndex>-1?this._currentIndex:0;for(let e=0,t=n.length;ed.hitTest(t,e.clientX,e.clientY)));if(-1===n)return;let r=this.titles[n],s=t[n].querySelector(".lm-TabBar-tabLabel");if(s&&s.contains(e.target)){let e=r.label||"",t=s.innerHTML;s.innerHTML="";let n=document.createElement("input");n.classList.add("lm-TabBar-tabInput"),n.value=e,s.appendChild(n);let i=()=>{n.removeEventListener("blur",i),s.innerHTML=t,this.node.addEventListener("keydown",this)};n.addEventListener("dblclick",(e=>e.stopPropagation())),n.addEventListener("blur",i),n.addEventListener("keydown",(e=>{"Enter"===e.key?(""!==n.value&&(r.label=r.caption=n.value),i()):"Escape"===e.key&&i()})),this.node.removeEventListener("keydown",this),n.select(),n.focus(),s.children.length>0&&s.children[0].focus()}}_evtKeyDownCapturing(e){e.eventPhase===Event.CAPTURING_PHASE&&(e.preventDefault(),e.stopPropagation(),"Escape"===e.key&&this._releaseMouse())}_evtKeyDown(e){var t,n,r;if("Tab"!==e.key&&e.eventPhase!==Event.CAPTURING_PHASE)if("Enter"===e.key||"Spacebar"===e.key||" "===e.key){const t=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(t))e.preventDefault(),e.stopPropagation(),this._addRequested.emit();else{const n=i.findFirstIndex(this.contentNode.children,(e=>e.contains(t)));n>=0&&(e.preventDefault(),e.stopPropagation(),this.currentIndex=n)}}else if(ue.includes(e.key)){const i=[...this.contentNode.children];if(this.addButtonEnabled&&i.push(this.addButtonNode),i.length<=1)return;e.preventDefault(),e.stopPropagation();let s,o=i.indexOf(document.activeElement);-1===o&&(o=this._currentIndex),"ArrowRight"===e.key&&"horizontal"===this._orientation||"ArrowDown"===e.key&&"vertical"===this._orientation?s=null!==(t=i[o+1])&&void 0!==t?t:i[0]:"ArrowLeft"===e.key&&"horizontal"===this._orientation||"ArrowUp"===e.key&&"vertical"===this._orientation?s=null!==(n=i[o-1])&&void 0!==n?n:i[i.length-1]:"Home"===e.key?s=i[0]:"End"===e.key&&(s=i[i.length-1]),s&&(null===(r=i[o])||void 0===r||r.setAttribute("tabindex","-1"),null==s||s.setAttribute("tabindex","0"),s.focus())}}_evtPointerDown(e){if(0!==e.button&&1!==e.button)return;if(this._dragData)return;if(e.target.classList.contains("lm-TabBar-tabInput"))return;let t=this.addButtonEnabled&&this.addButtonNode.contains(e.target),n=this.contentNode.children,r=i.findFirstIndex(n,(t=>d.hitTest(t,e.clientX,e.clientY)));if(-1===r&&!t)return;if(e.preventDefault(),e.stopPropagation(),this._dragData={tab:n[r],index:r,pressX:e.clientX,pressY:e.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),1===e.button||t)return;let s=n[r].querySelector(this.renderer.closeIconSelector);s&&s.contains(e.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===r?this.currentIndex=-1:this.currentIndex=r,-1!==this.currentIndex&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(e){let t=this._dragData;if(!t)return;e.preventDefault(),e.stopPropagation();let n=this.contentNode.children;if(t.dragActive||he.dragExceeded(t,e)){if(!t.dragActive){let e=t.tab.getBoundingClientRect();"horizontal"===this._orientation?(t.tabPos=t.tab.offsetLeft,t.tabSize=e.width,t.tabPressPos=t.pressX-e.left):(t.tabPos=t.tab.offsetTop,t.tabSize=e.height,t.tabPressPos=t.pressY-e.top),t.tabPressOffset={x:t.pressX-e.left,y:t.pressY-e.top},t.tabLayout=he.snapTabLayout(n,this._orientation),t.contentRect=this.contentNode.getBoundingClientRect(),t.override=D.Drag.overrideCursor("default"),t.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),t.dragActive=!0}if(!t.detachRequested&&he.detachExceeded(t,e)){t.detachRequested=!0;let i=t.index,r=e.clientX,s=e.clientY,o=n[i],a=this._titles[i];if(this._tabDetachRequested.emit({index:i,title:a,tab:o,clientX:r,clientY:s,offset:t.tabPressOffset}),t.dragAborted)return}he.layoutTabs(n,t,e,this._orientation)}}_evtPointerUp(e){if(0!==e.button&&1!==e.button)return;const t=this._dragData;if(!t)return;if(e.preventDefault(),e.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!t.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(e.target))return void this._addRequested.emit(void 0);let n=this.contentNode.children,r=i.findFirstIndex(n,(t=>d.hitTest(t,e.clientX,e.clientY)));if(r!==t.index)return;let s=this._titles[r];if(!s.closable)return;if(1===e.button)return void this._tabCloseRequested.emit({index:r,title:s});let o=n[r].querySelector(this.renderer.closeIconSelector);return o&&o.contains(e.target)?void this._tabCloseRequested.emit({index:r,title:s}):void 0}if(0!==e.button)return;he.finalizeTabPosition(t,this._orientation),t.tab.classList.remove("lm-mod-dragging");let n=he.parseTransitionDuration(t.tab);setTimeout((()=>{if(t.dragAborted)return;this._dragData=null,he.resetTabPositions(this.contentNode.children,this._orientation),t.override.dispose(),this.removeClass("lm-mod-dragging");let e=t.index,n=t.targetIndex;-1!==n&&e!==n&&(i.move(this._titles,e,n),this._adjustCurrentForMove(e,n),this._tabMoved.emit({fromIndex:e,toIndex:n,title:this._titles[n]}),g.sendMessage(this,z.Msg.UpdateRequest))}),n)}_releaseMouse(){let e=this._dragData;e&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),e.dragAborted=!0,e.dragActive&&(he.resetTabPositions(this.contentNode.children,this._orientation),e.override.dispose(),e.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(e,t){let n=this.currentTitle,i=this._currentIndex,r=this.insertBehavior;if("select-tab"===r||"select-tab-if-needed"===r&&-1===i)return this._currentIndex=e,this._previousTitle=n,void this._currentChanged.emit({previousIndex:i,previousTitle:n,currentIndex:e,currentTitle:t});i>=e&&this._currentIndex++}_adjustCurrentForMove(e,t){this._currentIndex===e?this._currentIndex=t:this._currentIndex=t?this._currentIndex++:this._currentIndex>e&&this._currentIndex<=t&&this._currentIndex--}_adjustCurrentForRemove(e,t){let n=this._currentIndex,i=this.removeBehavior;if(n===e){if(0===this._titles.length)return this._currentIndex=-1,void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null});if("select-tab-after"===i)return this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-tab-before"===i)return this._currentIndex=Math.max(0,e-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-previous-tab"===i)return this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});this._currentIndex=-1,this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}else n>e&&this._currentIndex--}_onTitleChanged(e){this.update()}}var he,pe,ge,fe,me,ve,be,Ae;!function(e){class t{constructor(){this.closeIconSelector=".lm-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap,this._uuid=++t._nInstance}renderTab(e){let t=e.title.caption,n=this.createTabKey(e),i=n,r=this.createTabStyle(e),s=this.createTabClass(e),o=this.createTabDataset(e),a=this.createTabARIA(e);return e.title.closable?k.li({id:i,key:n,className:s,title:t,style:r,dataset:o,...a},this.renderIcon(e),this.renderLabel(e),this.renderCloseIcon(e)):k.li({id:i,key:n,className:s,title:t,style:r,dataset:o,...a},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){const{title:t}=e;let n=this.createIconClass(e);return k.div({className:n},t.icon,t.iconLabel)}renderLabel(e){return k.div({className:"lm-TabBar-tabLabel"},e.title.label)}renderCloseIcon(e){return k.div({className:"lm-TabBar-tabCloseIcon"})}createTabKey(e){let t=this._tabKeys.get(e.title);return void 0===t&&(t=`tab-key-${this._uuid}-${this._tabID++}`,this._tabKeys.set(e.title,t)),t}createTabStyle(e){return{zIndex:`${e.zIndex}`}}createTabClass(e){let t="lm-TabBar-tab";return e.title.className&&(t+=` ${e.title.className}`),e.title.closable&&(t+=" lm-mod-closable"),e.current&&(t+=" lm-mod-current"),t}createTabDataset(e){return e.title.dataset}createTabARIA(e){var t;return{role:"tab","aria-selected":e.current.toString(),tabindex:`${null!==(t=e.tabIndex)&&void 0!==t?t:"-1"}`}}createIconClass(e){let t="lm-TabBar-tabIcon",n=e.title.iconClass;return n?`${t} ${n}`:t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t,e.addButtonSelector=".lm-TabBar-addButton"}(ce||(ce={})),function(e){e.DRAG_THRESHOLD=5,e.DETACH_THRESHOLD=20,e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");t.setAttribute("role","tablist"),t.className="lm-TabBar-content",e.appendChild(t);let n=document.createElement("div");return n.className="lm-TabBar-addButton lm-mod-hidden",n.setAttribute("tabindex","-1"),n.setAttribute("role","button"),e.appendChild(n),e},e.asTitle=function(e){return e instanceof F?e:new F(e)},e.parseTransitionDuration=function(e){let t=window.getComputedStyle(e);return 1e3*(parseFloat(t.transitionDuration)||0)},e.snapTabLayout=function(e,t){let n=new Array(e.length);for(let i=0,r=e.length;i=e.DRAG_THRESHOLD||r>=e.DRAG_THRESHOLD},e.detachExceeded=function(t,n){let i=t.contentRect;return n.clientX=i.right+e.DETACH_THRESHOLD||n.clientY=i.bottom+e.DETACH_THRESHOLD},e.layoutTabs=function(e,t,n,i){let r,s,o,a;"horizontal"===i?(r=t.pressX,s=n.clientX-t.contentRect.left,o=n.clientX,a=t.contentRect.width):(r=t.pressY,s=n.clientY-t.contentRect.top,o=n.clientY,a=t.contentRect.height);let l=t.index,d=s-t.tabPressPos,u=d+t.tabSize;for(let n=0,s=e.length;n>1);if(nt.index&&u>h)s=-t.tabSize-c.margin+"px",l=Math.max(l,n);else if(n===t.index){let e=o-r,n=a-(t.tabPos+t.tabSize);s=`${Math.max(-t.tabPos,Math.min(e,n))}px`}else s="";"horizontal"===i?e[n].style.left=s:e[n].style.top=s}t.targetIndex=l},e.finalizeTabPosition=function(e,t){let n,i;if(n="horizontal"===t?e.contentRect.width:e.contentRect.height,e.targetIndex===e.index)i=0;else if(e.targetIndex>e.index){let t=e.tabLayout[e.targetIndex];i=t.pos+t.size-e.tabSize-e.tabPos}else i=e.tabLayout[e.targetIndex].pos-e.tabPos;let r=n-(e.tabPos+e.tabSize),s=Math.max(-e.tabPos,Math.min(i,r));"horizontal"===t?e.tab.style.left=`${s}px`:e.tab.style.top=`${s}px`},e.resetTabPositions=function(e,t){for(const n of e)"horizontal"===t?n.style.left="":n.style.top=""}}(he||(he={}));class ye extends U{constructor(e){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=e.renderer,void 0!==e.spacing&&(this._spacing=ee.clampDimension(e.spacing)),this._document=e.document||document,this._hiddenMode=void 0!==e.hiddenMode?e.hiddenMode:z.HiddenMode.Display}dispose(){let e=this[Symbol.iterator]();this._items.forEach((e=>{e.dispose()})),this._box=null,this._root=null,this._items.clear();for(const t of e)t.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){if(this._hiddenMode!==e){this._hiddenMode=e;for(const e of this.tabBars())if(e.titles.length>1)for(const t of e.titles)t.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(e){e=ee.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get isEmpty(){return null===this._root}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():o()}widgets(){return this._root?this._root.iterUserWidgets():o()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():o()}tabBars(){return this._root?this._root.iterTabBars():o()}handles(){return this._root?this._root.iterHandles():o()}moveHandle(e,t,n){let i=e.classList.contains("lm-mod-hidden");if(!this._root||i)return;let r,s=this._root.findSplitNode(e);s&&(r="horizontal"===s.node.orientation?t-e.offsetLeft:n-e.offsetTop,0!==r&&(s.node.holdSizes(),I.adjust(s.node.sizers,s.index,r),this.parent&&this.parent.update()))}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(e){let t,n=new Set;t=e.main?pe.normalizeAreaConfig(e.main,n):null;let i=this.widgets(),r=this.tabBars(),s=this.handles();this._root=null;for(const e of i)n.has(e)||(e.parent=null);for(const e of r)e.dispose();for(const e of s)e.parentNode&&e.parentNode.removeChild(e);for(const e of n)e.parent=this.parent;this._root=t?pe.realizeAreaConfig(t,{createTabBar:e=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):null,this.parent&&(n.forEach((e=>{this.attachWidget(e)})),this.parent.fit())}addWidget(e,t={}){let n=t.ref||null,i=t.mode||"tab-after",r=null;if(this._root&&n&&(r=this._root.findTabNode(n)),n&&!r)throw new Error("Reference widget is not in the layout.");switch(e.parent=this.parent,i){case"tab-after":this._insertTab(e,n,r,!0);break;case"tab-before":this._insertTab(e,n,r,!1);break;case"split-top":this._insertSplit(e,n,r,"vertical",!1);break;case"split-left":this._insertSplit(e,n,r,"horizontal",!1);break;case"split-right":this._insertSplit(e,n,r,"horizontal",!0);break;case"split-bottom":this._insertSplit(e,n,r,"vertical",!0);break;case"merge-top":this._insertSplit(e,n,r,"vertical",!1,!0);break;case"merge-left":this._insertSplit(e,n,r,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(e,n,r,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(e,n,r,"vertical",!0,!0)}this.parent&&(this.attachWidget(e),this.parent.fit())}removeWidget(e){this._removeWidget(e),this.parent&&(this.detachWidget(e),this.parent.fit())}hitTestTabAreas(e,t){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=d.boxSizing(this.parent.node));let n=this.parent.node.getBoundingClientRect(),i=e-n.left-this._box.borderLeft,r=t-n.top-this._box.borderTop,s=this._root.hitTestTabNodes(i,r);if(!s)return null;let{tabBar:o,top:a,left:l,width:u,height:c}=s,h=this._box.borderLeft+this._box.borderRight,p=this._box.borderTop+this._box.borderBottom;return{tabBar:o,x:i,y:r,top:a,left:l,right:n.width-h-(l+u),bottom:n.height-p-(a+c),width:u,height:c}}init(){super.init();for(const e of this)this.attachWidget(e);for(const e of this.handles())this.parent.node.appendChild(e);this.parent.fit()}attachWidget(e){this.parent.node!==e.node.parentNode&&(this._items.set(e,new W(e)),this.parent.isAttached&&g.sendMessage(e,z.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&g.sendMessage(e,z.Msg.AfterAttach))}detachWidget(e){if(this.parent.node!==e.node.parentNode)return;this.parent.isAttached&&g.sendMessage(e,z.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&g.sendMessage(e,z.Msg.AfterDetach);let t=this._items.get(e);t&&(this._items.delete(e),t.dispose())}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_removeWidget(e){if(!this._root)return;let t=this._root.findTabNode(e);if(!t)return;if(pe.removeAria(e),t.tabBar.titles.length>1)return t.tabBar.removeTab(e.title),void(this._hiddenMode===z.HiddenMode.Scale&&1==t.tabBar.titles.length&&(t.tabBar.titles[0].owner.hiddenMode=z.HiddenMode.Display));if(t.tabBar.dispose(),this._root===t)return void(this._root=null);this._root.holdAllSizes();let n=t.parent;t.parent=null;let r=i.removeFirstOf(n.children,t),s=i.removeAt(n.handles,r);if(i.removeAt(n.sizers,r),s.parentNode&&s.parentNode.removeChild(s),n.children.length>1)return void n.syncHandles();let o=n.parent;n.parent=null;let a=n.children[0],l=n.handles[0];if(n.children.length=0,n.handles.length=0,n.sizers.length=0,l.parentNode&&l.parentNode.removeChild(l),this._root===n)return a.parent=null,void(this._root=a);let d=o,u=d.children.indexOf(n);if(a instanceof pe.TabLayoutNode)return a.parent=d,void(d.children[u]=a);let c=i.removeAt(d.handles,u);i.removeAt(d.children,u),i.removeAt(d.sizers,u),c.parentNode&&c.parentNode.removeChild(c);for(let e=0,t=a.children.length;e=n.length)&&(i=0),{type:"tab-area",widgets:n,currentIndex:i}}(t,n):function(t,n){let i=t.orientation,r=[],s=[];for(let o=0,a=t.children.length;o{let l=r(i,n,s),d=t(e.sizes[a]),u=n.createHandle();o.children.push(l),o.handles.push(u),o.sizers.push(d),l.parent=o})),o.syncHandles(),o.normalizeSizes(),o}(s,o,a),l};class n{constructor(e){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;let t=new N,n=new N;t.stretch=0,n.stretch=1,this.tabBar=e,this.sizers=[t,n]}get top(){return this._top}get left(){return this._left}get width(){return this._width}get height(){return this._height}*iterAllWidgets(){yield this.tabBar,yield*this.iterUserWidgets()}*iterUserWidgets(){for(const e of this.tabBar.titles)yield e.owner}*iterSelectedWidgets(){let e=this.tabBar.currentTitle;e&&(yield e.owner)}*iterTabBars(){yield this.tabBar}*iterHandles(){}findTabNode(e){return-1!==this.tabBar.titles.indexOf(e.title)?this:null}findSplitNode(e){return null}findFirstTabNode(){return this}hitTestTabNodes(e,t){return e=this._left+this._width||t=this._top+this._height?null:this}createConfig(){return{type:"tab-area",widgets:this.tabBar.titles.map((e=>e.owner)),currentIndex:this.tabBar.currentIndex}}holdAllSizes(){}fit(e,t){let n=0,i=0,r=t.get(this.tabBar),s=this.tabBar.currentTitle,o=s?t.get(s.owner):void 0,[a,l]=this.sizers;return r&&r.fit(),o&&o.fit(),r&&!r.isHidden?(n=Math.max(n,r.minWidth),i+=r.minHeight,a.minSize=r.minHeight,a.maxSize=r.maxHeight):(a.minSize=0,a.maxSize=0),o&&!o.isHidden?(n=Math.max(n,o.minWidth),i+=o.minHeight,l.minSize=o.minHeight,l.maxSize=1/0):(l.minSize=0,l.maxSize=1/0),{minWidth:n,minHeight:i,maxWidth:1/0,maxHeight:1/0}}update(e,t,n,i,r,s){this._top=t,this._left=e,this._width=n,this._height=i;let o=s.get(this.tabBar),a=this.tabBar.currentTitle,l=a?s.get(a.owner):void 0;if(I.calc(this.sizers,i),o&&!o.isHidden){let i=this.sizers[0].size;o.update(e,t,n,i),t+=i}if(l&&!l.isHidden){let i=this.sizers[1].size;l.update(e,t,n,i)}}}e.TabLayoutNode=n;class i{constructor(e){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=e}*iterAllWidgets(){for(const e of this.children)yield*e.iterAllWidgets()}*iterUserWidgets(){for(const e of this.children)yield*e.iterUserWidgets()}*iterSelectedWidgets(){for(const e of this.children)yield*e.iterSelectedWidgets()}*iterTabBars(){for(const e of this.children)yield*e.iterTabBars()}*iterHandles(){yield*this.handles;for(const e of this.children)yield*e.iterHandles()}findTabNode(e){for(let t=0,n=this.children.length;te.createConfig())),sizes:t}}syncHandles(){this.handles.forEach(((e,t)=>{e.setAttribute("data-orientation",this.orientation),t===this.handles.length-1?e.classList.add("lm-mod-hidden"):e.classList.remove("lm-mod-hidden")}))}holdSizes(){for(const e of this.sizers)e.sizeHint=e.size}holdAllSizes(){for(const e of this.children)e.holdAllSizes();this.holdSizes()}normalizeSizes(){let e=this.sizers.length;if(0===e)return;this.holdSizes();let t=this.sizers.reduce(((e,t)=>e+t.sizeHint),0);if(0===t)for(const t of this.sizers)t.size=t.sizeHint=1/e;else for(const e of this.sizers)e.size=e.sizeHint/=t;this.normalized=!0}createNormalizedSizes(){let e=this.sizers.length;if(0===e)return[];let t=this.sizers.map((e=>e.size)),n=t.reduce(((e,t)=>e+t),0);if(0===n)for(let n=t.length-1;n>-1;n--)t[n]=1/e;else for(let e=t.length-1;e>-1;e--)t[e]/=n;return t}fit(e,t){let n="horizontal"===this.orientation,i=Math.max(0,this.children.length-1)*e,r=n?i:0,s=n?0:i;for(let i=0,o=this.children.length;ithis._createTabBar(),createHandle:()=>this._createHandle()};this.layout=new ye({document:this._document,renderer:t,spacing:e.spacing,hiddenMode:e.hiddenMode}),this.overlay=e.overlay||new _e.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(e){this.layout.hiddenMode=e}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get mode(){return this._mode}set mode(e){if(this._mode===e)return;this._mode=e,this.dataset.mode=e;let t=this.layout;switch(e){case"multiple-document":for(const e of t.tabBars())e.show();break;case"single-document":t.restoreLayout(ge.createSingleDocumentConfig(this));break;default:throw"unreachable"}g.postMessage(this,ge.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(e){this._tabsMovable=e;for(const t of this.tabBars())t.tabsMovable=e}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(e){this._tabsConstrained=e}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled=e;for(const t of this.tabBars())t.addButtonEnabled=e}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(e){let t=a(this.tabBars(),(t=>-1!==t.titles.indexOf(e.title)));if(!t)throw new Error("Widget is not contained in the dock panel.");t.currentTitle=e.title}activateWidget(e){this.selectWidget(e),e.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(e){this._mode="multiple-document",this.layout.restoreLayout(e),(u.IS_EDGE||u.IS_IE)&&g.flush(),g.postMessage(this,ge.LayoutModified)}addWidget(e,t={}){"single-document"===this._mode?this.layout.addWidget(e):this.layout.addWidget(e,t),g.postMessage(this,ge.LayoutModified)}processMessage(e){"layout-modified"===e.type?this._layoutModified.emit(void 0):super.processMessage(e)}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);break;case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){ge.isGeneratedTabBarProperty.get(e.child)||e.child.addClass("lm-DockPanel-widget")}onChildRemoved(e){ge.isGeneratedTabBarProperty.get(e.child)||(e.child.removeClass("lm-DockPanel-widget"),g.postMessage(this,ge.LayoutModified))}_evtDragEnter(e){e.mimeData.hasData("application/vnd.lumino.widget-factory")&&(e.preventDefault(),e.stopPropagation())}_evtDragLeave(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||(e.stopPropagation(),this.overlay.hide(1))}_evtDragOver(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||"invalid"===this._showOverlay(e.clientX,e.clientY)?e.dropAction="none":(e.stopPropagation(),e.dropAction=e.proposedAction)}_evtDrop(e){if(e.preventDefault(),this.overlay.hide(0),"none"===e.proposedAction)return void(e.dropAction="none");let{clientX:t,clientY:n}=e,{zone:i,target:r}=ge.findDropTarget(this,t,n,this._edges);if(this._tabsConstrained&&e.source!==this||"invalid"===i)return void(e.dropAction="none");let s=e.mimeData.getData("application/vnd.lumino.widget-factory");if("function"!=typeof s)return void(e.dropAction="none");let o=s();if(!(o instanceof z))return void(e.dropAction="none");if(o.contains(this))return void(e.dropAction="none");let a=r?ge.getDropRef(r.tabBar):null;switch(i){case"root-all":this.addWidget(o);break;case"root-top":this.addWidget(o,{mode:"split-top"});break;case"root-left":this.addWidget(o,{mode:"split-left"});break;case"root-right":this.addWidget(o,{mode:"split-right"});break;case"root-bottom":this.addWidget(o,{mode:"split-bottom"});break;case"widget-all":case"widget-tab":this.addWidget(o,{mode:"tab-after",ref:a});break;case"widget-top":this.addWidget(o,{mode:"split-top",ref:a});break;case"widget-left":this.addWidget(o,{mode:"split-left",ref:a});break;case"widget-right":this.addWidget(o,{mode:"split-right",ref:a});break;case"widget-bottom":this.addWidget(o,{mode:"split-bottom",ref:a});break;default:throw"unreachable"}e.dropAction=e.proposedAction,e.stopPropagation(),this.activateWidget(o)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation(),27===e.keyCode&&(this._releaseMouse(),g.postMessage(this,ge.LayoutModified))}_evtPointerDown(e){if(0!==e.button)return;let t=this.layout,n=e.target,i=a(t.handles(),(e=>e.contains(n)));if(!i)return;e.preventDefault(),e.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let r=i.getBoundingClientRect(),s=e.clientX-r.left,o=e.clientY-r.top,l=window.getComputedStyle(i),d=D.Drag.overrideCursor(l.cursor,this._document);this._pressData={handle:i,deltaX:s,deltaY:o,override:d}}_evtPointerMove(e){if(!this._pressData)return;e.preventDefault(),e.stopPropagation();let t=this.node.getBoundingClientRect(),n=e.clientX-t.left-this._pressData.deltaX,i=e.clientY-t.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,n,i)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse(),g.postMessage(this,ge.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(e,t){let n,i,r,s,{zone:o,target:a}=ge.findDropTarget(this,e,t,this._edges);if("invalid"===o)return this.overlay.hide(100),o;let l=d.boxSizing(this.node),u=this.node.getBoundingClientRect();switch(o){case"root-all":n=l.paddingTop,i=l.paddingLeft,r=l.paddingRight,s=l.paddingBottom;break;case"root-top":n=l.paddingTop,i=l.paddingLeft,r=l.paddingRight,s=u.height*ge.GOLDEN_RATIO;break;case"root-left":n=l.paddingTop,i=l.paddingLeft,r=u.width*ge.GOLDEN_RATIO,s=l.paddingBottom;break;case"root-right":n=l.paddingTop,i=u.width*ge.GOLDEN_RATIO,r=l.paddingRight,s=l.paddingBottom;break;case"root-bottom":n=u.height*ge.GOLDEN_RATIO,i=l.paddingLeft,r=l.paddingRight,s=l.paddingBottom;break;case"widget-all":n=a.top,i=a.left,r=a.right,s=a.bottom;break;case"widget-top":n=a.top,i=a.left,r=a.right,s=a.bottom+a.height/2;break;case"widget-left":n=a.top,i=a.left,r=a.right+a.width/2,s=a.bottom;break;case"widget-right":n=a.top,i=a.left+a.width/2,r=a.right,s=a.bottom;break;case"widget-bottom":n=a.top+a.height/2,i=a.left,r=a.right,s=a.bottom;break;case"widget-tab":{const e=a.tabBar.node.getBoundingClientRect().height;n=a.top,i=a.left,r=a.right,s=a.bottom+a.height-e;break}default:throw"unreachable"}return this.overlay.show({top:n,left:i,right:r,bottom:s}),o}_createTabBar(){let e=this._renderer.createTabBar(this._document);return ge.isGeneratedTabBarProperty.set(e,!0),"single-document"===this._mode&&e.hide(),e.tabsMovable=this._tabsMovable,e.allowDeselect=!1,e.addButtonEnabled=this._addButtonEnabled,e.removeBehavior="select-previous-tab",e.insertBehavior="select-tab-if-needed",e.tabMoved.connect(this._onTabMoved,this),e.currentChanged.connect(this._onCurrentChanged,this),e.tabCloseRequested.connect(this._onTabCloseRequested,this),e.tabDetachRequested.connect(this._onTabDetachRequested,this),e.tabActivateRequested.connect(this._onTabActivateRequested,this),e.addRequested.connect(this._onTabAddRequested,this),e}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){g.postMessage(this,ge.LayoutModified)}_onCurrentChanged(e,t){let{previousTitle:n,currentTitle:i}=t;n&&n.owner.hide(),i&&i.owner.show(),(u.IS_EDGE||u.IS_IE)&&g.flush(),g.postMessage(this,ge.LayoutModified)}_onTabAddRequested(e){this._addRequested.emit(e)}_onTabActivateRequested(e,t){t.title.owner.activate()}_onTabCloseRequested(e,t){t.title.owner.close()}_onTabDetachRequested(e,t){if(this._drag)return;e.releaseMouse();let{title:n,tab:i,clientX:r,clientY:s,offset:o}=t,a=new f.MimeData;a.setData("application/vnd.lumino.widget-factory",(()=>n.owner));let l=i.cloneNode(!0);o&&(l.style.top=`-${o.y}px`,l.style.left=`-${o.x}px`),this._drag=new D.Drag({document:this._document,mimeData:a,dragImage:l,proposedAction:"move",supportedActions:"move",source:this}),i.classList.add("lm-mod-hidden"),this._drag.start(r,s).then((()=>{this._drag=null,i.classList.remove("lm-mod-hidden")}))}}!function(e){e.Overlay=class{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(e){let t=this.node.style;t.top=`${e.top}px`,t.left=`${e.left}px`,t.right=`${e.right}px`,t.bottom=`${e.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(e){if(!this._hidden)return e<=0?(clearTimeout(this._timer),this._timer=-1,this._hidden=!0,void this.node.classList.add("lm-mod-hidden")):void(-1===this._timer&&(this._timer=window.setTimeout((()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")}),e)))}};class t{createTabBar(e){let t=new ce({document:e});return t.addClass("lm-DockPanel-tabBar"),t}createHandle(){let e=document.createElement("div");return e.className="lm-DockPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t}(_e||(_e={})),function(e){e.GOLDEN_RATIO=.618,e.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},e.LayoutModified=new b("layout-modified"),e.isGeneratedTabBarProperty=new E.AttachedProperty({name:"isGeneratedTabBar",create:()=>!1}),e.createSingleDocumentConfig=function(e){if(e.isEmpty)return{main:null};let t=Array.from(e.widgets()),n=e.selectedWidgets().next().value,i=n?t.indexOf(n):-1;return{main:{type:"tab-area",widgets:t,currentIndex:i}}},e.findDropTarget=function(e,t,n,i){if(!d.hitTest(e.node,t,n))return{zone:"invalid",target:null};let r=e.layout;if(r.isEmpty)return{zone:"root-all",target:null};if("multiple-document"===e.mode){let r=e.node.getBoundingClientRect(),s=t-r.left+1,o=n-r.top+1,a=r.right-t,l=r.bottom-n;switch(Math.min(o,a,l,s)){case o:if(oh&&l>h&&a>p&&u>p)return{zone:"widget-all",target:s};switch(o/=h,a/=p,l/=h,u/=p,Math.min(o,a,l,u)){case o:c="widget-left";break;case a:c="widget-top";break;case l:c="widget-right";break;case u:c="widget-bottom";break;default:throw"unreachable"}return{zone:c,target:s}},e.getDropRef=function(e){return 0===e.titles.length?null:e.currentTitle?e.currentTitle.owner:e.titles[e.titles.length-1].owner}}(ge||(ge={}));class we{constructor(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new x.Signal(this),this._currentChanged=new x.Signal(this)}dispose(){if(!(this._counter<0)){this._counter=-1,x.Signal.clearData(this);for(const e of this._widgets)e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0);this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0}}get currentChanged(){return this._currentChanged}get activeChanged(){return this._activeChanged}get isDisposed(){return this._counter<0}get currentWidget(){return this._currentWidget}get activeWidget(){return this._activeWidget}get widgets(){return this._widgets}focusNumber(e){let t=this._numbers.get(e);return void 0===t?-1:t}has(e){return this._numbers.has(e)}add(e){if(this._numbers.has(e))return;let t=e.node.contains(document.activeElement),n=t?this._counter++:-1;this._widgets.push(e),this._numbers.set(e,n),this._nodes.set(e.node,e),e.node.addEventListener("focus",this,!0),e.node.addEventListener("blur",this,!0),e.disposed.connect(this._onWidgetDisposed,this),t&&this._setWidgets(e,e)}remove(e){if(!this._numbers.has(e))return;if(e.disposed.disconnect(this._onWidgetDisposed,this),e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0),i.removeFirstOf(this._widgets,e),this._nodes.delete(e.node),this._numbers.delete(e),this._currentWidget!==e)return;let t=function(e,t){let n;for(const i of e)void 0!==n?t(i,n)>0&&(n=i):n=i;return n}(this._widgets.filter((e=>-1!==this._numbers.get(e))),((e,t)=>this._numbers.get(e)-this._numbers.get(t)))||null;this._setWidgets(t,null)}handleEvent(e){switch(e.type){case"focus":this._evtFocus(e);break;case"blur":this._evtBlur(e)}}_setWidgets(e,t){let n=this._currentWidget;this._currentWidget=e;let i=this._activeWidget;this._activeWidget=t,n!==e&&this._currentChanged.emit({oldValue:n,newValue:e}),i!==t&&this._activeChanged.emit({oldValue:i,newValue:t})}_evtFocus(e){let t=this._nodes.get(e.currentTarget);t!==this._currentWidget&&this._numbers.set(t,this._counter++),this._setWidgets(t,t)}_evtBlur(e){let t=this._nodes.get(e.currentTarget),n=e.relatedTarget;n&&(t.node.contains(n)||a(this._widgets,(e=>e.node.contains(n))))||this._setWidgets(this._currentWidget,null)}_onWidgetDisposed(e){this.remove(e)}}class Ce extends U{constructor(e={}){super(e),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new N],this._columnSizers=[new N],this._box=null,void 0!==e.rowCount&&fe.reallocSizers(this._rowSizers,e.rowCount),void 0!==e.columnCount&&fe.reallocSizers(this._columnSizers,e.columnCount),void 0!==e.rowSpacing&&(this._rowSpacing=fe.clampValue(e.rowSpacing)),void 0!==e.columnSpacing&&(this._columnSpacing=fe.clampValue(e.columnSpacing))}dispose(){for(const e of this._items){let t=e.widget;e.dispose(),t.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(e){e!==this.rowCount&&(fe.reallocSizers(this._rowSizers,e),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(e){e!==this.columnCount&&(fe.reallocSizers(this._columnSizers,e),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(e){e=fe.clampValue(e),this._rowSpacing!==e&&(this._rowSpacing=e,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(e){e=fe.clampValue(e),this._columnSpacing!==e&&(this._columnSpacing=e,this.parent&&this.parent.fit())}rowStretch(e){let t=this._rowSizers[e];return t?t.stretch:-1}setRowStretch(e,t){let n=this._rowSizers[e];n&&(t=fe.clampValue(t),n.stretch!==t&&(n.stretch=t,this.parent&&this.parent.update()))}columnStretch(e){let t=this._columnSizers[e];return t?t.stretch:-1}setColumnStretch(e,t){let n=this._columnSizers[e];n&&(t=fe.clampValue(t),n.stretch!==t&&(n.stretch=t,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(const e of this._items)yield e.widget}addWidget(e){-1===i.findFirstIndex(this._items,(t=>t.widget===e))&&(this._items.push(new W(e)),this.parent&&this.attachWidget(e))}removeWidget(e){let t=i.findFirstIndex(this._items,(t=>t.widget===e));if(-1===t)return;let n=i.removeAt(this._items,t);this.parent&&this.detachWidget(e),n.dispose()}init(){super.init();for(const e of this)this.attachWidget(e)}attachWidget(e){this.parent.isAttached&&g.sendMessage(e,z.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&g.sendMessage(e,z.Msg.AfterAttach),this.parent.fit()}detachWidget(e){this.parent.isAttached&&g.sendMessage(e,z.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&g.sendMessage(e,z.Msg.AfterDetach),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){for(let e=0,t=this.rowCount;e!e.isHidden));for(let t=0,n=e.length;t({row:0,column:0,rowSpan:1,columnSpan:1}),changed:function(e){e.parent&&e.parent.layout instanceof Ce&&e.parent.fit()}}),e.normalizeConfig=function(e){return{row:Math.max(0,Math.floor(e.row||0)),column:Math.max(0,Math.floor(e.column||0)),rowSpan:Math.max(1,Math.floor(e.rowSpan||0)),columnSpan:Math.max(1,Math.floor(e.columnSpan||0))}},e.clampValue=function(e){return Math.max(0,Math.floor(e))},e.rowSpanCmp=function(t,n){let i=e.cellConfigProperty.get(t.widget),r=e.cellConfigProperty.get(n.widget);return i.rowSpan-r.rowSpan},e.columnSpanCmp=function(t,n){let i=e.cellConfigProperty.get(t.widget),r=e.cellConfigProperty.get(n.widget);return i.columnSpan-r.columnSpan},e.reallocSizers=function(e,t){for(t=Math.max(1,Math.floor(t));e.lengtht&&(e.length=t)},e.distributeMin=function(e,t,n,i){if(n=i)return;let s=(i-r)/(n-t+1);for(let i=t;i<=n;++i)e[i].minSize+=s}}(fe||(fe={}));class Ee extends z{constructor(e={}){super({node:me.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(z.Flag.DisallowLayout),this.renderer=e.renderer||Ee.defaultRenderer,this._forceItemsPosition=e.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=e.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(e){this.activeIndex=e?this._menus.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._menus.length)&&(e=-1),e>-1&&0===this._menus[e].items.length&&(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this.update())}get menus(){return this._menus}openActiveMenu(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(e,t=!0){this.insertMenu(this._menus.length,e,t)}insertMenu(e,t,n=!0){this._closeChildMenu();let r=this._menus.indexOf(t),s=Math.max(0,Math.min(e,this._menus.length));if(-1===r)return i.insert(this._menus,s,t),t.addClass("lm-MenuBar-menu"),t.aboutToClose.connect(this._onMenuAboutToClose,this),t.menuRequested.connect(this._onMenuMenuRequested,this),t.title.changed.connect(this._onTitleChanged,this),void(n&&this.update());s===this._menus.length&&s--,r!==s&&(i.move(this._menus,r,s),n&&this.update())}removeMenu(e,t=!0){this.removeMenuAt(this._menus.indexOf(e),t)}removeMenuAt(e,t=!0){this._closeChildMenu();let n=i.removeAt(this._menus,e);n&&(n.aboutToClose.disconnect(this._onMenuAboutToClose,this),n.menuRequested.disconnect(this._onMenuMenuRequested,this),n.title.changed.disconnect(this._onTitleChanged,this),n.removeClass("lm-MenuBar-menu"),t&&this.update())}clearMenus(){if(0!==this._menus.length){this._closeChildMenu();for(let e of this._menus)e.aboutToClose.disconnect(this._onMenuAboutToClose,this),e.menuRequested.disconnect(this._onMenuMenuRequested,this),e.title.changed.disconnect(this._onTitleChanged,this),e.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mousedown":this._evtMouseDown(e);break;case"mousemove":this._evtMouseMove(e);break;case"focusout":this._evtFocusOut(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("keydown",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(e){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(e){this.isAttached&&this._focusItemAt(0)}onResize(e){this.update(),super.onResize(e)}onUpdateRequest(e){var t;let n=this._menus,i=this.renderer,r=this._activeIndex,s=this._tabFocusIndex>=0&&this._tabFocusIndex-1?this._overflowIndex:n.length,a=0,l=!1;o=null!==this._overflowMenu?o-1:o;let d=new Array(o);for(let e=0;e{this._tabFocusIndex=e,this.activeIndex=e}}),a+=this._menuItemSizes[e],n[e].title.label===this._overflowMenuOptions.title&&(l=!0,o--);if(this._overflowMenuOptions.isVisible)if(this._overflowIndex>-1&&!l){if(null===this._overflowMenu){const e=null!==(t=this._overflowMenuOptions.title)&&void 0!==t?t:"...";this._overflowMenu=new de({commands:new D.CommandRegistry}),this._overflowMenu.title.label=e,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let e=n.length-2;e>=o;e--){const t=this.menus[e];t.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:t}),this.removeMenu(t,!1)}d[o]=i.renderItem({title:this._overflowMenu.title,active:o===r&&0!==n[o].items.length,tabbable:o===s,disabled:0===n[o].items.length,onfocus:()=>{this._tabFocusIndex=o,this.activeIndex=o}}),o++}else if(null!==this._overflowMenu){let e=this._overflowMenu.items,t=this.node.offsetWidth,r=this._overflowMenu.items.length;for(let l=0;lthis._menuItemSizes[r]){let t=e[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(o,t,!1),d[o]=i.renderItem({title:t.title,active:!1,tabbable:o===s,disabled:0===n[o].items.length,onfocus:()=>{this._tabFocusIndex=o,this.activeIndex=o}}),o++}}0===this._overflowMenu.items.length&&(this.removeMenu(this._overflowMenu,!1),d.pop(),this._overflowMenu=null,this._overflowIndex=-1)}w.render(d,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;const e=this.contentNode.childNodes;let t=this.node.offsetWidth,n=0,i=-1,r=e.length;if(0==this._menuItemSizes.length)for(let s=0;st&&-1===i&&(i=s)}else for(let e=0;et){i=e;break}this._overflowIndex=i}_evtKeyDown(e){let t=e.keyCode;if(9===t)return void(this.activeIndex=-1);if(e.preventDefault(),e.stopPropagation(),13===t||32===t||38===t||40===t){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;return void this.openActiveMenu()}if(27===t)return this._closeChildMenu(),void this._focusItemAt(this.activeIndex);if(37===t||39===t){let e=37===t?-1:1,n=this._tabFocusIndex+e,i=this._menus.length;for(let t=0;td.hitTest(t,e.clientX,e.clientY)));if(-1!==t){if(0===e.button)if(this._childMenu)this._closeChildMenu(),this.activeIndex=t;else{e.preventDefault();const n=this._positionForMenu(t);de.saveWindowData(),this.activeIndex=t,this._openChildMenu(n)}}else this._closeChildMenu()}_evtMouseMove(e){let t=i.findFirstIndex(this.contentNode.children,(t=>d.hitTest(t,e.clientX,e.clientY)));if(t===this._activeIndex)return;if(-1===t&&this._childMenu)return;const n=t>=0&&this._childMenu?this._positionForMenu(t):null;de.saveWindowData(),this.activeIndex=t,n&&this._openChildMenu(n)}_positionForMenu(e){let t=this.contentNode.children[e],{left:n,bottom:i}=t.getBoundingClientRect();return{top:i,left:n}}_evtFocusOut(e){this._childMenu||this.node.contains(e.relatedTarget)||(this.activeIndex=-1)}_focusItemAt(e){const t=this.contentNode.childNodes[e];t&&t.focus()}_openChildMenu(e={}){let t=this.activeMenu;if(!t)return void this._closeChildMenu();let n=this._childMenu;if(n===t)return;this._childMenu=t,n?n.close():document.addEventListener("mousedown",this,!0),this._tabFocusIndex=this.activeIndex,g.sendMessage(this,z.Msg.UpdateRequest);let{left:i,top:r}=e;void 0!==i&&void 0!==r||({left:i,top:r}=this._positionForMenu(this._activeIndex)),n||this.addClass("lm-mod-active"),t.items.length>0&&t.open(i,r,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0);let e=this._childMenu;this._childMenu=null,e.close(),this.activeIndex=-1}_onMenuAboutToClose(e){e===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(e,t){if(e!==this._childMenu)return;let n=this._activeIndex,i=this._menus.length;switch(t){case"next":this.activeIndex=n===i-1?0:n+1;break;case"previous":this.activeIndex=0===n?i-1:n-1}this.openActiveMenu()}_onTitleChanged(){this.update()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),n=this.createItemDataset(e),i=this.createItemARIA(e);return k.li({className:t,dataset:n,...e.disabled?{}:{tabindex:e.tabbable?"0":"-1"},onfocus:e.onfocus,...i},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){let t=this.createIconClass(e);return k.div({className:t},e.title.icon,e.title.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return k.div({className:"lm-MenuBar-itemLabel"},t)}createItemClass(e){let t="lm-MenuBar-item";return e.title.className&&(t+=` ${e.title.className}`),e.active&&!e.disabled&&(t+=" lm-mod-active"),t}createItemDataset(e){return e.title.dataset}createItemARIA(e){return{role:"menuitem","aria-haspopup":"true","aria-disabled":e.disabled?"true":"false"}}createIconClass(e){let t="lm-MenuBar-itemIcon",n=e.title.iconClass;return n?`${t} ${n}`:t}formatLabel(e){let{label:t,mnemonic:n}=e.title;if(n<0||n>=t.length)return t;let i=t.slice(0,n),r=t.slice(n+1),s=t[n];return[i,k.span({className:"lm-MenuBar-itemMnemonic"},s),r]}}e.Renderer=t,e.defaultRenderer=new t}(Ee||(Ee={})),function(e){e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-MenuBar-content",e.appendChild(t),t.setAttribute("role","menubar"),e},e.findMnemonic=function(e,t,n){let i=-1,r=-1,s=!1,o=t.toUpperCase();for(let t=0,a=e.length;t=0&&u1&&this.widgets.forEach((e=>{e.hiddenMode=this._hiddenMode})))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(e,t){this._hiddenMode===z.HiddenMode.Scale&&this._items.length>0?(1===this._items.length&&(this.widgets[0].hiddenMode=z.HiddenMode.Scale),t.hiddenMode=z.HiddenMode.Scale):t.hiddenMode=z.HiddenMode.Display,i.insert(this._items,e,new W(t)),this.parent.isAttached&&g.sendMessage(t,z.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&g.sendMessage(t,z.Msg.AfterAttach),this.parent.fit()}moveWidget(e,t,n){i.move(this._items,e,t),this.parent.update()}detachWidget(e,t){let n=i.removeAt(this._items,e);this.parent.isAttached&&g.sendMessage(t,z.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&g.sendMessage(t,z.Msg.AfterDetach),n.widget.node.style.zIndex="",this._hiddenMode===z.HiddenMode.Scale&&(t.hiddenMode=z.HiddenMode.Display,1===this._items.length&&(this._items[0].widget.hiddenMode=z.HiddenMode.Display)),n.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0,t=0;for(let n=0,i=this._items.length;n{var i,r,s;s="object"==typeof self&&self.self===self&&self||"object"==typeof n.g&&n.g.global===n.g&&n.g,i=[n(2562),n(4651),t],r=function(e,t,n){s.Backbone=function(e,t,n,i){var r=e.Backbone,s=Array.prototype.slice;t.VERSION="1.4.0",t.$=i,t.noConflict=function(){return e.Backbone=r,this},t.emulateHTTP=!1,t.emulateJSON=!1;var o,a=t.Events={},l=/\s+/,d=function(e,t,i,r,s){var o,a=0;if(i&&"object"==typeof i){void 0!==r&&"context"in s&&void 0===s.context&&(s.context=r);for(o=n.keys(i);athis.length&&(r=this.length),r<0&&(r+=this.length+1);var s,o,a=[],l=[],d=[],u=[],c={},h=t.add,p=t.merge,g=t.remove,f=!1,m=this.comparator&&null==r&&!1!==t.sort,v=n.isString(this.comparator)?this.comparator:null;for(o=0;o7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(U,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var t=this.root.slice(0,-1)||"/";return this.location.replace(t+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var i=document.body,r=i.insertBefore(this.iframe,i.firstChild).contentWindow;r.document.open(),r.document.close(),r.location.hash="#"+this.fragment}var s=window.addEventListener||function(e,t){return attachEvent("on"+e,t)};if(this._usePushState?s("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?s("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var e=window.removeEventListener||function(e,t){return detachEvent("on"+e,t)};this._usePushState?e("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&e("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),F.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();if(t===this.fragment&&this.iframe&&(t=this.getHash(this.iframe.contentWindow)),t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()},loadUrl:function(e){return!!this.matchRoot()&&(e=this.fragment=this.getFragment(e),n.some(this.handlers,(function(t){if(t.route.test(e))return t.callback(e),!0})))},navigate:function(e,t){if(!F.started)return!1;t&&!0!==t||(t={trigger:!!t}),e=this.getFragment(e||"");var n=this.root;""!==e&&"?"!==e.charAt(0)||(n=n.slice(0,-1)||"/");var i=n+e;e=e.replace(W,"");var r=this.decodeFragment(e);if(this.fragment!==r){if(this.fragment=r,this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,i);else{if(!this._wantsHashChange)return this.location.assign(i);if(this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getHash(this.iframe.contentWindow)){var s=this.iframe.contentWindow;t.replace||(s.document.open(),s.document.close()),this._updateHash(s.location,e,t.replace)}}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,n){if(n){var i=e.href.replace(/(javascript:|#).*$/,"");e.replace(i+"#"+t)}else e.hash="#"+t}}),t.history=new F;v.extend=b.extend=I.extend=S.extend=F.extend=function(e,t){var i,r=this;return i=e&&n.has(e,"constructor")?e.constructor:function(){return r.apply(this,arguments)},n.extend(i,r,t),i.prototype=n.create(r.prototype,e),i.prototype.constructor=i,i.__super__=r.prototype,i};var H=function(){throw new Error('A "url" property or function must be specified')},V=function(e,t){var n=t.error;t.error=function(i){n&&n.call(t.context,e,i,t),e.trigger("error",e,i,t)}};return t}(s,n,e,t)}.apply(t,i),void 0===r||(e.exports=r)},7991:(e,t)=>{"use strict";t.bg=function(e){var t,n,s=function(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}(e),o=s[0],a=s[1],l=new r(function(e,t,n){return 3*(t+n)/4-n}(0,o,a)),d=0,u=a>0?o-4:o;for(n=0;n>16&255,l[d++]=t>>8&255,l[d++]=255&t;return 2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,l[d++]=255&t),1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,l[d++]=t>>8&255,l[d++]=255&t),l},t.iI=function(e){for(var t,i=e.length,r=i%3,s=[],o=16383,l=0,d=i-r;ld?d:l+o));return 1===r?(t=e[i-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function a(e,t,i){for(var r,s,o=[],a=t;a>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},1050:(e,t,n)=>{!function(e){"use strict";function t(t,n){clearTimeout(n.timeout),e.off(window,"mouseup",n.hurry),e.off(window,"keyup",n.hurry)}e.defineOption("autoRefresh",!1,(function(n,i){n.state.autoRefresh&&(t(0,n.state.autoRefresh),n.state.autoRefresh=null),i&&0==n.display.wrapper.offsetHeight&&function(n,i){function r(){n.display.wrapper.offsetHeight?(t(0,i),n.display.lastWrapHeight!=n.display.wrapper.clientHeight&&n.refresh()):i.timeout=setTimeout(r,i.delay)}i.timeout=setTimeout(r,i.delay),i.hurry=function(){clearTimeout(i.timeout),i.timeout=setTimeout(r,50)},e.on(window,"mouseup",i.hurry),e.on(window,"keyup",i.hurry)}(n,n.state.autoRefresh={delay:i.delay||250})}))}(n(1448))},7122:(e,t,n)=>{!function(e){"use strict";var t="CodeMirror-hint-active";function n(e,t){if(this.cm=e,this.options=t,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length,this.options.updateOnCursorActivity){var n=this;e.on("cursorActivity",this.activityFunc=function(){n.cursorActivity()})}}e.showHint=function(e,t,n){if(!t)return e.showHint(n);n&&n.async&&(t.async=!0);var i={hint:t};if(n)for(var r in n)i[r]=n[r];return e.showHint(i)},e.defineExtension("showHint",(function(t){t=function(e,t,n){var i=e.options.hintOptions,r={};for(var s in d)r[s]=d[s];if(i)for(var s in i)void 0!==i[s]&&(r[s]=i[s]);if(n)for(var s in n)void 0!==n[s]&&(r[s]=n[s]);return r.hint.resolve&&(r.hint=r.hint.resolve(e,t)),r}(this,this.getCursor("start"),t);var i=this.listSelections();if(!(i.length>1)){if(this.somethingSelected()){if(!t.hint.supportsSelection)return;for(var r=0;ru.clientHeight+1;if(setTimeout((function(){k=a.getScrollInfo()})),B.bottom-T>0){var j=B.bottom-B.top;if(b.top-(b.bottom-B.top)-j>0)u.style.top=(y=b.top-j-C)+"px",_=!1;else if(j>T){u.style.height=T-5+"px",u.style.top=(y=b.bottom-B.top-C)+"px";var O=a.getCursor();i.from.ch!=O.ch&&(b=a.cursorCoords(O),u.style.left=(A=b.left-w)+"px",B=u.getBoundingClientRect())}}var I,P=B.right-S;if(M&&(P+=a.display.nativeBarWidth),P>0&&(B.right-B.left>S&&(u.style.width=S-5+"px",P-=B.right-B.left-S),u.style.left=(A=b.left-P-w)+"px"),M)for(var R=u.firstChild;R;R=R.nextSibling)R.style.paddingRight=a.display.nativeBarWidth+"px";a.addKeyMap(this.keyMap=function(e,t){var n={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(1-t.menuSize(),!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close};/Mac/.test(navigator.platform)&&(n["Ctrl-P"]=function(){t.moveFocus(-1)},n["Ctrl-N"]=function(){t.moveFocus(1)});var i=e.options.customKeys,r=i?{}:n;function s(e,i){var s;s="string"!=typeof i?function(e){return i(e,t)}:n.hasOwnProperty(i)?n[i]:i,r[e]=s}if(i)for(var o in i)i.hasOwnProperty(o)&&s(o,i[o]);var a=e.options.extraKeys;if(a)for(var o in a)a.hasOwnProperty(o)&&s(o,a[o]);return r}(n,{moveFocus:function(e,t){r.changeActive(r.selectedHint+e,t)},setFocus:function(e){r.changeActive(e)},menuSize:function(){return r.screenAmount()},length:h.length,close:function(){n.close()},pick:function(){r.pick()},data:i})),n.options.closeOnUnfocus&&(a.on("blur",this.onBlur=function(){I=setTimeout((function(){n.close()}),100)}),a.on("focus",this.onFocus=function(){clearTimeout(I)})),a.on("scroll",this.onScroll=function(){var e=a.getScrollInfo(),t=a.getWrapperElement().getBoundingClientRect();k||(k=a.getScrollInfo());var i=y+k.top-e.top,r=i-(d.pageYOffset||(l.documentElement||l.body).scrollTop);if(_||(r+=u.offsetHeight),r<=t.top||r>=t.bottom)return n.close();u.style.top=i+"px",u.style.left=A+k.left-e.left+"px"}),e.on(u,"dblclick",(function(e){var t=o(u,e.target||e.srcElement);t&&null!=t.hintId&&(r.changeActive(t.hintId),r.pick())})),e.on(u,"click",(function(e){var t=o(u,e.target||e.srcElement);t&&null!=t.hintId&&(r.changeActive(t.hintId),n.options.completeOnSingleClick&&r.pick())})),e.on(u,"mousedown",(function(){setTimeout((function(){a.focus()}),20)}));var L=this.getSelectedHintRange();return 0===L.from&&0===L.to||this.scrollToActive(),e.signal(i,"select",h[this.selectedHint],u.childNodes[this.selectedHint]),!0}function l(e,t,n,i){if(e.async)e(t,i,n);else{var r=e(t,n);r&&r.then?r.then(i):i(r)}}n.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.options.updateOnCursorActivity&&this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&e.signal(this.data,"close"),this.widget&&this.widget.close(),e.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(t,n){var i=t.list[n],r=this;this.cm.operation((function(){i.hint?i.hint(r.cm,t,i):r.cm.replaceRange(s(i),i.from||t.from,i.to||t.to,"complete"),e.signal(t,"pick",i),r.cm.scrollIntoView()})),this.options.closeOnPick&&this.close()},cursorActivity:function(){this.debounce&&(r(this.debounce),this.debounce=0);var e=this.startPos;this.data&&(e=this.data.from);var t=this.cm.getCursor(),n=this.cm.getLine(t.line);if(t.line!=this.startPos.line||n.length-t.ch!=this.startLen-this.startPos.ch||t.ch=this.data.list.length?n=i?this.data.list.length-1:0:n<0&&(n=i?0:this.data.list.length-1),this.selectedHint!=n){var r=this.hints.childNodes[this.selectedHint];r&&(r.className=r.className.replace(" "+t,"")),(r=this.hints.childNodes[this.selectedHint=n]).className+=" "+t,this.scrollToActive(),e.signal(this.data,"select",this.data.list[this.selectedHint],r)}},scrollToActive:function(){var e=this.getSelectedHintRange(),t=this.hints.childNodes[e.from],n=this.hints.childNodes[e.to],i=this.hints.firstChild;t.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=n.offsetTop+n.offsetHeight-this.hints.clientHeight+i.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var e=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-e),to:Math.min(this.data.list.length-1,this.selectedHint+e)}}},e.registerHelper("hint","auto",{resolve:function(t,n){var i,r=t.getHelpers(n,"hint");if(r.length){var s=function(e,t,n){var i=function(e,t){if(!e.somethingSelected())return t;for(var n=[],i=0;i0?t(e):r(s+1)}))}(0)};return s.async=!0,s.supportsSelection=!0,s}return(i=t.getHelper(t.getCursor(),"hintWords"))?function(t){return e.hint.fromList(t,{words:i})}:e.hint.anyword?function(t,n){return e.hint.anyword(t,n)}:function(){}}}),e.registerHelper("hint","fromList",(function(t,n){var i,r=t.getCursor(),s=t.getTokenAt(r),o=e.Pos(r.line,s.start),a=r;s.start,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};e.defineOption("hintOptions",null)}(n(1448))},1448:function(e){e.exports=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),i=/MSIE \d/.test(e),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),s=/Edge\/(\d+)/.exec(e),o=i||r||s,a=o&&(i?document.documentMode||6:+(s||r)[1]),l=!s&&/WebKit\//.test(e),d=l&&/Qt\/\d+\.\d+/.test(e),u=!s&&/Chrome\//.test(e),c=/Opera\//.test(e),h=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),g=/PhantomJS/.test(e),f=h&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),m=/Android/.test(e),v=f||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),b=f||/Mac/.test(t),A=/\bCrOS\b/.test(e),y=/win/i.test(t),_=c&&e.match(/Version\/(\d*\.\d*)/);_&&(_=Number(_[1])),_&&_>=15&&(c=!1,l=!0);var w=b&&(d||c&&(null==_||_<12.11)),C=n||o&&a>=9;function E(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var x,D=function(e,t){var n=e.className,i=E(t).exec(n);if(i){var r=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(r?i[1]+r:"")}};function S(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function T(e,t){return S(e).appendChild(t)}function k(e,t,n,i){var r=document.createElement(e);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof t)r.appendChild(document.createTextNode(t));else if(t)for(var s=0;s=t)return o+(t-s);o+=a-s,o+=n-o%n,s=a+1}}f?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:o&&(P=function(e){try{e.select()}catch(e){}});var F=function(){this.id=null,this.f=null,this.time=0,this.handler=R(this.onTimeout,this)};function z(e,t){for(var n=0;n=t)return i+Math.min(o,t-r);if(r+=s-i,i=s+1,(r+=n-r%n)>=t)return i}}var G=[""];function K(e){for(;G.length<=e;)G.push(Y(G)+" ");return G[e]}function Y(e){return e[e.length-1]}function J(e,t){for(var n=[],i=0;i"€"&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ie=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function re(e){return e.charCodeAt(0)>=768&&ie.test(e)}function se(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var r=(t+n)/2,s=i<0?Math.ceil(r):Math.floor(r);if(s==t)return e(s)?t:n;e(s)?n=s:t=s+i}}var ae=null;function le(e,t,n){var i;ae=null;for(var r=0;rt)return r;s.to==t&&(s.from!=s.to&&"before"==n?i=r:ae=r),s.from==t&&(s.from!=s.to&&"before"!=n?i=r:ae=r)}return null!=i?i:ae}var de=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,n=/[LRr]/,i=/[Lb1n]/,r=/[1n]/;function s(e,t,n){this.level=e,this.from=t,this.to=n}return function(o,a){var l,d="ltr"==a?"L":"R";if(0==o.length||"ltr"==a&&!e.test(o))return!1;for(var u=o.length,c=[],h=0;h-1&&(i[t]=r.slice(0,s).concat(r.slice(s+1)))}}}function fe(e,t){var n=pe(e,t);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r0}function Ae(e){e.prototype.on=function(e,t){he(this,e,t)},e.prototype.off=function(e,t){ge(this,e,t)}}function ye(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function _e(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function we(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ce(e){ye(e),_e(e)}function Ee(e){return e.target||e.srcElement}function xe(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),b&&e.ctrlKey&&1==t&&(t=3),t}var De,Se,Te=function(){if(o&&a<9)return!1;var e=k("div");return"draggable"in e||"dragDrop"in e}();function ke(e){if(null==De){var t=k("span","​");T(e,k("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(De=t.offsetWidth<=1&&t.offsetHeight>2&&!(o&&a<8))}var n=De?k("span","​"):k("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Be(e){if(null!=Se)return Se;var t=T(e,document.createTextNode("AخA")),n=x(t,0,1).getBoundingClientRect(),i=x(t,1,2).getBoundingClientRect();return S(e),!(!n||n.left==n.right)&&(Se=i.right-n.right<3)}var Me,je=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],i=e.length;t<=i;){var r=e.indexOf("\n",t);-1==r&&(r=e.length);var s=e.slice(t,"\r"==e.charAt(r-1)?r-1:r),o=s.indexOf("\r");-1!=o?(n.push(s.slice(0,o)),t+=o+1):(n.push(s),t=r+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Oe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Ie="oncopy"in(Me=k("div"))||(Me.setAttribute("oncopy","return;"),"function"==typeof Me.oncopy),Pe=null;var Re={},Le={};function Ne(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Re[e]=t}function Fe(e){if("string"==typeof e&&Le.hasOwnProperty(e))e=Le[e];else if(e&&"string"==typeof e.name&&Le.hasOwnProperty(e.name)){var t=Le[e.name];"string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Fe("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Fe("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function ze(e,t){t=Fe(t);var n=Re[t.name];if(!n)return ze(e,"text/plain");var i=n(e,t);if(Ue.hasOwnProperty(t.name)){var r=Ue[t.name];for(var s in r)r.hasOwnProperty(s)&&(i.hasOwnProperty(s)&&(i["_"+s]=i[s]),i[s]=r[s])}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var o in t.modeProps)i[o]=t.modeProps[o];return i}var Ue={};function We(e,t){L(t,Ue.hasOwnProperty(e)?Ue[e]:Ue[e]={})}function He(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var r=t[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function Ve(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function $e(e,t,n){return!e.startState||e.startState(t,n)}var qe=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Ge(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var i=0;;++i){var r=n.children[i],s=r.chunkSize();if(t=e.first&&tn?tt(n,Ge(e,n).text.length):function(e,t){var n=e.ch;return null==n||n>t?tt(e.line,t):n<0?tt(e.line,0):e}(t,Ge(e,t.line).text.length)}function dt(e,t){for(var n=[],i=0;i=this.string.length},qe.prototype.sol=function(){return this.pos==this.lineStart},qe.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},qe.prototype.next=function(){if(this.post},qe.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},qe.prototype.skipToEnd=function(){this.pos=this.string.length},qe.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},qe.prototype.backUp=function(e){this.pos-=e},qe.prototype.column=function(){return this.lastColumnPos0?null:(i&&!1!==t&&(this.pos+=i[0].length),i)}var r=function(e){return n?e.toLowerCase():e};if(r(this.string.substr(this.pos,e.length))==r(e))return!1!==t&&(this.pos+=e.length),!0},qe.prototype.current=function(){return this.string.slice(this.start,this.pos)},qe.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},qe.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},qe.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ut=function(e,t){this.state=e,this.lookAhead=t},ct=function(e,t,n,i){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};function ht(e,t,n,i){var r=[e.state.modeGen],s={};_t(e,t.text,e.doc.mode,n,(function(e,t){return r.push(e,t)}),s,i);for(var o=n.state,a=function(i){n.baseTokens=r;var a=e.state.overlays[i],l=1,d=0;n.state=!0,_t(e,t.text,a.mode,n,(function(e,t){for(var n=l;de&&r.splice(l,1,e,r[l+1],i),l+=2,d=Math.min(e,i)}if(t)if(a.opaque)r.splice(n,l-n,e,"overlay "+t),l=n+2;else for(;ne.options.maxHighlightLength&&He(e.doc.mode,i.state),s=ht(e,t,i);r&&(i.state=r),t.stateAfter=i.save(!r),t.styles=s.styles,s.classes?t.styleClasses=s.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function gt(e,t,n){var i=e.doc,r=e.display;if(!i.mode.startState)return new ct(i,!0,t);var s=function(e,t,n){for(var i,r,s=e.doc,o=n?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>o;--a){if(a<=s.first)return s.first;var l=Ge(s,a-1),d=l.stateAfter;if(d&&(!n||a+(d instanceof ut?d.lookAhead:0)<=s.modeFrontier))return a;var u=N(l.text,null,e.options.tabSize);(null==r||i>u)&&(r=a-1,i=u)}return r}(e,t,n),o=s>i.first&&Ge(i,s-1).stateAfter,a=o?ct.fromSaved(i,o,s):new ct(i,$e(i.mode),s);return i.iter(s,t,(function(n){ft(e,n.text,a);var i=a.line;n.stateAfter=i==t-1||i%5==0||i>=r.viewFrom&&it.start)return s}throw new Error("Mode "+e.name+" failed to advance stream.")}ct.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ct.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ct.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ct.fromSaved=function(e,t,n){return t instanceof ut?new ct(e,He(e.mode,t.state),n,t.lookAhead):new ct(e,He(e.mode,t),n)},ct.prototype.save=function(e){var t=!1!==e?He(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ut(t,this.maxLookAhead):t};var bt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function At(e,t,n,i){var r,s,o=e.doc,a=o.mode,l=Ge(o,(t=lt(o,t)).line),d=gt(e,t.line,n),u=new qe(l.text,e.options.tabSize,d);for(i&&(s=[]);(i||u.pose.options.maxHighlightLength?(a=!1,o&&ft(e,t,i,c.pos),c.pos=t.length,l=null):l=yt(vt(n,c,i.state,h),s),h){var p=h[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!a||u!=l){for(;d=t:s.to>t);(i||(i=[])).push(new Et(o,s.from,a?null:s.to))}}return i}(n,r,o),l=function(e,t,n){var i;if(e)for(var r=0;r=t:s.to>t)||s.from==t&&"bookmark"==o.type&&(!n||s.marker.insertLeft)){var a=null==s.from||(o.inclusiveLeft?s.from<=t:s.from0&&a)for(var A=0;At)&&(!n||Ot(n,s.marker)<0)&&(n=s.marker)}return n}function Nt(e,t,n,i,r){var s=Ge(e,t),o=Ct&&s.markedSpans;if(o)for(var a=0;a=0&&c<=0||u<=0&&c>=0)&&(u<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?nt(d.to,n)>=0:nt(d.to,n)>0)||u>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?nt(d.from,i)<=0:nt(d.from,i)<0)))return!0}}}function Ft(e){for(var t;t=Pt(e);)e=t.find(-1,!0).line;return e}function zt(e,t){var n=Ge(e,t),i=Ft(n);return n==i?t:Xe(i)}function Ut(e,t){if(t>e.lastLine())return t;var n,i=Ge(e,t);if(!Wt(e,i))return t;for(;n=Rt(i);)i=n.find(1,!0).line;return Xe(i)+1}function Wt(e,t){var n=Ct&&t.markedSpans;if(n)for(var i=void 0,r=0;rt.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var Gt=function(e,t,n){this.text=e,Bt(this,t),this.height=n?n(this):1};function Kt(e){e.parent=null,kt(e)}Gt.prototype.lineNo=function(){return Xe(this)},Ae(Gt);var Yt={},Jt={};function Xt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Jt:Yt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var n=B("span",null,null,l?"padding-right: .1px":null),i={pre:B("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var s=r?t.rest[r-1]:t.line,o=void 0;i.pos=0,i.addToken=en,Be(e.display.measure)&&(o=ue(s,e.doc.direction))&&(i.addToken=tn(i.addToken,o)),i.map=[],rn(s,i,pt(e,s,t!=e.display.externalMeasured&&Xe(s))),s.styleClasses&&(s.styleClasses.bgClass&&(i.bgClass=I(s.styleClasses.bgClass,i.bgClass||"")),s.styleClasses.textClass&&(i.textClass=I(s.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(ke(e.display.measure))),0==r?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(l){var a=i.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return fe(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=I(i.pre.className,i.textClass||"")),i}function Qt(e){var t=k("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function en(e,t,n,i,r,s,l){if(t){var d,u=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,i="",r=0;rd&&c.from<=d);h++);if(c.to>=u)return e(n,i,r,s,o,a,l);e(n,i.slice(0,c.to-d),r,s,null,a,l),s=null,i=i.slice(c.to-d),d=c.to}}}function nn(e,t,n,i){var r=!i&&n.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!i&&e.cm.display.input.needsContentAttribute&&(r||(r=e.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t,e.trailingSpace=!1}function rn(e,t,n){var i=e.markedSpans,r=e.text,s=0;if(i)for(var o,a,l,d,u,c,h,p=r.length,g=0,f=1,m="",v=0;;){if(v==g){l=d=u=a="",h=null,c=null,v=1/0;for(var b=[],A=void 0,y=0;yg||w.collapsed&&_.to==g&&_.from==g)){if(null!=_.to&&_.to!=g&&v>_.to&&(v=_.to,d=""),w.className&&(l+=" "+w.className),w.css&&(a=(a?a+";":"")+w.css),w.startStyle&&_.from==g&&(u+=" "+w.startStyle),w.endStyle&&_.to==v&&(A||(A=[])).push(w.endStyle,_.to),w.title&&((h||(h={})).title=w.title),w.attributes)for(var C in w.attributes)(h||(h={}))[C]=w.attributes[C];w.collapsed&&(!c||Ot(c.marker,w)<0)&&(c=_)}else _.from>g&&v>_.from&&(v=_.from)}if(A)for(var E=0;E=p)break;for(var D=Math.min(p,v);;){if(m){var S=g+m.length;if(!c){var T=S>D?m.slice(0,D-g):m;t.addToken(t,T,o?o+l:l,u,g+T.length==v?d:"",a,h)}if(S>=D){m=m.slice(D-g),g=D;break}g=S,u=""}m=r.slice(s,s=n[f++]),o=Xt(n[f++],t.cm.options)}}else for(var k=1;kn)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Mn(e,t,n,i){return In(e,On(e,t),n,i)}function jn(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&t2&&s.push((l.bottom+d.top)/2-n.top)}}s.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(s=function(e,t,n,i){var r,s=Ln(t.map,n,i),l=s.node,d=s.start,u=s.end,c=s.collapse;if(3==l.nodeType){for(var h=0;h<4;h++){for(;d&&re(t.line.text.charAt(s.coverStart+d));)--d;for(;s.coverStart+u1}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*i,bottom:t.bottom*i}}(e.display.measure,r))}else{var p;d>0&&(c=i="right"),r=e.options.lineWrapping&&(p=l.getClientRects()).length>1?p["right"==i?p.length-1:0]:l.getBoundingClientRect()}if(o&&a<9&&!d&&(!r||!r.left&&!r.right)){var g=l.parentNode.getClientRects()[0];r=g?{left:g.left,right:g.left+si(e.display),top:g.top,bottom:g.bottom}:Rn}for(var f=r.top-t.rect.top,m=r.bottom-t.rect.top,v=(f+m)/2,b=t.view.measure.heights,A=0;At)&&(r=(s=l-a)-1,t>=l&&(o="right")),null!=r){if(i=e[d+2],a==l&&n==(i.insertLeft?"left":"right")&&(o=n),"left"==n&&0==r)for(;d&&e[d-2]==e[d-3]&&e[d-1].insertLeft;)i=e[2+(d-=3)],o="left";if("right"==n&&r==l-a)for(;d=0&&(n=e[r]).left==n.right;r--);return n}function Fn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=i.text.length?(l=i.text.length,d="before"):l<=0&&(l=0,d="after"),!a)return o("before"==d?l-1:l,"before"==d);function u(e,t,n){return o(n?e-1:e,1==a[t].level!=n)}var c=le(a,l,d),h=ae,p=u(l,c,"before"==d);return null!=h&&(p.other=u(l,h,"before"!=d)),p}function Yn(e,t){var n=0;t=lt(e.doc,t),e.options.lineWrapping||(n=si(e.display)*t.ch);var i=Ge(e.doc,t.line),r=Vt(i)+En(e.display);return{left:n,right:n,top:r,bottom:r+i.height}}function Jn(e,t,n,i,r){var s=tt(e,t,n);return s.xRel=r,i&&(s.outside=i),s}function Xn(e,t,n){var i=e.doc;if((n+=e.display.viewOffset)<0)return Jn(i.first,0,null,-1,-1);var r=Ze(i,n),s=i.first+i.size-1;if(r>s)return Jn(i.first+i.size-1,Ge(i,s).text.length,null,1,1);t<0&&(t=0);for(var o=Ge(i,r);;){var a=ti(e,o,r,t,n),l=Lt(o,a.ch+(a.xRel>0||a.outside>0?1:0));if(!l)return a;var d=l.find(1);if(d.line==r)return d;o=Ge(i,r=d.line)}}function Zn(e,t,n,i){i-=Vn(t);var r=t.text.length,s=oe((function(t){return In(e,n,t-1).bottom<=i}),r,0);return{begin:s,end:r=oe((function(t){return In(e,n,t).top>i}),s,r)}}function Qn(e,t,n,i){return n||(n=On(e,t)),Zn(e,t,n,$n(e,t,In(e,n,i),"line").top)}function ei(e,t,n,i){return!(e.bottom<=n)&&(e.top>n||(i?e.left:e.right)>t)}function ti(e,t,n,i,r){r-=Vt(t);var s=On(e,t),o=Vn(t),a=0,l=t.text.length,d=!0,u=ue(t,e.doc.direction);if(u){var c=(e.options.lineWrapping?ii:ni)(e,t,n,s,u,i,r);a=(d=1!=c.level)?c.from:c.to-1,l=d?c.to:c.from-1}var h,p,g=null,f=null,m=oe((function(t){var n=In(e,s,t);return n.top+=o,n.bottom+=o,!!ei(n,i,r,!1)&&(n.top<=r&&n.left<=i&&(g=t,f=n),!0)}),a,l),v=!1;if(f){var b=i-f.left=y.bottom?1:0}return Jn(n,m=se(t.text,m,1),p,v,i-h)}function ni(e,t,n,i,r,s,o){var a=oe((function(a){var l=r[a],d=1!=l.level;return ei(Kn(e,tt(n,d?l.to:l.from,d?"before":"after"),"line",t,i),s,o,!0)}),0,r.length-1),l=r[a];if(a>0){var d=1!=l.level,u=Kn(e,tt(n,d?l.from:l.to,d?"after":"before"),"line",t,i);ei(u,s,o,!0)&&u.top>o&&(l=r[a-1])}return l}function ii(e,t,n,i,r,s,o){var a=Zn(e,t,i,o),l=a.begin,d=a.end;/\s/.test(t.text.charAt(d-1))&&d--;for(var u=null,c=null,h=0;h=d||p.to<=l)){var g=In(e,i,1!=p.level?Math.min(d,p.to)-1:Math.max(l,p.from)).right,f=gf)&&(u=p,c=f)}}return u||(u=r[r.length-1]),u.fromd&&(u={from:u.from,to:d,level:u.level}),u}function ri(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Pn){Pn=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pn.appendChild(document.createTextNode("x")),Pn.appendChild(k("br"));Pn.appendChild(document.createTextNode("x"))}T(e.measure,Pn);var n=Pn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),S(e.measure),n||1}function si(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx"),n=k("pre",[t],"CodeMirror-line-like");T(e.measure,n);var i=t.getBoundingClientRect(),r=(i.right-i.left)/10;return r>2&&(e.cachedCharWidth=r),r||10}function oi(e){for(var t=e.display,n={},i={},r=t.gutters.clientLeft,s=t.gutters.firstChild,o=0;s;s=s.nextSibling,++o){var a=e.display.gutterSpecs[o].className;n[a]=s.offsetLeft+s.clientLeft+r,i[a]=s.clientWidth}return{fixedPos:ai(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ai(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function li(e){var t=ri(e.display),n=e.options.lineWrapping,i=n&&Math.max(5,e.display.scroller.clientWidth/si(e.display)-3);return function(r){if(Wt(e.doc,r))return 0;var s=0;if(r.widgets)for(var o=0;o0&&(l=Ge(e.doc,d.line).text).length==d.ch){var u=N(l,l.length,e.options.tabSize)-l.length;d=tt(d.line,Math.max(0,Math.round((s-Dn(e.display).left)/si(e.display))-u))}return d}function ci(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,i=0;it)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)Ct&&zt(e.doc,t)r.viewFrom?gi(e):(r.viewFrom+=i,r.viewTo+=i);else if(t<=r.viewFrom&&n>=r.viewTo)gi(e);else if(t<=r.viewFrom){var s=fi(e,n,n+i,1);s?(r.view=r.view.slice(s.index),r.viewFrom=s.lineN,r.viewTo+=i):gi(e)}else if(n>=r.viewTo){var o=fi(e,t,t,-1);o?(r.view=r.view.slice(0,o.index),r.viewTo=o.lineN):gi(e)}else{var a=fi(e,t,t,-1),l=fi(e,n,n+i,1);a&&l?(r.view=r.view.slice(0,a.index).concat(on(e,a.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=i):gi(e)}var d=r.externalMeasured;d&&(n=r.lineN&&t=i.viewTo)){var s=i.view[ci(e,t)];if(null!=s.node){var o=s.changes||(s.changes=[]);-1==z(o,n)&&o.push(n)}}}function gi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function fi(e,t,n,i){var r,s=ci(e,t),o=e.display.view;if(!Ct||n==e.doc.first+e.doc.size)return{index:s,lineN:n};for(var a=e.display.viewFrom,l=0;l0){if(s==o.length-1)return null;r=a+o[s].size-t,s++}else r=a-t;t+=r,n+=r}for(;zt(e.doc,n)!=n;){if(s==(i<0?0:o.length-1))return null;n+=i*o[s-(i<0?1:0)].size,s+=i}return{index:s,lineN:n}}function mi(e){for(var t=e.display.view,n=0,i=0;i=e.display.viewTo||a.to().linet||t==n&&o.to==t)&&(i(Math.max(o.from,t),Math.min(o.to,n),1==o.level?"rtl":"ltr",s),r=!0)}r||i(t,n,"ltr")}(f,n||0,null==i?h:i,(function(e,t,r,c){var m="ltr"==r,v=p(e,m?"left":"right"),b=p(t-1,m?"right":"left"),A=null==n&&0==e,y=null==i&&t==h,_=0==c,w=!f||c==f.length-1;if(b.top-v.top<=3){var C=(d?y:A)&&w,E=(d?A:y)&&_?a:(m?v:b).left,x=C?l:(m?b:v).right;u(E,v.top,x-E,v.bottom)}else{var D,S,T,k;m?(D=d&&A&&_?a:v.left,S=d?l:g(e,r,"before"),T=d?a:g(t,r,"after"),k=d&&y&&w?l:b.right):(D=d?g(e,r,"before"):a,S=!d&&A&&_?l:v.right,T=!d&&y&&w?a:b.left,k=d?g(t,r,"after"):l),u(D,v.top,S-D,v.bottom),v.bottom0?t.blinker=setInterval((function(){e.hasFocus()||Di(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ci(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||xi(e))}function Ei(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Di(e))}),100)}function xi(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(fe(e,"focus",e,t),e.state.focused=!0,O(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),l&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),wi(e))}function Di(e,t){e.state.delayingBlurEvent||(e.state.focused&&(fe(e,"blur",e,t),e.state.focused=!1,D(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Si(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=0;i.005||h<-.005)&&(Je(r.line,l),Ti(r.line),r.rest))for(var p=0;pe.display.sizerWidth){var g=Math.ceil(d/si(e.display));g>e.display.maxLineLength&&(e.display.maxLineLength=g,e.display.maxLine=r.line,e.display.maxLineChanged=!0)}}}}function Ti(e){if(e.widgets)for(var t=0;t=o&&(s=Ze(t,Vt(Ge(t,l))-e.wrapper.clientHeight),o=l)}return{from:s,to:Math.max(o,s+1)}}function Bi(e,t){var n=e.display,i=ri(e.display);t.top<0&&(t.top=0);var r=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,s=kn(e),o={};t.bottom-t.top>s&&(t.bottom=t.top+s);var a=e.doc.height+xn(n),l=t.topa-i;if(t.topr+s){var u=Math.min(t.top,(d?a:t.bottom)-s);u!=r&&(o.scrollTop=u)}var c=e.options.fixedGutter?0:n.gutters.offsetWidth,h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-c,p=Tn(e)-n.gutters.offsetWidth,g=t.right-t.left>p;return g&&(t.right=t.left+p),t.left<10?o.scrollLeft=0:t.leftp+h-3&&(o.scrollLeft=t.right+(g?0:10)-p),o}function Mi(e,t){null!=t&&(Ii(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function ji(e){Ii(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Oi(e,t,n){null==t&&null==n||Ii(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Ii(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Pi(e,Yn(e,t.from),Yn(e,t.to),t.margin))}function Pi(e,t,n,i){var r=Bi(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});Oi(e,r.scrollLeft,r.scrollTop)}function Ri(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||dr(e,{top:t}),Li(e,t,!0),n&&dr(e),rr(e,100))}function Li(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ni(e,t,n,i){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i||(e.doc.scrollLeft=t,hr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Fi(e){var t=e.display,n=t.gutters.offsetWidth,i=Math.round(e.doc.height+xn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+Sn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var zi=function(e,t,n){this.cm=n;var i=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1,e(i),e(r),he(i,"scroll",(function(){i.clientHeight&&t(i.scrollTop,"vertical")})),he(r,"scroll",(function(){r.clientWidth&&t(r.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,o&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};zi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var r=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var s=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+s)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:t?i:0}},zi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},zi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},zi.prototype.zeroWidthHack=function(){var e=b&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new F,this.disableVert=new F},zi.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,(function i(){var r=e.getBoundingClientRect();("vert"==n?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,i)}))},zi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ui=function(){};function Wi(e,t){t||(t=Fi(e));var n=e.display.barWidth,i=e.display.barHeight;Hi(e,t);for(var r=0;r<4&&n!=e.display.barWidth||i!=e.display.barHeight;r++)n!=e.display.barWidth&&e.options.lineWrapping&&Si(e),Hi(e,Fi(e)),n=e.display.barWidth,i=e.display.barHeight}function Hi(e,t){var n=e.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Ui.prototype.update=function(){return{bottom:0,right:0}},Ui.prototype.setScrollLeft=function(){},Ui.prototype.setScrollTop=function(){},Ui.prototype.clear=function(){};var Vi={native:zi,null:Ui};function $i(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&D(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Vi[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),he(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?Ni(e,t):Ri(e,t)}),e),e.display.scrollbars.addClass&&O(e.display.wrapper,e.display.scrollbars.addClass)}var qi=0;function Gi(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++qi,markArrays:null},t=e.curOp,an?an.ops.push(t):t.ownsGroup=an={ops:[t],delayedCallbacks:[]}}function Ki(e){var t=e.curOp;t&&function(e,t){var n=e.ownsGroup;if(n)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new or(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ji(e){e.updatedDisplay=e.mustUpdate&&ar(e.cm,e.update)}function Xi(e){var t=e.cm,n=t.display;e.updatedDisplay&&Si(t),e.barMeasure=Fi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Mn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Sn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Tn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Zi(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),null!=r&&!g){var s=k("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-En(e.display))+"px;\n height: "+(t.bottom-t.top+Sn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(r),e.display.lineSpace.removeChild(s)}}}(t,function(e,t,n,i){var r;null==i&&(i=0),e.options.lineWrapping||t!=n||(n="before"==t.sticky?tt(t.line,t.ch+1,"before"):t,t=t.ch?tt(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var s=0;s<5;s++){var o=!1,a=Kn(e,t),l=n&&n!=t?Kn(e,n):a,d=Bi(e,r={left:Math.min(a.left,l.left),top:Math.min(a.top,l.top)-i,right:Math.max(a.left,l.left),bottom:Math.max(a.bottom,l.bottom)+i}),u=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=d.scrollTop&&(Ri(e,d.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(o=!0)),null!=d.scrollLeft&&(Ni(e,d.scrollLeft),Math.abs(e.doc.scrollLeft-c)>1&&(o=!0)),!o)break}return r}(t,lt(i,e.scrollToPos.from),lt(i,e.scrollToPos.to),e.scrollToPos.margin));var r=e.maybeHiddenMarkers,s=e.maybeUnhiddenMarkers;if(r)for(var o=0;o=e.display.viewTo)){var n=+new Date+e.options.workTime,i=gt(e,t.highlightFrontier),r=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(s){if(i.line>=e.display.viewFrom){var o=s.styles,a=s.text.length>e.options.maxHighlightLength?He(t.mode,i.state):null,l=ht(e,s,i,!0);a&&(i.state=a),s.styles=l.styles;var d=s.styleClasses,u=l.classes;u?s.styleClasses=u:d&&(s.styleClasses=null);for(var c=!o||o.length!=s.styles.length||d!=u&&(!d||!u||d.bgClass!=u.bgClass||d.textClass!=u.textClass),h=0;!c&&hn)return rr(e,e.options.workDelay),!0})),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),r.length&&er(e,(function(){for(var t=0;t=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==mi(e))return!1;pr(e)&&(gi(e),t.dims=oi(e));var r=i.first+i.size,s=Math.max(t.visible.from-e.options.viewportMargin,i.first),o=Math.min(r,t.visible.to+e.options.viewportMargin);n.viewFromo&&n.viewTo-o<20&&(o=Math.min(r,n.viewTo)),Ct&&(s=zt(e.doc,s),o=Ut(e.doc,o));var a=s!=n.viewFrom||o!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;(function(e,t,n){var i=e.display;0==i.view.length||t>=i.viewTo||n<=i.viewFrom?(i.view=on(e,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=on(e,t,i.viewFrom).concat(i.view):i.viewFromn&&(i.view=i.view.slice(0,ci(e,n)))),i.viewTo=n})(e,s,o),n.viewOffset=Vt(Ge(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var d=mi(e);if(!a&&0==d&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=function(e){if(e.hasFocus())return null;var t=j();if(!t||!M(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&M(e.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}(e);return d>4&&(n.lineDiv.style.display="none"),function(e,t,n){var i=e.display,r=e.options.lineNumbers,s=i.lineDiv,o=s.firstChild;function a(t){var n=t.nextSibling;return l&&b&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var d=i.view,u=i.viewFrom,c=0;c-1&&(p=!1),cn(e,h,u,n)),p&&(S(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(et(e.options,u)))),o=h.node.nextSibling}else{var g=bn(e,h,u,n);s.insertBefore(g,o)}u+=h.size}for(;o;)o=a(o)}(e,n.updateLineNumbers,t.dims),d>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=j()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&M(document.body,e.anchorNode)&&M(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(u),S(n.cursorDiv),S(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,rr(e,400)),n.updateLineNumbers=null,!0}function lr(e,t){for(var n=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Tn(e))i&&(t.visible=ki(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+xn(e.display)-kn(e),n.top)}),t.visible=ki(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!ar(e,t))break;Si(e);var r=Fi(e);vi(e),Wi(e,r),cr(e,r),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function dr(e,t){var n=new or(e,t);if(ar(e,n)){Si(e),lr(e,n);var i=Fi(e);vi(e),Wi(e,i),cr(e,i),n.finish()}}function ur(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",dn(e,"gutterChanged",e)}function cr(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Sn(e)+"px"}function hr(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var i=ai(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,s=i+"px",o=0;oa.clientWidth,u=a.scrollHeight>a.clientHeight;if(r&&d||s&&u){if(s&&b&&l)e:for(var h=t.target,p=o.view;h!=a;h=h.parentNode)for(var g=0;g=0&&nt(e,i.to())<=0)return n}return-1};var Er=function(e,t){this.anchor=e,this.head=t};function xr(e,t,n){var i=e&&e.options.selectionsMayTouch,r=t[n];t.sort((function(e,t){return nt(e.from(),t.from())})),n=z(t,r);for(var s=1;s0:l>=0){var d=ot(a.from(),o.from()),u=st(a.to(),o.to()),c=a.empty()?o.from()==o.head:a.from()==a.head;s<=n&&--n,t.splice(--s,2,new Er(c?u:d,c?d:u))}}return new Cr(t,n)}function Dr(e,t){return new Cr([new Er(e,t||e)],0)}function Sr(e){return e.text?tt(e.from.line+e.text.length-1,Y(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Tr(e,t){if(nt(e,t.from)<0)return e;if(nt(e,t.to)<=0)return Sr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Sr(t).ch-t.to.ch),tt(n,i)}function kr(e,t){for(var n=[],i=0;i1&&e.remove(a.line+1,g-1),e.insert(a.line+1,v)}dn(e,"change",e,t)}function Pr(e,t,n){!function e(i,r,s){if(i.linked)for(var o=0;oa-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(s=function(e,t){return t?(zr(e.done),Y(e.done)):e.done.length&&!Y(e.done).ranges?Y(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Y(e.done)):void 0}(r,r.lastOp==i)))o=Y(s.changes),0==nt(t.from,t.to)&&0==nt(t.from,o.to)?o.to=Sr(t):s.changes.push(Fr(e,t));else{var l=Y(r.done);for(l&&l.ranges||Hr(e.sel,r.done),s={changes:[Fr(e,t)],generation:r.generation},r.done.push(s);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=t.origin,o||fe(e,"historyAdded")}function Wr(e,t,n,i){var r=e.history,s=i&&i.origin;n==r.lastSelOp||s&&r.lastSelOrigin==s&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==s||function(e,t,n,i){var r=t.charAt(0);return"*"==r||"+"==r&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,s,Y(r.done),t))?r.done[r.done.length-1]=t:Hr(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=s,r.lastSelOp=n,i&&!1!==i.clearRedo&&zr(r.undone)}function Hr(e,t){var n=Y(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Vr(e,t,n,i){var r=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,i),(function(n){n.markedSpans&&((r||(r=t["spans_"+e.id]={}))[s]=n.markedSpans),++s}))}function $r(e){if(!e)return null;for(var t,n=0;n-1&&(Y(a)[c]=d[c],delete d[c])}}}return i}function Kr(e,t,n,i){if(i){var r=e.anchor;if(n){var s=nt(t,r)<0;s!=nt(n,r)<0?(r=t,t=n):s!=nt(t,n)<0&&(t=n)}return new Er(r,t)}return new Er(n||t,t)}function Yr(e,t,n,i,r){null==r&&(r=e.cm&&(e.cm.display.shift||e.extend)),es(e,new Cr([Kr(e.sel.primary(),t,n,r)],0),i)}function Jr(e,t,n){for(var i=[],r=e.cm&&(e.cm.display.shift||e.extend),s=0;s=t.ch:a.to>t.ch))){if(r&&(fe(l,"beforeCursorEnter"),l.explicitlyCleared)){if(s.markedSpans){--o;continue}break}if(!l.atomic)continue;if(n){var c=l.find(i<0?1:-1),h=void 0;if((i<0?u:d)&&(c=as(e,c,-i,c&&c.line==t.line?s:null)),c&&c.line==t.line&&(h=nt(c,n))&&(i<0?h<0:h>0))return ss(e,c,t,i,r)}var p=l.find(i<0?-1:1);return(i<0?d:u)&&(p=as(e,p,i,p.line==t.line?s:null)),p?ss(e,p,t,i,r):null}}return t}function os(e,t,n,i,r){var s=i||1;return ss(e,t,n,s,r)||!r&&ss(e,t,n,s,!0)||ss(e,t,n,-s,r)||!r&&ss(e,t,n,-s,!0)||(e.cantEdit=!0,tt(e.first,0))}function as(e,t,n,i){return n<0&&0==t.ch?t.line>e.first?lt(e,tt(t.line-1)):null:n>0&&t.ch==(i||Ge(e,t.line)).text.length?t.line0)){var u=[l,1],c=nt(d.from,a.from),h=nt(d.to,a.to);(c<0||!o.inclusiveLeft&&!c)&&u.push({from:d.from,to:a.from}),(h>0||!o.inclusiveRight&&!h)&&u.push({from:a.to,to:d.to}),r.splice.apply(r,u),l+=u.length-3}}return r}(e,t.from,t.to);if(i)for(var r=i.length-1;r>=0;--r)cs(e,{from:i[r].from,to:i[r].to,text:r?[""]:t.text,origin:t.origin});else cs(e,t)}}function cs(e,t){if(1!=t.text.length||""!=t.text[0]||0!=nt(t.from,t.to)){var n=kr(e,t);Ur(e,t,n,e.cm?e.cm.curOp.id:NaN),gs(e,t,n,St(e,t));var i=[];Pr(e,(function(e,n){n||-1!=z(i,e.history)||(bs(e.history,t),i.push(e.history)),gs(e,t,null,St(e,t))}))}}function hs(e,t,n){var i=e.cm&&e.cm.state.suppressEdits;if(!i||n){for(var r,s=e.history,o=e.sel,a="undo"==t?s.done:s.undone,l="undo"==t?s.undone:s.done,d=0;d=0;--p){var g=h(p);if(g)return g.v}}}}function ps(e,t){if(0!=t&&(e.first+=t,e.sel=new Cr(J(e.sel.ranges,(function(e){return new Er(tt(e.anchor.line+t,e.anchor.ch),tt(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){hi(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;ie.lastLine())){if(t.from.lines&&(t={from:t.from,to:tt(s,Ge(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ke(e,t.from,t.to),n||(n=kr(e,t)),e.cm?function(e,t,n){var i=e.doc,r=e.display,s=t.from,o=t.to,a=!1,l=s.line;e.options.lineWrapping||(l=Xe(Ft(Ge(i,s.line))),i.iter(l,o.line+1,(function(e){if(e==r.maxLine)return a=!0,!0}))),i.sel.contains(t.from,t.to)>-1&&ve(e),Ir(i,t,n,li(e)),e.options.lineWrapping||(i.iter(l,s.line+t.text.length,(function(e){var t=$t(e);t>r.maxLineLength&&(r.maxLine=e,r.maxLineLength=t,r.maxLineChanged=!0,a=!1)})),a&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;i--){var r=Ge(e,i).stateAfter;if(r&&(!(r instanceof ut)||i+r.lookAhead1||!(this.children[0]instanceof ys))){var a=[];this.collapse(a),this.children=[new ys(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var o=r.lines.length%25+25,a=o;a10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var i=0;i0||0==o&&!1!==s.clearWhenEmpty)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=B("span",[s.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(Nt(e,t.line,t,n,s)||t.line!=n.line&&Nt(e,n.line,t,n,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ct=!0}s.addToHistory&&Ur(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var a,l=t.line,d=e.cm;if(e.iter(l,n.line+1,(function(i){d&&s.collapsed&&!d.options.lineWrapping&&Ft(i)==d.display.maxLine&&(a=!0),s.collapsed&&l!=t.line&&Je(i,0),function(e,t,n){var i=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));i&&i.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],i&&i.add(e.markedSpans)),t.marker.attachLine(e)}(i,new Et(s,l==t.line?t.ch:null,l==n.line?n.ch:null),e.cm&&e.cm.curOp),++l})),s.collapsed&&e.iter(t.line,n.line+1,(function(t){Wt(e,t)&&Je(t,0)})),s.clearOnEnter&&he(s,"beforeCursorEnter",(function(){return s.clear()})),s.readOnly&&(wt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++Es,s.atomic=!0),d){if(a&&(d.curOp.updateMaxLine=!0),s.collapsed)hi(d,t.line,n.line+1);else if(s.className||s.startStyle||s.endStyle||s.css||s.attributes||s.title)for(var u=t.line;u<=n.line;u++)pi(d,u,"text");s.atomic&&is(d.doc),dn(d,"markerAdded",d,s)}return s}xs.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Gi(e),be(this,"clear")){var n=this.find();n&&dn(this,"clear",n.from,n.to)}for(var i=null,r=null,s=0;se.display.maxLineLength&&(e.display.maxLine=d,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=i&&e&&this.collapsed&&hi(e,i,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&is(e.doc)),e&&dn(e,"markerCleared",e,this,i,r),t&&Ki(e),this.parent&&this.parent.clear()}},xs.prototype.find=function(e,t){var n,i;null==e&&"bookmark"==this.type&&(e=1);for(var r=0;r=0;l--)us(this,i[l]);a?Qr(this,a):this.cm&&ji(this.cm)})),undo:ir((function(){hs(this,"undo")})),redo:ir((function(){hs(this,"redo")})),undoSelection:ir((function(){hs(this,"undo",!0)})),redoSelection:ir((function(){hs(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,i=0;i=e.ch)&&t.push(r.marker.parent||r.marker)}return t},findMarks:function(e,t,n){e=lt(this,e),t=lt(this,t);var i=[],r=e.line;return this.iter(e.line,t.line+1,(function(s){var o=s.markedSpans;if(o)for(var a=0;a=l.to||null==l.from&&r!=e.line||null!=l.from&&r==t.line&&l.from>=t.ch||n&&!n(l.marker)||i.push(l.marker.parent||l.marker)}++r})),i},getAllMarks:function(){var e=[];return this.iter((function(t){var n=t.markedSpans;if(n)for(var i=0;ie)return t=e,!0;e-=s,++n})),lt(this,tt(n,t))},indexFromPos:function(e){var t=(e=lt(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var c=e.dataTransfer.getData("Text");if(c){var h;if(t.state.draggingText&&!t.state.draggingText.copy&&(h=t.listSelections()),ts(t.doc,Dr(n,n)),h)for(var p=0;p=0;t--)fs(e.doc,"",i[t].from,i[t].to,"+delete");ji(e)}))}function Zs(e,t,n){var i=se(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Qs(e,t,n){var i=Zs(e,t.ch,n);return null==i?null:new tt(t.line,i,n<0?"after":"before")}function eo(e,t,n,i,r){if(e){"rtl"==t.doc.direction&&(r=-r);var s=ue(n,t.doc.direction);if(s){var o,a=r<0?Y(s):s[0],l=r<0==(1==a.level)?"after":"before";if(a.level>0||"rtl"==t.doc.direction){var d=On(t,n);o=r<0?n.text.length-1:0;var u=In(t,d,o).top;o=oe((function(e){return In(t,d,e).top==u}),r<0==(1==a.level)?a.from:a.to-1,o),"before"==l&&(o=Zs(n,o,1))}else o=r<0?a.to:a.from;return new tt(i,o,l)}}return new tt(i,r<0?n.text.length:0,r<0?"before":"after")}Hs.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Hs.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Hs.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Hs.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Hs.default=b?Hs.macDefault:Hs.pcDefault;var to={selectAll:ls,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),H)},killLine:function(e){return Xs(e,(function(t){if(t.empty()){var n=Ge(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)r=new tt(r.line,r.ch+1),e.replaceRange(s.charAt(r.ch-1)+s.charAt(r.ch-2),tt(r.line,r.ch-2),r,"+transpose");else if(r.line>e.doc.first){var o=Ge(e.doc,r.line-1).text;o&&(r=new tt(r.line,1),e.replaceRange(s.charAt(0)+e.doc.lineSeparator()+o.charAt(o.length-1),tt(r.line-1,o.length-1),r,"+transpose"))}n.push(new Er(r,r))}e.setSelections(n)}))},newlineAndIndent:function(e){return er(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var i=0;i-1&&(nt((r=d.ranges[r]).from(),t)<0||t.xRel>0)&&(nt(r.to(),t)>0||t.xRel<0)?function(e,t,n,i){var r=e.display,s=!1,d=tr(e,(function(t){l&&(r.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ei(e)),ge(r.wrapper.ownerDocument,"mouseup",d),ge(r.wrapper.ownerDocument,"mousemove",u),ge(r.scroller,"dragstart",c),ge(r.scroller,"drop",d),s||(ye(t),i.addNew||Yr(e.doc,n,null,null,i.extend),l&&!h||o&&9==a?setTimeout((function(){r.wrapper.ownerDocument.body.focus({preventScroll:!0}),r.input.focus()}),20):r.input.focus())})),u=function(e){s=s||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},c=function(){return s=!0};l&&(r.scroller.draggable=!0),e.state.draggingText=d,d.copy=!i.moveOnDrag,he(r.wrapper.ownerDocument,"mouseup",d),he(r.wrapper.ownerDocument,"mousemove",u),he(r.scroller,"dragstart",c),he(r.scroller,"drop",d),e.state.delayingBlurEvent=!0,setTimeout((function(){return r.input.focus()}),20),r.scroller.dragDrop&&r.scroller.dragDrop()}(e,i,t,s):function(e,t,n,i){o&&Ei(e);var r=e.display,s=e.doc;ye(t);var a,l,d=s.sel,u=d.ranges;if(i.addNew&&!i.extend?(l=s.sel.contains(n),a=l>-1?u[l]:new Er(n,n)):(a=s.sel.primary(),l=s.sel.primIndex),"rectangle"==i.unit)i.addNew||(a=new Er(n,n)),n=ui(e,t,!0,!0),l=-1;else{var c=bo(e,n,i.unit);a=i.extend?Kr(a,c.anchor,c.head,i.extend):c}i.addNew?-1==l?(l=u.length,es(s,xr(e,u.concat([a]),l),{scroll:!1,origin:"*mouse"})):u.length>1&&u[l].empty()&&"char"==i.unit&&!i.extend?(es(s,xr(e,u.slice(0,l).concat(u.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),d=s.sel):Xr(s,l,a,V):(l=0,es(s,new Cr([a],0),V),d=s.sel);var h=n;function p(t){if(0!=nt(h,t))if(h=t,"rectangle"==i.unit){for(var r=[],o=e.options.tabSize,u=N(Ge(s,n.line).text,n.ch,o),c=N(Ge(s,t.line).text,t.ch,o),p=Math.min(u,c),g=Math.max(u,c),f=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));f<=m;f++){var v=Ge(s,f).text,b=q(v,p,o);p==g?r.push(new Er(tt(f,b),tt(f,b))):v.length>b&&r.push(new Er(tt(f,b),tt(f,q(v,g,o))))}r.length||r.push(new Er(n,n)),es(s,xr(e,d.ranges.slice(0,l).concat(r),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var A,y=a,_=bo(e,t,i.unit),w=y.anchor;nt(_.anchor,w)>0?(A=_.head,w=ot(y.from(),_.anchor)):(A=_.anchor,w=st(y.to(),_.head));var C=d.ranges.slice(0);C[l]=function(e,t){var n=t.anchor,i=t.head,r=Ge(e.doc,n.line);if(0==nt(n,i)&&n.sticky==i.sticky)return t;var s=ue(r);if(!s)return t;var o=le(s,n.ch,n.sticky),a=s[o];if(a.from!=n.ch&&a.to!=n.ch)return t;var l,d=o+(a.from==n.ch==(1!=a.level)?0:1);if(0==d||d==s.length)return t;if(i.line!=n.line)l=(i.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var u=le(s,i.ch,i.sticky),c=u-o||(i.ch-n.ch)*(1==a.level?-1:1);l=u==d-1||u==d?c<0:c>0}var h=s[d+(l?-1:0)],p=l==(1==h.level),g=p?h.from:h.to,f=p?"after":"before";return n.ch==g&&n.sticky==f?t:new Er(new tt(n.line,g,f),i)}(e,new Er(lt(s,w),A)),es(s,xr(e,C,l),V)}}var g=r.wrapper.getBoundingClientRect(),f=0;function m(t){var n=++f,o=ui(e,t,!0,"rectangle"==i.unit);if(o)if(0!=nt(o,h)){e.curOp.focus=j(),p(o);var a=ki(r,s);(o.line>=a.to||o.lineg.bottom?20:0;l&&setTimeout(tr(e,(function(){f==n&&(r.scroller.scrollTop+=l,m(t))})),50)}}function v(t){e.state.selectingText=!1,f=1/0,t&&(ye(t),r.input.focus()),ge(r.wrapper.ownerDocument,"mousemove",b),ge(r.wrapper.ownerDocument,"mouseup",A),s.history.lastSelOrigin=null}var b=tr(e,(function(e){0!==e.buttons&&xe(e)?m(e):v(e)})),A=tr(e,v);e.state.selectingText=A,he(r.wrapper.ownerDocument,"mousemove",b),he(r.wrapper.ownerDocument,"mouseup",A)}(e,i,t,s)}(t,i,s,e):Ee(e)==n.scroller&&ye(e):2==r?(i&&Yr(t.doc,i),setTimeout((function(){return n.input.focus()}),20)):3==r&&(C?t.display.input.onContextMenu(e):Ei(t)))}}function bo(e,t,n){if("char"==n)return new Er(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Er(tt(t.line,0),lt(e.doc,tt(t.line+1,0)));var i=n(e,t);return new Er(i.from,i.to)}function Ao(e,t,n,i){var r,s;if(t.touches)r=t.touches[0].clientX,s=t.touches[0].clientY;else try{r=t.clientX,s=t.clientY}catch(e){return!1}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&ye(t);var o=e.display,a=o.lineDiv.getBoundingClientRect();if(s>a.bottom||!be(e,n))return we(t);s-=a.top-o.viewOffset;for(var l=0;l=r)return fe(e,n,e,Ze(e.doc,s),e.display.gutterSpecs[l].className,t),we(t)}}function yo(e,t){return Ao(e,t,"gutterClick",!0)}function _o(e,t){Cn(e.display,t)||function(e,t){return!!be(e,"gutterContextMenu")&&Ao(e,t,"gutterContextMenu",!1)}(e,t)||me(e,t,"contextmenu")||C||e.display.input.onContextMenu(t)}function wo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Un(e)}mo.prototype.compare=function(e,t,n){return this.time+400>e&&0==nt(t,this.pos)&&n==this.button};var Co={toString:function(){return"CodeMirror.Init"}},Eo={},xo={};function Do(e,t,n){if(!t!=!(n&&n!=Co)){var i=e.display.dragFunctions,r=t?he:ge;r(e.display.scroller,"dragstart",i.start),r(e.display.scroller,"dragenter",i.enter),r(e.display.scroller,"dragover",i.over),r(e.display.scroller,"dragleave",i.leave),r(e.display.scroller,"drop",i.drop)}}function So(e){e.options.lineWrapping?(O(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(D(e.display.wrapper,"CodeMirror-wrap"),qt(e)),di(e),hi(e),Un(e),setTimeout((function(){return Wi(e)}),100)}function To(e,t){var n=this;if(!(this instanceof To))return new To(e,t);this.options=t=t?L(t):{},L(Eo,t,!1);var i=t.value;"string"==typeof i?i=new Ms(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var r=new To.inputStyles[t.inputStyle](this),s=this.display=new vr(e,i,r,t);for(var d in s.wrapper.CodeMirror=this,wo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),$i(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new F,keySeq:null,specialChars:null},t.autofocus&&!v&&s.input.focus(),o&&a<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),function(e){var t=e.display;he(t.scroller,"mousedown",tr(e,vo)),he(t.scroller,"dblclick",o&&a<11?tr(e,(function(t){if(!me(e,t)){var n=ui(e,t);if(n&&!yo(e,t)&&!Cn(e.display,t)){ye(t);var i=e.findWordAt(n);Yr(e.doc,i.anchor,i.head)}}})):function(t){return me(e,t)||ye(t)}),he(t.scroller,"contextmenu",(function(t){return _o(e,t)})),he(t.input.getField(),"contextmenu",(function(n){t.scroller.contains(n.target)||_o(e,n)}));var n,i={end:0};function r(){t.activeTouch&&(n=setTimeout((function(){return t.activeTouch=null}),1e3),(i=t.activeTouch).end=+new Date)}function s(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function l(e,t){if(null==t.left)return!0;var n=t.left-e.left,i=t.top-e.top;return n*n+i*i>400}he(t.scroller,"touchstart",(function(r){if(!me(e,r)&&!s(r)&&!yo(e,r)){t.input.ensurePolled(),clearTimeout(n);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-i.end<=300?i:null},1==r.touches.length&&(t.activeTouch.left=r.touches[0].pageX,t.activeTouch.top=r.touches[0].pageY)}})),he(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),he(t.scroller,"touchend",(function(n){var i=t.activeTouch;if(i&&!Cn(t,n)&&null!=i.left&&!i.moved&&new Date-i.start<300){var s,o=e.coordsChar(t.activeTouch,"page");s=!i.prev||l(i,i.prev)?new Er(o,o):!i.prev.prev||l(i,i.prev.prev)?e.findWordAt(o):new Er(tt(o.line,0),lt(e.doc,tt(o.line+1,0))),e.setSelection(s.anchor,s.head),e.focus(),ye(n)}r()})),he(t.scroller,"touchcancel",r),he(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Ri(e,t.scroller.scrollTop),Ni(e,t.scroller.scrollLeft,!0),fe(e,"scroll",e))})),he(t.scroller,"mousewheel",(function(t){return wr(e,t)})),he(t.scroller,"DOMMouseScroll",(function(t){return wr(e,t)})),he(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){me(e,t)||Ce(t)},over:function(t){me(e,t)||(function(e,t){var n=ui(e,t);if(n){var i=document.createDocumentFragment();Ai(e,n,i),e.display.dragCursor||(e.display.dragCursor=k("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),T(e.display.dragCursor,i)}}(e,t),Ce(t))},start:function(t){return function(e,t){if(o&&(!e.state.draggingText||+new Date-js<100))Ce(t);else if(!me(e,t)&&!Cn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!h)){var n=k("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",c&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),c&&n.parentNode.removeChild(n)}}(e,t)},drop:tr(e,Os),leave:function(t){me(e,t)||Is(e)}};var d=t.input.getField();he(d,"keyup",(function(t){return ho.call(e,t)})),he(d,"keydown",tr(e,co)),he(d,"keypress",tr(e,po)),he(d,"focus",(function(t){return xi(e,t)})),he(d,"blur",(function(t){return Di(e,t)}))}(this),Ls(),Gi(this),this.curOp.forceUpdate=!0,Rr(this,i),t.autofocus&&!v||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&xi(n)}),20):Di(this),xo)xo.hasOwnProperty(d)&&xo[d](this,t[d],Co);pr(this),t.finishInit&&t.finishInit(this);for(var u=0;u150)){if(!i)return;n="prev"}}else d=0,n="not";"prev"==n?d=t>s.first?N(Ge(s,t-1).text,null,o):0:"add"==n?d=l+e.options.indentUnit:"subtract"==n?d=l-e.options.indentUnit:"number"==typeof n&&(d=l+n),d=Math.max(0,d);var c="",h=0;if(e.options.indentWithTabs)for(var p=Math.floor(d/o);p;--p)h+=o,c+="\t";if(ho,l=je(t),d=null;if(a&&i.ranges.length>1)if(Mo&&Mo.text.join("\n")==t){if(i.ranges.length%Mo.text.length==0){d=[];for(var u=0;u=0;h--){var p=i.ranges[h],g=p.from(),f=p.to();p.empty()&&(n&&n>0?g=tt(g.line,g.ch-n):e.state.overwrite&&!a?f=tt(f.line,Math.min(Ge(s,f.line).text.length,f.ch+Y(l).length)):a&&Mo&&Mo.lineWise&&Mo.text.join("\n")==l.join("\n")&&(g=f=tt(g.line,0)));var m={from:g,to:f,text:d?d[h%d.length]:l,origin:r||(a?"paste":e.state.cutIncoming>o?"cut":"+input")};us(e.doc,m),dn(e,"inputRead",e,m)}t&&!a&&Po(e,t),ji(e),e.curOp.updateInput<2&&(e.curOp.updateInput=c),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Io(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||er(t,(function(){return Oo(t,n,0,null,"paste")})),!0}function Po(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(!(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line)){var s=e.getModeAt(r.head),o=!1;if(s.electricChars){for(var a=0;a-1){o=Bo(e,r.head.line,"smart");break}}else s.electricInput&&s.electricInput.test(Ge(e.doc,r.head.line).text.slice(0,r.head.ch))&&(o=Bo(e,r.head.line,"smart"));o&&dn(e,"electricInput",e,r.head.line)}}}function Ro(e){for(var t=[],n=[],i=0;i0?0:-1));if(isNaN(u))o=null;else{var c=n>0?u>=55296&&u<56320:u>=56320&&u<57343;o=new tt(t.line,Math.max(0,Math.min(a.text.length,t.ch+n*(c?2:1))),-n)}}else o=r?function(e,t,n,i){var r=ue(t,e.doc.direction);if(!r)return Qs(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var s=le(r,n.ch,n.sticky),o=r[s];if("ltr"==e.doc.direction&&o.level%2==0&&(i>0?o.to>n.ch:o.from=o.from&&h>=u.begin)){var p=c?"before":"after";return new tt(n.line,h,p)}}var g=function(e,t,i){for(var s=function(e,t){return t?new tt(n.line,l(e,1),"before"):new tt(n.line,e,"after")};e>=0&&e0==(1!=o.level),d=a?i.begin:l(i.end,-1);if(o.from<=d&&d0?u.end:l(u.begin,-1);return null==m||i>0&&m==t.text.length||!(f=g(i>0?0:r.length-1,i,d(m)))?null:f}(e.cm,a,t,n):Qs(a,t,n);if(null==o){if(s||((d=t.line+l)=e.first+e.size||(t=new tt(d,t.ch,t.sticky),!(a=Ge(e,d)))))return!1;t=eo(r,e.cm,a,t.line,l)}else t=o;return!0}if("char"==i||"codepoint"==i)d();else if("column"==i)d(!0);else if("word"==i||"group"==i)for(var u=null,c="group"==i,h=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(n<0)||d(!p);p=!1){var g=a.text.charAt(t.ch)||"\n",f=te(g,h)?"w":c&&"\n"==g?"n":!c||/\s/.test(g)?null:"p";if(!c||p||f||(f="s"),u&&u!=f){n<0&&(n=1,d(),t.sticky="after");break}if(f&&(u=f),n>0&&!d(!p))break}var m=os(e,t,s,o,!0);return it(s,m)&&(m.hitSide=!0),m}function zo(e,t,n,i){var r,s,o=e.doc,a=t.left;if("page"==i){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),d=Math.max(l-.5*ri(e.display),3);r=(n>0?t.bottom:t.top)+n*d}else"line"==i&&(r=n>0?t.bottom+3:t.top-3);for(;(s=Xn(e,a,r)).outside;){if(n<0?r<=0:r>=o.height){s.hitSide=!0;break}r+=5*n}return s}var Uo=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new F,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Wo(e,t){var n=jn(e,t.line);if(!n||n.hidden)return null;var i=Ge(e.doc,t.line),r=Bn(n,i,t.line),s=ue(i,e.doc.direction),o="left";s&&(o=le(s,t.ch)%2?"right":"left");var a=Ln(r.map,t.ch,o);return a.offset="right"==a.collapse?a.end:a.start,a}function Ho(e,t){return t&&(e.bad=!0),e}function Vo(e,t,n){var i;if(t==e.display.lineDiv){if(!(i=e.display.lineDiv.childNodes[n]))return Ho(e.clipPos(tt(e.display.viewTo-1)),!0);t=null,n=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var r=0;r=t.display.viewTo||s.line=t.display.viewFrom&&Wo(t,r)||{node:l[0].measure.map[2],offset:0},u=s.linei.firstLine()&&(o=tt(o.line-1,Ge(i.doc,o.line-1).length)),a.ch==Ge(i.doc,a.line).text.length&&a.liner.viewTo-1)return!1;o.line==r.viewFrom||0==(e=ci(i,o.line))?(t=Xe(r.view[0].line),n=r.view[0].node):(t=Xe(r.view[e].line),n=r.view[e-1].node.nextSibling);var l,d,u=ci(i,a.line);if(u==r.view.length-1?(l=r.viewTo-1,d=r.lineDiv.lastChild):(l=Xe(r.view[u+1].line)-1,d=r.view[u+1].node.previousSibling),!n)return!1;for(var c=i.doc.splitLines(function(e,t,n,i,r){var s="",o=!1,a=e.doc.lineSeparator(),l=!1;function d(){o&&(s+=a,l&&(s+=a),o=l=!1)}function u(e){e&&(d(),s+=e)}function c(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void u(n);var s,h=t.getAttribute("cm-marker");if(h){var p=e.findMarks(tt(i,0),tt(r+1,0),(m=+h,function(e){return e.id==m}));return void(p.length&&(s=p[0].find(0))&&u(Ke(e.doc,s.from,s.to).join(a)))}if("false"==t.getAttribute("contenteditable"))return;var g=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;g&&d();for(var f=0;f1&&h.length>1;)if(Y(c)==Y(h))c.pop(),h.pop(),l--;else{if(c[0]!=h[0])break;c.shift(),h.shift(),t++}for(var p=0,g=0,f=c[0],m=h[0],v=Math.min(f.length,m.length);po.ch&&b.charCodeAt(b.length-g-1)==A.charCodeAt(A.length-g-1);)p--,g++;c[c.length-1]=b.slice(0,b.length-g).replace(/^\u200b+/,""),c[0]=c[0].slice(p).replace(/\u200b+$/,"");var _=tt(t,p),w=tt(l,h.length?Y(h).length-g:0);return c.length>1||c[0]||nt(_,w)?(fs(i.doc,c,_,w,"+input"),!0):void 0},Uo.prototype.ensurePolled=function(){this.forceCompositionEnd()},Uo.prototype.reset=function(){this.forceCompositionEnd()},Uo.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Uo.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Uo.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||er(this.cm,(function(){return hi(e.cm)}))},Uo.prototype.setUneditable=function(e){e.contentEditable="false"},Uo.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tr(this.cm,Oo)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Uo.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Uo.prototype.onContextMenu=function(){},Uo.prototype.resetPosition=function(){},Uo.prototype.needsContentAttribute=!0;var qo=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new F,this.hasSelection=!1,this.composing=null};qo.prototype.init=function(e){var t=this,n=this,i=this.cm;this.createField(e);var r=this.textarea;function s(e){if(!me(i,e)){if(i.somethingSelected())jo({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=Ro(i);jo({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,H):(n.prevInput="",r.value=t.text.join("\n"),P(r))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),f&&(r.style.width="0px"),he(r,"input",(function(){o&&a>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),he(r,"paste",(function(e){me(i,e)||Io(e,i)||(i.state.pasteIncoming=+new Date,n.fastPoll())})),he(r,"cut",s),he(r,"copy",s),he(e.scroller,"paste",(function(t){if(!Cn(e,t)&&!me(i,t)){if(!r.dispatchEvent)return i.state.pasteIncoming=+new Date,void n.focus();var s=new Event("paste");s.clipboardData=t.clipboardData,r.dispatchEvent(s)}})),he(e.lineSpace,"selectstart",(function(t){Cn(e,t)||ye(t)})),he(r,"compositionstart",(function(){var e=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}})),he(r,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},qo.prototype.createField=function(e){this.wrapper=No(),this.textarea=this.wrapper.firstChild},qo.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qo.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,i=bi(e);if(e.options.moveInputWithCursor){var r=Kn(e,n.sel.primary().head,"div"),s=t.wrapper.getBoundingClientRect(),o=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+o.top-s.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+o.left-s.left))}return i},qo.prototype.showSelection=function(e){var t=this.cm.display;T(t.cursorDiv,e.cursors),T(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qo.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&P(this.textarea),o&&a>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",o&&a>=9&&(this.hasSelection=null))}},qo.prototype.getField=function(){return this.textarea},qo.prototype.supportsTouch=function(){return!1},qo.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||j()!=this.textarea))try{this.textarea.focus()}catch(e){}},qo.prototype.blur=function(){this.textarea.blur()},qo.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qo.prototype.receivedFocus=function(){this.slowPoll()},qo.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},qo.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}))},qo.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||Oe(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var r=n.value;if(r==i&&!t.somethingSelected())return!1;if(o&&a>=9&&this.hasSelection===r||b&&/[\uf700-\uf7ff]/.test(r))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var s=r.charCodeAt(0);if(8203!=s||i||(i="​"),8666==s)return this.reset(),this.cm.execCommand("undo")}for(var l=0,d=Math.min(i.length,r.length);l1e3||r.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=r,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},qo.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qo.prototype.onKeyPress=function(){o&&a>=9&&(this.hasSelection=null),this.fastPoll()},qo.prototype.onContextMenu=function(e){var t=this,n=t.cm,i=n.display,r=t.textarea;t.contextMenuPending&&t.contextMenuPending();var s=ui(n,e),d=i.scroller.scrollTop;if(s&&!c){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(s)&&tr(n,es)(n.doc,Dr(s),H);var u,h=r.style.cssText,p=t.wrapper.style.cssText,g=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",r.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-g.top-5)+"px; left: "+(e.clientX-g.left-5)+"px;\n z-index: 1000; background: "+(o?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(u=window.scrollY),i.input.focus(),l&&window.scrollTo(null,u),i.input.reset(),n.somethingSelected()||(r.value=t.prevInput=" "),t.contextMenuPending=v,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),o&&a>=9&&m(),C){Ce(e);var f=function(){ge(window,"mouseup",f),setTimeout(v,20)};he(window,"mouseup",f)}else setTimeout(v,50)}function m(){if(null!=r.selectionStart){var e=n.somethingSelected(),s="​"+(e?r.value:"");r.value="⇚",r.value=s,t.prevInput=e?"":"​",r.selectionStart=1,r.selectionEnd=s.length,i.selForContextMenu=n.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=p,r.style.cssText=h,o&&a<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=d),null!=r.selectionStart)){(!o||o&&a<9)&&m();var e=0,s=function(){i.selForContextMenu==n.doc.sel&&0==r.selectionStart&&r.selectionEnd>0&&"​"==t.prevInput?tr(n,ls)(n):e++<10?i.detectingSelectAll=setTimeout(s,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(s,200)}}},qo.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},qo.prototype.setUneditable=function(){},qo.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function n(n,i,r,s){e.defaults[n]=i,r&&(t[n]=s?function(e,t,n){n!=Co&&r(e,t,n)}:r)}e.defineOption=n,e.Init=Co,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,Mr(e)}),!0),n("indentUnit",2,Mr,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){jr(e),Un(e),hi(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],i=e.doc.first;e.doc.iter((function(e){for(var r=0;;){var s=e.text.indexOf(t,r);if(-1==s)break;r=s+t.length,n.push(tt(i,s))}i++}));for(var r=n.length-1;r>=0;r--)fs(e.doc,t,n[r],tt(n[r].line,n[r].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Co&&e.refresh()})),n("specialCharPlaceholder",Qt,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!y),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){wo(e),mr(e)}),!0),n("keyMap","default",(function(e,t,n){var i=Js(t),r=n!=Co&&Js(n);r&&r.detach&&r.detach(e,i),i.attach&&i.attach(e,r||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,So,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=gr(t,e.options.lineNumbers),mr(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?ai(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return Wi(e)}),!0),n("scrollbarStyle","native",(function(e){$i(e),Wi(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=gr(e.options.gutters,t),mr(e)}),!0),n("firstLineNumber",1,mr,!0),n("lineNumberFormatter",(function(e){return e}),mr,!0),n("showCursorWhenSelecting",!1,vi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(Di(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,Do),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,vi,!0),n("singleCursorHeightPerLine",!0,vi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,jr,!0),n("addModeClass",!1,jr,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,jr,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}(To),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var i=this.options,r=i[e];i[e]==n&&"mode"!=e||(i[e]=n,t.hasOwnProperty(e)&&tr(this,t[e])(this,n,r),fe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Js(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(Bo(this,r.head.line,e,!0),n=r.head.line,i==this.doc.sel.primIndex&&ji(this));else{var s=r.from(),o=r.to(),a=Math.max(n,s.line);n=Math.min(this.lastLine(),o.line-(o.ch?0:1))+1;for(var l=a;l0&&Xr(this.doc,i,new Er(s,d[i].to()),H)}}})),getTokenAt:function(e,t){return At(this,e,t)},getLineTokens:function(e,t){return At(this,tt(e),t,!0)},getTokenTypeAt:function(e){e=lt(this.doc,e);var t,n=pt(this,Ge(this.doc,e.line)),i=0,r=(n.length-1)/2,s=e.ch;if(0==s)t=n[2];else for(;;){var o=i+r>>1;if((o?n[2*o-1]:0)>=s)r=o;else{if(!(n[2*o+1]s&&(e=s,r=!0),i=Ge(this.doc,e)}else i=e;return $n(this,i,{top:0,left:0},t||"page",n||r).top+(r?this.doc.height-Vt(i):0)},defaultTextHeight:function(){return ri(this.display)},defaultCharWidth:function(){return si(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,i,r){var s,o,a,l=this.display,d=(e=Kn(this,lt(this.doc,e))).bottom,u=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),l.sizer.appendChild(t),"over"==i)d=e.top;else if("above"==i||"near"==i){var c=Math.max(l.wrapper.clientHeight,this.doc.height),h=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==i||e.bottom+t.offsetHeight>c)&&e.top>t.offsetHeight?d=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=c&&(d=e.bottom),u+t.offsetWidth>h&&(u=h-t.offsetWidth)}t.style.top=d+"px",t.style.left=t.style.right="","right"==r?(u=l.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==r?u=0:"middle"==r&&(u=(l.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),n&&(s=this,o={left:u,top:d,right:u+t.offsetWidth,bottom:d+t.offsetHeight},null!=(a=Bi(s,o)).scrollTop&&Ri(s,a.scrollTop),null!=a.scrollLeft&&Ni(s,a.scrollLeft))},triggerOnKeyDown:nr(co),triggerOnKeyPress:nr(po),triggerOnKeyUp:ho,triggerOnMouseDown:nr(vo),execCommand:function(e){if(to.hasOwnProperty(e))return to[e].call(null,this)},triggerElectric:nr((function(e){Po(this,e)})),findPosH:function(e,t,n,i){var r=1;t<0&&(r=-1,t=-t);for(var s=lt(this.doc,e),o=0;o0&&o(t.charAt(n-1));)--n;for(;i.5||this.options.lineWrapping)&&di(this),fe(this,"refresh",this)})),swapDoc:nr((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Rr(this,e),Un(this),this.display.input.reset(),Oi(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,dn(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ae(e),e.registerHelper=function(t,i,r){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][i]=r},e.registerGlobalHelper=function(t,i,r,s){e.registerHelper(t,i,s),n[t]._global.push({pred:r,val:s})}}(To);var Go="iter insert remove copy getEditor constructor".split(" ");for(var Ko in Ms.prototype)Ms.prototype.hasOwnProperty(Ko)&&z(Go,Ko)<0&&(To.prototype[Ko]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ms.prototype[Ko]));return Ae(Ms),To.inputStyles={textarea:qo,contenteditable:Uo},To.defineMode=function(e){To.defaults.mode||"null"==e||(To.defaults.mode=e),Ne.apply(this,arguments)},To.defineMIME=function(e,t){Le[e]=t},To.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),To.defineMIME("text/plain","null"),To.defineExtension=function(e,t){To.prototype[e]=t},To.defineDocExtension=function(e,t){Ms.prototype[e]=t},To.fromTextArea=function(e,t){if((t=t?L(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=j();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function i(){e.value=a.getValue()}var r;if(e.form&&(he(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var s=e.form;r=s.submit;try{var o=s.submit=function(){i(),s.submit=r,s.submit(),s.submit=o}}catch(e){}}t.finishInit=function(n){n.save=i,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,i(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(ge(e.form,"submit",i),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=r))}},e.style.display="none";var a=To((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return a},function(e){e.off=ge,e.on=he,e.wheelEventPixels=_r,e.Doc=Ms,e.splitLines=je,e.countColumn=N,e.findColumn=q,e.isWordChar=ee,e.Pass=W,e.signal=fe,e.Line=Gt,e.changeEnd=Sr,e.scrollbarModel=Vi,e.Pos=tt,e.cmpPos=nt,e.modes=Re,e.mimeModes=Le,e.resolveMode=Fe,e.getMode=ze,e.modeExtensions=Ue,e.extendMode=We,e.copyState=He,e.startState=$e,e.innerMode=Ve,e.commands=to,e.keyMap=Hs,e.keyName=Ys,e.isModifierKey=Gs,e.lookupKey=qs,e.normalizeKeyMap=$s,e.StringStream=qe,e.SharedTextMarker=Ss,e.TextMarker=xs,e.LineWidget=ws,e.e_preventDefault=ye,e.e_stopPropagation=_e,e.e_stop=Ce,e.addClass=O,e.contains=M,e.rmClass=D,e.keyNames=Fs}(To),To.version="5.61.1",To}()},1755:(e,t,n)=>{!function(e){"use strict";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}var n=t(["and","or","not","is"]),i=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],r=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function s(e){return e.scopes[e.scopes.length-1]}e.registerHelper("hintWords","python",i.concat(r)),e.defineMode("python",(function(o,a){for(var l="error",d=a.delimiters||a.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,u=[a.singleOperators,a.doubleOperators,a.doubleDelimiters,a.tripleDelimiters,a.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/],c=0;ci?w(t):r0&&C(e,t)&&(o+=" "+l),o}return _(e,t)}function _(e,t,i){if(e.eatSpace())return null;if(!i&&e.match(/^#.*/))return"comment";if(e.match(/^[0-9\.]/,!1)){var r=!1;if(e.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&(r=!0),e.match(/^[\d_]+\.\d*/)&&(r=!0),e.match(/^\.\d+/)&&(r=!0),r)return e.eat(/J/i),"number";var s=!1;if(e.match(/^0x[0-9a-f_]+/i)&&(s=!0),e.match(/^0b[01_]+/i)&&(s=!0),e.match(/^0o[0-7_]+/i)&&(s=!0),e.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(e.eat(/J/i),s=!0),e.match(/^0(?![\dx])/i)&&(s=!0),s)return e.eat(/L/i),"number"}if(e.match(v))return-1!==e.current().toLowerCase().indexOf("f")?(t.tokenize=function(e,t){for(;"rubf".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var n=1==e.length,i="string";function r(e){return function(t,n){var i=_(t,n,!0);return"punctuation"==i&&("{"==t.current()?n.tokenize=r(e+1):"}"==t.current()&&(n.tokenize=e>1?r(e-1):s)),i}}function s(s,o){for(;!s.eol();)if(s.eatWhile(/[^'"\{\}\\]/),s.eat("\\")){if(s.next(),n&&s.eol())return i}else{if(s.match(e))return o.tokenize=t,i;if(s.match("{{"))return i;if(s.match("{",!1))return o.tokenize=r(0),s.current()?i:o.tokenize(s,o);if(s.match("}}"))return i;if(s.match("}"))return l;s.eat(/['"]/)}if(n){if(a.singleLineStringErrors)return l;o.tokenize=t}return i}return s.isString=!0,s}(e.current(),t.tokenize),t.tokenize(e,t)):(t.tokenize=function(e,t){for(;"rubf".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var n=1==e.length,i="string";function r(r,s){for(;!r.eol();)if(r.eatWhile(/[^'"\\]/),r.eat("\\")){if(r.next(),n&&r.eol())return i}else{if(r.match(e))return s.tokenize=t,i;r.eat(/['"]/)}if(n){if(a.singleLineStringErrors)return l;s.tokenize=t}return i}return r.isString=!0,r}(e.current(),t.tokenize),t.tokenize(e,t));for(var o=0;o1&&s(t).offset>n;){if("py"!=s(t).type)return!0;t.scopes.pop()}return s(t).offset!=n}function E(e,t){e.sol()&&(t.beginningOfLine=!0);var n=t.tokenize(e,t),i=e.current();if(t.beginningOfLine&&"@"==i)return e.match(m,!1)?"meta":f?"operator":l;if(/\S/.test(i)&&(t.beginningOfLine=!1),"variable"!=n&&"builtin"!=n||"meta"!=t.lastToken||(n="meta"),"pass"!=i&&"return"!=i||(t.dedent+=1),"lambda"==i&&(t.lambda=!0),":"==i&&!t.lambda&&"py"==s(t).type&&e.match(/^\s*(?:#|$)/,!1)&&w(t),1==i.length&&!/string|comment/.test(n)){var r="[({".indexOf(i);if(-1!=r&&function(e,t,n){var i=e.match(/^[\s\[\{\(]*(?:#|$)/,!1)?null:e.column()+1;t.scopes.push({offset:t.indent+h,type:n,align:i})}(e,t,"])}".slice(r,r+1)),-1!=(r="])}".indexOf(i))){if(s(t).type!=i)return l;t.indent=t.scopes.pop().offset-h}}return t.dedent>0&&e.eol()&&"py"==s(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),n}return{startState:function(e){return{tokenize:y,scopes:[{offset:e||0,type:"py",align:null}],indent:e||0,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=t.errorToken;n&&(t.errorToken=!1);var i=E(e,t);return i&&"comment"!=i&&(t.lastToken="keyword"==i||"punctuation"==i?e.current():i),"punctuation"==i&&(i=null),e.eol()&&t.lambda&&(t.lambda=!1),n?i+" "+l:i},indent:function(t,n){if(t.tokenize!=y)return t.tokenize.isString?e.Pass:0;var i=s(t),r=i.type==n.charAt(0);return null!=i.align?i.align-(r?1:0):i.offset-(r?h:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"}})),e.defineMIME("text/x-python","python");var o;e.defineMIME("text/x-cython",{name:"python",extra_keywords:(o="by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE",o.split(" "))})}(n(1448))},2743:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function r(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function o(e,t){try{return t in e}catch(e){return!1}}function a(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||r,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var d=Array.isArray(n);return d===Array.isArray(e)?d?l.arrayMerge(e,n,l):function(e,t,n){var r={};return n.isMergeableObject(e)&&s(e).forEach((function(t){r[t]=i(e[t],n)})),s(t).forEach((function(s){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,s)||(o(e,s)&&n.isMergeableObject(t[s])?r[s]=function(e,t){if(!t.customMerge)return a;var n=t.customMerge(e);return"function"==typeof n?n:a}(s,n)(e[s],t[s],n):r[s]=i(t[s],n))})),r}(e,n,l):i(n,l)}a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return a(e,n,t)}),{})};var l=a;e.exports=l},3338:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Doctype=t.CDATA=t.Tag=t.Style=t.Script=t.Comment=t.Directive=t.Text=t.Root=t.isTag=t.ElementType=void 0,function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"}(n=t.ElementType||(t.ElementType={})),t.isTag=function(e){return e.type===n.Tag||e.type===n.Script||e.type===n.Style},t.Root=n.Root,t.Text=n.Text,t.Directive=n.Directive,t.Comment=n.Comment,t.Script=n.Script,t.Style=n.Style,t.Tag=n.Tag,t.CDATA=n.CDATA,t.Doctype=n.Doctype},3379:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXML=t.decodeHTMLStrict=t.decodeHTMLAttribute=t.decodeHTML=t.determineBranch=t.EntityDecoder=t.DecodingMode=t.BinTrieFlags=t.fromCodePoint=t.replaceCodePoint=t.decodeCodePoint=t.xmlDecodeTree=t.htmlDecodeTree=void 0;var a=o(n(7346));t.htmlDecodeTree=a.default;var l=o(n(8622));t.xmlDecodeTree=l.default;var d=s(n(2809));t.decodeCodePoint=d.default;var u,c,h,p,g=n(2809);function f(e){return e>=u.ZERO&&e<=u.NINE}Object.defineProperty(t,"replaceCodePoint",{enumerable:!0,get:function(){return g.replaceCodePoint}}),Object.defineProperty(t,"fromCodePoint",{enumerable:!0,get:function(){return g.fromCodePoint}}),function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"}(u||(u={})),function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"}(c=t.BinTrieFlags||(t.BinTrieFlags={})),function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"}(h||(h={})),function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"}(p=t.DecodingMode||(t.DecodingMode={}));var m=function(){function e(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=h.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=p.Strict}return e.prototype.startEntity=function(e){this.decodeMode=e,this.state=h.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1},e.prototype.write=function(e,t){switch(this.state){case h.EntityStart:return e.charCodeAt(t)===u.NUM?(this.state=h.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=h.NamedEntity,this.stateNamedEntity(e,t));case h.NumericStart:return this.stateNumericStart(e,t);case h.NumericDecimal:return this.stateNumericDecimal(e,t);case h.NumericHex:return this.stateNumericHex(e,t);case h.NamedEntity:return this.stateNamedEntity(e,t)}},e.prototype.stateNumericStart=function(e,t){return t>=e.length?-1:(32|e.charCodeAt(t))===u.LOWER_X?(this.state=h.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=h.NumericDecimal,this.stateNumericDecimal(e,t))},e.prototype.addToNumericResult=function(e,t,n,i){if(t!==n){var r=n-t;this.result=this.result*Math.pow(i,r)+parseInt(e.substr(t,r),i),this.consumed+=r}},e.prototype.stateNumericHex=function(e,t){for(var n,i=t;t=u.UPPER_A&&n<=u.UPPER_F||n>=u.LOWER_A&&n<=u.LOWER_F)))return this.addToNumericResult(e,i,t,16),this.emitNumericEntity(r,3);t+=1}return this.addToNumericResult(e,i,t,16),-1},e.prototype.stateNumericDecimal=function(e,t){for(var n=t;t>14;t=u.UPPER_A&&e<=u.UPPER_Z||e>=u.LOWER_A&&e<=u.LOWER_Z||f(e)}(o)))?0:this.emitNotTerminatedNamedEntity();if(0!=(r=((i=n[this.treeIndex])&c.VALUE_LENGTH)>>14)){if(s===u.SEMI)return this.emitNamedEntityData(this.treeIndex,r,this.consumed+this.excess);this.decodeMode!==p.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}var o;return-1},e.prototype.emitNotTerminatedNamedEntity=function(){var e,t=this.result,n=(this.decodeTree[t]&c.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,n,this.consumed),null===(e=this.errors)||void 0===e||e.missingSemicolonAfterCharacterReference(),this.consumed},e.prototype.emitNamedEntityData=function(e,t,n){var i=this.decodeTree;return this.emitCodePoint(1===t?i[e]&~c.VALUE_LENGTH:i[e+1],n),3===t&&this.emitCodePoint(i[e+2],n),n},e.prototype.end=function(){var e;switch(this.state){case h.NamedEntity:return 0===this.result||this.decodeMode===p.Attribute&&this.result!==this.treeIndex?0:this.emitNotTerminatedNamedEntity();case h.NumericDecimal:return this.emitNumericEntity(0,2);case h.NumericHex:return this.emitNumericEntity(0,3);case h.NumericStart:return null===(e=this.errors)||void 0===e||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case h.EntityStart:return 0}},e}();function v(e){var t="",n=new m(e,(function(e){return t+=(0,d.fromCodePoint)(e)}));return function(e,i){for(var r=0,s=0;(s=e.indexOf("&",s))>=0;){t+=e.slice(r,s),n.startEntity(i);var o=n.write(e,s+1);if(o<0){r=s+n.end();break}r=s+o,s=0===o?r+1:r}var a=t+e.slice(r);return t="",a}}function b(e,t,n,i){var r=(t&c.BRANCH_LENGTH)>>7,s=t&c.JUMP_TABLE;if(0===r)return 0!==s&&i===s?n:-1;if(s){var o=i-s;return o<0||o>=r?-1:e[n+o]-1}for(var a=n,l=a+r-1;a<=l;){var d=a+l>>>1,u=e[d];if(ui))return e[d+r];l=d-1}}return-1}t.EntityDecoder=m,t.determineBranch=b;var A=v(a.default),y=v(l.default);t.decodeHTML=function(e,t){return void 0===t&&(t=p.Legacy),A(e,t)},t.decodeHTMLAttribute=function(e){return A(e,p.Attribute)},t.decodeHTMLStrict=function(e){return A(e,p.Strict)},t.decodeXML=function(e){return y(e,p.Strict)}},2809:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.replaceCodePoint=t.fromCodePoint=void 0;var i=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function r(e){var t;return e>=55296&&e<=57343||e>1114111?65533:null!==(t=i.get(e))&&void 0!==t?t:e}t.fromCodePoint=null!==(n=String.fromCodePoint)&&void 0!==n?n:function(e){var t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),t+String.fromCharCode(e)},t.replaceCodePoint=r,t.default=function(e){return(0,t.fromCodePoint)(r(e))}},3231:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.encodeNonAsciiHTML=t.encodeHTML=void 0;var r=i(n(8635)),s=n(7078),o=/[\t\n!-,./:-@[-`\f{-}$\x80-\uFFFF]/g;function a(e,t){for(var n,i="",o=0;null!==(n=e.exec(t));){var a=n.index;i+=t.substring(o,a);var l=t.charCodeAt(a),d=r.default.get(l);if("object"==typeof d){if(a+1{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.escapeText=t.escapeAttribute=t.escapeUTF8=t.escape=t.encodeXML=t.getCodePoint=t.xmlReplacer=void 0,t.xmlReplacer=/["&'<>$\x80-\uFFFF]/g;var n=new Map([[34,"""],[38,"&"],[39,"'"],[60,"<"],[62,">"]]);function i(e){for(var i,r="",s=0;null!==(i=t.xmlReplacer.exec(e));){var o=i.index,a=e.charCodeAt(o),l=n.get(a);void 0!==l?(r+=e.substring(s,o)+l,s=o+1):(r+="".concat(e.substring(s,o),"&#x").concat((0,t.getCodePoint)(e,o).toString(16),";"),s=t.xmlReplacer.lastIndex+=Number(55296==(64512&a)))}return r+e.substr(s)}function r(e,t){return function(n){for(var i,r=0,s="";i=e.exec(n);)r!==i.index&&(s+=n.substring(r,i.index)),s+=t.get(i[0].charCodeAt(0)),r=i.index+1;return s+n.substring(r)}}t.getCodePoint=null!=String.prototype.codePointAt?function(e,t){return e.codePointAt(t)}:function(e,t){return 55296==(64512&e.charCodeAt(t))?1024*(e.charCodeAt(t)-55296)+e.charCodeAt(t+1)-56320+65536:e.charCodeAt(t)},t.encodeXML=i,t.escape=i,t.escapeUTF8=r(/[&<>'"]/g,n),t.escapeAttribute=r(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),t.escapeText=r(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]]))},7346:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map((function(e){return e.charCodeAt(0)})))},8622:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=new Uint16Array("Ȁaglq\tɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map((function(e){return e.charCodeAt(0)})))},8635:(e,t)=>{"use strict";function n(e){for(var t=1;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXMLStrict=t.decodeHTML5Strict=t.decodeHTML4Strict=t.decodeHTML5=t.decodeHTML4=t.decodeHTMLAttribute=t.decodeHTMLStrict=t.decodeHTML=t.decodeXML=t.DecodingMode=t.EntityDecoder=t.encodeHTML5=t.encodeHTML4=t.encodeNonAsciiHTML=t.encodeHTML=t.escapeText=t.escapeAttribute=t.escapeUTF8=t.escape=t.encodeXML=t.encode=t.decodeStrict=t.decode=t.EncodingMode=t.EntityLevel=void 0;var i,r,s=n(3379),o=n(3231),a=n(7078);function l(e,t){if(void 0===t&&(t=i.XML),("number"==typeof t?t:t.level)===i.HTML){var n="object"==typeof t?t.mode:void 0;return(0,s.decodeHTML)(e,n)}return(0,s.decodeXML)(e)}!function(e){e[e.XML=0]="XML",e[e.HTML=1]="HTML"}(i=t.EntityLevel||(t.EntityLevel={})),function(e){e[e.UTF8=0]="UTF8",e[e.ASCII=1]="ASCII",e[e.Extensive=2]="Extensive",e[e.Attribute=3]="Attribute",e[e.Text=4]="Text"}(r=t.EncodingMode||(t.EncodingMode={})),t.decode=l,t.decodeStrict=function(e,t){var n;void 0===t&&(t=i.XML);var r="number"==typeof t?{level:t}:t;return null!==(n=r.mode)&&void 0!==n||(r.mode=s.DecodingMode.Strict),l(e,r)},t.encode=function(e,t){void 0===t&&(t=i.XML);var n="number"==typeof t?{level:t}:t;return n.mode===r.UTF8?(0,a.escapeUTF8)(e):n.mode===r.Attribute?(0,a.escapeAttribute)(e):n.mode===r.Text?(0,a.escapeText)(e):n.level===i.HTML?n.mode===r.ASCII?(0,o.encodeNonAsciiHTML)(e):(0,o.encodeHTML)(e):(0,a.encodeXML)(e)};var d=n(7078);Object.defineProperty(t,"encodeXML",{enumerable:!0,get:function(){return d.encodeXML}}),Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return d.escape}}),Object.defineProperty(t,"escapeUTF8",{enumerable:!0,get:function(){return d.escapeUTF8}}),Object.defineProperty(t,"escapeAttribute",{enumerable:!0,get:function(){return d.escapeAttribute}}),Object.defineProperty(t,"escapeText",{enumerable:!0,get:function(){return d.escapeText}});var u=n(3231);Object.defineProperty(t,"encodeHTML",{enumerable:!0,get:function(){return u.encodeHTML}}),Object.defineProperty(t,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return u.encodeNonAsciiHTML}}),Object.defineProperty(t,"encodeHTML4",{enumerable:!0,get:function(){return u.encodeHTML}}),Object.defineProperty(t,"encodeHTML5",{enumerable:!0,get:function(){return u.encodeHTML}});var c=n(3379);Object.defineProperty(t,"EntityDecoder",{enumerable:!0,get:function(){return c.EntityDecoder}}),Object.defineProperty(t,"DecodingMode",{enumerable:!0,get:function(){return c.DecodingMode}}),Object.defineProperty(t,"decodeXML",{enumerable:!0,get:function(){return c.decodeXML}}),Object.defineProperty(t,"decodeHTML",{enumerable:!0,get:function(){return c.decodeHTML}}),Object.defineProperty(t,"decodeHTMLStrict",{enumerable:!0,get:function(){return c.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTMLAttribute",{enumerable:!0,get:function(){return c.decodeHTMLAttribute}}),Object.defineProperty(t,"decodeHTML4",{enumerable:!0,get:function(){return c.decodeHTML}}),Object.defineProperty(t,"decodeHTML5",{enumerable:!0,get:function(){return c.decodeHTML}}),Object.defineProperty(t,"decodeHTML4Strict",{enumerable:!0,get:function(){return c.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML5Strict",{enumerable:!0,get:function(){return c.decodeHTMLStrict}}),Object.defineProperty(t,"decodeXMLStrict",{enumerable:!0,get:function(){return c.decodeXML}})},4651:function(e,t){var n;!function(t,n){"use strict";"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,(function(i,r){"use strict";var s=[],o=Object.getPrototypeOf,a=s.slice,l=s.flat?function(e){return s.flat.call(e)}:function(e){return s.concat.apply([],e)},d=s.push,u=s.indexOf,c={},h=c.toString,p=c.hasOwnProperty,g=p.toString,f=g.call(Object),m={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},b=function(e){return null!=e&&e===e.window},A=i.document,y={type:!0,src:!0,nonce:!0,noModule:!0};function _(e,t,n){var i,r,s=(n=n||A).createElement("script");if(s.text=e,t)for(i in y)(r=t[i]||t.getAttribute&&t.getAttribute(i))&&s.setAttribute(i,r);n.head.appendChild(s).parentNode.removeChild(s)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[h.call(e)]||"object":typeof e}var C="3.7.1",E=/HTML$/i,x=function(e,t){return new x.fn.init(e,t)};function D(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!v(e)&&!b(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function S(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}x.fn=x.prototype={jquery:C,constructor:x,length:0,toArray:function(){return a.call(this)},get:function(e){return null==e?a.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return x.each(this,e)},map:function(e){return this.pushStack(x.map(this,(function(t,n){return e.call(t,n,t)})))},slice:function(){return this.pushStack(a.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(x.grep(this,(function(e,t){return(t+1)%2})))},odd:function(){return this.pushStack(x.grep(this,(function(e,t){return t%2})))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),W=new RegExp(L),H=new RegExp("^"+O+"$"),V={ID:new RegExp("^#("+O+")"),CLASS:new RegExp("^\\.("+O+")"),TAG:new RegExp("^("+O+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+L),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+D+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},$=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,G=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Y=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),J=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},X=function(){le()},Z=he((function(e){return!0===e.disabled&&S(e,"fieldset")}),{dir:"parentNode",next:"legend"});try{f.apply(s=a.call(P.childNodes),P.childNodes),s[P.childNodes.length].nodeType}catch(e){f={apply:function(e,t){R.apply(e,a.call(t))},call:function(e){R.apply(e,a.call(arguments,1))}}}function Q(e,t,n,i){var r,s,o,a,d,u,p,g=t&&t.ownerDocument,b=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==b&&9!==b&&11!==b)return n;if(!i&&(le(t),t=t||l,c)){if(11!==b&&(d=G.exec(e)))if(r=d[1]){if(9===b){if(!(o=t.getElementById(r)))return n;if(o.id===r)return f.call(n,o),n}else if(g&&(o=g.getElementById(r))&&Q.contains(t,o)&&o.id===r)return f.call(n,o),n}else{if(d[2])return f.apply(n,t.getElementsByTagName(e)),n;if((r=d[3])&&t.getElementsByClassName)return f.apply(n,t.getElementsByClassName(r)),n}if(!(C[e+" "]||h&&h.test(e))){if(p=e,g=t,1===b&&(U.test(e)||z.test(e))){for((g=K.test(e)&&ae(t.parentNode)||t)==t&&m.scope||((a=t.getAttribute("id"))?a=x.escapeSelector(a):t.setAttribute("id",a=v)),s=(u=ue(e)).length;s--;)u[s]=(a?"#"+a:":scope")+" "+ce(u[s]);p=u.join(",")}try{return f.apply(n,g.querySelectorAll(p)),n}catch(t){C(e,!0)}finally{a===v&&t.removeAttribute("id")}}}return be(e.replace(j,"$1"),t,n,i)}function ee(){var e=[];return function n(i,r){return e.push(i+" ")>t.cacheLength&&delete n[e.shift()],n[i+" "]=r}}function te(e){return e[v]=!0,e}function ne(e){var t=l.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ie(e){return function(t){return S(t,"input")&&t.type===e}}function re(e){return function(t){return(S(t,"input")||S(t,"button"))&&t.type===e}}function se(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&Z(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function oe(e){return te((function(t){return t=+t,te((function(n,i){for(var r,s=e([],n.length,t),o=s.length;o--;)n[r=s[o]]&&(n[r]=!(i[r]=n[r]))}))}))}function ae(e){return e&&void 0!==e.getElementsByTagName&&e}function le(e){var n,i=e?e.ownerDocument||e:P;return i!=l&&9===i.nodeType&&i.documentElement?(d=(l=i).documentElement,c=!x.isXMLDoc(l),g=d.matches||d.webkitMatchesSelector||d.msMatchesSelector,d.msMatchesSelector&&P!=l&&(n=l.defaultView)&&n.top!==n&&n.addEventListener("unload",X),m.getById=ne((function(e){return d.appendChild(e).id=x.expando,!l.getElementsByName||!l.getElementsByName(x.expando).length})),m.disconnectedMatch=ne((function(e){return g.call(e,"*")})),m.scope=ne((function(){return l.querySelectorAll(":scope")})),m.cssHas=ne((function(){try{return l.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}})),m.getById?(t.filter.ID=function(e){var t=e.replace(Y,J);return function(e){return e.getAttribute("id")===t}},t.find.ID=function(e,t){if(void 0!==t.getElementById&&c){var n=t.getElementById(e);return n?[n]:[]}}):(t.filter.ID=function(e){var t=e.replace(Y,J);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},t.find.ID=function(e,t){if(void 0!==t.getElementById&&c){var n,i,r,s=t.getElementById(e);if(s){if((n=s.getAttributeNode("id"))&&n.value===e)return[s];for(r=t.getElementsByName(e),i=0;s=r[i++];)if((n=s.getAttributeNode("id"))&&n.value===e)return[s]}return[]}}),t.find.TAG=function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},t.find.CLASS=function(e,t){if(void 0!==t.getElementsByClassName&&c)return t.getElementsByClassName(e)},h=[],ne((function(e){var t;d.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||h.push("\\["+M+"*(?:value|"+D+")"),e.querySelectorAll("[id~="+v+"-]").length||h.push("~="),e.querySelectorAll("a#"+v+"+*").length||h.push(".#.+[+~]"),e.querySelectorAll(":checked").length||h.push(":checked"),(t=l.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),d.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&h.push(":enabled",":disabled"),(t=l.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||h.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")")})),m.cssHas||h.push(":has"),h=h.length&&new RegExp(h.join("|")),E=function(e,t){if(e===t)return o=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!m.sortDetached&&t.compareDocumentPosition(e)===n?e===l||e.ownerDocument==P&&Q.contains(P,e)?-1:t===l||t.ownerDocument==P&&Q.contains(P,t)?1:r?u.call(r,e)-u.call(r,t):0:4&n?-1:1)},l):l}for(e in Q.matches=function(e,t){return Q(e,null,null,t)},Q.matchesSelector=function(e,t){if(le(e),c&&!C[t+" "]&&(!h||!h.test(t)))try{var n=g.call(e,t);if(n||m.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){C(t,!0)}return Q(t,l,null,[e]).length>0},Q.contains=function(e,t){return(e.ownerDocument||e)!=l&&le(e),x.contains(e,t)},Q.attr=function(e,n){(e.ownerDocument||e)!=l&&le(e);var i=t.attrHandle[n.toLowerCase()],r=i&&p.call(t.attrHandle,n.toLowerCase())?i(e,n,!c):void 0;return void 0!==r?r:e.getAttribute(n)},Q.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},x.uniqueSort=function(e){var t,n=[],i=0,s=0;if(o=!m.sortStable,r=!m.sortStable&&a.call(e,0),k.call(e,E),o){for(;t=e[s++];)t===e[s]&&(i=n.push(s));for(;i--;)B.call(e,n[i],1)}return r=null,e},x.fn.uniqueSort=function(){return this.pushStack(x.uniqueSort(a.apply(this)))},t=x.expr={cacheLength:50,createPseudo:te,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Y,J),e[3]=(e[3]||e[4]||e[5]||"").replace(Y,J),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||Q.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&Q.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&W.test(n)&&(t=ue(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Y,J).toLowerCase();return"*"===e?function(){return!0}:function(e){return S(e,t)}},CLASS:function(e){var t=y[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&y(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(i){var r=Q.attr(i,e);return null==r?"!="===t:!t||(r+="","="===t?r===n:"!="===t?r!==n:"^="===t?n&&0===r.indexOf(n):"*="===t?n&&r.indexOf(n)>-1:"$="===t?n&&r.slice(-n.length)===n:"~="===t?(" "+r.replace(N," ")+" ").indexOf(n)>-1:"|="===t&&(r===n||r.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,i,r){var s="nth"!==e.slice(0,3),o="last"!==e.slice(-4),a="of-type"===t;return 1===i&&0===r?function(e){return!!e.parentNode}:function(t,n,l){var d,u,c,h,p,g=s!==o?"nextSibling":"previousSibling",f=t.parentNode,m=a&&t.nodeName.toLowerCase(),A=!l&&!a,y=!1;if(f){if(s){for(;g;){for(c=t;c=c[g];)if(a?S(c,m):1===c.nodeType)return!1;p=g="only"===e&&!p&&"nextSibling"}return!0}if(p=[o?f.firstChild:f.lastChild],o&&A){for(y=(h=(d=(u=f[v]||(f[v]={}))[e]||[])[0]===b&&d[1])&&d[2],c=h&&f.childNodes[h];c=++h&&c&&c[g]||(y=h=0)||p.pop();)if(1===c.nodeType&&++y&&c===t){u[e]=[b,h,y];break}}else if(A&&(y=h=(d=(u=t[v]||(t[v]={}))[e]||[])[0]===b&&d[1]),!1===y)for(;(c=++h&&c&&c[g]||(y=h=0)||p.pop())&&(!(a?S(c,m):1===c.nodeType)||!++y||(A&&((u=c[v]||(c[v]={}))[e]=[b,y]),c!==t)););return(y-=r)===i||y%i==0&&y/i>=0}}},PSEUDO:function(e,n){var i,r=t.pseudos[e]||t.setFilters[e.toLowerCase()]||Q.error("unsupported pseudo: "+e);return r[v]?r(n):r.length>1?(i=[e,e,"",n],t.setFilters.hasOwnProperty(e.toLowerCase())?te((function(e,t){for(var i,s=r(e,n),o=s.length;o--;)e[i=u.call(e,s[o])]=!(t[i]=s[o])})):function(e){return r(e,0,i)}):r}},pseudos:{not:te((function(e){var t=[],n=[],i=ve(e.replace(j,"$1"));return i[v]?te((function(e,t,n,r){for(var s,o=i(e,null,r,[]),a=e.length;a--;)(s=o[a])&&(e[a]=!(t[a]=s))})):function(e,r,s){return t[0]=e,i(t,null,s,n),t[0]=null,!n.pop()}})),has:te((function(e){return function(t){return Q(e,t).length>0}})),contains:te((function(e){return e=e.replace(Y,J),function(t){return(t.textContent||x.text(t)).indexOf(e)>-1}})),lang:te((function(e){return H.test(e||"")||Q.error("unsupported lang: "+e),e=e.replace(Y,J).toLowerCase(),function(t){var n;do{if(n=c?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(e){var t=i.location&&i.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===d},focus:function(e){return e===function(){try{return l.activeElement}catch(e){}}()&&l.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:se(!1),disabled:se(!0),checked:function(e){return S(e,"input")&&!!e.checked||S(e,"option")&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!t.pseudos.empty(e)},header:function(e){return q.test(e.nodeName)},input:function(e){return $.test(e.nodeName)},button:function(e){return S(e,"input")&&"button"===e.type||S(e,"button")},text:function(e){var t;return S(e,"input")&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:oe((function(){return[0]})),last:oe((function(e,t){return[t-1]})),eq:oe((function(e,t,n){return[n<0?n+t:n]})),even:oe((function(e,t){for(var n=0;nt?t:n;--i>=0;)e.push(i);return e})),gt:oe((function(e,t,n){for(var i=n<0?n+t:n;++i1?function(t,n,i){for(var r=e.length;r--;)if(!e[r](t,n,i))return!1;return!0}:e[0]}function ge(e,t,n,i,r){for(var s,o=[],a=0,l=e.length,d=null!=t;a-1&&(s[d]=!(o[d]=h))}}else p=ge(p===o?p.splice(v,p.length):p),r?r(null,o,p,l):f.apply(o,p)}))}function me(e){for(var i,r,s,o=e.length,a=t.relative[e[0].type],l=a||t.relative[" "],d=a?1:0,c=he((function(e){return e===i}),l,!0),h=he((function(e){return u.call(i,e)>-1}),l,!0),p=[function(e,t,r){var s=!a&&(r||t!=n)||((i=t).nodeType?c(e,t,r):h(e,t,r));return i=null,s}];d1&&pe(p),d>1&&ce(e.slice(0,d-1).concat({value:" "===e[d-2].type?"*":""})).replace(j,"$1"),r,d0,s=e.length>0,o=function(o,a,d,u,h){var p,g,m,v=0,A="0",y=o&&[],_=[],w=n,C=o||s&&t.find.TAG("*",h),E=b+=null==w?1:Math.random()||.1,D=C.length;for(h&&(n=a==l||a||h);A!==D&&null!=(p=C[A]);A++){if(s&&p){for(g=0,a||p.ownerDocument==l||(le(p),d=!c);m=e[g++];)if(m(p,a||l,d)){f.call(u,p);break}h&&(b=E)}r&&((p=!m&&p)&&v--,o&&y.push(p))}if(v+=A,r&&A!==v){for(g=0;m=i[g++];)m(y,_,a,d);if(o){if(v>0)for(;A--;)y[A]||_[A]||(_[A]=T.call(u));_=ge(_)}f.apply(u,_),h&&!o&&_.length>0&&v+i.length>1&&x.uniqueSort(u)}return h&&(b=E,n=w),y};return r?te(o):o}(o,s)),a.selector=e}return a}function be(e,n,i,r){var s,o,a,l,d,u="function"==typeof e&&e,h=!r&&ue(e=u.selector||e);if(i=i||[],1===h.length){if((o=h[0]=h[0].slice(0)).length>2&&"ID"===(a=o[0]).type&&9===n.nodeType&&c&&t.relative[o[1].type]){if(!(n=(t.find.ID(a.matches[0].replace(Y,J),n)||[])[0]))return i;u&&(n=n.parentNode),e=e.slice(o.shift().value.length)}for(s=V.needsContext.test(e)?0:o.length;s--&&(a=o[s],!t.relative[l=a.type]);)if((d=t.find[l])&&(r=d(a.matches[0].replace(Y,J),K.test(o[0].type)&&ae(n.parentNode)||n))){if(o.splice(s,1),!(e=r.length&&ce(o)))return f.apply(i,r),i;break}}return(u||ve(e,h))(r,n,!c,i,!n||K.test(e)&&ae(n.parentNode)||n),i}de.prototype=t.filters=t.pseudos,t.setFilters=new de,m.sortStable=v.split("").sort(E).join("")===v,le(),m.sortDetached=ne((function(e){return 1&e.compareDocumentPosition(l.createElement("fieldset"))})),x.find=Q,x.expr[":"]=x.expr.pseudos,x.unique=x.uniqueSort,Q.compile=ve,Q.select=be,Q.setDocument=le,Q.tokenize=ue,Q.escape=x.escapeSelector,Q.getText=x.text,Q.isXML=x.isXMLDoc,Q.selectors=x.expr,Q.support=x.support,Q.uniqueSort=x.uniqueSort}();var L=function(e,t,n){for(var i=[],r=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(r&&x(e).is(n))break;i.push(e)}return i},N=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},F=x.expr.match.needsContext,z=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function U(e,t,n){return v(t)?x.grep(e,(function(e,i){return!!t.call(e,i,e)!==n})):t.nodeType?x.grep(e,(function(e){return e===t!==n})):"string"!=typeof t?x.grep(e,(function(e){return u.call(t,e)>-1!==n})):x.filter(t,e,n)}x.filter=function(e,t,n){var i=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?x.find.matchesSelector(i,e)?[i]:[]:x.find.matches(e,x.grep(t,(function(e){return 1===e.nodeType})))},x.fn.extend({find:function(e){var t,n,i=this.length,r=this;if("string"!=typeof e)return this.pushStack(x(e).filter((function(){for(t=0;t1?x.uniqueSort(n):n},filter:function(e){return this.pushStack(U(this,e||[],!1))},not:function(e){return this.pushStack(U(this,e||[],!0))},is:function(e){return!!U(this,"string"==typeof e&&F.test(e)?x(e):e||[],!1).length}});var W,H=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(x.fn.init=function(e,t,n){var i,r;if(!e)return this;if(n=n||W,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:H.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:A,!0)),z.test(i[1])&&x.isPlainObject(t))for(i in t)v(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(r=A.getElementById(i[2]))&&(this[0]=r,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(x):x.makeArray(e,this)}).prototype=x.fn,W=x(A);var V=/^(?:parents|prev(?:Until|All))/,$={children:!0,contents:!0,next:!0,prev:!0};function q(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}x.fn.extend({has:function(e){var t=x(e,this),n=t.length;return this.filter((function(){for(var e=0;e-1:1===n.nodeType&&x.find.matchesSelector(n,e))){s.push(n);break}return this.pushStack(s.length>1?x.uniqueSort(s):s)},index:function(e){return e?"string"==typeof e?u.call(x(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(x.uniqueSort(x.merge(this.get(),x(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return L(e,"parentNode")},parentsUntil:function(e,t,n){return L(e,"parentNode",n)},next:function(e){return q(e,"nextSibling")},prev:function(e){return q(e,"previousSibling")},nextAll:function(e){return L(e,"nextSibling")},prevAll:function(e){return L(e,"previousSibling")},nextUntil:function(e,t,n){return L(e,"nextSibling",n)},prevUntil:function(e,t,n){return L(e,"previousSibling",n)},siblings:function(e){return N((e.parentNode||{}).firstChild,e)},children:function(e){return N(e.firstChild)},contents:function(e){return null!=e.contentDocument&&o(e.contentDocument)?e.contentDocument:(S(e,"template")&&(e=e.content||e),x.merge([],e.childNodes))}},(function(e,t){x.fn[e]=function(n,i){var r=x.map(this,t,n);return"Until"!==e.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=x.filter(i,r)),this.length>1&&($[e]||x.uniqueSort(r),V.test(e)&&r.reverse()),this.pushStack(r)}}));var G=/[^\x20\t\r\n\f]+/g;function K(e){return e}function Y(e){throw e}function J(e,t,n,i){var r;try{e&&v(r=e.promise)?r.call(e).done(t).fail(n):e&&v(r=e.then)?r.call(e,t,n):t.apply(void 0,[e].slice(i))}catch(e){n.apply(void 0,[e])}}x.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return x.each(e.match(G)||[],(function(e,n){t[n]=!0})),t}(e):x.extend({},e);var t,n,i,r,s=[],o=[],a=-1,l=function(){for(r=r||e.once,i=t=!0;o.length;a=-1)for(n=o.shift();++a-1;)s.splice(n,1),n<=a&&a--})),this},has:function(e){return e?x.inArray(e,s)>-1:s.length>0},empty:function(){return s&&(s=[]),this},disable:function(){return r=o=[],s=n="",this},disabled:function(){return!s},lock:function(){return r=o=[],n||t||(s=n=""),this},locked:function(){return!!r},fireWith:function(e,n){return r||(n=[e,(n=n||[]).slice?n.slice():n],o.push(n),t||l()),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!i}};return d},x.extend({Deferred:function(e){var t=[["notify","progress",x.Callbacks("memory"),x.Callbacks("memory"),2],["resolve","done",x.Callbacks("once memory"),x.Callbacks("once memory"),0,"resolved"],["reject","fail",x.Callbacks("once memory"),x.Callbacks("once memory"),1,"rejected"]],n="pending",r={state:function(){return n},always:function(){return s.done(arguments).fail(arguments),this},catch:function(e){return r.then(null,e)},pipe:function(){var e=arguments;return x.Deferred((function(n){x.each(t,(function(t,i){var r=v(e[i[4]])&&e[i[4]];s[i[1]]((function(){var e=r&&r.apply(this,arguments);e&&v(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[i[0]+"With"](this,r?[e]:arguments)}))})),e=null})).promise()},then:function(e,n,r){var s=0;function o(e,t,n,r){return function(){var a=this,l=arguments,d=function(){var i,d;if(!(e=s&&(n!==Y&&(a=void 0,l=[i]),t.rejectWith(a,l))}};e?u():(x.Deferred.getErrorHook?u.error=x.Deferred.getErrorHook():x.Deferred.getStackHook&&(u.error=x.Deferred.getStackHook()),i.setTimeout(u))}}return x.Deferred((function(i){t[0][3].add(o(0,i,v(r)?r:K,i.notifyWith)),t[1][3].add(o(0,i,v(e)?e:K)),t[2][3].add(o(0,i,v(n)?n:Y))})).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},s={};return x.each(t,(function(e,i){var o=i[2],a=i[5];r[i[1]]=o.add,a&&o.add((function(){n=a}),t[3-e][2].disable,t[3-e][3].disable,t[0][2].lock,t[0][3].lock),o.add(i[3].fire),s[i[0]]=function(){return s[i[0]+"With"](this===s?void 0:this,arguments),this},s[i[0]+"With"]=o.fireWith})),r.promise(s),e&&e.call(s,s),s},when:function(e){var t=arguments.length,n=t,i=Array(n),r=a.call(arguments),s=x.Deferred(),o=function(e){return function(n){i[e]=this,r[e]=arguments.length>1?a.call(arguments):n,--t||s.resolveWith(i,r)}};if(t<=1&&(J(e,s.done(o(n)).resolve,s.reject,!t),"pending"===s.state()||v(r[n]&&r[n].then)))return s.then();for(;n--;)J(r[n],o(n),s.reject);return s.promise()}});var X=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;x.Deferred.exceptionHook=function(e,t){i.console&&i.console.warn&&e&&X.test(e.name)&&i.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},x.readyException=function(e){i.setTimeout((function(){throw e}))};var Z=x.Deferred();function Q(){A.removeEventListener("DOMContentLoaded",Q),i.removeEventListener("load",Q),x.ready()}x.fn.ready=function(e){return Z.then(e).catch((function(e){x.readyException(e)})),this},x.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--x.readyWait:x.isReady)||(x.isReady=!0,!0!==e&&--x.readyWait>0||Z.resolveWith(A,[x]))}}),x.ready.then=Z.then,"complete"===A.readyState||"loading"!==A.readyState&&!A.documentElement.doScroll?i.setTimeout(x.ready):(A.addEventListener("DOMContentLoaded",Q),i.addEventListener("load",Q));var ee=function(e,t,n,i,r,s,o){var a=0,l=e.length,d=null==n;if("object"===w(n))for(a in r=!0,n)ee(e,t,a,n[a],!0,s,o);else if(void 0!==i&&(r=!0,v(i)||(o=!0),d&&(o?(t.call(e,i),t=null):(d=t,t=function(e,t,n){return d.call(x(e),n)})),t))for(;a1,null,!0)},removeData:function(e){return this.each((function(){le.remove(this,e)}))}}),x.extend({queue:function(e,t,n){var i;if(e)return t=(t||"fx")+"queue",i=ae.get(e,t),n&&(!i||Array.isArray(n)?i=ae.access(e,t,x.makeArray(n)):i.push(n)),i||[]},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),i=n.length,r=n.shift(),s=x._queueHooks(e,t);"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===t&&n.unshift("inprogress"),delete s.stop,r.call(e,(function(){x.dequeue(e,t)}),s)),!i&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return ae.get(e,n)||ae.access(e,n,{empty:x.Callbacks("once memory").add((function(){ae.remove(e,[t+"queue",n])}))})}}),x.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]*)/i,Se=/^$|^module$|\/(?:java|ecma)script/i;Ce=A.createDocumentFragment().appendChild(A.createElement("div")),(Ee=A.createElement("input")).setAttribute("type","radio"),Ee.setAttribute("checked","checked"),Ee.setAttribute("name","t"),Ce.appendChild(Ee),m.checkClone=Ce.cloneNode(!0).cloneNode(!0).lastChild.checked,Ce.innerHTML="",m.noCloneChecked=!!Ce.cloneNode(!0).lastChild.defaultValue,Ce.innerHTML="",m.option=!!Ce.lastChild;var Te={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ke(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&S(e,t)?x.merge([e],n):n}function Be(e,t){for(var n=0,i=e.length;n",""]);var Me=/<|&#?\w+;/;function je(e,t,n,i,r){for(var s,o,a,l,d,u,c=t.createDocumentFragment(),h=[],p=0,g=e.length;p-1)r&&r.push(s);else if(d=me(s),o=ke(c.appendChild(s),"script"),d&&Be(o),n)for(u=0;s=o[u++];)Se.test(s.type||"")&&n.push(s);return c}var Oe=/^([^.]*)(?:\.(.+)|)/;function Ie(){return!0}function Pe(){return!1}function Re(e,t,n,i,r,s){var o,a;if("object"==typeof t){for(a in"string"!=typeof n&&(i=i||n,n=void 0),t)Re(e,a,n,i,t[a],s);return e}if(null==i&&null==r?(r=n,i=n=void 0):null==r&&("string"==typeof n?(r=i,i=void 0):(r=i,i=n,n=void 0)),!1===r)r=Pe;else if(!r)return e;return 1===s&&(o=r,r=function(e){return x().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=x.guid++)),e.each((function(){x.event.add(this,t,r,i,n)}))}function Le(e,t,n){n?(ae.set(e,t,!1),x.event.add(e,t,{namespace:!1,handler:function(e){var n,i=ae.get(this,t);if(1&e.isTrigger&&this[t]){if(i)(x.event.special[t]||{}).delegateType&&e.stopPropagation();else if(i=a.call(arguments),ae.set(this,t,i),this[t](),n=ae.get(this,t),ae.set(this,t,!1),i!==n)return e.stopImmediatePropagation(),e.preventDefault(),n}else i&&(ae.set(this,t,x.event.trigger(i[0],i.slice(1),this)),e.stopPropagation(),e.isImmediatePropagationStopped=Ie)}})):void 0===ae.get(e,t)&&x.event.add(e,t,Ie)}x.event={global:{},add:function(e,t,n,i,r){var s,o,a,l,d,u,c,h,p,g,f,m=ae.get(e);if(se(e))for(n.handler&&(n=(s=n).handler,r=s.selector),r&&x.find.matchesSelector(fe,r),n.guid||(n.guid=x.guid++),(l=m.events)||(l=m.events=Object.create(null)),(o=m.handle)||(o=m.handle=function(t){return void 0!==x&&x.event.triggered!==t.type?x.event.dispatch.apply(e,arguments):void 0}),d=(t=(t||"").match(G)||[""]).length;d--;)p=f=(a=Oe.exec(t[d])||[])[1],g=(a[2]||"").split(".").sort(),p&&(c=x.event.special[p]||{},p=(r?c.delegateType:c.bindType)||p,c=x.event.special[p]||{},u=x.extend({type:p,origType:f,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&x.expr.match.needsContext.test(r),namespace:g.join(".")},s),(h=l[p])||((h=l[p]=[]).delegateCount=0,c.setup&&!1!==c.setup.call(e,i,g,o)||e.addEventListener&&e.addEventListener(p,o)),c.add&&(c.add.call(e,u),u.handler.guid||(u.handler.guid=n.guid)),r?h.splice(h.delegateCount++,0,u):h.push(u),x.event.global[p]=!0)},remove:function(e,t,n,i,r){var s,o,a,l,d,u,c,h,p,g,f,m=ae.hasData(e)&&ae.get(e);if(m&&(l=m.events)){for(d=(t=(t||"").match(G)||[""]).length;d--;)if(p=f=(a=Oe.exec(t[d])||[])[1],g=(a[2]||"").split(".").sort(),p){for(c=x.event.special[p]||{},h=l[p=(i?c.delegateType:c.bindType)||p]||[],a=a[2]&&new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=h.length;s--;)u=h[s],!r&&f!==u.origType||n&&n.guid!==u.guid||a&&!a.test(u.namespace)||i&&i!==u.selector&&("**"!==i||!u.selector)||(h.splice(s,1),u.selector&&h.delegateCount--,c.remove&&c.remove.call(e,u));o&&!h.length&&(c.teardown&&!1!==c.teardown.call(e,g,m.handle)||x.removeEvent(e,p,m.handle),delete l[p])}else for(p in l)x.event.remove(e,p+t[d],n,i,!0);x.isEmptyObject(l)&&ae.remove(e,"handle events")}},dispatch:function(e){var t,n,i,r,s,o,a=new Array(arguments.length),l=x.event.fix(e),d=(ae.get(this,"events")||Object.create(null))[l.type]||[],u=x.event.special[l.type]||{};for(a[0]=l,t=1;t=1))for(;d!==this;d=d.parentNode||this)if(1===d.nodeType&&("click"!==e.type||!0!==d.disabled)){for(s=[],o={},n=0;n-1:x.find(r,this,null,[d]).length),o[r]&&s.push(i);s.length&&a.push({elem:d,handlers:s})}return d=this,l\s*$/g;function Ue(e,t){return S(e,"table")&&S(11!==t.nodeType?t:t.firstChild,"tr")&&x(e).children("tbody")[0]||e}function We(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Ve(e,t){var n,i,r,s,o,a;if(1===t.nodeType){if(ae.hasData(e)&&(a=ae.get(e).events))for(r in ae.remove(t,"handle events"),a)for(n=0,i=a[r].length;n1&&"string"==typeof g&&!m.checkClone&&Fe.test(g))return e.each((function(r){var s=e.eq(r);f&&(t[0]=g.call(this,r,s.html())),qe(s,t,n,i)}));if(h&&(s=(r=je(t,e[0].ownerDocument,!1,e,i)).firstChild,1===r.childNodes.length&&(r=s),s||i)){for(a=(o=x.map(ke(r,"script"),We)).length;c0&&Be(o,!l&&ke(e,"script")),a},cleanData:function(e){for(var t,n,i,r=x.event.special,s=0;void 0!==(n=e[s]);s++)if(se(n)){if(t=n[ae.expando]){if(t.events)for(i in t.events)r[i]?x.event.remove(n,i):x.removeEvent(n,i,t.handle);n[ae.expando]=void 0}n[le.expando]&&(n[le.expando]=void 0)}}}),x.fn.extend({detach:function(e){return Ge(this,e,!0)},remove:function(e){return Ge(this,e)},text:function(e){return ee(this,(function(e){return void 0===e?x.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return qe(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Ue(this,e).appendChild(e)}))},prepend:function(){return qe(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Ue(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return qe(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return qe(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(x.cleanData(ke(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return x.clone(this,e,t)}))},html:function(e){return ee(this,(function(e){var t=this[0]||{},n=0,i=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ne.test(e)&&!Te[(De.exec(e)||["",""])[1].toLowerCase()]){e=x.htmlPrefilter(e);try{for(;n=0&&(l+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-s-l-a-.5))||0),l+d}function ut(e,t,n){var i=Je(e),r=(!m.boxSizingReliable()||n)&&"border-box"===x.css(e,"boxSizing",!1,i),s=r,o=Qe(e,t,i),a="offset"+t[0].toUpperCase()+t.slice(1);if(Ke.test(o)){if(!n)return o;o="auto"}return(!m.boxSizingReliable()&&r||!m.reliableTrDimensions()&&S(e,"tr")||"auto"===o||!parseFloat(o)&&"inline"===x.css(e,"display",!1,i))&&e.getClientRects().length&&(r="border-box"===x.css(e,"boxSizing",!1,i),(s=a in e)&&(o=e[a])),(o=parseFloat(o)||0)+dt(e,t,n||(r?"border":"content"),s,i,o)+"px"}function ct(e,t,n,i,r){return new ct.prototype.init(e,t,n,i,r)}x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Qe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,n,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var r,s,o,a=re(t),l=Ye.test(t),d=e.style;if(l||(t=rt(a)),o=x.cssHooks[t]||x.cssHooks[a],void 0===n)return o&&"get"in o&&void 0!==(r=o.get(e,!1,i))?r:d[t];"string"==(s=typeof n)&&(r=pe.exec(n))&&r[1]&&(n=Ae(e,t,r),s="number"),null!=n&&n==n&&("number"!==s||l||(n+=r&&r[3]||(x.cssNumber[a]?"":"px")),m.clearCloneStyle||""!==n||0!==t.indexOf("background")||(d[t]="inherit"),o&&"set"in o&&void 0===(n=o.set(e,n,i))||(l?d.setProperty(t,n):d[t]=n))}},css:function(e,t,n,i){var r,s,o,a=re(t);return Ye.test(t)||(t=rt(a)),(o=x.cssHooks[t]||x.cssHooks[a])&&"get"in o&&(r=o.get(e,!0,n)),void 0===r&&(r=Qe(e,t,i)),"normal"===r&&t in at&&(r=at[t]),""===n||n?(s=parseFloat(r),!0===n||isFinite(s)?s||0:r):r}}),x.each(["height","width"],(function(e,t){x.cssHooks[t]={get:function(e,n,i){if(n)return!st.test(x.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?ut(e,t,i):Xe(e,ot,(function(){return ut(e,t,i)}))},set:function(e,n,i){var r,s=Je(e),o=!m.scrollboxSize()&&"absolute"===s.position,a=(o||i)&&"border-box"===x.css(e,"boxSizing",!1,s),l=i?dt(e,t,i,a,s):0;return a&&o&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(s[t])-dt(e,t,"border",!1,s)-.5)),l&&(r=pe.exec(n))&&"px"!==(r[3]||"px")&&(e.style[t]=n,n=x.css(e,t)),lt(0,n,l)}}})),x.cssHooks.marginLeft=et(m.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(Qe(e,"marginLeft"))||e.getBoundingClientRect().left-Xe(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),x.each({margin:"",padding:"",border:"Width"},(function(e,t){x.cssHooks[e+t]={expand:function(n){for(var i=0,r={},s="string"==typeof n?n.split(" "):[n];i<4;i++)r[e+ge[i]+t]=s[i]||s[i-2]||s[0];return r}},"margin"!==e&&(x.cssHooks[e+t].set=lt)})),x.fn.extend({css:function(e,t){return ee(this,(function(e,t,n){var i,r,s={},o=0;if(Array.isArray(t)){for(i=Je(e),r=t.length;o1)}}),x.Tween=ct,ct.prototype={constructor:ct,init:function(e,t,n,i,r,s){this.elem=e,this.prop=n,this.easing=r||x.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=i,this.unit=s||(x.cssNumber[n]?"":"px")},cur:function(){var e=ct.propHooks[this.prop];return e&&e.get?e.get(this):ct.propHooks._default.get(this)},run:function(e){var t,n=ct.propHooks[this.prop];return this.options.duration?this.pos=t=x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):ct.propHooks._default.set(this),this}},ct.prototype.init.prototype=ct.prototype,ct.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=x.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):1!==e.elem.nodeType||!x.cssHooks[e.prop]&&null==e.elem.style[rt(e.prop)]?e.elem[e.prop]=e.now:x.style(e.elem,e.prop,e.now+e.unit)}}},ct.propHooks.scrollTop=ct.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},x.fx=ct.prototype.init,x.fx.step={};var ht,pt,gt=/^(?:toggle|show|hide)$/,ft=/queueHooks$/;function mt(){pt&&(!1===A.hidden&&i.requestAnimationFrame?i.requestAnimationFrame(mt):i.setTimeout(mt,x.fx.interval),x.fx.tick())}function vt(){return i.setTimeout((function(){ht=void 0})),ht=Date.now()}function bt(e,t){var n,i=0,r={height:e};for(t=t?1:0;i<4;i+=2-t)r["margin"+(n=ge[i])]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function At(e,t,n){for(var i,r=(yt.tweeners[t]||[]).concat(yt.tweeners["*"]),s=0,o=r.length;s1)},removeAttr:function(e){return this.each((function(){x.removeAttr(this,e)}))}}),x.extend({attr:function(e,t,n){var i,r,s=e.nodeType;if(3!==s&&8!==s&&2!==s)return void 0===e.getAttribute?x.prop(e,t,n):(1===s&&x.isXMLDoc(e)||(r=x.attrHooks[t.toLowerCase()]||(x.expr.match.bool.test(t)?_t:void 0)),void 0!==n?null===n?void x.removeAttr(e,t):r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:(e.setAttribute(t,n+""),n):r&&"get"in r&&null!==(i=r.get(e,t))?i:null==(i=x.find.attr(e,t))?void 0:i)},attrHooks:{type:{set:function(e,t){if(!m.radioValue&&"radio"===t&&S(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,i=0,r=t&&t.match(G);if(r&&1===e.nodeType)for(;n=r[i++];)e.removeAttribute(n)}}),_t={set:function(e,t,n){return!1===t?x.removeAttr(e,n):e.setAttribute(n,n),n}},x.each(x.expr.match.bool.source.match(/\w+/g),(function(e,t){var n=wt[t]||x.find.attr;wt[t]=function(e,t,i){var r,s,o=t.toLowerCase();return i||(s=wt[o],wt[o]=r,r=null!=n(e,t,i)?o:null,wt[o]=s),r}}));var Ct=/^(?:input|select|textarea|button)$/i,Et=/^(?:a|area)$/i;function xt(e){return(e.match(G)||[]).join(" ")}function Dt(e){return e.getAttribute&&e.getAttribute("class")||""}function St(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(G)||[]}x.fn.extend({prop:function(e,t){return ee(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[x.propFix[e]||e]}))}}),x.extend({prop:function(e,t,n){var i,r,s=e.nodeType;if(3!==s&&8!==s&&2!==s)return 1===s&&x.isXMLDoc(e)||(t=x.propFix[t]||t,r=x.propHooks[t]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:e[t]=n:r&&"get"in r&&null!==(i=r.get(e,t))?i:e[t]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Ct.test(e.nodeName)||Et.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),m.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){x.propFix[this.toLowerCase()]=this})),x.fn.extend({addClass:function(e){var t,n,i,r,s,o;return v(e)?this.each((function(t){x(this).addClass(e.call(this,t,Dt(this)))})):(t=St(e)).length?this.each((function(){if(i=Dt(this),n=1===this.nodeType&&" "+xt(i)+" "){for(s=0;s-1;)n=n.replace(" "+r+" "," ");o=xt(n),i!==o&&this.setAttribute("class",o)}})):this:this.attr("class","")},toggleClass:function(e,t){var n,i,r,s,o=typeof e,a="string"===o||Array.isArray(e);return v(e)?this.each((function(n){x(this).toggleClass(e.call(this,n,Dt(this),t),t)})):"boolean"==typeof t&&a?t?this.addClass(e):this.removeClass(e):(n=St(e),this.each((function(){if(a)for(s=x(this),r=0;r-1)return!0;return!1}});var Tt=/\r/g;x.fn.extend({val:function(e){var t,n,i,r=this[0];return arguments.length?(i=v(e),this.each((function(n){var r;1===this.nodeType&&(null==(r=i?e.call(this,n,x(this).val()):e)?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=x.map(r,(function(e){return null==e?"":e+""}))),(t=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,r,"value")||(this.value=r))}))):r?(t=x.valHooks[r.type]||x.valHooks[r.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(r,"value"))?n:"string"==typeof(n=r.value)?n.replace(Tt,""):null==n?"":n:void 0}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:xt(x.text(e))}},select:{get:function(e){var t,n,i,r=e.options,s=e.selectedIndex,o="select-one"===e.type,a=o?null:[],l=o?s+1:r.length;for(i=s<0?l:o?s:0;i-1)&&(n=!0);return n||(e.selectedIndex=-1),s}}}}),x.each(["radio","checkbox"],(function(){x.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=x.inArray(x(e).val(),t)>-1}},m.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}));var kt=i.location,Bt={guid:Date.now()},Mt=/\?/;x.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new i.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||x.error("Invalid XML: "+(n?x.map(n.childNodes,(function(e){return e.textContent})).join("\n"):e)),t};var jt=/^(?:focusinfocus|focusoutblur)$/,Ot=function(e){e.stopPropagation()};x.extend(x.event,{trigger:function(e,t,n,r){var s,o,a,l,d,u,c,h,g=[n||A],f=p.call(e,"type")?e.type:e,m=p.call(e,"namespace")?e.namespace.split("."):[];if(o=h=a=n=n||A,3!==n.nodeType&&8!==n.nodeType&&!jt.test(f+x.event.triggered)&&(f.indexOf(".")>-1&&(m=f.split("."),f=m.shift(),m.sort()),d=f.indexOf(":")<0&&"on"+f,(e=e[x.expando]?e:new x.Event(f,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=m.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:x.makeArray(t,[e]),c=x.event.special[f]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!b(n)){for(l=c.delegateType||f,jt.test(l+f)||(o=o.parentNode);o;o=o.parentNode)g.push(o),a=o;a===(n.ownerDocument||A)&&g.push(a.defaultView||a.parentWindow||i)}for(s=0;(o=g[s++])&&!e.isPropagationStopped();)h=o,e.type=s>1?l:c.bindType||f,(u=(ae.get(o,"events")||Object.create(null))[e.type]&&ae.get(o,"handle"))&&u.apply(o,t),(u=d&&o[d])&&u.apply&&se(o)&&(e.result=u.apply(o,t),!1===e.result&&e.preventDefault());return e.type=f,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(g.pop(),t)||!se(n)||d&&v(n[f])&&!b(n)&&((a=n[d])&&(n[d]=null),x.event.triggered=f,e.isPropagationStopped()&&h.addEventListener(f,Ot),n[f](),e.isPropagationStopped()&&h.removeEventListener(f,Ot),x.event.triggered=void 0,a&&(n[d]=a)),e.result}},simulate:function(e,t,n){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0});x.event.trigger(i,null,t)}}),x.fn.extend({trigger:function(e,t){return this.each((function(){x.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return x.event.trigger(e,t,n,!0)}});var It=/\[\]$/,Pt=/\r?\n/g,Rt=/^(?:submit|button|image|reset|file)$/i,Lt=/^(?:input|select|textarea|keygen)/i;function Nt(e,t,n,i){var r;if(Array.isArray(t))x.each(t,(function(t,r){n||It.test(e)?i(e,r):Nt(e+"["+("object"==typeof r&&null!=r?t:"")+"]",r,n,i)}));else if(n||"object"!==w(t))i(e,t);else for(r in t)Nt(e+"["+r+"]",t[r],n,i)}x.param=function(e,t){var n,i=[],r=function(e,t){var n=v(t)?t():t;i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,(function(){r(this.name,this.value)}));else for(n in e)Nt(n,e[n],t,r);return i.join("&")},x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&Lt.test(this.nodeName)&&!Rt.test(e)&&(this.checked||!xe.test(e))})).map((function(e,t){var n=x(this).val();return null==n?null:Array.isArray(n)?x.map(n,(function(e){return{name:t.name,value:e.replace(Pt,"\r\n")}})):{name:t.name,value:n.replace(Pt,"\r\n")}})).get()}});var Ft=/%20/g,zt=/#.*$/,Ut=/([?&])_=[^&]*/,Wt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ht=/^(?:GET|HEAD)$/,Vt=/^\/\//,$t={},qt={},Gt="*/".concat("*"),Kt=A.createElement("a");function Yt(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var i,r=0,s=t.toLowerCase().match(G)||[];if(v(n))for(;i=s[r++];)"+"===i[0]?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(n)):(e[i]=e[i]||[]).push(n)}}function Jt(e,t,n,i){var r={},s=e===qt;function o(a){var l;return r[a]=!0,x.each(e[a]||[],(function(e,a){var d=a(t,n,i);return"string"!=typeof d||s||r[d]?s?!(l=d):void 0:(t.dataTypes.unshift(d),o(d),!1)})),l}return o(t.dataTypes[0])||!r["*"]&&o("*")}function Xt(e,t){var n,i,r=x.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((r[n]?e:i||(i={}))[n]=t[n]);return i&&x.extend(!0,e,i),e}Kt.href=kt.href,x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:kt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(kt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Gt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Xt(Xt(e,x.ajaxSettings),t):Xt(x.ajaxSettings,e)},ajaxPrefilter:Yt($t),ajaxTransport:Yt(qt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n,r,s,o,a,l,d,u,c,h,p=x.ajaxSetup({},t),g=p.context||p,f=p.context&&(g.nodeType||g.jquery)?x(g):x.event,m=x.Deferred(),v=x.Callbacks("once memory"),b=p.statusCode||{},y={},_={},w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(d){if(!o)for(o={};t=Wt.exec(s);)o[t[1].toLowerCase()+" "]=(o[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=o[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return d?s:null},setRequestHeader:function(e,t){return null==d&&(e=_[e.toLowerCase()]=_[e.toLowerCase()]||e,y[e]=t),this},overrideMimeType:function(e){return null==d&&(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(d)C.always(e[C.status]);else for(t in e)b[t]=[b[t],e[t]];return this},abort:function(e){var t=e||w;return n&&n.abort(t),E(0,t),this}};if(m.promise(C),p.url=((e||p.url||kt.href)+"").replace(Vt,kt.protocol+"//"),p.type=t.method||t.type||p.method||p.type,p.dataTypes=(p.dataType||"*").toLowerCase().match(G)||[""],null==p.crossDomain){l=A.createElement("a");try{l.href=p.url,l.href=l.href,p.crossDomain=Kt.protocol+"//"+Kt.host!=l.protocol+"//"+l.host}catch(e){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),Jt($t,p,t,C),d)return C;for(c in(u=x.event&&p.global)&&0==x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Ht.test(p.type),r=p.url.replace(zt,""),p.hasContent?p.data&&p.processData&&0===(p.contentType||"").indexOf("application/x-www-form-urlencoded")&&(p.data=p.data.replace(Ft,"+")):(h=p.url.slice(r.length),p.data&&(p.processData||"string"==typeof p.data)&&(r+=(Mt.test(r)?"&":"?")+p.data,delete p.data),!1===p.cache&&(r=r.replace(Ut,"$1"),h=(Mt.test(r)?"&":"?")+"_="+Bt.guid+++h),p.url=r+h),p.ifModified&&(x.lastModified[r]&&C.setRequestHeader("If-Modified-Since",x.lastModified[r]),x.etag[r]&&C.setRequestHeader("If-None-Match",x.etag[r])),(p.data&&p.hasContent&&!1!==p.contentType||t.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Gt+"; q=0.01":""):p.accepts["*"]),p.headers)C.setRequestHeader(c,p.headers[c]);if(p.beforeSend&&(!1===p.beforeSend.call(g,C,p)||d))return C.abort();if(w="abort",v.add(p.complete),C.done(p.success),C.fail(p.error),n=Jt(qt,p,t,C)){if(C.readyState=1,u&&f.trigger("ajaxSend",[C,p]),d)return C;p.async&&p.timeout>0&&(a=i.setTimeout((function(){C.abort("timeout")}),p.timeout));try{d=!1,n.send(y,E)}catch(e){if(d)throw e;E(-1,e)}}else E(-1,"No Transport");function E(e,t,o,l){var c,h,A,y,_,w=t;d||(d=!0,a&&i.clearTimeout(a),n=void 0,s=l||"",C.readyState=e>0?4:0,c=e>=200&&e<300||304===e,o&&(y=function(e,t,n){for(var i,r,s,o,a=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===i&&(i=e.mimeType||t.getResponseHeader("Content-Type"));if(i)for(r in a)if(a[r]&&a[r].test(i)){l.unshift(r);break}if(l[0]in n)s=l[0];else{for(r in n){if(!l[0]||e.converters[r+" "+l[0]]){s=r;break}o||(o=r)}s=s||o}if(s)return s!==l[0]&&l.unshift(s),n[s]}(p,C,o)),!c&&x.inArray("script",p.dataTypes)>-1&&x.inArray("json",p.dataTypes)<0&&(p.converters["text script"]=function(){}),y=function(e,t,n,i){var r,s,o,a,l,d={},u=e.dataTypes.slice();if(u[1])for(o in e.converters)d[o.toLowerCase()]=e.converters[o];for(s=u.shift();s;)if(e.responseFields[s]&&(n[e.responseFields[s]]=t),!l&&i&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=s,s=u.shift())if("*"===s)s=l;else if("*"!==l&&l!==s){if(!(o=d[l+" "+s]||d["* "+s]))for(r in d)if((a=r.split(" "))[1]===s&&(o=d[l+" "+a[0]]||d["* "+a[0]])){!0===o?o=d[r]:!0!==d[r]&&(s=a[0],u.unshift(a[1]));break}if(!0!==o)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(e){return{state:"parsererror",error:o?e:"No conversion from "+l+" to "+s}}}return{state:"success",data:t}}(p,y,C,c),c?(p.ifModified&&((_=C.getResponseHeader("Last-Modified"))&&(x.lastModified[r]=_),(_=C.getResponseHeader("etag"))&&(x.etag[r]=_)),204===e||"HEAD"===p.type?w="nocontent":304===e?w="notmodified":(w=y.state,h=y.data,c=!(A=y.error))):(A=w,!e&&w||(w="error",e<0&&(e=0))),C.status=e,C.statusText=(t||w)+"",c?m.resolveWith(g,[h,w,C]):m.rejectWith(g,[C,w,A]),C.statusCode(b),b=void 0,u&&f.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?h:A]),v.fireWith(g,[C,w]),u&&(f.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,t){return x.get(e,void 0,t,"script")}}),x.each(["get","post"],(function(e,t){x[t]=function(e,n,i,r){return v(n)&&(r=r||i,i=n,n=void 0),x.ajax(x.extend({url:e,type:t,dataType:r,data:n,success:i},x.isPlainObject(e)&&e))}})),x.ajaxPrefilter((function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")})),x._evalUrl=function(e,t,n){return x.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){x.globalEval(e,t,n)}})},x.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=x(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return v(e)?this.each((function(t){x(this).wrapInner(e.call(this,t))})):this.each((function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=v(e);return this.each((function(n){x(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){x(this).replaceWith(this.childNodes)})),this}}),x.expr.pseudos.hidden=function(e){return!x.expr.pseudos.visible(e)},x.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},x.ajaxSettings.xhr=function(){try{return new i.XMLHttpRequest}catch(e){}};var Zt={0:200,1223:204},Qt=x.ajaxSettings.xhr();m.cors=!!Qt&&"withCredentials"in Qt,m.ajax=Qt=!!Qt,x.ajaxTransport((function(e){var t,n;if(m.cors||Qt&&!e.crossDomain)return{send:function(r,s){var o,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)a[o]=e.xhrFields[o];for(o in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)a.setRequestHeader(o,r[o]);t=function(e){return function(){t&&(t=n=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===e?a.abort():"error"===e?"number"!=typeof a.status?s(0,"error"):s(a.status,a.statusText):s(Zt[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=t(),n=a.onerror=a.ontimeout=t("error"),void 0!==a.onabort?a.onabort=n:a.onreadystatechange=function(){4===a.readyState&&i.setTimeout((function(){t&&n()}))},t=t("abort");try{a.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}})),x.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),x.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(i,r){t=x("`.\n this.sequenceIndex = Number(c === CharCodes.Lt);\n }\n };\n Tokenizer.prototype.stateCDATASequence = function (c) {\n if (c === Sequences.Cdata[this.sequenceIndex]) {\n if (++this.sequenceIndex === Sequences.Cdata.length) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CdataEnd;\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n }\n }\n else {\n this.sequenceIndex = 0;\n this.state = State.InDeclaration;\n this.stateInDeclaration(c); // Reconsume the character\n }\n };\n /**\n * When we wait for one specific character, we can speed things up\n * by skipping through the buffer until we find it.\n *\n * @returns Whether the character was found.\n */\n Tokenizer.prototype.fastForwardTo = function (c) {\n while (++this.index < this.buffer.length + this.offset) {\n if (this.buffer.charCodeAt(this.index - this.offset) === c) {\n return true;\n }\n }\n /*\n * We increment the index at the end of the `parse` loop,\n * so set it to `buffer.length - 1` here.\n *\n * TODO: Refactor `parse` to increment index before calling states.\n */\n this.index = this.buffer.length + this.offset - 1;\n return false;\n };\n /**\n * Comments and CDATA end with `-->` and `]]>`.\n *\n * Their common qualities are:\n * - Their end sequences have a distinct character they start with.\n * - That character is then repeated, so we have to check multiple repeats.\n * - All characters but the start character of the sequence can be skipped.\n */\n Tokenizer.prototype.stateInCommentLike = function (c) {\n if (c === this.currentSequence[this.sequenceIndex]) {\n if (++this.sequenceIndex === this.currentSequence.length) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, this.index, 2);\n }\n else {\n this.cbs.oncomment(this.sectionStart, this.index, 2);\n }\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n this.state = State.Text;\n }\n }\n else if (this.sequenceIndex === 0) {\n // Fast-forward to the first character of the sequence\n if (this.fastForwardTo(this.currentSequence[0])) {\n this.sequenceIndex = 1;\n }\n }\n else if (c !== this.currentSequence[this.sequenceIndex - 1]) {\n // Allow long sequences, eg. --->, ]]]>\n this.sequenceIndex = 0;\n }\n };\n /**\n * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.\n *\n * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).\n * We allow anything that wouldn't end the tag.\n */\n Tokenizer.prototype.isTagStartChar = function (c) {\n return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);\n };\n Tokenizer.prototype.startSpecial = function (sequence, offset) {\n this.isSpecial = true;\n this.currentSequence = sequence;\n this.sequenceIndex = offset;\n this.state = State.SpecialStartSequence;\n };\n Tokenizer.prototype.stateBeforeTagName = function (c) {\n if (c === CharCodes.ExclamationMark) {\n this.state = State.BeforeDeclaration;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Questionmark) {\n this.state = State.InProcessingInstruction;\n this.sectionStart = this.index + 1;\n }\n else if (this.isTagStartChar(c)) {\n var lower = c | 0x20;\n this.sectionStart = this.index;\n if (!this.xmlMode && lower === Sequences.TitleEnd[2]) {\n this.startSpecial(Sequences.TitleEnd, 3);\n }\n else {\n this.state =\n !this.xmlMode && lower === Sequences.ScriptEnd[2]\n ? State.BeforeSpecialS\n : State.InTagName;\n }\n }\n else if (c === CharCodes.Slash) {\n this.state = State.BeforeClosingTagName;\n }\n else {\n this.state = State.Text;\n this.stateText(c);\n }\n };\n Tokenizer.prototype.stateInTagName = function (c) {\n if (isEndOfTagSection(c)) {\n this.cbs.onopentagname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n };\n Tokenizer.prototype.stateBeforeClosingTagName = function (c) {\n if (isWhitespace(c)) {\n // Ignore\n }\n else if (c === CharCodes.Gt) {\n this.state = State.Text;\n }\n else {\n this.state = this.isTagStartChar(c)\n ? State.InClosingTagName\n : State.InSpecialComment;\n this.sectionStart = this.index;\n }\n };\n Tokenizer.prototype.stateInClosingTagName = function (c) {\n if (c === CharCodes.Gt || isWhitespace(c)) {\n this.cbs.onclosetag(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterClosingTagName;\n this.stateAfterClosingTagName(c);\n }\n };\n Tokenizer.prototype.stateAfterClosingTagName = function (c) {\n // Skip everything until \">\"\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.state = State.Text;\n this.baseState = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeAttributeName = function (c) {\n if (c === CharCodes.Gt) {\n this.cbs.onopentagend(this.index);\n if (this.isSpecial) {\n this.state = State.InSpecialTag;\n this.sequenceIndex = 0;\n }\n else {\n this.state = State.Text;\n }\n this.baseState = this.state;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Slash) {\n this.state = State.InSelfClosingTag;\n }\n else if (!isWhitespace(c)) {\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n };\n Tokenizer.prototype.stateInSelfClosingTag = function (c) {\n if (c === CharCodes.Gt) {\n this.cbs.onselfclosingtag(this.index);\n this.state = State.Text;\n this.baseState = State.Text;\n this.sectionStart = this.index + 1;\n this.isSpecial = false; // Reset special state, in case of self-closing special tags\n }\n else if (!isWhitespace(c)) {\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n };\n Tokenizer.prototype.stateInAttributeName = function (c) {\n if (c === CharCodes.Eq || isEndOfTagSection(c)) {\n this.cbs.onattribname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterAttributeName;\n this.stateAfterAttributeName(c);\n }\n };\n Tokenizer.prototype.stateAfterAttributeName = function (c) {\n if (c === CharCodes.Eq) {\n this.state = State.BeforeAttributeValue;\n }\n else if (c === CharCodes.Slash || c === CharCodes.Gt) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (!isWhitespace(c)) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n };\n Tokenizer.prototype.stateBeforeAttributeValue = function (c) {\n if (c === CharCodes.DoubleQuote) {\n this.state = State.InAttributeValueDq;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.SingleQuote) {\n this.state = State.InAttributeValueSq;\n this.sectionStart = this.index + 1;\n }\n else if (!isWhitespace(c)) {\n this.sectionStart = this.index;\n this.state = State.InAttributeValueNq;\n this.stateInAttributeValueNoQuotes(c); // Reconsume token\n }\n };\n Tokenizer.prototype.handleInAttributeValue = function (c, quote) {\n if (c === quote ||\n (!this.decodeEntities && this.fastForwardTo(quote))) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(quote === CharCodes.DoubleQuote\n ? QuoteType.Double\n : QuoteType.Single, this.index);\n this.state = State.BeforeAttributeName;\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n };\n Tokenizer.prototype.stateInAttributeValueDoubleQuotes = function (c) {\n this.handleInAttributeValue(c, CharCodes.DoubleQuote);\n };\n Tokenizer.prototype.stateInAttributeValueSingleQuotes = function (c) {\n this.handleInAttributeValue(c, CharCodes.SingleQuote);\n };\n Tokenizer.prototype.stateInAttributeValueNoQuotes = function (c) {\n if (isWhitespace(c) || c === CharCodes.Gt) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(QuoteType.Unquoted, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n };\n Tokenizer.prototype.stateBeforeDeclaration = function (c) {\n if (c === CharCodes.OpeningSquareBracket) {\n this.state = State.CDATASequence;\n this.sequenceIndex = 0;\n }\n else {\n this.state =\n c === CharCodes.Dash\n ? State.BeforeComment\n : State.InDeclaration;\n }\n };\n Tokenizer.prototype.stateInDeclaration = function (c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.ondeclaration(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateInProcessingInstruction = function (c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.onprocessinginstruction(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeComment = function (c) {\n if (c === CharCodes.Dash) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CommentEnd;\n // Allow short comments (eg. )\n this.sequenceIndex = 2;\n this.sectionStart = this.index + 1;\n }\n else {\n this.state = State.InDeclaration;\n }\n };\n Tokenizer.prototype.stateInSpecialComment = function (c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.oncomment(this.sectionStart, this.index, 0);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeSpecialS = function (c) {\n var lower = c | 0x20;\n if (lower === Sequences.ScriptEnd[3]) {\n this.startSpecial(Sequences.ScriptEnd, 4);\n }\n else if (lower === Sequences.StyleEnd[3]) {\n this.startSpecial(Sequences.StyleEnd, 4);\n }\n else {\n this.state = State.InTagName;\n this.stateInTagName(c); // Consume the token again\n }\n };\n Tokenizer.prototype.stateBeforeEntity = function (c) {\n // Start excess with 1 to include the '&'\n this.entityExcess = 1;\n this.entityResult = 0;\n if (c === CharCodes.Number) {\n this.state = State.BeforeNumericEntity;\n }\n else if (c === CharCodes.Amp) {\n // We have two `&` characters in a row. Stay in the current state.\n }\n else {\n this.trieIndex = 0;\n this.trieCurrent = this.entityTrie[0];\n this.state = State.InNamedEntity;\n this.stateInNamedEntity(c);\n }\n };\n Tokenizer.prototype.stateInNamedEntity = function (c) {\n this.entityExcess += 1;\n this.trieIndex = (0, decode_js_1.determineBranch)(this.entityTrie, this.trieCurrent, this.trieIndex + 1, c);\n if (this.trieIndex < 0) {\n this.emitNamedEntity();\n this.index--;\n return;\n }\n this.trieCurrent = this.entityTrie[this.trieIndex];\n var masked = this.trieCurrent & decode_js_1.BinTrieFlags.VALUE_LENGTH;\n // If the branch is a value, store it and continue\n if (masked) {\n // The mask is the number of bytes of the value, including the current byte.\n var valueLength = (masked >> 14) - 1;\n // If we have a legacy entity while parsing strictly, just skip the number of bytes\n if (!this.allowLegacyEntity() && c !== CharCodes.Semi) {\n this.trieIndex += valueLength;\n }\n else {\n // Add 1 as we have already incremented the excess\n var entityStart = this.index - this.entityExcess + 1;\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n // If this is a surrogate pair, consume the next two bytes\n this.entityResult = this.trieIndex;\n this.trieIndex += valueLength;\n this.entityExcess = 0;\n this.sectionStart = this.index + 1;\n if (valueLength === 0) {\n this.emitNamedEntity();\n }\n }\n }\n };\n Tokenizer.prototype.emitNamedEntity = function () {\n this.state = this.baseState;\n if (this.entityResult === 0) {\n return;\n }\n var valueLength = (this.entityTrie[this.entityResult] & decode_js_1.BinTrieFlags.VALUE_LENGTH) >>\n 14;\n switch (valueLength) {\n case 1: {\n this.emitCodePoint(this.entityTrie[this.entityResult] &\n ~decode_js_1.BinTrieFlags.VALUE_LENGTH);\n break;\n }\n case 2: {\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n break;\n }\n case 3: {\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n this.emitCodePoint(this.entityTrie[this.entityResult + 2]);\n }\n }\n };\n Tokenizer.prototype.stateBeforeNumericEntity = function (c) {\n if ((c | 0x20) === CharCodes.LowerX) {\n this.entityExcess++;\n this.state = State.InHexEntity;\n }\n else {\n this.state = State.InNumericEntity;\n this.stateInNumericEntity(c);\n }\n };\n Tokenizer.prototype.emitNumericEntity = function (strict) {\n var entityStart = this.index - this.entityExcess - 1;\n var numberStart = entityStart + 2 + Number(this.state === State.InHexEntity);\n if (numberStart !== this.index) {\n // Emit leading data if any\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n this.sectionStart = this.index + Number(strict);\n this.emitCodePoint((0, decode_js_1.replaceCodePoint)(this.entityResult));\n }\n this.state = this.baseState;\n };\n Tokenizer.prototype.stateInNumericEntity = function (c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 10 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n };\n Tokenizer.prototype.stateInHexEntity = function (c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 16 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else if (isHexDigit(c)) {\n this.entityResult =\n this.entityResult * 16 + ((c | 0x20) - CharCodes.LowerA + 10);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n };\n Tokenizer.prototype.allowLegacyEntity = function () {\n return (!this.xmlMode &&\n (this.baseState === State.Text ||\n this.baseState === State.InSpecialTag));\n };\n /**\n * Remove data that has already been consumed from the buffer.\n */\n Tokenizer.prototype.cleanup = function () {\n // If we are inside of text or attributes, emit what we already have.\n if (this.running && this.sectionStart !== this.index) {\n if (this.state === State.Text ||\n (this.state === State.InSpecialTag && this.sequenceIndex === 0)) {\n this.cbs.ontext(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n else if (this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueNq) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n }\n };\n Tokenizer.prototype.shouldContinue = function () {\n return this.index < this.buffer.length + this.offset && this.running;\n };\n /**\n * Iterates through the buffer, calling the function corresponding to the current state.\n *\n * States that are more likely to be hit are higher up, as a performance improvement.\n */\n Tokenizer.prototype.parse = function () {\n while (this.shouldContinue()) {\n var c = this.buffer.charCodeAt(this.index - this.offset);\n switch (this.state) {\n case State.Text: {\n this.stateText(c);\n break;\n }\n case State.SpecialStartSequence: {\n this.stateSpecialStartSequence(c);\n break;\n }\n case State.InSpecialTag: {\n this.stateInSpecialTag(c);\n break;\n }\n case State.CDATASequence: {\n this.stateCDATASequence(c);\n break;\n }\n case State.InAttributeValueDq: {\n this.stateInAttributeValueDoubleQuotes(c);\n break;\n }\n case State.InAttributeName: {\n this.stateInAttributeName(c);\n break;\n }\n case State.InCommentLike: {\n this.stateInCommentLike(c);\n break;\n }\n case State.InSpecialComment: {\n this.stateInSpecialComment(c);\n break;\n }\n case State.BeforeAttributeName: {\n this.stateBeforeAttributeName(c);\n break;\n }\n case State.InTagName: {\n this.stateInTagName(c);\n break;\n }\n case State.InClosingTagName: {\n this.stateInClosingTagName(c);\n break;\n }\n case State.BeforeTagName: {\n this.stateBeforeTagName(c);\n break;\n }\n case State.AfterAttributeName: {\n this.stateAfterAttributeName(c);\n break;\n }\n case State.InAttributeValueSq: {\n this.stateInAttributeValueSingleQuotes(c);\n break;\n }\n case State.BeforeAttributeValue: {\n this.stateBeforeAttributeValue(c);\n break;\n }\n case State.BeforeClosingTagName: {\n this.stateBeforeClosingTagName(c);\n break;\n }\n case State.AfterClosingTagName: {\n this.stateAfterClosingTagName(c);\n break;\n }\n case State.BeforeSpecialS: {\n this.stateBeforeSpecialS(c);\n break;\n }\n case State.InAttributeValueNq: {\n this.stateInAttributeValueNoQuotes(c);\n break;\n }\n case State.InSelfClosingTag: {\n this.stateInSelfClosingTag(c);\n break;\n }\n case State.InDeclaration: {\n this.stateInDeclaration(c);\n break;\n }\n case State.BeforeDeclaration: {\n this.stateBeforeDeclaration(c);\n break;\n }\n case State.BeforeComment: {\n this.stateBeforeComment(c);\n break;\n }\n case State.InProcessingInstruction: {\n this.stateInProcessingInstruction(c);\n break;\n }\n case State.InNamedEntity: {\n this.stateInNamedEntity(c);\n break;\n }\n case State.BeforeEntity: {\n this.stateBeforeEntity(c);\n break;\n }\n case State.InHexEntity: {\n this.stateInHexEntity(c);\n break;\n }\n case State.InNumericEntity: {\n this.stateInNumericEntity(c);\n break;\n }\n default: {\n // `this._state === State.BeforeNumericEntity`\n this.stateBeforeNumericEntity(c);\n }\n }\n this.index++;\n }\n this.cleanup();\n };\n Tokenizer.prototype.finish = function () {\n if (this.state === State.InNamedEntity) {\n this.emitNamedEntity();\n }\n // If there is remaining data, emit it in a reasonable way\n if (this.sectionStart < this.index) {\n this.handleTrailingData();\n }\n this.cbs.onend();\n };\n /** Handle any trailing data. */\n Tokenizer.prototype.handleTrailingData = function () {\n var endIndex = this.buffer.length + this.offset;\n if (this.state === State.InCommentLike) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, endIndex, 0);\n }\n else {\n this.cbs.oncomment(this.sectionStart, endIndex, 0);\n }\n }\n else if (this.state === State.InNumericEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InHexEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InTagName ||\n this.state === State.BeforeAttributeName ||\n this.state === State.BeforeAttributeValue ||\n this.state === State.AfterAttributeName ||\n this.state === State.InAttributeName ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueNq ||\n this.state === State.InClosingTagName) {\n /*\n * If we are currently in an opening or closing tag, us not calling the\n * respective callback signals that the tag should be ignored.\n */\n }\n else {\n this.cbs.ontext(this.sectionStart, endIndex);\n }\n };\n Tokenizer.prototype.emitPartial = function (start, endIndex) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribdata(start, endIndex);\n }\n else {\n this.cbs.ontext(start, endIndex);\n }\n };\n Tokenizer.prototype.emitCodePoint = function (cp) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribentity(cp);\n }\n else {\n this.cbs.ontextentity(cp);\n }\n };\n return Tokenizer;\n}());\nexports.default = Tokenizer;\n//# sourceMappingURL=Tokenizer.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DomUtils = exports.parseFeed = exports.getFeed = exports.ElementType = exports.Tokenizer = exports.createDomStream = exports.parseDOM = exports.parseDocument = exports.DefaultHandler = exports.DomHandler = exports.Parser = void 0;\nvar Parser_js_1 = require(\"./Parser.js\");\nvar Parser_js_2 = require(\"./Parser.js\");\nObject.defineProperty(exports, \"Parser\", { enumerable: true, get: function () { return Parser_js_2.Parser; } });\nvar domhandler_1 = require(\"domhandler\");\nvar domhandler_2 = require(\"domhandler\");\nObject.defineProperty(exports, \"DomHandler\", { enumerable: true, get: function () { return domhandler_2.DomHandler; } });\n// Old name for DomHandler\nObject.defineProperty(exports, \"DefaultHandler\", { enumerable: true, get: function () { return domhandler_2.DomHandler; } });\n// Helper methods\n/**\n * Parses the data, returns the resulting document.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n */\nfunction parseDocument(data, options) {\n var handler = new domhandler_1.DomHandler(undefined, options);\n new Parser_js_1.Parser(handler, options).end(data);\n return handler.root;\n}\nexports.parseDocument = parseDocument;\n/**\n * Parses data, returns an array of the root nodes.\n *\n * Note that the root nodes still have a `Document` node as their parent.\n * Use `parseDocument` to get the `Document` node instead.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n * @deprecated Use `parseDocument` instead.\n */\nfunction parseDOM(data, options) {\n return parseDocument(data, options).children;\n}\nexports.parseDOM = parseDOM;\n/**\n * Creates a parser instance, with an attached DOM handler.\n *\n * @param callback A callback that will be called once parsing has been completed.\n * @param options Optional options for the parser and DOM builder.\n * @param elementCallback An optional callback that will be called every time a tag has been completed inside of the DOM.\n */\nfunction createDomStream(callback, options, elementCallback) {\n var handler = new domhandler_1.DomHandler(callback, options, elementCallback);\n return new Parser_js_1.Parser(handler, options);\n}\nexports.createDomStream = createDomStream;\nvar Tokenizer_js_1 = require(\"./Tokenizer.js\");\nObject.defineProperty(exports, \"Tokenizer\", { enumerable: true, get: function () { return __importDefault(Tokenizer_js_1).default; } });\n/*\n * All of the following exports exist for backwards-compatibility.\n * They should probably be removed eventually.\n */\nexports.ElementType = __importStar(require(\"domelementtype\"));\nvar domutils_1 = require(\"domutils\");\nvar domutils_2 = require(\"domutils\");\nObject.defineProperty(exports, \"getFeed\", { enumerable: true, get: function () { return domutils_2.getFeed; } });\nvar parseFeedDefaultOptions = { xmlMode: true };\n/**\n * Parse a feed.\n *\n * @param feed The feed that should be parsed, as a string.\n * @param options Optionally, options for parsing. When using this, you should set `xmlMode` to `true`.\n */\nfunction parseFeed(feed, options) {\n if (options === void 0) { options = parseFeedDefaultOptions; }\n return (0, domutils_1.getFeed)(parseDOM(feed, options));\n}\nexports.parseFeed = parseFeed;\nexports.DomUtils = __importStar(require(\"domutils\"));\n//# sourceMappingURL=index.js.map","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n/*!\n * is-plain-object \n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isPlainObject(o) {\n var ctor,prot;\n\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n\nexports.isPlainObject = isPlainObject;\n","const htmlparser = require('htmlparser2');\nconst escapeStringRegexp = require('escape-string-regexp');\nconst { isPlainObject } = require('is-plain-object');\nconst deepmerge = require('deepmerge');\nconst parseSrcset = require('parse-srcset');\nconst { parse: postcssParse } = require('postcss');\n// Tags that can conceivably represent stand-alone media.\nconst mediaTags = [\n 'img', 'audio', 'video', 'picture', 'svg',\n 'object', 'map', 'iframe', 'embed'\n];\n// Tags that are inherently vulnerable to being used in XSS attacks.\nconst vulnerableTags = [ 'script', 'style' ];\n\nfunction each(obj, cb) {\n if (obj) {\n Object.keys(obj).forEach(function (key) {\n cb(obj[key], key);\n });\n }\n}\n\n// Avoid false positives with .__proto__, .hasOwnProperty, etc.\nfunction has(obj, key) {\n return ({}).hasOwnProperty.call(obj, key);\n}\n\n// Returns those elements of `a` for which `cb(a)` returns truthy\nfunction filter(a, cb) {\n const n = [];\n each(a, function(v) {\n if (cb(v)) {\n n.push(v);\n }\n });\n return n;\n}\n\nfunction isEmptyObject(obj) {\n for (const key in obj) {\n if (has(obj, key)) {\n return false;\n }\n }\n return true;\n}\n\nfunction stringifySrcset(parsedSrcset) {\n return parsedSrcset.map(function(part) {\n if (!part.url) {\n throw new Error('URL missing');\n }\n\n return (\n part.url +\n (part.w ? ` ${part.w}w` : '') +\n (part.h ? ` ${part.h}h` : '') +\n (part.d ? ` ${part.d}x` : '')\n );\n }).join(', ');\n}\n\nmodule.exports = sanitizeHtml;\n\n// A valid attribute name.\n// We use a tolerant definition based on the set of strings defined by\n// html.spec.whatwg.org/multipage/parsing.html#before-attribute-name-state\n// and html.spec.whatwg.org/multipage/parsing.html#attribute-name-state .\n// The characters accepted are ones which can be appended to the attribute\n// name buffer without triggering a parse error:\n// * unexpected-equals-sign-before-attribute-name\n// * unexpected-null-character\n// * unexpected-character-in-attribute-name\n// We exclude the empty string because it's impossible to get to the after\n// attribute name state with an empty attribute name buffer.\nconst VALID_HTML_ATTRIBUTE_NAME = /^[^\\0\\t\\n\\f\\r /<=>]+$/;\n\n// Ignore the _recursing flag; it's there for recursive\n// invocation as a guard against this exploit:\n// https://github.com/fb55/htmlparser2/issues/105\n\nfunction sanitizeHtml(html, options, _recursing) {\n if (html == null) {\n return '';\n }\n if (typeof html === 'number') {\n html = html.toString();\n }\n\n let result = '';\n // Used for hot swapping the result variable with an empty string in order to \"capture\" the text written to it.\n let tempResult = '';\n\n function Frame(tag, attribs) {\n const that = this;\n this.tag = tag;\n this.attribs = attribs || {};\n this.tagPosition = result.length;\n this.text = ''; // Node inner text\n this.mediaChildren = [];\n\n this.updateParentNodeText = function() {\n if (stack.length) {\n const parentFrame = stack[stack.length - 1];\n parentFrame.text += that.text;\n }\n };\n\n this.updateParentNodeMediaChildren = function() {\n if (stack.length && mediaTags.includes(this.tag)) {\n const parentFrame = stack[stack.length - 1];\n parentFrame.mediaChildren.push(this.tag);\n }\n };\n }\n\n options = Object.assign({}, sanitizeHtml.defaults, options);\n options.parser = Object.assign({}, htmlParserDefaults, options.parser);\n\n const tagAllowed = function (name) {\n return options.allowedTags === false || (options.allowedTags || []).indexOf(name) > -1;\n };\n\n // vulnerableTags\n vulnerableTags.forEach(function (tag) {\n if (tagAllowed(tag) && !options.allowVulnerableTags) {\n console.warn(`\\n\\n⚠️ Your \\`allowedTags\\` option includes, \\`${tag}\\`, which is inherently\\nvulnerable to XSS attacks. Please remove it from \\`allowedTags\\`.\\nOr, to disable this warning, add the \\`allowVulnerableTags\\` option\\nand ensure you are accounting for this risk.\\n\\n`);\n }\n });\n\n // Tags that contain something other than HTML, or where discarding\n // the text when the tag is disallowed makes sense for other reasons.\n // If we are not allowing these tags, we should drop their content too.\n // For other tags you would drop the tag but keep its content.\n const nonTextTagsArray = options.nonTextTags || [\n 'script',\n 'style',\n 'textarea',\n 'option'\n ];\n let allowedAttributesMap;\n let allowedAttributesGlobMap;\n if (options.allowedAttributes) {\n allowedAttributesMap = {};\n allowedAttributesGlobMap = {};\n each(options.allowedAttributes, function(attributes, tag) {\n allowedAttributesMap[tag] = [];\n const globRegex = [];\n attributes.forEach(function(obj) {\n if (typeof obj === 'string' && obj.indexOf('*') >= 0) {\n globRegex.push(escapeStringRegexp(obj).replace(/\\\\\\*/g, '.*'));\n } else {\n allowedAttributesMap[tag].push(obj);\n }\n });\n if (globRegex.length) {\n allowedAttributesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');\n }\n });\n }\n const allowedClassesMap = {};\n const allowedClassesGlobMap = {};\n const allowedClassesRegexMap = {};\n each(options.allowedClasses, function(classes, tag) {\n // Implicitly allows the class attribute\n if (allowedAttributesMap) {\n if (!has(allowedAttributesMap, tag)) {\n allowedAttributesMap[tag] = [];\n }\n allowedAttributesMap[tag].push('class');\n }\n\n allowedClassesMap[tag] = classes;\n\n if (Array.isArray(classes)) {\n const globRegex = [];\n allowedClassesMap[tag] = [];\n allowedClassesRegexMap[tag] = [];\n classes.forEach(function(obj) {\n if (typeof obj === 'string' && obj.indexOf('*') >= 0) {\n globRegex.push(escapeStringRegexp(obj).replace(/\\\\\\*/g, '.*'));\n } else if (obj instanceof RegExp) {\n allowedClassesRegexMap[tag].push(obj);\n } else {\n allowedClassesMap[tag].push(obj);\n }\n });\n if (globRegex.length) {\n allowedClassesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');\n }\n }\n });\n\n const transformTagsMap = {};\n let transformTagsAll;\n each(options.transformTags, function(transform, tag) {\n let transFun;\n if (typeof transform === 'function') {\n transFun = transform;\n } else if (typeof transform === 'string') {\n transFun = sanitizeHtml.simpleTransform(transform);\n }\n if (tag === '*') {\n transformTagsAll = transFun;\n } else {\n transformTagsMap[tag] = transFun;\n }\n });\n\n let depth;\n let stack;\n let skipMap;\n let transformMap;\n let skipText;\n let skipTextDepth;\n let addedText = false;\n\n initializeState();\n\n const parser = new htmlparser.Parser({\n onopentag: function(name, attribs) {\n // If `enforceHtmlBoundary` is `true` and this has found the opening\n // `html` tag, reset the state.\n if (options.enforceHtmlBoundary && name === 'html') {\n initializeState();\n }\n\n if (skipText) {\n skipTextDepth++;\n return;\n }\n const frame = new Frame(name, attribs);\n stack.push(frame);\n\n let skip = false;\n const hasText = !!frame.text;\n let transformedTag;\n if (has(transformTagsMap, name)) {\n transformedTag = transformTagsMap[name](name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n\n if (transformedTag.text !== undefined) {\n frame.innerText = transformedTag.text;\n }\n\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n if (transformTagsAll) {\n transformedTag = transformTagsAll(name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n\n if (!tagAllowed(name) || (options.disallowedTagsMode === 'recursiveEscape' && !isEmptyObject(skipMap)) || (options.nestingLimit != null && depth >= options.nestingLimit)) {\n skip = true;\n skipMap[depth] = true;\n if (options.disallowedTagsMode === 'discard') {\n if (nonTextTagsArray.indexOf(name) !== -1) {\n skipText = true;\n skipTextDepth = 1;\n }\n }\n skipMap[depth] = true;\n }\n depth++;\n if (skip) {\n if (options.disallowedTagsMode === 'discard') {\n // We want the contents but not this tag\n return;\n }\n tempResult = result;\n result = '';\n }\n result += '<' + name;\n\n if (name === 'script') {\n if (options.allowedScriptHostnames || options.allowedScriptDomains) {\n frame.innerText = '';\n }\n }\n\n if (!allowedAttributesMap || has(allowedAttributesMap, name) || allowedAttributesMap['*']) {\n each(attribs, function(value, a) {\n if (!VALID_HTML_ATTRIBUTE_NAME.test(a)) {\n // This prevents part of an attribute name in the output from being\n // interpreted as the end of an attribute, or end of a tag.\n delete frame.attribs[a];\n return;\n }\n // If the value is empty, check if the attribute is in the allowedEmptyAttributes array.\n // If it is not in the allowedEmptyAttributes array, and it is a known non-boolean attribute, delete it\n // List taken from https://html.spec.whatwg.org/multipage/indices.html#attributes-3\n if (value === '' && (!options.allowedEmptyAttributes.includes(a)) &&\n (options.nonBooleanAttributes.includes(a) || options.nonBooleanAttributes.includes('*'))) {\n delete frame.attribs[a];\n return;\n }\n // check allowedAttributesMap for the element and attribute and modify the value\n // as necessary if there are specific values defined.\n let passedAllowedAttributesMapCheck = false;\n if (!allowedAttributesMap ||\n (has(allowedAttributesMap, name) && allowedAttributesMap[name].indexOf(a) !== -1) ||\n (allowedAttributesMap['*'] && allowedAttributesMap['*'].indexOf(a) !== -1) ||\n (has(allowedAttributesGlobMap, name) && allowedAttributesGlobMap[name].test(a)) ||\n (allowedAttributesGlobMap['*'] && allowedAttributesGlobMap['*'].test(a))) {\n passedAllowedAttributesMapCheck = true;\n } else if (allowedAttributesMap && allowedAttributesMap[name]) {\n for (const o of allowedAttributesMap[name]) {\n if (isPlainObject(o) && o.name && (o.name === a)) {\n passedAllowedAttributesMapCheck = true;\n let newValue = '';\n if (o.multiple === true) {\n // verify the values that are allowed\n const splitStrArray = value.split(' ');\n for (const s of splitStrArray) {\n if (o.values.indexOf(s) !== -1) {\n if (newValue === '') {\n newValue = s;\n } else {\n newValue += ' ' + s;\n }\n }\n }\n } else if (o.values.indexOf(value) >= 0) {\n // verified an allowed value matches the entire attribute value\n newValue = value;\n }\n value = newValue;\n }\n }\n }\n if (passedAllowedAttributesMapCheck) {\n if (options.allowedSchemesAppliedToAttributes.indexOf(a) !== -1) {\n if (naughtyHref(name, value)) {\n delete frame.attribs[a];\n return;\n }\n }\n\n if (name === 'script' && a === 'src') {\n\n let allowed = true;\n\n try {\n const parsed = parseUrl(value);\n\n if (options.allowedScriptHostnames || options.allowedScriptDomains) {\n const allowedHostname = (options.allowedScriptHostnames || []).find(function (hostname) {\n return hostname === parsed.url.hostname;\n });\n const allowedDomain = (options.allowedScriptDomains || []).find(function(domain) {\n return parsed.url.hostname === domain || parsed.url.hostname.endsWith(`.${domain}`);\n });\n allowed = allowedHostname || allowedDomain;\n }\n } catch (e) {\n allowed = false;\n }\n\n if (!allowed) {\n delete frame.attribs[a];\n return;\n }\n }\n\n if (name === 'iframe' && a === 'src') {\n let allowed = true;\n try {\n const parsed = parseUrl(value);\n\n if (parsed.isRelativeUrl) {\n // default value of allowIframeRelativeUrls is true\n // unless allowedIframeHostnames or allowedIframeDomains specified\n allowed = has(options, 'allowIframeRelativeUrls')\n ? options.allowIframeRelativeUrls\n : (!options.allowedIframeHostnames && !options.allowedIframeDomains);\n } else if (options.allowedIframeHostnames || options.allowedIframeDomains) {\n const allowedHostname = (options.allowedIframeHostnames || []).find(function (hostname) {\n return hostname === parsed.url.hostname;\n });\n const allowedDomain = (options.allowedIframeDomains || []).find(function(domain) {\n return parsed.url.hostname === domain || parsed.url.hostname.endsWith(`.${domain}`);\n });\n allowed = allowedHostname || allowedDomain;\n }\n } catch (e) {\n // Unparseable iframe src\n allowed = false;\n }\n if (!allowed) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'srcset') {\n try {\n let parsed = parseSrcset(value);\n parsed.forEach(function(value) {\n if (naughtyHref('srcset', value.url)) {\n value.evil = true;\n }\n });\n parsed = filter(parsed, function(v) {\n return !v.evil;\n });\n if (!parsed.length) {\n delete frame.attribs[a];\n return;\n } else {\n value = stringifySrcset(filter(parsed, function(v) {\n return !v.evil;\n }));\n frame.attribs[a] = value;\n }\n } catch (e) {\n // Unparseable srcset\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'class') {\n const allowedSpecificClasses = allowedClassesMap[name];\n const allowedWildcardClasses = allowedClassesMap['*'];\n const allowedSpecificClassesGlob = allowedClassesGlobMap[name];\n const allowedSpecificClassesRegex = allowedClassesRegexMap[name];\n const allowedWildcardClassesGlob = allowedClassesGlobMap['*'];\n const allowedClassesGlobs = [\n allowedSpecificClassesGlob,\n allowedWildcardClassesGlob\n ]\n .concat(allowedSpecificClassesRegex)\n .filter(function (t) {\n return t;\n });\n if (allowedSpecificClasses && allowedWildcardClasses) {\n value = filterClasses(value, deepmerge(allowedSpecificClasses, allowedWildcardClasses), allowedClassesGlobs);\n } else {\n value = filterClasses(value, allowedSpecificClasses || allowedWildcardClasses, allowedClassesGlobs);\n }\n if (!value.length) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'style') {\n if (options.parseStyleAttributes) {\n try {\n const abstractSyntaxTree = postcssParse(name + ' {' + value + '}', { map: false });\n const filteredAST = filterCss(abstractSyntaxTree, options.allowedStyles);\n\n value = stringifyStyleAttributes(filteredAST);\n\n if (value.length === 0) {\n delete frame.attribs[a];\n return;\n }\n } catch (e) {\n if (typeof window !== 'undefined') {\n console.warn('Failed to parse \"' + name + ' {' + value + '}' + '\", If you\\'re running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547');\n }\n delete frame.attribs[a];\n return;\n }\n } else if (options.allowedStyles) {\n throw new Error('allowedStyles option cannot be used together with parseStyleAttributes: false.');\n }\n }\n result += ' ' + a;\n if (value && value.length) {\n result += '=\"' + escapeHtml(value, true) + '\"';\n } else if (options.allowedEmptyAttributes.includes(a)) {\n result += '=\"\"';\n }\n } else {\n delete frame.attribs[a];\n }\n });\n }\n if (options.selfClosing.indexOf(name) !== -1) {\n result += ' />';\n } else {\n result += '>';\n if (frame.innerText && !hasText && !options.textFilter) {\n result += escapeHtml(frame.innerText);\n addedText = true;\n }\n }\n if (skip) {\n result = tempResult + escapeHtml(result);\n tempResult = '';\n }\n },\n ontext: function(text) {\n if (skipText) {\n return;\n }\n const lastFrame = stack[stack.length - 1];\n let tag;\n\n if (lastFrame) {\n tag = lastFrame.tag;\n // If inner text was set by transform function then let's use it\n text = lastFrame.innerText !== undefined ? lastFrame.innerText : text;\n }\n\n if (options.disallowedTagsMode === 'discard' && ((tag === 'script') || (tag === 'style'))) {\n // htmlparser2 gives us these as-is. Escaping them ruins the content. Allowing\n // script tags is, by definition, game over for XSS protection, so if that's\n // your concern, don't allow them. The same is essentially true for style tags\n // which have their own collection of XSS vectors.\n result += text;\n } else {\n const escaped = escapeHtml(text, false);\n if (options.textFilter && !addedText) {\n result += options.textFilter(escaped, tag);\n } else if (!addedText) {\n result += escaped;\n }\n }\n if (stack.length) {\n const frame = stack[stack.length - 1];\n frame.text += text;\n }\n },\n onclosetag: function(name, isImplied) {\n\n if (skipText) {\n skipTextDepth--;\n if (!skipTextDepth) {\n skipText = false;\n } else {\n return;\n }\n }\n\n const frame = stack.pop();\n if (!frame) {\n // Do not crash on bad markup\n return;\n }\n\n if (frame.tag !== name) {\n // Another case of bad markup.\n // Push to stack, so that it will be used in future closing tags.\n stack.push(frame);\n return;\n }\n\n skipText = options.enforceHtmlBoundary ? name === 'html' : false;\n depth--;\n const skip = skipMap[depth];\n if (skip) {\n delete skipMap[depth];\n if (options.disallowedTagsMode === 'discard') {\n frame.updateParentNodeText();\n return;\n }\n tempResult = result;\n result = '';\n }\n\n if (transformMap[depth]) {\n name = transformMap[depth];\n delete transformMap[depth];\n }\n\n if (options.exclusiveFilter && options.exclusiveFilter(frame)) {\n result = result.substr(0, frame.tagPosition);\n return;\n }\n\n frame.updateParentNodeMediaChildren();\n frame.updateParentNodeText();\n\n if (\n // Already output />\n options.selfClosing.indexOf(name) !== -1 ||\n // Escaped tag, closing tag is implied\n (isImplied && !tagAllowed(name) && [ 'escape', 'recursiveEscape' ].indexOf(options.disallowedTagsMode) >= 0)\n ) {\n if (skip) {\n result = tempResult;\n tempResult = '';\n }\n return;\n }\n\n result += '';\n if (skip) {\n result = tempResult + escapeHtml(result);\n tempResult = '';\n }\n addedText = false;\n }\n }, options.parser);\n parser.write(html);\n parser.end();\n\n return result;\n\n function initializeState() {\n result = '';\n depth = 0;\n stack = [];\n skipMap = {};\n transformMap = {};\n skipText = false;\n skipTextDepth = 0;\n }\n\n function escapeHtml(s, quote) {\n if (typeof (s) !== 'string') {\n s = s + '';\n }\n if (options.parser.decodeEntities) {\n s = s.replace(/&/g, '&').replace(//g, '>');\n if (quote) {\n s = s.replace(/\"/g, '"');\n }\n }\n // TODO: this is inadequate because it will pass `&0;`. This approach\n // will not work, each & must be considered with regard to whether it\n // is followed by a 100% syntactically valid entity or not, and escaped\n // if it is not. If this bothers you, don't set parser.decodeEntities\n // to false. (The default is true.)\n s = s.replace(/&(?![a-zA-Z0-9#]{1,20};)/g, '&') // Match ampersands not part of existing HTML entity\n .replace(//g, '>');\n if (quote) {\n s = s.replace(/\"/g, '"');\n }\n return s;\n }\n\n function naughtyHref(name, href) {\n // Browsers ignore character codes of 32 (space) and below in a surprising\n // number of situations. Start reading here:\n // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Embedded_tab\n // eslint-disable-next-line no-control-regex\n href = href.replace(/[\\x00-\\x20]+/g, '');\n // Clobber any comments in URLs, which the browser might\n // interpret inside an XML data island, allowing\n // a javascript: URL to be snuck through\n while (true) {\n const firstIndex = href.indexOf('', firstIndex + 4);\n if (lastIndex === -1) {\n break;\n }\n href = href.substring(0, firstIndex) + href.substring(lastIndex + 3);\n }\n // Case insensitive so we don't get faked out by JAVASCRIPT #1\n // Allow more characters after the first so we don't get faked\n // out by certain schemes browsers accept\n const matches = href.match(/^([a-zA-Z][a-zA-Z0-9.\\-+]*):/);\n if (!matches) {\n // Protocol-relative URL starting with any combination of '/' and '\\'\n if (href.match(/^[/\\\\]{2}/)) {\n return !options.allowProtocolRelative;\n }\n\n // No scheme\n return false;\n }\n const scheme = matches[1].toLowerCase();\n\n if (has(options.allowedSchemesByTag, name)) {\n return options.allowedSchemesByTag[name].indexOf(scheme) === -1;\n }\n\n return !options.allowedSchemes || options.allowedSchemes.indexOf(scheme) === -1;\n }\n\n function parseUrl(value) {\n value = value.replace(/^(\\w+:)?\\s*[\\\\/]\\s*[\\\\/]/, '$1//');\n if (value.startsWith('relative:')) {\n // An attempt to exploit our workaround for base URLs being\n // mandatory for relative URL validation in the WHATWG\n // URL parser, reject it\n throw new Error('relative: exploit attempt');\n }\n // naughtyHref is in charge of whether protocol relative URLs\n // are cool. Here we are concerned just with allowed hostnames and\n // whether to allow relative URLs.\n //\n // Build a placeholder \"base URL\" against which any reasonable\n // relative URL may be parsed successfully\n let base = 'relative://relative-site';\n for (let i = 0; (i < 100); i++) {\n base += `/${i}`;\n }\n\n const parsed = new URL(value, base);\n\n const isRelativeUrl = parsed && parsed.hostname === 'relative-site' && parsed.protocol === 'relative:';\n return {\n isRelativeUrl,\n url: parsed\n };\n }\n /**\n * Filters user input css properties by allowlisted regex attributes.\n * Modifies the abstractSyntaxTree object.\n *\n * @param {object} abstractSyntaxTree - Object representation of CSS attributes.\n * @property {array[Declaration]} abstractSyntaxTree.nodes[0] - Each object cointains prop and value key, i.e { prop: 'color', value: 'red' }.\n * @param {object} allowedStyles - Keys are properties (i.e color), value is list of permitted regex rules (i.e /green/i).\n * @return {object} - The modified tree.\n */\n function filterCss(abstractSyntaxTree, allowedStyles) {\n if (!allowedStyles) {\n return abstractSyntaxTree;\n }\n\n const astRules = abstractSyntaxTree.nodes[0];\n let selectedRule;\n\n // Merge global and tag-specific styles into new AST.\n if (allowedStyles[astRules.selector] && allowedStyles['*']) {\n selectedRule = deepmerge(\n allowedStyles[astRules.selector],\n allowedStyles['*']\n );\n } else {\n selectedRule = allowedStyles[astRules.selector] || allowedStyles['*'];\n }\n\n if (selectedRule) {\n abstractSyntaxTree.nodes[0].nodes = astRules.nodes.reduce(filterDeclarations(selectedRule), []);\n }\n\n return abstractSyntaxTree;\n }\n\n /**\n * Extracts the style attributes from an AbstractSyntaxTree and formats those\n * values in the inline style attribute format.\n *\n * @param {AbstractSyntaxTree} filteredAST\n * @return {string} - Example: \"color:yellow;text-align:center !important;font-family:helvetica;\"\n */\n function stringifyStyleAttributes(filteredAST) {\n return filteredAST.nodes[0].nodes\n .reduce(function(extractedAttributes, attrObject) {\n extractedAttributes.push(\n `${attrObject.prop}:${attrObject.value}${attrObject.important ? ' !important' : ''}`\n );\n return extractedAttributes;\n }, [])\n .join(';');\n }\n\n /**\n * Filters the existing attributes for the given property. Discards any attributes\n * which don't match the allowlist.\n *\n * @param {object} selectedRule - Example: { color: red, font-family: helvetica }\n * @param {array} allowedDeclarationsList - List of declarations which pass the allowlist.\n * @param {object} attributeObject - Object representing the current css property.\n * @property {string} attributeObject.type - Typically 'declaration'.\n * @property {string} attributeObject.prop - The CSS property, i.e 'color'.\n * @property {string} attributeObject.value - The corresponding value to the css property, i.e 'red'.\n * @return {function} - When used in Array.reduce, will return an array of Declaration objects\n */\n function filterDeclarations(selectedRule) {\n return function (allowedDeclarationsList, attributeObject) {\n // If this property is allowlisted...\n if (has(selectedRule, attributeObject.prop)) {\n const matchesRegex = selectedRule[attributeObject.prop].some(function(regularExpression) {\n return regularExpression.test(attributeObject.value);\n });\n\n if (matchesRegex) {\n allowedDeclarationsList.push(attributeObject);\n }\n }\n return allowedDeclarationsList;\n };\n }\n\n function filterClasses(classes, allowed, allowedGlobs) {\n if (!allowed) {\n // The class attribute is allowed without filtering on this tag\n return classes;\n }\n classes = classes.split(/\\s+/);\n return classes.filter(function(clss) {\n return allowed.indexOf(clss) !== -1 || allowedGlobs.some(function(glob) {\n return glob.test(clss);\n });\n }).join(' ');\n }\n}\n\n// Defaults are accessible to you so that you can use them as a starting point\n// programmatically if you wish\n\nconst htmlParserDefaults = {\n decodeEntities: true\n};\nsanitizeHtml.defaults = {\n allowedTags: [\n // Sections derived from MDN element categories and limited to the more\n // benign categories.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element\n // Content sectioning\n 'address', 'article', 'aside', 'footer', 'header',\n 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup',\n 'main', 'nav', 'section',\n // Text content\n 'blockquote', 'dd', 'div', 'dl', 'dt', 'figcaption', 'figure',\n 'hr', 'li', 'main', 'ol', 'p', 'pre', 'ul',\n // Inline text semantics\n 'a', 'abbr', 'b', 'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn',\n 'em', 'i', 'kbd', 'mark', 'q',\n 'rb', 'rp', 'rt', 'rtc', 'ruby',\n 's', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'time', 'u', 'var', 'wbr',\n // Table content\n 'caption', 'col', 'colgroup', 'table', 'tbody', 'td', 'tfoot', 'th',\n 'thead', 'tr'\n ],\n // Tags that cannot be boolean\n nonBooleanAttributes: [\n 'abbr', 'accept', 'accept-charset', 'accesskey', 'action',\n 'allow', 'alt', 'as', 'autocapitalize', 'autocomplete',\n 'blocking', 'charset', 'cite', 'class', 'color', 'cols',\n 'colspan', 'content', 'contenteditable', 'coords', 'crossorigin',\n 'data', 'datetime', 'decoding', 'dir', 'dirname', 'download',\n 'draggable', 'enctype', 'enterkeyhint', 'fetchpriority', 'for',\n 'form', 'formaction', 'formenctype', 'formmethod', 'formtarget',\n 'headers', 'height', 'hidden', 'high', 'href', 'hreflang',\n 'http-equiv', 'id', 'imagesizes', 'imagesrcset', 'inputmode',\n 'integrity', 'is', 'itemid', 'itemprop', 'itemref', 'itemtype',\n 'kind', 'label', 'lang', 'list', 'loading', 'low', 'max',\n 'maxlength', 'media', 'method', 'min', 'minlength', 'name',\n 'nonce', 'optimum', 'pattern', 'ping', 'placeholder', 'popover',\n 'popovertarget', 'popovertargetaction', 'poster', 'preload',\n 'referrerpolicy', 'rel', 'rows', 'rowspan', 'sandbox', 'scope',\n 'shape', 'size', 'sizes', 'slot', 'span', 'spellcheck', 'src',\n 'srcdoc', 'srclang', 'srcset', 'start', 'step', 'style',\n 'tabindex', 'target', 'title', 'translate', 'type', 'usemap',\n 'value', 'width', 'wrap',\n // Event handlers\n 'onauxclick', 'onafterprint', 'onbeforematch', 'onbeforeprint',\n 'onbeforeunload', 'onbeforetoggle', 'onblur', 'oncancel',\n 'oncanplay', 'oncanplaythrough', 'onchange', 'onclick', 'onclose',\n 'oncontextlost', 'oncontextmenu', 'oncontextrestored', 'oncopy',\n 'oncuechange', 'oncut', 'ondblclick', 'ondrag', 'ondragend',\n 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart',\n 'ondrop', 'ondurationchange', 'onemptied', 'onended',\n 'onerror', 'onfocus', 'onformdata', 'onhashchange', 'oninput',\n 'oninvalid', 'onkeydown', 'onkeypress', 'onkeyup',\n 'onlanguagechange', 'onload', 'onloadeddata', 'onloadedmetadata',\n 'onloadstart', 'onmessage', 'onmessageerror', 'onmousedown',\n 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout',\n 'onmouseover', 'onmouseup', 'onoffline', 'ononline', 'onpagehide',\n 'onpageshow', 'onpaste', 'onpause', 'onplay', 'onplaying',\n 'onpopstate', 'onprogress', 'onratechange', 'onreset', 'onresize',\n 'onrejectionhandled', 'onscroll', 'onscrollend',\n 'onsecuritypolicyviolation', 'onseeked', 'onseeking', 'onselect',\n 'onslotchange', 'onstalled', 'onstorage', 'onsubmit', 'onsuspend',\n 'ontimeupdate', 'ontoggle', 'onunhandledrejection', 'onunload',\n 'onvolumechange', 'onwaiting', 'onwheel'\n ],\n disallowedTagsMode: 'discard',\n allowedAttributes: {\n a: [ 'href', 'name', 'target' ],\n // We don't currently allow img itself by default, but\n // these attributes would make sense if we did.\n img: [ 'src', 'srcset', 'alt', 'title', 'width', 'height', 'loading' ]\n },\n allowedEmptyAttributes: [\n 'alt'\n ],\n // Lots of these won't come up by default because we don't allow them\n selfClosing: [ 'img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta' ],\n // URL schemes we permit\n allowedSchemes: [ 'http', 'https', 'ftp', 'mailto', 'tel' ],\n allowedSchemesByTag: {},\n allowedSchemesAppliedToAttributes: [ 'href', 'src', 'cite' ],\n allowProtocolRelative: true,\n enforceHtmlBoundary: false,\n parseStyleAttributes: true\n};\n\nsanitizeHtml.simpleTransform = function(newTagName, newAttribs, merge) {\n merge = (merge === undefined) ? true : merge;\n newAttribs = newAttribs || {};\n\n return function(tagName, attribs) {\n let attrib;\n if (merge) {\n for (attrib in newAttribs) {\n attribs[attrib] = newAttribs[attrib];\n }\n } else {\n attribs = newAttribs;\n }\n\n return {\n tagName: newTagName,\n attribs: attribs\n };\n };\n};\n","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ActivityMonitor = void 0;\nconst signaling_1 = require(\"@lumino/signaling\");\n/**\n * A class that monitors activity on a signal.\n */\nclass ActivityMonitor {\n /**\n * Construct a new activity monitor.\n */\n constructor(options) {\n this._timer = -1;\n this._timeout = -1;\n this._isDisposed = false;\n this._activityStopped = new signaling_1.Signal(this);\n options.signal.connect(this._onSignalFired, this);\n this._timeout = options.timeout || 1000;\n }\n /**\n * A signal emitted when activity has ceased.\n */\n get activityStopped() {\n return this._activityStopped;\n }\n /**\n * The timeout associated with the monitor, in milliseconds.\n */\n get timeout() {\n return this._timeout;\n }\n set timeout(value) {\n this._timeout = value;\n }\n /**\n * Test whether the monitor has been disposed.\n *\n * #### Notes\n * This is a read-only property.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of the resources used by the activity monitor.\n */\n dispose() {\n if (this._isDisposed) {\n return;\n }\n this._isDisposed = true;\n signaling_1.Signal.clearData(this);\n }\n /**\n * A signal handler for the monitored signal.\n */\n _onSignalFired(sender, args) {\n clearTimeout(this._timer);\n this._sender = sender;\n this._args = args;\n this._timer = setTimeout(() => {\n this._activityStopped.emit({\n sender: this._sender,\n args: this._args\n });\n }, this._timeout);\n }\n}\nexports.ActivityMonitor = ActivityMonitor;\n//# sourceMappingURL=activitymonitor.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module coreutils\n */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./activitymonitor\"), exports);\n__exportStar(require(\"./interfaces\"), exports);\n__exportStar(require(\"./lru\"), exports);\n__exportStar(require(\"./markdowncodeblocks\"), exports);\n__exportStar(require(\"./pageconfig\"), exports);\n__exportStar(require(\"./path\"), exports);\n__exportStar(require(\"./signal\"), exports);\n__exportStar(require(\"./text\"), exports);\n__exportStar(require(\"./time\"), exports);\n__exportStar(require(\"./url\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=interfaces.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LruCache = void 0;\nconst DEFAULT_MAX_SIZE = 128;\n/** A least-recently-used cache. */\nclass LruCache {\n constructor(options = {}) {\n this._map = new Map();\n this._maxSize = (options === null || options === void 0 ? void 0 : options.maxSize) || DEFAULT_MAX_SIZE;\n }\n /**\n * Return the current size of the cache.\n */\n get size() {\n return this._map.size;\n }\n /**\n * Clear the values in the cache.\n */\n clear() {\n this._map.clear();\n }\n /**\n * Get a value (or null) from the cache, pushing the item to the front of the cache.\n */\n get(key) {\n const item = this._map.get(key) || null;\n if (item != null) {\n this._map.delete(key);\n this._map.set(key, item);\n }\n return item;\n }\n /**\n * Set a value in the cache, potentially evicting an old item.\n */\n set(key, value) {\n if (this._map.size >= this._maxSize) {\n this._map.delete(this._map.keys().next().value);\n }\n this._map.set(key, value);\n }\n}\nexports.LruCache = LruCache;\n//# sourceMappingURL=lru.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MarkdownCodeBlocks = void 0;\n/**\n * The namespace for code block functions which help\n * in extract code from markdown text\n */\nvar MarkdownCodeBlocks;\n(function (MarkdownCodeBlocks) {\n MarkdownCodeBlocks.CODE_BLOCK_MARKER = '```';\n const markdownExtensions = [\n '.markdown',\n '.mdown',\n '.mkdn',\n '.md',\n '.mkd',\n '.mdwn',\n '.mdtxt',\n '.mdtext',\n '.text',\n '.txt',\n '.Rmd'\n ];\n class MarkdownCodeBlock {\n constructor(startLine) {\n this.startLine = startLine;\n this.code = '';\n this.endLine = -1;\n }\n }\n MarkdownCodeBlocks.MarkdownCodeBlock = MarkdownCodeBlock;\n /**\n * Check whether the given file extension is a markdown extension\n * @param extension - A file extension\n *\n * @returns true/false depending on whether this is a supported markdown extension\n */\n function isMarkdown(extension) {\n return markdownExtensions.indexOf(extension) > -1;\n }\n MarkdownCodeBlocks.isMarkdown = isMarkdown;\n /**\n * Construct all code snippets from current text\n * (this could be potentially optimized if we can cache and detect differences)\n * @param text - A string to parse codeblocks from\n *\n * @returns An array of MarkdownCodeBlocks.\n */\n function findMarkdownCodeBlocks(text) {\n if (!text || text === '') {\n return [];\n }\n const lines = text.split('\\n');\n const codeBlocks = [];\n let currentBlock = null;\n for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {\n const line = lines[lineIndex];\n const lineContainsMarker = line.indexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER) === 0;\n const constructingBlock = currentBlock != null;\n // Skip this line if it is not part of any code block and doesn't contain a marker.\n if (!lineContainsMarker && !constructingBlock) {\n continue;\n }\n // Check if we are already constructing a code block.\n if (!constructingBlock) {\n // Start constructing a new code block.\n currentBlock = new MarkdownCodeBlock(lineIndex);\n // Check whether this is a single line code block of the form ```a = 10```.\n const firstIndex = line.indexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER);\n const lastIndex = line.lastIndexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER);\n const isSingleLine = firstIndex !== lastIndex;\n if (isSingleLine) {\n currentBlock.code = line.substring(firstIndex + MarkdownCodeBlocks.CODE_BLOCK_MARKER.length, lastIndex);\n currentBlock.endLine = lineIndex;\n codeBlocks.push(currentBlock);\n currentBlock = null;\n }\n }\n else if (currentBlock) {\n if (lineContainsMarker) {\n // End of block, finish it up.\n currentBlock.endLine = lineIndex - 1;\n codeBlocks.push(currentBlock);\n currentBlock = null;\n }\n else {\n // Append the current line.\n currentBlock.code += line + '\\n';\n }\n }\n }\n return codeBlocks;\n }\n MarkdownCodeBlocks.findMarkdownCodeBlocks = findMarkdownCodeBlocks;\n})(MarkdownCodeBlocks || (exports.MarkdownCodeBlocks = MarkdownCodeBlocks = {}));\n//# sourceMappingURL=markdowncodeblocks.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PageConfig = void 0;\nconst coreutils_1 = require(\"@lumino/coreutils\");\nconst minimist_1 = __importDefault(require(\"minimist\"));\nconst url_1 = require(\"./url\");\n/**\n * The namespace for `PageConfig` functions.\n */\nvar PageConfig;\n(function (PageConfig) {\n /**\n * Get global configuration data for the Jupyter application.\n *\n * @param name - The name of the configuration option.\n *\n * @returns The config value or an empty string if not found.\n *\n * #### Notes\n * All values are treated as strings.\n * For browser based applications, it is assumed that the page HTML\n * includes a script tag with the id `jupyter-config-data` containing the\n * configuration as valid JSON. In order to support the classic Notebook,\n * we fall back on checking for `body` data of the given `name`.\n *\n * For node applications, it is assumed that the process was launched\n * with a `--jupyter-config-data` option pointing to a JSON settings\n * file.\n */\n function getOption(name) {\n if (configData) {\n return configData[name] || getBodyData(name);\n }\n configData = Object.create(null);\n let found = false;\n // Use script tag if available.\n if (typeof document !== 'undefined' && document) {\n const el = document.getElementById('jupyter-config-data');\n if (el) {\n configData = JSON.parse(el.textContent || '');\n found = true;\n }\n }\n // Otherwise use CLI if given.\n if (!found && typeof process !== 'undefined' && process.argv) {\n try {\n const cli = (0, minimist_1.default)(process.argv.slice(2));\n const path = require('path');\n let fullPath = '';\n if ('jupyter-config-data' in cli) {\n fullPath = path.resolve(cli['jupyter-config-data']);\n }\n else if ('JUPYTER_CONFIG_DATA' in process.env) {\n fullPath = path.resolve(process.env['JUPYTER_CONFIG_DATA']);\n }\n if (fullPath) {\n // Force Webpack to ignore this require.\n // eslint-disable-next-line\n configData = eval('require')(fullPath);\n }\n }\n catch (e) {\n console.error(e);\n }\n }\n if (!coreutils_1.JSONExt.isObject(configData)) {\n configData = Object.create(null);\n }\n else {\n for (const key in configData) {\n // PageConfig expects strings\n if (typeof configData[key] !== 'string') {\n configData[key] = JSON.stringify(configData[key]);\n }\n }\n }\n return configData[name] || getBodyData(name);\n }\n PageConfig.getOption = getOption;\n /**\n * Set global configuration data for the Jupyter application.\n *\n * @param name - The name of the configuration option.\n * @param value - The value to set the option to.\n *\n * @returns The last config value or an empty string if it doesn't exist.\n */\n function setOption(name, value) {\n const last = getOption(name);\n configData[name] = value;\n return last;\n }\n PageConfig.setOption = setOption;\n /**\n * Get the base url for a Jupyter application, or the base url of the page.\n */\n function getBaseUrl() {\n return url_1.URLExt.normalize(getOption('baseUrl') || '/');\n }\n PageConfig.getBaseUrl = getBaseUrl;\n /**\n * Get the tree url for a JupyterLab application.\n */\n function getTreeUrl() {\n return url_1.URLExt.join(getBaseUrl(), getOption('treeUrl'));\n }\n PageConfig.getTreeUrl = getTreeUrl;\n /**\n * Get the base url for sharing links (usually baseUrl)\n */\n function getShareUrl() {\n return url_1.URLExt.normalize(getOption('shareUrl') || getBaseUrl());\n }\n PageConfig.getShareUrl = getShareUrl;\n /**\n * Get the tree url for shareable links.\n * Usually the same as treeUrl,\n * but overrideable e.g. when sharing with JupyterHub.\n */\n function getTreeShareUrl() {\n return url_1.URLExt.normalize(url_1.URLExt.join(getShareUrl(), getOption('treeUrl')));\n }\n PageConfig.getTreeShareUrl = getTreeShareUrl;\n /**\n * Create a new URL given an optional mode and tree path.\n *\n * This is used to create URLS when the mode or tree path change as the user\n * changes mode or the current document in the main area. If fields in\n * options are omitted, the value in PageConfig will be used.\n *\n * @param options - IGetUrlOptions for the new path.\n */\n function getUrl(options) {\n var _a, _b, _c, _d;\n let path = options.toShare ? getShareUrl() : getBaseUrl();\n const mode = (_a = options.mode) !== null && _a !== void 0 ? _a : getOption('mode');\n const workspace = (_b = options.workspace) !== null && _b !== void 0 ? _b : getOption('workspace');\n const labOrDoc = mode === 'single-document' ? 'doc' : 'lab';\n path = url_1.URLExt.join(path, labOrDoc);\n if (workspace !== PageConfig.defaultWorkspace) {\n path = url_1.URLExt.join(path, 'workspaces', encodeURIComponent((_c = getOption('workspace')) !== null && _c !== void 0 ? _c : PageConfig.defaultWorkspace));\n }\n const treePath = (_d = options.treePath) !== null && _d !== void 0 ? _d : getOption('treePath');\n if (treePath) {\n path = url_1.URLExt.join(path, 'tree', url_1.URLExt.encodeParts(treePath));\n }\n return path;\n }\n PageConfig.getUrl = getUrl;\n PageConfig.defaultWorkspace = 'default';\n /**\n * Get the base websocket url for a Jupyter application, or an empty string.\n */\n function getWsUrl(baseUrl) {\n let wsUrl = getOption('wsUrl');\n if (!wsUrl) {\n baseUrl = baseUrl ? url_1.URLExt.normalize(baseUrl) : getBaseUrl();\n if (baseUrl.indexOf('http') !== 0) {\n return '';\n }\n wsUrl = 'ws' + baseUrl.slice(4);\n }\n return url_1.URLExt.normalize(wsUrl);\n }\n PageConfig.getWsUrl = getWsUrl;\n /**\n * Returns the URL converting this notebook to a certain\n * format with nbconvert.\n */\n function getNBConvertURL({ path, format, download }) {\n const notebookPath = url_1.URLExt.encodeParts(path);\n const url = url_1.URLExt.join(getBaseUrl(), 'nbconvert', format, notebookPath);\n if (download) {\n return url + '?download=true';\n }\n return url;\n }\n PageConfig.getNBConvertURL = getNBConvertURL;\n /**\n * Get the authorization token for a Jupyter application.\n */\n function getToken() {\n return getOption('token') || getBodyData('jupyterApiToken');\n }\n PageConfig.getToken = getToken;\n /**\n * Get the Notebook version info [major, minor, patch].\n */\n function getNotebookVersion() {\n const notebookVersion = getOption('notebookVersion');\n if (notebookVersion === '') {\n return [0, 0, 0];\n }\n return JSON.parse(notebookVersion);\n }\n PageConfig.getNotebookVersion = getNotebookVersion;\n /**\n * Private page config data for the Jupyter application.\n */\n let configData = null;\n /**\n * Get a url-encoded item from `body.data` and decode it\n * We should never have any encoded URLs anywhere else in code\n * until we are building an actual request.\n */\n function getBodyData(key) {\n if (typeof document === 'undefined' || !document.body) {\n return '';\n }\n const val = document.body.dataset[key];\n if (typeof val === 'undefined') {\n return '';\n }\n return decodeURIComponent(val);\n }\n /**\n * The namespace for page config `Extension` functions.\n */\n let Extension;\n (function (Extension) {\n /**\n * Populate an array from page config.\n *\n * @param key - The page config key (e.g., `deferredExtensions`).\n *\n * #### Notes\n * This is intended for `deferredExtensions` and `disabledExtensions`.\n */\n function populate(key) {\n try {\n const raw = getOption(key);\n if (raw) {\n return JSON.parse(raw);\n }\n }\n catch (error) {\n console.warn(`Unable to parse ${key}.`, error);\n }\n return [];\n }\n /**\n * The collection of deferred extensions in page config.\n */\n Extension.deferred = populate('deferredExtensions');\n /**\n * The collection of disabled extensions in page config.\n */\n Extension.disabled = populate('disabledExtensions');\n /**\n * Returns whether a plugin is deferred.\n *\n * @param id - The plugin ID.\n */\n function isDeferred(id) {\n // Check for either a full plugin id match or an extension\n // name match.\n const separatorIndex = id.indexOf(':');\n let extName = '';\n if (separatorIndex !== -1) {\n extName = id.slice(0, separatorIndex);\n }\n return Extension.deferred.some(val => val === id || (extName && val === extName));\n }\n Extension.isDeferred = isDeferred;\n /**\n * Returns whether a plugin is disabled.\n *\n * @param id - The plugin ID.\n */\n function isDisabled(id) {\n // Check for either a full plugin id match or an extension\n // name match.\n const separatorIndex = id.indexOf(':');\n let extName = '';\n if (separatorIndex !== -1) {\n extName = id.slice(0, separatorIndex);\n }\n return Extension.disabled.some(val => val === id || (extName && val === extName));\n }\n Extension.isDisabled = isDisabled;\n })(Extension = PageConfig.Extension || (PageConfig.Extension = {}));\n})(PageConfig || (exports.PageConfig = PageConfig = {}));\n//# sourceMappingURL=pageconfig.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PathExt = void 0;\nconst path_1 = require(\"path\");\n/**\n * The namespace for path-related functions.\n *\n * Note that Jupyter server paths do not start with a leading slash.\n */\nvar PathExt;\n(function (PathExt) {\n /**\n * Join all arguments together and normalize the resulting path.\n * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.\n *\n * @param paths - The string paths to join.\n */\n function join(...paths) {\n const path = path_1.posix.join(...paths);\n return path === '.' ? '' : removeSlash(path);\n }\n PathExt.join = join;\n /**\n * Join all arguments together and normalize the resulting path and preserve the leading slash.\n *\n * @param paths - The string paths to join.\n */\n function joinWithLeadingSlash(...paths) {\n const path = path_1.posix.join(...paths);\n return path === '.' ? '' : path;\n }\n PathExt.joinWithLeadingSlash = joinWithLeadingSlash;\n /**\n * Return the last portion of a path. Similar to the Unix basename command.\n * Often used to extract the file name from a fully qualified path.\n *\n * @param path - The path to evaluate.\n *\n * @param ext - An extension to remove from the result.\n */\n function basename(path, ext) {\n return path_1.posix.basename(path, ext);\n }\n PathExt.basename = basename;\n /**\n * Get the directory name of a path, similar to the Unix dirname command.\n * When an empty path is given, returns the root path.\n *\n * @param path - The file path.\n */\n function dirname(path) {\n const dir = removeSlash(path_1.posix.dirname(path));\n return dir === '.' ? '' : dir;\n }\n PathExt.dirname = dirname;\n /**\n * Get the extension of the path.\n *\n * @param path - The file path.\n *\n * @returns the extension of the file.\n *\n * #### Notes\n * The extension is the string from the last occurrence of the `.`\n * character to end of string in the last portion of the path, inclusive.\n * If there is no `.` in the last portion of the path, or if the first\n * character of the basename of path [[basename]] is `.`, then an\n * empty string is returned.\n */\n function extname(path) {\n return path_1.posix.extname(path);\n }\n PathExt.extname = extname;\n /**\n * Normalize a string path, reducing '..' and '.' parts.\n * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.\n * When an empty path is given, returns the root path.\n *\n * @param path - The string path to normalize.\n */\n function normalize(path) {\n if (path === '') {\n return '';\n }\n return removeSlash(path_1.posix.normalize(path));\n }\n PathExt.normalize = normalize;\n /**\n * Resolve a sequence of paths or path segments into an absolute path.\n * The root path in the application has no leading slash, so it is removed.\n *\n * @param parts - The paths to join.\n *\n * #### Notes\n * The right-most parameter is considered \\{to\\}. Other parameters are considered an array of \\{from\\}.\n *\n * Starting from leftmost \\{from\\} parameter, resolves \\{to\\} to an absolute path.\n *\n * If \\{to\\} isn't already absolute, \\{from\\} arguments are prepended in right to left order, until an absolute path is found. If after using all \\{from\\} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory.\n */\n function resolve(...parts) {\n return removeSlash(path_1.posix.resolve(...parts));\n }\n PathExt.resolve = resolve;\n /**\n * Solve the relative path from \\{from\\} to \\{to\\}.\n *\n * @param from - The source path.\n *\n * @param to - The target path.\n *\n * #### Notes\n * If from and to each resolve to the same path (after calling\n * path.resolve() on each), a zero-length string is returned.\n * If a zero-length string is passed as from or to, `/`\n * will be used instead of the zero-length strings.\n */\n function relative(from, to) {\n return removeSlash(path_1.posix.relative(from, to));\n }\n PathExt.relative = relative;\n /**\n * Normalize a file extension to be of the type `'.foo'`.\n *\n * @param extension - the file extension.\n *\n * #### Notes\n * Adds a leading dot if not present and converts to lower case.\n */\n function normalizeExtension(extension) {\n if (extension.length > 0 && extension.indexOf('.') !== 0) {\n extension = `.${extension}`;\n }\n return extension;\n }\n PathExt.normalizeExtension = normalizeExtension;\n /**\n * Remove the leading slash from a path.\n *\n * @param path the path from which to remove a leading slash.\n */\n function removeSlash(path) {\n if (path.indexOf('/') === 0) {\n path = path.slice(1);\n }\n return path;\n }\n PathExt.removeSlash = removeSlash;\n})(PathExt || (exports.PathExt = PathExt = {}));\n//# sourceMappingURL=path.js.map","\"use strict\";\n/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signalToPromise = void 0;\nconst coreutils_1 = require(\"@lumino/coreutils\");\n/**\n * Convert a signal into a promise for the first emitted value.\n *\n * @param signal - The signal we are listening to.\n * @param timeout - Timeout to wait for signal in ms (not timeout if not defined or 0)\n *\n * @returns a Promise that resolves with a `(sender, args)` pair.\n */\nfunction signalToPromise(signal, timeout) {\n const waitForSignal = new coreutils_1.PromiseDelegate();\n function cleanup() {\n signal.disconnect(slot);\n }\n function slot(sender, args) {\n cleanup();\n waitForSignal.resolve([sender, args]);\n }\n signal.connect(slot);\n if ((timeout !== null && timeout !== void 0 ? timeout : 0) > 0) {\n setTimeout(() => {\n cleanup();\n waitForSignal.reject(`Signal not emitted within ${timeout} ms.`);\n }, timeout);\n }\n return waitForSignal.promise;\n}\nexports.signalToPromise = signalToPromise;\n//# sourceMappingURL=signal.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Text = void 0;\n/**\n * The namespace for text-related functions.\n */\nvar Text;\n(function (Text) {\n // javascript stores text as utf16 and string indices use \"code units\",\n // which stores high-codepoint characters as \"surrogate pairs\",\n // which occupy two indices in the javascript string.\n // We need to translate cursor_pos in the Jupyter protocol (in characters)\n // to js offset (with surrogate pairs taking two spots).\n const HAS_SURROGATES = '𝐚'.length > 1;\n /**\n * Convert a javascript string index into a unicode character offset\n *\n * @param jsIdx - The javascript string index (counting surrogate pairs)\n *\n * @param text - The text in which the offset is calculated\n *\n * @returns The unicode character offset\n */\n function jsIndexToCharIndex(jsIdx, text) {\n if (HAS_SURROGATES) {\n // not using surrogates, nothing to do\n return jsIdx;\n }\n let charIdx = jsIdx;\n for (let i = 0; i + 1 < text.length && i < jsIdx; i++) {\n const charCode = text.charCodeAt(i);\n // check for surrogate pair\n if (charCode >= 0xd800 && charCode <= 0xdbff) {\n const nextCharCode = text.charCodeAt(i + 1);\n if (nextCharCode >= 0xdc00 && nextCharCode <= 0xdfff) {\n charIdx--;\n i++;\n }\n }\n }\n return charIdx;\n }\n Text.jsIndexToCharIndex = jsIndexToCharIndex;\n /**\n * Convert a unicode character offset to a javascript string index.\n *\n * @param charIdx - The index in unicode characters\n *\n * @param text - The text in which the offset is calculated\n *\n * @returns The js-native index\n */\n function charIndexToJsIndex(charIdx, text) {\n if (HAS_SURROGATES) {\n // not using surrogates, nothing to do\n return charIdx;\n }\n let jsIdx = charIdx;\n for (let i = 0; i + 1 < text.length && i < jsIdx; i++) {\n const charCode = text.charCodeAt(i);\n // check for surrogate pair\n if (charCode >= 0xd800 && charCode <= 0xdbff) {\n const nextCharCode = text.charCodeAt(i + 1);\n if (nextCharCode >= 0xdc00 && nextCharCode <= 0xdfff) {\n jsIdx++;\n i++;\n }\n }\n }\n return jsIdx;\n }\n Text.charIndexToJsIndex = charIndexToJsIndex;\n /**\n * Given a 'snake-case', 'snake_case', 'snake:case', or\n * 'snake case' string, will return the camel case version: 'snakeCase'.\n *\n * @param str the snake-case input string.\n *\n * @param upper default = false. If true, the first letter of the\n * returned string will be capitalized.\n *\n * @returns the camel case version of the input string.\n */\n function camelCase(str, upper = false) {\n return str.replace(/^(\\w)|[\\s-_:]+(\\w)/g, function (match, p1, p2) {\n if (p2) {\n return p2.toUpperCase();\n }\n else {\n return upper ? p1.toUpperCase() : p1.toLowerCase();\n }\n });\n }\n Text.camelCase = camelCase;\n /**\n * Given a string, title case the words in the string.\n *\n * @param str the string to title case.\n *\n * @returns the same string, but with each word capitalized.\n */\n function titleCase(str) {\n return (str || '')\n .toLowerCase()\n .split(' ')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n }\n Text.titleCase = titleCase;\n})(Text || (exports.Text = Text = {}));\n//# sourceMappingURL=text.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.URLExt = void 0;\nconst path_1 = require(\"path\");\nconst url_parse_1 = __importDefault(require(\"url-parse\"));\n/**\n * The namespace for URL-related functions.\n */\nvar URLExt;\n(function (URLExt) {\n /**\n * Parse a url into a URL object.\n *\n * @param url - The URL string to parse.\n *\n * @returns A URL object.\n */\n function parse(url) {\n if (typeof document !== 'undefined' && document) {\n const a = document.createElement('a');\n a.href = url;\n return a;\n }\n return (0, url_parse_1.default)(url);\n }\n URLExt.parse = parse;\n /**\n * Parse URL and retrieve hostname\n *\n * @param url - The URL string to parse\n *\n * @returns a hostname string value\n */\n function getHostName(url) {\n return (0, url_parse_1.default)(url).hostname;\n }\n URLExt.getHostName = getHostName;\n function normalize(url) {\n return url && parse(url).toString();\n }\n URLExt.normalize = normalize;\n /**\n * Join a sequence of url components and normalizes as in node `path.join`.\n *\n * @param parts - The url components.\n *\n * @returns the joined url.\n */\n function join(...parts) {\n let u = (0, url_parse_1.default)(parts[0], {});\n // Schema-less URL can be only parsed as relative to a base URL\n // see https://github.com/unshiftio/url-parse/issues/219#issuecomment-1002219326\n const isSchemaLess = u.protocol === '' && u.slashes;\n if (isSchemaLess) {\n u = (0, url_parse_1.default)(parts[0], 'https:' + parts[0]);\n }\n const prefix = `${isSchemaLess ? '' : u.protocol}${u.slashes ? '//' : ''}${u.auth}${u.auth ? '@' : ''}${u.host}`;\n // If there was a prefix, then the first path must start at the root.\n const path = path_1.posix.join(`${!!prefix && u.pathname[0] !== '/' ? '/' : ''}${u.pathname}`, ...parts.slice(1));\n return `${prefix}${path === '.' ? '' : path}`;\n }\n URLExt.join = join;\n /**\n * Encode the components of a multi-segment url.\n *\n * @param url - The url to encode.\n *\n * @returns the encoded url.\n *\n * #### Notes\n * Preserves the `'/'` separators.\n * Should not include the base url, since all parts are escaped.\n */\n function encodeParts(url) {\n return join(...url.split('/').map(encodeURIComponent));\n }\n URLExt.encodeParts = encodeParts;\n /**\n * Return a serialized object string suitable for a query.\n *\n * @param value The source object.\n *\n * @returns an encoded url query.\n *\n * #### Notes\n * Modified version of [stackoverflow](http://stackoverflow.com/a/30707423).\n */\n function objectToQueryString(value) {\n const keys = Object.keys(value).filter(key => key.length > 0);\n if (!keys.length) {\n return '';\n }\n return ('?' +\n keys\n .map(key => {\n const content = encodeURIComponent(String(value[key]));\n return key + (content ? '=' + content : '');\n })\n .join('&'));\n }\n URLExt.objectToQueryString = objectToQueryString;\n /**\n * Return a parsed object that represents the values in a query string.\n */\n function queryStringToObject(value) {\n return value\n .replace(/^\\?/, '')\n .split('&')\n .reduce((acc, val) => {\n const [key, value] = val.split('=');\n if (key.length > 0) {\n acc[key] = decodeURIComponent(value || '');\n }\n return acc;\n }, {});\n }\n URLExt.queryStringToObject = queryStringToObject;\n /**\n * Test whether the url is a local url.\n *\n * @param allowRoot - Whether the paths starting at Unix-style filesystem root (`/`) are permitted.\n *\n * #### Notes\n * This function returns `false` for any fully qualified url, including\n * `data:`, `file:`, and `//` protocol URLs.\n */\n function isLocal(url, allowRoot = false) {\n const { protocol } = parse(url);\n return ((!protocol || url.toLowerCase().indexOf(protocol) !== 0) &&\n (allowRoot ? url.indexOf('//') !== 0 : url.indexOf('/') !== 0));\n }\n URLExt.isLocal = isLocal;\n})(URLExt || (exports.URLExt = URLExt = {}));\n//# sourceMappingURL=url.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module javascript-extension\n */\nimport { RenderedJavaScript } from '@jupyterlab/rendermime';\nexport const TEXT_JAVASCRIPT_MIMETYPE = 'text/javascript';\nexport const APPLICATION_JAVASCRIPT_MIMETYPE = 'application/javascript';\nfunction evalInContext(code, element, document, window) {\n // eslint-disable-next-line\n return eval(code);\n}\nexport class ExperimentalRenderedJavascript extends RenderedJavaScript {\n render(model) {\n const trans = this.translator.load('jupyterlab');\n const renderJavascript = () => {\n try {\n const data = model.data[this.mimeType];\n if (data) {\n evalInContext(data, this.node, document, window);\n }\n return Promise.resolve();\n }\n catch (error) {\n return Promise.reject(error);\n }\n };\n if (!model.trusted) {\n // If output is not trusted or if arbitrary Javascript execution is not enabled, render an informative error message\n const pre = document.createElement('pre');\n pre.textContent = trans.__('Are you sure that you want to run arbitrary Javascript within your JupyterLab session?');\n const button = document.createElement('button');\n button.textContent = trans.__('Run');\n this.node.appendChild(pre);\n this.node.appendChild(button);\n button.onclick = event => {\n this.node.textContent = '';\n void renderJavascript();\n };\n return Promise.resolve();\n }\n return renderJavascript();\n }\n}\n/**\n * A mime renderer factory for text/javascript data.\n */\nexport const rendererFactory = {\n safe: false,\n mimeTypes: [TEXT_JAVASCRIPT_MIMETYPE, APPLICATION_JAVASCRIPT_MIMETYPE],\n createRenderer: options => new ExperimentalRenderedJavascript(options)\n};\nconst extension = {\n id: '@jupyterlab/javascript-extension:factory',\n description: 'Adds renderer for JavaScript content.',\n rendererFactory,\n rank: 0,\n dataType: 'string'\n};\nexport default extension;\n//# sourceMappingURL=index.js.map","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.lumino_coreutils = {}));\n}(this, (function (exports) { 'use strict';\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * The namespace for JSON-specific functions.\n */\n exports.JSONExt = void 0;\n (function (JSONExt) {\n /**\n * A shared frozen empty JSONObject\n */\n JSONExt.emptyObject = Object.freeze({});\n /**\n * A shared frozen empty JSONArray\n */\n JSONExt.emptyArray = Object.freeze([]);\n /**\n * Test whether a JSON value is a primitive.\n *\n * @param value - The JSON value of interest.\n *\n * @returns `true` if the value is a primitive,`false` otherwise.\n */\n function isPrimitive(value) {\n return (value === null ||\n typeof value === 'boolean' ||\n typeof value === 'number' ||\n typeof value === 'string');\n }\n JSONExt.isPrimitive = isPrimitive;\n function isArray(value) {\n return Array.isArray(value);\n }\n JSONExt.isArray = isArray;\n function isObject(value) {\n return !isPrimitive(value) && !isArray(value);\n }\n JSONExt.isObject = isObject;\n /**\n * Compare two JSON values for deep equality.\n *\n * @param first - The first JSON value of interest.\n *\n * @param second - The second JSON value of interest.\n *\n * @returns `true` if the values are equivalent, `false` otherwise.\n */\n function deepEqual(first, second) {\n // Check referential and primitive equality first.\n if (first === second) {\n return true;\n }\n // If one is a primitive, the `===` check ruled out the other.\n if (isPrimitive(first) || isPrimitive(second)) {\n return false;\n }\n // Test whether they are arrays.\n var a1 = isArray(first);\n var a2 = isArray(second);\n // Bail if the types are different.\n if (a1 !== a2) {\n return false;\n }\n // If they are both arrays, compare them.\n if (a1 && a2) {\n return deepArrayEqual(first, second);\n }\n // At this point, they must both be objects.\n return deepObjectEqual(first, second);\n }\n JSONExt.deepEqual = deepEqual;\n /**\n * Create a deep copy of a JSON value.\n *\n * @param value - The JSON value to copy.\n *\n * @returns A deep copy of the given JSON value.\n */\n function deepCopy(value) {\n // Do nothing for primitive values.\n if (isPrimitive(value)) {\n return value;\n }\n // Deep copy an array.\n if (isArray(value)) {\n return deepArrayCopy(value);\n }\n // Deep copy an object.\n return deepObjectCopy(value);\n }\n JSONExt.deepCopy = deepCopy;\n /**\n * Compare two JSON arrays for deep equality.\n */\n function deepArrayEqual(first, second) {\n // Check referential equality first.\n if (first === second) {\n return true;\n }\n // Test the arrays for equal length.\n if (first.length !== second.length) {\n return false;\n }\n // Compare the values for equality.\n for (var i = 0, n = first.length; i < n; ++i) {\n if (!deepEqual(first[i], second[i])) {\n return false;\n }\n }\n // At this point, the arrays are equal.\n return true;\n }\n /**\n * Compare two JSON objects for deep equality.\n */\n function deepObjectEqual(first, second) {\n // Check referential equality first.\n if (first === second) {\n return true;\n }\n // Check for the first object's keys in the second object.\n for (var key in first) {\n if (first[key] !== undefined && !(key in second)) {\n return false;\n }\n }\n // Check for the second object's keys in the first object.\n for (var key in second) {\n if (second[key] !== undefined && !(key in first)) {\n return false;\n }\n }\n // Compare the values for equality.\n for (var key in first) {\n // Get the values.\n var firstValue = first[key];\n var secondValue = second[key];\n // If both are undefined, ignore the key.\n if (firstValue === undefined && secondValue === undefined) {\n continue;\n }\n // If only one value is undefined, the objects are not equal.\n if (firstValue === undefined || secondValue === undefined) {\n return false;\n }\n // Compare the values.\n if (!deepEqual(firstValue, secondValue)) {\n return false;\n }\n }\n // At this point, the objects are equal.\n return true;\n }\n /**\n * Create a deep copy of a JSON array.\n */\n function deepArrayCopy(value) {\n var result = new Array(value.length);\n for (var i = 0, n = value.length; i < n; ++i) {\n result[i] = deepCopy(value[i]);\n }\n return result;\n }\n /**\n * Create a deep copy of a JSON object.\n */\n function deepObjectCopy(value) {\n var result = {};\n for (var key in value) {\n // Ignore undefined values.\n var subvalue = value[key];\n if (subvalue === undefined) {\n continue;\n }\n result[key] = deepCopy(subvalue);\n }\n return result;\n }\n })(exports.JSONExt || (exports.JSONExt = {}));\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * An object which stores MIME data for general application use.\n *\n * #### Notes\n * This class does not attempt to enforce \"correctness\" of MIME types\n * and their associated data. Since this class is designed to transfer\n * arbitrary data and objects within the same application, it assumes\n * that the user provides correct and accurate data.\n */\n var MimeData = /** @class */ (function () {\n function MimeData() {\n this._types = [];\n this._values = [];\n }\n /**\n * Get an array of the MIME types contained within the dataset.\n *\n * @returns A new array of the MIME types, in order of insertion.\n */\n MimeData.prototype.types = function () {\n return this._types.slice();\n };\n /**\n * Test whether the dataset has an entry for the given type.\n *\n * @param mime - The MIME type of interest.\n *\n * @returns `true` if the dataset contains a value for the given\n * MIME type, `false` otherwise.\n */\n MimeData.prototype.hasData = function (mime) {\n return this._types.indexOf(mime) !== -1;\n };\n /**\n * Get the data value for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * @returns The value for the given MIME type, or `undefined` if\n * the dataset does not contain a value for the type.\n */\n MimeData.prototype.getData = function (mime) {\n var i = this._types.indexOf(mime);\n return i !== -1 ? this._values[i] : undefined;\n };\n /**\n * Set the data value for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * @param data - The data value for the given MIME type.\n *\n * #### Notes\n * This will overwrite any previous entry for the MIME type.\n */\n MimeData.prototype.setData = function (mime, data) {\n this.clearData(mime);\n this._types.push(mime);\n this._values.push(data);\n };\n /**\n * Remove the data entry for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * #### Notes\n * This is a no-op if there is no entry for the given MIME type.\n */\n MimeData.prototype.clearData = function (mime) {\n var i = this._types.indexOf(mime);\n if (i !== -1) {\n this._types.splice(i, 1);\n this._values.splice(i, 1);\n }\n };\n /**\n * Remove all data entries from the dataset.\n */\n MimeData.prototype.clear = function () {\n this._types.length = 0;\n this._values.length = 0;\n };\n return MimeData;\n }());\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * A class which wraps a promise into a delegate object.\n *\n * #### Notes\n * This class is useful when the logic to resolve or reject a promise\n * cannot be defined at the point where the promise is created.\n */\n var PromiseDelegate = /** @class */ (function () {\n /**\n * Construct a new promise delegate.\n */\n function PromiseDelegate() {\n var _this = this;\n this.promise = new Promise(function (resolve, reject) {\n _this._resolve = resolve;\n _this._reject = reject;\n });\n }\n /**\n * Resolve the wrapped promise with the given value.\n *\n * @param value - The value to use for resolving the promise.\n */\n PromiseDelegate.prototype.resolve = function (value) {\n var resolve = this._resolve;\n resolve(value);\n };\n /**\n * Reject the wrapped promise with the given value.\n *\n * @reason - The reason for rejecting the promise.\n */\n PromiseDelegate.prototype.reject = function (reason) {\n var reject = this._reject;\n reject(reason);\n };\n return PromiseDelegate;\n }());\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * A runtime object which captures compile-time type information.\n *\n * #### Notes\n * A token captures the compile-time type of an interface or class in\n * an object which can be used at runtime in a type-safe fashion.\n */\n var Token = /** @class */ (function () {\n /**\n * Construct a new token.\n *\n * @param name - A human readable name for the token.\n */\n function Token(name) {\n this.name = name;\n this._tokenStructuralPropertyT = null;\n }\n return Token;\n }());\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n // Fallback\n function fallbackRandomValues(buffer) {\n var value = 0;\n for (var i = 0, n = buffer.length; i < n; ++i) {\n if (i % 4 === 0) {\n value = (Math.random() * 0xffffffff) >>> 0;\n }\n buffer[i] = value & 0xff;\n value >>>= 8;\n }\n }\n\n // Copyright (c) Jupyter Development Team.\n /**\n * The namespace for random number related functionality.\n */\n exports.Random = void 0;\n (function (Random) {\n /**\n * A function which generates random bytes.\n *\n * @param buffer - The `Uint8Array` to fill with random bytes.\n *\n * #### Notes\n * A cryptographically strong random number generator will be used if\n * available. Otherwise, `Math.random` will be used as a fallback for\n * randomness.\n *\n * The following RNGs are supported, listed in order of precedence:\n * - `window.crypto.getRandomValues`\n * - `window.msCrypto.getRandomValues`\n * - `require('crypto').randomFillSync\n * - `require('crypto').randomBytes\n * - `Math.random`\n */\n Random.getRandomValues = (function () {\n // Look up the crypto module if available.\n var crypto = (typeof window !== 'undefined' && (window.crypto || window.msCrypto)) ||\n null;\n // Modern browsers and IE 11\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return function getRandomValues(buffer) {\n return crypto.getRandomValues(buffer);\n };\n }\n // Fallback\n return fallbackRandomValues;\n })();\n })(exports.Random || (exports.Random = {}));\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * A function which creates a function that generates UUID v4 identifiers.\n *\n * @returns A new function that creates a UUID v4 string.\n *\n * #### Notes\n * This implementation complies with RFC 4122.\n *\n * This uses `Random.getRandomValues()` for random bytes, which in\n * turn will use the underlying `crypto` module of the platform if\n * it is available. The fallback for randomness is `Math.random`.\n */\n function uuid4Factory(getRandomValues) {\n // Create a 16 byte array to hold the random values.\n var bytes = new Uint8Array(16);\n // Create a look up table from bytes to hex strings.\n var lut = new Array(256);\n // Pad the single character hex digits with a leading zero.\n for (var i = 0; i < 16; ++i) {\n lut[i] = '0' + i.toString(16);\n }\n // Populate the rest of the hex digits.\n for (var i = 16; i < 256; ++i) {\n lut[i] = i.toString(16);\n }\n // Return a function which generates the UUID.\n return function uuid4() {\n // Get a new batch of random values.\n getRandomValues(bytes);\n // Set the UUID version number to 4.\n bytes[6] = 0x40 | (bytes[6] & 0x0f);\n // Set the clock sequence bit to the RFC spec.\n bytes[8] = 0x80 | (bytes[8] & 0x3f);\n // Assemble the UUID string.\n return (lut[bytes[0]] +\n lut[bytes[1]] +\n lut[bytes[2]] +\n lut[bytes[3]] +\n '-' +\n lut[bytes[4]] +\n lut[bytes[5]] +\n '-' +\n lut[bytes[6]] +\n lut[bytes[7]] +\n '-' +\n lut[bytes[8]] +\n lut[bytes[9]] +\n '-' +\n lut[bytes[10]] +\n lut[bytes[11]] +\n lut[bytes[12]] +\n lut[bytes[13]] +\n lut[bytes[14]] +\n lut[bytes[15]]);\n };\n }\n\n // Copyright (c) Jupyter Development Team.\n /**\n * The namespace for UUID related functionality.\n */\n exports.UUID = void 0;\n (function (UUID) {\n /**\n * A function which generates UUID v4 identifiers.\n *\n * @returns A new UUID v4 string.\n *\n * #### Notes\n * This implementation complies with RFC 4122.\n *\n * This uses `Random.getRandomValues()` for random bytes, which in\n * turn will use the underlying `crypto` module of the platform if\n * it is available. The fallback for randomness is `Math.random`.\n */\n UUID.uuid4 = uuid4Factory(exports.Random.getRandomValues);\n })(exports.UUID || (exports.UUID = {}));\n\n exports.MimeData = MimeData;\n exports.PromiseDelegate = PromiseDelegate;\n exports.Token = Token;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=index.js.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for array-specific algorithms.\n */\nvar ArrayExt;\n(function (ArrayExt) {\n /**\n * Find the index of the first occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.firstIndexOf(data, 'red'); // -1\n * ArrayExt.firstIndexOf(data, 'one'); // 0\n * ArrayExt.firstIndexOf(data, 'one', 1); // 4\n * ArrayExt.firstIndexOf(data, 'two', 2); // -1\n * ArrayExt.firstIndexOf(data, 'two', 2, 1); // 1\n * ```\n */\n function firstIndexOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.firstIndexOf = firstIndexOf;\n /**\n * Find the index of the last occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.lastIndexOf(data, 'red'); // -1\n * ArrayExt.lastIndexOf(data, 'one'); // 4\n * ArrayExt.lastIndexOf(data, 'one', 1); // 0\n * ArrayExt.lastIndexOf(data, 'two', 0); // -1\n * ArrayExt.lastIndexOf(data, 'two', 0, 1); // 1\n * ```\n */\n function lastIndexOf(array, value, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (start < stop) {\n span = start + 1 + (n - stop);\n }\n else {\n span = start - stop + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start - i + n) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.lastIndexOf = lastIndexOf;\n /**\n * Find the index of the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstIndex(data, isEven); // 1\n * ArrayExt.findFirstIndex(data, isEven, 4); // 5\n * ArrayExt.findFirstIndex(data, isEven, 6); // -1\n * ArrayExt.findFirstIndex(data, isEven, 6, 5); // 1\n * ```\n */\n function findFirstIndex(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findFirstIndex = findFirstIndex;\n /**\n * Find the index of the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastIndex(data, isEven); // 5\n * ArrayExt.findLastIndex(data, isEven, 4); // 3\n * ArrayExt.findLastIndex(data, isEven, 0); // -1\n * ArrayExt.findLastIndex(data, isEven, 0, 1); // 5\n * ```\n */\n function findLastIndex(array, fn, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let d;\n if (start < stop) {\n d = start + 1 + (n - stop);\n }\n else {\n d = start - stop + 1;\n }\n for (let i = 0; i < d; ++i) {\n let j = (start - i + n) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findLastIndex = findLastIndex;\n /**\n * Find the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstValue(data, isEven); // 2\n * ArrayExt.findFirstValue(data, isEven, 2); // 4\n * ArrayExt.findFirstValue(data, isEven, 6); // undefined\n * ArrayExt.findFirstValue(data, isEven, 6, 5); // 2\n * ```\n */\n function findFirstValue(array, fn, start = 0, stop = -1) {\n let index = findFirstIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findFirstValue = findFirstValue;\n /**\n * Find the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The last matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastValue(data, isEven); // 2\n * ArrayExt.findLastValue(data, isEven, 4); // 4\n * ArrayExt.findLastValue(data, isEven, 0); // undefined\n * ArrayExt.findLastValue(data, isEven, 0, 1); // 2\n * ```\n */\n function findLastValue(array, fn, start = -1, stop = 0) {\n let index = findLastIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findLastValue = findLastValue;\n /**\n * Find the index of the first element which compares `>=` to a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>=` to the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.lowerBound(data, 0, numberCmp); // 0\n * ArrayExt.lowerBound(data, 6, numberCmp); // 3\n * ArrayExt.lowerBound(data, 7, numberCmp); // 3\n * ArrayExt.lowerBound(data, -1, numberCmp); // 0\n * ArrayExt.lowerBound(data, 10, numberCmp); // 6\n * ```\n */\n function lowerBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) < 0) {\n begin = middle + 1;\n span -= half + 1;\n }\n else {\n span = half;\n }\n }\n return begin;\n }\n ArrayExt.lowerBound = lowerBound;\n /**\n * Find the index of the first element which compares `>` than a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>` than the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.upperBound(data, 0, numberCmp); // 1\n * ArrayExt.upperBound(data, 6, numberCmp); // 3\n * ArrayExt.upperBound(data, 7, numberCmp); // 5\n * ArrayExt.upperBound(data, -1, numberCmp); // 0\n * ArrayExt.upperBound(data, 10, numberCmp); // 6\n * ```\n */\n function upperBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) > 0) {\n span = half;\n }\n else {\n begin = middle + 1;\n span -= half + 1;\n }\n }\n return begin;\n }\n ArrayExt.upperBound = upperBound;\n /**\n * Test whether two arrays are shallowly equal.\n *\n * @param a - The first array-like object to compare.\n *\n * @param b - The second array-like object to compare.\n *\n * @param fn - The comparison function to apply to the elements. It\n * should return `true` if the elements are \"equal\". The default\n * compares elements using strict `===` equality.\n *\n * @returns Whether the two arrays are shallowly equal.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * Modifying the length of the arrays while comparing.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let d1 = [0, 3, 4, 7, 7, 9];\n * let d2 = [0, 3, 4, 7, 7, 9];\n * let d3 = [42];\n * ArrayExt.shallowEqual(d1, d2); // true\n * ArrayExt.shallowEqual(d2, d3); // false\n * ```\n */\n function shallowEqual(a, b, fn) {\n // Check for object identity first.\n if (a === b) {\n return true;\n }\n // Bail early if the lengths are different.\n if (a.length !== b.length) {\n return false;\n }\n // Compare each element for equality.\n for (let i = 0, n = a.length; i < n; ++i) {\n if (fn ? !fn(a[i], b[i]) : a[i] !== b[i]) {\n return false;\n }\n }\n // The array are shallowly equal.\n return true;\n }\n ArrayExt.shallowEqual = shallowEqual;\n /**\n * Create a slice of an array subject to an optional step.\n *\n * @param array - The array-like object of interest.\n *\n * @param options - The options for configuring the slice.\n *\n * @returns A new array with the specified values.\n *\n * @throws An exception if the slice `step` is `0`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start`, `stop`, or `step` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]\n * ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]\n * ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]\n * ```\n */\n function slice(array, options = {}) {\n // Extract the options.\n let { start, stop, step } = options;\n // Set up the `step` value.\n if (step === undefined) {\n step = 1;\n }\n // Validate the step size.\n if (step === 0) {\n throw new Error('Slice `step` cannot be zero.');\n }\n // Look up the length of the array.\n let n = array.length;\n // Set up the `start` value.\n if (start === undefined) {\n start = step < 0 ? n - 1 : 0;\n }\n else if (start < 0) {\n start = Math.max(start + n, step < 0 ? -1 : 0);\n }\n else if (start >= n) {\n start = step < 0 ? n - 1 : n;\n }\n // Set up the `stop` value.\n if (stop === undefined) {\n stop = step < 0 ? -1 : n;\n }\n else if (stop < 0) {\n stop = Math.max(stop + n, step < 0 ? -1 : 0);\n }\n else if (stop >= n) {\n stop = step < 0 ? n - 1 : n;\n }\n // Compute the slice length.\n let length;\n if ((step < 0 && stop >= start) || (step > 0 && start >= stop)) {\n length = 0;\n }\n else if (step < 0) {\n length = Math.floor((stop - start + 1) / step + 1);\n }\n else {\n length = Math.floor((stop - start - 1) / step + 1);\n }\n // Compute the sliced result.\n let result = [];\n for (let i = 0; i < length; ++i) {\n result[i] = array[start + i * step];\n }\n // Return the result.\n return result;\n }\n ArrayExt.slice = slice;\n /**\n * Move an element in an array from one index to another.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param fromIndex - The index of the element to move. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param toIndex - The target index of the element. Negative\n * values are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `fromIndex` or `toIndex` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.move(data, 1, 2); // [0, 2, 1, 3, 4]\n * ArrayExt.move(data, 4, 2); // [0, 2, 4, 1, 3]\n * ```\n */\n function move(array, fromIndex, toIndex) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (fromIndex < 0) {\n fromIndex = Math.max(0, fromIndex + n);\n }\n else {\n fromIndex = Math.min(fromIndex, n - 1);\n }\n if (toIndex < 0) {\n toIndex = Math.max(0, toIndex + n);\n }\n else {\n toIndex = Math.min(toIndex, n - 1);\n }\n if (fromIndex === toIndex) {\n return;\n }\n let value = array[fromIndex];\n let d = fromIndex < toIndex ? 1 : -1;\n for (let i = fromIndex; i !== toIndex; i += d) {\n array[i] = array[i + d];\n }\n array[toIndex] = value;\n }\n ArrayExt.move = move;\n /**\n * Reverse an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param start - The index of the first element in the range to be\n * reversed, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * reversed, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` index which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.reverse(data, 1, 3); // [0, 3, 2, 1, 4]\n * ArrayExt.reverse(data, 3); // [0, 3, 2, 4, 1]\n * ArrayExt.reverse(data); // [1, 4, 2, 3, 0]\n * ```\n */\n function reverse(array, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n while (start < stop) {\n let a = array[start];\n let b = array[stop];\n array[start++] = b;\n array[stop--] = a;\n }\n }\n ArrayExt.reverse = reverse;\n /**\n * Rotate the elements of an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param delta - The amount of rotation to apply to the elements. A\n * positive value will rotate the elements to the left. A negative\n * value will rotate the elements to the right.\n *\n * @param start - The index of the first element in the range to be\n * rotated, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * rotated, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `delta`, `start`, or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.rotate(data, 2); // [2, 3, 4, 0, 1]\n * ArrayExt.rotate(data, -2); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 10); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 9); // [4, 0, 1, 2, 3]\n * ArrayExt.rotate(data, 2, 1, 3); // [4, 2, 0, 1, 3]\n * ```\n */\n function rotate(array, delta, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n if (start >= stop) {\n return;\n }\n let length = stop - start + 1;\n if (delta > 0) {\n delta = delta % length;\n }\n else if (delta < 0) {\n delta = ((delta % length) + length) % length;\n }\n if (delta === 0) {\n return;\n }\n let pivot = start + delta;\n reverse(array, start, pivot - 1);\n reverse(array, pivot, stop);\n reverse(array, start, stop);\n }\n ArrayExt.rotate = rotate;\n /**\n * Fill an array with a static value.\n *\n * @param array - The mutable array-like object to fill.\n *\n * @param value - The static value to use to fill the array.\n *\n * @param start - The index of the first element in the range to be\n * filled, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * filled, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Notes\n * If `stop < start` the fill will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four'];\n * ArrayExt.fill(data, 'r'); // ['r', 'r', 'r', 'r']\n * ArrayExt.fill(data, 'g', 1); // ['r', 'g', 'g', 'g']\n * ArrayExt.fill(data, 'b', 2, 3); // ['r', 'g', 'b', 'b']\n * ArrayExt.fill(data, 'z', 3, 1); // ['z', 'z', 'b', 'z']\n * ```\n */\n function fill(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n array[(start + i) % n] = value;\n }\n }\n ArrayExt.fill = fill;\n /**\n * Insert a value into an array at a specific index.\n *\n * @param array - The array of interest.\n *\n * @param index - The index at which to insert the value. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2];\n * ArrayExt.insert(data, 0, -1); // [-1, 0, 1, 2]\n * ArrayExt.insert(data, 2, 12); // [-1, 0, 12, 1, 2]\n * ArrayExt.insert(data, -1, 7); // [-1, 0, 12, 1, 7, 2]\n * ArrayExt.insert(data, 6, 19); // [-1, 0, 12, 1, 7, 2, 19]\n * ```\n */\n function insert(array, index, value) {\n let n = array.length;\n if (index < 0) {\n index = Math.max(0, index + n);\n }\n else {\n index = Math.min(index, n);\n }\n for (let i = n; i > index; --i) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n }\n ArrayExt.insert = insert;\n /**\n * Remove and return a value at a specific index in an array.\n *\n * @param array - The array of interest.\n *\n * @param index - The index of the value to remove. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The value at the specified index, or `undefined` if the\n * index is out of range.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeAt(data, 2); // 23\n * ArrayExt.removeAt(data, -2); // 12\n * ArrayExt.removeAt(data, 10); // undefined;\n * ```\n */\n function removeAt(array, index) {\n let n = array.length;\n if (index < 0) {\n index += n;\n }\n if (index < 0 || index >= n) {\n return undefined;\n }\n let value = array[index];\n for (let i = index + 1; i < n; ++i) {\n array[i - 1] = array[i];\n }\n array.length = n - 1;\n return value;\n }\n ArrayExt.removeAt = removeAt;\n /**\n * Remove the first occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstOf(data, 12); // 1\n * ArrayExt.removeFirstOf(data, 17); // -1\n * ArrayExt.removeFirstOf(data, 39, 3); // -1\n * ArrayExt.removeFirstOf(data, 39, 3, 2); // 2\n * ```\n */\n function removeFirstOf(array, value, start = 0, stop = -1) {\n let index = firstIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeFirstOf = removeFirstOf;\n /**\n * Remove the last occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastOf(data, 12); // 5\n * ArrayExt.removeLastOf(data, 17); // -1\n * ArrayExt.removeLastOf(data, 39, 2); // -1\n * ArrayExt.removeLastOf(data, 39, 2, 3); // 3\n * ```\n */\n function removeLastOf(array, value, start = -1, stop = 0) {\n let index = lastIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeLastOf = removeLastOf;\n /**\n * Remove all occurrences of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [14, 12, 23, 39, 14, 12, 19, 14];\n * ArrayExt.removeAllOf(data, 12); // 2\n * ArrayExt.removeAllOf(data, 17); // 0\n * ArrayExt.removeAllOf(data, 14, 1, 4); // 1\n * ```\n */\n function removeAllOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && array[i] === value) {\n count++;\n }\n else if (stop < start &&\n (i <= stop || i >= start) &&\n array[i] === value) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllOf = removeAllOf;\n /**\n * Remove the first occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstWhere(data, isEven); // { index: 0, value: 0 }\n * ArrayExt.removeFirstWhere(data, isEven, 2); // { index: 3, value: 14 }\n * ArrayExt.removeFirstWhere(data, isEven, 4); // { index: -1, value: undefined }\n * ```\n */\n function removeFirstWhere(array, fn, start = 0, stop = -1) {\n let value;\n let index = findFirstIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeFirstWhere = removeFirstWhere;\n /**\n * Remove the last occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastWhere(data, isEven); // { index: 5, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2); // { index: 1, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2, 1); // { index: -1, value: undefined }\n * ```\n */\n function removeLastWhere(array, fn, start = -1, stop = 0) {\n let value;\n let index = findLastIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeLastWhere = removeLastWhere;\n /**\n * Remove all occurrences of values which match a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * function isNegative(value: number): boolean {\n * return value < 0;\n * }\n *\n * let data = [0, 12, -13, -9, 23, 39, 14, -15, 12, 75];\n * ArrayExt.removeAllWhere(data, isEven); // 4\n * ArrayExt.removeAllWhere(data, isNegative, 0, 3); // 2\n * ```\n */\n function removeAllWhere(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && fn(array[i], i)) {\n count++;\n }\n else if (stop < start && (i <= stop || i >= start) && fn(array[i], i)) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllWhere = removeAllWhere;\n})(ArrayExt || (ArrayExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Chain together several iterables.\n *\n * @deprecated\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields the values of the iterables\n * in the order in which they are supplied.\n *\n * #### Example\n * ```typescript\n * import { chain } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = chain(data1, data2);\n *\n * Array.from(stream); // [1, 2, 3, 4, 5, 6]\n * ```\n */\nfunction* chain(...objects) {\n for (const object of objects) {\n yield* object;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an empty iterator.\n *\n * @returns A new iterator which yields nothing.\n *\n * #### Example\n * ```typescript\n * import { empty } from '@lumino/algorithm';\n *\n * let stream = empty();\n *\n * Array.from(stream); // []\n * ```\n */\n// eslint-disable-next-line require-yield\nfunction* empty() {\n return;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Enumerate an iterable object.\n *\n * @param object - The iterable object of interest.\n *\n * @param start - The starting enum value. The default is `0`.\n *\n * @returns An iterator which yields the enumerated values.\n *\n * #### Example\n * ```typescript\n * import { enumerate } from '@lumino/algorithm';\n *\n * let data = ['foo', 'bar', 'baz'];\n *\n * let stream = enumerate(data, 1);\n *\n * Array.from(stream); // [[1, 'foo'], [2, 'bar'], [3, 'baz']]\n * ```\n */\nfunction* enumerate(object, start = 0) {\n for (const value of object) {\n yield [start++, value];\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Filter an iterable for values which pass a test.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns An iterator which yields the values which pass the test.\n *\n * #### Example\n * ```typescript\n * import { filter } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = filter(data, value => value % 2 === 0);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* filter(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Find the first value in an iterable which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { find } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * find(data, isCat).name; // 'fluffy'\n * ```\n */\nfunction find(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return value;\n }\n }\n return undefined;\n}\n/**\n * Find the index of the first value which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { findIndex } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * findIndex(data, isCat); // 1\n * ```\n */\nfunction findIndex(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return index - 1;\n }\n }\n return -1;\n}\n/**\n * Find the minimum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The minimum value in the iterable. If multiple values are\n * equivalent to the minimum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { min } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * min([7, 4, 0, 3, 9, 4], numberCmp); // 0\n * ```\n */\nfunction min(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) < 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the maximum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The maximum value in the iterable. If multiple values are\n * equivalent to the maximum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { max } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * max([7, 4, 0, 3, 9, 4], numberCmp); // 9\n * ```\n */\nfunction max(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) > 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the minimum and maximum values in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns A 2-tuple of the `[min, max]` values in the iterable. If\n * multiple values are equivalent, the left-most values are returned.\n * If the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { minmax } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * minmax([7, 4, 0, 3, 9, 4], numberCmp); // [0, 9]\n * ```\n */\nfunction minmax(object, fn) {\n let empty = true;\n let vmin;\n let vmax;\n for (const value of object) {\n if (empty) {\n vmin = value;\n vmax = value;\n empty = false;\n }\n else if (fn(value, vmin) < 0) {\n vmin = value;\n }\n else if (fn(value, vmax) > 0) {\n vmax = value;\n }\n }\n return empty ? undefined : [vmin, vmax];\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an array from an iterable of values.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new array of values from the given object.\n *\n * #### Example\n * ```typescript\n * import { toArray } from '@lumino/algorithm';\n *\n * let stream = [1, 2, 3, 4, 5, 6][Symbol.iterator]();\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6];\n * ```\n */\nfunction toArray(object) {\n return Array.from(object);\n}\n/**\n * Create an object from an iterable of key/value pairs.\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new object mapping keys to values.\n *\n * #### Example\n * ```typescript\n * import { toObject } from '@lumino/algorithm';\n *\n * let data: [string, number][] = [['one', 1], ['two', 2], ['three', 3]];\n *\n * toObject(data); // { one: 1, two: 2, three: 3 }\n * ```\n */\nfunction toObject(object) {\n const result = {};\n for (const [key, value] of object) {\n result[key] = value;\n }\n return result;\n}\n/**\n * Invoke a function for each value in an iterable.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The callback function to invoke for each value.\n *\n * #### Notes\n * Iteration can be terminated early by returning `false` from the\n * callback function.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each } from '@lumino/algorithm';\n *\n * let data = [5, 7, 0, -2, 9];\n *\n * each(data, value => { console.log(value); });\n * ```\n */\nfunction each(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return;\n }\n }\n}\n/**\n * Test whether all values in an iterable satisfy a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if all values pass the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `false` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { every } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * every(data, value => value % 2 === 0); // false\n * every(data, value => value % 2 === 1); // true\n * ```\n */\nfunction every(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Test whether any value in an iterable satisfies a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if any value passes the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `true` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { some } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * some(data, value => value === 7); // true\n * some(data, value => value === 3); // false\n * ```\n */\nfunction some(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return true;\n }\n }\n return false;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Transform the values of an iterable with a mapping function.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n *\n * @returns An iterator which yields the transformed values.\n *\n * #### Example\n * ```typescript\n * import { map } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3];\n *\n * let stream = map(data, value => value * 2);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* map(object, fn) {\n let index = 0;\n for (const value of object) {\n yield fn(value, index++);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator of evenly spaced values.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns An iterator which produces evenly spaced values.\n *\n * #### Notes\n * In the single argument form of `range(stop)`, `start` defaults to\n * `0` and `step` defaults to `1`.\n *\n * In the two argument form of `range(start, stop)`, `step` defaults\n * to `1`.\n *\n * #### Example\n * ```typescript\n * import { range } from '@lumino/algorithm';\n *\n * let stream = range(2, 4);\n *\n * Array.from(stream); // [2, 3]\n * ```\n */\nfunction* range(start, stop, step) {\n if (stop === undefined) {\n stop = start;\n start = 0;\n step = 1;\n }\n else if (step === undefined) {\n step = 1;\n }\n const length = Private.rangeLength(start, stop, step);\n for (let index = 0; index < length; index++) {\n yield start + step * index;\n }\n}\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * Compute the effective length of a range.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns The number of steps need to traverse the range.\n */\n function rangeLength(start, stop, step) {\n if (step === 0) {\n return Infinity;\n }\n if (start > stop && step > 0) {\n return 0;\n }\n if (start < stop && step < 0) {\n return 0;\n }\n return Math.ceil((stop - start) / step);\n }\n Private.rangeLength = rangeLength;\n})(Private || (Private = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nfunction reduce(object, fn, initial) {\n // Setup the iterator and fetch the first value.\n const it = object[Symbol.iterator]();\n let index = 0;\n let first = it.next();\n // An empty iterator and no initial value is an error.\n if (first.done && initial === undefined) {\n throw new TypeError('Reduce of empty iterable with no initial value.');\n }\n // If the iterator is empty, return the initial value.\n if (first.done) {\n return initial;\n }\n // If the iterator has a single item and no initial value, the\n // reducer is not invoked and the first item is the return value.\n let second = it.next();\n if (second.done && initial === undefined) {\n return first.value;\n }\n // If iterator has a single item and an initial value is provided,\n // the reducer is invoked and that result is the return value.\n if (second.done) {\n return fn(initial, first.value, index++);\n }\n // Setup the initial accumlated value.\n let accumulator;\n if (initial === undefined) {\n accumulator = fn(first.value, second.value, index++);\n }\n else {\n accumulator = fn(fn(initial, first.value, index++), second.value, index++);\n }\n // Iterate the rest of the values, updating the accumulator.\n let next;\n while (!(next = it.next()).done) {\n accumulator = fn(accumulator, next.value, index++);\n }\n // Return the final accumulated value.\n return accumulator;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator which repeats a value a number of times.\n *\n * @deprecated\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n *\n * @returns A new iterator which repeats the specified value.\n *\n * #### Example\n * ```typescript\n * import { repeat } from '@lumino/algorithm';\n *\n * let stream = repeat(7, 3);\n *\n * Array.from(stream); // [7, 7, 7]\n * ```\n */\nfunction* repeat(value, count) {\n while (0 < count--) {\n yield value;\n }\n}\n/**\n * Create an iterator which yields a value a single time.\n *\n * @deprecated\n *\n * @param value - The value to wrap in an iterator.\n *\n * @returns A new iterator which yields the value a single time.\n *\n * #### Example\n * ```typescript\n * import { once } from '@lumino/algorithm';\n *\n * let stream = once(7);\n *\n * Array.from(stream); // [7]\n * ```\n */\nfunction* once(value) {\n yield value;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator for a retroable object.\n *\n * @param object - The retroable or array-like object of interest.\n *\n * @returns An iterator which traverses the object's values in reverse.\n *\n * #### Example\n * ```typescript\n * import { retro } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = retro(data);\n *\n * Array.from(stream); // [6, 5, 4, 3, 2, 1]\n * ```\n */\nfunction* retro(object) {\n if (typeof object.retro === 'function') {\n yield* object.retro();\n }\n else {\n for (let index = object.length - 1; index > -1; index--) {\n yield object[index];\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Topologically sort an iterable of edges.\n *\n * @param edges - The iterable object of edges to sort.\n * An edge is represented as a 2-tuple of `[fromNode, toNode]`.\n *\n * @returns The topologically sorted array of nodes.\n *\n * #### Notes\n * If a cycle is present in the graph, the cycle will be ignored and\n * the return value will be only approximately sorted.\n *\n * #### Example\n * ```typescript\n * import { topologicSort } from '@lumino/algorithm';\n *\n * let data = [\n * ['d', 'e'],\n * ['c', 'd'],\n * ['a', 'b'],\n * ['b', 'c']\n * ];\n *\n * topologicSort(data); // ['a', 'b', 'c', 'd', 'e']\n * ```\n */\nfunction topologicSort(edges) {\n // Setup the shared sorting state.\n let sorted = [];\n let visited = new Set();\n let graph = new Map();\n // Add the edges to the graph.\n for (const edge of edges) {\n addEdge(edge);\n }\n // Visit each node in the graph.\n for (const [k] of graph) {\n visit(k);\n }\n // Return the sorted results.\n return sorted;\n // Add an edge to the graph.\n function addEdge(edge) {\n let [fromNode, toNode] = edge;\n let children = graph.get(toNode);\n if (children) {\n children.push(fromNode);\n }\n else {\n graph.set(toNode, [fromNode]);\n }\n }\n // Recursively visit the node.\n function visit(node) {\n if (visited.has(node)) {\n return;\n }\n visited.add(node);\n let children = graph.get(node);\n if (children) {\n for (const child of children) {\n visit(child);\n }\n }\n sorted.push(node);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate over an iterable using a stepped increment.\n *\n * @param object - The iterable object of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n *\n * @returns An iterator which traverses the iterable step-wise.\n *\n * #### Example\n * ```typescript\n * import { stride } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = stride(data, 2);\n *\n * Array.from(stream); // [1, 3, 5];\n * ```\n */\nfunction* stride(object, step) {\n let count = 0;\n for (const value of object) {\n if (0 === count++ % step) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for string-specific algorithms.\n */\nvar StringExt;\n(function (StringExt) {\n /**\n * Find the indices of characters in a source text.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The matched indices, or `null` if there is no match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * In order for there to be a match, all of the characters in `query`\n * **must** appear in `source` in the order given by `query`.\n *\n * Characters are matched using strict `===` equality.\n */\n function findIndices(source, query, start = 0) {\n let indices = new Array(query.length);\n for (let i = 0, j = start, n = query.length; i < n; ++i, ++j) {\n j = source.indexOf(query[i], j);\n if (j === -1) {\n return null;\n }\n indices[i] = j;\n }\n return indices;\n }\n StringExt.findIndices = findIndices;\n /**\n * A string matcher which uses a sum-of-squares algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-squares approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The index of each\n * matching character is squared and added to the score. This means\n * that early and consecutive character matches are preferred, while\n * late matches are heavily penalized.\n */\n function matchSumOfSquares(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i] - start;\n score += j * j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfSquares = matchSumOfSquares;\n /**\n * A string matcher which uses a sum-of-deltas algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-deltas approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The delta between\n * the indices are summed to create the score. This means that groups\n * of matched characters are preferred, while fragmented matches are\n * penalized.\n */\n function matchSumOfDeltas(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n let last = start - 1;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i];\n score += j - last - 1;\n last = j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfDeltas = matchSumOfDeltas;\n /**\n * Highlight the matched characters of a source text.\n *\n * @param source - The text which should be highlighted.\n *\n * @param indices - The indices of the matched characters. They must\n * appear in increasing order and must be in bounds of the source.\n *\n * @param fn - The function to apply to the matched chunks.\n *\n * @returns An array of unmatched and highlighted chunks.\n */\n function highlight(source, indices, fn) {\n // Set up the result array.\n let result = [];\n // Set up the counter variables.\n let k = 0;\n let last = 0;\n let n = indices.length;\n // Iterator over each index.\n while (k < n) {\n // Set up the chunk indices.\n let i = indices[k];\n let j = indices[k];\n // Advance the right chunk index until it's non-contiguous.\n while (++k < n && indices[k] === j + 1) {\n j++;\n }\n // Extract the unmatched text.\n if (last < i) {\n result.push(source.slice(last, i));\n }\n // Extract and highlight the matched text.\n if (i < j + 1) {\n result.push(fn(source.slice(i, j + 1)));\n }\n // Update the last visited index.\n last = j + 1;\n }\n // Extract any remaining unmatched text.\n if (last < source.length) {\n result.push(source.slice(last));\n }\n // Return the highlighted result.\n return result;\n }\n StringExt.highlight = highlight;\n /**\n * A 3-way string comparison function.\n *\n * @param a - The first string of interest.\n *\n * @param b - The second string of interest.\n *\n * @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.\n */\n function cmp(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n StringExt.cmp = cmp;\n})(StringExt || (StringExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Take a fixed number of items from an iterable.\n *\n * @param object - The iterable object of interest.\n *\n * @param count - The number of items to take from the iterable.\n *\n * @returns An iterator which yields the specified number of items\n * from the source iterable.\n *\n * #### Notes\n * The returned iterator will exhaust early if the source iterable\n * contains an insufficient number of items.\n *\n * #### Example\n * ```typescript\n * import { take } from '@lumino/algorithm';\n *\n * let stream = take([5, 4, 3, 2, 1, 0, -1], 3);\n *\n * Array.from(stream); // [5, 4, 3]\n * ```\n */\nfunction* take(object, count) {\n if (count < 1) {\n return;\n }\n const it = object[Symbol.iterator]();\n let item;\n while (0 < count-- && !(item = it.next()).done) {\n yield item.value;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate several iterables in lockstep.\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields successive tuples of values where\n * each value is taken in turn from the provided iterables. It will\n * be as long as the shortest provided iterable.\n *\n * #### Example\n * ```typescript\n * import { zip } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = zip(data1, data2);\n *\n * Array.from(stream); // [[1, 4], [2, 5], [3, 6]]\n * ```\n */\nfunction* zip(...objects) {\n const iters = objects.map(obj => obj[Symbol.iterator]());\n let tuple = iters.map(it => it.next());\n for (; every(tuple, item => !item.done); tuple = iters.map(it => it.next())) {\n yield tuple.map(item => item.value);\n }\n}\n\nexport { ArrayExt, StringExt, chain, each, empty, enumerate, every, filter, find, findIndex, map, max, min, minmax, once, range, reduce, repeat, retro, some, stride, take, toArray, toObject, topologicSort, zip };\n//# sourceMappingURL=index.es6.js.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module nbformat\n */\n// Notebook format interfaces\n// https://nbformat.readthedocs.io/en/latest/format_description.html\n// https://github.com/jupyter/nbformat/blob/master/nbformat/v4/nbformat.v4.schema.json\nimport { JSONExt } from '@lumino/coreutils';\n/**\n * The earliest major version of the notebook format we support.\n */\nexport const MAJOR_VERSION = 4;\n/**\n * The earliest minor version of the notebook format we support.\n */\nexport const MINOR_VERSION = 4;\n/**\n * Validate a mime type/value pair.\n *\n * @param type - The mimetype name.\n *\n * @param value - The value associated with the type.\n *\n * @returns Whether the type/value pair are valid.\n */\nexport function validateMimeValue(type, value) {\n // Check if \"application/json\" or \"application/foo+json\"\n const jsonTest = /^application\\/.+\\+json$/;\n const isJSONType = type === 'application/json' || jsonTest.test(type);\n const isString = (x) => {\n return Object.prototype.toString.call(x) === '[object String]';\n };\n // If it is an array, make sure if is not a JSON type and it is an\n // array of strings.\n if (Array.isArray(value)) {\n if (isJSONType) {\n return false;\n }\n let valid = true;\n value.forEach(v => {\n if (!isString(v)) {\n valid = false;\n }\n });\n return valid;\n }\n // If it is a string, make sure we are not a JSON type.\n if (isString(value)) {\n return !isJSONType;\n }\n // It is not a string, make sure it is a JSON type.\n if (!isJSONType) {\n return false;\n }\n // It is a JSON type, make sure it is a valid JSON object.\n return JSONExt.isObject(value);\n}\n/**\n * Test whether a cell is a raw cell.\n */\nexport function isRaw(cell) {\n return cell.cell_type === 'raw';\n}\n/**\n * Test whether a cell is a markdown cell.\n */\nexport function isMarkdown(cell) {\n return cell.cell_type === 'markdown';\n}\n/**\n * Test whether a cell is a code cell.\n */\nexport function isCode(cell) {\n return cell.cell_type === 'code';\n}\n/**\n * Test whether an output is an execute result.\n */\nexport function isExecuteResult(output) {\n return output.output_type === 'execute_result';\n}\n/**\n * Test whether an output is from display data.\n */\nexport function isDisplayData(output) {\n return output.output_type === 'display_data';\n}\n/**\n * Test whether an output is from updated display data.\n */\nexport function isDisplayUpdate(output) {\n return output.output_type === 'update_display_data';\n}\n/**\n * Test whether an output is from a stream.\n */\nexport function isStream(output) {\n return output.output_type === 'stream';\n}\n/**\n * Test whether an output is an error.\n */\nexport function isError(output) {\n return output.output_type === 'error';\n}\n//# sourceMappingURL=index.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Signal } from '@lumino/signaling';\n/**\n * A concrete implementation of [[IObservableList]].\n */\nexport class ObservableList {\n /**\n * Construct a new observable map.\n */\n constructor(options = {}) {\n this._array = [];\n this._isDisposed = false;\n this._changed = new Signal(this);\n if (options.values) {\n for (const value of options.values) {\n this._array.push(value);\n }\n }\n this._itemCmp = options.itemCmp || Private.itemCmp;\n }\n /**\n * The type of this object.\n */\n get type() {\n return 'List';\n }\n /**\n * A signal emitted when the list has changed.\n */\n get changed() {\n return this._changed;\n }\n /**\n * The length of the list.\n */\n get length() {\n return this._array.length;\n }\n /**\n * Test whether the list has been disposed.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of the resources held by the list.\n */\n dispose() {\n if (this._isDisposed) {\n return;\n }\n this._isDisposed = true;\n Signal.clearData(this);\n this.clear();\n }\n /**\n * Create an iterator over the values in the list.\n *\n * @returns A new iterator starting at the front of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Iterator Validity\n * No changes.\n */\n [Symbol.iterator]() {\n return this._array[Symbol.iterator]();\n }\n /**\n * Get the value at the specified index.\n *\n * @param index - The positive integer index of interest.\n *\n * @returns The value at the specified index.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral or out of range.\n */\n get(index) {\n return this._array[index];\n }\n /**\n * Set the value at the specified index.\n *\n * @param index - The positive integer index of interest.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Constant.\n *\n * #### Iterator Validity\n * No changes.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral or out of range.\n */\n set(index, value) {\n const oldValue = this._array[index];\n if (value === undefined) {\n throw new Error('Cannot set an undefined item');\n }\n // Bail if the value does not change.\n const itemCmp = this._itemCmp;\n if (itemCmp(oldValue, value)) {\n return;\n }\n this._array[index] = value;\n this._changed.emit({\n type: 'set',\n oldIndex: index,\n newIndex: index,\n oldValues: [oldValue],\n newValues: [value]\n });\n }\n /**\n * Add a value to the end of the list.\n *\n * @param value - The value to add to the end of the list.\n *\n * @returns The new length of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * By convention, the oldIndex is set to -1 to indicate\n * an push operation.\n *\n * #### Iterator Validity\n * No changes.\n */\n push(value) {\n const num = this._array.push(value);\n this._changed.emit({\n type: 'add',\n oldIndex: -1,\n newIndex: this.length - 1,\n oldValues: [],\n newValues: [value]\n });\n return num;\n }\n /**\n * Insert a value into the list at a specific index.\n *\n * @param index - The index at which to insert the value.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Linear.\n *\n * #### Iterator Validity\n * No changes.\n *\n * #### Notes\n * The `index` will be clamped to the bounds of the list.\n *\n * By convention, the oldIndex is set to -2 to indicate\n * an insert operation.\n *\n * The value -2 as oldIndex can be used to distinguish from the push\n * method which will use a value -1.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insert(index, value) {\n if (index === this._array.length) {\n this._array.push(value);\n }\n else {\n ArrayExt.insert(this._array, index, value);\n }\n this._changed.emit({\n type: 'add',\n oldIndex: -2,\n newIndex: index,\n oldValues: [],\n newValues: [value]\n });\n }\n /**\n * Remove the first occurrence of a value from the list.\n *\n * @param value - The value of interest.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the list.\n *\n * #### Complexity\n * Linear.\n *\n * #### Iterator Validity\n * Iterators pointing at the removed value and beyond are invalidated.\n */\n removeValue(value) {\n const itemCmp = this._itemCmp;\n const index = ArrayExt.findFirstIndex(this._array, item => {\n return itemCmp(item, value);\n });\n this.remove(index);\n return index;\n }\n /**\n * Remove and return the value at a specific index.\n *\n * @param index - The index of the value of interest.\n *\n * @returns The value at the specified index, or `undefined` if the\n * index is out of range.\n *\n * #### Complexity\n * Constant.\n *\n * #### Iterator Validity\n * Iterators pointing at the removed value and beyond are invalidated.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n remove(index) {\n const value = ArrayExt.removeAt(this._array, index);\n if (value === undefined) {\n return;\n }\n this._changed.emit({\n type: 'remove',\n oldIndex: index,\n newIndex: -1,\n newValues: [],\n oldValues: [value]\n });\n return value;\n }\n /**\n * Remove all values from the list.\n *\n * #### Complexity\n * Linear.\n *\n * #### Iterator Validity\n * All current iterators are invalidated.\n */\n clear() {\n const copy = this._array.slice();\n this._array.length = 0;\n this._changed.emit({\n type: 'remove',\n oldIndex: 0,\n newIndex: 0,\n newValues: [],\n oldValues: copy\n });\n }\n /**\n * Move a value from one index to another.\n *\n * @param fromIndex - The index of the element to move.\n *\n * @param toIndex - The index to move the element to.\n *\n * #### Complexity\n * Constant.\n *\n * #### Iterator Validity\n * Iterators pointing at the lesser of the `fromIndex` and the `toIndex`\n * and beyond are invalidated.\n *\n * #### Undefined Behavior\n * A `fromIndex` or a `toIndex` which is non-integral.\n */\n move(fromIndex, toIndex) {\n if (this.length <= 1 || fromIndex === toIndex) {\n return;\n }\n const values = [this._array[fromIndex]];\n ArrayExt.move(this._array, fromIndex, toIndex);\n this._changed.emit({\n type: 'move',\n oldIndex: fromIndex,\n newIndex: toIndex,\n oldValues: values,\n newValues: values\n });\n }\n /**\n * Push a set of values to the back of the list.\n *\n * @param values - An iterable set of values to add.\n *\n * @returns The new length of the list.\n *\n * #### Complexity\n * Linear.\n *\n * #### Notes\n * By convention, the oldIndex is set to -1 to indicate\n * an push operation.\n *\n * #### Iterator Validity\n * No changes.\n */\n pushAll(values) {\n const newIndex = this.length;\n for (const value of values) {\n this._array.push(value);\n }\n this._changed.emit({\n type: 'add',\n oldIndex: -1,\n newIndex,\n oldValues: [],\n newValues: Array.from(values)\n });\n return this.length;\n }\n /**\n * Insert a set of items into the list at the specified index.\n *\n * @param index - The index at which to insert the values.\n *\n * @param values - The values to insert at the specified index.\n *\n * #### Complexity.\n * Linear.\n *\n * #### Iterator Validity\n * No changes.\n *\n * #### Notes\n * The `index` will be clamped to the bounds of the list.\n * By convention, the oldIndex is set to -2 to indicate\n * an insert operation.\n *\n * #### Undefined Behavior.\n * An `index` which is non-integral.\n */\n insertAll(index, values) {\n const newIndex = index;\n for (const value of values) {\n ArrayExt.insert(this._array, index++, value);\n }\n this._changed.emit({\n type: 'add',\n oldIndex: -2,\n newIndex,\n oldValues: [],\n newValues: Array.from(values)\n });\n }\n /**\n * Remove a range of items from the list.\n *\n * @param startIndex - The start index of the range to remove (inclusive).\n *\n * @param endIndex - The end index of the range to remove (exclusive).\n *\n * @returns The new length of the list.\n *\n * #### Complexity\n * Linear.\n *\n * #### Iterator Validity\n * Iterators pointing to the first removed value and beyond are invalid.\n *\n * #### Undefined Behavior\n * A `startIndex` or `endIndex` which is non-integral.\n */\n removeRange(startIndex, endIndex) {\n const oldValues = this._array.slice(startIndex, endIndex);\n for (let i = startIndex; i < endIndex; i++) {\n ArrayExt.removeAt(this._array, startIndex);\n }\n this._changed.emit({\n type: 'remove',\n oldIndex: startIndex,\n newIndex: -1,\n oldValues,\n newValues: []\n });\n return this.length;\n }\n}\n/**\n * The namespace for module private data.\n */\nvar Private;\n(function (Private) {\n /**\n * The default strict equality item cmp.\n */\n function itemCmp(first, second) {\n return first === second;\n }\n Private.itemCmp = itemCmp;\n})(Private || (Private = {}));\n//# sourceMappingURL=observablelist.js.map","/**\n * A generic doubly-linked list.\n */\nclass LinkedList {\n constructor() {\n this._first = null;\n this._last = null;\n this._size = 0;\n }\n /**\n * Whether the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get isEmpty() {\n return this._size === 0;\n }\n /**\n * The size of the list.\n *\n * #### Complexity\n * `O(1)`\n *\n * #### Notes\n * This is equivalent to `length`.\n */\n get size() {\n return this._size;\n }\n /**\n * The length of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `size`.\n *\n * This property is deprecated.\n */\n get length() {\n return this._size;\n }\n /**\n * The first value in the list.\n *\n * This is `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get first() {\n return this._first ? this._first.value : undefined;\n }\n /**\n * The last value in the list.\n *\n * This is `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get last() {\n return this._last ? this._last.value : undefined;\n }\n /**\n * The first node in the list.\n *\n * This is `null` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get firstNode() {\n return this._first;\n }\n /**\n * The last node in the list.\n *\n * This is `null` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get lastNode() {\n return this._last;\n }\n /**\n * Create an iterator over the values in the list.\n *\n * @returns A new iterator starting with the first value.\n *\n * #### Complexity\n * Constant.\n */\n *[Symbol.iterator]() {\n let node = this._first;\n while (node) {\n yield node.value;\n node = node.next;\n }\n }\n /**\n * Create a reverse iterator over the values in the list.\n *\n * @returns A new iterator starting with the last value.\n *\n * #### Complexity\n * Constant.\n */\n *retro() {\n let node = this._last;\n while (node) {\n yield node.value;\n node = node.prev;\n }\n }\n /**\n * Create an iterator over the nodes in the list.\n *\n * @returns A new iterator starting with the first node.\n *\n * #### Complexity\n * Constant.\n */\n *nodes() {\n let node = this._first;\n while (node) {\n yield node;\n node = node.next;\n }\n }\n /**\n * Create a reverse iterator over the nodes in the list.\n *\n * @returns A new iterator starting with the last node.\n *\n * #### Complexity\n * Constant.\n */\n *retroNodes() {\n let node = this._last;\n while (node) {\n yield node;\n node = node.prev;\n }\n }\n /**\n * Assign new values to the list, replacing all current values.\n *\n * @param values - The values to assign to the list.\n *\n * #### Complexity\n * Linear.\n */\n assign(values) {\n this.clear();\n for (const value of values) {\n this.addLast(value);\n }\n }\n /**\n * Add a value to the end of the list.\n *\n * @param value - The value to add to the end of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `addLast`.\n */\n push(value) {\n this.addLast(value);\n }\n /**\n * Remove and return the value at the end of the list.\n *\n * @returns The removed value, or `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `removeLast`.\n */\n pop() {\n return this.removeLast();\n }\n /**\n * Add a value to the beginning of the list.\n *\n * @param value - The value to add to the beginning of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `addFirst`.\n */\n shift(value) {\n this.addFirst(value);\n }\n /**\n * Remove and return the value at the beginning of the list.\n *\n * @returns The removed value, or `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `removeFirst`.\n */\n unshift() {\n return this.removeFirst();\n }\n /**\n * Add a value to the beginning of the list.\n *\n * @param value - The value to add to the beginning of the list.\n *\n * @returns The list node which holds the value.\n *\n * #### Complexity\n * Constant.\n */\n addFirst(value) {\n let node = new Private.LinkedListNode(this, value);\n if (!this._first) {\n this._first = node;\n this._last = node;\n }\n else {\n node.next = this._first;\n this._first.prev = node;\n this._first = node;\n }\n this._size++;\n return node;\n }\n /**\n * Add a value to the end of the list.\n *\n * @param value - The value to add to the end of the list.\n *\n * @returns The list node which holds the value.\n *\n * #### Complexity\n * Constant.\n */\n addLast(value) {\n let node = new Private.LinkedListNode(this, value);\n if (!this._last) {\n this._first = node;\n this._last = node;\n }\n else {\n node.prev = this._last;\n this._last.next = node;\n this._last = node;\n }\n this._size++;\n return node;\n }\n /**\n * Insert a value before a specific node in the list.\n *\n * @param value - The value to insert before the reference node.\n *\n * @param ref - The reference node of interest. If this is `null`,\n * the value will be added to the beginning of the list.\n *\n * @returns The list node which holds the value.\n *\n * #### Notes\n * The reference node must be owned by the list.\n *\n * #### Complexity\n * Constant.\n */\n insertBefore(value, ref) {\n if (!ref || ref === this._first) {\n return this.addFirst(value);\n }\n if (!(ref instanceof Private.LinkedListNode) || ref.list !== this) {\n throw new Error('Reference node is not owned by the list.');\n }\n let node = new Private.LinkedListNode(this, value);\n let _ref = ref;\n let prev = _ref.prev;\n node.next = _ref;\n node.prev = prev;\n _ref.prev = node;\n prev.next = node;\n this._size++;\n return node;\n }\n /**\n * Insert a value after a specific node in the list.\n *\n * @param value - The value to insert after the reference node.\n *\n * @param ref - The reference node of interest. If this is `null`,\n * the value will be added to the end of the list.\n *\n * @returns The list node which holds the value.\n *\n * #### Notes\n * The reference node must be owned by the list.\n *\n * #### Complexity\n * Constant.\n */\n insertAfter(value, ref) {\n if (!ref || ref === this._last) {\n return this.addLast(value);\n }\n if (!(ref instanceof Private.LinkedListNode) || ref.list !== this) {\n throw new Error('Reference node is not owned by the list.');\n }\n let node = new Private.LinkedListNode(this, value);\n let _ref = ref;\n let next = _ref.next;\n node.next = next;\n node.prev = _ref;\n _ref.next = node;\n next.prev = node;\n this._size++;\n return node;\n }\n /**\n * Remove and return the value at the beginning of the list.\n *\n * @returns The removed value, or `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n removeFirst() {\n let node = this._first;\n if (!node) {\n return undefined;\n }\n if (node === this._last) {\n this._first = null;\n this._last = null;\n }\n else {\n this._first = node.next;\n this._first.prev = null;\n }\n node.list = null;\n node.next = null;\n node.prev = null;\n this._size--;\n return node.value;\n }\n /**\n * Remove and return the value at the end of the list.\n *\n * @returns The removed value, or `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n removeLast() {\n let node = this._last;\n if (!node) {\n return undefined;\n }\n if (node === this._first) {\n this._first = null;\n this._last = null;\n }\n else {\n this._last = node.prev;\n this._last.next = null;\n }\n node.list = null;\n node.next = null;\n node.prev = null;\n this._size--;\n return node.value;\n }\n /**\n * Remove a specific node from the list.\n *\n * @param node - The node to remove from the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * The node must be owned by the list.\n */\n removeNode(node) {\n if (!(node instanceof Private.LinkedListNode) || node.list !== this) {\n throw new Error('Node is not owned by the list.');\n }\n let _node = node;\n if (_node === this._first && _node === this._last) {\n this._first = null;\n this._last = null;\n }\n else if (_node === this._first) {\n this._first = _node.next;\n this._first.prev = null;\n }\n else if (_node === this._last) {\n this._last = _node.prev;\n this._last.next = null;\n }\n else {\n _node.next.prev = _node.prev;\n _node.prev.next = _node.next;\n }\n _node.list = null;\n _node.next = null;\n _node.prev = null;\n this._size--;\n }\n /**\n * Remove all values from the list.\n *\n * #### Complexity\n * Linear.\n */\n clear() {\n let node = this._first;\n while (node) {\n let next = node.next;\n node.list = null;\n node.prev = null;\n node.next = null;\n node = next;\n }\n this._first = null;\n this._last = null;\n this._size = 0;\n }\n}\n/**\n * The namespace for the `LinkedList` class statics.\n */\n(function (LinkedList) {\n /**\n * Create a linked list from an iterable of values.\n *\n * @param values - The iterable object of interest.\n *\n * @returns A new linked list initialized with the given values.\n *\n * #### Complexity\n * Linear.\n */\n function from(values) {\n let list = new LinkedList();\n list.assign(values);\n return list;\n }\n LinkedList.from = from;\n})(LinkedList || (LinkedList = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * The internal linked list node implementation.\n */\n class LinkedListNode {\n /**\n * Construct a new linked list node.\n *\n * @param list - The list which owns the node.\n *\n * @param value - The value for the link.\n */\n constructor(list, value) {\n /**\n * The linked list which created and owns the node.\n */\n this.list = null;\n /**\n * The next node in the list.\n */\n this.next = null;\n /**\n * The previous node in the list.\n */\n this.prev = null;\n this.list = list;\n this.value = value;\n }\n }\n Private.LinkedListNode = LinkedListNode;\n})(Private || (Private = {}));\n\nexport { LinkedList };\n//# sourceMappingURL=index.es6.js.map\n","import { every, retro, some, ArrayExt } from '@lumino/algorithm';\nimport { LinkedList } from '@lumino/collections';\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module messaging\n */\n/**\n * A message which can be delivered to a message handler.\n *\n * #### Notes\n * This class may be subclassed to create complex message types.\n */\nclass Message {\n /**\n * Construct a new message.\n *\n * @param type - The type of the message.\n */\n constructor(type) {\n this.type = type;\n }\n /**\n * Test whether the message is conflatable.\n *\n * #### Notes\n * Message conflation is an advanced topic. Most message types will\n * not make use of this feature.\n *\n * If a conflatable message is posted to a handler while another\n * conflatable message of the same `type` has already been posted\n * to the handler, the `conflate()` method of the existing message\n * will be invoked. If that method returns `true`, the new message\n * will not be enqueued. This allows messages to be compressed, so\n * that only a single instance of the message type is processed per\n * cycle, no matter how many times messages of that type are posted.\n *\n * Custom message types may reimplement this property.\n *\n * The default implementation is always `false`.\n */\n get isConflatable() {\n return false;\n }\n /**\n * Conflate this message with another message of the same `type`.\n *\n * @param other - A conflatable message of the same `type`.\n *\n * @returns `true` if the message was successfully conflated, or\n * `false` otherwise.\n *\n * #### Notes\n * Message conflation is an advanced topic. Most message types will\n * not make use of this feature.\n *\n * This method is called automatically by the message loop when the\n * given message is posted to the handler paired with this message.\n * This message will already be enqueued and conflatable, and the\n * given message will have the same `type` and also be conflatable.\n *\n * This method should merge the state of the other message into this\n * message as needed so that when this message is finally delivered\n * to the handler, it receives the most up-to-date information.\n *\n * If this method returns `true`, it signals that the other message\n * was successfully conflated and that message will not be enqueued.\n *\n * If this method returns `false`, the other message will be enqueued\n * for normal delivery.\n *\n * Custom message types may reimplement this method.\n *\n * The default implementation always returns `false`.\n */\n conflate(other) {\n return false;\n }\n}\n/**\n * A convenience message class which conflates automatically.\n *\n * #### Notes\n * Message conflation is an advanced topic. Most user code will not\n * make use of this class.\n *\n * This message class is useful for creating message instances which\n * should be conflated, but which have no state other than `type`.\n *\n * If conflation of stateful messages is required, a custom `Message`\n * subclass should be created.\n */\nclass ConflatableMessage extends Message {\n /**\n * Test whether the message is conflatable.\n *\n * #### Notes\n * This property is always `true`.\n */\n get isConflatable() {\n return true;\n }\n /**\n * Conflate this message with another message of the same `type`.\n *\n * #### Notes\n * This method always returns `true`.\n */\n conflate(other) {\n return true;\n }\n}\n/**\n * The namespace for the global singleton message loop.\n */\nvar MessageLoop;\n(function (MessageLoop) {\n /**\n * A function that cancels the pending loop task; `null` if unavailable.\n */\n let pending = null;\n /**\n * Schedules a function for invocation as soon as possible asynchronously.\n *\n * @param fn The function to invoke when called back.\n *\n * @returns An anonymous function that will unschedule invocation if possible.\n */\n const schedule = (resolved => (fn) => {\n let rejected = false;\n resolved.then(() => !rejected && fn());\n return () => {\n rejected = true;\n };\n })(Promise.resolve());\n /**\n * Send a message to a message handler to process immediately.\n *\n * @param handler - The handler which should process the message.\n *\n * @param msg - The message to deliver to the handler.\n *\n * #### Notes\n * The message will first be sent through any installed message hooks\n * for the handler. If the message passes all hooks, it will then be\n * delivered to the `processMessage` method of the handler.\n *\n * The message will not be conflated with pending posted messages.\n *\n * Exceptions in hooks and handlers will be caught and logged.\n */\n function sendMessage(handler, msg) {\n // Lookup the message hooks for the handler.\n let hooks = messageHooks.get(handler);\n // Handle the common case of no installed hooks.\n if (!hooks || hooks.length === 0) {\n invokeHandler(handler, msg);\n return;\n }\n // Invoke the message hooks starting with the newest first.\n let passed = every(retro(hooks), hook => {\n return hook ? invokeHook(hook, handler, msg) : true;\n });\n // Invoke the handler if the message passes all hooks.\n if (passed) {\n invokeHandler(handler, msg);\n }\n }\n MessageLoop.sendMessage = sendMessage;\n /**\n * Post a message to a message handler to process in the future.\n *\n * @param handler - The handler which should process the message.\n *\n * @param msg - The message to post to the handler.\n *\n * #### Notes\n * The message will be conflated with the pending posted messages for\n * the handler, if possible. If the message is not conflated, it will\n * be queued for normal delivery on the next cycle of the event loop.\n *\n * Exceptions in hooks and handlers will be caught and logged.\n */\n function postMessage(handler, msg) {\n // Handle the common case of a non-conflatable message.\n if (!msg.isConflatable) {\n enqueueMessage(handler, msg);\n return;\n }\n // Conflate the message with an existing message if possible.\n let conflated = some(messageQueue, posted => {\n if (posted.handler !== handler) {\n return false;\n }\n if (!posted.msg) {\n return false;\n }\n if (posted.msg.type !== msg.type) {\n return false;\n }\n if (!posted.msg.isConflatable) {\n return false;\n }\n return posted.msg.conflate(msg);\n });\n // Enqueue the message if it was not conflated.\n if (!conflated) {\n enqueueMessage(handler, msg);\n }\n }\n MessageLoop.postMessage = postMessage;\n /**\n * Install a message hook for a message handler.\n *\n * @param handler - The message handler of interest.\n *\n * @param hook - The message hook to install.\n *\n * #### Notes\n * A message hook is invoked before a message is delivered to the\n * handler. If the hook returns `false`, no other hooks will be\n * invoked and the message will not be delivered to the handler.\n *\n * The most recently installed message hook is executed first.\n *\n * If the hook is already installed, this is a no-op.\n */\n function installMessageHook(handler, hook) {\n // Look up the hooks for the handler.\n let hooks = messageHooks.get(handler);\n // Bail early if the hook is already installed.\n if (hooks && hooks.indexOf(hook) !== -1) {\n return;\n }\n // Add the hook to the end, so it will be the first to execute.\n if (!hooks) {\n messageHooks.set(handler, [hook]);\n }\n else {\n hooks.push(hook);\n }\n }\n MessageLoop.installMessageHook = installMessageHook;\n /**\n * Remove an installed message hook for a message handler.\n *\n * @param handler - The message handler of interest.\n *\n * @param hook - The message hook to remove.\n *\n * #### Notes\n * It is safe to call this function while the hook is executing.\n *\n * If the hook is not installed, this is a no-op.\n */\n function removeMessageHook(handler, hook) {\n // Lookup the hooks for the handler.\n let hooks = messageHooks.get(handler);\n // Bail early if the hooks do not exist.\n if (!hooks) {\n return;\n }\n // Lookup the index of the hook and bail if not found.\n let i = hooks.indexOf(hook);\n if (i === -1) {\n return;\n }\n // Clear the hook and schedule a cleanup of the array.\n hooks[i] = null;\n scheduleCleanup(hooks);\n }\n MessageLoop.removeMessageHook = removeMessageHook;\n /**\n * Clear all message data associated with a message handler.\n *\n * @param handler - The message handler of interest.\n *\n * #### Notes\n * This will clear all posted messages and hooks for the handler.\n */\n function clearData(handler) {\n // Lookup the hooks for the handler.\n let hooks = messageHooks.get(handler);\n // Clear all messsage hooks for the handler.\n if (hooks && hooks.length > 0) {\n ArrayExt.fill(hooks, null);\n scheduleCleanup(hooks);\n }\n // Clear all posted messages for the handler.\n for (const posted of messageQueue) {\n if (posted.handler === handler) {\n posted.handler = null;\n posted.msg = null;\n }\n }\n }\n MessageLoop.clearData = clearData;\n /**\n * Process the pending posted messages in the queue immediately.\n *\n * #### Notes\n * This function is useful when posted messages must be processed immediately.\n *\n * This function should normally not be needed, but it may be\n * required to work around certain browser idiosyncrasies.\n *\n * Recursing into this function is a no-op.\n */\n function flush() {\n // Bail if recursion is detected or if there is no pending task.\n if (flushGuard || pending === null) {\n return;\n }\n // Unschedule the pending loop task.\n pending();\n pending = null;\n // Run the message loop within the recursion guard.\n flushGuard = true;\n runMessageLoop();\n flushGuard = false;\n }\n MessageLoop.flush = flush;\n /**\n * Get the message loop exception handler.\n *\n * @returns The current exception handler.\n *\n * #### Notes\n * The default exception handler is `console.error`.\n */\n function getExceptionHandler() {\n return exceptionHandler;\n }\n MessageLoop.getExceptionHandler = getExceptionHandler;\n /**\n * Set the message loop exception handler.\n *\n * @param handler - The function to use as the exception handler.\n *\n * @returns The old exception handler.\n *\n * #### Notes\n * The exception handler is invoked when a message handler or a\n * message hook throws an exception.\n */\n function setExceptionHandler(handler) {\n let old = exceptionHandler;\n exceptionHandler = handler;\n return old;\n }\n MessageLoop.setExceptionHandler = setExceptionHandler;\n /**\n * The queue of posted message pairs.\n */\n const messageQueue = new LinkedList();\n /**\n * A mapping of handler to array of installed message hooks.\n */\n const messageHooks = new WeakMap();\n /**\n * A set of message hook arrays which are pending cleanup.\n */\n const dirtySet = new Set();\n /**\n * The message loop exception handler.\n */\n let exceptionHandler = (err) => {\n console.error(err);\n };\n /**\n * A guard flag to prevent flush recursion.\n */\n let flushGuard = false;\n /**\n * Invoke a message hook with the specified handler and message.\n *\n * Returns the result of the hook, or `true` if the hook throws.\n *\n * Exceptions in the hook will be caught and logged.\n */\n function invokeHook(hook, handler, msg) {\n let result = true;\n try {\n if (typeof hook === 'function') {\n result = hook(handler, msg);\n }\n else {\n result = hook.messageHook(handler, msg);\n }\n }\n catch (err) {\n exceptionHandler(err);\n }\n return result;\n }\n /**\n * Invoke a message handler with the specified message.\n *\n * Exceptions in the handler will be caught and logged.\n */\n function invokeHandler(handler, msg) {\n try {\n handler.processMessage(msg);\n }\n catch (err) {\n exceptionHandler(err);\n }\n }\n /**\n * Add a message to the end of the message queue.\n *\n * This will automatically schedule a run of the message loop.\n */\n function enqueueMessage(handler, msg) {\n // Add the posted message to the queue.\n messageQueue.addLast({ handler, msg });\n // Bail if a loop task is already pending.\n if (pending !== null) {\n return;\n }\n // Schedule a run of the message loop.\n pending = schedule(runMessageLoop);\n }\n /**\n * Run an iteration of the message loop.\n *\n * This will process all pending messages in the queue. If a message\n * is added to the queue while the message loop is running, it will\n * be processed on the next cycle of the loop.\n */\n function runMessageLoop() {\n // Clear the task so the next loop can be scheduled.\n pending = null;\n // If the message queue is empty, there is nothing else to do.\n if (messageQueue.isEmpty) {\n return;\n }\n // Add a sentinel value to the end of the queue. The queue will\n // only be processed up to the sentinel. Messages posted during\n // this cycle will execute on the next cycle.\n let sentinel = { handler: null, msg: null };\n messageQueue.addLast(sentinel);\n // Enter the message loop.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Remove the first posted message in the queue.\n let posted = messageQueue.removeFirst();\n // If the value is the sentinel, exit the loop.\n if (posted === sentinel) {\n return;\n }\n // Dispatch the message if it has not been cleared.\n if (posted.handler && posted.msg) {\n sendMessage(posted.handler, posted.msg);\n }\n }\n }\n /**\n * Schedule a cleanup of a message hooks array.\n *\n * This will add the array to the dirty set and schedule a deferred\n * cleanup of the array contents. On cleanup, any `null` hook will\n * be removed from the array.\n */\n function scheduleCleanup(hooks) {\n if (dirtySet.size === 0) {\n schedule(cleanupDirtySet);\n }\n dirtySet.add(hooks);\n }\n /**\n * Cleanup the message hook arrays in the dirty set.\n *\n * This function should only be invoked asynchronously, when the\n * stack frame is guaranteed to not be on the path of user code.\n */\n function cleanupDirtySet() {\n dirtySet.forEach(cleanupHooks);\n dirtySet.clear();\n }\n /**\n * Cleanup the dirty hooks in a message hooks array.\n *\n * This will remove any `null` hook from the array.\n *\n * This function should only be invoked asynchronously, when the\n * stack frame is guaranteed to not be on the path of user code.\n */\n function cleanupHooks(hooks) {\n ArrayExt.removeAllWhere(hooks, isNull);\n }\n /**\n * Test whether a value is `null`.\n */\n function isNull(value) {\n return value === null;\n }\n})(MessageLoop || (MessageLoop = {}));\n\nexport { ConflatableMessage, Message, MessageLoop };\n//# sourceMappingURL=index.es6.js.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { Signal } from '@lumino/signaling';\n/**\n * A concrete implementation of IObservableMap.\n */\nexport class ObservableMap {\n /**\n * Construct a new observable map.\n */\n constructor(options = {}) {\n this._map = new Map();\n this._changed = new Signal(this);\n this._isDisposed = false;\n this._itemCmp = options.itemCmp || Private.itemCmp;\n if (options.values) {\n for (const key in options.values) {\n this._map.set(key, options.values[key]);\n }\n }\n }\n /**\n * The type of the Observable.\n */\n get type() {\n return 'Map';\n }\n /**\n * A signal emitted when the map has changed.\n */\n get changed() {\n return this._changed;\n }\n /**\n * Whether this map has been disposed.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * The number of key-value pairs in the map.\n */\n get size() {\n return this._map.size;\n }\n /**\n * Set a key-value pair in the map\n *\n * @param key - The key to set.\n *\n * @param value - The value for the key.\n *\n * @returns the old value for the key, or undefined\n * if that did not exist.\n *\n * @throws if the new value is undefined.\n *\n * #### Notes\n * This is a no-op if the value does not change.\n */\n set(key, value) {\n const oldVal = this._map.get(key);\n if (value === undefined) {\n throw Error('Cannot set an undefined value, use remove');\n }\n // Bail if the value does not change.\n const itemCmp = this._itemCmp;\n if (oldVal !== undefined && itemCmp(oldVal, value)) {\n return oldVal;\n }\n this._map.set(key, value);\n this._changed.emit({\n type: oldVal ? 'change' : 'add',\n key: key,\n oldValue: oldVal,\n newValue: value\n });\n return oldVal;\n }\n /**\n * Get a value for a given key.\n *\n * @param key - the key.\n *\n * @returns the value for that key.\n */\n get(key) {\n return this._map.get(key);\n }\n /**\n * Check whether the map has a key.\n *\n * @param key - the key to check.\n *\n * @returns `true` if the map has the key, `false` otherwise.\n */\n has(key) {\n return this._map.has(key);\n }\n /**\n * Get a list of the keys in the map.\n *\n * @returns - a list of keys.\n */\n keys() {\n const keyList = [];\n this._map.forEach((v, k) => {\n keyList.push(k);\n });\n return keyList;\n }\n /**\n * Get a list of the values in the map.\n *\n * @returns - a list of values.\n */\n values() {\n const valList = [];\n this._map.forEach((v, k) => {\n valList.push(v);\n });\n return valList;\n }\n /**\n * Remove a key from the map\n *\n * @param key - the key to remove.\n *\n * @returns the value of the given key,\n * or undefined if that does not exist.\n *\n * #### Notes\n * This is a no-op if the value does not change.\n */\n delete(key) {\n const oldVal = this._map.get(key);\n const removed = this._map.delete(key);\n if (removed) {\n this._changed.emit({\n type: 'remove',\n key: key,\n oldValue: oldVal,\n newValue: undefined\n });\n }\n return oldVal;\n }\n /**\n * Set the ObservableMap to an empty map.\n */\n clear() {\n // Delete one by one to emit the correct signals.\n const keyList = this.keys();\n for (let i = 0; i < keyList.length; i++) {\n this.delete(keyList[i]);\n }\n }\n /**\n * Dispose of the resources held by the map.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n Signal.clearData(this);\n this._map.clear();\n }\n}\n/**\n * The namespace for module private data.\n */\nvar Private;\n(function (Private) {\n /**\n * The default strict equality item comparator.\n */\n function itemCmp(first, second) {\n return first === second;\n }\n Private.itemCmp = itemCmp;\n})(Private || (Private = {}));\n//# sourceMappingURL=observablemap.js.map","/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\nimport * as nbformat from '@jupyterlab/nbformat';\nimport { ObservableJSON } from '@jupyterlab/observables';\nimport { JSONExt } from '@lumino/coreutils';\nimport { Signal } from '@lumino/signaling';\n/**\n * The default implementation of a notebook output model.\n */\nexport class OutputModel {\n /**\n * Construct a new output model.\n */\n constructor(options) {\n this._changed = new Signal(this);\n this._raw = {};\n const { data, metadata, trusted } = Private.getBundleOptions(options);\n this._data = new ObservableJSON({ values: data });\n this._rawData = data;\n this._metadata = new ObservableJSON({ values: metadata });\n this._rawMetadata = metadata;\n this.trusted = trusted;\n // Make a copy of the data.\n const value = options.value;\n for (const key in value) {\n // Ignore data and metadata that were stripped.\n switch (key) {\n case 'data':\n case 'metadata':\n break;\n default:\n this._raw[key] = Private.extract(value, key);\n }\n }\n this.type = value.output_type;\n if (nbformat.isExecuteResult(value)) {\n this.executionCount = value.execution_count;\n }\n else {\n this.executionCount = null;\n }\n }\n /**\n * A signal emitted when the output model changes.\n */\n get changed() {\n return this._changed;\n }\n /**\n * Dispose of the resources used by the output model.\n */\n dispose() {\n this._data.dispose();\n this._metadata.dispose();\n Signal.clearData(this);\n }\n /**\n * The data associated with the model.\n */\n get data() {\n return this._rawData;\n }\n /**\n * The metadata associated with the model.\n */\n get metadata() {\n return this._rawMetadata;\n }\n /**\n * Set the data associated with the model.\n *\n * #### Notes\n * Depending on the implementation of the mime model,\n * this call may or may not have deferred effects,\n */\n setData(options) {\n if (options.data) {\n this._updateObservable(this._data, options.data);\n this._rawData = options.data;\n }\n if (options.metadata) {\n this._updateObservable(this._metadata, options.metadata);\n this._rawMetadata = options.metadata;\n }\n this._changed.emit();\n }\n /**\n * Serialize the model to JSON.\n */\n toJSON() {\n const output = {};\n for (const key in this._raw) {\n output[key] = Private.extract(this._raw, key);\n }\n switch (this.type) {\n case 'display_data':\n case 'execute_result':\n case 'update_display_data':\n output['data'] = this.data;\n output['metadata'] = this.metadata;\n break;\n default:\n break;\n }\n // Remove transient data.\n delete output['transient'];\n return output;\n }\n /**\n * Update an observable JSON object using a readonly JSON object.\n */\n _updateObservable(observable, data) {\n const oldKeys = observable.keys();\n const newKeys = Object.keys(data);\n // Handle removed keys.\n for (const key of oldKeys) {\n if (newKeys.indexOf(key) === -1) {\n observable.delete(key);\n }\n }\n // Handle changed data.\n for (const key of newKeys) {\n const oldValue = observable.get(key);\n const newValue = data[key];\n if (oldValue !== newValue) {\n observable.set(key, newValue);\n }\n }\n }\n}\n/**\n * The namespace for OutputModel statics.\n */\n(function (OutputModel) {\n /**\n * Get the data for an output.\n *\n * @param output - A kernel output message payload.\n *\n * @returns - The data for the payload.\n */\n function getData(output) {\n return Private.getData(output);\n }\n OutputModel.getData = getData;\n /**\n * Get the metadata from an output message.\n *\n * @param output - A kernel output message payload.\n *\n * @returns - The metadata for the payload.\n */\n function getMetadata(output) {\n return Private.getMetadata(output);\n }\n OutputModel.getMetadata = getMetadata;\n})(OutputModel || (OutputModel = {}));\n/**\n * The namespace for module private data.\n */\nvar Private;\n(function (Private) {\n /**\n * Get the data from a notebook output.\n */\n function getData(output) {\n let bundle = {};\n if (nbformat.isExecuteResult(output) ||\n nbformat.isDisplayData(output) ||\n nbformat.isDisplayUpdate(output)) {\n bundle = output.data;\n }\n else if (nbformat.isStream(output)) {\n if (output.name === 'stderr') {\n bundle['application/vnd.jupyter.stderr'] = output.text;\n }\n else {\n bundle['application/vnd.jupyter.stdout'] = output.text;\n }\n }\n else if (nbformat.isError(output)) {\n bundle['application/vnd.jupyter.error'] = output;\n const traceback = output.traceback.join('\\n');\n bundle['application/vnd.jupyter.stderr'] =\n traceback || `${output.ename}: ${output.evalue}`;\n }\n return convertBundle(bundle);\n }\n Private.getData = getData;\n /**\n * Get the metadata from an output message.\n */\n function getMetadata(output) {\n const value = Object.create(null);\n if (nbformat.isExecuteResult(output) || nbformat.isDisplayData(output)) {\n for (const key in output.metadata) {\n value[key] = extract(output.metadata, key);\n }\n }\n return value;\n }\n Private.getMetadata = getMetadata;\n /**\n * Get the bundle options given output model options.\n */\n function getBundleOptions(options) {\n const data = getData(options.value);\n const metadata = getMetadata(options.value);\n const trusted = !!options.trusted;\n return { data, metadata, trusted };\n }\n Private.getBundleOptions = getBundleOptions;\n /**\n * Extract a value from a JSONObject.\n */\n function extract(value, key) {\n const item = value[key];\n if (item === undefined || JSONExt.isPrimitive(item)) {\n return item;\n }\n return JSON.parse(JSON.stringify(item));\n }\n Private.extract = extract;\n /**\n * Convert a mime bundle to mime data.\n */\n function convertBundle(bundle) {\n const map = Object.create(null);\n for (const mimeType in bundle) {\n map[mimeType] = extract(bundle, mimeType);\n }\n return map;\n }\n})(Private || (Private = {}));\n//# sourceMappingURL=outputmodel.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for array-specific algorithms.\n */\nvar ArrayExt;\n(function (ArrayExt) {\n /**\n * Find the index of the first occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.firstIndexOf(data, 'red'); // -1\n * ArrayExt.firstIndexOf(data, 'one'); // 0\n * ArrayExt.firstIndexOf(data, 'one', 1); // 4\n * ArrayExt.firstIndexOf(data, 'two', 2); // -1\n * ArrayExt.firstIndexOf(data, 'two', 2, 1); // 1\n * ```\n */\n function firstIndexOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.firstIndexOf = firstIndexOf;\n /**\n * Find the index of the last occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.lastIndexOf(data, 'red'); // -1\n * ArrayExt.lastIndexOf(data, 'one'); // 4\n * ArrayExt.lastIndexOf(data, 'one', 1); // 0\n * ArrayExt.lastIndexOf(data, 'two', 0); // -1\n * ArrayExt.lastIndexOf(data, 'two', 0, 1); // 1\n * ```\n */\n function lastIndexOf(array, value, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (start < stop) {\n span = start + 1 + (n - stop);\n }\n else {\n span = start - stop + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start - i + n) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.lastIndexOf = lastIndexOf;\n /**\n * Find the index of the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstIndex(data, isEven); // 1\n * ArrayExt.findFirstIndex(data, isEven, 4); // 5\n * ArrayExt.findFirstIndex(data, isEven, 6); // -1\n * ArrayExt.findFirstIndex(data, isEven, 6, 5); // 1\n * ```\n */\n function findFirstIndex(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findFirstIndex = findFirstIndex;\n /**\n * Find the index of the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastIndex(data, isEven); // 5\n * ArrayExt.findLastIndex(data, isEven, 4); // 3\n * ArrayExt.findLastIndex(data, isEven, 0); // -1\n * ArrayExt.findLastIndex(data, isEven, 0, 1); // 5\n * ```\n */\n function findLastIndex(array, fn, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let d;\n if (start < stop) {\n d = start + 1 + (n - stop);\n }\n else {\n d = start - stop + 1;\n }\n for (let i = 0; i < d; ++i) {\n let j = (start - i + n) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findLastIndex = findLastIndex;\n /**\n * Find the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstValue(data, isEven); // 2\n * ArrayExt.findFirstValue(data, isEven, 2); // 4\n * ArrayExt.findFirstValue(data, isEven, 6); // undefined\n * ArrayExt.findFirstValue(data, isEven, 6, 5); // 2\n * ```\n */\n function findFirstValue(array, fn, start = 0, stop = -1) {\n let index = findFirstIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findFirstValue = findFirstValue;\n /**\n * Find the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The last matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastValue(data, isEven); // 2\n * ArrayExt.findLastValue(data, isEven, 4); // 4\n * ArrayExt.findLastValue(data, isEven, 0); // undefined\n * ArrayExt.findLastValue(data, isEven, 0, 1); // 2\n * ```\n */\n function findLastValue(array, fn, start = -1, stop = 0) {\n let index = findLastIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findLastValue = findLastValue;\n /**\n * Find the index of the first element which compares `>=` to a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>=` to the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.lowerBound(data, 0, numberCmp); // 0\n * ArrayExt.lowerBound(data, 6, numberCmp); // 3\n * ArrayExt.lowerBound(data, 7, numberCmp); // 3\n * ArrayExt.lowerBound(data, -1, numberCmp); // 0\n * ArrayExt.lowerBound(data, 10, numberCmp); // 6\n * ```\n */\n function lowerBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) < 0) {\n begin = middle + 1;\n span -= half + 1;\n }\n else {\n span = half;\n }\n }\n return begin;\n }\n ArrayExt.lowerBound = lowerBound;\n /**\n * Find the index of the first element which compares `>` than a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>` than the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.upperBound(data, 0, numberCmp); // 1\n * ArrayExt.upperBound(data, 6, numberCmp); // 3\n * ArrayExt.upperBound(data, 7, numberCmp); // 5\n * ArrayExt.upperBound(data, -1, numberCmp); // 0\n * ArrayExt.upperBound(data, 10, numberCmp); // 6\n * ```\n */\n function upperBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) > 0) {\n span = half;\n }\n else {\n begin = middle + 1;\n span -= half + 1;\n }\n }\n return begin;\n }\n ArrayExt.upperBound = upperBound;\n /**\n * Test whether two arrays are shallowly equal.\n *\n * @param a - The first array-like object to compare.\n *\n * @param b - The second array-like object to compare.\n *\n * @param fn - The comparison function to apply to the elements. It\n * should return `true` if the elements are \"equal\". The default\n * compares elements using strict `===` equality.\n *\n * @returns Whether the two arrays are shallowly equal.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * Modifying the length of the arrays while comparing.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let d1 = [0, 3, 4, 7, 7, 9];\n * let d2 = [0, 3, 4, 7, 7, 9];\n * let d3 = [42];\n * ArrayExt.shallowEqual(d1, d2); // true\n * ArrayExt.shallowEqual(d2, d3); // false\n * ```\n */\n function shallowEqual(a, b, fn) {\n // Check for object identity first.\n if (a === b) {\n return true;\n }\n // Bail early if the lengths are different.\n if (a.length !== b.length) {\n return false;\n }\n // Compare each element for equality.\n for (let i = 0, n = a.length; i < n; ++i) {\n if (fn ? !fn(a[i], b[i]) : a[i] !== b[i]) {\n return false;\n }\n }\n // The array are shallowly equal.\n return true;\n }\n ArrayExt.shallowEqual = shallowEqual;\n /**\n * Create a slice of an array subject to an optional step.\n *\n * @param array - The array-like object of interest.\n *\n * @param options - The options for configuring the slice.\n *\n * @returns A new array with the specified values.\n *\n * @throws An exception if the slice `step` is `0`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start`, `stop`, or `step` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]\n * ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]\n * ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]\n * ```\n */\n function slice(array, options = {}) {\n // Extract the options.\n let { start, stop, step } = options;\n // Set up the `step` value.\n if (step === undefined) {\n step = 1;\n }\n // Validate the step size.\n if (step === 0) {\n throw new Error('Slice `step` cannot be zero.');\n }\n // Look up the length of the array.\n let n = array.length;\n // Set up the `start` value.\n if (start === undefined) {\n start = step < 0 ? n - 1 : 0;\n }\n else if (start < 0) {\n start = Math.max(start + n, step < 0 ? -1 : 0);\n }\n else if (start >= n) {\n start = step < 0 ? n - 1 : n;\n }\n // Set up the `stop` value.\n if (stop === undefined) {\n stop = step < 0 ? -1 : n;\n }\n else if (stop < 0) {\n stop = Math.max(stop + n, step < 0 ? -1 : 0);\n }\n else if (stop >= n) {\n stop = step < 0 ? n - 1 : n;\n }\n // Compute the slice length.\n let length;\n if ((step < 0 && stop >= start) || (step > 0 && start >= stop)) {\n length = 0;\n }\n else if (step < 0) {\n length = Math.floor((stop - start + 1) / step + 1);\n }\n else {\n length = Math.floor((stop - start - 1) / step + 1);\n }\n // Compute the sliced result.\n let result = [];\n for (let i = 0; i < length; ++i) {\n result[i] = array[start + i * step];\n }\n // Return the result.\n return result;\n }\n ArrayExt.slice = slice;\n /**\n * Move an element in an array from one index to another.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param fromIndex - The index of the element to move. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param toIndex - The target index of the element. Negative\n * values are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `fromIndex` or `toIndex` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.move(data, 1, 2); // [0, 2, 1, 3, 4]\n * ArrayExt.move(data, 4, 2); // [0, 2, 4, 1, 3]\n * ```\n */\n function move(array, fromIndex, toIndex) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (fromIndex < 0) {\n fromIndex = Math.max(0, fromIndex + n);\n }\n else {\n fromIndex = Math.min(fromIndex, n - 1);\n }\n if (toIndex < 0) {\n toIndex = Math.max(0, toIndex + n);\n }\n else {\n toIndex = Math.min(toIndex, n - 1);\n }\n if (fromIndex === toIndex) {\n return;\n }\n let value = array[fromIndex];\n let d = fromIndex < toIndex ? 1 : -1;\n for (let i = fromIndex; i !== toIndex; i += d) {\n array[i] = array[i + d];\n }\n array[toIndex] = value;\n }\n ArrayExt.move = move;\n /**\n * Reverse an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param start - The index of the first element in the range to be\n * reversed, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * reversed, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` index which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.reverse(data, 1, 3); // [0, 3, 2, 1, 4]\n * ArrayExt.reverse(data, 3); // [0, 3, 2, 4, 1]\n * ArrayExt.reverse(data); // [1, 4, 2, 3, 0]\n * ```\n */\n function reverse(array, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n while (start < stop) {\n let a = array[start];\n let b = array[stop];\n array[start++] = b;\n array[stop--] = a;\n }\n }\n ArrayExt.reverse = reverse;\n /**\n * Rotate the elements of an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param delta - The amount of rotation to apply to the elements. A\n * positive value will rotate the elements to the left. A negative\n * value will rotate the elements to the right.\n *\n * @param start - The index of the first element in the range to be\n * rotated, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * rotated, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `delta`, `start`, or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.rotate(data, 2); // [2, 3, 4, 0, 1]\n * ArrayExt.rotate(data, -2); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 10); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 9); // [4, 0, 1, 2, 3]\n * ArrayExt.rotate(data, 2, 1, 3); // [4, 2, 0, 1, 3]\n * ```\n */\n function rotate(array, delta, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n if (start >= stop) {\n return;\n }\n let length = stop - start + 1;\n if (delta > 0) {\n delta = delta % length;\n }\n else if (delta < 0) {\n delta = ((delta % length) + length) % length;\n }\n if (delta === 0) {\n return;\n }\n let pivot = start + delta;\n reverse(array, start, pivot - 1);\n reverse(array, pivot, stop);\n reverse(array, start, stop);\n }\n ArrayExt.rotate = rotate;\n /**\n * Fill an array with a static value.\n *\n * @param array - The mutable array-like object to fill.\n *\n * @param value - The static value to use to fill the array.\n *\n * @param start - The index of the first element in the range to be\n * filled, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * filled, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Notes\n * If `stop < start` the fill will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four'];\n * ArrayExt.fill(data, 'r'); // ['r', 'r', 'r', 'r']\n * ArrayExt.fill(data, 'g', 1); // ['r', 'g', 'g', 'g']\n * ArrayExt.fill(data, 'b', 2, 3); // ['r', 'g', 'b', 'b']\n * ArrayExt.fill(data, 'z', 3, 1); // ['z', 'z', 'b', 'z']\n * ```\n */\n function fill(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n array[(start + i) % n] = value;\n }\n }\n ArrayExt.fill = fill;\n /**\n * Insert a value into an array at a specific index.\n *\n * @param array - The array of interest.\n *\n * @param index - The index at which to insert the value. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2];\n * ArrayExt.insert(data, 0, -1); // [-1, 0, 1, 2]\n * ArrayExt.insert(data, 2, 12); // [-1, 0, 12, 1, 2]\n * ArrayExt.insert(data, -1, 7); // [-1, 0, 12, 1, 7, 2]\n * ArrayExt.insert(data, 6, 19); // [-1, 0, 12, 1, 7, 2, 19]\n * ```\n */\n function insert(array, index, value) {\n let n = array.length;\n if (index < 0) {\n index = Math.max(0, index + n);\n }\n else {\n index = Math.min(index, n);\n }\n for (let i = n; i > index; --i) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n }\n ArrayExt.insert = insert;\n /**\n * Remove and return a value at a specific index in an array.\n *\n * @param array - The array of interest.\n *\n * @param index - The index of the value to remove. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The value at the specified index, or `undefined` if the\n * index is out of range.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeAt(data, 2); // 23\n * ArrayExt.removeAt(data, -2); // 12\n * ArrayExt.removeAt(data, 10); // undefined;\n * ```\n */\n function removeAt(array, index) {\n let n = array.length;\n if (index < 0) {\n index += n;\n }\n if (index < 0 || index >= n) {\n return undefined;\n }\n let value = array[index];\n for (let i = index + 1; i < n; ++i) {\n array[i - 1] = array[i];\n }\n array.length = n - 1;\n return value;\n }\n ArrayExt.removeAt = removeAt;\n /**\n * Remove the first occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstOf(data, 12); // 1\n * ArrayExt.removeFirstOf(data, 17); // -1\n * ArrayExt.removeFirstOf(data, 39, 3); // -1\n * ArrayExt.removeFirstOf(data, 39, 3, 2); // 2\n * ```\n */\n function removeFirstOf(array, value, start = 0, stop = -1) {\n let index = firstIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeFirstOf = removeFirstOf;\n /**\n * Remove the last occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastOf(data, 12); // 5\n * ArrayExt.removeLastOf(data, 17); // -1\n * ArrayExt.removeLastOf(data, 39, 2); // -1\n * ArrayExt.removeLastOf(data, 39, 2, 3); // 3\n * ```\n */\n function removeLastOf(array, value, start = -1, stop = 0) {\n let index = lastIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeLastOf = removeLastOf;\n /**\n * Remove all occurrences of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [14, 12, 23, 39, 14, 12, 19, 14];\n * ArrayExt.removeAllOf(data, 12); // 2\n * ArrayExt.removeAllOf(data, 17); // 0\n * ArrayExt.removeAllOf(data, 14, 1, 4); // 1\n * ```\n */\n function removeAllOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && array[i] === value) {\n count++;\n }\n else if (stop < start &&\n (i <= stop || i >= start) &&\n array[i] === value) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllOf = removeAllOf;\n /**\n * Remove the first occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstWhere(data, isEven); // { index: 0, value: 0 }\n * ArrayExt.removeFirstWhere(data, isEven, 2); // { index: 3, value: 14 }\n * ArrayExt.removeFirstWhere(data, isEven, 4); // { index: -1, value: undefined }\n * ```\n */\n function removeFirstWhere(array, fn, start = 0, stop = -1) {\n let value;\n let index = findFirstIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeFirstWhere = removeFirstWhere;\n /**\n * Remove the last occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastWhere(data, isEven); // { index: 5, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2); // { index: 1, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2, 1); // { index: -1, value: undefined }\n * ```\n */\n function removeLastWhere(array, fn, start = -1, stop = 0) {\n let value;\n let index = findLastIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeLastWhere = removeLastWhere;\n /**\n * Remove all occurrences of values which match a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * function isNegative(value: number): boolean {\n * return value < 0;\n * }\n *\n * let data = [0, 12, -13, -9, 23, 39, 14, -15, 12, 75];\n * ArrayExt.removeAllWhere(data, isEven); // 4\n * ArrayExt.removeAllWhere(data, isNegative, 0, 3); // 2\n * ```\n */\n function removeAllWhere(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && fn(array[i], i)) {\n count++;\n }\n else if (stop < start && (i <= stop || i >= start) && fn(array[i], i)) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllWhere = removeAllWhere;\n})(ArrayExt || (ArrayExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Chain together several iterables.\n *\n * @deprecated\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields the values of the iterables\n * in the order in which they are supplied.\n *\n * #### Example\n * ```typescript\n * import { chain } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = chain(data1, data2);\n *\n * Array.from(stream); // [1, 2, 3, 4, 5, 6]\n * ```\n */\nfunction* chain(...objects) {\n for (const object of objects) {\n yield* object;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an empty iterator.\n *\n * @returns A new iterator which yields nothing.\n *\n * #### Example\n * ```typescript\n * import { empty } from '@lumino/algorithm';\n *\n * let stream = empty();\n *\n * Array.from(stream); // []\n * ```\n */\n// eslint-disable-next-line require-yield\nfunction* empty() {\n return;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Enumerate an iterable object.\n *\n * @param object - The iterable object of interest.\n *\n * @param start - The starting enum value. The default is `0`.\n *\n * @returns An iterator which yields the enumerated values.\n *\n * #### Example\n * ```typescript\n * import { enumerate } from '@lumino/algorithm';\n *\n * let data = ['foo', 'bar', 'baz'];\n *\n * let stream = enumerate(data, 1);\n *\n * Array.from(stream); // [[1, 'foo'], [2, 'bar'], [3, 'baz']]\n * ```\n */\nfunction* enumerate(object, start = 0) {\n for (const value of object) {\n yield [start++, value];\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Filter an iterable for values which pass a test.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns An iterator which yields the values which pass the test.\n *\n * #### Example\n * ```typescript\n * import { filter } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = filter(data, value => value % 2 === 0);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* filter(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Find the first value in an iterable which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { find } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * find(data, isCat).name; // 'fluffy'\n * ```\n */\nfunction find(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return value;\n }\n }\n return undefined;\n}\n/**\n * Find the index of the first value which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { findIndex } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * findIndex(data, isCat); // 1\n * ```\n */\nfunction findIndex(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return index - 1;\n }\n }\n return -1;\n}\n/**\n * Find the minimum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The minimum value in the iterable. If multiple values are\n * equivalent to the minimum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { min } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * min([7, 4, 0, 3, 9, 4], numberCmp); // 0\n * ```\n */\nfunction min(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) < 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the maximum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The maximum value in the iterable. If multiple values are\n * equivalent to the maximum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { max } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * max([7, 4, 0, 3, 9, 4], numberCmp); // 9\n * ```\n */\nfunction max(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) > 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the minimum and maximum values in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns A 2-tuple of the `[min, max]` values in the iterable. If\n * multiple values are equivalent, the left-most values are returned.\n * If the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { minmax } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * minmax([7, 4, 0, 3, 9, 4], numberCmp); // [0, 9]\n * ```\n */\nfunction minmax(object, fn) {\n let empty = true;\n let vmin;\n let vmax;\n for (const value of object) {\n if (empty) {\n vmin = value;\n vmax = value;\n empty = false;\n }\n else if (fn(value, vmin) < 0) {\n vmin = value;\n }\n else if (fn(value, vmax) > 0) {\n vmax = value;\n }\n }\n return empty ? undefined : [vmin, vmax];\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an array from an iterable of values.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new array of values from the given object.\n *\n * #### Example\n * ```typescript\n * import { toArray } from '@lumino/algorithm';\n *\n * let stream = [1, 2, 3, 4, 5, 6][Symbol.iterator]();\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6];\n * ```\n */\nfunction toArray(object) {\n return Array.from(object);\n}\n/**\n * Create an object from an iterable of key/value pairs.\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new object mapping keys to values.\n *\n * #### Example\n * ```typescript\n * import { toObject } from '@lumino/algorithm';\n *\n * let data: [string, number][] = [['one', 1], ['two', 2], ['three', 3]];\n *\n * toObject(data); // { one: 1, two: 2, three: 3 }\n * ```\n */\nfunction toObject(object) {\n const result = {};\n for (const [key, value] of object) {\n result[key] = value;\n }\n return result;\n}\n/**\n * Invoke a function for each value in an iterable.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The callback function to invoke for each value.\n *\n * #### Notes\n * Iteration can be terminated early by returning `false` from the\n * callback function.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each } from '@lumino/algorithm';\n *\n * let data = [5, 7, 0, -2, 9];\n *\n * each(data, value => { console.log(value); });\n * ```\n */\nfunction each(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return;\n }\n }\n}\n/**\n * Test whether all values in an iterable satisfy a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if all values pass the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `false` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { every } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * every(data, value => value % 2 === 0); // false\n * every(data, value => value % 2 === 1); // true\n * ```\n */\nfunction every(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Test whether any value in an iterable satisfies a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if any value passes the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `true` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { some } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * some(data, value => value === 7); // true\n * some(data, value => value === 3); // false\n * ```\n */\nfunction some(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return true;\n }\n }\n return false;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Transform the values of an iterable with a mapping function.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n *\n * @returns An iterator which yields the transformed values.\n *\n * #### Example\n * ```typescript\n * import { map } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3];\n *\n * let stream = map(data, value => value * 2);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* map(object, fn) {\n let index = 0;\n for (const value of object) {\n yield fn(value, index++);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator of evenly spaced values.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns An iterator which produces evenly spaced values.\n *\n * #### Notes\n * In the single argument form of `range(stop)`, `start` defaults to\n * `0` and `step` defaults to `1`.\n *\n * In the two argument form of `range(start, stop)`, `step` defaults\n * to `1`.\n *\n * #### Example\n * ```typescript\n * import { range } from '@lumino/algorithm';\n *\n * let stream = range(2, 4);\n *\n * Array.from(stream); // [2, 3]\n * ```\n */\nfunction* range(start, stop, step) {\n if (stop === undefined) {\n stop = start;\n start = 0;\n step = 1;\n }\n else if (step === undefined) {\n step = 1;\n }\n const length = Private.rangeLength(start, stop, step);\n for (let index = 0; index < length; index++) {\n yield start + step * index;\n }\n}\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * Compute the effective length of a range.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns The number of steps need to traverse the range.\n */\n function rangeLength(start, stop, step) {\n if (step === 0) {\n return Infinity;\n }\n if (start > stop && step > 0) {\n return 0;\n }\n if (start < stop && step < 0) {\n return 0;\n }\n return Math.ceil((stop - start) / step);\n }\n Private.rangeLength = rangeLength;\n})(Private || (Private = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nfunction reduce(object, fn, initial) {\n // Setup the iterator and fetch the first value.\n const it = object[Symbol.iterator]();\n let index = 0;\n let first = it.next();\n // An empty iterator and no initial value is an error.\n if (first.done && initial === undefined) {\n throw new TypeError('Reduce of empty iterable with no initial value.');\n }\n // If the iterator is empty, return the initial value.\n if (first.done) {\n return initial;\n }\n // If the iterator has a single item and no initial value, the\n // reducer is not invoked and the first item is the return value.\n let second = it.next();\n if (second.done && initial === undefined) {\n return first.value;\n }\n // If iterator has a single item and an initial value is provided,\n // the reducer is invoked and that result is the return value.\n if (second.done) {\n return fn(initial, first.value, index++);\n }\n // Setup the initial accumlated value.\n let accumulator;\n if (initial === undefined) {\n accumulator = fn(first.value, second.value, index++);\n }\n else {\n accumulator = fn(fn(initial, first.value, index++), second.value, index++);\n }\n // Iterate the rest of the values, updating the accumulator.\n let next;\n while (!(next = it.next()).done) {\n accumulator = fn(accumulator, next.value, index++);\n }\n // Return the final accumulated value.\n return accumulator;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator which repeats a value a number of times.\n *\n * @deprecated\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n *\n * @returns A new iterator which repeats the specified value.\n *\n * #### Example\n * ```typescript\n * import { repeat } from '@lumino/algorithm';\n *\n * let stream = repeat(7, 3);\n *\n * Array.from(stream); // [7, 7, 7]\n * ```\n */\nfunction* repeat(value, count) {\n while (0 < count--) {\n yield value;\n }\n}\n/**\n * Create an iterator which yields a value a single time.\n *\n * @deprecated\n *\n * @param value - The value to wrap in an iterator.\n *\n * @returns A new iterator which yields the value a single time.\n *\n * #### Example\n * ```typescript\n * import { once } from '@lumino/algorithm';\n *\n * let stream = once(7);\n *\n * Array.from(stream); // [7]\n * ```\n */\nfunction* once(value) {\n yield value;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator for a retroable object.\n *\n * @param object - The retroable or array-like object of interest.\n *\n * @returns An iterator which traverses the object's values in reverse.\n *\n * #### Example\n * ```typescript\n * import { retro } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = retro(data);\n *\n * Array.from(stream); // [6, 5, 4, 3, 2, 1]\n * ```\n */\nfunction* retro(object) {\n if (typeof object.retro === 'function') {\n yield* object.retro();\n }\n else {\n for (let index = object.length - 1; index > -1; index--) {\n yield object[index];\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Topologically sort an iterable of edges.\n *\n * @param edges - The iterable object of edges to sort.\n * An edge is represented as a 2-tuple of `[fromNode, toNode]`.\n *\n * @returns The topologically sorted array of nodes.\n *\n * #### Notes\n * If a cycle is present in the graph, the cycle will be ignored and\n * the return value will be only approximately sorted.\n *\n * #### Example\n * ```typescript\n * import { topologicSort } from '@lumino/algorithm';\n *\n * let data = [\n * ['d', 'e'],\n * ['c', 'd'],\n * ['a', 'b'],\n * ['b', 'c']\n * ];\n *\n * topologicSort(data); // ['a', 'b', 'c', 'd', 'e']\n * ```\n */\nfunction topologicSort(edges) {\n // Setup the shared sorting state.\n let sorted = [];\n let visited = new Set();\n let graph = new Map();\n // Add the edges to the graph.\n for (const edge of edges) {\n addEdge(edge);\n }\n // Visit each node in the graph.\n for (const [k] of graph) {\n visit(k);\n }\n // Return the sorted results.\n return sorted;\n // Add an edge to the graph.\n function addEdge(edge) {\n let [fromNode, toNode] = edge;\n let children = graph.get(toNode);\n if (children) {\n children.push(fromNode);\n }\n else {\n graph.set(toNode, [fromNode]);\n }\n }\n // Recursively visit the node.\n function visit(node) {\n if (visited.has(node)) {\n return;\n }\n visited.add(node);\n let children = graph.get(node);\n if (children) {\n for (const child of children) {\n visit(child);\n }\n }\n sorted.push(node);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate over an iterable using a stepped increment.\n *\n * @param object - The iterable object of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n *\n * @returns An iterator which traverses the iterable step-wise.\n *\n * #### Example\n * ```typescript\n * import { stride } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = stride(data, 2);\n *\n * Array.from(stream); // [1, 3, 5];\n * ```\n */\nfunction* stride(object, step) {\n let count = 0;\n for (const value of object) {\n if (0 === count++ % step) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for string-specific algorithms.\n */\nvar StringExt;\n(function (StringExt) {\n /**\n * Find the indices of characters in a source text.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The matched indices, or `null` if there is no match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * In order for there to be a match, all of the characters in `query`\n * **must** appear in `source` in the order given by `query`.\n *\n * Characters are matched using strict `===` equality.\n */\n function findIndices(source, query, start = 0) {\n let indices = new Array(query.length);\n for (let i = 0, j = start, n = query.length; i < n; ++i, ++j) {\n j = source.indexOf(query[i], j);\n if (j === -1) {\n return null;\n }\n indices[i] = j;\n }\n return indices;\n }\n StringExt.findIndices = findIndices;\n /**\n * A string matcher which uses a sum-of-squares algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-squares approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The index of each\n * matching character is squared and added to the score. This means\n * that early and consecutive character matches are preferred, while\n * late matches are heavily penalized.\n */\n function matchSumOfSquares(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i] - start;\n score += j * j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfSquares = matchSumOfSquares;\n /**\n * A string matcher which uses a sum-of-deltas algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-deltas approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The delta between\n * the indices are summed to create the score. This means that groups\n * of matched characters are preferred, while fragmented matches are\n * penalized.\n */\n function matchSumOfDeltas(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n let last = start - 1;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i];\n score += j - last - 1;\n last = j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfDeltas = matchSumOfDeltas;\n /**\n * Highlight the matched characters of a source text.\n *\n * @param source - The text which should be highlighted.\n *\n * @param indices - The indices of the matched characters. They must\n * appear in increasing order and must be in bounds of the source.\n *\n * @param fn - The function to apply to the matched chunks.\n *\n * @returns An array of unmatched and highlighted chunks.\n */\n function highlight(source, indices, fn) {\n // Set up the result array.\n let result = [];\n // Set up the counter variables.\n let k = 0;\n let last = 0;\n let n = indices.length;\n // Iterator over each index.\n while (k < n) {\n // Set up the chunk indices.\n let i = indices[k];\n let j = indices[k];\n // Advance the right chunk index until it's non-contiguous.\n while (++k < n && indices[k] === j + 1) {\n j++;\n }\n // Extract the unmatched text.\n if (last < i) {\n result.push(source.slice(last, i));\n }\n // Extract and highlight the matched text.\n if (i < j + 1) {\n result.push(fn(source.slice(i, j + 1)));\n }\n // Update the last visited index.\n last = j + 1;\n }\n // Extract any remaining unmatched text.\n if (last < source.length) {\n result.push(source.slice(last));\n }\n // Return the highlighted result.\n return result;\n }\n StringExt.highlight = highlight;\n /**\n * A 3-way string comparison function.\n *\n * @param a - The first string of interest.\n *\n * @param b - The second string of interest.\n *\n * @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.\n */\n function cmp(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n StringExt.cmp = cmp;\n})(StringExt || (StringExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Take a fixed number of items from an iterable.\n *\n * @param object - The iterable object of interest.\n *\n * @param count - The number of items to take from the iterable.\n *\n * @returns An iterator which yields the specified number of items\n * from the source iterable.\n *\n * #### Notes\n * The returned iterator will exhaust early if the source iterable\n * contains an insufficient number of items.\n *\n * #### Example\n * ```typescript\n * import { take } from '@lumino/algorithm';\n *\n * let stream = take([5, 4, 3, 2, 1, 0, -1], 3);\n *\n * Array.from(stream); // [5, 4, 3]\n * ```\n */\nfunction* take(object, count) {\n if (count < 1) {\n return;\n }\n const it = object[Symbol.iterator]();\n let item;\n while (0 < count-- && !(item = it.next()).done) {\n yield item.value;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate several iterables in lockstep.\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields successive tuples of values where\n * each value is taken in turn from the provided iterables. It will\n * be as long as the shortest provided iterable.\n *\n * #### Example\n * ```typescript\n * import { zip } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = zip(data1, data2);\n *\n * Array.from(stream); // [[1, 4], [2, 5], [3, 6]]\n * ```\n */\nfunction* zip(...objects) {\n const iters = objects.map(obj => obj[Symbol.iterator]());\n let tuple = iters.map(it => it.next());\n for (; every(tuple, item => !item.done); tuple = iters.map(it => it.next())) {\n yield tuple.map(item => item.value);\n }\n}\n\nexport { ArrayExt, StringExt, chain, each, empty, enumerate, every, filter, find, findIndex, map, max, min, minmax, once, range, reduce, repeat, retro, some, stride, take, toArray, toObject, topologicSort, zip };\n//# sourceMappingURL=index.es6.js.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport * as nbformat from '@jupyterlab/nbformat';\nimport { ObservableList } from '@jupyterlab/observables';\nimport { OutputModel } from '@jupyterlab/rendermime';\nimport { map } from '@lumino/algorithm';\nimport { JSONExt } from '@lumino/coreutils';\nimport { Signal } from '@lumino/signaling';\n/**\n * The default implementation of the IOutputAreaModel.\n */\nexport class OutputAreaModel {\n /**\n * Construct a new observable outputs instance.\n */\n constructor(options = {}) {\n /**\n * A flag that is set when we want to clear the output area\n * *after* the next addition to it.\n */\n this.clearNext = false;\n this._lastStream = '';\n this._trusted = false;\n this._isDisposed = false;\n this._stateChanged = new Signal(this);\n this._changed = new Signal(this);\n this._trusted = !!options.trusted;\n this.contentFactory =\n options.contentFactory || OutputAreaModel.defaultContentFactory;\n this.list = new ObservableList();\n if (options.values) {\n for (const value of options.values) {\n const index = this._add(value) - 1;\n const item = this.list.get(index);\n item.changed.connect(this._onGenericChange, this);\n }\n }\n this.list.changed.connect(this._onListChanged, this);\n }\n /**\n * A signal emitted when an item changes.\n */\n get stateChanged() {\n return this._stateChanged;\n }\n /**\n * A signal emitted when the list of items changes.\n */\n get changed() {\n return this._changed;\n }\n /**\n * Get the length of the items in the model.\n */\n get length() {\n return this.list ? this.list.length : 0;\n }\n /**\n * Get whether the model is trusted.\n */\n get trusted() {\n return this._trusted;\n }\n /**\n * Set whether the model is trusted.\n *\n * #### Notes\n * Changing the value will cause all of the models to re-set.\n */\n set trusted(value) {\n if (value === this._trusted) {\n return;\n }\n const trusted = (this._trusted = value);\n for (let i = 0; i < this.list.length; i++) {\n const oldItem = this.list.get(i);\n const value = oldItem.toJSON();\n const item = this._createItem({ value, trusted });\n this.list.set(i, item);\n oldItem.dispose();\n }\n }\n /**\n * Test whether the model is disposed.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of the resources used by the model.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n this.list.dispose();\n Signal.clearData(this);\n }\n /**\n * Get an item at the specified index.\n */\n get(index) {\n return this.list.get(index);\n }\n /**\n * Set the value at the specified index.\n */\n set(index, value) {\n value = JSONExt.deepCopy(value);\n // Normalize stream data.\n Private.normalize(value);\n const item = this._createItem({ value, trusted: this._trusted });\n this.list.set(index, item);\n }\n /**\n * Add an output, which may be combined with previous output.\n *\n * @returns The total number of outputs.\n *\n * #### Notes\n * The output bundle is copied.\n * Contiguous stream outputs of the same `name` are combined.\n */\n add(output) {\n // If we received a delayed clear message, then clear now.\n if (this.clearNext) {\n this.clear();\n this.clearNext = false;\n }\n return this._add(output);\n }\n /**\n * Clear all of the output.\n *\n * @param wait Delay clearing the output until the next message is added.\n */\n clear(wait = false) {\n this._lastStream = '';\n if (wait) {\n this.clearNext = true;\n return;\n }\n for (const item of this.list) {\n item.dispose();\n }\n this.list.clear();\n }\n /**\n * Deserialize the model from JSON.\n *\n * #### Notes\n * This will clear any existing data.\n */\n fromJSON(values) {\n this.clear();\n for (const value of values) {\n this._add(value);\n }\n }\n /**\n * Serialize the model to JSON.\n */\n toJSON() {\n return Array.from(map(this.list, (output) => output.toJSON()));\n }\n /**\n * Add a copy of the item to the list.\n *\n * @returns The list length\n */\n _add(value) {\n const trusted = this._trusted;\n value = JSONExt.deepCopy(value);\n // Normalize the value.\n Private.normalize(value);\n // Consolidate outputs if they are stream outputs of the same kind.\n if (nbformat.isStream(value) &&\n this._lastStream &&\n value.name === this._lastName &&\n this.shouldCombine({\n value,\n lastModel: this.list.get(this.length - 1)\n })) {\n // In order to get a list change event, we add the previous\n // text to the current item and replace the previous item.\n // This also replaces the metadata of the last item.\n this._lastStream += value.text;\n this._lastStream = Private.removeOverwrittenChars(this._lastStream);\n value.text = this._lastStream;\n const item = this._createItem({ value, trusted });\n const index = this.length - 1;\n const prev = this.list.get(index);\n this.list.set(index, item);\n prev.dispose();\n return this.length;\n }\n if (nbformat.isStream(value)) {\n value.text = Private.removeOverwrittenChars(value.text);\n }\n // Create the new item.\n const item = this._createItem({ value, trusted });\n // Update the stream information.\n if (nbformat.isStream(value)) {\n this._lastStream = value.text;\n this._lastName = value.name;\n }\n else {\n this._lastStream = '';\n }\n // Add the item to our list and return the new length.\n return this.list.push(item);\n }\n /**\n * Whether a new value should be consolidated with the previous output.\n *\n * This will only be called if the minimal criteria of both being stream\n * messages of the same type.\n */\n shouldCombine(options) {\n return true;\n }\n /**\n * Create an output item and hook up its signals.\n */\n _createItem(options) {\n const factory = this.contentFactory;\n const item = factory.createOutputModel(options);\n return item;\n }\n /**\n * Handle a change to the list.\n */\n _onListChanged(sender, args) {\n switch (args.type) {\n case 'add':\n args.newValues.forEach(item => {\n item.changed.connect(this._onGenericChange, this);\n });\n break;\n case 'remove':\n args.oldValues.forEach(item => {\n item.changed.disconnect(this._onGenericChange, this);\n });\n break;\n case 'set':\n args.newValues.forEach(item => {\n item.changed.connect(this._onGenericChange, this);\n });\n args.oldValues.forEach(item => {\n item.changed.disconnect(this._onGenericChange, this);\n });\n break;\n }\n this._changed.emit(args);\n }\n /**\n * Handle a change to an item.\n */\n _onGenericChange(itemModel) {\n let idx;\n let item = null;\n for (idx = 0; idx < this.list.length; idx++) {\n item = this.list.get(idx);\n if (item === itemModel) {\n break;\n }\n }\n if (item != null) {\n this._stateChanged.emit(idx);\n this._changed.emit({\n type: 'set',\n newIndex: idx,\n oldIndex: idx,\n oldValues: [item],\n newValues: [item]\n });\n }\n }\n}\n/**\n * The namespace for OutputAreaModel class statics.\n */\n(function (OutputAreaModel) {\n /**\n * The default implementation of a `IModelOutputFactory`.\n */\n class ContentFactory {\n /**\n * Create an output model.\n */\n createOutputModel(options) {\n return new OutputModel(options);\n }\n }\n OutputAreaModel.ContentFactory = ContentFactory;\n /**\n * The default output model factory.\n */\n OutputAreaModel.defaultContentFactory = new ContentFactory();\n})(OutputAreaModel || (OutputAreaModel = {}));\n/**\n * A namespace for module-private functionality.\n */\nvar Private;\n(function (Private) {\n /**\n * Normalize an output.\n */\n function normalize(value) {\n if (nbformat.isStream(value)) {\n if (Array.isArray(value.text)) {\n value.text = value.text.join('\\n');\n }\n }\n }\n Private.normalize = normalize;\n /**\n * Remove characters that are overridden by backspace characters.\n */\n function fixBackspace(txt) {\n let tmp = txt;\n do {\n txt = tmp;\n // Cancel out anything-but-newline followed by backspace\n tmp = txt.replace(/[^\\n]\\x08/gm, ''); // eslint-disable-line no-control-regex\n } while (tmp.length < txt.length);\n return txt;\n }\n /**\n * Remove chunks that should be overridden by the effect of\n * carriage return characters.\n */\n function fixCarriageReturn(txt) {\n txt = txt.replace(/\\r+\\n/gm, '\\n'); // \\r followed by \\n --> newline\n while (txt.search(/\\r[^$]/g) > -1) {\n const base = txt.match(/^(.*)\\r+/m)[1];\n let insert = txt.match(/\\r+(.*)$/m)[1];\n insert = insert + base.slice(insert.length, base.length);\n txt = txt.replace(/\\r+.*$/m, '\\r').replace(/^.*\\r/m, insert);\n }\n return txt;\n }\n /*\n * Remove characters overridden by backspaces and carriage returns\n */\n function removeOverwrittenChars(text) {\n return fixCarriageReturn(fixBackspace(text));\n }\n Private.removeOverwrittenChars = removeOverwrittenChars;\n})(Private || (Private = {}));\n//# sourceMappingURL=model.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { JSONExt } from '@lumino/coreutils';\nimport { Message } from '@lumino/messaging';\nimport { ObservableMap } from './observablemap';\n/**\n * A concrete Observable map for JSON data.\n */\nexport class ObservableJSON extends ObservableMap {\n /**\n * Construct a new observable JSON object.\n */\n constructor(options = {}) {\n super({\n itemCmp: JSONExt.deepEqual,\n values: options.values\n });\n }\n /**\n * Serialize the model to JSON.\n */\n toJSON() {\n const out = Object.create(null);\n const keys = this.keys();\n for (const key of keys) {\n const value = this.get(key);\n if (value !== undefined) {\n out[key] = JSONExt.deepCopy(value);\n }\n }\n return out;\n }\n}\n/**\n * The namespace for ObservableJSON static data.\n */\n(function (ObservableJSON) {\n /**\n * An observable JSON change message.\n */\n class ChangeMessage extends Message {\n /**\n * Create a new metadata changed message.\n */\n constructor(type, args) {\n super(type);\n this.args = args;\n }\n }\n ObservableJSON.ChangeMessage = ChangeMessage;\n})(ObservableJSON || (ObservableJSON = {}));\n//# sourceMappingURL=observablejson.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { RestorablePool } from '@jupyterlab/statedb';\nimport { Signal } from '@lumino/signaling';\nimport { FocusTracker } from '@lumino/widgets';\n/**\n * A class that keeps track of widget instances on an Application shell.\n *\n * @typeparam T - The type of widget being tracked. Defaults to `Widget`.\n *\n * #### Notes\n * The API surface area of this concrete implementation is substantially larger\n * than the widget tracker interface it implements. The interface is intended\n * for export by JupyterLab plugins that create widgets and have clients who may\n * wish to keep track of newly created widgets. This class, however, can be used\n * internally by plugins to restore state as well.\n */\nexport class WidgetTracker {\n /**\n * Create a new widget tracker.\n *\n * @param options - The instantiation options for a widget tracker.\n */\n constructor(options) {\n this._currentChanged = new Signal(this);\n this._deferred = null;\n this._isDisposed = false;\n this._widgetAdded = new Signal(this);\n this._widgetUpdated = new Signal(this);\n const focus = (this._focusTracker = new FocusTracker());\n const pool = (this._pool = new RestorablePool(options));\n this.namespace = options.namespace;\n focus.currentChanged.connect((_, current) => {\n if (current.newValue !== this.currentWidget) {\n pool.current = current.newValue;\n }\n }, this);\n pool.added.connect((_, widget) => {\n this._widgetAdded.emit(widget);\n }, this);\n pool.currentChanged.connect((_, widget) => {\n // If the pool's current reference is `null` but the focus tracker has a\n // current widget, update the pool to match the focus tracker.\n if (widget === null && focus.currentWidget) {\n pool.current = focus.currentWidget;\n return;\n }\n this.onCurrentChanged(widget);\n this._currentChanged.emit(widget);\n }, this);\n pool.updated.connect((_, widget) => {\n this._widgetUpdated.emit(widget);\n }, this);\n }\n /**\n * A signal emitted when the current widget changes.\n */\n get currentChanged() {\n return this._currentChanged;\n }\n /**\n * The current widget is the most recently focused or added widget.\n *\n * #### Notes\n * It is the most recently focused widget, or the most recently added\n * widget if no widget has taken focus.\n */\n get currentWidget() {\n return this._pool.current || null;\n }\n /**\n * A promise resolved when the tracker has been restored.\n */\n get restored() {\n if (this._deferred) {\n return Promise.resolve();\n }\n else {\n return this._pool.restored;\n }\n }\n /**\n * The number of widgets held by the tracker.\n */\n get size() {\n return this._pool.size;\n }\n /**\n * A signal emitted when a widget is added.\n *\n * #### Notes\n * This signal will only fire when a widget is added to the tracker. It will\n * not fire if a widget is injected into the tracker.\n */\n get widgetAdded() {\n return this._widgetAdded;\n }\n /**\n * A signal emitted when a widget is updated.\n */\n get widgetUpdated() {\n return this._widgetUpdated;\n }\n /**\n * Add a new widget to the tracker.\n *\n * @param widget - The widget being added.\n *\n * #### Notes\n * The widget passed into the tracker is added synchronously; its existence in\n * the tracker can be checked with the `has()` method. The promise this method\n * returns resolves after the widget has been added and saved to an underlying\n * restoration connector, if one is available.\n *\n * The newly added widget becomes the current widget unless the focus tracker\n * already had a focused widget.\n */\n async add(widget) {\n this._focusTracker.add(widget);\n await this._pool.add(widget);\n if (!this._focusTracker.activeWidget) {\n this._pool.current = widget;\n }\n }\n /**\n * Test whether the tracker is disposed.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n this._pool.dispose();\n this._focusTracker.dispose();\n Signal.clearData(this);\n }\n /**\n * Find the first widget in the tracker that satisfies a filter function.\n *\n * @param fn The filter function to call on each widget.\n *\n * #### Notes\n * If no widget is found, the value returned is `undefined`.\n */\n find(fn) {\n return this._pool.find(fn);\n }\n /**\n * Iterate through each widget in the tracker.\n *\n * @param fn - The function to call on each widget.\n */\n forEach(fn) {\n return this._pool.forEach(fn);\n }\n /**\n * Filter the widgets in the tracker based on a predicate.\n *\n * @param fn - The function by which to filter.\n */\n filter(fn) {\n return this._pool.filter(fn);\n }\n /**\n * Inject a foreign widget into the widget tracker.\n *\n * @param widget - The widget to inject into the tracker.\n *\n * #### Notes\n * Injected widgets will not have their state saved by the tracker.\n *\n * The primary use case for widget injection is for a plugin that offers a\n * sub-class of an extant plugin to have its instances share the same commands\n * as the parent plugin (since most relevant commands will use the\n * `currentWidget` of the parent plugin's widget tracker). In this situation,\n * the sub-class plugin may well have its own widget tracker for layout and\n * state restoration in addition to injecting its widgets into the parent\n * plugin's widget tracker.\n */\n inject(widget) {\n return this._pool.inject(widget);\n }\n /**\n * Check if this tracker has the specified widget.\n *\n * @param widget - The widget whose existence is being checked.\n */\n has(widget) {\n return this._pool.has(widget);\n }\n /**\n * Restore the widgets in this tracker's namespace.\n *\n * @param options - The configuration options that describe restoration.\n *\n * @returns A promise that resolves when restoration has completed.\n *\n * #### Notes\n * This function should not typically be invoked by client code.\n * Its primary use case is to be invoked by a restorer.\n */\n async restore(options) {\n const deferred = this._deferred;\n if (deferred) {\n this._deferred = null;\n return this._pool.restore(deferred);\n }\n if (options) {\n return this._pool.restore(options);\n }\n console.warn('No options provided to restore the tracker.');\n }\n /**\n * Save the restore options for this tracker, but do not restore yet.\n *\n * @param options - The configuration options that describe restoration.\n *\n * ### Notes\n * This function is useful when starting the shell in 'single-document' mode,\n * to avoid restoring all useless widgets. It should not ordinarily be called\n * by client code.\n */\n defer(options) {\n this._deferred = options;\n }\n /**\n * Save the restore data for a given widget.\n *\n * @param widget - The widget being saved.\n */\n async save(widget) {\n return this._pool.save(widget);\n }\n /**\n * Handle the current change event.\n *\n * #### Notes\n * The default implementation is a no-op.\n */\n onCurrentChanged(value) {\n /* no-op */\n }\n}\n//# sourceMappingURL=widgettracker.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { WidgetTracker } from '@jupyterlab/apputils';\nimport { KernelMessage } from '@jupyterlab/services';\nimport { nullTranslator } from '@jupyterlab/translation';\nimport { PromiseDelegate, UUID } from '@lumino/coreutils';\nimport { AttachedProperty } from '@lumino/properties';\nimport { Signal } from '@lumino/signaling';\nimport { Panel, PanelLayout, Widget } from '@lumino/widgets';\n/**\n * The class name added to an output area widget.\n */\nconst OUTPUT_AREA_CLASS = 'jp-OutputArea';\n/**\n * The class name added to the direction children of OutputArea\n */\nconst OUTPUT_AREA_ITEM_CLASS = 'jp-OutputArea-child';\n/**\n * The class name added to actual outputs\n */\nconst OUTPUT_AREA_OUTPUT_CLASS = 'jp-OutputArea-output';\n/**\n * The class name added to prompt children of OutputArea.\n */\nconst OUTPUT_AREA_PROMPT_CLASS = 'jp-OutputArea-prompt';\nconst OUTPUT_AREA_STDIN_HIDING_CLASS = 'jp-OutputArea-stdin-hiding';\n/**\n * The class name added to OutputPrompt.\n */\nconst OUTPUT_PROMPT_CLASS = 'jp-OutputPrompt';\n/**\n * The class name added to an execution result.\n */\nconst EXECUTE_CLASS = 'jp-OutputArea-executeResult';\n/**\n * The class name added stdin items of OutputArea\n */\nconst OUTPUT_AREA_STDIN_ITEM_CLASS = 'jp-OutputArea-stdin-item';\n/**\n * The class name added to stdin widgets.\n */\nconst STDIN_CLASS = 'jp-Stdin';\n/**\n * The class name added to stdin data prompt nodes.\n */\nconst STDIN_PROMPT_CLASS = 'jp-Stdin-prompt';\n/**\n * The class name added to stdin data input nodes.\n */\nconst STDIN_INPUT_CLASS = 'jp-Stdin-input';\n/**\n * The overlay that can be clicked to switch between output scrolling modes.\n */\nconst OUTPUT_PROMPT_OVERLAY = 'jp-OutputArea-promptOverlay';\n/** ****************************************************************************\n * OutputArea\n ******************************************************************************/\n/**\n * An output area widget.\n *\n * #### Notes\n * The widget model must be set separately and can be changed\n * at any time. Consumers of the widget must account for a\n * `null` model, and may want to listen to the `modelChanged`\n * signal.\n */\nexport class OutputArea extends Widget {\n /**\n * Construct an output area widget.\n */\n constructor(options) {\n var _a, _b, _c, _d;\n super();\n /**\n * A public signal used to indicate the number of displayed outputs has changed.\n *\n * #### Notes\n * This is useful for parents who want to apply styling based on the number\n * of outputs. Emits the current number of outputs.\n */\n this.outputLengthChanged = new Signal(this);\n /**\n * Handle an iopub message.\n */\n this._onIOPub = (msg) => {\n const model = this.model;\n const msgType = msg.header.msg_type;\n let output;\n const transient = (msg.content.transient || {});\n const displayId = transient['display_id'];\n let targets;\n switch (msgType) {\n case 'execute_result':\n case 'display_data':\n case 'stream':\n case 'error':\n output = { ...msg.content, output_type: msgType };\n model.add(output);\n break;\n case 'clear_output': {\n const wait = msg.content.wait;\n model.clear(wait);\n break;\n }\n case 'update_display_data':\n output = { ...msg.content, output_type: 'display_data' };\n targets = this._displayIdMap.get(displayId);\n if (targets) {\n for (const index of targets) {\n model.set(index, output);\n }\n }\n break;\n case 'status': {\n const executionState = msg.content\n .execution_state;\n if (executionState === 'idle') {\n // If status is idle, the kernel is no longer blocked by the input\n this._pendingInput = false;\n }\n break;\n }\n default:\n break;\n }\n if (displayId && msgType === 'display_data') {\n targets = this._displayIdMap.get(displayId) || [];\n targets.push(model.length - 1);\n this._displayIdMap.set(displayId, targets);\n }\n };\n /**\n * Handle an execute reply message.\n */\n this._onExecuteReply = (msg) => {\n // API responses that contain a pager are special cased and their type\n // is overridden from 'execute_reply' to 'display_data' in order to\n // render output.\n const model = this.model;\n const content = msg.content;\n if (content.status !== 'ok') {\n return;\n }\n const payload = content && content.payload;\n if (!payload || !payload.length) {\n return;\n }\n const pages = payload.filter((i) => i.source === 'page');\n if (!pages.length) {\n return;\n }\n const page = JSON.parse(JSON.stringify(pages[0]));\n const output = {\n output_type: 'display_data',\n data: page.data,\n metadata: {}\n };\n model.add(output);\n };\n this._displayIdMap = new Map();\n this._minHeightTimeout = null;\n this._inputRequested = new Signal(this);\n this._toggleScrolling = new Signal(this);\n this._initialize = new Signal(this);\n this._outputTracker = new WidgetTracker({\n namespace: UUID.uuid4()\n });\n this._inputHistoryScope = 'global';\n this._pendingInput = false;\n super.layout = new PanelLayout();\n this.addClass(OUTPUT_AREA_CLASS);\n this.contentFactory =\n (_a = options.contentFactory) !== null && _a !== void 0 ? _a : OutputArea.defaultContentFactory;\n this.rendermime = options.rendermime;\n this._maxNumberOutputs = (_b = options.maxNumberOutputs) !== null && _b !== void 0 ? _b : Infinity;\n this._translator = (_c = options.translator) !== null && _c !== void 0 ? _c : nullTranslator;\n this._inputHistoryScope = (_d = options.inputHistoryScope) !== null && _d !== void 0 ? _d : 'global';\n const model = (this.model = options.model);\n for (let i = 0; i < Math.min(model.length, this._maxNumberOutputs + 1); i++) {\n const output = model.get(i);\n this._insertOutput(i, output);\n }\n model.changed.connect(this.onModelChanged, this);\n model.stateChanged.connect(this.onStateChanged, this);\n if (options.promptOverlay) {\n this._addPromptOverlay();\n }\n }\n /**\n * Narrow the type of OutputArea's layout prop\n */\n get layout() {\n return super.layout;\n }\n /**\n * A read-only sequence of the children widgets in the output area.\n */\n get widgets() {\n return this.layout.widgets;\n }\n /**\n * The kernel future associated with the output area.\n */\n get future() {\n return this._future;\n }\n set future(value) {\n // Bail if the model is disposed.\n if (this.model.isDisposed) {\n throw Error('Model is disposed');\n }\n if (this._future === value) {\n return;\n }\n if (this._future) {\n this._future.dispose();\n }\n this._future = value;\n value.done\n .finally(() => {\n this._pendingInput = false;\n })\n .catch(() => {\n // No-op, required because `finally` re-raises any rejections,\n // even if caught on the `done` promise level before.\n });\n this.model.clear();\n // Make sure there were no input widgets.\n if (this.widgets.length) {\n this._clear();\n this.outputLengthChanged.emit(Math.min(this.model.length, this._maxNumberOutputs));\n }\n // Handle published messages.\n value.onIOPub = this._onIOPub;\n // Handle the execute reply.\n value.onReply = this._onExecuteReply;\n // Handle stdin.\n value.onStdin = msg => {\n if (KernelMessage.isInputRequestMsg(msg)) {\n this.onInputRequest(msg, value);\n }\n };\n }\n /**\n * Signal emitted when an output area is requesting an input. The signal\n * carries the input widget that this class creates in response to the input\n * request.\n */\n get inputRequested() {\n return this._inputRequested;\n }\n /**\n * A flag indicating if the output area has pending input.\n */\n get pendingInput() {\n return this._pendingInput;\n }\n /**\n * The maximum number of output items to display on top and bottom of cell output.\n *\n * ### Notes\n * It is set to Infinity if no trim is applied.\n */\n get maxNumberOutputs() {\n return this._maxNumberOutputs;\n }\n set maxNumberOutputs(limit) {\n if (limit <= 0) {\n console.warn(`OutputArea.maxNumberOutputs must be strictly positive.`);\n return;\n }\n const lastShown = this._maxNumberOutputs;\n this._maxNumberOutputs = limit;\n if (lastShown < limit) {\n this._showTrimmedOutputs(lastShown);\n }\n }\n /**\n * Dispose of the resources used by the output area.\n */\n dispose() {\n if (this._future) {\n this._future.dispose();\n this._future = null;\n }\n this._displayIdMap.clear();\n this._outputTracker.dispose();\n super.dispose();\n }\n /**\n * Follow changes on the model state.\n */\n onModelChanged(sender, args) {\n switch (args.type) {\n case 'add':\n this._insertOutput(args.newIndex, args.newValues[0]);\n break;\n case 'remove':\n if (this.widgets.length) {\n // all items removed from model\n if (this.model.length === 0) {\n this._clear();\n }\n else {\n // range of items removed from model\n // remove widgets corresponding to removed model items\n const startIndex = args.oldIndex;\n for (let i = 0; i < args.oldValues.length && startIndex < this.widgets.length; ++i) {\n const widget = this.widgets[startIndex];\n widget.parent = null;\n widget.dispose();\n }\n // apply item offset to target model item indices in _displayIdMap\n this._moveDisplayIdIndices(startIndex, args.oldValues.length);\n // prevent jitter caused by immediate height change\n this._preventHeightChangeJitter();\n }\n }\n break;\n case 'set':\n this._setOutput(args.newIndex, args.newValues[0]);\n break;\n default:\n break;\n }\n this.outputLengthChanged.emit(Math.min(this.model.length, this._maxNumberOutputs));\n }\n /**\n * Emitted when user requests toggling of the output scrolling mode.\n */\n get toggleScrolling() {\n return this._toggleScrolling;\n }\n get initialize() {\n return this._initialize;\n }\n /**\n * Add overlay allowing to toggle scrolling.\n */\n _addPromptOverlay() {\n const overlay = document.createElement('div');\n overlay.className = OUTPUT_PROMPT_OVERLAY;\n overlay.addEventListener('click', () => {\n this._toggleScrolling.emit();\n });\n this.node.appendChild(overlay);\n requestAnimationFrame(() => {\n this._initialize.emit();\n });\n }\n /**\n * Update indices in _displayIdMap in response to element remove from model items\n *\n * @param startIndex - The index of first element removed\n *\n * @param count - The number of elements removed from model items\n *\n */\n _moveDisplayIdIndices(startIndex, count) {\n this._displayIdMap.forEach((indices) => {\n const rangeEnd = startIndex + count;\n const numIndices = indices.length;\n // reverse loop in order to prevent removing element affecting the index\n for (let i = numIndices - 1; i >= 0; --i) {\n const index = indices[i];\n // remove model item indices in removed range\n if (index >= startIndex && index < rangeEnd) {\n indices.splice(i, 1);\n }\n else if (index >= rangeEnd) {\n // move model item indices that were larger than range end\n indices[i] -= count;\n }\n }\n });\n }\n /**\n * Follow changes on the output model state.\n */\n onStateChanged(sender, change) {\n const outputLength = Math.min(this.model.length, this._maxNumberOutputs);\n if (change) {\n if (change >= this._maxNumberOutputs) {\n // Bail early\n return;\n }\n this._setOutput(change, this.model.get(change));\n }\n else {\n for (let i = 0; i < outputLength; i++) {\n this._setOutput(i, this.model.get(i));\n }\n }\n this.outputLengthChanged.emit(outputLength);\n }\n /**\n * Clear the widget outputs.\n */\n _clear() {\n // Bail if there is no work to do.\n if (!this.widgets.length) {\n return;\n }\n // Remove all of our widgets.\n const length = this.widgets.length;\n for (let i = 0; i < length; i++) {\n const widget = this.widgets[0];\n widget.parent = null;\n widget.dispose();\n }\n // Clear the display id map.\n this._displayIdMap.clear();\n // prevent jitter caused by immediate height change\n this._preventHeightChangeJitter();\n }\n _preventHeightChangeJitter() {\n // When an output area is cleared and then quickly replaced with new\n // content (as happens with @interact in widgets, for example), the\n // quickly changing height can make the page jitter.\n // We introduce a small delay in the minimum height\n // to prevent this jitter.\n const rect = this.node.getBoundingClientRect();\n this.node.style.minHeight = `${rect.height}px`;\n if (this._minHeightTimeout) {\n window.clearTimeout(this._minHeightTimeout);\n }\n this._minHeightTimeout = window.setTimeout(() => {\n if (this.isDisposed) {\n return;\n }\n this.node.style.minHeight = '';\n }, 50);\n }\n /**\n * Handle an input request from a kernel.\n */\n onInputRequest(msg, future) {\n // Add an output widget to the end.\n const factory = this.contentFactory;\n const stdinPrompt = msg.content.prompt;\n const password = msg.content.password;\n const panel = new Panel();\n panel.addClass(OUTPUT_AREA_ITEM_CLASS);\n panel.addClass(OUTPUT_AREA_STDIN_ITEM_CLASS);\n const prompt = factory.createOutputPrompt();\n prompt.addClass(OUTPUT_AREA_PROMPT_CLASS);\n panel.addWidget(prompt);\n // Indicate that input is pending\n this._pendingInput = true;\n const input = factory.createStdin({\n parent_header: msg.header,\n prompt: stdinPrompt,\n password,\n future,\n translator: this._translator,\n inputHistoryScope: this._inputHistoryScope\n });\n input.addClass(OUTPUT_AREA_OUTPUT_CLASS);\n panel.addWidget(input);\n // Increase number of outputs to display the result up to the input request.\n if (this.model.length >= this.maxNumberOutputs) {\n this.maxNumberOutputs = this.model.length;\n }\n this._inputRequested.emit(input);\n // Get the input node to ensure focus after updating the model upon user reply.\n const inputNode = input.node.getElementsByTagName('input')[0];\n /**\n * Wait for the stdin to complete, add it to the model (so it persists)\n * and remove the stdin widget.\n */\n void input.value.then(value => {\n // Increase number of outputs to display the result of stdin if needed.\n if (this.model.length >= this.maxNumberOutputs) {\n this.maxNumberOutputs = this.model.length + 1;\n }\n panel.addClass(OUTPUT_AREA_STDIN_HIDING_CLASS);\n // Use stdin as the stream so it does not get combined with stdout.\n // Note: because it modifies DOM it may (will) shift focus away from the input node.\n this.model.add({\n output_type: 'stream',\n name: 'stdin',\n text: value + '\\n'\n });\n // Refocus the input node after it lost focus due to update of the model.\n inputNode.focus();\n // Indicate that input is no longer pending\n this._pendingInput = false;\n // Keep the input in view for a little while; this (along refocusing)\n // ensures that we can avoid the cell editor stealing the focus, and\n // leading to user inadvertently modifying editor content when executing\n // consecutive commands in short succession.\n window.setTimeout(() => {\n // Tack currently focused element to ensure that it remains on it\n // after disposal of the panel with the old input\n // (which modifies DOM and can lead to focus jump).\n const focusedElement = document.activeElement;\n // Dispose the old panel with no longer needed input box.\n panel.dispose();\n // Refocus the element that was focused before.\n if (focusedElement && focusedElement instanceof HTMLElement) {\n focusedElement.focus();\n }\n }, 500);\n });\n // Note: the `input.value` promise must be listened to before we attach the panel\n this.layout.addWidget(panel);\n }\n /**\n * Update an output in the layout in place.\n */\n _setOutput(index, model) {\n if (index >= this._maxNumberOutputs) {\n return;\n }\n const panel = this.layout.widgets[index];\n const renderer = (panel.widgets\n ? panel.widgets.filter(it => 'renderModel' in it).pop()\n : panel);\n // Check whether it is safe to reuse renderer:\n // - Preferred mime type has not changed\n // - Isolation has not changed\n const mimeType = this.rendermime.preferredMimeType(model.data, model.trusted ? 'any' : 'ensure');\n if (Private.currentPreferredMimetype.get(renderer) === mimeType &&\n OutputArea.isIsolated(mimeType, model.metadata) ===\n renderer instanceof Private.IsolatedRenderer) {\n void renderer.renderModel(model);\n }\n else {\n this.layout.widgets[index].dispose();\n this._insertOutput(index, model);\n }\n }\n /**\n * Render and insert a single output into the layout.\n *\n * @param index - The index of the output to be inserted.\n * @param model - The model of the output to be inserted.\n */\n _insertOutput(index, model) {\n if (index > this._maxNumberOutputs) {\n return;\n }\n const layout = this.layout;\n if (index === this._maxNumberOutputs) {\n const warning = new Private.TrimmedOutputs(this._maxNumberOutputs, () => {\n const lastShown = this._maxNumberOutputs;\n this._maxNumberOutputs = Infinity;\n this._showTrimmedOutputs(lastShown);\n });\n layout.insertWidget(index, this._wrappedOutput(warning));\n }\n else {\n let output = this.createOutputItem(model);\n if (output) {\n output.toggleClass(EXECUTE_CLASS, model.executionCount !== null);\n }\n else {\n output = new Widget();\n }\n if (!this._outputTracker.has(output)) {\n void this._outputTracker.add(output);\n }\n layout.insertWidget(index, output);\n }\n }\n /**\n * A widget tracker for individual output widgets in the output area.\n */\n get outputTracker() {\n return this._outputTracker;\n }\n /**\n * Dispose information message and show output models from the given\n * index to maxNumberOutputs\n *\n * @param lastShown Starting model index to insert.\n */\n _showTrimmedOutputs(lastShown) {\n // Dispose information widget\n this.widgets[lastShown].dispose();\n for (let idx = lastShown; idx < this.model.length; idx++) {\n this._insertOutput(idx, this.model.get(idx));\n }\n this.outputLengthChanged.emit(Math.min(this.model.length, this._maxNumberOutputs));\n }\n /**\n * Create an output item with a prompt and actual output\n *\n * @returns a rendered widget, or null if we cannot render\n * #### Notes\n */\n createOutputItem(model) {\n const output = this.createRenderedMimetype(model);\n if (!output) {\n return null;\n }\n return this._wrappedOutput(output, model.executionCount);\n }\n /**\n * Render a mimetype\n */\n createRenderedMimetype(model) {\n const mimeType = this.rendermime.preferredMimeType(model.data, model.trusted ? 'any' : 'ensure');\n if (!mimeType) {\n return null;\n }\n let output = this.rendermime.createRenderer(mimeType);\n const isolated = OutputArea.isIsolated(mimeType, model.metadata);\n if (isolated === true) {\n output = new Private.IsolatedRenderer(output);\n }\n Private.currentPreferredMimetype.set(output, mimeType);\n output.renderModel(model).catch(error => {\n // Manually append error message to output\n const pre = document.createElement('pre');\n const trans = this._translator.load('jupyterlab');\n pre.textContent = trans.__('Javascript Error: %1', error.message);\n output.node.appendChild(pre);\n // Remove mime-type-specific CSS classes\n output.node.className = 'lm-Widget jp-RenderedText';\n output.node.setAttribute('data-mime-type', 'application/vnd.jupyter.stderr');\n });\n return output;\n }\n /**\n * Wrap a output widget within a output panel\n *\n * @param output Output widget to wrap\n * @param executionCount Execution count\n * @returns The output panel\n */\n _wrappedOutput(output, executionCount = null) {\n const panel = new Private.OutputPanel();\n panel.addClass(OUTPUT_AREA_ITEM_CLASS);\n const prompt = this.contentFactory.createOutputPrompt();\n prompt.executionCount = executionCount;\n prompt.addClass(OUTPUT_AREA_PROMPT_CLASS);\n panel.addWidget(prompt);\n output.addClass(OUTPUT_AREA_OUTPUT_CLASS);\n panel.addWidget(output);\n return panel;\n }\n}\nexport class SimplifiedOutputArea extends OutputArea {\n /**\n * Handle an input request from a kernel by doing nothing.\n */\n onInputRequest(msg, future) {\n return;\n }\n /**\n * Create an output item without a prompt, just the output widgets\n */\n createOutputItem(model) {\n const output = this.createRenderedMimetype(model);\n if (!output) {\n return null;\n }\n const panel = new Private.OutputPanel();\n panel.addClass(OUTPUT_AREA_ITEM_CLASS);\n output.addClass(OUTPUT_AREA_OUTPUT_CLASS);\n panel.addWidget(output);\n return panel;\n }\n}\n/**\n * A namespace for OutputArea statics.\n */\n(function (OutputArea) {\n /**\n * Execute code on an output area.\n */\n async function execute(code, output, sessionContext, metadata) {\n var _a;\n // Override the default for `stop_on_error`.\n let stopOnError = true;\n if (metadata &&\n Array.isArray(metadata.tags) &&\n metadata.tags.indexOf('raises-exception') !== -1) {\n stopOnError = false;\n }\n const content = {\n code,\n stop_on_error: stopOnError\n };\n const kernel = (_a = sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel;\n if (!kernel) {\n throw new Error('Session has no kernel.');\n }\n const future = kernel.requestExecute(content, false, metadata);\n output.future = future;\n return future.done;\n }\n OutputArea.execute = execute;\n function isIsolated(mimeType, metadata) {\n const mimeMd = metadata[mimeType];\n // mime-specific higher priority\n if (mimeMd && mimeMd['isolated'] !== undefined) {\n return !!mimeMd['isolated'];\n }\n else {\n // fallback on global\n return !!metadata['isolated'];\n }\n }\n OutputArea.isIsolated = isIsolated;\n /**\n * The default implementation of `IContentFactory`.\n */\n class ContentFactory {\n /**\n * Create the output prompt for the widget.\n */\n createOutputPrompt() {\n return new OutputPrompt();\n }\n /**\n * Create an stdin widget.\n */\n createStdin(options) {\n return new Stdin(options);\n }\n }\n OutputArea.ContentFactory = ContentFactory;\n /**\n * The default `ContentFactory` instance.\n */\n OutputArea.defaultContentFactory = new ContentFactory();\n})(OutputArea || (OutputArea = {}));\n/**\n * The default output prompt implementation\n */\nexport class OutputPrompt extends Widget {\n /*\n * Create an output prompt widget.\n */\n constructor() {\n super();\n this._executionCount = null;\n this.addClass(OUTPUT_PROMPT_CLASS);\n }\n /**\n * The execution count for the prompt.\n */\n get executionCount() {\n return this._executionCount;\n }\n set executionCount(value) {\n this._executionCount = value;\n if (value === null) {\n this.node.textContent = '';\n }\n else {\n this.node.textContent = `[${value}]:`;\n }\n }\n}\n/**\n * The default stdin widget.\n */\nexport class Stdin extends Widget {\n static _historyIx(key, ix) {\n const history = Stdin._history.get(key);\n if (!history) {\n return undefined;\n }\n const len = history.length;\n // wrap nonpositive ix to nonnegative ix\n if (ix <= 0) {\n return len + ix;\n }\n }\n static _historyAt(key, ix) {\n const history = Stdin._history.get(key);\n if (!history) {\n return undefined;\n }\n const len = history.length;\n const ixpos = Stdin._historyIx(key, ix);\n if (ixpos !== undefined && ixpos < len) {\n return history[ixpos];\n }\n // return undefined if ix is out of bounds\n }\n static _historyPush(key, line) {\n const history = Stdin._history.get(key);\n history.push(line);\n if (history.length > 1000) {\n // truncate line history if it's too long\n history.shift();\n }\n }\n static _historySearch(key, pat, ix, reverse = true) {\n const history = Stdin._history.get(key);\n const len = history.length;\n const ixpos = Stdin._historyIx(key, ix);\n const substrFound = (x) => x.search(pat) !== -1;\n if (ixpos === undefined) {\n return;\n }\n if (reverse) {\n if (ixpos === 0) {\n // reverse search fails if already at start of history\n return;\n }\n const ixFound = history.slice(0, ixpos).findLastIndex(substrFound);\n if (ixFound !== -1) {\n // wrap ix to negative\n return ixFound - len;\n }\n }\n else {\n if (ixpos >= len - 1) {\n // forward search fails if already at end of history\n return;\n }\n const ixFound = history.slice(ixpos + 1).findIndex(substrFound);\n if (ixFound !== -1) {\n // wrap ix to negative and adjust for slice\n return ixFound - len + ixpos + 1;\n }\n }\n }\n /**\n * Construct a new input widget.\n */\n constructor(options) {\n var _a;\n super({\n node: Private.createInputWidgetNode(options.prompt, options.password)\n });\n this._promise = new PromiseDelegate();\n this._resolved = false;\n this.addClass(STDIN_CLASS);\n this._future = options.future;\n this._historyIndex = 0;\n this._historyKey =\n options.inputHistoryScope === 'session'\n ? options.parent_header.session\n : '';\n this._historyPat = '';\n this._parentHeader = options.parent_header;\n this._password = options.password;\n this._trans = ((_a = options.translator) !== null && _a !== void 0 ? _a : nullTranslator).load('jupyterlab');\n this._value = options.prompt + ' ';\n this._input = this.node.getElementsByTagName('input')[0];\n // make users aware of the line history feature\n if (!this._password) {\n this._input.placeholder = this._trans.__('↑↓ for history. Search history with c-↑/c-↓');\n }\n else {\n this._input.placeholder = '';\n }\n // initialize line history\n if (!Stdin._history.has(this._historyKey)) {\n Stdin._history.set(this._historyKey, []);\n }\n }\n /**\n * The value of the widget.\n */\n get value() {\n return this._promise.promise.then(() => this._value);\n }\n /**\n * Handle the DOM events for the widget.\n *\n * @param event - The DOM event sent to the widget.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the dock panel's node. It should\n * not be called directly by user code.\n */\n handleEvent(event) {\n if (this._resolved) {\n // Do not handle any more key events if the promise was resolved.\n event.preventDefault();\n return;\n }\n const input = this._input;\n if (event.type === 'keydown') {\n if (event.key === 'Enter') {\n this.resetSearch();\n this._future.sendInputReply({\n status: 'ok',\n value: input.value\n }, this._parentHeader);\n if (this._password) {\n this._value += '········';\n }\n else {\n this._value += input.value;\n Stdin._historyPush(this._historyKey, input.value);\n }\n this._resolved = true;\n this._promise.resolve(void 0);\n }\n else if (event.key === 'Escape') {\n // currently this gets clobbered by the documentsearch:end command at the notebook level\n this.resetSearch();\n input.blur();\n }\n else if (event.ctrlKey &&\n (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {\n // if _historyPat is blank, use input as search pattern. Otherwise, reuse the current search pattern\n if (this._historyPat === '') {\n this._historyPat = input.value;\n }\n const reverse = event.key === 'ArrowUp';\n const searchHistoryIx = Stdin._historySearch(this._historyKey, this._historyPat, this._historyIndex, reverse);\n if (searchHistoryIx !== undefined) {\n const historyLine = Stdin._historyAt(this._historyKey, searchHistoryIx);\n if (historyLine !== undefined) {\n if (this._historyIndex === 0) {\n this._valueCache = input.value;\n }\n this._setInputValue(historyLine);\n this._historyIndex = searchHistoryIx;\n // The default action for ArrowUp is moving to first character\n // but we want to keep the cursor at the end.\n event.preventDefault();\n }\n }\n }\n else if (event.key === 'ArrowUp') {\n this.resetSearch();\n const historyLine = Stdin._historyAt(this._historyKey, this._historyIndex - 1);\n if (historyLine) {\n if (this._historyIndex === 0) {\n this._valueCache = input.value;\n }\n this._setInputValue(historyLine);\n --this._historyIndex;\n // The default action for ArrowUp is moving to first character\n // but we want to keep the cursor at the end.\n event.preventDefault();\n }\n }\n else if (event.key === 'ArrowDown') {\n this.resetSearch();\n if (this._historyIndex === 0) {\n // do nothing\n }\n else if (this._historyIndex === -1) {\n this._setInputValue(this._valueCache);\n ++this._historyIndex;\n }\n else {\n const historyLine = Stdin._historyAt(this._historyKey, this._historyIndex + 1);\n if (historyLine) {\n this._setInputValue(historyLine);\n ++this._historyIndex;\n }\n }\n }\n }\n }\n resetSearch() {\n this._historyPat = '';\n }\n /**\n * Handle `after-attach` messages sent to the widget.\n */\n onAfterAttach(msg) {\n this._input.addEventListener('keydown', this);\n this._input.focus();\n }\n /**\n * Handle `before-detach` messages sent to the widget.\n */\n onBeforeDetach(msg) {\n this._input.removeEventListener('keydown', this);\n }\n _setInputValue(value) {\n this._input.value = value;\n // Set cursor at the end; this is usually not necessary when input is\n // focused but having the explicit placement ensures consistency.\n this._input.setSelectionRange(value.length, value.length);\n }\n}\nStdin._history = new Map();\n/** ****************************************************************************\n * Private namespace\n ******************************************************************************/\n/**\n * A namespace for private data.\n */\nvar Private;\n(function (Private) {\n /**\n * Create the node for an InputWidget.\n */\n function createInputWidgetNode(prompt, password) {\n const node = document.createElement('div');\n const promptNode = document.createElement('pre');\n promptNode.className = STDIN_PROMPT_CLASS;\n promptNode.textContent = prompt;\n const input = document.createElement('input');\n input.className = STDIN_INPUT_CLASS;\n if (password) {\n input.type = 'password';\n }\n node.appendChild(promptNode);\n promptNode.appendChild(input);\n return node;\n }\n Private.createInputWidgetNode = createInputWidgetNode;\n /**\n * A renderer for IFrame data.\n */\n class IsolatedRenderer extends Widget {\n /**\n * Create an isolated renderer.\n */\n constructor(wrapped) {\n super({ node: document.createElement('iframe') });\n this.addClass('jp-mod-isolated');\n this._wrapped = wrapped;\n // Once the iframe is loaded, the subarea is dynamically inserted\n const iframe = this.node;\n iframe.frameBorder = '0';\n iframe.scrolling = 'auto';\n iframe.addEventListener('load', () => {\n // Workaround needed by Firefox, to properly render svg inside\n // iframes, see https://stackoverflow.com/questions/10177190/\n // svg-dynamically-added-to-iframe-does-not-render-correctly\n iframe.contentDocument.open();\n // Insert the subarea into the iframe\n // We must directly write the html. At this point, subarea doesn't\n // contain any user content.\n iframe.contentDocument.write(this._wrapped.node.innerHTML);\n iframe.contentDocument.close();\n const body = iframe.contentDocument.body;\n // Adjust the iframe height automatically\n iframe.style.height = `${body.scrollHeight}px`;\n iframe.heightChangeObserver = new ResizeObserver(() => {\n iframe.style.height = `${body.scrollHeight}px`;\n });\n iframe.heightChangeObserver.observe(body);\n });\n }\n /**\n * Render a mime model.\n *\n * @param model - The mime model to render.\n *\n * @returns A promise which resolves when rendering is complete.\n *\n * #### Notes\n * This method may be called multiple times during the lifetime\n * of the widget to update it if and when new data is available.\n */\n renderModel(model) {\n return this._wrapped.renderModel(model);\n }\n }\n Private.IsolatedRenderer = IsolatedRenderer;\n Private.currentPreferredMimetype = new AttachedProperty({\n name: 'preferredMimetype',\n create: owner => ''\n });\n /**\n * A `Panel` that's focused by a `contextmenu` event.\n */\n class OutputPanel extends Panel {\n /**\n * Construct a new `OutputPanel` widget.\n */\n constructor(options) {\n super(options);\n }\n /**\n * A callback that focuses on the widget.\n */\n _onContext(_) {\n this.node.focus();\n }\n /**\n * Handle `after-attach` messages sent to the widget.\n */\n onAfterAttach(msg) {\n super.onAfterAttach(msg);\n this.node.addEventListener('contextmenu', this._onContext.bind(this));\n }\n /**\n * Handle `before-detach` messages sent to the widget.\n */\n onBeforeDetach(msg) {\n super.onAfterDetach(msg);\n this.node.removeEventListener('contextmenu', this._onContext.bind(this));\n }\n }\n Private.OutputPanel = OutputPanel;\n /**\n * Trimmed outputs information widget.\n */\n class TrimmedOutputs extends Widget {\n /**\n * Widget constructor\n *\n * ### Notes\n * The widget will be disposed on click after calling the callback.\n *\n * @param maxNumberOutputs Maximal number of outputs to display\n * @param _onClick Callback on click event on the widget\n */\n constructor(maxNumberOutputs, onClick) {\n const node = document.createElement('div');\n const title = `The first ${maxNumberOutputs} are displayed`;\n const msg = 'Show more outputs';\n node.insertAdjacentHTML('afterbegin', `\n
${msg}
\n
`);\n super({\n node\n });\n this._onClick = onClick;\n this.addClass('jp-TrimmedOutputs');\n this.addClass('jp-RenderedHTMLCommon');\n }\n /**\n * Handle the DOM events for widget.\n *\n * @param event - The DOM event sent to the widget.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the widget's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event) {\n if (event.type === 'click') {\n this._onClick(event);\n }\n }\n /**\n * Handle `after-attach` messages for the widget.\n */\n onAfterAttach(msg) {\n super.onAfterAttach(msg);\n this.node.addEventListener('click', this);\n }\n /**\n * A message handler invoked on a `'before-detach'`\n * message\n */\n onBeforeDetach(msg) {\n super.onBeforeDetach(msg);\n this.node.removeEventListener('click', this);\n }\n }\n Private.TrimmedOutputs = TrimmedOutputs;\n})(Private || (Private = {}));\n//# sourceMappingURL=widget.js.map","/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n// Some magic for deferring mathematical expressions to MathJax\n// by hiding them from the Markdown parser.\n// Some of the code here is adapted with permission from Davide Cervone\n// under the terms of the Apache2 license governing the MathJax project.\n// Other minor modifications are also due to StackExchange and are used with\n// permission.\nconst inline = '$'; // the inline math delimiter\n// MATHSPLIT contains the pattern for math delimiters and special symbols\n// needed for searching for math in the text input.\nconst MATHSPLIT = /(\\$\\$?|\\\\(?:begin|end)\\{[a-z]*\\*?\\}|\\\\[{}$]|[{}]|(?:\\n\\s*)+|@@\\d+@@|\\\\\\\\(?:\\(|\\)|\\[|\\]))/i;\n/**\n * Break up the text into its component parts and search\n * through them for math delimiters, braces, linebreaks, etc.\n * Math delimiters must match and braces must balance.\n * Don't allow math to pass through a double linebreak\n * (which will be a paragraph).\n */\nexport function removeMath(text) {\n const math = []; // stores math strings for later\n let start = null;\n let end = null;\n let last = null;\n let braces = 0;\n let deTilde;\n // Except for extreme edge cases, this should catch precisely those pieces of the markdown\n // source that will later be turned into code spans. While MathJax will not TeXify code spans,\n // we still have to consider them at this point; the following issue has happened several times:\n //\n // `$foo` and `$bar` are variables. --> $foo ` and `$bar are variables.\n const hasCodeSpans = text.includes('`') || text.includes('~~~');\n if (hasCodeSpans) {\n text = text\n .replace(/~/g, '~T')\n // note: the `fence` (three or more consecutive tildes or backticks)\n // can be followed by an `info string` but this cannot include backticks,\n // see specification: https://spec.commonmark.org/0.30/#info-string\n .replace(/^(?`{3,}|(~T){3,})[^`\\n]*\\n([\\s\\S]*?)^\\k`*$/gm, wholematch => wholematch.replace(/\\$/g, '~D'))\n .replace(/(^|[^\\\\])(`+)([^\\n]*?[^`\\n])\\2(?!`)/gm, wholematch => wholematch.replace(/\\$/g, '~D'));\n deTilde = (text) => {\n return text.replace(/~([TD])/g, (wholematch, character) => character === 'T' ? '~' : inline);\n };\n }\n else {\n deTilde = (text) => {\n return text;\n };\n }\n let blocks = text.replace(/\\r\\n?/g, '\\n').split(MATHSPLIT);\n for (let i = 1, m = blocks.length; i < m; i += 2) {\n const block = blocks[i];\n if (block.charAt(0) === '@') {\n //\n // Things that look like our math markers will get\n // stored and then retrieved along with the math.\n //\n blocks[i] = '@@' + math.length + '@@';\n math.push(block);\n }\n else if (start !== null) {\n //\n // If we are in math, look for the end delimiter,\n // but don't go past double line breaks, and\n // and balance braces within the math.\n //\n if (block === end) {\n if (braces) {\n last = i;\n }\n else {\n blocks = processMath(start, i, deTilde, math, blocks);\n start = null;\n end = null;\n last = null;\n }\n }\n else if (block.match(/\\n.*\\n/)) {\n if (last !== null) {\n i = last;\n blocks = processMath(start, i, deTilde, math, blocks);\n }\n start = null;\n end = null;\n last = null;\n braces = 0;\n }\n else if (block === '{') {\n braces++;\n }\n else if (block === '}' && braces) {\n braces--;\n }\n }\n else {\n //\n // Look for math start delimiters and when\n // found, set up the end delimiter.\n //\n if (block === inline || block === '$$') {\n start = i;\n end = block;\n braces = 0;\n }\n else if (block === '\\\\\\\\(' || block === '\\\\\\\\[') {\n start = i;\n end = block.slice(-1) === '(' ? '\\\\\\\\)' : '\\\\\\\\]';\n braces = 0;\n }\n else if (block.substr(1, 5) === 'begin') {\n start = i;\n end = '\\\\end' + block.substr(6);\n braces = 0;\n }\n }\n }\n if (start !== null && last !== null) {\n blocks = processMath(start, last, deTilde, math, blocks);\n start = null;\n end = null;\n last = null;\n }\n return { text: deTilde(blocks.join('')), math };\n}\n/**\n * Put back the math strings that were saved,\n * and clear the math array (no need to keep it around).\n */\nexport function replaceMath(text, math) {\n /**\n * Replace a math placeholder with its corresponding group.\n * The math delimiters \"\\\\(\", \"\\\\[\", \"\\\\)\" and \"\\\\]\" are replaced\n * removing one backslash in order to be interpreted correctly by MathJax.\n */\n const process = (match, n) => {\n let group = math[n];\n if (group.substr(0, 3) === '\\\\\\\\(' &&\n group.substr(group.length - 3) === '\\\\\\\\)') {\n group = '\\\\(' + group.substring(3, group.length - 3) + '\\\\)';\n }\n else if (group.substr(0, 3) === '\\\\\\\\[' &&\n group.substr(group.length - 3) === '\\\\\\\\]') {\n group = '\\\\[' + group.substring(3, group.length - 3) + '\\\\]';\n }\n return group;\n };\n // Replace all the math group placeholders in the text\n // with the saved strings.\n return text.replace(/@@(\\d+)@@/g, process);\n}\n/**\n * Process math blocks.\n *\n * The math is in blocks i through j, so\n * collect it into one block and clear the others.\n * Replace &, <, and > by named entities.\n * For IE, put
at the ends of comments since IE removes \\n.\n * Clear the current math positions and store the index of the\n * math, then push the math string onto the storage array.\n * The preProcess function is called on all blocks if it has been passed in\n */\nfunction processMath(i, j, preProcess, math, blocks) {\n let block = blocks\n .slice(i, j + 1)\n .join('')\n .replace(/&/g, '&') // use HTML entity for &\n .replace(//g, '>'); // use HTML entity for >\n if (navigator && navigator.appName === 'Microsoft Internet Explorer') {\n block = block.replace(/(%[^\\n]*)\\n/g, '$1
\\n');\n }\n while (j > i) {\n blocks[j] = '';\n j--;\n }\n blocks[i] = '@@' + math.length + '@@'; // replace the current block text with a unique tag to find later\n if (preProcess) {\n block = preProcess(block);\n }\n math.push(block);\n return blocks;\n}\n//# sourceMappingURL=latex.js.map","/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\nimport { URLExt } from '@jupyterlab/coreutils';\nimport { nullTranslator } from '@jupyterlab/translation';\nimport escape from 'lodash.escape';\nimport { removeMath, replaceMath } from './latex';\n/**\n * Render HTML into a host node.\n *\n * @param options - The options for rendering.\n *\n * @returns A promise which resolves when rendering is complete.\n */\nexport function renderHTML(options) {\n // Unpack the options.\n let { host, source, trusted, sanitizer, resolver, linkHandler, shouldTypeset, latexTypesetter, translator } = options;\n translator = translator || nullTranslator;\n const trans = translator === null || translator === void 0 ? void 0 : translator.load('jupyterlab');\n let originalSource = source;\n // Bail early if the source is empty.\n if (!source) {\n host.textContent = '';\n return Promise.resolve(undefined);\n }\n // Sanitize the source if it is not trusted. This removes all\n // ``.\n this.sequenceIndex = Number(c === CharCodes.Lt);\n }\n };\n Tokenizer.prototype.stateCDATASequence = function (c) {\n if (c === Sequences.Cdata[this.sequenceIndex]) {\n if (++this.sequenceIndex === Sequences.Cdata.length) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CdataEnd;\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n }\n }\n else {\n this.sequenceIndex = 0;\n this.state = State.InDeclaration;\n this.stateInDeclaration(c); // Reconsume the character\n }\n };\n /**\n * When we wait for one specific character, we can speed things up\n * by skipping through the buffer until we find it.\n *\n * @returns Whether the character was found.\n */\n Tokenizer.prototype.fastForwardTo = function (c) {\n while (++this.index < this.buffer.length + this.offset) {\n if (this.buffer.charCodeAt(this.index - this.offset) === c) {\n return true;\n }\n }\n /*\n * We increment the index at the end of the `parse` loop,\n * so set it to `buffer.length - 1` here.\n *\n * TODO: Refactor `parse` to increment index before calling states.\n */\n this.index = this.buffer.length + this.offset - 1;\n return false;\n };\n /**\n * Comments and CDATA end with `-->` and `]]>`.\n *\n * Their common qualities are:\n * - Their end sequences have a distinct character they start with.\n * - That character is then repeated, so we have to check multiple repeats.\n * - All characters but the start character of the sequence can be skipped.\n */\n Tokenizer.prototype.stateInCommentLike = function (c) {\n if (c === this.currentSequence[this.sequenceIndex]) {\n if (++this.sequenceIndex === this.currentSequence.length) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, this.index, 2);\n }\n else {\n this.cbs.oncomment(this.sectionStart, this.index, 2);\n }\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n this.state = State.Text;\n }\n }\n else if (this.sequenceIndex === 0) {\n // Fast-forward to the first character of the sequence\n if (this.fastForwardTo(this.currentSequence[0])) {\n this.sequenceIndex = 1;\n }\n }\n else if (c !== this.currentSequence[this.sequenceIndex - 1]) {\n // Allow long sequences, eg. --->, ]]]>\n this.sequenceIndex = 0;\n }\n };\n /**\n * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.\n *\n * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).\n * We allow anything that wouldn't end the tag.\n */\n Tokenizer.prototype.isTagStartChar = function (c) {\n return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);\n };\n Tokenizer.prototype.startSpecial = function (sequence, offset) {\n this.isSpecial = true;\n this.currentSequence = sequence;\n this.sequenceIndex = offset;\n this.state = State.SpecialStartSequence;\n };\n Tokenizer.prototype.stateBeforeTagName = function (c) {\n if (c === CharCodes.ExclamationMark) {\n this.state = State.BeforeDeclaration;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Questionmark) {\n this.state = State.InProcessingInstruction;\n this.sectionStart = this.index + 1;\n }\n else if (this.isTagStartChar(c)) {\n var lower = c | 0x20;\n this.sectionStart = this.index;\n if (!this.xmlMode && lower === Sequences.TitleEnd[2]) {\n this.startSpecial(Sequences.TitleEnd, 3);\n }\n else {\n this.state =\n !this.xmlMode && lower === Sequences.ScriptEnd[2]\n ? State.BeforeSpecialS\n : State.InTagName;\n }\n }\n else if (c === CharCodes.Slash) {\n this.state = State.BeforeClosingTagName;\n }\n else {\n this.state = State.Text;\n this.stateText(c);\n }\n };\n Tokenizer.prototype.stateInTagName = function (c) {\n if (isEndOfTagSection(c)) {\n this.cbs.onopentagname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n };\n Tokenizer.prototype.stateBeforeClosingTagName = function (c) {\n if (isWhitespace(c)) {\n // Ignore\n }\n else if (c === CharCodes.Gt) {\n this.state = State.Text;\n }\n else {\n this.state = this.isTagStartChar(c)\n ? State.InClosingTagName\n : State.InSpecialComment;\n this.sectionStart = this.index;\n }\n };\n Tokenizer.prototype.stateInClosingTagName = function (c) {\n if (c === CharCodes.Gt || isWhitespace(c)) {\n this.cbs.onclosetag(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterClosingTagName;\n this.stateAfterClosingTagName(c);\n }\n };\n Tokenizer.prototype.stateAfterClosingTagName = function (c) {\n // Skip everything until \">\"\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.state = State.Text;\n this.baseState = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeAttributeName = function (c) {\n if (c === CharCodes.Gt) {\n this.cbs.onopentagend(this.index);\n if (this.isSpecial) {\n this.state = State.InSpecialTag;\n this.sequenceIndex = 0;\n }\n else {\n this.state = State.Text;\n }\n this.baseState = this.state;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Slash) {\n this.state = State.InSelfClosingTag;\n }\n else if (!isWhitespace(c)) {\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n };\n Tokenizer.prototype.stateInSelfClosingTag = function (c) {\n if (c === CharCodes.Gt) {\n this.cbs.onselfclosingtag(this.index);\n this.state = State.Text;\n this.baseState = State.Text;\n this.sectionStart = this.index + 1;\n this.isSpecial = false; // Reset special state, in case of self-closing special tags\n }\n else if (!isWhitespace(c)) {\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n };\n Tokenizer.prototype.stateInAttributeName = function (c) {\n if (c === CharCodes.Eq || isEndOfTagSection(c)) {\n this.cbs.onattribname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterAttributeName;\n this.stateAfterAttributeName(c);\n }\n };\n Tokenizer.prototype.stateAfterAttributeName = function (c) {\n if (c === CharCodes.Eq) {\n this.state = State.BeforeAttributeValue;\n }\n else if (c === CharCodes.Slash || c === CharCodes.Gt) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (!isWhitespace(c)) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n };\n Tokenizer.prototype.stateBeforeAttributeValue = function (c) {\n if (c === CharCodes.DoubleQuote) {\n this.state = State.InAttributeValueDq;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.SingleQuote) {\n this.state = State.InAttributeValueSq;\n this.sectionStart = this.index + 1;\n }\n else if (!isWhitespace(c)) {\n this.sectionStart = this.index;\n this.state = State.InAttributeValueNq;\n this.stateInAttributeValueNoQuotes(c); // Reconsume token\n }\n };\n Tokenizer.prototype.handleInAttributeValue = function (c, quote) {\n if (c === quote ||\n (!this.decodeEntities && this.fastForwardTo(quote))) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(quote === CharCodes.DoubleQuote\n ? QuoteType.Double\n : QuoteType.Single, this.index);\n this.state = State.BeforeAttributeName;\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n };\n Tokenizer.prototype.stateInAttributeValueDoubleQuotes = function (c) {\n this.handleInAttributeValue(c, CharCodes.DoubleQuote);\n };\n Tokenizer.prototype.stateInAttributeValueSingleQuotes = function (c) {\n this.handleInAttributeValue(c, CharCodes.SingleQuote);\n };\n Tokenizer.prototype.stateInAttributeValueNoQuotes = function (c) {\n if (isWhitespace(c) || c === CharCodes.Gt) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(QuoteType.Unquoted, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n };\n Tokenizer.prototype.stateBeforeDeclaration = function (c) {\n if (c === CharCodes.OpeningSquareBracket) {\n this.state = State.CDATASequence;\n this.sequenceIndex = 0;\n }\n else {\n this.state =\n c === CharCodes.Dash\n ? State.BeforeComment\n : State.InDeclaration;\n }\n };\n Tokenizer.prototype.stateInDeclaration = function (c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.ondeclaration(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateInProcessingInstruction = function (c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.onprocessinginstruction(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeComment = function (c) {\n if (c === CharCodes.Dash) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CommentEnd;\n // Allow short comments (eg. )\n this.sequenceIndex = 2;\n this.sectionStart = this.index + 1;\n }\n else {\n this.state = State.InDeclaration;\n }\n };\n Tokenizer.prototype.stateInSpecialComment = function (c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.oncomment(this.sectionStart, this.index, 0);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeSpecialS = function (c) {\n var lower = c | 0x20;\n if (lower === Sequences.ScriptEnd[3]) {\n this.startSpecial(Sequences.ScriptEnd, 4);\n }\n else if (lower === Sequences.StyleEnd[3]) {\n this.startSpecial(Sequences.StyleEnd, 4);\n }\n else {\n this.state = State.InTagName;\n this.stateInTagName(c); // Consume the token again\n }\n };\n Tokenizer.prototype.stateBeforeEntity = function (c) {\n // Start excess with 1 to include the '&'\n this.entityExcess = 1;\n this.entityResult = 0;\n if (c === CharCodes.Number) {\n this.state = State.BeforeNumericEntity;\n }\n else if (c === CharCodes.Amp) {\n // We have two `&` characters in a row. Stay in the current state.\n }\n else {\n this.trieIndex = 0;\n this.trieCurrent = this.entityTrie[0];\n this.state = State.InNamedEntity;\n this.stateInNamedEntity(c);\n }\n };\n Tokenizer.prototype.stateInNamedEntity = function (c) {\n this.entityExcess += 1;\n this.trieIndex = (0, decode_js_1.determineBranch)(this.entityTrie, this.trieCurrent, this.trieIndex + 1, c);\n if (this.trieIndex < 0) {\n this.emitNamedEntity();\n this.index--;\n return;\n }\n this.trieCurrent = this.entityTrie[this.trieIndex];\n var masked = this.trieCurrent & decode_js_1.BinTrieFlags.VALUE_LENGTH;\n // If the branch is a value, store it and continue\n if (masked) {\n // The mask is the number of bytes of the value, including the current byte.\n var valueLength = (masked >> 14) - 1;\n // If we have a legacy entity while parsing strictly, just skip the number of bytes\n if (!this.allowLegacyEntity() && c !== CharCodes.Semi) {\n this.trieIndex += valueLength;\n }\n else {\n // Add 1 as we have already incremented the excess\n var entityStart = this.index - this.entityExcess + 1;\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n // If this is a surrogate pair, consume the next two bytes\n this.entityResult = this.trieIndex;\n this.trieIndex += valueLength;\n this.entityExcess = 0;\n this.sectionStart = this.index + 1;\n if (valueLength === 0) {\n this.emitNamedEntity();\n }\n }\n }\n };\n Tokenizer.prototype.emitNamedEntity = function () {\n this.state = this.baseState;\n if (this.entityResult === 0) {\n return;\n }\n var valueLength = (this.entityTrie[this.entityResult] & decode_js_1.BinTrieFlags.VALUE_LENGTH) >>\n 14;\n switch (valueLength) {\n case 1: {\n this.emitCodePoint(this.entityTrie[this.entityResult] &\n ~decode_js_1.BinTrieFlags.VALUE_LENGTH);\n break;\n }\n case 2: {\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n break;\n }\n case 3: {\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n this.emitCodePoint(this.entityTrie[this.entityResult + 2]);\n }\n }\n };\n Tokenizer.prototype.stateBeforeNumericEntity = function (c) {\n if ((c | 0x20) === CharCodes.LowerX) {\n this.entityExcess++;\n this.state = State.InHexEntity;\n }\n else {\n this.state = State.InNumericEntity;\n this.stateInNumericEntity(c);\n }\n };\n Tokenizer.prototype.emitNumericEntity = function (strict) {\n var entityStart = this.index - this.entityExcess - 1;\n var numberStart = entityStart + 2 + Number(this.state === State.InHexEntity);\n if (numberStart !== this.index) {\n // Emit leading data if any\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n this.sectionStart = this.index + Number(strict);\n this.emitCodePoint((0, decode_js_1.replaceCodePoint)(this.entityResult));\n }\n this.state = this.baseState;\n };\n Tokenizer.prototype.stateInNumericEntity = function (c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 10 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n };\n Tokenizer.prototype.stateInHexEntity = function (c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 16 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else if (isHexDigit(c)) {\n this.entityResult =\n this.entityResult * 16 + ((c | 0x20) - CharCodes.LowerA + 10);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n };\n Tokenizer.prototype.allowLegacyEntity = function () {\n return (!this.xmlMode &&\n (this.baseState === State.Text ||\n this.baseState === State.InSpecialTag));\n };\n /**\n * Remove data that has already been consumed from the buffer.\n */\n Tokenizer.prototype.cleanup = function () {\n // If we are inside of text or attributes, emit what we already have.\n if (this.running && this.sectionStart !== this.index) {\n if (this.state === State.Text ||\n (this.state === State.InSpecialTag && this.sequenceIndex === 0)) {\n this.cbs.ontext(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n else if (this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueNq) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n }\n };\n Tokenizer.prototype.shouldContinue = function () {\n return this.index < this.buffer.length + this.offset && this.running;\n };\n /**\n * Iterates through the buffer, calling the function corresponding to the current state.\n *\n * States that are more likely to be hit are higher up, as a performance improvement.\n */\n Tokenizer.prototype.parse = function () {\n while (this.shouldContinue()) {\n var c = this.buffer.charCodeAt(this.index - this.offset);\n switch (this.state) {\n case State.Text: {\n this.stateText(c);\n break;\n }\n case State.SpecialStartSequence: {\n this.stateSpecialStartSequence(c);\n break;\n }\n case State.InSpecialTag: {\n this.stateInSpecialTag(c);\n break;\n }\n case State.CDATASequence: {\n this.stateCDATASequence(c);\n break;\n }\n case State.InAttributeValueDq: {\n this.stateInAttributeValueDoubleQuotes(c);\n break;\n }\n case State.InAttributeName: {\n this.stateInAttributeName(c);\n break;\n }\n case State.InCommentLike: {\n this.stateInCommentLike(c);\n break;\n }\n case State.InSpecialComment: {\n this.stateInSpecialComment(c);\n break;\n }\n case State.BeforeAttributeName: {\n this.stateBeforeAttributeName(c);\n break;\n }\n case State.InTagName: {\n this.stateInTagName(c);\n break;\n }\n case State.InClosingTagName: {\n this.stateInClosingTagName(c);\n break;\n }\n case State.BeforeTagName: {\n this.stateBeforeTagName(c);\n break;\n }\n case State.AfterAttributeName: {\n this.stateAfterAttributeName(c);\n break;\n }\n case State.InAttributeValueSq: {\n this.stateInAttributeValueSingleQuotes(c);\n break;\n }\n case State.BeforeAttributeValue: {\n this.stateBeforeAttributeValue(c);\n break;\n }\n case State.BeforeClosingTagName: {\n this.stateBeforeClosingTagName(c);\n break;\n }\n case State.AfterClosingTagName: {\n this.stateAfterClosingTagName(c);\n break;\n }\n case State.BeforeSpecialS: {\n this.stateBeforeSpecialS(c);\n break;\n }\n case State.InAttributeValueNq: {\n this.stateInAttributeValueNoQuotes(c);\n break;\n }\n case State.InSelfClosingTag: {\n this.stateInSelfClosingTag(c);\n break;\n }\n case State.InDeclaration: {\n this.stateInDeclaration(c);\n break;\n }\n case State.BeforeDeclaration: {\n this.stateBeforeDeclaration(c);\n break;\n }\n case State.BeforeComment: {\n this.stateBeforeComment(c);\n break;\n }\n case State.InProcessingInstruction: {\n this.stateInProcessingInstruction(c);\n break;\n }\n case State.InNamedEntity: {\n this.stateInNamedEntity(c);\n break;\n }\n case State.BeforeEntity: {\n this.stateBeforeEntity(c);\n break;\n }\n case State.InHexEntity: {\n this.stateInHexEntity(c);\n break;\n }\n case State.InNumericEntity: {\n this.stateInNumericEntity(c);\n break;\n }\n default: {\n // `this._state === State.BeforeNumericEntity`\n this.stateBeforeNumericEntity(c);\n }\n }\n this.index++;\n }\n this.cleanup();\n };\n Tokenizer.prototype.finish = function () {\n if (this.state === State.InNamedEntity) {\n this.emitNamedEntity();\n }\n // If there is remaining data, emit it in a reasonable way\n if (this.sectionStart < this.index) {\n this.handleTrailingData();\n }\n this.cbs.onend();\n };\n /** Handle any trailing data. */\n Tokenizer.prototype.handleTrailingData = function () {\n var endIndex = this.buffer.length + this.offset;\n if (this.state === State.InCommentLike) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, endIndex, 0);\n }\n else {\n this.cbs.oncomment(this.sectionStart, endIndex, 0);\n }\n }\n else if (this.state === State.InNumericEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InHexEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InTagName ||\n this.state === State.BeforeAttributeName ||\n this.state === State.BeforeAttributeValue ||\n this.state === State.AfterAttributeName ||\n this.state === State.InAttributeName ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueNq ||\n this.state === State.InClosingTagName) {\n /*\n * If we are currently in an opening or closing tag, us not calling the\n * respective callback signals that the tag should be ignored.\n */\n }\n else {\n this.cbs.ontext(this.sectionStart, endIndex);\n }\n };\n Tokenizer.prototype.emitPartial = function (start, endIndex) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribdata(start, endIndex);\n }\n else {\n this.cbs.ontext(start, endIndex);\n }\n };\n Tokenizer.prototype.emitCodePoint = function (cp) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribentity(cp);\n }\n else {\n this.cbs.ontextentity(cp);\n }\n };\n return Tokenizer;\n}());\nexports.default = Tokenizer;\n//# sourceMappingURL=Tokenizer.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DomUtils = exports.parseFeed = exports.getFeed = exports.ElementType = exports.Tokenizer = exports.createDomStream = exports.parseDOM = exports.parseDocument = exports.DefaultHandler = exports.DomHandler = exports.Parser = void 0;\nvar Parser_js_1 = require(\"./Parser.js\");\nvar Parser_js_2 = require(\"./Parser.js\");\nObject.defineProperty(exports, \"Parser\", { enumerable: true, get: function () { return Parser_js_2.Parser; } });\nvar domhandler_1 = require(\"domhandler\");\nvar domhandler_2 = require(\"domhandler\");\nObject.defineProperty(exports, \"DomHandler\", { enumerable: true, get: function () { return domhandler_2.DomHandler; } });\n// Old name for DomHandler\nObject.defineProperty(exports, \"DefaultHandler\", { enumerable: true, get: function () { return domhandler_2.DomHandler; } });\n// Helper methods\n/**\n * Parses the data, returns the resulting document.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n */\nfunction parseDocument(data, options) {\n var handler = new domhandler_1.DomHandler(undefined, options);\n new Parser_js_1.Parser(handler, options).end(data);\n return handler.root;\n}\nexports.parseDocument = parseDocument;\n/**\n * Parses data, returns an array of the root nodes.\n *\n * Note that the root nodes still have a `Document` node as their parent.\n * Use `parseDocument` to get the `Document` node instead.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n * @deprecated Use `parseDocument` instead.\n */\nfunction parseDOM(data, options) {\n return parseDocument(data, options).children;\n}\nexports.parseDOM = parseDOM;\n/**\n * Creates a parser instance, with an attached DOM handler.\n *\n * @param callback A callback that will be called once parsing has been completed.\n * @param options Optional options for the parser and DOM builder.\n * @param elementCallback An optional callback that will be called every time a tag has been completed inside of the DOM.\n */\nfunction createDomStream(callback, options, elementCallback) {\n var handler = new domhandler_1.DomHandler(callback, options, elementCallback);\n return new Parser_js_1.Parser(handler, options);\n}\nexports.createDomStream = createDomStream;\nvar Tokenizer_js_1 = require(\"./Tokenizer.js\");\nObject.defineProperty(exports, \"Tokenizer\", { enumerable: true, get: function () { return __importDefault(Tokenizer_js_1).default; } });\n/*\n * All of the following exports exist for backwards-compatibility.\n * They should probably be removed eventually.\n */\nexports.ElementType = __importStar(require(\"domelementtype\"));\nvar domutils_1 = require(\"domutils\");\nvar domutils_2 = require(\"domutils\");\nObject.defineProperty(exports, \"getFeed\", { enumerable: true, get: function () { return domutils_2.getFeed; } });\nvar parseFeedDefaultOptions = { xmlMode: true };\n/**\n * Parse a feed.\n *\n * @param feed The feed that should be parsed, as a string.\n * @param options Optionally, options for parsing. When using this, you should set `xmlMode` to `true`.\n */\nfunction parseFeed(feed, options) {\n if (options === void 0) { options = parseFeedDefaultOptions; }\n return (0, domutils_1.getFeed)(parseDOM(feed, options));\n}\nexports.parseFeed = parseFeed;\nexports.DomUtils = __importStar(require(\"domutils\"));\n//# sourceMappingURL=index.js.map","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n/*!\n * is-plain-object \n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isPlainObject(o) {\n var ctor,prot;\n\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n\nexports.isPlainObject = isPlainObject;\n","const ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n","// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.format()\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range\n .trim()\n .split(/\\s+/)\n .join(' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.format()\n }\n\n format () {\n this.range = this.set\n .map((comps) => comps.join(' ').trim())\n .join('||')\n .trim()\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0 <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n }${z} <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n }${z} <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n","const debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n return (\n compareIdentifiers(this.major, other.major) ||\n compareIdentifiers(this.minor, other.minor) ||\n compareIdentifiers(this.patch, other.patch)\n )\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (compareIdentifiers(this.prerelease[0], identifier) === 0) {\n if (isNaN(this.prerelease[1])) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","const parse = require('./parse')\nconst clean = (version, options) => {\n const s = parse(version.trim().replace(/^[=v]+/, ''), options)\n return s ? s.version : null\n}\nmodule.exports = clean\n","const eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n","const SemVer = require('../classes/semver')\nconst parse = require('./parse')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst coerce = (version, options) => {\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version === 'number') {\n version = String(version)\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n options = options || {}\n\n let match = null\n if (!options.rtl) {\n match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])\n } else {\n // Find the right-most coercible string that does not share\n // a terminus with a more left-ward coercible string.\n // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'\n // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'\n //\n // Walk through the string checking with a /g regexp\n // Manually set the index so as to pick up overlapping matches.\n // Stop when we get a match that ends at the string end, since no\n // coercible string can be more right-ward without the same terminus.\n const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]\n let next\n while ((next = coerceRtlRegex.exec(version)) &&\n (!match || match.index + match[0].length !== version.length)\n ) {\n if (!match ||\n next.index + next[0].length !== match.index + match[0].length) {\n match = next\n }\n coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length\n }\n // leave it in a clean state\n coerceRtlRegex.lastIndex = -1\n }\n\n if (match === null) {\n return null\n }\n\n const major = match[2]\n const minor = match[3] || '0'\n const patch = match[4] || '0'\n const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''\n const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''\n\n return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)\n}\nmodule.exports = coerce\n","const SemVer = require('../classes/semver')\nconst compareBuild = (a, b, loose) => {\n const versionA = new SemVer(a, loose)\n const versionB = new SemVer(b, loose)\n return versionA.compare(versionB) || versionA.compareBuild(versionB)\n}\nmodule.exports = compareBuild\n","const compare = require('./compare')\nconst compareLoose = (a, b) => compare(a, b, true)\nmodule.exports = compareLoose\n","const SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n","const parse = require('./parse.js')\n\nconst diff = (version1, version2) => {\n const v1 = parse(version1, null, true)\n const v2 = parse(version2, null, true)\n const comparison = v1.compare(v2)\n\n if (comparison === 0) {\n return null\n }\n\n const v1Higher = comparison > 0\n const highVersion = v1Higher ? v1 : v2\n const lowVersion = v1Higher ? v2 : v1\n const highHasPre = !!highVersion.prerelease.length\n const lowHasPre = !!lowVersion.prerelease.length\n\n if (lowHasPre && !highHasPre) {\n // Going from prerelease -> no prerelease requires some special casing\n\n // If the low version has only a major, then it will always be a major\n // Some examples:\n // 1.0.0-1 -> 1.0.0\n // 1.0.0-1 -> 1.1.1\n // 1.0.0-1 -> 2.0.0\n if (!lowVersion.patch && !lowVersion.minor) {\n return 'major'\n }\n\n // Otherwise it can be determined by checking the high version\n\n if (highVersion.patch) {\n // anything higher than a patch bump would result in the wrong version\n return 'patch'\n }\n\n if (highVersion.minor) {\n // anything higher than a minor bump would result in the wrong version\n return 'minor'\n }\n\n // bumping major/minor/patch all have same result\n return 'major'\n }\n\n // add the `pre` prefix if we are going to a prerelease version\n const prefix = highHasPre ? 'pre' : ''\n\n if (v1.major !== v2.major) {\n return prefix + 'major'\n }\n\n if (v1.minor !== v2.minor) {\n return prefix + 'minor'\n }\n\n if (v1.patch !== v2.patch) {\n return prefix + 'patch'\n }\n\n // high and low are preleases\n return 'prerelease'\n}\n\nmodule.exports = diff\n","const compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n","const compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n","const compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n","const SemVer = require('../classes/semver')\n\nconst inc = (version, release, options, identifier, identifierBase) => {\n if (typeof (options) === 'string') {\n identifierBase = identifier\n identifier = options\n options = undefined\n }\n\n try {\n return new SemVer(\n version instanceof SemVer ? version.version : version,\n options\n ).inc(release, identifier, identifierBase).version\n } catch (er) {\n return null\n }\n}\nmodule.exports = inc\n","const compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n","const compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n","const SemVer = require('../classes/semver')\nconst major = (a, loose) => new SemVer(a, loose).major\nmodule.exports = major\n","const SemVer = require('../classes/semver')\nconst minor = (a, loose) => new SemVer(a, loose).minor\nmodule.exports = minor\n","const compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n","const SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n if (version instanceof SemVer) {\n return version\n }\n try {\n return new SemVer(version, options)\n } catch (er) {\n if (!throwErrors) {\n return null\n }\n throw er\n }\n}\n\nmodule.exports = parse\n","const SemVer = require('../classes/semver')\nconst patch = (a, loose) => new SemVer(a, loose).patch\nmodule.exports = patch\n","const parse = require('./parse')\nconst prerelease = (version, options) => {\n const parsed = parse(version, options)\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n}\nmodule.exports = prerelease\n","const compare = require('./compare')\nconst rcompare = (a, b, loose) => compare(b, a, loose)\nmodule.exports = rcompare\n","const compareBuild = require('./compare-build')\nconst rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))\nmodule.exports = rsort\n","const Range = require('../classes/range')\nconst satisfies = (version, range, options) => {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\nmodule.exports = satisfies\n","const compareBuild = require('./compare-build')\nconst sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))\nmodule.exports = sort\n","const parse = require('./parse')\nconst valid = (version, options) => {\n const v = parse(version, options)\n return v ? v.version : null\n}\nmodule.exports = valid\n","// just pre-load all the stuff that index.js lazily exports\nconst internalRe = require('./internal/re')\nconst constants = require('./internal/constants')\nconst SemVer = require('./classes/semver')\nconst identifiers = require('./internal/identifiers')\nconst parse = require('./functions/parse')\nconst valid = require('./functions/valid')\nconst clean = require('./functions/clean')\nconst inc = require('./functions/inc')\nconst diff = require('./functions/diff')\nconst major = require('./functions/major')\nconst minor = require('./functions/minor')\nconst patch = require('./functions/patch')\nconst prerelease = require('./functions/prerelease')\nconst compare = require('./functions/compare')\nconst rcompare = require('./functions/rcompare')\nconst compareLoose = require('./functions/compare-loose')\nconst compareBuild = require('./functions/compare-build')\nconst sort = require('./functions/sort')\nconst rsort = require('./functions/rsort')\nconst gt = require('./functions/gt')\nconst lt = require('./functions/lt')\nconst eq = require('./functions/eq')\nconst neq = require('./functions/neq')\nconst gte = require('./functions/gte')\nconst lte = require('./functions/lte')\nconst cmp = require('./functions/cmp')\nconst coerce = require('./functions/coerce')\nconst Comparator = require('./classes/comparator')\nconst Range = require('./classes/range')\nconst satisfies = require('./functions/satisfies')\nconst toComparators = require('./ranges/to-comparators')\nconst maxSatisfying = require('./ranges/max-satisfying')\nconst minSatisfying = require('./ranges/min-satisfying')\nconst minVersion = require('./ranges/min-version')\nconst validRange = require('./ranges/valid')\nconst outside = require('./ranges/outside')\nconst gtr = require('./ranges/gtr')\nconst ltr = require('./ranges/ltr')\nconst intersects = require('./ranges/intersects')\nconst simplifyRange = require('./ranges/simplify')\nconst subset = require('./ranges/subset')\nmodule.exports = {\n parse,\n valid,\n clean,\n inc,\n diff,\n major,\n minor,\n patch,\n prerelease,\n compare,\n rcompare,\n compareLoose,\n compareBuild,\n sort,\n rsort,\n gt,\n lt,\n eq,\n neq,\n gte,\n lte,\n cmp,\n coerce,\n Comparator,\n Range,\n satisfies,\n toComparators,\n maxSatisfying,\n minSatisfying,\n minVersion,\n validRange,\n outside,\n gtr,\n ltr,\n intersects,\n simplifyRange,\n subset,\n SemVer,\n re: internalRe.re,\n src: internalRe.src,\n tokens: internalRe.t,\n SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,\n RELEASE_TYPES: constants.RELEASE_TYPES,\n compareIdentifiers: identifiers.compareIdentifiers,\n rcompareIdentifiers: identifiers.rcompareIdentifiers,\n}\n","// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","const debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","const numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","class LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n","// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","const {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]\n}|${src[t.NONNUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]\n}|${src[t.NONNUMERICIDENTIFIER]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","// Determine if version is greater than all the versions possible in the range.\nconst outside = require('./outside')\nconst gtr = (version, range, options) => outside(version, range, '>', options)\nmodule.exports = gtr\n","const Range = require('../classes/range')\nconst intersects = (r1, r2, options) => {\n r1 = new Range(r1, options)\n r2 = new Range(r2, options)\n return r1.intersects(r2, options)\n}\nmodule.exports = intersects\n","const outside = require('./outside')\n// Determine if version is less than all the versions possible in the range\nconst ltr = (version, range, options) => outside(version, range, '<', options)\nmodule.exports = ltr\n","const SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\n\nconst maxSatisfying = (versions, range, options) => {\n let max = null\n let maxSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v\n maxSV = new SemVer(max, options)\n }\n }\n })\n return max\n}\nmodule.exports = maxSatisfying\n","const SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst minSatisfying = (versions, range, options) => {\n let min = null\n let minSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v\n minSV = new SemVer(min, options)\n }\n }\n })\n return min\n}\nmodule.exports = minSatisfying\n","const SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst gt = require('../functions/gt')\n\nconst minVersion = (range, loose) => {\n range = new Range(range, loose)\n\n let minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let setMin = null\n comparators.forEach((comparator) => {\n // Clone to avoid manipulating the comparator's semver object.\n const compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!setMin || gt(compver, setMin)) {\n setMin = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error(`Unexpected operation: ${comparator.operator}`)\n }\n })\n if (setMin && (!minver || gt(minver, setMin))) {\n minver = setMin\n }\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\nmodule.exports = minVersion\n","const SemVer = require('../classes/semver')\nconst Comparator = require('../classes/comparator')\nconst { ANY } = Comparator\nconst Range = require('../classes/range')\nconst satisfies = require('../functions/satisfies')\nconst gt = require('../functions/gt')\nconst lt = require('../functions/lt')\nconst lte = require('../functions/lte')\nconst gte = require('../functions/gte')\n\nconst outside = (version, range, hilo, options) => {\n version = new SemVer(version, options)\n range = new Range(range, options)\n\n let gtfn, ltefn, ltfn, comp, ecomp\n switch (hilo) {\n case '>':\n gtfn = gt\n ltefn = lte\n ltfn = lt\n comp = '>'\n ecomp = '>='\n break\n case '<':\n gtfn = lt\n ltefn = gte\n ltfn = gt\n comp = '<'\n ecomp = '<='\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisfies the range it is not outside\n if (satisfies(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let high = null\n let low = null\n\n comparators.forEach((comparator) => {\n if (comparator.semver === ANY) {\n comparator = new Comparator('>=0.0.0')\n }\n high = high || comparator\n low = low || comparator\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator\n }\n })\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n}\n\nmodule.exports = outside\n","// given a set of versions and a range, create a \"simplified\" range\n// that includes the same versions that the original range does\n// If the original range is shorter than the simplified one, return that.\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\nmodule.exports = (versions, range, options) => {\n const set = []\n let first = null\n let prev = null\n const v = versions.sort((a, b) => compare(a, b, options))\n for (const version of v) {\n const included = satisfies(version, range, options)\n if (included) {\n prev = version\n if (!first) {\n first = version\n }\n } else {\n if (prev) {\n set.push([first, prev])\n }\n prev = null\n first = null\n }\n }\n if (first) {\n set.push([first, null])\n }\n\n const ranges = []\n for (const [min, max] of set) {\n if (min === max) {\n ranges.push(min)\n } else if (!max && min === v[0]) {\n ranges.push('*')\n } else if (!max) {\n ranges.push(`>=${min}`)\n } else if (min === v[0]) {\n ranges.push(`<=${max}`)\n } else {\n ranges.push(`${min} - ${max}`)\n }\n }\n const simplified = ranges.join(' || ')\n const original = typeof range.raw === 'string' ? range.raw : String(range)\n return simplified.length < original.length ? simplified : range\n}\n","const Range = require('../classes/range.js')\nconst Comparator = require('../classes/comparator.js')\nconst { ANY } = Comparator\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\n\n// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:\n// - Every simple range `r1, r2, ...` is a null set, OR\n// - Every simple range `r1, r2, ...` which is not a null set is a subset of\n// some `R1, R2, ...`\n//\n// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:\n// - If c is only the ANY comparator\n// - If C is only the ANY comparator, return true\n// - Else if in prerelease mode, return false\n// - else replace c with `[>=0.0.0]`\n// - If C is only the ANY comparator\n// - if in prerelease mode, return true\n// - else replace C with `[>=0.0.0]`\n// - Let EQ be the set of = comparators in c\n// - If EQ is more than one, return true (null set)\n// - Let GT be the highest > or >= comparator in c\n// - Let LT be the lowest < or <= comparator in c\n// - If GT and LT, and GT.semver > LT.semver, return true (null set)\n// - If any C is a = range, and GT or LT are set, return false\n// - If EQ\n// - If GT, and EQ does not satisfy GT, return true (null set)\n// - If LT, and EQ does not satisfy LT, return true (null set)\n// - If EQ satisfies every C, return true\n// - Else return false\n// - If GT\n// - If GT.semver is lower than any > or >= comp in C, return false\n// - If GT is >=, and GT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the GT.semver tuple, return false\n// - If LT\n// - If LT.semver is greater than any < or <= comp in C, return false\n// - If LT is <=, and LT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the LT.semver tuple, return false\n// - Else return true\n\nconst subset = (sub, dom, options = {}) => {\n if (sub === dom) {\n return true\n }\n\n sub = new Range(sub, options)\n dom = new Range(dom, options)\n let sawNonNull = false\n\n OUTER: for (const simpleSub of sub.set) {\n for (const simpleDom of dom.set) {\n const isSub = simpleSubset(simpleSub, simpleDom, options)\n sawNonNull = sawNonNull || isSub !== null\n if (isSub) {\n continue OUTER\n }\n }\n // the null set is a subset of everything, but null simple ranges in\n // a complex range should be ignored. so if we saw a non-null range,\n // then we know this isn't a subset, but if EVERY simple range was null,\n // then it is a subset.\n if (sawNonNull) {\n return false\n }\n }\n return true\n}\n\nconst minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]\nconst minimumVersion = [new Comparator('>=0.0.0')]\n\nconst simpleSubset = (sub, dom, options) => {\n if (sub === dom) {\n return true\n }\n\n if (sub.length === 1 && sub[0].semver === ANY) {\n if (dom.length === 1 && dom[0].semver === ANY) {\n return true\n } else if (options.includePrerelease) {\n sub = minimumVersionWithPreRelease\n } else {\n sub = minimumVersion\n }\n }\n\n if (dom.length === 1 && dom[0].semver === ANY) {\n if (options.includePrerelease) {\n return true\n } else {\n dom = minimumVersion\n }\n }\n\n const eqSet = new Set()\n let gt, lt\n for (const c of sub) {\n if (c.operator === '>' || c.operator === '>=') {\n gt = higherGT(gt, c, options)\n } else if (c.operator === '<' || c.operator === '<=') {\n lt = lowerLT(lt, c, options)\n } else {\n eqSet.add(c.semver)\n }\n }\n\n if (eqSet.size > 1) {\n return null\n }\n\n let gtltComp\n if (gt && lt) {\n gtltComp = compare(gt.semver, lt.semver, options)\n if (gtltComp > 0) {\n return null\n } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {\n return null\n }\n }\n\n // will iterate one or zero times\n for (const eq of eqSet) {\n if (gt && !satisfies(eq, String(gt), options)) {\n return null\n }\n\n if (lt && !satisfies(eq, String(lt), options)) {\n return null\n }\n\n for (const c of dom) {\n if (!satisfies(eq, String(c), options)) {\n return false\n }\n }\n\n return true\n }\n\n let higher, lower\n let hasDomLT, hasDomGT\n // if the subset has a prerelease, we need a comparator in the superset\n // with the same tuple and a prerelease, or it's not a subset\n let needDomLTPre = lt &&\n !options.includePrerelease &&\n lt.semver.prerelease.length ? lt.semver : false\n let needDomGTPre = gt &&\n !options.includePrerelease &&\n gt.semver.prerelease.length ? gt.semver : false\n // exception: <1.2.3-0 is the same as <1.2.3\n if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&\n lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {\n needDomLTPre = false\n }\n\n for (const c of dom) {\n hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='\n hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='\n if (gt) {\n if (needDomGTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomGTPre.major &&\n c.semver.minor === needDomGTPre.minor &&\n c.semver.patch === needDomGTPre.patch) {\n needDomGTPre = false\n }\n }\n if (c.operator === '>' || c.operator === '>=') {\n higher = higherGT(gt, c, options)\n if (higher === c && higher !== gt) {\n return false\n }\n } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {\n return false\n }\n }\n if (lt) {\n if (needDomLTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomLTPre.major &&\n c.semver.minor === needDomLTPre.minor &&\n c.semver.patch === needDomLTPre.patch) {\n needDomLTPre = false\n }\n }\n if (c.operator === '<' || c.operator === '<=') {\n lower = lowerLT(lt, c, options)\n if (lower === c && lower !== lt) {\n return false\n }\n } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {\n return false\n }\n }\n if (!c.operator && (lt || gt) && gtltComp !== 0) {\n return false\n }\n }\n\n // if there was a < or >, and nothing in the dom, then must be false\n // UNLESS it was limited by another range in the other direction.\n // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0\n if (gt && hasDomLT && !lt && gtltComp !== 0) {\n return false\n }\n\n if (lt && hasDomGT && !gt && gtltComp !== 0) {\n return false\n }\n\n // we needed a prerelease range in a specific tuple, but didn't get one\n // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,\n // because it includes prereleases in the 1.2.3 tuple\n if (needDomGTPre || needDomLTPre) {\n return false\n }\n\n return true\n}\n\n// >=1.2.3 is lower than >1.2.3\nconst higherGT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp > 0 ? a\n : comp < 0 ? b\n : b.operator === '>' && a.operator === '>=' ? b\n : a\n}\n\n// <=1.2.3 is higher than <1.2.3\nconst lowerLT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp < 0 ? a\n : comp > 0 ? b\n : b.operator === '<' && a.operator === '<=' ? b\n : a\n}\n\nmodule.exports = subset\n","const Range = require('../classes/range')\n\n// Mostly just for testing and legacy API reasons\nconst toComparators = (range, options) =>\n new Range(range, options).set\n .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))\n\nmodule.exports = toComparators\n","const Range = require('../classes/range')\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\nmodule.exports = validRange\n","import type { Config } from './config';\nimport type { BinderUrlSet, RepoProviderSpec } from './types';\n\nexport function makeDefaultStorageKey(storagePrefix: string, url: string) {\n const urlObj = new URL(url);\n // ignore the query string and hash\n return `${storagePrefix}-${urlObj.origin + urlObj.pathname}`;\n}\n\nfunction makeDefaultBuildSpec(storagePrefix: string, binderUrl: string, stub: string) {\n const build = `${binderUrl}/build/${stub}`;\n const launch = `${binderUrl}/v2/${stub}`;\n\n return {\n build,\n launch,\n storageKey: makeDefaultStorageKey(storagePrefix, build),\n };\n}\n\n/**\n * Make a binder url for git providers\n *\n * - trim trailing or leading '/' on repo\n * - trailing / on binderUrl\n * - convert to URL acceptable string. Required for git\n *\n * @param opts BinderOptions\n * @returns a binder compatible url\n */\nfunction makeGitUrls(config: Config) {\n if (!config.binder.repo) throw Error('repo is required for git provider');\n const { repo, binderUrl, ref } = config.binder;\n const encodedRepo = encodeURIComponent(repo.replace(/(^\\/)|(\\/?$)/g, ''));\n const base = binderUrl?.replace(/(\\/?$)/g, '');\n const stub = `git/${encodedRepo}/${ref ?? 'HEAD'}`;\n return makeDefaultBuildSpec(config.savedSessions.storagePrefix, base, stub);\n}\n\n/**\n * Make a binder url for gitlab providers\n *\n * - trim gitlab.com from repo\n * - trim trailing or leading '/' on repo\n * - convert to URL acceptable string. Required for gitlab\n * - trailing / on binderUrl\n *\n * @param opts BinderOptions\n * @returns a binder compatible url\n */\nfunction makeGitLabUrl(config: Config) {\n if (!config.binder.repo) throw Error('repo is required for gitlab provider');\n const binderUrl = config.binder.binderUrl?.replace(/(\\/?$)/g, '');\n const repo = encodeURIComponent(\n (config.binder.repo ?? '')\n .replace(/^(https?:\\/\\/)?gitlab.com\\//, '')\n .replace(/(^\\/)|(\\/?$)/g, ''),\n );\n const stub = `gl/${repo}/${config.binder.ref ?? 'HEAD'}`;\n return makeDefaultBuildSpec(config.savedSessions.storagePrefix, binderUrl, stub);\n}\n\n/**\n * Make a binder url for gitlab providers\n *\n * - trim github.com from repo\n * - trim trailing or leading '/' on repo\n * - convert to URL acceptable string. Required for gitlab\n * - trailing / on binderUrl\n *\n * @param opts BinderOptions\n * @returns a binder compatible url\n */\nfunction makeGitHubUrl(config: Config) {\n if (!config.binder.repo) throw Error('repo is required for github provider');\n const repo = config.binder.repo\n .replace(/^(https?:\\/\\/)?github.com\\//, '')\n .replace(/(^\\/)|(\\/?$)/g, '');\n const binderUrl = config.binder.binderUrl?.replace(/(\\/?$)/g, '');\n const stub = `gh/${repo}/${config.binder.ref ?? 'HEAD'}`;\n\n return makeDefaultBuildSpec(config.savedSessions.storagePrefix, binderUrl, stub);\n}\n\nfunction makeGistUrl(config: Config) {\n if (!config.binder.repo) throw Error('repo is required for gist provider');\n const repo = config.binder.repo\n .replace(/^(https?:\\/\\/)?github.com\\//, '')\n .replace(/(^\\/)|(\\/?$)/g, '');\n const binderUrl = config.binder.binderUrl?.replace(/(\\/?$)/g, '');\n const stub = `gist/${repo}/${config.binder.ref ?? 'HEAD'}`;\n\n return makeDefaultBuildSpec(config.savedSessions.storagePrefix, binderUrl, stub);\n}\n\nexport const GITHUB_SPEC: RepoProviderSpec = {\n name: 'github',\n makeUrls: makeGitHubUrl,\n};\n\nexport const GITLAB_SPEC: RepoProviderSpec = {\n name: 'gitlab',\n makeUrls: makeGitLabUrl,\n};\n\nexport const GIT_SPEC: RepoProviderSpec = {\n name: 'git',\n makeUrls: makeGitUrls,\n};\n\nexport const GIST_SPEC: RepoProviderSpec = {\n name: 'gist',\n makeUrls: makeGistUrl,\n};\n\nexport const WELL_KNOWN_REPO_PROVIDERS = [GITHUB_SPEC, GITLAB_SPEC, GIT_SPEC, GIST_SPEC];\n\n/**\n * Make a binder url for both well known or custom providers\n *\n * Custom providers are supported by passing in an array of CustomRepoProviderSpecs.\n *\n */\nexport function makeBinderUrls(config: Config, repoProviders: RepoProviderSpec[]): BinderUrlSet {\n const providerMap: Record =\n repoProviders.reduce((obj, spec) => ({ ...obj, [spec.name]: spec }), {}) ?? {};\n\n const provider = config.binder.repoProvider ?? 'github';\n if (!Object.keys(providerMap).includes(provider))\n throw Error(`Unknown provider ${config.binder.repoProvider}`);\n\n if (!providerMap[provider].makeUrls) throw Error(`No makeUrls function for ${provider}`);\n\n return providerMap[provider].makeUrls(config);\n}\n","import type ThebeCodeCell from './cell';\nimport type ThebeNotebook from './notebook';\nimport type ThebeServer from './server';\nimport type ThebeSession from './session';\nimport type { IError } from '@jupyterlab/nbformat';\n\n// value of some of these enums are not arbitrary\n// but relate to events sent from the server via the\n// event stream\nexport enum ServerStatusEvent {\n 'launching' = 'launching',\n 'ready' = 'server-ready',\n 'closed' = 'closed',\n 'unknown' = 'unknown',\n}\n\nexport enum SessionStatusEvent {\n 'starting' = 'starting',\n 'ready' = 'ready',\n 'shutdown' = 'shutdown',\n}\n\nexport enum KernelStatusEvent {\n 'starting' = 'starting',\n 'ready' = 'ready',\n 'shutdown' = 'shutdown',\n}\n\nexport enum NotebookStatusEvent {\n 'attached' = 'attached',\n 'detached' = 'detached',\n 'executing' = 'executing',\n 'idle' = 'idle',\n}\n\nexport enum CellStatusEvent {\n 'attached' = 'attached',\n 'detached' = 'detached',\n 'executing' = 'executing',\n 'idle' = 'idle',\n}\n\nexport enum EventSubject {\n 'server' = 'server',\n 'session' = 'session',\n 'kernel' = 'kernel',\n 'notebook' = 'notebook',\n 'cell' = 'cell',\n}\n\n// TODO improve typing around status's\nexport enum ErrorStatusEvent {\n 'warning' = 'warning',\n 'executeError' = 'execute-error',\n 'error' = 'error',\n 'server' = 'server-error',\n 'session' = 'session-error',\n}\n\nexport function errorToMessage(json: IError): string {\n if (!json.traceback) {\n return json.evalue;\n } else if (Array.isArray(json.traceback)) {\n return `${json.evalue}\\n${(json.traceback ?? []).join('')}`;\n } else {\n return `${json.evalue}\\n${JSON.stringify(json.traceback)}`;\n }\n}\n\nexport enum ThebeEventType {\n 'status' = 'status',\n 'error' = 'error',\n}\n\nexport type EventObject = ThebeServer | ThebeSession | ThebeNotebook | ThebeCodeCell;\n\nexport type StatusEvent =\n | ServerStatusEvent\n | SessionStatusEvent\n | NotebookStatusEvent\n | CellStatusEvent\n | KernelStatusEvent\n | ErrorStatusEvent;\n\nexport interface ThebeEventData {\n subject?: EventSubject;\n id?: string;\n status?: StatusEvent;\n message: string;\n object?: EventObject;\n}\n\nexport type ThebeEventCb = (event: string, data: ThebeEventData) => void;\n\nexport class ThebeEvents {\n listeners: Record>;\n\n constructor() {\n this.listeners = {};\n }\n\n _ensureMap(event: string) {\n if (!(event in this.listeners)) this.listeners[event] = new Map();\n }\n\n trigger(event: ThebeEventType, evt: ThebeEventData) {\n if (!(event in this.listeners)) return;\n this.listeners[event].forEach(({ unbind }, cb) => {\n cb(event, evt);\n if (unbind) this.listeners[event].delete(cb);\n });\n }\n\n on(event: ThebeEventType, cb: ThebeEventCb) {\n this._ensureMap(event);\n this.listeners[event].set(cb, { unbind: false });\n return () => this.off(event, cb);\n }\n\n one(event: ThebeEventType, cb: ThebeEventCb) {\n this._ensureMap(event);\n this.listeners[event].set(cb, { unbind: true });\n return () => this.off(event, cb);\n }\n\n off(event: ThebeEventType, cb: ThebeEventCb) {\n if (!(event in this.listeners)) return;\n this.listeners[event].delete(cb);\n }\n}\n","import { KernelAPI, ServerConnection } from '@jupyterlab/services';\nimport type { SavedSessionInfo, SavedSessionOptions, ServerSettings } from './types';\n\nexport function removeServerInfo(storageKey: string) {\n window.localStorage.removeItem(storageKey);\n}\n\nexport function updateLastUsedTimestamp(storageKey: string) {\n const saved = window.localStorage.getItem(storageKey);\n if (!saved) return;\n const obj = JSON.parse(saved);\n window.localStorage.setItem(storageKey, JSON.stringify({ ...obj, lastUsed: new Date() }));\n}\n\nexport function saveServerInfo(\n storageKey: string,\n id: string,\n serverSettings: Required,\n) {\n try {\n // save the current connection url+token to reuse later\n const { baseUrl, token, wsUrl } = serverSettings;\n window.localStorage.setItem(\n storageKey,\n JSON.stringify({\n id,\n baseUrl,\n token,\n wsUrl,\n lastUsed: new Date(),\n }),\n );\n } catch (e) {\n // storage quota full, gently ignore nonfatal error\n console.warn(\"Couldn't save thebe binder connection info to local storage\", e);\n }\n}\n\nexport async function getExistingServer(\n savedSessionOptions: Required,\n storageKey: string,\n): Promise {\n if (!savedSessionOptions.enabled) return null;\n const storedInfoJSON = window.localStorage.getItem(storageKey);\n if (storedInfoJSON == null) {\n console.debug('thebe:getExistingServer No session saved in ', storageKey);\n return null;\n }\n\n console.debug('thebe:getExistingServer Saved binder session found');\n const existingSettings = JSON.parse(storedInfoJSON ?? '') as SavedSessionInfo;\n const lastUsed = new Date(existingSettings.lastUsed);\n const now = new Date();\n const ageSeconds = (now.getTime() - lastUsed.getTime()) / 1000;\n if (ageSeconds > savedSessionOptions.maxAge) {\n console.debug(\n `thebe:getExistingServer Not using expired binder session for ${existingSettings.baseUrl} from ${lastUsed}`,\n );\n window.localStorage.removeItem(storageKey);\n return null;\n }\n\n try {\n await KernelAPI.listRunning(ServerConnection.makeSettings(existingSettings));\n } catch (err) {\n console.debug(\n 'thebe:getExistingServer Saved binder connection appears to be invalid, requesting new session',\n err,\n );\n window.localStorage.removeItem(storageKey);\n return null;\n }\n\n // refresh lastUsed timestamp in stored info\n updateLastUsedTimestamp(storageKey);\n console.debug(\n `thebe:getExistingServer Saved binder session is valid and will be reused ${existingSettings.baseUrl}`,\n );\n\n return existingSettings;\n}\n\n/**\n * Remove all saved sessions items from local storage based on the storagePrefix provided.\n * The appropriate (default) storage prefix will be available in the SavedSessionOptions object\n * in the Config object.\n *\n * @param storagePrefix\n */\nexport function clearAllSavedSessions(storagePrefix = 'thebe-binder') {\n const keysToRemove: string[] = [];\n for (let i = 0; i < window.localStorage.length; i++) {\n const key = window.localStorage.key(i);\n if (key?.startsWith(storagePrefix)) {\n keysToRemove.push(key);\n }\n }\n console.debug(\n `thebe:clearAllSavedSessions - removing ${keysToRemove.length} saved sessions`,\n keysToRemove.join(','),\n );\n keysToRemove.forEach((key) => window.localStorage.removeItem(key));\n}\n\n/**\n * Remove all saved sessions items from local storage based on the storagePrefix provided.\n * The appropriate (default) storage prefix will be available in the SavedSessionOptions object\n * in the Config object.\n *\n * @param storagePrefix\n * @param url\n */\nexport function clearSavedSession(storageKey: string) {\n console.debug(`thebe:clearSavedSession - removing ${storageKey}`);\n window.localStorage.removeItem(storageKey);\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { maxSatisfying } from 'semver';\n/**\n * A cache using semver ranges to retrieve values.\n */\nexport class SemVerCache {\n constructor() {\n this._cache = Object.create(null);\n }\n set(key, version, object) {\n if (!(key in this._cache)) {\n this._cache[key] = Object.create(null);\n }\n if (!(version in this._cache[key])) {\n this._cache[key][version] = object;\n }\n else {\n throw `Version ${version} of key ${key} already registered.`;\n }\n }\n get(key, semver) {\n if (key in this._cache) {\n const versions = this._cache[key];\n const best = maxSatisfying(Object.keys(versions), semver);\n if (best !== null) {\n return versions[best];\n }\n }\n }\n getAllVersions(key) {\n if (key in this._cache) {\n return this._cache[key];\n }\n }\n}\n//# sourceMappingURL=semvercache.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { shims, } from '@jupyter-widgets/base';\nimport { ManagerBase, serialize_state, } from '@jupyter-widgets/base-manager';\nimport { Signal } from '@lumino/signaling';\nimport { valid } from 'semver';\nimport { SemVerCache } from './semvercache';\n/**\n * The mime type for a widget view.\n */\nexport const WIDGET_VIEW_MIMETYPE = 'application/vnd.jupyter.widget-view+json';\n/**\n * The mime type for widget state data.\n */\nexport const WIDGET_STATE_MIMETYPE = 'application/vnd.jupyter.widget-state+json';\n/**\n * A widget manager that returns Lumino widgets.\n */\nexport class LabWidgetManager extends ManagerBase {\n constructor(rendermime) {\n super();\n // _handleCommOpen is an attribute, not a method, so `this` is captured in a\n // single object that can be registered and removed\n this._handleCommOpen = async (comm, msg) => {\n const oldComm = new shims.services.Comm(comm);\n await this.handle_comm_open(oldComm, msg);\n };\n this._restored = new Signal(this);\n this._restoredStatus = false;\n this._kernelRestoreInProgress = false;\n this._isDisposed = false;\n this._registry = new SemVerCache();\n this._modelsSync = new Map();\n this._onUnhandledIOPubMessage = new Signal(this);\n this._rendermime = rendermime;\n }\n /**\n * Default callback handler to emit unhandled kernel messages.\n */\n callbacks(view) {\n return {\n iopub: {\n output: (msg) => {\n this._onUnhandledIOPubMessage.emit(msg);\n },\n },\n };\n }\n /**\n * Register a new kernel\n */\n _handleKernelChanged({ oldValue, newValue, }) {\n if (oldValue) {\n oldValue.removeCommTarget(this.comm_target_name, this._handleCommOpen);\n }\n if (newValue) {\n newValue.registerCommTarget(this.comm_target_name, this._handleCommOpen);\n }\n }\n /**\n * Disconnect the widget manager from the kernel, setting each model's comm\n * as dead.\n */\n disconnect() {\n super.disconnect();\n this._restoredStatus = false;\n }\n async _loadFromKernel() {\n var _a;\n if (!this.kernel) {\n throw new Error('Kernel not set');\n }\n if (((_a = this.kernel) === null || _a === void 0 ? void 0 : _a.handleComms) === false) {\n // A \"load\" for a kernel that does not handle comms does nothing.\n return;\n }\n return super._loadFromKernel();\n }\n /**\n * Create a comm.\n */\n async _create_comm(target_name, model_id, data, metadata, buffers) {\n const kernel = this.kernel;\n if (!kernel) {\n throw new Error('No current kernel');\n }\n const comm = kernel.createComm(target_name, model_id);\n if (data || metadata) {\n comm.open(data, metadata, buffers);\n }\n return new shims.services.Comm(comm);\n }\n /**\n * Get the currently-registered comms.\n */\n async _get_comm_info() {\n const kernel = this.kernel;\n if (!kernel) {\n throw new Error('No current kernel');\n }\n const reply = await kernel.requestCommInfo({\n target_name: this.comm_target_name,\n });\n if (reply.content.status === 'ok') {\n return reply.content.comms;\n }\n else {\n return {};\n }\n }\n /**\n * Get whether the manager is disposed.\n *\n * #### Notes\n * This is a read-only property.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose the resources held by the manager.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n if (this._commRegistration) {\n this._commRegistration.dispose();\n }\n }\n /**\n * Resolve a URL relative to the current notebook location.\n */\n async resolveUrl(url) {\n return url;\n }\n /**\n * Load a class and return a promise to the loaded object.\n */\n async loadClass(className, moduleName, moduleVersion) {\n // Special-case the Jupyter base and controls packages. If we have just a\n // plain version, with no indication of the compatible range, prepend a ^ to\n // get all compatible versions. We may eventually apply this logic to all\n // widget modules. See issues #2006 and #2017 for more discussion.\n if ((moduleName === '@jupyter-widgets/base' ||\n moduleName === '@jupyter-widgets/controls') &&\n valid(moduleVersion)) {\n moduleVersion = `^${moduleVersion}`;\n }\n const allVersions = this._registry.getAllVersions(moduleName);\n if (!allVersions) {\n throw new Error(`No version of module ${moduleName} is registered`);\n }\n const mod = this._registry.get(moduleName, moduleVersion);\n if (!mod) {\n const registeredVersionList = Object.keys(allVersions);\n throw new Error(`Module ${moduleName}, version ${moduleVersion} is not registered, however, \\\n ${registeredVersionList.join(',')} ${registeredVersionList.length > 1 ? 'are' : 'is'}`);\n }\n let module;\n if (typeof mod === 'function') {\n module = await mod();\n }\n else {\n module = await mod;\n }\n const cls = module[className];\n if (!cls) {\n throw new Error(`Class ${className} not found in module ${moduleName}`);\n }\n return cls;\n }\n get rendermime() {\n return this._rendermime;\n }\n /**\n * A signal emitted when state is restored to the widget manager.\n *\n * #### Notes\n * This indicates that previously-unavailable widget models might be available now.\n */\n get restored() {\n return this._restored;\n }\n /**\n * Whether the state has been restored yet or not.\n */\n get restoredStatus() {\n return this._restoredStatus;\n }\n /**\n * A signal emitted for unhandled iopub kernel messages.\n *\n */\n get onUnhandledIOPubMessage() {\n return this._onUnhandledIOPubMessage;\n }\n register(data) {\n this._registry.set(data.name, data.version, data.exports);\n }\n /**\n * Register a widget model.\n */\n register_model(model_id, modelPromise) {\n super.register_model(model_id, modelPromise);\n // Update the synchronous model map\n modelPromise.then((model) => {\n this._modelsSync.set(model_id, model);\n model.once('comm:close', () => {\n this._modelsSync.delete(model_id);\n });\n });\n }\n /**\n * Close all widgets and empty the widget state.\n * @return Promise that resolves when the widget state is cleared.\n */\n async clear_state() {\n await super.clear_state();\n this._modelsSync = new Map();\n }\n /**\n * Synchronously get the state of the live widgets in the widget manager.\n *\n * This includes all of the live widget models, and follows the format given in\n * the @jupyter-widgets/schema package.\n *\n * @param options - The options for what state to return.\n * @returns A state dictionary\n */\n get_state_sync(options = {}) {\n const models = [];\n for (const model of this._modelsSync.values()) {\n if (model.comm_live) {\n models.push(model);\n }\n }\n return serialize_state(models, options);\n }\n}\n/**\n * A widget manager that returns Lumino widgets.\n */\nexport class KernelWidgetManager extends LabWidgetManager {\n constructor(kernel, rendermime) {\n super(rendermime);\n this._kernel = kernel;\n kernel.statusChanged.connect((sender, args) => {\n this._handleKernelStatusChange(args);\n });\n kernel.connectionStatusChanged.connect((sender, args) => {\n this._handleKernelConnectionStatusChange(args);\n });\n this._handleKernelChanged({\n name: 'kernel',\n oldValue: null,\n newValue: kernel,\n });\n this.restoreWidgets();\n }\n _handleKernelConnectionStatusChange(status) {\n if (status === 'connected') {\n // Only restore if we aren't currently trying to restore from the kernel\n // (for example, in our initial restore from the constructor).\n if (!this._kernelRestoreInProgress) {\n this.restoreWidgets();\n }\n }\n }\n _handleKernelStatusChange(status) {\n if (status === 'restarting') {\n this.disconnect();\n }\n }\n /**\n * Restore widgets from kernel and saved state.\n */\n async restoreWidgets() {\n try {\n this._kernelRestoreInProgress = true;\n await this._loadFromKernel();\n this._restoredStatus = true;\n this._restored.emit();\n }\n catch (err) {\n // Do nothing\n }\n this._kernelRestoreInProgress = false;\n }\n /**\n * Dispose the resources held by the manager.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._kernel = null;\n super.dispose();\n }\n get kernel() {\n return this._kernel;\n }\n}\n/**\n * A widget manager that returns phosphor widgets.\n */\nexport class WidgetManager extends LabWidgetManager {\n constructor(context, rendermime, settings) {\n var _a, _b;\n super(rendermime);\n this._context = context;\n context.sessionContext.kernelChanged.connect((sender, args) => {\n this._handleKernelChanged(args);\n });\n context.sessionContext.statusChanged.connect((sender, args) => {\n this._handleKernelStatusChange(args);\n });\n context.sessionContext.connectionStatusChanged.connect((sender, args) => {\n this._handleKernelConnectionStatusChange(args);\n });\n if ((_a = context.sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel) {\n this._handleKernelChanged({\n name: 'kernel',\n oldValue: null,\n newValue: (_b = context.sessionContext.session) === null || _b === void 0 ? void 0 : _b.kernel,\n });\n }\n this.restoreWidgets(this._context.model);\n this._settings = settings;\n context.saveState.connect((sender, saveState) => {\n if (saveState === 'started' && settings.saveState) {\n this._saveState();\n }\n });\n }\n /**\n * Save the widget state to the context model.\n */\n _saveState() {\n const state = this.get_state_sync({ drop_defaults: true });\n if (this._context.model.setMetadata) {\n this._context.model.setMetadata('widgets', {\n 'application/vnd.jupyter.widget-state+json': state,\n });\n }\n else {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore JupyterLab 3 support\n this._context.model.metadata.set('widgets', {\n 'application/vnd.jupyter.widget-state+json': state,\n });\n }\n }\n _handleKernelConnectionStatusChange(status) {\n if (status === 'connected') {\n // Only restore if we aren't currently trying to restore from the kernel\n // (for example, in our initial restore from the constructor).\n if (!this._kernelRestoreInProgress) {\n // We only want to restore widgets from the kernel, not ones saved in the notebook.\n this.restoreWidgets(this._context.model, {\n loadKernel: true,\n loadNotebook: false,\n });\n }\n }\n }\n _handleKernelStatusChange(status) {\n if (status === 'restarting') {\n this.disconnect();\n }\n }\n /**\n * Restore widgets from kernel and saved state.\n */\n async restoreWidgets(notebook, { loadKernel, loadNotebook } = { loadKernel: true, loadNotebook: true }) {\n try {\n await this.context.sessionContext.ready;\n if (loadKernel) {\n try {\n this._kernelRestoreInProgress = true;\n await this._loadFromKernel();\n }\n finally {\n this._kernelRestoreInProgress = false;\n }\n }\n if (loadNotebook) {\n await this._loadFromNotebook(notebook);\n }\n // If the restore worked above, then update our state.\n this._restoredStatus = true;\n this._restored.emit();\n }\n catch (err) {\n // Do nothing if the restore did not work.\n }\n }\n /**\n * Load widget state from notebook metadata\n */\n async _loadFromNotebook(notebook) {\n const widget_md = notebook.getMetadata\n ? notebook.getMetadata('widgets')\n : // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore JupyterLab 3 support\n notebook.metadata.get('widgets');\n // Restore any widgets from saved state that are not live\n if (widget_md && widget_md[WIDGET_STATE_MIMETYPE]) {\n let state = widget_md[WIDGET_STATE_MIMETYPE];\n state = this.filterExistingModelState(state);\n await this.set_state(state);\n }\n }\n /**\n * Dispose the resources held by the manager.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._context = null;\n super.dispose();\n }\n /**\n * Resolve a URL relative to the current notebook location.\n */\n async resolveUrl(url) {\n const partial = await this.context.urlResolver.resolveUrl(url);\n return this.context.urlResolver.getDownloadUrl(partial);\n }\n get context() {\n return this._context;\n }\n get kernel() {\n var _a, _b, _c;\n return (_c = (_b = (_a = this._context.sessionContext) === null || _a === void 0 ? void 0 : _a.session) === null || _b === void 0 ? void 0 : _b.kernel) !== null && _c !== void 0 ? _c : null;\n }\n /**\n * Register a widget model.\n */\n register_model(model_id, modelPromise) {\n super.register_model(model_id, modelPromise);\n this.setDirty();\n }\n /**\n * Close all widgets and empty the widget state.\n * @return Promise that resolves when the widget state is cleared.\n */\n async clear_state() {\n await super.clear_state();\n this.setDirty();\n }\n /**\n * Set the dirty state of the notebook model if applicable.\n *\n * TODO: perhaps should also set dirty when any model changes any data\n */\n setDirty() {\n if (this._settings.saveState) {\n this._context.model.dirty = true;\n }\n }\n}\n//# sourceMappingURL=manager.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { PromiseDelegate } from '@lumino/coreutils';\nimport { Panel } from '@lumino/widgets';\n/**\n * A renderer for widgets.\n */\nexport class WidgetRenderer extends Panel {\n constructor(options, manager) {\n super();\n this._manager = new PromiseDelegate();\n this._rerenderMimeModel = null;\n this.mimeType = options.mimeType;\n if (manager) {\n this.manager = manager;\n }\n }\n /**\n * The widget manager.\n */\n set manager(value) {\n value.restored.connect(this._rerender, this);\n this._manager.resolve(value);\n }\n async renderModel(model) {\n const source = model.data[this.mimeType];\n // Let's be optimistic, and hope the widget state will come later.\n this.node.textContent = 'Loading widget...';\n const manager = await this._manager.promise;\n // If there is no model id, the view was removed, so hide the node.\n if (source.model_id === '') {\n this.hide();\n return Promise.resolve();\n }\n let wModel;\n try {\n // Presume we have a DOMWidgetModel. Should we check for sure?\n wModel = (await manager.get_model(source.model_id));\n }\n catch (err) {\n if (manager.restoredStatus) {\n // The manager has been restored, so this error won't be going away.\n this.node.textContent = 'Error displaying widget: model not found';\n this.addClass('jupyter-widgets');\n console.error(err);\n return;\n }\n // Store the model for a possible rerender\n this._rerenderMimeModel = model;\n return;\n }\n // Successful getting the model, so we don't need to try to rerender.\n this._rerenderMimeModel = null;\n let widget;\n try {\n widget = (await manager.create_view(wModel)).luminoWidget;\n }\n catch (err) {\n this.node.textContent = 'Error displaying widget';\n this.addClass('jupyter-widgets');\n console.error(err);\n return;\n }\n // Clear any previous loading message.\n this.node.textContent = '';\n this.addWidget(widget);\n // When the widget is disposed, hide this container and make sure we\n // change the output model to reflect the view was closed.\n widget.disposed.connect(() => {\n this.hide();\n source.model_id = '';\n });\n }\n /**\n * Dispose the resources held by the manager.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._manager = null;\n super.dispose();\n }\n _rerender() {\n if (this._rerenderMimeModel) {\n // Clear the error message\n this.node.textContent = '';\n this.removeClass('jupyter-widgets');\n // Attempt to rerender.\n this.renderModel(this._rerenderMimeModel);\n }\n }\n}\n//# sourceMappingURL=renderer.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport * as outputBase from '@jupyter-widgets/output';\nimport { JupyterLuminoPanelWidget } from '@jupyter-widgets/base';\nimport { WidgetManager } from './manager';\nimport { OutputAreaModel, OutputArea } from '@jupyterlab/outputarea';\nimport $ from 'jquery';\nexport const OUTPUT_WIDGET_VERSION = outputBase.OUTPUT_WIDGET_VERSION;\nexport class OutputModel extends outputBase.OutputModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { msg_id: '', outputs: [] });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n // The output area model is trusted since widgets are only rendered in trusted contexts.\n this._outputs = new OutputAreaModel({ trusted: true });\n this._msgHook = (msg) => {\n this.add(msg);\n return false;\n };\n // if the context is available, react on kernel changes\n if (this.widget_manager instanceof WidgetManager) {\n this.widget_manager.context.sessionContext.kernelChanged.connect((sender, args) => {\n this._handleKernelChanged(args);\n });\n }\n this.listenTo(this, 'change:msg_id', this.reset_msg_id);\n this.listenTo(this, 'change:outputs', this.setOutputs);\n this.setOutputs();\n }\n /**\n * Register a new kernel\n */\n _handleKernelChanged({ oldValue, }) {\n const msgId = this.get('msg_id');\n if (msgId && oldValue) {\n oldValue.removeMessageHook(msgId, this._msgHook);\n this.set('msg_id', null);\n }\n }\n /**\n * Reset the message id.\n */\n reset_msg_id() {\n const kernel = this.widget_manager.kernel;\n const msgId = this.get('msg_id');\n const oldMsgId = this.previous('msg_id');\n // Clear any old handler.\n if (oldMsgId && kernel) {\n kernel.removeMessageHook(oldMsgId, this._msgHook);\n }\n // Register any new handler.\n if (msgId && kernel) {\n kernel.registerMessageHook(msgId, this._msgHook);\n }\n }\n add(msg) {\n const msgType = msg.header.msg_type;\n switch (msgType) {\n case 'execute_result':\n case 'display_data':\n case 'stream':\n case 'error': {\n const model = msg.content;\n model.output_type = msgType;\n this._outputs.add(model);\n break;\n }\n case 'clear_output':\n this.clear_output(msg.content.wait);\n break;\n default:\n break;\n }\n this.set('outputs', this._outputs.toJSON(), { newMessage: true });\n this.save_changes();\n }\n clear_output(wait = false) {\n this._outputs.clear(wait);\n }\n get outputs() {\n return this._outputs;\n }\n setOutputs(model, value, options) {\n if (!(options && options.newMessage)) {\n // fromJSON does not clear the existing output\n this.clear_output();\n // fromJSON does not copy the message, so we make a deep copy\n this._outputs.fromJSON(JSON.parse(JSON.stringify(this.get('outputs'))));\n }\n }\n}\nexport class OutputView extends outputBase.OutputView {\n _createElement(tagName) {\n this.luminoWidget = new JupyterLuminoPanelWidget({ view: this });\n return this.luminoWidget.node;\n }\n _setElement(el) {\n if (this.el || el !== this.luminoWidget.node) {\n // Boxes don't allow setting the element beyond the initial creation.\n throw new Error('Cannot reset the DOM element.');\n }\n this.el = this.luminoWidget.node;\n this.$el = $(this.luminoWidget.node);\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this._outputView = new OutputArea({\n rendermime: this.model.widget_manager.rendermime,\n contentFactory: OutputArea.defaultContentFactory,\n model: this.model.outputs,\n });\n // TODO: why is this a readonly property now?\n // this._outputView.model = this.model.outputs;\n // TODO: why is this on the model now?\n // this._outputView.trusted = true;\n this.luminoWidget.insertWidget(0, this._outputView);\n this.luminoWidget.addClass('jupyter-widgets');\n this.luminoWidget.addClass('widget-output');\n this.update(); // Set defaults.\n }\n remove() {\n this._outputView.dispose();\n return super.remove();\n }\n}\n//# sourceMappingURL=output.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nexport { uuid, resolvePromisesDict } from '@jupyter-widgets/base';\n/**\n * Apply MathJax rendering to an element, and optionally set its text.\n *\n * If MathJax is not available, make no changes.\n *\n * Parameters\n * ----------\n * element: Node\n * text: optional string\n */\nexport function typeset(element, text) {\n if (text !== void 0) {\n element.textContent = text;\n }\n if (window.MathJax !== void 0) {\n MathJax.Hub.Queue(['Typeset', MathJax.Hub, element]);\n }\n}\n/**\n * escape text to HTML\n */\nexport function escape_html(text) {\n const esc = document.createElement('div');\n esc.textContent = text;\n return esc.innerHTML;\n}\n/**\n * Creates a wrappable Promise rejection function.\n */\nexport function reject(message, log) {\n return function promiseRejection(error) {\n if (log) {\n console.error(new Error(message));\n }\n throw error;\n };\n}\n//# sourceMappingURL=utils.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * The version of the Jupyter controls widget attribute spec that this package\n * implements.\n */\nexport const JUPYTER_CONTROLS_VERSION = '2.0.0';\n//# sourceMappingURL=version.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetModel, DOMWidgetView, StyleModel, } from '@jupyter-widgets/base';\nimport { typeset } from './utils';\nimport { JUPYTER_CONTROLS_VERSION } from './version';\nexport class DescriptionStyleModel extends StyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'DescriptionStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nDescriptionStyleModel.styleProperties = {\n description_width: {\n selector: '.widget-label',\n attribute: 'width',\n default: null,\n },\n};\nexport class DescriptionModel extends DOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'DescriptionModel', _view_name: 'DescriptionView', _view_module: '@jupyter-widgets/controls', _model_module: '@jupyter-widgets/controls', _view_module_version: JUPYTER_CONTROLS_VERSION, _model_module_version: JUPYTER_CONTROLS_VERSION, description: '', description_allow_html: false });\n }\n}\nexport class DescriptionView extends DOMWidgetView {\n render() {\n this.label = document.createElement('label');\n this.el.appendChild(this.label);\n this.label.className = 'widget-label';\n this.label.style.display = 'none';\n this.listenTo(this.model, 'change:description', this.updateDescription);\n this.listenTo(this.model, 'change:description_allow_html', this.updateDescription);\n this.listenTo(this.model, 'change:tabbable', this.updateTabindex);\n this.updateDescription();\n this.updateTabindex();\n this.updateTooltip();\n }\n typeset(element, text) {\n this.displayed.then(() => {\n var _a, _b, _c;\n if ((_b = (_a = window.MathJax) === null || _a === void 0 ? void 0 : _a.Hub) === null || _b === void 0 ? void 0 : _b.Queue) {\n return typeset(element, text);\n }\n const widget_manager = this.model.widget_manager;\n const latexTypesetter = (_c = widget_manager._rendermime) === null || _c === void 0 ? void 0 : _c.latexTypesetter;\n if (latexTypesetter) {\n if (text !== void 0) {\n element.textContent = text;\n }\n latexTypesetter.typeset(element);\n }\n });\n }\n updateDescription() {\n const description = this.model.get('description');\n if (description.length === 0) {\n this.label.style.display = 'none';\n }\n else {\n if (this.model.get('description_allow_html')) {\n this.label.innerHTML =\n this.model.widget_manager.inline_sanitize(description);\n }\n else {\n this.label.textContent = description;\n }\n this.typeset(this.label);\n this.label.style.display = '';\n }\n }\n updateTooltip() {\n if (!this.label)\n return;\n this.label.title = this.model.get('tooltip');\n }\n}\n/**\n * For backwards compatibility with jupyter-js-widgets 2.x.\n *\n * Use DescriptionModel instead.\n */\nexport class LabeledDOMWidgetModel extends DescriptionModel {\n}\n/**\n * For backwards compatibility with jupyter-js-widgets 2.x.\n *\n * Use DescriptionView instead.\n */\nexport class LabeledDOMWidgetView extends DescriptionView {\n}\n//# sourceMappingURL=widget_description.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n// widget_core implements some common patterns for the core widget collection\n// that are not to be used directly by third-party widget authors.\nimport { DOMWidgetModel, WidgetModel } from '@jupyter-widgets/base';\nimport { DescriptionModel } from './widget_description';\nimport { JUPYTER_CONTROLS_VERSION } from './version';\nexport class CoreWidgetModel extends WidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'CoreWidgetModel', _view_module: '@jupyter-widgets/controls', _model_module: '@jupyter-widgets/controls', _view_module_version: JUPYTER_CONTROLS_VERSION, _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nexport class CoreDOMWidgetModel extends DOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'CoreDOMWidgetModel', _view_module: '@jupyter-widgets/controls', _model_module: '@jupyter-widgets/controls', _view_module_version: JUPYTER_CONTROLS_VERSION, _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nexport class CoreDescriptionModel extends DescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'CoreDescriptionModel', _view_module: '@jupyter-widgets/controls', _model_module: '@jupyter-widgets/controls', _view_module_version: JUPYTER_CONTROLS_VERSION, _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\n//# sourceMappingURL=widget_core.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { unpack_models } from '@jupyter-widgets/base';\nimport { CoreWidgetModel } from './widget_core';\nexport class DirectionalLinkModel extends CoreWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { target: undefined, source: undefined, _model_name: 'DirectionalLinkModel' });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n this.on('change', this.updateBindings, this);\n this.updateBindings();\n }\n updateValue(sourceModel, sourceAttr, targetModel, targetAttr) {\n if (this._updating) {\n return;\n }\n this._updating = true;\n try {\n if (targetModel) {\n targetModel.set(targetAttr, sourceModel.get(sourceAttr));\n targetModel.save_changes();\n }\n }\n finally {\n this._updating = false;\n }\n }\n updateBindings() {\n this.cleanup();\n [this.sourceModel, this.sourceAttr] = this.get('source') || [null, null];\n [this.targetModel, this.targetAttr] = this.get('target') || [null, null];\n if (this.sourceModel) {\n this.listenTo(this.sourceModel, 'change:' + this.sourceAttr, () => {\n this.updateValue(this.sourceModel, this.sourceAttr, this.targetModel, this.targetAttr);\n });\n this.updateValue(this.sourceModel, this.sourceAttr, this.targetModel, this.targetAttr);\n this.listenToOnce(this.sourceModel, 'destroy', this.cleanup);\n }\n if (this.targetModel) {\n this.listenToOnce(this.targetModel, 'destroy', this.cleanup);\n }\n }\n cleanup() {\n // Stop listening to 'change' and 'destroy' events of the source and target\n if (this.sourceModel) {\n this.stopListening(this.sourceModel, 'change:' + this.sourceAttr, undefined);\n this.stopListening(this.sourceModel, 'destroy', undefined);\n }\n if (this.targetModel) {\n this.stopListening(this.targetModel, 'destroy', undefined);\n }\n }\n}\nDirectionalLinkModel.serializers = Object.assign(Object.assign({}, CoreWidgetModel.serializers), { target: { deserialize: unpack_models }, source: { deserialize: unpack_models } });\nexport class LinkModel extends DirectionalLinkModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'LinkModel' });\n }\n updateBindings() {\n super.updateBindings();\n if (this.targetModel) {\n this.listenTo(this.targetModel, 'change:' + this.targetAttr, () => {\n this.updateValue(this.targetModel, this.targetAttr, this.sourceModel, this.sourceAttr);\n });\n }\n }\n cleanup() {\n super.cleanup();\n if (this.targetModel) {\n this.stopListening(this.targetModel, 'change:' + this.targetAttr, undefined);\n }\n }\n}\n//# sourceMappingURL=widget_link.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView } from '@jupyter-widgets/base';\nimport { CoreDescriptionModel } from './widget_core';\nimport { DescriptionStyleModel, DescriptionView } from './widget_description';\nexport class CheckboxStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'CheckboxStyleModel' });\n }\n}\nCheckboxStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { background: {\n selector: '',\n attribute: 'background',\n default: null,\n } });\nexport class ToggleButtonStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ToggleButtonStyleModel' });\n }\n}\nToggleButtonStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { font_family: {\n selector: '',\n attribute: 'font-family',\n default: '',\n }, font_size: {\n selector: '',\n attribute: 'font-size',\n default: '',\n }, font_style: {\n selector: '',\n attribute: 'font-style',\n default: '',\n }, font_variant: {\n selector: '',\n attribute: 'font-variant',\n default: '',\n }, font_weight: {\n selector: '',\n attribute: 'font-weight',\n default: '',\n }, text_color: {\n selector: '',\n attribute: 'color',\n default: '',\n }, text_decoration: {\n selector: '',\n attribute: 'text-decoration',\n default: '',\n } });\nexport class BoolModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: false, disabled: false, _model_name: 'BoolModel' });\n }\n}\nexport class CheckboxModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { indent: true, style: null, _view_name: 'CheckboxView', _model_name: 'CheckboxModel' });\n }\n}\nexport class CheckboxView extends DescriptionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-checkbox');\n // adding a zero-width space to the label to help\n // the browser set the baseline correctly\n this.label.innerHTML = '​';\n // label containing the checkbox and description span\n this.checkboxLabel = document.createElement('label');\n this.checkboxLabel.classList.add('widget-label-basic');\n this.el.appendChild(this.checkboxLabel);\n // checkbox\n this.checkbox = document.createElement('input');\n this.checkbox.setAttribute('type', 'checkbox');\n this.checkboxLabel.appendChild(this.checkbox);\n // span to the right of the checkbox that will render the description\n this.descriptionSpan = document.createElement('span');\n this.checkboxLabel.appendChild(this.descriptionSpan);\n this.listenTo(this.model, 'change:indent', this.updateIndent);\n this.listenTo(this.model, 'change:tabbable', this.updateTabindex);\n this.update(); // Set defaults.\n this.updateDescription();\n this.updateIndent();\n this.updateTabindex();\n this.updateTooltip();\n }\n /**\n * Overridden from super class\n *\n * Update the description span (rather than the label) since\n * we want the description to the right of the checkbox.\n */\n updateDescription() {\n // can be called before the view is fully initialized\n if (this.checkboxLabel == null) {\n return;\n }\n const description = this.model.get('description');\n if (this.model.get('description_allow_html')) {\n this.descriptionSpan.innerHTML =\n this.model.widget_manager.inline_sanitize(description);\n }\n else {\n this.descriptionSpan.textContent = description;\n }\n this.typeset(this.descriptionSpan);\n this.descriptionSpan.title = description;\n this.checkbox.title = description;\n }\n /**\n * Update the visibility of the label in the super class\n * to provide the optional indent.\n */\n updateIndent() {\n const indent = this.model.get('indent');\n this.label.style.display = indent ? '' : 'none';\n }\n updateTabindex() {\n if (!this.checkbox) {\n return; // we might be constructing the parent\n }\n const tabbable = this.model.get('tabbable');\n if (tabbable === true) {\n this.checkbox.setAttribute('tabIndex', '0');\n }\n else if (tabbable === false) {\n this.checkbox.setAttribute('tabIndex', '-1');\n }\n else if (tabbable === null) {\n this.checkbox.removeAttribute('tabIndex');\n }\n }\n updateTooltip() {\n if (!this.checkbox)\n return; // we might be constructing the parent\n const title = this.model.get('tooltip');\n if (!title) {\n this.checkbox.removeAttribute('title');\n }\n else if (this.model.get('description').length === 0) {\n this.checkbox.setAttribute('title', title);\n }\n }\n events() {\n return {\n 'click input[type=\"checkbox\"]': '_handle_click',\n };\n }\n /**\n * Handles when the checkbox is clicked.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n _handle_click() {\n const value = this.model.get('value');\n this.model.set('value', !value, { updated_view: this });\n this.touch();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n this.checkbox.checked = this.model.get('value');\n if (options === undefined || options.updated_view != this) {\n this.checkbox.disabled = this.model.get('disabled');\n }\n return super.update();\n }\n /**\n * Handle message sent to the front end.\n *\n * Used to focus or blur the widget.\n */\n handle_message(content) {\n if (content.do == 'focus') {\n this.checkbox.focus();\n }\n else if (content.do == 'blur') {\n this.checkbox.blur();\n }\n }\n}\nexport class ToggleButtonModel extends BoolModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'ToggleButtonView', _model_name: 'ToggleButtonModel', tooltip: '', icon: '', button_style: '', style: null });\n }\n}\nexport class ToggleButtonView extends DOMWidgetView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('jupyter-button');\n this.el.classList.add('widget-toggle-button');\n this.listenTo(this.model, 'change:button_style', this.update_button_style);\n this.listenTo(this.model, 'change:tabbable', this.updateTabindex);\n this.set_button_style();\n this.update(); // Set defaults.\n }\n update_button_style() {\n this.update_mapped_classes(ToggleButtonView.class_map, 'button_style');\n }\n set_button_style() {\n this.set_mapped_classes(ToggleButtonView.class_map, 'button_style');\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if (this.model.get('value')) {\n this.el.classList.add('mod-active');\n }\n else {\n this.el.classList.remove('mod-active');\n }\n if (options === undefined || options.updated_view !== this) {\n this.el.disabled = this.model.get('disabled');\n this.el.setAttribute('tabbable', this.model.get('tabbable'));\n this.el.setAttribute('title', this.model.get('tooltip'));\n const description = this.model.get('description');\n const icon = this.model.get('icon');\n if (description.trim().length === 0 && icon.trim().length === 0) {\n this.el.innerHTML = ' '; // Preserve button height\n }\n else {\n this.el.textContent = '';\n if (icon.trim().length) {\n const i = document.createElement('i');\n this.el.appendChild(i);\n i.classList.add('fa');\n i.classList.add('fa-' + icon);\n }\n this.el.appendChild(document.createTextNode(description));\n }\n }\n this.updateTabindex();\n return super.update();\n }\n events() {\n return {\n // Dictionary of events and their handlers.\n click: '_handle_click',\n };\n }\n /**\n * Handles and validates user input.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n _handle_click(event) {\n event.preventDefault();\n const value = this.model.get('value');\n this.model.set('value', !value, { updated_view: this });\n this.touch();\n }\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'button';\n }\n}\nToggleButtonView.class_map = {\n primary: ['mod-primary'],\n success: ['mod-success'],\n info: ['mod-info'],\n warning: ['mod-warning'],\n danger: ['mod-danger'],\n};\nexport class ValidModel extends BoolModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { readout: 'Invalid', _view_name: 'ValidView', _model_name: 'ValidModel' });\n }\n}\nexport class ValidView extends DescriptionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-valid');\n this.el.classList.add('widget-inline-hbox');\n this.icon = document.createElement('i');\n this.icon.classList.add('fa', 'fa-fw');\n this.el.appendChild(this.icon);\n this.readout = document.createElement('span');\n this.readout.classList.add('widget-valid-readout');\n this.readout.classList.add('widget-readout');\n this.el.appendChild(this.readout);\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n this.el.classList.remove('mod-valid');\n this.el.classList.remove('mod-invalid');\n this.icon.classList.remove('fa-check');\n this.icon.classList.remove('fa-times');\n this.readout.textContent = this.model.get('readout');\n if (this.model.get('value')) {\n this.el.classList.add('mod-valid');\n this.icon.classList.add('fa-check');\n }\n else {\n this.el.classList.add('mod-invalid');\n this.icon.classList.add('fa-times');\n }\n }\n}\n//# sourceMappingURL=widget_bool.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView, StyleModel } from '@jupyter-widgets/base';\nimport { CoreDOMWidgetModel } from './widget_core';\nimport { JUPYTER_CONTROLS_VERSION } from './version';\nexport class ButtonStyleModel extends StyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ButtonStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nButtonStyleModel.styleProperties = {\n button_color: {\n selector: '',\n attribute: 'background-color',\n default: null,\n },\n font_family: {\n selector: '',\n attribute: 'font-family',\n default: '',\n },\n font_size: {\n selector: '',\n attribute: 'font-size',\n default: '',\n },\n font_style: {\n selector: '',\n attribute: 'font-style',\n default: '',\n },\n font_variant: {\n selector: '',\n attribute: 'font-variant',\n default: '',\n },\n font_weight: {\n selector: '',\n attribute: 'font-weight',\n default: '',\n },\n text_color: {\n selector: '',\n attribute: 'color',\n default: '',\n },\n text_decoration: {\n selector: '',\n attribute: 'text-decoration',\n default: '',\n },\n};\nexport class ButtonModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { description: '', tooltip: '', disabled: false, icon: '', button_style: '', _view_name: 'ButtonView', _model_name: 'ButtonModel', style: null });\n }\n}\nexport class ButtonView extends DOMWidgetView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('jupyter-button');\n this.el.classList.add('widget-button');\n this.listenTo(this.model, 'change:button_style', this.update_button_style);\n this.listenTo(this.model, 'change:tabbable', this.updateTabindex);\n this.set_button_style();\n this.update(); // Set defaults.\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n this.el.disabled = this.model.get('disabled');\n this.updateTabindex();\n const tooltip = this.model.get('tooltip');\n const description = this.model.get('description');\n const icon = this.model.get('icon');\n this.el.setAttribute('title', tooltip !== null && tooltip !== void 0 ? tooltip : description);\n if (description.length || icon.length) {\n this.el.textContent = '';\n if (icon.length) {\n const i = document.createElement('i');\n i.classList.add('fa');\n i.classList.add(...icon\n .split(/[\\s]+/)\n .filter(Boolean)\n .map((v) => `fa-${v}`));\n if (description.length === 0) {\n i.classList.add('center');\n }\n this.el.appendChild(i);\n }\n this.el.appendChild(document.createTextNode(description));\n }\n return super.update();\n }\n update_button_style() {\n this.update_mapped_classes(ButtonView.class_map, 'button_style');\n }\n set_button_style() {\n this.set_mapped_classes(ButtonView.class_map, 'button_style');\n }\n /**\n * Dictionary of events and handlers\n */\n events() {\n // TODO: return typing not needed in Typescript later than 1.8.x\n // See http://stackoverflow.com/questions/22077023/why-cant-i-indirectly-return-an-object-literal-to-satisfy-an-index-signature-re and https://github.com/Microsoft/TypeScript/pull/7029\n return { click: '_handle_click' };\n }\n /**\n * Handles when the button is clicked.\n */\n _handle_click(event) {\n event.preventDefault();\n this.send({ event: 'click' });\n }\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'button';\n }\n}\nButtonView.class_map = {\n primary: ['mod-primary'],\n success: ['mod-success'],\n info: ['mod-info'],\n warning: ['mod-warning'],\n danger: ['mod-danger'],\n};\n//# sourceMappingURL=widget_button.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView, unpack_models, ViewList, JupyterLuminoPanelWidget, reject, } from '@jupyter-widgets/base';\nimport { CoreDOMWidgetModel } from './widget_core';\nimport { ArrayExt } from '@lumino/algorithm';\nimport { MessageLoop } from '@lumino/messaging';\nimport { Widget } from '@lumino/widgets';\nimport $ from 'jquery';\nexport class BoxModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'BoxView', _model_name: 'BoxModel', children: [], box_style: '' });\n }\n}\nBoxModel.serializers = Object.assign(Object.assign({}, CoreDOMWidgetModel.serializers), { children: { deserialize: unpack_models } });\nexport class HBoxModel extends BoxModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'HBoxView', _model_name: 'HBoxModel' });\n }\n}\nexport class VBoxModel extends BoxModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'VBoxView', _model_name: 'VBoxModel' });\n }\n}\nexport class BoxView extends DOMWidgetView {\n _createElement(tagName) {\n this.luminoWidget = new JupyterLuminoPanelWidget({ view: this });\n return this.luminoWidget.node;\n }\n _setElement(el) {\n if (this.el || el !== this.luminoWidget.node) {\n // Boxes don't allow setting the element beyond the initial creation.\n throw new Error('Cannot reset the DOM element.');\n }\n this.el = this.luminoWidget.node;\n this.$el = $(this.luminoWidget.node);\n }\n initialize(parameters) {\n super.initialize(parameters);\n this.children_views = new ViewList(this.add_child_model, null, this);\n this.listenTo(this.model, 'change:children', this.update_children);\n this.listenTo(this.model, 'change:box_style', this.update_box_style);\n this.luminoWidget.addClass('jupyter-widgets');\n this.luminoWidget.addClass('widget-container');\n this.luminoWidget.addClass('widget-box');\n }\n render() {\n super.render();\n this.update_children();\n this.set_box_style();\n }\n update_children() {\n var _a;\n (_a = this.children_views) === null || _a === void 0 ? void 0 : _a.update(this.model.get('children')).then((views) => {\n // Notify all children that their sizes may have changed.\n views.forEach((view) => {\n MessageLoop.postMessage(view.luminoWidget, Widget.ResizeMessage.UnknownSize);\n });\n });\n }\n update_box_style() {\n this.update_mapped_classes(BoxView.class_map, 'box_style');\n }\n set_box_style() {\n this.set_mapped_classes(BoxView.class_map, 'box_style');\n }\n add_child_model(model) {\n // we insert a dummy element so the order is preserved when we add\n // the rendered content later.\n const dummy = new Widget();\n this.luminoWidget.addWidget(dummy);\n return this.create_child_view(model)\n .then((view) => {\n // replace the dummy widget with the new one.\n const i = ArrayExt.firstIndexOf(this.luminoWidget.widgets, dummy);\n this.luminoWidget.insertWidget(i, view.luminoWidget);\n dummy.dispose();\n return view;\n })\n .catch(reject('Could not add child view to box', true));\n }\n remove() {\n this.children_views = null;\n super.remove();\n }\n}\nBoxView.class_map = {\n success: ['alert', 'alert-success'],\n info: ['alert', 'alert-info'],\n warning: ['alert', 'alert-warning'],\n danger: ['alert', 'alert-danger'],\n};\nexport class HBoxView extends BoxView {\n /**\n * Public constructor\n */\n initialize(parameters) {\n super.initialize(parameters);\n this.luminoWidget.addClass('widget-hbox');\n }\n}\nexport class VBoxView extends BoxView {\n /**\n * Public constructor\n */\n initialize(parameters) {\n super.initialize(parameters);\n this.luminoWidget.addClass('widget-vbox');\n }\n}\nexport class GridBoxView extends BoxView {\n /**\n * Public constructor\n */\n initialize(parameters) {\n super.initialize(parameters);\n this.luminoWidget.addClass('widget-gridbox');\n // display needn't be set to flex and grid\n this.luminoWidget.removeClass('widget-box');\n }\n}\nexport class GridBoxModel extends BoxModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'GridBoxView', _model_name: 'GridBoxModel' });\n }\n}\n//# sourceMappingURL=widget_box.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView } from '@jupyter-widgets/base';\nimport { CoreDOMWidgetModel } from './widget_core';\nexport class ImageModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ImageModel', _view_name: 'ImageView', format: 'png', width: '', height: '', value: new DataView(new ArrayBuffer(0)) });\n }\n}\nImageModel.serializers = Object.assign(Object.assign({}, CoreDOMWidgetModel.serializers), { value: {\n serialize: (value) => {\n return new DataView(value.buffer.slice(0));\n },\n } });\nexport class ImageView extends DOMWidgetView {\n render() {\n /**\n * Called when view is rendered.\n */\n super.render();\n this.luminoWidget.addClass('jupyter-widgets');\n this.luminoWidget.addClass('widget-image');\n this.update(); // Set defaults.\n }\n update() {\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n let url;\n const format = this.model.get('format');\n const value = this.model.get('value');\n if (format !== 'url') {\n const blob = new Blob([value], {\n type: `image/${this.model.get('format')}`,\n });\n url = URL.createObjectURL(blob);\n }\n else {\n url = new TextDecoder('utf-8').decode(value.buffer);\n }\n // Clean up the old objectURL\n const oldurl = this.el.src;\n this.el.src = url;\n if (oldurl) {\n URL.revokeObjectURL(oldurl);\n }\n const width = this.model.get('width');\n if (width !== undefined && width.length > 0) {\n this.el.setAttribute('width', width);\n }\n else {\n this.el.removeAttribute('width');\n }\n const height = this.model.get('height');\n if (height !== undefined && height.length > 0) {\n this.el.setAttribute('height', height);\n }\n else {\n this.el.removeAttribute('height');\n }\n return super.update();\n }\n remove() {\n if (this.el.src) {\n URL.revokeObjectURL(this.el.src);\n }\n super.remove();\n }\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'img';\n }\n}\n//# sourceMappingURL=widget_image.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView } from '@jupyter-widgets/base';\nimport { CoreDOMWidgetModel } from './widget_core';\nexport class VideoModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'VideoModel', _view_name: 'VideoView', format: 'mp4', width: '', height: '', autoplay: true, loop: true, controls: true, value: new DataView(new ArrayBuffer(0)) });\n }\n}\nVideoModel.serializers = Object.assign(Object.assign({}, CoreDOMWidgetModel.serializers), { value: {\n serialize: (value) => {\n return new DataView(value.buffer.slice(0));\n },\n } });\nexport class VideoView extends DOMWidgetView {\n render() {\n /**\n * Called when view is rendered.\n */\n super.render();\n this.luminoWidget.addClass('jupyter-widgets');\n this.luminoWidget.addClass('widget-image');\n this.update(); // Set defaults.\n }\n update() {\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n let url;\n const format = this.model.get('format');\n const value = this.model.get('value');\n if (format !== 'url') {\n const blob = new Blob([value], {\n type: `video/${this.model.get('format')}`,\n });\n url = URL.createObjectURL(blob);\n }\n else {\n url = new TextDecoder('utf-8').decode(value.buffer);\n }\n // Clean up the old objectURL\n const oldurl = this.el.src;\n this.el.src = url;\n if (oldurl) {\n URL.revokeObjectURL(oldurl);\n }\n // Height and width\n const width = this.model.get('width');\n if (width !== undefined && width.length > 0) {\n this.el.setAttribute('width', width);\n }\n else {\n this.el.removeAttribute('width');\n }\n const height = this.model.get('height');\n if (height !== undefined && height.length > 0) {\n this.el.setAttribute('height', height);\n }\n else {\n this.el.removeAttribute('height');\n }\n // Video attributes\n this.el.loop = this.model.get('loop');\n this.el.autoplay = this.model.get('autoplay');\n this.el.controls = this.model.get('controls');\n return super.update();\n }\n remove() {\n if (this.el.src) {\n URL.revokeObjectURL(this.el.src);\n }\n super.remove();\n }\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'video';\n }\n}\n//# sourceMappingURL=widget_video.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView } from '@jupyter-widgets/base';\nimport { CoreDOMWidgetModel } from './widget_core';\nexport class AudioModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'AudioModel', _view_name: 'AudioView', format: 'mp3', autoplay: true, loop: true, controls: true, value: new DataView(new ArrayBuffer(0)) });\n }\n}\nAudioModel.serializers = Object.assign(Object.assign({}, CoreDOMWidgetModel.serializers), { value: {\n serialize: (value) => {\n return new DataView(value.buffer.slice(0));\n },\n } });\nexport class AudioView extends DOMWidgetView {\n render() {\n /**\n * Called when view is rendered.\n */\n super.render();\n this.luminoWidget.addClass('jupyter-widgets');\n this.update(); // Set defaults.\n }\n update() {\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n let url;\n const format = this.model.get('format');\n const value = this.model.get('value');\n if (format !== 'url') {\n const blob = new Blob([value], {\n type: `audio/${this.model.get('format')}`,\n });\n url = URL.createObjectURL(blob);\n }\n else {\n url = new TextDecoder('utf-8').decode(value.buffer);\n }\n // Clean up the old objectURL\n const oldurl = this.el.src;\n this.el.src = url;\n if (oldurl) {\n URL.revokeObjectURL(oldurl);\n }\n // Audio attributes\n this.el.loop = this.model.get('loop');\n this.el.autoplay = this.model.get('autoplay');\n this.el.controls = this.model.get('controls');\n return super.update();\n }\n remove() {\n if (this.el.src) {\n URL.revokeObjectURL(this.el.src);\n }\n super.remove();\n }\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'audio';\n }\n}\n//# sourceMappingURL=widget_audio.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDescriptionModel } from './widget_core';\nimport { DescriptionView } from './widget_description';\nimport { uuid } from './utils';\nconst named_colors = {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgrey: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkslategrey: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dimgrey: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n grey: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n indianred: '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgreen: '#90ee90',\n lightgray: '#d3d3d3',\n lightgrey: '#d3d3d3',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightslategrey: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370db',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#db7093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n slategrey: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32',\n};\nexport class ColorPickerModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: 'black', concise: false, _model_name: 'ColorPickerModel', _view_name: 'ColorPickerView' });\n }\n}\nexport class ColorPickerView extends DescriptionView {\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-colorpicker');\n this._color_container = document.createElement('div');\n this._color_container.className =\n 'widget-inline-hbox widget-colorpicker-input';\n this.el.appendChild(this._color_container);\n this._textbox = document.createElement('input');\n this._textbox.setAttribute('type', 'text');\n this._textbox.id = this.label.htmlFor = uuid();\n this._color_container.appendChild(this._textbox);\n this._textbox.value = this.model.get('value');\n this._colorpicker = document.createElement('input');\n this._colorpicker.setAttribute('type', 'color');\n this._color_container.appendChild(this._colorpicker);\n this.listenTo(this.model, 'change:value', this._update_value);\n this.listenTo(this.model, 'change:concise', this._update_concise);\n this._update_concise();\n this._update_value();\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if (options === undefined || options.updated_view != this) {\n const disabled = this.model.get('disabled');\n this._textbox.disabled = disabled;\n this._colorpicker.disabled = disabled;\n }\n return super.update();\n }\n events() {\n // Typescript doesn't understand that these functions are called, so we\n // specifically use them here so it knows they are being used.\n void this._picker_change;\n void this._text_change;\n return {\n 'change [type=\"color\"]': '_picker_change',\n 'change [type=\"text\"]': '_text_change',\n };\n }\n _update_value() {\n const value = this.model.get('value');\n this._colorpicker.value = color2hex(value);\n this._textbox.value = value;\n }\n _update_concise() {\n const concise = this.model.get('concise');\n if (concise) {\n this.el.classList.add('concise');\n this._textbox.style.display = 'none';\n }\n else {\n this.el.classList.remove('concise');\n this._textbox.style.display = '';\n }\n }\n _picker_change() {\n this.model.set('value', this._colorpicker.value);\n this.touch();\n }\n _text_change() {\n const value = this._validate_color(this._textbox.value, this.model.get('value'));\n this.model.set('value', value);\n this.touch();\n }\n _validate_color(color, fallback) {\n return color.match(/#[a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?$/) ||\n named_colors[color.toLowerCase()]\n ? color\n : fallback;\n }\n}\n/*\n * From a valid html color (named color, 6-digits or 3-digits hex format)\n * return a 6-digits hexadecimal color #rrggbb.\n */\nfunction color2hex(color) {\n return named_colors[color.toLowerCase()] || rgb3_to_rgb6(color);\n}\nfunction rgb3_to_rgb6(rgb) {\n if (rgb.length === 7) {\n return rgb;\n }\n else {\n return ('#' +\n rgb.charAt(1) +\n rgb.charAt(1) +\n rgb.charAt(2) +\n rgb.charAt(2) +\n rgb.charAt(3) +\n rgb.charAt(3));\n }\n}\n//# sourceMappingURL=widget_color.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DescriptionView } from './widget_description';\nimport { CoreDescriptionModel } from './widget_core';\nimport { uuid } from './utils';\nexport function serialize_date(value) {\n if (value === null) {\n return null;\n }\n else {\n return {\n year: value.getUTCFullYear(),\n month: value.getUTCMonth(),\n date: value.getUTCDate(),\n };\n }\n}\nexport function deserialize_date(value) {\n if (value === null) {\n return null;\n }\n else {\n const date = new Date();\n date.setUTCFullYear(value.year, value.month, value.date);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n}\nexport class DatePickerModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: null, _model_name: 'DatePickerModel', _view_name: 'DatePickerView' });\n }\n}\nDatePickerModel.serializers = Object.assign(Object.assign({}, CoreDescriptionModel.serializers), { value: {\n serialize: serialize_date,\n deserialize: deserialize_date,\n } });\nexport class DatePickerView extends DescriptionView {\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-datepicker');\n this._datepicker = document.createElement('input');\n this._datepicker.setAttribute('type', 'date');\n this._datepicker.id = this.label.htmlFor = uuid();\n this.el.appendChild(this._datepicker);\n this.listenTo(this.model, 'change:value', this._update_value);\n this._update_value();\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if (options === undefined || options.updated_view !== this) {\n this._datepicker.disabled = this.model.get('disabled');\n }\n return super.update();\n }\n events() {\n // Typescript doesn't understand that these functions are called, so we\n // specifically use them here so it knows they are being used.\n void this._picker_change;\n void this._picker_focusout;\n return {\n 'change [type=\"date\"]': '_picker_change',\n 'focusout [type=\"date\"]': '_picker_focusout',\n };\n }\n _update_value() {\n const value = this.model.get('value');\n this._datepicker.valueAsDate = value;\n }\n _picker_change() {\n if (!this._datepicker.validity.badInput) {\n this.model.set('value', this._datepicker.valueAsDate);\n this.touch();\n }\n }\n _picker_focusout() {\n if (this._datepicker.validity.badInput) {\n this.model.set('value', null);\n this.touch();\n }\n }\n}\n//# sourceMappingURL=widget_date.js.map","// Copyright (c) Vidar Tonaas Fauske\n// Distributed under the terms of the Modified BSD License.\nimport { uuid } from './utils';\nimport { DescriptionView } from './widget_description';\nimport { CoreDescriptionModel } from './widget_core';\nconst PARSER = /(\\d\\d):(\\d\\d)(:(\\d\\d)(.(\\d{1,3})\\d*)?)?/;\nexport function serialize_time(value) {\n if (value === null) {\n return null;\n }\n else {\n const res = PARSER.exec(value);\n if (res === null) {\n return null;\n }\n return {\n hours: Math.min(23, parseInt(res[1], 10)),\n minutes: Math.min(59, parseInt(res[2], 10)),\n seconds: res[4] ? Math.min(59, parseInt(res[4], 10)) : 0,\n milliseconds: res[6] ? parseInt(res[6], 10) : 0,\n };\n }\n}\nexport function deserialize_time(value) {\n if (value === null) {\n return null;\n }\n else {\n const parts = [\n `${value.hours.toString().padStart(2, '0')}:${value.minutes\n .toString()\n .padStart(2, '0')}`,\n ];\n if (value.seconds > 0 || value.milliseconds > 0) {\n parts.push(`:${value.seconds.toString().padStart(2, '0')}`);\n if (value.milliseconds > 0) {\n parts.push(`.${value.milliseconds.toString().padStart(3, '0')}`);\n }\n }\n return parts.join('');\n }\n}\nexport const time_serializers = {\n serialize: serialize_time,\n deserialize: deserialize_time,\n};\nexport class TimeModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: TimeModel.model_name, _view_name: TimeModel.view_name, value: null, disabled: false, min: null, max: null, step: 60 });\n }\n}\nTimeModel.serializers = Object.assign(Object.assign({}, CoreDescriptionModel.serializers), { value: time_serializers, min: time_serializers, max: time_serializers });\nTimeModel.model_name = 'TimeModel';\nTimeModel.view_name = 'TimeView';\nexport class TimeView extends DescriptionView {\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-timepicker');\n this._timepicker = document.createElement('input');\n this._timepicker.setAttribute('type', 'time');\n this._timepicker.id = this.label.htmlFor = uuid();\n this.el.appendChild(this._timepicker);\n this.listenTo(this.model, 'change:value', this._update_value);\n this.listenTo(this.model, 'change', this.update2);\n this._update_value();\n this.update2();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update2(model, options) {\n if (options === undefined || options.updated_view !== this) {\n this._timepicker.disabled = this.model.get('disabled');\n this._timepicker.min = this.model.get('min');\n this._timepicker.max = this.model.get('max');\n this._timepicker.step = this.model.get('step');\n }\n return super.update();\n }\n events() {\n // Typescript doesn't understand that these functions are called, so we\n // specifically use them here so it knows they are being used.\n void this._picker_change;\n void this._picker_focusout;\n return {\n 'change [type=\"time\"]': '_picker_change',\n 'focusout [type=\"time\"]': '_picker_focusout',\n };\n }\n _update_value(model, newValue, options) {\n if (options === undefined || options.updated_view !== this) {\n this._timepicker.value = this.model.get('value');\n }\n }\n _picker_change() {\n if (!this._timepicker.validity.badInput) {\n this.model.set('value', this._timepicker.value, { updated_view: this });\n this.touch();\n }\n }\n _picker_focusout() {\n if (this._timepicker.validity.badInput) {\n this.model.set('value', null, { updated_view: this });\n this.touch();\n }\n }\n}\n//# sourceMappingURL=widget_time.js.map","// Copyright (c) Vidar Tonaas Fauske\n// Distributed under the terms of the Modified BSD License.\nimport { uuid } from './utils';\nimport { DescriptionView } from './widget_description';\nimport { CoreDescriptionModel } from './widget_core';\nimport { serialize_time } from './widget_time';\nexport function serialize_datetime(value) {\n if (value === null) {\n return null;\n }\n else {\n return {\n year: value.getUTCFullYear(),\n month: value.getUTCMonth(),\n date: value.getUTCDate(),\n hours: value.getUTCHours(),\n minutes: value.getUTCMinutes(),\n seconds: value.getUTCSeconds(),\n milliseconds: value.getUTCMilliseconds(),\n };\n }\n}\nexport function deserialize_datetime(value) {\n if (value === null) {\n return null;\n }\n else {\n const date = new Date();\n date.setUTCFullYear(value.year, value.month, value.date);\n date.setUTCHours(value.hours, value.minutes, value.seconds, value.milliseconds);\n return date;\n }\n}\nexport const datetime_serializers = {\n serialize: serialize_datetime,\n deserialize: deserialize_datetime,\n};\nexport class DatetimeModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'DatetimeModel', _view_name: 'DatetimeView', value: null, disabled: false, min: null, max: null });\n }\n}\nDatetimeModel.serializers = Object.assign(Object.assign({}, CoreDescriptionModel.serializers), { value: datetime_serializers, min: datetime_serializers, max: datetime_serializers });\nexport class DatetimeView extends DescriptionView {\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-datetimepicker');\n const test = document.createElement('input');\n test.type = 'datetime-local';\n if (test.type === 'text') {\n // No native support, split into date and time input:\n this._datepicker = document.createElement('input');\n this._datepicker.setAttribute('type', 'date');\n this._datepicker.id = this.label.htmlFor = uuid();\n this._timepicker = document.createElement('input');\n this._timepicker.setAttribute('type', 'time');\n this._timepicker.id = uuid();\n this.el.appendChild(this._datepicker);\n this.el.appendChild(this._timepicker);\n }\n else {\n this._datetimepicker = test;\n this._datetimepicker.id = this.label.htmlFor = uuid();\n this.el.appendChild(this._datetimepicker);\n }\n this.listenTo(this.model, 'change:value', this._update_value);\n this.listenTo(this.model, 'change', this.update2);\n this._update_value();\n this.update2();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update2(model, options) {\n if (options === undefined || options.updated_view !== this) {\n const min = this.model.get('min');\n const max = this.model.get('max');\n if (this._datetimepicker) {\n this._datetimepicker.disabled = this.model.get('disabled');\n this._datetimepicker.min = Private.dt_as_dt_string(min);\n this._datetimepicker.max = Private.dt_as_dt_string(max);\n }\n else {\n this._datepicker.disabled = this.model.get('disabled');\n this._datepicker.min = Private.dt_as_date_string(min);\n this._datepicker.max = Private.dt_as_date_string(max);\n this._timepicker.disabled = this.model.get('disabled');\n // Don't support min/max time here.\n // It could be added by enabling min time if value is min date,\n // and enabling max time if value is max date, but leave as\n // TODO for now.\n }\n }\n }\n events() {\n // Typescript doesn't understand that these functions are called, so we\n // specifically use them here so it knows they are being used.\n void this._picker_change;\n void this._picker_focusout;\n return {\n 'change [type=\"date\"]': '_picker_change',\n 'change [type=\"time\"]': '_picker_change',\n 'change [type=\"datetime-local\"]': '_picker_change',\n 'focusout [type=\"date\"]': '_picker_focusout',\n 'focusout [type=\"datetime-local\"]': '_picker_focusout',\n 'focusout [type=\"time\"]': '_picker_focusout',\n };\n }\n _update_value(model, newValue, options) {\n if (options === undefined || options.updated_view !== this) {\n const value = this.model.get('value');\n if (this._datetimepicker) {\n this._datetimepicker.value = Private.dt_as_dt_string(value);\n }\n else {\n this._datepicker.valueAsDate = value;\n this._timepicker.value = Private.dt_as_time_string(value);\n }\n }\n }\n _picker_change() {\n if (this._datetimepicker) {\n if (!this._datetimepicker.validity.badInput) {\n const v = this._datetimepicker.value;\n let date = v ? new Date(v) : null;\n if (date && isNaN(date.valueOf())) {\n date = null;\n }\n this.model.set('value', date, { updated_view: this });\n this.touch();\n }\n }\n else {\n if (!this._datepicker.validity.badInput &&\n !this._timepicker.validity.badInput) {\n const date = this._datepicker.valueAsDate;\n const time = serialize_time(this._timepicker.value);\n if (date !== null && time !== null) {\n // * Use local time *\n date.setHours(time.hours, time.minutes, time.seconds, time.milliseconds);\n }\n this.model.set('value', time !== null && date, { updated_view: this });\n this.touch();\n }\n }\n }\n _picker_focusout() {\n const pickers = [this._datetimepicker, this._datepicker, this._timepicker];\n if (pickers.some((p) => p && p.validity.badInput)) {\n this.model.set('value', null);\n this.touch();\n }\n }\n}\nvar Private;\n(function (Private) {\n // eslint-disable-next-line no-inner-declarations\n function dt_as_dt_string(value) {\n if (value === null) {\n return '';\n }\n // Replicate `toISOString()` but in local time zone:\n const parts = [];\n parts.push(`${value.getFullYear().toString().padStart(4, '0')}`);\n parts.push(`-${(value.getMonth() + 1).toString().padStart(2, '0')}`);\n parts.push(`-${value.getDate().toString().padStart(2, '0')}`);\n parts.push(`T${value.getHours().toString().padStart(2, '0')}`);\n parts.push(`:${value.getMinutes().toString().padStart(2, '0')}`);\n if (value.getSeconds() > 0 || value.getMilliseconds() > 0) {\n parts.push(`:${value.getSeconds().toString().padStart(2, '0')}`);\n if (value.getMilliseconds() > 0) {\n parts.push(`.${value.getMilliseconds().toString().padStart(3, '0')}`);\n }\n }\n return parts.join('');\n }\n Private.dt_as_dt_string = dt_as_dt_string;\n // eslint-disable-next-line no-inner-declarations\n function dt_as_date_string(value) {\n return value ? dt_as_dt_string(value).split('T', 2)[0] : '';\n }\n Private.dt_as_date_string = dt_as_date_string;\n // eslint-disable-next-line no-inner-declarations\n function dt_as_time_string(value) {\n return value ? dt_as_dt_string(value).split('T', 2)[1] : '';\n }\n Private.dt_as_time_string = dt_as_time_string;\n})(Private || (Private = {}));\nexport function serialize_naive(value) {\n if (value === null) {\n return null;\n }\n else {\n return {\n year: value.getFullYear(),\n month: value.getMonth(),\n date: value.getDate(),\n hours: value.getHours(),\n minutes: value.getMinutes(),\n seconds: value.getSeconds(),\n milliseconds: value.getMilliseconds(),\n };\n }\n}\nexport function deserialize_naive(value) {\n if (value === null) {\n return null;\n }\n else {\n const date = new Date();\n date.setFullYear(value.year, value.month, value.date);\n date.setHours(value.hours, value.minutes, value.seconds, value.milliseconds);\n return date;\n }\n}\nexport const naive_serializers = {\n serialize: serialize_naive,\n deserialize: deserialize_naive,\n};\nexport class NaiveDatetimeModel extends DatetimeModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'NaiveDatetimeModel' });\n }\n}\nNaiveDatetimeModel.serializers = Object.assign(Object.assign({}, CoreDescriptionModel.serializers), { value: naive_serializers, min: naive_serializers, max: naive_serializers });\n//# sourceMappingURL=widget_datetime.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDescriptionModel } from './widget_core';\nimport { DescriptionStyleModel, DescriptionView } from './widget_description';\nimport { DOMWidgetView } from '@jupyter-widgets/base';\nimport { uuid } from './utils';\nimport { format } from 'd3-format';\nimport noUiSlider from 'nouislider';\nexport class IntModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'IntModel', value: 0 });\n }\n}\nexport class BoundedIntModel extends IntModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'BoundedIntModel', max: 100, min: 0 });\n }\n}\nexport class SliderStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SliderStyleModel' });\n }\n}\nSliderStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { handle_color: {\n selector: '.noUi-handle',\n attribute: 'background-color',\n default: null,\n } });\nexport class IntSliderModel extends BoundedIntModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'IntSliderModel', _view_name: 'IntSliderView', step: 1, orientation: 'horizontal', readout: true, readout_format: 'd', continuous_update: true, style: null, disabled: false });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n this.on('change:readout_format', this.update_readout_format, this);\n this.update_readout_format();\n }\n update_readout_format() {\n this.readout_formatter = format(this.get('readout_format'));\n }\n}\nexport class IntRangeSliderModel extends IntSliderModel {\n}\nexport class BaseIntSliderView extends DescriptionView {\n constructor() {\n super(...arguments);\n this._parse_value = parseInt;\n }\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-slider');\n this.el.classList.add('widget-hslider');\n // Creating noUiSlider instance and scaffolding\n this.$slider = document.createElement('div');\n this.$slider.classList.add('slider');\n // Put the slider in a container\n this.slider_container = document.createElement('div');\n this.slider_container.classList.add('slider-container');\n this.slider_container.appendChild(this.$slider);\n this.el.appendChild(this.slider_container);\n this.readout = document.createElement('div');\n this.el.appendChild(this.readout);\n this.readout.classList.add('widget-readout');\n this.readout.contentEditable = 'true';\n this.readout.style.display = 'none';\n // noUiSlider constructor and event handlers\n this.createSlider();\n // Event handlers\n this.model.on('change:orientation', this.regenSlider, this);\n this.model.on('change:max', this.updateSliderOptions, this);\n this.model.on('change:min', this.updateSliderOptions, this);\n this.model.on('change:step', this.updateSliderOptions, this);\n this.model.on('change:value', this.updateSliderValue, this);\n // Set defaults.\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if (options === undefined || options.updated_view !== this) {\n if (this.model.get('disabled')) {\n this.readout.contentEditable = 'false';\n this.$slider.setAttribute('disabled', true);\n }\n else {\n this.readout.contentEditable = 'true';\n this.$slider.removeAttribute('disabled');\n }\n // Use the right CSS classes for vertical & horizontal sliders\n const orientation = this.model.get('orientation');\n if (orientation === 'vertical') {\n this.el.classList.remove('widget-hslider');\n this.el.classList.add('widget-vslider');\n this.el.classList.remove('widget-inline-hbox');\n this.el.classList.add('widget-inline-vbox');\n }\n else {\n this.el.classList.remove('widget-vslider');\n this.el.classList.add('widget-hslider');\n this.el.classList.remove('widget-inline-vbox');\n this.el.classList.add('widget-inline-hbox');\n }\n const readout = this.model.get('readout');\n if (readout) {\n this.readout.style.display = '';\n this.displayed.then(() => {\n if (this.readout_overflow()) {\n this.readout.classList.add('overflow');\n }\n else {\n this.readout.classList.remove('overflow');\n }\n });\n }\n else {\n this.readout.style.display = 'none';\n }\n }\n return super.update();\n }\n /**\n * Returns true if the readout box content overflows.\n */\n readout_overflow() {\n return this.readout.scrollWidth > this.readout.clientWidth;\n }\n events() {\n return {\n // Dictionary of events and their handlers.\n 'blur [contentEditable=true]': 'handleTextChange',\n 'keydown [contentEditable=true]': 'handleKeyDown',\n };\n }\n handleKeyDown(e) {\n if (e.keyCode === 13) {\n /* keyboard keycodes `enter` */\n e.preventDefault();\n this.handleTextChange();\n }\n }\n /**\n * Create a new noUiSlider object\n */\n createSlider() {\n const orientation = this.model.get('orientation');\n const behavior = this.model.get('behavior');\n noUiSlider.create(this.$slider, {\n start: this.model.get('value'),\n connect: true,\n behaviour: behavior,\n range: {\n min: this.model.get('min'),\n max: this.model.get('max'),\n },\n step: this.model.get('step'),\n animate: false,\n orientation: orientation,\n direction: orientation === 'horizontal' ? 'ltr' : 'rtl',\n format: {\n from: (value) => Number(value),\n to: (value) => this._validate_slide_value(value),\n },\n });\n // Using noUiSlider's 'update' and 'change' events.\n // See reference: https://refreshless.com/nouislider/events-callbacks/\n this.$slider.noUiSlider.on('update', (values, handle) => {\n this.handleSliderUpdateEvent(values, handle);\n });\n this.$slider.noUiSlider.on('change', (values, handle) => {\n this.handleSliderChangeEvent(values, handle);\n });\n }\n /**\n * Recreate/Regenerate a slider object\n * noUiSlider does not support in-place mutation of the orientation\n * state. We therefore need to destroy the current instance\n * and create a new one with the new properties. This is\n * handled in a separate function and has a dedicated event\n * handler.\n */\n regenSlider(e) {\n this.$slider.noUiSlider.destroy();\n this.createSlider();\n }\n /**\n * Validate the value of the slider before sending it to the back-end\n * and applying it to the other views on the page.\n */\n _validate_slide_value(x) {\n return Math.round(x);\n }\n}\nexport class IntRangeSliderView extends BaseIntSliderView {\n constructor() {\n super(...arguments);\n // range numbers can be separated by a hyphen, colon, or an en-dash\n this._range_regex = /^\\s*([+-]?\\d+)\\s*[-:–]\\s*([+-]?\\d+)/;\n }\n update(options) {\n super.update(options);\n const value = this.model.get('value');\n this.readout.textContent = this.valueToString(value);\n if (this.model.get('value') !== value) {\n this.model.set('value', value, { updated_view: this });\n this.touch();\n }\n }\n /**\n * Write value to a string\n */\n valueToString(value) {\n const format = this.model.readout_formatter;\n return value\n .map(function (v) {\n return format(v);\n })\n .join(' – ');\n }\n /**\n * Parse value from a string\n */\n stringToValue(text) {\n if (text === null) {\n return null;\n }\n // ranges can be expressed either 'val-val' or 'val:val' (+spaces)\n const match = this._range_regex.exec(text);\n if (match) {\n return [this._parse_value(match[1]), this._parse_value(match[2])];\n }\n else {\n return null;\n }\n }\n handleTextChange() {\n let value = this.stringToValue(this.readout.textContent);\n const vmin = this.model.get('min');\n const vmax = this.model.get('max');\n // reject input where NaN or lower > upper\n if (value === null ||\n isNaN(value[0]) ||\n isNaN(value[1]) ||\n value[0] > value[1]) {\n this.readout.textContent = this.valueToString(this.model.get('value'));\n }\n else {\n // clamp to range\n value = [\n Math.max(Math.min(value[0], vmax), vmin),\n Math.max(Math.min(value[1], vmax), vmin),\n ];\n if (value[0] !== this.model.get('value')[0] ||\n value[1] !== this.model.get('value')[1]) {\n this.readout.textContent = this.valueToString(value);\n this.model.set('value', value);\n this.touch();\n }\n else {\n this.readout.textContent = this.valueToString(this.model.get('value'));\n }\n }\n }\n /**\n * Called when the slider handle is released after dragging,\n * or by tapping or moving by the arrow keys.\n */\n handleSliderChangeEvent(values, handle) {\n const actual_value = values.map(this._validate_slide_value);\n this.readout.textContent = this.valueToString(actual_value);\n this.handleSliderChanged(values, handle);\n }\n /**\n * Called whilst the slider is dragged, tapped or moved by the arrow keys.\n */\n handleSliderUpdateEvent(values, handle) {\n const actual_value = values.map(this._validate_slide_value);\n this.readout.textContent = this.valueToString(actual_value);\n // Only persist the value while sliding if the continuous_update\n // trait is set to true.\n if (this.model.get('continuous_update')) {\n this.handleSliderChanged(values, handle);\n }\n }\n handleSliderChanged(values, handle) {\n const actual_value = values.map(this._validate_slide_value);\n this.model.set('value', actual_value, { updated_view: this });\n this.touch();\n }\n updateSliderOptions(e) {\n this.$slider.noUiSlider.updateOptions({\n start: this.model.get('value'),\n range: {\n min: this.model.get('min'),\n max: this.model.get('max'),\n },\n step: this.model.get('step'),\n });\n }\n updateSliderValue(model, _, options) {\n if (options.updated_view === this) {\n return;\n }\n const prev_value = this.$slider.noUiSlider.get();\n const value = this.model.get('value');\n if (prev_value[0] !== value[0] || prev_value[1] !== value[1]) {\n this.$slider.noUiSlider.set(value);\n }\n }\n}\nexport class IntSliderView extends BaseIntSliderView {\n update(options) {\n super.update(options);\n const min = this.model.get('min');\n const max = this.model.get('max');\n let value = this.model.get('value');\n if (value > max) {\n value = max;\n }\n else if (value < min) {\n value = min;\n }\n this.readout.textContent = this.valueToString(value);\n if (this.model.get('value') !== value) {\n this.model.set('value', value, { updated_view: this });\n this.touch();\n }\n }\n valueToString(value) {\n const format = this.model.readout_formatter;\n return format(value);\n }\n stringToValue(text) {\n return this._parse_value(text);\n }\n handleTextChange() {\n var _a;\n let value = this.stringToValue((_a = this.readout.textContent) !== null && _a !== void 0 ? _a : '');\n const vmin = this.model.get('min');\n const vmax = this.model.get('max');\n if (isNaN(value)) {\n this.readout.textContent = this.valueToString(this.model.get('value'));\n }\n else {\n value = Math.max(Math.min(value, vmax), vmin);\n if (value !== this.model.get('value')) {\n this.readout.textContent = this.valueToString(value);\n this.model.set('value', value);\n this.touch();\n }\n else {\n this.readout.textContent = this.valueToString(this.model.get('value'));\n }\n }\n }\n handleSliderChangeEvent(values, handle) {\n const actual_value = values.map(this._validate_slide_value);\n this.readout.textContent = this.valueToString(actual_value);\n this.handleSliderChanged(values, handle);\n }\n handleSliderUpdateEvent(values, handle) {\n const actual_value = values.map(this._validate_slide_value);\n this.readout.textContent = this.valueToString(actual_value);\n // Only persist the value while sliding if the continuous_update\n // trait is set to true.\n if (this.model.get('continuous_update')) {\n this.handleSliderChanged(values, handle);\n }\n }\n handleSliderChanged(values, handle) {\n const actual_value = this._validate_slide_value(values[handle]);\n const model_value = this.model.get('value');\n if (parseFloat(model_value) !== actual_value) {\n this.model.set('value', actual_value, { updated_view: this });\n this.touch();\n }\n }\n updateSliderOptions(e) {\n this.$slider.noUiSlider.updateOptions({\n start: this.model.get('value'),\n range: {\n min: this.model.get('min'),\n max: this.model.get('max'),\n },\n step: this.model.get('step'),\n });\n }\n updateSliderValue(model, _, options) {\n if (options.updated_view === this) {\n return;\n }\n const prev_value = this.$slider.noUiSlider.get();\n const value = this.model.get('value');\n if (prev_value !== value) {\n this.$slider.noUiSlider.set(value);\n }\n }\n}\nexport class IntTextModel extends IntModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'IntTextModel', _view_name: 'IntTextView', disabled: false, continuous_update: false });\n }\n}\nexport class BoundedIntTextModel extends BoundedIntModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'BoundedIntTextModel', _view_name: 'IntTextView', disabled: false, continuous_update: false, step: 1 });\n }\n}\nexport class IntTextView extends DescriptionView {\n constructor() {\n super(...arguments);\n this._parse_value = parseInt;\n this._default_step = '1';\n }\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-text');\n this.textbox = document.createElement('input');\n this.textbox.type = 'number';\n this.textbox.required = true;\n this.textbox.id = this.label.htmlFor = uuid();\n this.el.appendChild(this.textbox);\n this.update(); // Set defaults.\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if (options === undefined || options.updated_view !== this) {\n const value = this.model.get('value');\n if (this._parse_value(this.textbox.value) !== value) {\n this.textbox.value = value.toString();\n }\n if (this.model.get('min') !== undefined) {\n this.textbox.min = this.model.get('min');\n }\n if (this.model.get('max') !== undefined) {\n this.textbox.max = this.model.get('max');\n }\n if (this.model.get('step') !== undefined &&\n this.model.get('step') !== null) {\n this.textbox.step = this.model.get('step');\n }\n else {\n this.textbox.step = this._default_step;\n }\n this.textbox.disabled = this.model.get('disabled');\n }\n return super.update();\n }\n events() {\n return {\n 'keydown input': 'handleKeyDown',\n 'keypress input': 'handleKeypress',\n 'keyup input': 'handleKeyUp',\n 'input input': 'handleChanging',\n 'change input': 'handleChanged',\n };\n }\n /**\n * Handle key down\n *\n * Stop propagation so the event isn't sent to the application.\n */\n handleKeyDown(e) {\n e.stopPropagation();\n }\n /**\n * Handles key press\n */\n handleKeypress(e) {\n if (/[e,. ]/.test(String.fromCharCode(e.keyCode))) {\n e.preventDefault();\n }\n }\n /**\n * Handle key up\n */\n handleKeyUp(e) {\n if (e.altKey || e.ctrlKey) {\n return;\n }\n const target = e.target;\n /* remove invalid characters */\n let value = target.value;\n value = value.replace(/[e,.\\s]/g, '');\n if (value.length >= 1) {\n const subvalue = value.substr(1);\n value = value[0] + subvalue.replace(/[+-]/g, '');\n }\n if (target.value !== value) {\n e.preventDefault();\n target.value = value;\n }\n }\n /**\n * Call the submit handler if continuous update is true and we are not\n * obviously incomplete.\n */\n handleChanging(e) {\n const target = e.target;\n const trimmed = target.value.trim();\n if (trimmed === '' || ['-', '-.', '.', '+.', '+'].indexOf(trimmed) >= 0) {\n // incomplete number\n return;\n }\n if (this.model.get('continuous_update')) {\n this.handleChanged(e);\n }\n }\n /**\n * Applies validated input.\n */\n handleChanged(e) {\n const target = e.target;\n let numericalValue = this._parse_value(target.value);\n // If parse failed, reset value to value stored in model.\n if (isNaN(numericalValue)) {\n target.value = this.model.get('value');\n }\n else {\n // Handle both the unbounded and bounded case by\n // checking to see if the max/min properties are defined\n let boundedValue = numericalValue;\n if (this.model.get('max') !== undefined) {\n boundedValue = Math.min(this.model.get('max'), boundedValue);\n }\n if (this.model.get('min') !== undefined) {\n boundedValue = Math.max(this.model.get('min'), boundedValue);\n }\n if (boundedValue !== numericalValue) {\n target.value = boundedValue;\n numericalValue = boundedValue;\n }\n // Apply the value if it has changed.\n if (numericalValue !== this.model.get('value')) {\n this.model.set('value', numericalValue, { updated_view: this });\n this.touch();\n }\n }\n }\n}\nexport class ProgressStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ProgressStyleModel' });\n }\n}\nProgressStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { bar_color: {\n selector: '.progress-bar',\n attribute: 'background-color',\n default: null,\n } });\nexport class IntProgressModel extends BoundedIntModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'IntProgressModel', _view_name: 'ProgressView', orientation: 'horizontal', bar_style: '', style: null });\n }\n}\nexport class ProgressView extends DescriptionView {\n initialize(parameters) {\n super.initialize(parameters);\n this.listenTo(this.model, 'change:bar_style', this.update_bar_style);\n this.luminoWidget.addClass('jupyter-widgets');\n }\n render() {\n super.render();\n const orientation = this.model.get('orientation');\n const className = orientation === 'horizontal' ? 'widget-hprogress' : 'widget-vprogress';\n this.el.classList.add(className);\n this.progress = document.createElement('div');\n this.progress.classList.add('progress');\n this.progress.style.position = 'relative';\n this.el.appendChild(this.progress);\n this.bar = document.createElement('div');\n this.bar.classList.add('progress-bar');\n this.bar.style.position = 'absolute';\n this.bar.style.bottom = '0px';\n this.bar.style.left = '0px';\n this.progress.appendChild(this.bar);\n // Set defaults.\n this.update();\n this.set_bar_style();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n const value = this.model.get('value');\n const max = this.model.get('max');\n const min = this.model.get('min');\n const orientation = this.model.get('orientation');\n const percent = (100.0 * (value - min)) / (max - min);\n if (orientation === 'horizontal') {\n this.el.classList.remove('widget-inline-vbox');\n this.el.classList.remove('widget-vprogress');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-hprogress');\n this.bar.style.width = percent + '%';\n this.bar.style.height = '100%';\n }\n else {\n this.el.classList.remove('widget-inline-hbox');\n this.el.classList.remove('widget-hprogress');\n this.el.classList.add('widget-inline-vbox');\n this.el.classList.add('widget-vprogress');\n this.bar.style.width = '100%';\n this.bar.style.height = percent + '%';\n }\n return super.update();\n }\n update_bar_style() {\n this.update_mapped_classes(ProgressView.class_map, 'bar_style', this.bar);\n }\n set_bar_style() {\n this.set_mapped_classes(ProgressView.class_map, 'bar_style', this.bar);\n }\n}\nProgressView.class_map = {\n success: ['progress-bar-success'],\n info: ['progress-bar-info'],\n warning: ['progress-bar-warning'],\n danger: ['progress-bar-danger'],\n};\nexport class PlayModel extends BoundedIntModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'PlayModel', _view_name: 'PlayView', repeat: false, playing: false, show_repeat: true, interval: 100, step: 1, disabled: false });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n }\n loop() {\n if (!this.get('playing')) {\n return;\n }\n const next_value = this.get('value') + this.get('step');\n if (next_value <= this.get('max')) {\n this.set('value', next_value);\n this.schedule_next();\n }\n else {\n if (this.get('repeat')) {\n this.set('value', this.get('min'));\n this.schedule_next();\n }\n else {\n this.pause();\n }\n }\n this.save_changes();\n }\n schedule_next() {\n this._timerId = window.setTimeout(this.loop.bind(this), this.get('interval'));\n }\n stop() {\n this.pause();\n this.set('value', this.get('min'));\n this.save_changes();\n }\n pause() {\n window.clearTimeout(this._timerId);\n this._timerId = undefined;\n this.set('playing', false);\n this.save_changes();\n }\n animate() {\n if (this._timerId !== undefined) {\n return;\n }\n if (this.get('value') === this.get('max')) {\n // if the value is at the end, reset it first, and then schedule the next\n this.set('value', this.get('min'));\n this.schedule_next();\n this.save_changes();\n }\n else {\n // otherwise directly start with the next value\n // loop will call save_changes in this case\n this.loop();\n }\n this.save_changes();\n }\n play() {\n this.set('playing', !this.get('playing'));\n this.save_changes();\n }\n repeat() {\n this.set('repeat', !this.get('repeat'));\n this.save_changes();\n }\n}\nexport class PlayView extends DOMWidgetView {\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-play');\n this.playPauseButton = document.createElement('button');\n this.stopButton = document.createElement('button');\n this.repeatButton = document.createElement('button');\n this.playPauseButton.className = 'jupyter-button';\n this.stopButton.className = 'jupyter-button';\n this.repeatButton.className = 'jupyter-button';\n this.el.appendChild(this.playPauseButton); // Toggle button with playing\n this.el.appendChild(this.stopButton); // Disable if not playing\n this.el.appendChild(this.repeatButton); // Always enabled, but may be hidden\n const playIcon = document.createElement('i');\n playIcon.className = 'fa fa-play';\n this.playPauseButton.appendChild(playIcon);\n const stopIcon = document.createElement('i');\n stopIcon.className = 'fa fa-stop';\n this.stopButton.appendChild(stopIcon);\n const repeatIcon = document.createElement('i');\n repeatIcon.className = 'fa fa-retweet';\n this.repeatButton.appendChild(repeatIcon);\n this.playPauseButton.onclick = this.model.play.bind(this.model);\n this.stopButton.onclick = this.model.stop.bind(this.model);\n this.repeatButton.onclick = this.model.repeat.bind(this.model);\n this.listenTo(this.model, 'change:playing', this.onPlayingChanged);\n this.listenTo(this.model, 'change:repeat', this.updateRepeat);\n this.listenTo(this.model, 'change:show_repeat', this.updateRepeat);\n this.updatePlaying();\n this.updateRepeat();\n this.update();\n }\n update() {\n const disabled = this.model.get('disabled');\n this.playPauseButton.disabled = disabled;\n this.stopButton.disabled = disabled;\n this.repeatButton.disabled = disabled;\n this.updatePlaying();\n }\n onPlayingChanged() {\n this.updatePlaying();\n const previous = this.model.previous('playing');\n const current = this.model.get('playing');\n if (!previous && current) {\n this.model.animate();\n }\n else {\n this.model.pause();\n }\n }\n updatePlaying() {\n const playing = this.model.get('playing');\n const icon = this.playPauseButton.getElementsByTagName('i')[0];\n if (playing) {\n icon.className = 'fa fa-pause';\n }\n else {\n icon.className = 'fa fa-play';\n }\n }\n updateRepeat() {\n const repeat = this.model.get('repeat');\n this.repeatButton.style.display = this.model.get('show_repeat')\n ? this.playPauseButton.style.display\n : 'none';\n if (repeat) {\n this.repeatButton.classList.add('mod-active');\n }\n else {\n this.repeatButton.classList.remove('mod-active');\n }\n }\n}\n//# sourceMappingURL=widget_int.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDescriptionModel } from './widget_core';\nimport { BaseIntSliderView, IntRangeSliderView, IntSliderView, IntTextView, } from './widget_int';\nimport { format } from 'd3-format';\nimport noUiSlider from 'nouislider';\nexport class FloatModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'FloatModel', value: 0 });\n }\n}\nexport class BoundedFloatModel extends FloatModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'BoundedFloatModel', max: 100.0, min: 0.0 });\n }\n}\nexport class FloatSliderModel extends BoundedFloatModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'FloatSliderModel', _view_name: 'FloatSliderView', step: 1.0, orientation: 'horizontal', _range: false, readout: true, readout_format: '.2f', slider_color: null, continuous_update: true, disabled: false });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n this.on('change:readout_format', this.update_readout_format, this);\n this.update_readout_format();\n }\n update_readout_format() {\n this.readout_formatter = format(this.get('readout_format'));\n }\n}\nexport class FloatLogSliderModel extends BoundedFloatModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'FloatLogSliderModel', _view_name: 'FloatLogSliderView', step: 0.1, orientation: 'horizontal', _range: false, readout: true, readout_format: '.3g', slider_color: null, continuous_update: true, disabled: false, base: 10, value: 1.0, min: 0, max: 4 });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n this.on('change:readout_format', this.update_readout_format, this);\n this.update_readout_format();\n }\n update_readout_format() {\n this.readout_formatter = format(this.get('readout_format'));\n }\n}\nexport class FloatRangeSliderModel extends FloatSliderModel {\n}\nexport class FloatSliderView extends IntSliderView {\n constructor() {\n super(...arguments);\n this._parse_value = parseFloat;\n }\n /**\n * Validate the value of the slider before sending it to the back-end\n * and applying it to the other views on the page.\n */\n _validate_slide_value(x) {\n return x;\n }\n}\nexport class FloatLogSliderView extends BaseIntSliderView {\n constructor() {\n super(...arguments);\n this._parse_value = parseFloat;\n }\n update(options) {\n super.update(options);\n const value = this.model.get('value');\n this.readout.textContent = this.valueToString(value);\n }\n /**\n * Convert from value to exponent\n *\n * @param value the widget value\n * @returns the log-value between the min/max exponents\n */\n logCalc(value) {\n const min = this.model.get('min');\n const max = this.model.get('max');\n const base = this.model.get('base');\n let log_value = Math.log(value) / Math.log(base);\n if (log_value > max) {\n log_value = max;\n }\n else if (log_value < min) {\n log_value = min;\n }\n return log_value;\n }\n createSlider() {\n var _a;\n const orientation = this.model.get('orientation');\n const behavior = this.model.get('behavior');\n noUiSlider.create(this.$slider, {\n start: this.logCalc(this.model.get('value')),\n behaviour: behavior,\n range: {\n min: this.model.get('min'),\n max: this.model.get('max'),\n },\n step: (_a = this.model.get('step')) !== null && _a !== void 0 ? _a : undefined,\n animate: false,\n orientation: orientation,\n direction: orientation === 'horizontal' ? 'ltr' : 'rtl',\n format: {\n from: (value) => Number(value),\n to: (value) => value,\n },\n });\n // Using noUiSlider's 'update' and 'change' events.\n // See reference: https://refreshless.com/nouislider/events-callbacks/\n this.$slider.noUiSlider.on('update', (values, handle) => {\n this.handleSliderUpdateEvent(values, handle);\n });\n this.$slider.noUiSlider.on('change', (values, handle) => {\n this.handleSliderChangeEvent(values, handle);\n });\n }\n /**\n * Write value to a string\n */\n valueToString(value) {\n const format = this.model.readout_formatter;\n return format(value);\n }\n /**\n * Parse value from a string\n */\n stringToValue(text) {\n return text === null ? NaN : this._parse_value(text);\n }\n /**\n * this handles the entry of text into the contentEditable label first, the\n * value is checked if it contains a parseable value then it is clamped\n * within the min-max range of the slider finally, the model is updated if\n * the value is to be changed\n *\n * if any of these conditions are not met, the text is reset\n */\n handleTextChange() {\n let value = this.stringToValue(this.readout.textContent);\n const vmin = this.model.get('min');\n const vmax = this.model.get('max');\n const base = this.model.get('base');\n if (isNaN(value)) {\n this.readout.textContent = this.valueToString(this.model.get('value'));\n }\n else {\n value = Math.max(Math.min(value, Math.pow(base, vmax)), Math.pow(base, vmin));\n if (value !== this.model.get('value')) {\n this.readout.textContent = this.valueToString(value);\n this.model.set('value', value);\n this.touch();\n }\n else {\n this.readout.textContent = this.valueToString(this.model.get('value'));\n }\n }\n }\n /**\n * Called whilst the slider is dragged, tapped or moved by the arrow keys.\n */\n handleSliderUpdateEvent(values, handle) {\n const base = this.model.get('base');\n const actual_value = Math.pow(base, this._validate_slide_value(values[0]));\n this.readout.textContent = this.valueToString(actual_value);\n // Only persist the value while sliding if the continuous_update\n // trait is set to true.\n if (this.model.get('continuous_update')) {\n this.handleSliderChanged(values, handle);\n }\n }\n /**\n * Called when the slider handle is released after dragging,\n * or by tapping or moving by the arrow keys.\n */\n handleSliderChangeEvent(values, handle) {\n const base = this.model.get('base');\n const actual_value = Math.pow(base, this._validate_slide_value(values[0]));\n this.readout.textContent = this.valueToString(actual_value);\n this.handleSliderChanged(values, handle);\n }\n /**\n * Called when the slider value has changed.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n handleSliderChanged(values, handle) {\n if (this._updating_slider) {\n return;\n }\n const base = this.model.get('base');\n const actual_value = Math.pow(base, this._validate_slide_value(values[0]));\n this.model.set('value', actual_value, { updated_view: this });\n this.touch();\n }\n updateSliderValue(model, value, options) {\n if (options.updated_view === this) {\n return;\n }\n const log_value = this.logCalc(this.model.get('value'));\n this.$slider.noUiSlider.set(log_value);\n }\n updateSliderOptions(e) {\n this.$slider.noUiSlider.updateOptions({\n start: this.logCalc(this.model.get('value')),\n range: {\n min: this.model.get('min'),\n max: this.model.get('max'),\n },\n step: this.model.get('step'),\n });\n }\n _validate_slide_value(x) {\n return x;\n }\n}\nexport class FloatRangeSliderView extends IntRangeSliderView {\n constructor() {\n super(...arguments);\n this._parse_value = parseFloat;\n // matches: whitespace?, float, whitespace?, (hyphen, colon, or en-dash), whitespace?, float\n this._range_regex = /^\\s*([+-]?(?:\\d*\\.?\\d+|\\d+\\.)(?:[eE][-:]?\\d+)?)\\s*[-:–]\\s*([+-]?(?:\\d*\\.?\\d+|\\d+\\.)(?:[eE][+-]?\\d+)?)/;\n }\n /**\n * Validate the value of the slider before sending it to the back-end\n * and applying it to the other views on the page.\n */\n _validate_slide_value(x) {\n return x;\n }\n}\nexport class FloatTextModel extends FloatModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'FloatTextModel', _view_name: 'FloatTextView', disabled: false, continuous_update: false });\n }\n}\nexport class BoundedFloatTextModel extends BoundedFloatModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'BoundedFloatTextModel', _view_name: 'FloatTextView', disabled: false, continuous_update: false, step: 0.1 });\n }\n}\nexport class FloatTextView extends IntTextView {\n constructor() {\n super(...arguments);\n this._parse_value = parseFloat;\n this._default_step = 'any';\n }\n /**\n * Handle key press\n */\n handleKeypress(e) {\n // Overwrite IntTextView's handleKeypress\n // which prevents decimal points.\n e.stopPropagation();\n }\n /**\n * Handle key up\n */\n handleKeyUp(e) {\n // Overwrite IntTextView's handleKeyUp\n // which prevents decimal points.\n }\n}\nexport class FloatProgressModel extends BoundedFloatModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'FloatProgressModel', _view_name: 'ProgressView', orientation: 'horizontal', bar_style: '', style: null });\n }\n}\n//# sourceMappingURL=widget_float.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDOMWidgetModel } from './widget_core';\nimport { DOMWidgetView, unpack_models, ViewList, JupyterLuminoPanelWidget, reject, } from '@jupyter-widgets/base';\nimport { Widget, Panel } from '@lumino/widgets';\nimport { ArrayExt } from '@lumino/algorithm';\nimport * as utils from './utils';\nimport $ from 'jquery';\nexport class ControllerButtonModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ControllerButtonModel', _view_name: 'ControllerButtonView', value: 0.0, pressed: false });\n }\n}\n/**\n * Very simple view for a gamepad button.\n */\nexport class ControllerButtonView extends DOMWidgetView {\n render() {\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-controller-button');\n this.el.style.width = 'fit-content';\n this.support = document.createElement('div');\n this.support.style.position = 'relative';\n this.support.style.margin = '1px';\n this.support.style.width = '16px';\n this.support.style.height = '16px';\n this.support.style.border = '1px solid black';\n this.support.style.background = 'lightgray';\n this.el.appendChild(this.support);\n this.bar = document.createElement('div');\n this.bar.style.position = 'absolute';\n this.bar.style.width = '100%';\n this.bar.style.bottom = '0px';\n this.bar.style.background = 'gray';\n this.support.appendChild(this.bar);\n this.update();\n this.label = document.createElement('div');\n this.label.textContent = this.model.get('description');\n this.label.style.textAlign = 'center';\n this.el.appendChild(this.label);\n }\n update() {\n this.bar.style.height = 100 * this.model.get('value') + '%';\n }\n}\nexport class ControllerAxisModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ControllerAxisModel', _view_name: 'ControllerAxisView', value: 0.0 });\n }\n}\n/**\n * Very simple view for a gamepad axis.\n */\nexport class ControllerAxisView extends DOMWidgetView {\n render() {\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-controller-axis');\n this.el.style.width = '16px';\n this.el.style.padding = '4px';\n this.support = document.createElement('div');\n this.support.style.position = 'relative';\n this.support.style.margin = '1px';\n this.support.style.width = '4px';\n this.support.style.height = '64px';\n this.support.style.border = '1px solid black';\n this.support.style.background = 'lightgray';\n this.bullet = document.createElement('div');\n this.bullet.style.position = 'absolute';\n this.bullet.style.margin = '-3px';\n this.bullet.style.boxSizing = 'unset';\n this.bullet.style.width = '10px';\n this.bullet.style.height = '10px';\n this.bullet.style.background = 'gray';\n this.label = document.createElement('div');\n this.label.textContent = this.model.get('description');\n this.label.style.textAlign = 'center';\n this.support.appendChild(this.bullet);\n this.el.appendChild(this.support);\n this.el.appendChild(this.label);\n this.update();\n }\n update() {\n this.bullet.style.top = 50 * (this.model.get('value') + 1) + '%';\n }\n}\nexport class ControllerModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ControllerModel', _view_name: 'ControllerView', index: 0, name: '', mapping: '', connected: false, timestamp: 0, buttons: [], axes: [] });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n if (navigator.getGamepads === void 0) {\n // Checks if the browser supports the gamepad API\n this.readout = 'This browser does not support gamepads.';\n console.error(this.readout);\n }\n else {\n // Start the wait loop, and listen to updates of the only\n // user-provided attribute, the gamepad index.\n this.readout = 'Connect gamepad and press any button.';\n if (this.get('connected')) {\n // No need to re-create Button and Axis widgets, re-use\n // the models provided by the backend which may already\n // be wired to other things.\n this.update_loop();\n }\n else {\n // Wait for a gamepad to be connected.\n this.wait_loop();\n }\n }\n }\n /**\n * Waits for a gamepad to be connected at the provided index.\n * Once one is connected, it will start the update loop, which\n * populates the update of axes and button values.\n */\n wait_loop() {\n const index = this.get('index');\n const pad = navigator.getGamepads()[index];\n if (pad) {\n this.setup(pad).then((controls) => {\n this.set(controls);\n this.save_changes();\n window.requestAnimationFrame(this.update_loop.bind(this));\n });\n }\n else {\n window.requestAnimationFrame(this.wait_loop.bind(this));\n }\n }\n /**\n * Given a native gamepad object, returns a promise for a dictionary of\n * controls, of the form\n * {\n * buttons: list of Button models,\n * axes: list of Axis models,\n * }\n */\n setup(pad) {\n // Set up the main gamepad attributes\n this.set({\n name: pad.id,\n mapping: pad.mapping,\n connected: pad.connected,\n timestamp: pad.timestamp,\n });\n // Create buttons and axes. When done, start the update loop\n return utils.resolvePromisesDict({\n buttons: Promise.all(pad.buttons.map((btn, index) => {\n return this._create_button_model(index);\n })),\n axes: Promise.all(pad.axes.map((axis, index) => {\n return this._create_axis_model(index);\n })),\n });\n }\n /**\n * Update axes and buttons values, until the gamepad is disconnected.\n * When the gamepad is disconnected, this.reset_gamepad is called.\n */\n update_loop() {\n const index = this.get('index');\n const id = this.get('name');\n const pad = navigator.getGamepads()[index];\n if (pad && index === pad.index && id === pad.id) {\n this.set({\n timestamp: pad.timestamp,\n connected: pad.connected,\n });\n this.save_changes();\n this.get('buttons').forEach(function (model, index) {\n model.set({\n value: pad.buttons[index].value,\n pressed: pad.buttons[index].pressed,\n });\n model.save_changes();\n });\n this.get('axes').forEach(function (model, index) {\n model.set('value', pad.axes[index]);\n model.save_changes();\n });\n window.requestAnimationFrame(this.update_loop.bind(this));\n }\n else {\n this.reset_gamepad();\n }\n }\n /**\n * Resets the gamepad attributes, and start the wait_loop.\n */\n reset_gamepad() {\n this.get('buttons').forEach(function (button) {\n button.close();\n });\n this.get('axes').forEach(function (axis) {\n axis.close();\n });\n this.set({\n name: '',\n mapping: '',\n connected: false,\n timestamp: 0.0,\n buttons: [],\n axes: [],\n });\n this.save_changes();\n window.requestAnimationFrame(this.wait_loop.bind(this));\n }\n /**\n * Creates a gamepad button widget.\n */\n _create_button_model(index) {\n return this.widget_manager\n .new_widget({\n model_name: 'ControllerButtonModel',\n model_module: '@jupyter-widgets/controls',\n model_module_version: this.get('_model_module_version'),\n view_name: 'ControllerButtonView',\n view_module: '@jupyter-widgets/controls',\n view_module_version: this.get('_view_module_version'),\n })\n .then(function (model) {\n model.set('description', index);\n return model;\n });\n }\n /**\n * Creates a gamepad axis widget.\n */\n _create_axis_model(index) {\n return this.widget_manager\n .new_widget({\n model_name: 'ControllerAxisModel',\n model_module: '@jupyter-widgets/controls',\n model_module_version: this.get('_model_module_version'),\n view_name: 'ControllerAxisView',\n view_module: '@jupyter-widgets/controls',\n view_module_version: this.get('_view_module_version'),\n })\n .then(function (model) {\n model.set('description', index);\n return model;\n });\n }\n}\nControllerModel.serializers = Object.assign(Object.assign({}, CoreDOMWidgetModel.serializers), { buttons: { deserialize: unpack_models }, axes: { deserialize: unpack_models } });\n/**\n * A simple view for a gamepad.\n */\nexport class ControllerView extends DOMWidgetView {\n _createElement(tagName) {\n this.luminoWidget = new JupyterLuminoPanelWidget({ view: this });\n return this.luminoWidget.node;\n }\n _setElement(el) {\n if (this.el || el !== this.luminoWidget.node) {\n // Boxes don't allow setting the element beyond the initial creation.\n throw new Error('Cannot reset the DOM element.');\n }\n this.el = this.luminoWidget.node;\n this.$el = $(this.luminoWidget.node);\n }\n initialize(parameters) {\n super.initialize(parameters);\n this.button_views = new ViewList(this.add_button, null, this);\n this.listenTo(this.model, 'change:buttons', (model, value) => {\n this.button_views.update(value);\n });\n this.axis_views = new ViewList(this.add_axis, null, this);\n this.listenTo(this.model, 'change:axes', (model, value) => {\n this.axis_views.update(value);\n });\n this.listenTo(this.model, 'change:name', this.update_label);\n }\n render() {\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-controller');\n this.label = document.createElement('div');\n this.el.appendChild(this.label);\n this.axis_box = new Panel();\n this.axis_box.node.style.display = 'flex';\n this.luminoWidget.addWidget(this.axis_box);\n this.button_box = new Panel();\n this.button_box.node.style.display = 'flex';\n this.luminoWidget.addWidget(this.button_box);\n this.button_views.update(this.model.get('buttons'));\n this.axis_views.update(this.model.get('axes'));\n this.update_label();\n }\n update_label() {\n this.label.textContent = this.model.get('name') || this.model.readout;\n }\n add_button(model) {\n // we insert a dummy element so the order is preserved when we add\n // the rendered content later.\n const dummy = new Widget();\n this.button_box.addWidget(dummy);\n return this.create_child_view(model)\n .then((view) => {\n // replace the dummy widget with the new one.\n const i = ArrayExt.firstIndexOf(this.button_box.widgets, dummy);\n this.button_box.insertWidget(i, view.luminoWidget);\n dummy.dispose();\n return view;\n })\n .catch(reject('Could not add child button view to controller', true));\n }\n add_axis(model) {\n // we insert a dummy element so the order is preserved when we add\n // the rendered content later.\n const dummy = new Widget();\n this.axis_box.addWidget(dummy);\n return this.create_child_view(model)\n .then((view) => {\n // replace the dummy widget with the new one.\n const i = ArrayExt.firstIndexOf(this.axis_box.widgets, dummy);\n this.axis_box.insertWidget(i, view.luminoWidget);\n dummy.dispose();\n return view;\n })\n .catch(reject('Could not add child axis view to controller', true));\n }\n remove() {\n super.remove();\n this.button_views.remove();\n this.axis_views.remove();\n }\n}\n//# sourceMappingURL=widget_controller.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDescriptionModel } from './widget_core';\nimport { DescriptionStyleModel, DescriptionView } from './widget_description';\nimport { uuid } from './utils';\nimport noUiSlider from 'nouislider';\nimport * as utils from './utils';\nexport class SelectionModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SelectionModel', index: '', _options_labels: [], disabled: false });\n }\n}\nexport class SelectionView extends DescriptionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render(); // Incl. setting some defaults.\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n super.update();\n // Disable listbox if needed\n if (this.listbox) {\n this.listbox.disabled = this.model.get('disabled');\n }\n // Set tabindex\n this.updateTabindex();\n this.updateTooltip();\n }\n updateTabindex() {\n if (!this.listbox) {\n return; // we might be constructing the parent\n }\n const tabbable = this.model.get('tabbable');\n if (tabbable === true) {\n this.listbox.setAttribute('tabIndex', '0');\n }\n else if (tabbable === false) {\n this.listbox.setAttribute('tabIndex', '-1');\n }\n else if (tabbable === null) {\n this.listbox.removeAttribute('tabIndex');\n }\n }\n updateTooltip() {\n if (!this.listbox)\n return; // we might be constructing the parent\n const title = this.model.get('tooltip');\n if (!title) {\n this.listbox.removeAttribute('title');\n }\n else if (this.model.get('description').length === 0) {\n this.listbox.setAttribute('title', title);\n }\n }\n}\nexport class DropdownModel extends SelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'DropdownModel', _view_name: 'DropdownView', button_style: '' });\n }\n}\n// TODO: Make a Lumino dropdown control, wrapped in DropdownView. Also, fix\n// bugs in keyboard handling. See\n// https://github.com/jupyter-widgets/ipywidgets/issues/1055 and\n// https://github.com/jupyter-widgets/ipywidgets/issues/1049\n// For now, we subclass SelectView to provide DropdownView\n// For the old code, see commit f68bfbc566f3a78a8f3350b438db8ed523ce3642\nexport class DropdownView extends SelectionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-dropdown');\n this.listbox = document.createElement('select');\n this.listbox.id = this.label.htmlFor = uuid();\n this.el.appendChild(this.listbox);\n this._updateOptions();\n this.update();\n }\n /**\n * Update the contents of this view\n */\n update(options) {\n // Debounce set calls from ourselves:\n if ((options === null || options === void 0 ? void 0 : options.updated_view) !== this) {\n const optsChanged = this.model.hasChanged('_options_labels');\n if (optsChanged) {\n // Need to update options:\n this._updateOptions();\n }\n }\n // Select the correct element\n const index = this.model.get('index');\n this.listbox.selectedIndex = index === null ? -1 : index;\n return super.update();\n }\n _updateOptions() {\n this.listbox.textContent = '';\n const items = this.model.get('_options_labels');\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n const option = document.createElement('option');\n option.textContent = item.replace(/ /g, '\\xa0'); // space ->  \n option.setAttribute('data-value', encodeURIComponent(item));\n option.value = item;\n this.listbox.appendChild(option);\n }\n }\n events() {\n return {\n 'change select': '_handle_change',\n };\n }\n /**\n * Handle when a new value is selected.\n */\n _handle_change() {\n this.model.set('index', this.listbox.selectedIndex === -1 ? null : this.listbox.selectedIndex, { updated_view: this });\n this.touch();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.listbox.focus();\n }\n else if (content.do === 'blur') {\n this.listbox.blur();\n }\n }\n}\nexport class SelectModel extends SelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SelectModel', _view_name: 'SelectView', rows: 5 });\n }\n}\nexport class SelectView extends SelectionView {\n /**\n * Public constructor.\n */\n initialize(parameters) {\n super.initialize(parameters);\n // Create listbox here so that subclasses can modify it before it is populated in render()\n this.listbox = document.createElement('select');\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-select');\n this.listbox.id = this.label.htmlFor = uuid();\n this.el.appendChild(this.listbox);\n this._updateOptions();\n this.update();\n this.updateSelection();\n }\n /**\n * Update the contents of this view\n */\n update(options) {\n // Don't update options/index on set calls from ourselves:\n if ((options === null || options === void 0 ? void 0 : options.updated_view) !== this) {\n const optsChange = this.model.hasChanged('_options_labels');\n const idxChange = this.model.hasChanged('index');\n if (optsChange || idxChange) {\n // Stash the index to guard against change events\n const idx = this.model.get('index');\n if (optsChange) {\n this._updateOptions();\n }\n this.updateSelection(idx);\n }\n }\n super.update();\n let rows = this.model.get('rows');\n if (rows === null) {\n rows = '';\n }\n this.listbox.setAttribute('size', rows);\n }\n updateSelection(index) {\n index = index || this.model.get('index');\n this.listbox.selectedIndex = index === null ? -1 : index;\n }\n _updateOptions() {\n this.listbox.textContent = '';\n const items = this.model.get('_options_labels');\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n const option = document.createElement('option');\n option.textContent = item.replace(/ /g, '\\xa0'); // space ->  \n option.setAttribute('data-value', encodeURIComponent(item));\n option.value = item;\n this.listbox.appendChild(option);\n }\n }\n events() {\n return {\n 'change select': '_handle_change',\n };\n }\n /**\n * Handle when a new value is selected.\n */\n _handle_change() {\n this.model.set('index', this.listbox.selectedIndex, { updated_view: this });\n this.touch();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do == 'focus') {\n this.listbox.focus();\n }\n else if (content.do == 'blur') {\n this.listbox.blur();\n }\n }\n}\nexport class RadioButtonsModel extends SelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'RadioButtonsModel', _view_name: 'RadioButtonsView', tooltips: [], icons: [], button_style: '' });\n }\n}\nexport class RadioButtonsView extends DescriptionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-radio');\n this.container = document.createElement('div');\n this.el.appendChild(this.container);\n this.container.classList.add('widget-radio-box');\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n const items = this.model.get('_options_labels');\n const radios = Array.from(this.container.querySelectorAll('input[type=\"radio\"]')).map((x) => x.value);\n let stale = items.length !== radios.length;\n if (!stale) {\n for (let i = 0, len = items.length; i < len; ++i) {\n if (radios[i] !== items[i]) {\n stale = true;\n break;\n }\n }\n }\n if (stale && (options === undefined || options.updated_view !== this)) {\n // Add items to the DOM.\n this.container.textContent = '';\n items.forEach((item, index) => {\n const label = document.createElement('label');\n label.textContent = item;\n this.container.appendChild(label);\n const radio = document.createElement('input');\n radio.setAttribute('type', 'radio');\n radio.value = index.toString();\n radio.setAttribute('data-value', encodeURIComponent(item));\n label.appendChild(radio);\n });\n }\n items.forEach((item, index) => {\n const item_query = 'input[data-value=\"' + encodeURIComponent(item) + '\"]';\n const radio = this.container.querySelectorAll(item_query);\n if (radio.length > 0) {\n const radio_el = radio[0];\n radio_el.checked = this.model.get('index') === index;\n radio_el.disabled = this.model.get('disabled');\n }\n });\n // Schedule adjustPadding asynchronously to\n // allow dom elements to be created properly\n setTimeout(this.adjustPadding, 0, this);\n return super.update(options);\n }\n /**\n * Adjust Padding to Multiple of Line Height\n *\n * Adjust margins so that the overall height\n * is a multiple of a single line height.\n *\n * This widget needs it because radio options\n * are spaced tighter than individual widgets\n * yet we would like the full widget line up properly\n * when displayed side-by-side with other widgets.\n */\n adjustPadding(e) {\n // Vertical margins on a widget\n const elStyles = window.getComputedStyle(e.el);\n const margins = parseInt(elStyles.marginTop, 10) + parseInt(elStyles.marginBottom, 10);\n // Total spaces taken by a single-line widget\n const lineHeight = e.label.offsetHeight + margins;\n // Current adjustment value on this widget\n const cStyles = window.getComputedStyle(e.container);\n const containerMargin = parseInt(cStyles.marginBottom, 10);\n // How far we are off from a multiple of single windget lines\n const diff = (e.el.offsetHeight + margins - containerMargin) % lineHeight;\n // Apply the new adjustment\n const extraMargin = diff === 0 ? 0 : lineHeight - diff;\n e.container.style.marginBottom = extraMargin + 'px';\n }\n events() {\n return {\n 'click input[type=\"radio\"]': '_handle_click',\n };\n }\n /**\n * Handle when a value is clicked.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n _handle_click(event) {\n const target = event.target;\n this.model.set('index', parseInt(target.value, 10), { updated_view: this });\n this.touch();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do == 'focus') {\n const firstItem = this.container.firstElementChild;\n firstItem.focus();\n }\n else if (content.do == 'blur') {\n for (let i = 0; i < this.container.children.length; i++) {\n const item = this.container.children[i];\n item.blur();\n }\n }\n }\n}\nexport class ToggleButtonsStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ToggleButtonsStyleModel' });\n }\n}\nToggleButtonsStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { button_width: {\n selector: '.widget-toggle-button',\n attribute: 'width',\n default: null,\n }, font_weight: {\n selector: '.widget-toggle-button',\n attribute: 'font-weight',\n default: '',\n } });\nexport class ToggleButtonsModel extends SelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ToggleButtonsModel', _view_name: 'ToggleButtonsView' });\n }\n}\nexport class ToggleButtonsView extends DescriptionView {\n initialize(options) {\n this._css_state = {};\n super.initialize(options);\n this.listenTo(this.model, 'change:button_style', this.update_button_style);\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-toggle-buttons');\n this.buttongroup = document.createElement('div');\n this.el.appendChild(this.buttongroup);\n this.update();\n this.set_button_style();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n const items = this.model.get('_options_labels');\n const icons = this.model.get('icons') || [];\n const previous_icons = this.model.previous('icons') || [];\n const previous_bstyle = ToggleButtonsView.classMap[this.model.previous('button_style')] || '';\n const tooltips = this.model.get('tooltips') || [];\n const disabled = this.model.get('disabled');\n const buttons = this.buttongroup.querySelectorAll('button');\n const values = Array.from(buttons).map((x) => x.value);\n let stale = false;\n for (let i = 0, len = items.length; i < len; ++i) {\n if (values[i] !== items[i] || icons[i] !== previous_icons[i]) {\n stale = true;\n break;\n }\n }\n if (stale && (options === undefined || options.updated_view !== this)) {\n // Add items to the DOM.\n this.buttongroup.textContent = '';\n items.forEach((item, index) => {\n let item_html;\n const empty = item.trim().length === 0 &&\n (!icons[index] || icons[index].trim().length === 0);\n if (empty) {\n item_html = ' ';\n }\n else {\n item_html = utils.escape_html(item);\n }\n const icon = document.createElement('i');\n const button = document.createElement('button');\n if (icons[index]) {\n icon.className = 'fa fa-' + icons[index];\n }\n button.setAttribute('type', 'button');\n button.className = 'widget-toggle-button jupyter-button';\n if (previous_bstyle) {\n button.classList.add(previous_bstyle);\n }\n button.innerHTML = item_html;\n button.setAttribute('data-value', encodeURIComponent(item));\n button.setAttribute('value', index.toString());\n button.appendChild(icon);\n button.disabled = disabled;\n if (tooltips[index]) {\n button.setAttribute('title', tooltips[index]);\n }\n this.update_style_traits(button);\n this.buttongroup.appendChild(button);\n });\n }\n // Select active button.\n items.forEach((item, index) => {\n const item_query = '[data-value=\"' + encodeURIComponent(item) + '\"]';\n const button = this.buttongroup.querySelector(item_query);\n if (this.model.get('index') === index) {\n button.classList.add('mod-active');\n }\n else {\n button.classList.remove('mod-active');\n }\n });\n this.stylePromise.then(function (style) {\n if (style) {\n style.style();\n }\n });\n return super.update(options);\n }\n update_style_traits(button) {\n for (const name in this._css_state) {\n if (Object.prototype.hasOwnProperty.call(this._css_state, 'name')) {\n if (name === 'margin') {\n this.buttongroup.style[name] = this._css_state[name];\n }\n else if (name !== 'width') {\n if (button) {\n button.style[name] = this._css_state[name];\n }\n else {\n const buttons = this.buttongroup.querySelectorAll('button');\n if (buttons.length) {\n buttons[0].style[name] = this._css_state[name];\n }\n }\n }\n }\n }\n }\n update_button_style() {\n const buttons = this.buttongroup.querySelectorAll('button');\n for (let i = 0; i < buttons.length; i++) {\n this.update_mapped_classes(ToggleButtonsView.classMap, 'button_style', buttons[i]);\n }\n }\n set_button_style() {\n const buttons = this.buttongroup.querySelectorAll('button');\n for (let i = 0; i < buttons.length; i++) {\n this.set_mapped_classes(ToggleButtonsView.classMap, 'button_style', buttons[i]);\n }\n }\n events() {\n return {\n 'click button': '_handle_click',\n };\n }\n /**\n * Handle when a value is clicked.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n _handle_click(event) {\n const target = event.target;\n this.model.set('index', parseInt(target.value, 10), { updated_view: this });\n this.touch();\n // We also send a clicked event, since the value is only set if it changed.\n // See https://github.com/jupyter-widgets/ipywidgets/issues/763\n this.send({ event: 'click' });\n }\n}\n(function (ToggleButtonsView) {\n ToggleButtonsView.classMap = {\n primary: ['mod-primary'],\n success: ['mod-success'],\n info: ['mod-info'],\n warning: ['mod-warning'],\n danger: ['mod-danger'],\n };\n})(ToggleButtonsView || (ToggleButtonsView = {}));\nexport class SelectionSliderModel extends SelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SelectionSliderModel', _view_name: 'SelectionSliderView', orientation: 'horizontal', readout: true, continuous_update: true });\n }\n}\nexport class SelectionSliderView extends DescriptionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-hslider');\n this.el.classList.add('widget-slider');\n // Creating noUiSlider instance and scaffolding\n this.$slider = document.createElement('div');\n this.$slider.classList.add('slider');\n // Put the slider in a container\n this.slider_container = document.createElement('div');\n this.slider_container.classList.add('slider-container');\n this.slider_container.appendChild(this.$slider);\n this.el.appendChild(this.slider_container);\n this.readout = document.createElement('div');\n this.el.appendChild(this.readout);\n this.readout.classList.add('widget-readout');\n this.readout.style.display = 'none';\n // noUiSlider constructor and event handlers\n this.createSlider();\n // Event handlers\n this.model.on('change:orientation', this.regenSlider, this);\n this.model.on('change:index', this.updateSliderValue, this);\n // Set defaults.\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if ((options === null || options === void 0 ? void 0 : options.updated_view) !== this) {\n this.updateSliderOptions(this.model);\n const orientation = this.model.get('orientation');\n const disabled = this.model.get('disabled');\n if (disabled) {\n this.readout.contentEditable = 'false';\n this.$slider.setAttribute('disabled', true);\n }\n else {\n this.readout.contentEditable = 'true';\n this.$slider.removeAttribute('disabled');\n }\n // Use the right CSS classes for vertical & horizontal sliders\n if (orientation === 'vertical') {\n this.el.classList.remove('widget-hslider');\n this.el.classList.remove('widget-inline-hbox');\n this.el.classList.add('widget-vslider');\n this.el.classList.add('widget-inline-vbox');\n }\n else {\n this.el.classList.remove('widget-vslider');\n this.el.classList.remove('widget-inline-vbox');\n this.el.classList.add('widget-hslider');\n this.el.classList.add('widget-inline-hbox');\n }\n const readout = this.model.get('readout');\n if (readout) {\n // this.$readout.show();\n this.readout.style.display = '';\n }\n else {\n // this.$readout.hide();\n this.readout.style.display = 'none';\n }\n this.updateSelection();\n }\n return super.update(options);\n }\n regenSlider(e) {\n this.$slider.noUiSlider.destroy();\n this.createSlider();\n }\n createSlider() {\n const labels = this.model.get('_options_labels');\n const min = 0;\n const max = labels.length - 1;\n const orientation = this.model.get('orientation');\n const behavior = this.model.get('behavior');\n noUiSlider.create(this.$slider, {\n start: this.model.get('index'),\n connect: true,\n behaviour: behavior,\n range: {\n min: min,\n max: max,\n },\n step: 1,\n animate: false,\n orientation: orientation,\n direction: orientation === 'horizontal' ? 'ltr' : 'rtl',\n format: {\n from: (value) => Number(value),\n to: (value) => Math.round(value),\n },\n });\n // Using noUiSlider's 'update' and 'change' events.\n // See reference: https://refreshless.com/nouislider/events-callbacks/\n this.$slider.noUiSlider.on('update', (values, handle) => {\n this.handleSliderUpdateEvent(values, handle);\n });\n this.$slider.noUiSlider.on('change', (values, handle) => {\n this.handleSliderChangeEvent(values, handle);\n });\n }\n events() {\n return {\n slide: 'handleSliderChange',\n slidestop: 'handleSliderChanged',\n };\n }\n updateSelection() {\n const index = this.model.get('index');\n this.updateReadout(index);\n }\n updateReadout(index) {\n const value = this.model.get('_options_labels')[index];\n this.readout.textContent = value;\n }\n /**\n * Called whilst the slider is dragged, tapped or moved by the arrow keys.\n */\n handleSliderUpdateEvent(values, handle) {\n const index = values[0];\n this.updateReadout(index);\n // Only persist the value while sliding if the continuous_update\n // trait is set to true.\n if (this.model.get('continuous_update')) {\n this.handleSliderChanged(values, handle);\n }\n }\n /**\n * Called when the slider handle is released after dragging,\n * or by tapping or moving by the arrow keys.\n */\n handleSliderChangeEvent(values, handle) {\n const index = values[0];\n this.updateReadout(index);\n this.handleSliderChanged(values, handle);\n }\n /**\n * Called when the slider value has changed.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n handleSliderChanged(values, handle) {\n const index = values[0];\n this.updateReadout(index);\n this.model.set('index', index, { updated_view: this });\n this.touch();\n }\n updateSliderOptions(e) {\n const labels = this.model.get('_options_labels');\n const min = 0;\n const max = labels.length - 1;\n this.$slider.noUiSlider.updateOptions({\n start: this.model.get('index'),\n range: {\n min: min,\n max: max,\n },\n step: 1,\n });\n }\n updateSliderValue(model, _, options) {\n if (options.updated_view === this) {\n return;\n }\n const prev_index = this.$slider.noUiSlider.get();\n const index = this.model.get('index');\n if (prev_index !== index) {\n this.$slider.noUiSlider.set(index);\n }\n }\n}\nexport class MultipleSelectionModel extends SelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'MultipleSelectionModel' });\n }\n}\nexport class SelectMultipleModel extends MultipleSelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SelectMultipleModel', _view_name: 'SelectMultipleView', rows: null });\n }\n}\nexport class SelectMultipleView extends SelectView {\n /**\n * Public constructor.\n */\n initialize(parameters) {\n super.initialize(parameters);\n this.listbox.multiple = true;\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-select-multiple');\n }\n updateSelection() {\n const selected = this.model.get('index') || [];\n const listboxOptions = this.listbox.options;\n // Clear the selection\n this.listbox.selectedIndex = -1;\n // Select the appropriate options\n selected.forEach((i) => {\n listboxOptions[i].selected = true;\n });\n }\n /**\n * Handle when a new value is selected.\n */\n _handle_change() {\n const index = Array.prototype.map.call(this.listbox.selectedOptions || [], function (option) {\n return option.index;\n });\n this.model.set('index', index, { updated_view: this });\n this.touch();\n }\n}\nexport class SelectionRangeSliderModel extends MultipleSelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SelectionSliderModel', _view_name: 'SelectionSliderView', orientation: 'horizontal', readout: true, continuous_update: true });\n }\n}\nexport class SelectionRangeSliderView extends SelectionSliderView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n }\n updateSelection(index) {\n index = index || this.model.get('index');\n this.updateReadout(index);\n }\n updateReadout(index) {\n const labels = this.model.get('_options_labels');\n const minValue = labels[index[0]];\n const maxValue = labels[index[1]];\n this.readout.textContent = `${minValue}-${maxValue}`;\n }\n /**\n * Called when the slider value is changing.\n */\n handleSliderUpdateEvent(values, handle) {\n const intValues = values.map(Math.trunc);\n this.updateReadout(intValues);\n // Only persist the value while sliding if the continuous_update\n // trait is set to true.\n if (this.model.get('continuous_update')) {\n this.handleSliderChanged(values, handle);\n }\n }\n /**\n * Called when the slider value has changed.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n handleSliderChanged(values, handle) {\n const intValues = values.map(Math.round);\n this.updateReadout(intValues);\n // set index to a snapshot of the values passed by the slider\n this.model.set('index', intValues.slice(), { updated_view: this });\n this.touch();\n }\n updateSliderValue(model, _, options) {\n if (options.updated_view === this) {\n return;\n }\n // Rounding values to avoid floating point precision error for the if statement below\n const prev_index = this.$slider.noUiSlider.get().map(Math.round);\n const index = this.model.get('index').map(Math.round);\n if (prev_index[0] !== index[0] || prev_index[1] !== index[1]) {\n this.$slider.noUiSlider.set(index);\n }\n }\n}\n//# sourceMappingURL=widget_selection.js.map","/* This file has code derived from Lumino. The license for this Lumino code is:\n\nCopyright (c) 2019 Project Jupyter Contributors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\nCopyright (c) 2014-2017, PhosphorJS Contributors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\nimport { MessageLoop } from '@lumino/messaging';\nimport { Signal } from '@lumino/signaling';\nimport { Platform } from '@lumino/domutils';\nimport { Panel, PanelLayout, TabBar, Widget } from '@lumino/widgets';\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a [[PanelLayout]].\n */\nexport class EventedPanel extends Panel {\n constructor() {\n super(...arguments);\n this._widgetRemoved = new Signal(this);\n }\n /**\n * A signal emitted when a widget is removed from the panel.\n */\n get widgetRemoved() {\n return this._widgetRemoved;\n }\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n onChildRemoved(msg) {\n this._widgetRemoved.emit(msg.child);\n }\n}\n/**\n * A widget which combines a `TabBar` and a `EventedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n *\n * TODO: Support setting the direction??\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options = {}) {\n super();\n this._currentChanged = new Signal(this);\n this.addClass('jupyter-widget-TabPanel');\n // Create the tab bar and contents panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('jupyter-widget-TabPanel-tabBar');\n this.tabContents = new EventedPanel();\n this.tabContents.addClass('jupyter-widget-TabPanel-tabContents');\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n // Connect the evented panel signal handlers.\n this.tabContents.widgetRemoved.connect(this._onWidgetRemoved, this);\n // Create the layout.\n const layout = new PanelLayout();\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.tabContents);\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged() {\n return this._currentChanged;\n }\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentIndex() {\n const currentIndex = this.tabBar.currentIndex;\n // Lumino tab bars have an index of -1 if no tab is selected\n return currentIndex === -1 ? null : currentIndex;\n }\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `null`.\n */\n set currentIndex(value) {\n this.tabBar.currentIndex = value === null ? -1 : value;\n }\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget() {\n const title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable() {\n return this.tabBar.tabsMovable;\n }\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value) {\n this.tabBar.tabsMovable = value;\n }\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets() {\n return this.tabContents.widgets;\n }\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget) {\n this.insertWidget(this.widgets.length, widget);\n }\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index, widget) {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.tabContents.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n }\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n _onCurrentChanged(sender, args) {\n // Extract the previous and current title from the args.\n const { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n // Extract the widgets from the titles.\n const previousWidget = previousTitle ? previousTitle.owner : null;\n const currentWidget = currentTitle ? currentTitle.owner : null;\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget,\n });\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n _onTabActivateRequested(sender, args) {\n args.title.owner.activate();\n }\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n _onTabCloseRequested(sender, args) {\n args.title.owner.close();\n }\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n _onTabMoved(sender, args) {\n this.tabContents.insertWidget(args.toIndex, args.title.owner);\n }\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n _onWidgetRemoved(sender, widget) {\n this.tabBar.removeTab(widget.title);\n }\n}\n//# sourceMappingURL=tabpanel.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * A variety of convenience methods for maintaining a current selection\n */\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Signal } from '@lumino/signaling';\nexport class Selection {\n constructor(sequence, options = {}) {\n this._array = null;\n this._value = null;\n this._previousValue = null;\n this._selectionChanged = new Signal(this);\n this._array = sequence;\n this._insertBehavior = options.insertBehavior || 'select-item-if-needed';\n this._removeBehavior = options.removeBehavior || 'select-item-after';\n }\n /**\n * A signal emitted when the current item is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected item is changed either\n * through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current item\n * changes due to other items being inserted, removed, or moved, but the\n * current item remains the same. It is only emitted when the actual current\n * item is changed.\n */\n get selectionChanged() {\n return this._selectionChanged;\n }\n /**\n * Adjust for setting an item.\n *\n * This should be called *after* the set.\n *\n * @param index - The index set.\n * @param oldValue - The old value at the index.\n */\n adjustSelectionForSet(index) {\n // We just need to send a signal if the currentValue changed.\n // Get the current index and value.\n const pi = this.index;\n const pv = this.value;\n // Exit early if this doesn't affect the selection\n if (index !== pi) {\n return;\n }\n this._updateSelectedValue();\n const cv = this.value;\n // The previous item is now null, since it is no longer in the array.\n this._previousValue = null;\n // Send signal if there was a change\n if (pv !== cv) {\n // Emit the current changed signal.\n this._selectionChanged.emit({\n previousIndex: pi,\n previousValue: pv,\n currentIndex: pi,\n currentValue: cv,\n });\n }\n }\n /**\n * Get the currently selected item.\n *\n * #### Notes\n * This will be `null` if no item is selected.\n */\n get value() {\n return this._value;\n }\n /**\n * Set the currently selected item.\n *\n * #### Notes\n * If the item does not exist in the vector, the currentValue will be set to\n * `null`. This selects the first entry equal to the desired item.\n */\n set value(value) {\n if (value === null || this._array === null) {\n this.index = null;\n }\n else {\n this.index = ArrayExt.firstIndexOf(this._array, value);\n }\n }\n /**\n * Get the index of the currently selected item.\n *\n * #### Notes\n * This will be `null` if no item is selected.\n */\n get index() {\n return this._index;\n }\n /**\n * Set the index of the currently selected tab.\n *\n * @param index - The index to select.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `null`, which\n * indicates no item is selected.\n */\n set index(index) {\n // Coerce the value to an index.\n let i;\n if (index !== null && this._array !== null) {\n i = Math.floor(index);\n if (i < 0 || i >= this._array.length) {\n i = null;\n }\n }\n else {\n i = null;\n }\n // Bail early if the index will not change.\n if (this._index === i) {\n return;\n }\n // Look up the previous index and item.\n const pi = this._index;\n const pv = this._value;\n // Update the state\n this._index = i;\n this._updateSelectedValue();\n this._previousValue = pv;\n // Emit the current changed signal.\n this._selectionChanged.emit({\n previousIndex: pi,\n previousValue: pv,\n currentIndex: i,\n currentValue: this._value,\n });\n }\n /**\n * Get the selection behavior when inserting a tab.\n */\n get insertBehavior() {\n return this._insertBehavior;\n }\n /**\n * Set the selection behavior when inserting a tab.\n */\n set insertBehavior(value) {\n this._insertBehavior = value;\n }\n /**\n * Get the selection behavior when removing a tab.\n */\n get removeBehavior() {\n return this._removeBehavior;\n }\n /**\n * Set the selection behavior when removing a tab.\n */\n set removeBehavior(value) {\n this._removeBehavior = value;\n }\n /**\n * Adjust the current index for a tab insert operation.\n *\n * @param i - The new index of the inserted item.\n * @param j - The inserted item.\n *\n * #### Notes\n * This method accounts for the tab bar's insertion behavior when adjusting\n * the current index and emitting the changed signal. This should be called\n * after the insertion.\n */\n adjustSelectionForInsert(i, item) {\n // Lookup commonly used variables.\n const cv = this._value;\n const ci = this._index;\n const bh = this._insertBehavior;\n // Handle the behavior where the new item is always selected,\n // or the behavior where the new item is selected if needed.\n if (bh === 'select-item' ||\n (bh === 'select-item-if-needed' && ci === null)) {\n this._index = i;\n this._value = item;\n this._previousValue = cv;\n this._selectionChanged.emit({\n previousIndex: ci,\n previousValue: cv,\n currentIndex: i,\n currentValue: item,\n });\n return;\n }\n // Otherwise, silently adjust the current index if needed.\n if (ci !== null && ci >= i) {\n this._index++;\n }\n }\n /**\n * Clear the selection and history.\n */\n clearSelection() {\n // Get the current index and item.\n const pi = this._index;\n const pv = this._value;\n // Reset the current index and previous item.\n this._index = null;\n this._value = null;\n this._previousValue = null;\n // If no item was selected, there's nothing else to do.\n if (pi === null) {\n return;\n }\n // Emit the current changed signal.\n this._selectionChanged.emit({\n previousIndex: pi,\n previousValue: pv,\n currentIndex: this._index,\n currentValue: this._value,\n });\n }\n /**\n * Adjust the current index for an item remove operation.\n *\n * @param i - The former index of the removed item.\n * @param item - The removed item.\n *\n * #### Notes\n * This method accounts for the remove behavior when adjusting the current\n * index and emitting the changed signal. It should be called after the item\n * is removed.\n */\n adjustSelectionForRemove(i, item) {\n // If we have no selection, there is nothing to do\n if (this._index === null) {\n return;\n }\n // Lookup commonly used variables.\n const ci = this._index;\n const bh = this._removeBehavior;\n // Silently adjust the index if the current item is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._index--;\n }\n return;\n }\n // No item gets selected if the vector is empty.\n if (!this._array || this._array.length === 0) {\n // Reset the current index and previous item.\n this._index = null;\n this._value = null;\n this._previousValue = null;\n this._selectionChanged.emit({\n previousIndex: i,\n previousValue: item,\n currentIndex: this._index,\n currentValue: this._value,\n });\n return;\n }\n // Handle behavior where the next sibling item is selected.\n if (bh === 'select-item-after') {\n this._index = Math.min(i, this._array.length - 1);\n this._updateSelectedValue();\n this._previousValue = null;\n this._selectionChanged.emit({\n previousIndex: i,\n previousValue: item,\n currentIndex: this._index,\n currentValue: this._value,\n });\n return;\n }\n // Handle behavior where the previous sibling item is selected.\n if (bh === 'select-item-before') {\n this._index = Math.max(0, i - 1);\n this._updateSelectedValue();\n this._previousValue = null;\n this._selectionChanged.emit({\n previousIndex: i,\n previousValue: item,\n currentIndex: this._index,\n currentValue: this._value,\n });\n return;\n }\n // Handle behavior where the previous history item is selected.\n if (bh === 'select-previous-item') {\n if (this._previousValue) {\n this.value = this._previousValue;\n }\n else {\n this._index = Math.min(i, this._array.length - 1);\n this._updateSelectedValue();\n }\n this._previousValue = null;\n this._selectionChanged.emit({\n previousIndex: i,\n previousValue: item,\n currentIndex: this._index,\n currentValue: this.value,\n });\n return;\n }\n // Otherwise, no item gets selected.\n this._index = null;\n this._value = null;\n this._previousValue = null;\n this._selectionChanged.emit({\n previousIndex: i,\n previousValue: item,\n currentIndex: this._index,\n currentValue: this._value,\n });\n }\n /**\n * Set the current value based on the current index.\n */\n _updateSelectedValue() {\n const i = this._index;\n this._value = i !== null && this._array ? this._array[i] : null;\n }\n}\n//# sourceMappingURL=currentselection.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Signal } from '@lumino/signaling';\nimport { Panel, PanelLayout, Widget } from '@lumino/widgets';\nimport { Selection } from './currentselection';\n/**\n * The class name added to Collapse instances.\n */\nconst COLLAPSE_CLASS = 'jupyter-widget-Collapse';\n/**\n * The class name added to a Collapse's header.\n */\nconst COLLAPSE_HEADER_CLASS = 'jupyter-widget-Collapse-header';\n/**\n * The class name added to a Collapse's contents.\n */\nconst COLLAPSE_CONTENTS_CLASS = 'jupyter-widget-Collapse-contents';\n/**\n * The class name added to a Collapse when it is opened\n */\nconst COLLAPSE_CLASS_OPEN = 'jupyter-widget-Collapse-open';\n/**\n * A panel that supports a collapsible header, made from the widget's title.\n * Clicking on the title expands or contracts the widget.\n */\nexport class Collapse extends Widget {\n constructor(options) {\n super(options);\n this._collapseChanged = new Signal(this);\n this.addClass(COLLAPSE_CLASS);\n this._header = new Widget();\n this._header.addClass(COLLAPSE_HEADER_CLASS);\n this._header.node.addEventListener('click', this);\n // Fontawesome icon for caret\n const icon = document.createElement('i');\n icon.classList.add('fa', 'fa-fw', 'fa-caret-right');\n this._header.node.appendChild(icon);\n // Label content\n this._header.node.appendChild(document.createElement('span'));\n this._content = new Panel();\n this._content.addClass(COLLAPSE_CONTENTS_CLASS);\n const layout = new PanelLayout();\n this.layout = layout;\n layout.addWidget(this._header);\n layout.addWidget(this._content);\n if (options.widget) {\n this.widget = options.widget;\n }\n this.collapsed = false;\n }\n dispose() {\n if (this.isDisposed) {\n return;\n }\n super.dispose();\n this._header = null;\n this._widget = null;\n this._content = null;\n }\n get widget() {\n return this._widget;\n }\n set widget(widget) {\n const oldWidget = this._widget;\n if (oldWidget) {\n oldWidget.disposed.disconnect(this._onChildDisposed, this);\n oldWidget.title.changed.disconnect(this._onTitleChanged, this);\n oldWidget.parent = null;\n }\n this._widget = widget;\n widget.disposed.connect(this._onChildDisposed, this);\n widget.title.changed.connect(this._onTitleChanged, this);\n this._onTitleChanged(widget.title);\n this._content.addWidget(widget);\n }\n get collapsed() {\n return this._collapsed;\n }\n set collapsed(value) {\n // TODO: should we have this check here?\n if (value === this._collapsed) {\n return;\n }\n if (value) {\n this._collapse();\n }\n else {\n this._uncollapse();\n }\n }\n toggle() {\n this.collapsed = !this.collapsed;\n }\n get collapseChanged() {\n return this._collapseChanged;\n }\n _collapse() {\n this._collapsed = true;\n if (this._content) {\n this._content.hide();\n }\n this.removeClass(COLLAPSE_CLASS_OPEN);\n this._header.node.children[0].classList.add('fa-caret-right');\n this._header.node.children[0].classList.remove('fa-caret-down');\n this._collapseChanged.emit(void 0);\n }\n _uncollapse() {\n this._collapsed = false;\n if (this._content) {\n this._content.show();\n }\n this.addClass(COLLAPSE_CLASS_OPEN);\n this._header.node.children[0].classList.add('fa-caret-down');\n this._header.node.children[0].classList.remove('fa-caret-right');\n this._collapseChanged.emit(void 0);\n }\n /**\n * Handle the DOM events for the Collapse widget.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event) {\n switch (event.type) {\n case 'click':\n this._evtClick(event);\n break;\n default:\n break;\n }\n }\n _evtClick(event) {\n this.toggle();\n }\n /**\n * Handle the `changed` signal of a title object.\n */\n _onTitleChanged(sender) {\n this._header.node.children[1].textContent = this._widget.title.label;\n }\n _onChildDisposed(sender) {\n this.dispose();\n }\n}\n/**\n * The class name added to Accordion instances.\n */\nconst ACCORDION_CLASS = 'jupyter-widget-Accordion';\n/**\n * The class name added to an Accordion child.\n */\nconst ACCORDION_CHILD_CLASS = 'jupyter-widget-Accordion-child';\nconst ACCORDION_CHILD_ACTIVE_CLASS = 'jupyter-widget-Accordion-child-active';\n/**\n * A panel that supports a collapsible header, made from the widget's title.\n * Clicking on the title expands or contracts the widget.\n */\nexport class Accordion extends Panel {\n constructor(options) {\n super(options);\n this._selection = new Selection(this.widgets);\n this._selection.selectionChanged.connect(this._onSelectionChanged, this);\n this.addClass(ACCORDION_CLASS);\n }\n /**\n * A read-only sequence of the widgets in the panel.\n *\n * #### Notes\n * This is a read-only property.\n */\n /* get widgets(): ISequence {\n return new ArraySequence(toArray(map((this.layout as PanelLayout).widgets, (w: Collapse) => w.widget)));\n }\n */\n get collapseWidgets() {\n return this.layout.widgets;\n }\n get selection() {\n return this._selection;\n }\n indexOf(widget) {\n return ArrayExt.findFirstIndex(this.collapseWidgets, (w) => w.widget === widget);\n }\n /**\n * Add a widget to the end of the accordion.\n *\n * @param widget - The widget to add to the accordion.\n *\n * @returns The Collapse widget wrapping the added widget.\n *\n * #### Notes\n * The widget will be wrapped in a CollapsedWidget.\n */\n addWidget(widget) {\n const collapse = this._wrapWidget(widget);\n collapse.collapsed = true;\n super.addWidget(collapse);\n this._selection.adjustSelectionForInsert(this.widgets.length - 1, collapse);\n return collapse;\n }\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the accordion.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index, widget) {\n const collapse = this._wrapWidget(widget);\n collapse.collapsed = true;\n super.insertWidget(index, collapse);\n this._selection.adjustSelectionForInsert(index, collapse);\n }\n removeWidget(widget) {\n const index = this.indexOf(widget);\n if (index >= 0) {\n const collapse = this.collapseWidgets[index];\n widget.parent = null;\n collapse.dispose();\n this._selection.adjustSelectionForRemove(index, null);\n }\n }\n _wrapWidget(widget) {\n const collapse = new Collapse({ widget });\n collapse.addClass(ACCORDION_CHILD_CLASS);\n collapse.collapseChanged.connect(this._onCollapseChange, this);\n return collapse;\n }\n _onCollapseChange(sender) {\n if (!sender.collapsed) {\n this._selection.value = sender;\n }\n else if (this._selection.value === sender && sender.collapsed) {\n this._selection.value = null;\n }\n }\n _onSelectionChanged(sender, change) {\n // Collapse previous widget, open current widget\n const pv = change.previousValue;\n const cv = change.currentValue;\n if (pv) {\n pv.collapsed = true;\n pv.removeClass(ACCORDION_CHILD_ACTIVE_CLASS);\n }\n if (cv) {\n cv.collapsed = false;\n cv.addClass(ACCORDION_CHILD_ACTIVE_CLASS);\n }\n }\n}\n//# sourceMappingURL=accordion.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView, ViewList, reject, } from '@jupyter-widgets/base';\nimport { BoxModel, BoxView } from './widget_box';\nimport { TabPanel } from './lumino/tabpanel';\nimport { Accordion } from './lumino/accordion';\nimport { Widget } from '@lumino/widgets';\nimport { each, ArrayExt } from '@lumino/algorithm';\nimport { MessageLoop } from '@lumino/messaging';\nimport $ from 'jquery';\nexport class SelectionContainerModel extends BoxModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SelectionContainerModel', selected_index: null, titles: [] });\n }\n}\nexport class AccordionModel extends SelectionContainerModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'AccordionModel', _view_name: 'AccordionView' });\n }\n}\n// We implement our own tab widget since Phoshpor's TabPanel uses an absolute\n// positioning BoxLayout, but we want a more an html/css-based Panel layout.\nexport class JupyterLuminoAccordionWidget extends Accordion {\n constructor(options) {\n const view = options.view;\n delete options.view;\n super(options);\n this._view = view;\n }\n /**\n * Process the Lumino message.\n *\n * Any custom Lumino widget used inside a Jupyter widget should override\n * the processMessage function like this.\n */\n processMessage(msg) {\n var _a;\n super.processMessage(msg);\n (_a = this._view) === null || _a === void 0 ? void 0 : _a.processLuminoMessage(msg);\n }\n /**\n * Dispose the widget.\n *\n * This causes the view to be destroyed as well with 'remove'\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n super.dispose();\n this._view.remove();\n this._view = null;\n }\n}\nexport class AccordionView extends DOMWidgetView {\n _createElement(tagName) {\n this.luminoWidget = new JupyterLuminoAccordionWidget({ view: this });\n return this.luminoWidget.node;\n }\n _setElement(el) {\n if (this.el || el !== this.luminoWidget.node) {\n // Accordions don't allow setting the element beyond the initial creation.\n throw new Error('Cannot reset the DOM element.');\n }\n this.el = this.luminoWidget.node;\n this.$el = $(this.luminoWidget.node);\n }\n initialize(parameters) {\n super.initialize(parameters);\n this.children_views = new ViewList(this.add_child_view, this.remove_child_view, this);\n this.listenTo(this.model, 'change:children', () => this.updateChildren());\n this.listenTo(this.model, 'change:selected_index', () => this.update_selected_index());\n this.listenTo(this.model, 'change:titles', () => this.update_titles());\n }\n /**\n * Called when view is rendered.\n */\n render() {\n var _a;\n super.render();\n const accordion = this.luminoWidget;\n accordion.addClass('jupyter-widgets');\n accordion.addClass('widget-accordion');\n accordion.addClass('widget-container');\n accordion.selection.selectionChanged.connect((sender) => {\n if (!this.updatingChildren) {\n this.model.set('selected_index', accordion.selection.index);\n this.touch();\n }\n });\n (_a = this.children_views) === null || _a === void 0 ? void 0 : _a.update(this.model.get('children'));\n this.update_titles();\n this.update_selected_index();\n }\n /**\n * Update children\n */\n updateChildren() {\n var _a;\n // While we are updating, the index may not be valid, so deselect the\n // tabs before updating so we don't get spurious changes in the index,\n // which would then set off another sync cycle.\n this.updatingChildren = true;\n this.luminoWidget.selection.index = null;\n (_a = this.children_views) === null || _a === void 0 ? void 0 : _a.update(this.model.get('children'));\n this.update_selected_index();\n this.updatingChildren = false;\n }\n /**\n * Set header titles\n */\n update_titles() {\n const collapsed = this.luminoWidget.collapseWidgets;\n const titles = this.model.get('titles');\n for (let i = 0; i < collapsed.length; i++) {\n if (titles[i] !== void 0) {\n collapsed[i].widget.title.label = titles[i];\n }\n }\n }\n /**\n * Make the rendering and selected index consistent.\n */\n update_selected_index() {\n this.luminoWidget.selection.index = this.model.get('selected_index');\n }\n /**\n * Called when a child is removed from children list.\n */\n remove_child_view(view) {\n this.luminoWidget.removeWidget(view.luminoWidget);\n view.remove();\n }\n /**\n * Called when a child is added to children list.\n */\n add_child_view(model, index) {\n // Placeholder widget to keep our position in the tab panel while we create the view.\n const accordion = this.luminoWidget;\n const placeholder = new Widget();\n placeholder.title.label = this.model.get('titles')[index] || '';\n accordion.addWidget(placeholder);\n return this.create_child_view(model)\n .then((view) => {\n const widget = view.luminoWidget;\n widget.title.label = placeholder.title.label;\n const collapse = accordion.collapseWidgets[accordion.indexOf(placeholder)];\n collapse.widget = widget;\n placeholder.dispose();\n return view;\n })\n .catch(reject('Could not add child view to box', true));\n }\n remove() {\n this.children_views = null;\n super.remove();\n }\n}\nexport class TabModel extends SelectionContainerModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'TabModel', _view_name: 'TabView' });\n }\n}\n// We implement our own tab widget since Phoshpor's TabPanel uses an absolute\n// positioning BoxLayout, but we want a more an html/css-based Panel layout.\nexport class JupyterLuminoTabPanelWidget extends TabPanel {\n constructor(options) {\n const view = options.view;\n delete options.view;\n super(options);\n this._view = view;\n // We want the view's messages to be the messages the tabContents panel\n // gets.\n MessageLoop.installMessageHook(this.tabContents, (handler, msg) => {\n // There may be times when we want the view's handler to be called\n // *after* the message has been processed by the widget, in which\n // case we'll need to revisit using a message hook.\n this._view.processLuminoMessage(msg);\n return true;\n });\n }\n /**\n * Dispose the widget.\n *\n * This causes the view to be destroyed as well with 'remove'\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n super.dispose();\n this._view.remove();\n this._view = null;\n }\n}\nexport class TabView extends DOMWidgetView {\n constructor() {\n super(...arguments);\n this.updatingTabs = false;\n }\n _createElement(tagName) {\n this.luminoWidget = new JupyterLuminoTabPanelWidget({\n view: this,\n });\n return this.luminoWidget.node;\n }\n _setElement(el) {\n if (this.el || el !== this.luminoWidget.node) {\n // TabViews don't allow setting the element beyond the initial creation.\n throw new Error('Cannot reset the DOM element.');\n }\n this.el = this.luminoWidget.node;\n this.$el = $(this.luminoWidget.node);\n }\n /**\n * Public constructor.\n */\n initialize(parameters) {\n super.initialize(parameters);\n this.childrenViews = new ViewList(this.addChildView, (view) => {\n view.remove();\n }, this);\n this.listenTo(this.model, 'change:children', () => this.updateTabs());\n this.listenTo(this.model, 'change:titles', () => this.updateTitles());\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n const tabs = this.luminoWidget;\n tabs.addClass('jupyter-widgets');\n tabs.addClass('widget-container');\n tabs.addClass('jupyter-widget-tab');\n tabs.addClass('widget-tab');\n tabs.tabsMovable = true;\n tabs.tabBar.insertBehavior = 'none'; // needed for insert behavior, see below.\n tabs.tabBar.currentChanged.connect(this._onTabChanged, this);\n tabs.tabBar.tabMoved.connect(this._onTabMoved, this);\n tabs.tabBar.addClass('widget-tab-bar');\n tabs.tabContents.addClass('widget-tab-contents');\n // TODO: expose this option in python\n tabs.tabBar.tabsMovable = false;\n this.updateTabs();\n this.update();\n }\n /**\n * Render tab views based on the current model's children.\n */\n updateTabs() {\n var _a;\n // While we are updating, the index may not be valid, so deselect the\n // tabs before updating so we don't get spurious changes in the index,\n // which would then set off another sync cycle.\n this.updatingTabs = true;\n this.luminoWidget.currentIndex = null;\n (_a = this.childrenViews) === null || _a === void 0 ? void 0 : _a.update(this.model.get('children'));\n this.luminoWidget.currentIndex = this.model.get('selected_index');\n this.updatingTabs = false;\n }\n /**\n * Called when a child is added to children list.\n */\n addChildView(model, index) {\n // Placeholder widget to keep our position in the tab panel while we create the view.\n const label = this.model.get('titles')[index] || '';\n const tabs = this.luminoWidget;\n const placeholder = new Widget();\n placeholder.title.label = label;\n tabs.addWidget(placeholder);\n return this.create_child_view(model)\n .then((view) => {\n const widget = view.luminoWidget;\n widget.title.label = placeholder.title.label;\n widget.title.closable = false;\n const i = ArrayExt.firstIndexOf(tabs.widgets, placeholder);\n // insert after placeholder so that if placeholder is selected, the\n // real widget will be selected now (this depends on the tab bar\n // insert behavior)\n tabs.insertWidget(i + 1, widget);\n placeholder.dispose();\n return view;\n })\n .catch(reject('Could not add child view to box', true));\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n // Update the selected index in the overall update method because it\n // should be run after the tabs have been updated. Otherwise the\n // selected index may not be a valid tab in the tab bar.\n this.updateSelectedIndex();\n return super.update();\n }\n /**\n * Updates the tab page titles.\n */\n updateTitles() {\n const titles = this.model.get('titles') || [];\n each(this.luminoWidget.widgets, (widget, i) => {\n widget.title.label = titles[i] || '';\n });\n }\n /**\n * Updates the selected index.\n */\n updateSelectedIndex() {\n this.luminoWidget.currentIndex = this.model.get('selected_index');\n }\n remove() {\n this.childrenViews = null;\n super.remove();\n }\n _onTabChanged(sender, args) {\n if (!this.updatingTabs) {\n const i = args.currentIndex;\n this.model.set('selected_index', i === -1 ? null : i);\n this.touch();\n }\n }\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n _onTabMoved(sender, args) {\n const children = this.model.get('children').slice();\n ArrayExt.move(children, args.fromIndex, args.toIndex);\n this.model.set('children', children);\n this.touch();\n }\n}\nexport class StackModel extends SelectionContainerModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'StackModel', _view_name: 'StackView' });\n }\n}\nexport class StackView extends BoxView {\n initialize(parameters) {\n super.initialize(parameters);\n this.listenTo(this.model, 'change:selected_index', this.update_children);\n }\n update_children() {\n var _a;\n let child;\n if (this.model.get('selected_index') === null) {\n child = [];\n }\n else {\n child = [this.model.get('children')[this.model.get('selected_index')]];\n }\n (_a = this.children_views) === null || _a === void 0 ? void 0 : _a.update(child).then((views) => {\n // Notify all children that their sizes may have changed.\n views.forEach((view) => {\n MessageLoop.postMessage(view.luminoWidget, Widget.ResizeMessage.UnknownSize);\n });\n });\n }\n}\n//# sourceMappingURL=widget_selectioncontainer.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport * as d3Color from 'd3-color';\nimport * as d3Format from 'd3-format';\nimport { CoreDOMWidgetModel } from './widget_core';\nimport { DOMWidgetView, uuid } from '@jupyter-widgets/base';\n/**\n * Returns a new string after removing any leading and trailing whitespaces.\n * The original string is left unchanged.\n */\nfunction trim(value) {\n return value.replace(/^\\s+|\\s+$/g, '');\n}\n/**\n * Clamp a number between min and max and return the result.\n */\nfunction clamp(value, min, max) {\n return Math.min(Math.max(value, min), max);\n}\n/**\n * Remove children from an HTMLElement\n */\nfunction removeChildren(el) {\n while (el.firstChild) {\n el.removeChild(el.firstChild);\n }\n}\n/**\n * Selection class which keeps track on selected indices.\n */\nclass Selection {\n constructor(start, dx, max) {\n this.start = start;\n this.dx = dx;\n this.max = max;\n }\n /**\n * Check if a given index is currently selected.\n */\n isSelected(index) {\n let min;\n let max;\n if (this.dx >= 0) {\n min = this.start;\n max = this.start + this.dx;\n }\n else {\n min = this.start + this.dx;\n max = this.start;\n }\n return min <= index && index < max;\n }\n /**\n * Update selection\n */\n updateSelection(dx) {\n this.dx += dx;\n if (this.start + this.dx > this.max) {\n this.dx = this.max - this.start;\n }\n if (this.start + this.dx < 0) {\n this.dx = -this.start;\n }\n }\n}\nclass TagsInputBaseModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: [], placeholder: '\\u200b', allowed_tags: null, allow_duplicates: true });\n }\n}\nclass TagsInputBaseView extends DOMWidgetView {\n constructor() {\n super(...arguments);\n this.hoveredTag = null;\n this.hoveredTagIndex = null;\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('jupyter-widget-tagsinput');\n this.taginputWrapper = document.createElement('div');\n // The taginput is hidden until the user focuses on the widget\n // Unless there is no value\n if (this.model.get('value').length) {\n this.taginputWrapper.style.display = 'none';\n }\n else {\n this.taginputWrapper.style.display = 'inline-block';\n }\n this.datalistID = uuid();\n this.taginput = document.createElement('input');\n this.taginput.classList.add('jupyter-widget-tag');\n this.taginput.classList.add('jupyter-widget-taginput');\n this.taginput.setAttribute('list', this.datalistID);\n this.taginput.setAttribute('type', 'text');\n this.autocompleteList = document.createElement('datalist');\n this.autocompleteList.id = this.datalistID;\n this.updateAutocomplete();\n this.model.on('change:allowed_tags', this.updateAutocomplete.bind(this));\n this.updatePlaceholder();\n this.model.on('change:placeholder', this.updatePlaceholder.bind(this));\n this.taginputWrapper.classList.add('widget-text');\n this.taginputWrapper.appendChild(this.taginput);\n this.taginputWrapper.appendChild(this.autocompleteList);\n this.el.onclick = this.focus.bind(this);\n this.el.ondrop = (event) => {\n // Put the tag at the end of the list if there is no currently hovered tag\n const index = this.hoveredTagIndex == null ? this.tags.length : this.hoveredTagIndex;\n return this.ondrop(event, index);\n };\n this.el.ondragover = this.ondragover.bind(this);\n this.taginput.onchange = this.handleValueAdded.bind(this);\n this.taginput.oninput = this.resizeInput.bind(this);\n this.taginput.onkeydown = this.handleKeyEvent.bind(this);\n this.taginput.onblur = this.loseFocus.bind(this);\n this.resizeInput();\n this.inputIndex = this.model.get('value').length;\n this.selection = null;\n this.preventLoosingFocus = false;\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n // Prevent hiding the input element and clearing the selection when updating everything\n this.preventLoosingFocus = true;\n removeChildren(this.el);\n this.tags = [];\n const value = this.model.get('value');\n for (const idx in value) {\n const index = parseInt(idx);\n const tag = this.createTag(value[index], index, this.selection != null && this.selection.isSelected(index));\n // Drag and drop\n tag.draggable = true;\n tag.ondragstart = ((index, value) => {\n return (event) => {\n this.ondragstart(event, index, value, this.model.model_id);\n };\n })(index, value[index]);\n tag.ondrop = ((index) => {\n return (event) => {\n this.ondrop(event, index);\n };\n })(index);\n tag.ondragover = this.ondragover.bind(this);\n tag.ondragenter = ((index) => {\n return (event) => {\n this.ondragenter(event, index);\n };\n })(index);\n tag.ondragend = this.ondragend.bind(this);\n this.tags.push(tag);\n this.el.appendChild(tag);\n }\n this.el.insertBefore(this.taginputWrapper, this.el.children[this.inputIndex]);\n // The taginput is hidden until the user focuses on the widget\n // Unless there is no value\n if (this.model.get('value').length) {\n this.taginputWrapper.style.display = 'none';\n }\n else {\n this.taginputWrapper.style.display = 'inline-block';\n }\n this.preventLoosingFocus = false;\n return super.update();\n }\n /**\n * Update the auto-completion list\n */\n updateAutocomplete() {\n removeChildren(this.autocompleteList);\n const allowedTags = this.model.get('allowed_tags');\n for (const tag of allowedTags) {\n const option = document.createElement('option');\n option.value = tag;\n this.autocompleteList.appendChild(option);\n }\n }\n /**\n * Update the auto-completion list\n */\n updatePlaceholder() {\n this.taginput.placeholder = this.model.get('placeholder');\n this.resizeInput();\n }\n /**\n * Update the tags, called when the selection has changed and we need to update the tags CSS\n */\n updateTags() {\n const value = this.model.get('value');\n for (const idx in this.tags) {\n const index = parseInt(idx);\n this.updateTag(this.tags[index], value[index], index, this.selection != null && this.selection.isSelected(index));\n }\n }\n /**\n * Handle a new value is added from the input element\n */\n handleValueAdded(event) {\n const newTagValue = trim(this.taginput.value);\n const tagIndex = this.inputIndex;\n if (newTagValue == '') {\n return;\n }\n this.inputIndex++;\n const tagAdded = this.addTag(tagIndex, newTagValue);\n if (tagAdded) {\n // Clear the input and keep focus on it allowing the user to add more tags\n this.taginput.value = '';\n this.resizeInput();\n this.focus();\n }\n }\n /**\n * Add a new tag with a value of `tagValue` at the `index` position\n * Return true if the tag was correctly added, false otherwise\n */\n addTag(index, tagValue) {\n const value = this.model.get('value');\n let newTagValue;\n try {\n newTagValue = this.validateValue(tagValue);\n }\n catch (error) {\n return false;\n }\n const allowedTagValues = this.model.get('allowed_tags');\n if (allowedTagValues.length && !allowedTagValues.includes(newTagValue)) {\n // Do nothing for now, maybe show a proper error message?\n return false;\n }\n if (!this.model.get('allow_duplicates') && value.includes(newTagValue)) {\n // Do nothing for now, maybe add an animation to highlight the tag?\n return false;\n }\n // Clearing the current selection before setting the new value\n this.selection = null;\n // Making a copy so that backbone sees the change, and insert the new tag\n const newValue = [...value];\n newValue.splice(index, 0, newTagValue);\n this.model.set('value', newValue);\n this.model.save_changes();\n return true;\n }\n /**\n * Resize the input element\n */\n resizeInput() {\n let content;\n if (this.taginput.value.length != 0) {\n content = this.taginput.value;\n }\n else {\n content = this.model.get('placeholder');\n }\n const size = content.length + 1;\n this.taginput.setAttribute('size', String(size));\n }\n /**\n * Handle key events on the input element\n */\n handleKeyEvent(event) {\n const valueLength = this.model.get('value').length;\n // Do nothing if the user is typing something\n if (this.taginput.value.length) {\n return;\n }\n const currentElement = this.inputIndex;\n switch (event.key) {\n case 'ArrowLeft':\n if (event.ctrlKey && event.shiftKey) {\n this.select(currentElement, -currentElement);\n }\n if (!event.ctrlKey && event.shiftKey) {\n this.select(currentElement, -1);\n }\n if (event.ctrlKey) {\n this.inputIndex = 0;\n }\n else {\n this.inputIndex--;\n }\n break;\n case 'ArrowRight':\n if (event.ctrlKey && event.shiftKey) {\n this.select(currentElement, valueLength - currentElement);\n }\n if (!event.ctrlKey && event.shiftKey) {\n this.select(currentElement, 1);\n }\n if (event.ctrlKey) {\n this.inputIndex = valueLength;\n }\n else {\n this.inputIndex++;\n }\n break;\n case 'Backspace':\n if (this.selection) {\n this.removeSelectedTags();\n }\n else {\n this.removeTag(this.inputIndex - 1);\n }\n break;\n case 'Delete':\n if (this.selection) {\n this.removeSelectedTags();\n }\n else {\n this.removeTag(this.inputIndex);\n }\n break;\n default:\n // Do nothing by default\n return;\n break;\n }\n // Reset selection is shift key is not pressed\n if (!event.shiftKey) {\n this.selection = null;\n }\n this.inputIndex = clamp(this.inputIndex, 0, valueLength);\n this.update();\n this.focus();\n }\n /**\n * Function that gets called when a tag with a given `value` is being dragged.\n */\n ondragstart(event, index, tagValue, origin) {\n if (event.dataTransfer == null) {\n return;\n }\n event.dataTransfer.setData('index', String(index));\n event.dataTransfer.setData('tagValue', String(tagValue));\n event.dataTransfer.setData('origin', origin);\n }\n /**\n * Function that gets called when a tag has been dragged on the tag at the `index` position.\n */\n ondrop(event, index) {\n if (event.dataTransfer == null) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n const draggedTagValue = event.dataTransfer.getData('tagValue');\n const draggedTagindex = parseInt(event.dataTransfer.getData('index'));\n const sameOrigin = event.dataTransfer.getData('origin') == this.model.model_id;\n // If something else than a tag was dropped, draggedTagindex should be NaN\n if (isNaN(draggedTagindex)) {\n return;\n }\n // If it's the same origin, the drag and drop results in a reordering\n if (sameOrigin) {\n const value = this.model.get('value');\n const newValue = [...value];\n // If the old position is on the left of the new position, we need to re-index the new position\n // after removing the tag at the old position\n if (draggedTagindex < index) {\n index--;\n }\n newValue.splice(draggedTagindex, 1); // Removing at the old position\n newValue.splice(index, 0, draggedTagValue); // Adding at the new one\n this.model.set('value', newValue);\n this.model.save_changes();\n return;\n }\n // Else we add a new tag with the given draggedTagValue\n this.addTag(index, draggedTagValue);\n }\n ondragover(event) {\n // This is needed for the drag and drop to work\n event.preventDefault();\n }\n ondragenter(event, index) {\n if (this.hoveredTag != null && this.hoveredTag != this.tags[index]) {\n this.hoveredTag.style.marginLeft = '1px';\n }\n this.hoveredTag = this.tags[index];\n this.hoveredTagIndex = index;\n this.hoveredTag.style.marginLeft = '30px';\n }\n ondragend() {\n if (this.hoveredTag != null) {\n this.hoveredTag.style.marginLeft = '1px';\n }\n this.hoveredTag = null;\n this.hoveredTagIndex = null;\n }\n /**\n * Select tags from `start` to `start + dx` not included.\n */\n select(start, dx) {\n const valueLength = this.model.get('value').length;\n if (!this.selection) {\n this.selection = new Selection(start, dx, valueLength);\n }\n else {\n this.selection.updateSelection(dx);\n }\n }\n /**\n * Remove all the selected tags.\n */\n removeSelectedTags() {\n const value = [...this.model.get('value')];\n const valueLength = value.length;\n // It is simpler to remove from right to left\n for (let idx = valueLength - 1; idx >= 0; idx--) {\n if (this.selection != null && this.selection.isSelected(idx)) {\n value.splice(idx, 1);\n // Move the input to the left if we remove a tag that is before the input\n if (idx < this.inputIndex) {\n this.inputIndex--;\n }\n }\n }\n this.model.set('value', value);\n this.model.save_changes();\n }\n /**\n * Remove a tag given its index in the list\n */\n removeTag(tagIndex) {\n const value = [...this.model.get('value')];\n value.splice(tagIndex, 1);\n // Move the input to the left if we remove a tag that is before the input\n if (tagIndex < this.inputIndex) {\n this.inputIndex--;\n }\n this.model.set('value', value);\n this.model.save_changes();\n }\n /**\n * Focus on the input element\n */\n focus() {\n this.taginputWrapper.style.display = 'inline-block';\n this.taginput.focus();\n }\n /**\n * Lose focus on the input element\n */\n loseFocus() {\n if (this.preventLoosingFocus) {\n return;\n }\n // Only hide the input if we have tags displayed\n if (this.model.get('value').length) {\n this.taginputWrapper.style.display = 'none';\n }\n this.selection = null;\n this.updateTags();\n }\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'div';\n }\n /**\n * Validate an input tag typed by the user, returning the correct tag type. This should be overridden in subclasses.\n */\n validateValue(value) {\n return value;\n }\n}\nexport class TagsInputModel extends TagsInputBaseModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: [], tag_style: '', _view_name: 'TagsInputView', _model_name: 'TagsInputModel' });\n }\n}\nexport class TagsInputView extends TagsInputBaseView {\n /**\n * Create the string tag\n */\n createTag(value, index, selected) {\n const tag = document.createElement('div');\n const style = this.model.get('tag_style');\n tag.classList.add('jupyter-widget-tag');\n tag.classList.add(TagsInputView.class_map[style]);\n if (selected) {\n tag.classList.add('mod-active');\n }\n tag.appendChild(document.createTextNode(this.getTagText(value)));\n const i = document.createElement('i');\n i.classList.add('fa');\n i.classList.add('fa-times');\n i.classList.add('jupyter-widget-tag-close');\n tag.appendChild(i);\n i.onmousedown = ((index) => {\n return () => {\n this.removeTag(index);\n this.loseFocus();\n };\n })(index);\n return tag;\n }\n /**\n * Returns the text that should be displayed in the tag element\n */\n getTagText(value) {\n return value;\n }\n /**\n * Update a given tag\n */\n updateTag(tag, value, index, selected) {\n if (selected) {\n tag.classList.add('mod-active');\n }\n else {\n tag.classList.remove('mod-active');\n }\n }\n}\nTagsInputView.class_map = {\n primary: 'mod-primary',\n success: 'mod-success',\n info: 'mod-info',\n warning: 'mod-warning',\n danger: 'mod-danger',\n};\nexport class ColorsInputModel extends TagsInputBaseModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: [], _view_name: 'ColorsInputView', _model_name: 'ColorsInputModel' });\n }\n}\nexport class ColorsInputView extends TagsInputBaseView {\n /**\n * Create the Color tag\n */\n createTag(value, index, selected) {\n const tag = document.createElement('div');\n const color = value;\n const darkerColor = d3Color.color(value).darker().toString();\n tag.classList.add('jupyter-widget-tag');\n tag.classList.add('jupyter-widget-colortag');\n if (!selected) {\n tag.style.backgroundColor = color;\n }\n else {\n tag.classList.add('mod-active');\n tag.style.backgroundColor = darkerColor;\n }\n const i = document.createElement('i');\n i.classList.add('fa');\n i.classList.add('fa-times');\n i.classList.add('jupyter-widget-tag-close');\n tag.appendChild(i);\n i.onmousedown = ((index) => {\n return () => {\n this.removeTag(index);\n this.loseFocus();\n };\n })(index);\n return tag;\n }\n /**\n * Update a given tag\n */\n updateTag(tag, value, index, selected) {\n const color = value;\n const darkerColor = d3Color.color(value).darker().toString();\n if (!selected) {\n tag.classList.remove('mod-active');\n tag.style.backgroundColor = color;\n }\n else {\n tag.classList.add('mod-active');\n tag.style.backgroundColor = darkerColor;\n }\n }\n /**\n * Validate an input tag typed by the user, returning the correct tag type. This should be overridden in subclasses.\n */\n validateValue(value) {\n if (d3Color.color(value) == null) {\n throw value + ' is not a valid Color';\n }\n return value;\n }\n}\nclass NumbersInputModel extends TagsInputModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { min: null, max: null });\n }\n}\nclass NumbersInputView extends TagsInputView {\n render() {\n // Initialize text formatter\n this.model.on('change:format', () => {\n this.formatter = d3Format.format(this.model.get('format'));\n this.update();\n });\n this.formatter = d3Format.format(this.model.get('format'));\n super.render();\n }\n /**\n * Returns the text that should be displayed in the tag element\n */\n getTagText(value) {\n return this.formatter(this.parseNumber(value));\n }\n /**\n * Validate an input tag typed by the user, returning the correct tag type. This should be overridden in subclasses.\n */\n validateValue(value) {\n const parsed = this.parseNumber(value);\n const min = this.model.get('min');\n const max = this.model.get('max');\n if (isNaN(parsed) ||\n (min != null && parsed < min) ||\n (max != null && parsed > max)) {\n throw (value +\n ' is not a valid number, it should be in the range [' +\n min +\n ', ' +\n max +\n ']');\n }\n return parsed;\n }\n}\nexport class FloatsInputModel extends NumbersInputModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'FloatsInputView', _model_name: 'FloatsInputModel', format: '.1f' });\n }\n}\nexport class FloatsInputView extends NumbersInputView {\n parseNumber(value) {\n return parseFloat(value);\n }\n}\nexport class IntsInputModel extends NumbersInputModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'IntsInputView', _model_name: 'IntsInputModel', format: 'd' });\n }\n}\nexport class IntsInputView extends NumbersInputView {\n parseNumber(value) {\n const int = parseInt(value);\n if (int != parseFloat(value)) {\n throw value + ' should be an integer';\n }\n return int;\n }\n}\n//# sourceMappingURL=widget_tagsinput.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDescriptionModel } from './widget_core';\nimport { DescriptionStyleModel, DescriptionView } from './widget_description';\nimport { uuid } from './utils';\nimport { JUPYTER_CONTROLS_VERSION } from './version';\n/**\n * Class name for a combobox with an invalid value.\n */\nconst INVALID_VALUE_CLASS = 'jpwidgets-invalidComboValue';\nclass StringStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'StringStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nStringStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { background: {\n selector: '',\n attribute: 'background',\n default: null,\n }, font_size: {\n selector: '',\n attribute: 'font-size',\n default: '',\n }, text_color: {\n selector: '',\n attribute: 'color',\n default: '',\n } });\nexport class HTMLStyleModel extends StringStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'HTMLStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nHTMLStyleModel.styleProperties = Object.assign({}, StringStyleModel.styleProperties);\nexport class HTMLMathStyleModel extends StringStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'HTMLMathStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nHTMLMathStyleModel.styleProperties = Object.assign({}, StringStyleModel.styleProperties);\nexport class LabelStyleModel extends StringStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'LabelStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nLabelStyleModel.styleProperties = Object.assign(Object.assign({}, StringStyleModel.styleProperties), { font_family: {\n selector: '',\n attribute: 'font-family',\n default: '',\n }, font_style: {\n selector: '',\n attribute: 'font-style',\n default: '',\n }, font_variant: {\n selector: '',\n attribute: 'font-variant',\n default: '',\n }, font_weight: {\n selector: '',\n attribute: 'font-weight',\n default: '',\n }, text_decoration: {\n selector: '',\n attribute: 'text-decoration',\n default: '',\n } });\nexport class TextStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'TextStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nTextStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { background: {\n selector: '.widget-input',\n attribute: 'background',\n default: null,\n }, font_size: {\n selector: '.widget-input',\n attribute: 'font-size',\n default: '',\n }, text_color: {\n selector: '.widget-input',\n attribute: 'color',\n default: '',\n } });\nexport class StringModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: '', disabled: false, placeholder: '\\u200b', _model_name: 'StringModel' });\n }\n}\nexport class StringView extends DescriptionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render(); // Incl. setting some defaults.\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n }\n}\nexport class HTMLModel extends StringModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'HTMLView', _model_name: 'HTMLModel' });\n }\n}\nexport class HTMLView extends StringView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-html');\n this.content = document.createElement('div');\n this.content.classList.add('widget-html-content');\n this.el.appendChild(this.content);\n this.update(); // Set defaults.\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n this.content.innerHTML = this.model.get('value');\n return super.update();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.content.focus();\n }\n else if (content.do === 'blur') {\n this.content.blur();\n }\n }\n}\nexport class HTMLMathModel extends StringModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'HTMLMathView', _model_name: 'HTMLMathModel' });\n }\n}\nexport class HTMLMathView extends StringView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-htmlmath');\n this.content = document.createElement('div');\n this.content.classList.add('widget-htmlmath-content');\n this.el.appendChild(this.content);\n this.update(); // Set defaults.\n }\n /**\n * Update the contents of this view\n */\n update() {\n this.content.innerHTML = this.model.get('value');\n this.typeset(this.content);\n return super.update();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.content.focus();\n }\n else if (content.do === 'blur') {\n this.content.blur();\n }\n }\n}\nexport class LabelModel extends StringModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'LabelView', _model_name: 'LabelModel' });\n }\n}\nexport class LabelView extends StringView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-label');\n this.update(); // Set defaults.\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n this.typeset(this.el, this.model.get('value'));\n return super.update();\n }\n}\nexport class TextareaModel extends StringModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'TextareaView', _model_name: 'TextareaModel', rows: null, continuous_update: true });\n }\n}\nexport class TextareaView extends StringView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-textarea');\n this.textbox = document.createElement('textarea');\n this.textbox.setAttribute('rows', '5');\n this.textbox.id = this.label.htmlFor = uuid();\n this.textbox.classList.add('widget-input');\n this.el.appendChild(this.textbox);\n this.update(); // Set defaults.\n this.listenTo(this.model, 'change:placeholder', (model, value, options) => {\n this.update_placeholder(value);\n });\n this.update_placeholder();\n this.updateTooltip();\n }\n update_placeholder(value) {\n const v = value || this.model.get('placeholder');\n this.textbox.setAttribute('placeholder', v.toString());\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if (options === undefined || options.updated_view !== this) {\n this.textbox.value = this.model.get('value');\n let rows = this.model.get('rows');\n if (rows === null) {\n rows = '';\n }\n this.textbox.setAttribute('rows', rows);\n this.textbox.disabled = this.model.get('disabled');\n }\n this.updateTabindex();\n this.updateTooltip();\n return super.update();\n }\n updateTabindex() {\n if (!this.textbox) {\n return; // we might be constructing the parent\n }\n const tabbable = this.model.get('tabbable');\n if (tabbable === true) {\n this.textbox.setAttribute('tabIndex', '0');\n }\n else if (tabbable === false) {\n this.textbox.setAttribute('tabIndex', '-1');\n }\n else if (tabbable === null) {\n this.textbox.removeAttribute('tabIndex');\n }\n }\n updateTooltip() {\n if (!this.textbox)\n return; // we might be constructing the parent\n const title = this.model.get('tooltip');\n if (!title) {\n this.textbox.removeAttribute('title');\n }\n else if (this.model.get('description').length === 0) {\n this.textbox.setAttribute('title', title);\n }\n }\n events() {\n return {\n 'keydown input': 'handleKeyDown',\n 'keypress input': 'handleKeypress',\n 'input textarea': 'handleChanging',\n 'change textarea': 'handleChanged',\n };\n }\n /**\n * Handle key down\n *\n * Stop propagation so the event isn't sent to the application.\n */\n handleKeyDown(e) {\n e.stopPropagation();\n }\n /**\n * Handles key press\n *\n * Stop propagation so the keypress isn't sent to the application.\n */\n handleKeypress(e) {\n e.stopPropagation();\n }\n /**\n * Triggered on input change\n */\n handleChanging(e) {\n if (this.model.get('continuous_update')) {\n this.handleChanged(e);\n }\n }\n /**\n * Sync the value with the kernel.\n *\n * @param e Event\n */\n handleChanged(e) {\n const target = e.target;\n this.model.set('value', target.value, { updated_view: this });\n this.touch();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.textbox.focus();\n }\n else if (content.do === 'blur') {\n this.textbox.blur();\n }\n }\n}\nexport class TextModel extends StringModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'TextView', _model_name: 'TextModel', continuous_update: true });\n }\n}\nexport class TextView extends StringView {\n constructor() {\n super(...arguments);\n this.inputType = 'text';\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-text');\n this.textbox = document.createElement('input');\n this.textbox.setAttribute('type', this.inputType);\n this.textbox.id = this.label.htmlFor = uuid();\n this.textbox.classList.add('widget-input');\n this.el.appendChild(this.textbox);\n this.update(); // Set defaults.\n this.listenTo(this.model, 'change:placeholder', (model, value, options) => {\n this.update_placeholder(value);\n });\n this.update_placeholder();\n this.updateTabindex();\n this.updateTooltip();\n }\n update_placeholder(value) {\n this.textbox.setAttribute('placeholder', value || this.model.get('placeholder'));\n }\n updateTabindex() {\n if (!this.textbox) {\n return; // we might be constructing the parent\n }\n const tabbable = this.model.get('tabbable');\n if (tabbable === true) {\n this.textbox.setAttribute('tabIndex', '0');\n }\n else if (tabbable === false) {\n this.textbox.setAttribute('tabIndex', '-1');\n }\n else if (tabbable === null) {\n this.textbox.removeAttribute('tabIndex');\n }\n }\n updateTooltip() {\n if (!this.textbox)\n return; // we might be constructing the parent\n const title = this.model.get('tooltip');\n if (!title) {\n this.textbox.removeAttribute('title');\n }\n else if (this.model.get('description').length === 0) {\n this.textbox.setAttribute('title', title);\n }\n }\n update(options) {\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n if (options === undefined || options.updated_view !== this) {\n if (this.textbox.value !== this.model.get('value')) {\n this.textbox.value = this.model.get('value');\n }\n this.textbox.disabled = this.model.get('disabled');\n }\n return super.update();\n }\n events() {\n return {\n 'keydown input': 'handleKeyDown',\n 'keypress input': 'handleKeypress',\n 'input input': 'handleChanging',\n 'change input': 'handleChanged',\n };\n }\n /**\n * Handle key down\n *\n * Stop propagation so the keypress isn't sent to the application.\n */\n handleKeyDown(e) {\n e.stopPropagation();\n }\n /**\n * Handles text submission\n */\n handleKeypress(e) {\n e.stopPropagation();\n // The submit message is deprecated in widgets 7\n if (e.keyCode === 13) {\n // Return key\n this.send({ event: 'submit' });\n }\n }\n /**\n * Handles user input.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n handleChanging(e) {\n if (this.model.get('continuous_update')) {\n this.handleChanged(e);\n }\n }\n /**\n * Handles user input.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n handleChanged(e) {\n const target = e.target;\n this.model.set('value', target.value, { updated_view: this });\n this.touch();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.textbox.focus();\n }\n else if (content.do === 'blur') {\n this.textbox.blur();\n }\n }\n}\nexport class PasswordModel extends TextModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'PasswordView', _model_name: 'PasswordModel' });\n }\n}\nexport class PasswordView extends TextView {\n constructor() {\n super(...arguments);\n this.inputType = 'password';\n }\n}\n/**\n * Combobox widget model class.\n */\nexport class ComboboxModel extends TextModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ComboboxModel', _view_name: 'ComboboxView', options: [], ensure_options: false });\n }\n}\n/**\n * Combobox widget view class.\n */\nexport class ComboboxView extends TextView {\n constructor() {\n super(...arguments);\n this.isInitialRender = true;\n }\n render() {\n this.datalist = document.createElement('datalist');\n this.datalist.id = uuid();\n super.render();\n this.textbox.setAttribute('list', this.datalist.id);\n this.el.appendChild(this.datalist);\n this.updateTooltip();\n }\n update(options) {\n super.update(options);\n if (!this.datalist) {\n return;\n }\n const valid = this.isValid(this.model.get('value'));\n this.highlightValidState(valid);\n // Check if we need to update options\n if ((options !== undefined && options.updated_view) ||\n (!this.model.hasChanged('options') && !this.isInitialRender)) {\n // Value update only, keep current options\n return;\n }\n this.isInitialRender = false;\n const opts = this.model.get('options');\n const optionFragment = document.createDocumentFragment();\n for (const v of opts) {\n const o = document.createElement('option');\n o.value = v;\n optionFragment.appendChild(o);\n }\n this.datalist.replaceChildren(...optionFragment.children);\n }\n isValid(value) {\n if (true === this.model.get('ensure_option')) {\n const options = this.model.get('options');\n if (options.indexOf(value) === -1) {\n return false;\n }\n }\n return true;\n }\n handleChanging(e) {\n // Override to validate value\n const target = e.target;\n const valid = this.isValid(target.value);\n this.highlightValidState(valid);\n if (valid) {\n super.handleChanging(e);\n }\n }\n handleChanged(e) {\n // Override to validate value\n const target = e.target;\n const valid = this.isValid(target.value);\n this.highlightValidState(valid);\n if (valid) {\n super.handleChanged(e);\n }\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.textbox.focus();\n }\n else if (content.do === 'blur') {\n this.textbox.blur();\n }\n }\n highlightValidState(valid) {\n this.textbox.classList.toggle(INVALID_VALUE_CLASS, !valid);\n }\n}\n//# sourceMappingURL=widget_string.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDOMWidgetModel } from './widget_core';\nimport { DOMWidgetView } from '@jupyter-widgets/base';\nexport class FileUploadModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'FileUploadModel', _view_name: 'FileUploadView', accept: '', description: 'Upload', disabled: false, icon: 'upload', button_style: '', multiple: false, value: [], error: '', style: null });\n }\n}\nFileUploadModel.serializers = Object.assign(Object.assign({}, CoreDOMWidgetModel.serializers), { \n // use a dummy serializer for value to circumvent the default serializer.\n value: { serialize: (x) => x } });\nexport class FileUploadView extends DOMWidgetView {\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'button';\n }\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-upload');\n this.el.classList.add('jupyter-button');\n this.fileInput = document.createElement('input');\n this.fileInput.type = 'file';\n this.fileInput.style.display = 'none';\n this.el.addEventListener('click', () => {\n this.fileInput.click();\n });\n this.fileInput.addEventListener('click', () => {\n this.fileInput.value = '';\n });\n this.fileInput.addEventListener('change', () => {\n var _a;\n const promisesFile = [];\n Array.from((_a = this.fileInput.files) !== null && _a !== void 0 ? _a : []).forEach((file) => {\n promisesFile.push(new Promise((resolve, reject) => {\n const fileReader = new FileReader();\n fileReader.onload = () => {\n // We know we can read the result as an array buffer since\n // we use the `.readAsArrayBuffer` method\n const content = fileReader.result;\n resolve({\n content,\n name: file.name,\n type: file.type,\n size: file.size,\n last_modified: file.lastModified,\n });\n };\n fileReader.onerror = () => {\n reject();\n };\n fileReader.onabort = fileReader.onerror;\n fileReader.readAsArrayBuffer(file);\n }));\n });\n Promise.all(promisesFile)\n .then((files) => {\n this.model.set({\n value: files,\n error: '',\n });\n this.touch();\n })\n .catch((err) => {\n console.error('error in file upload: %o', err);\n this.model.set({\n error: err,\n });\n this.touch();\n });\n });\n this.listenTo(this.model, 'change:button_style', this.update_button_style);\n this.set_button_style();\n this.update(); // Set defaults.\n }\n update() {\n this.el.disabled = this.model.get('disabled');\n this.el.setAttribute('title', this.model.get('tooltip'));\n const value = this.model.get('value');\n const description = `${this.model.get('description')} (${value.length})`;\n const icon = this.model.get('icon');\n if (description.length || icon.length) {\n this.el.textContent = '';\n if (icon.length) {\n const i = document.createElement('i');\n i.classList.add('fa');\n i.classList.add('fa-' + icon);\n if (description.length === 0) {\n i.classList.add('center');\n }\n this.el.appendChild(i);\n }\n this.el.appendChild(document.createTextNode(description));\n }\n this.fileInput.accept = this.model.get('accept');\n this.fileInput.multiple = this.model.get('multiple');\n return super.update();\n }\n update_button_style() {\n this.update_mapped_classes(FileUploadView.class_map, 'button_style', this.el);\n }\n set_button_style() {\n this.set_mapped_classes(FileUploadView.class_map, 'button_style', this.el);\n }\n}\nFileUploadView.class_map = {\n primary: ['mod-primary'],\n success: ['mod-success'],\n info: ['mod-info'],\n warning: ['mod-warning'],\n danger: ['mod-danger'],\n};\n//# sourceMappingURL=widget_upload.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nexport * from './utils';\nexport * from './version';\nexport * from './widget_link';\nexport * from './widget_bool';\nexport * from './widget_button';\nexport * from './widget_box';\nexport * from './widget_image';\nexport * from './widget_video';\nexport * from './widget_audio';\nexport * from './widget_color';\nexport * from './widget_date';\nexport * from './widget_datetime';\nexport * from './widget_time';\nexport * from './widget_int';\nexport * from './widget_float';\nexport * from './widget_controller';\nexport * from './widget_selection';\nexport * from './widget_selectioncontainer';\nexport * from './widget_tagsinput';\nexport * from './widget_string';\nexport * from './widget_description';\nexport * from './widget_upload';\nexport const version = require('../package.json').version;\n//# sourceMappingURL=index.js.map","import { urlAlphabet } from './url-alphabet/index.js'\nlet random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nlet customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length === size) return id\n }\n }\n }\n}\nlet customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size, random)\nlet nanoid = (size = 21) =>\n crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {\n byte &= 63\n if (byte < 36) {\n id += byte.toString(36)\n } else if (byte < 62) {\n id += (byte - 26).toString(36).toUpperCase()\n } else if (byte > 62) {\n id += '-'\n } else {\n id += '_'\n }\n return id\n }, '')\nexport { nanoid, customAlphabet, customRandom, urlAlphabet, random }\n","import { customAlphabet } from 'nanoid';\nimport { WIDGET_VIEW_MIMETYPE } from './manager';\nimport type * as nbformat from '@jupyterlab/nbformat';\n\nconst nanoid = customAlphabet('1234567890abcdef', 8);\n\n/**\n * Creates a compact random id for use in runtime objects\n *\n * @returns string\n */\nexport function shortId() {\n return nanoid();\n}\n\nexport function ensureString(maybeString: string[] | string): string {\n if (Array.isArray(maybeString)) return maybeString.join('\\n');\n return maybeString;\n}\n\nexport function isMimeBundle({ output_type }: nbformat.IOutput) {\n return output_type === 'display_data' || output_type === 'execute_result';\n}\n\nexport function placeholder(plainText?: string) {\n return `\n
\n
\n
ipywidgets - a Jupyter kernel connection is required to fully display this output.
\n ${plainText && `
${plainText}
`}\n
\n`;\n}\n\nexport function assert(condition: any, msg?: string): asserts condition {\n if (!condition) {\n throw new Error(msg);\n }\n}\n\nexport function stripWidgets(\n outputs: nbformat.IOutput[],\n hideWidgets = true,\n placeholderFn: (plainText?: string) => string = placeholder,\n) {\n return outputs.map((output: nbformat.IOutput) => {\n if (!isMimeBundle(output)) return output;\n const { [WIDGET_VIEW_MIMETYPE]: widgets, ...others } = output.data as nbformat.IMimeBundle;\n if (!widgets) return output;\n\n let data = output.data;\n if (hideWidgets) data = { ...others };\n\n if (placeholderFn && !('text/html' in (data as nbformat.IMimeBundle)))\n // if there is not already an html bundle, add a placeholder to hide the plain/text field\n (data as nbformat.IMimeBundle)['text/html'] = placeholderFn(\n ensureString((data as nbformat.IMimeBundle)['text/plain'] as string | string[]),\n );\n\n const stripped = {\n ...output,\n data,\n };\n return stripped;\n });\n}\n","/**\n * Inspired by https://github.com/jupyterlab/jupyterlab-plugin-playground/blob/main/src/requirejs.ts\n */\n\nconst REQUIREJS_CDN_URL = 'https://cdn.jsdelivr.net/npm/';\nconst REQUIREJS_URL = 'https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js';\n\nexport interface IRequireJS {\n readonly require: Require;\n readonly define: RequireDefine;\n}\n\nasync function fetchAndLoadInFrame(baseUrl: string): Promise {\n if (typeof document === 'undefined')\n throw new Error('Cannot load requirejs outside of the browser');\n\n const res = await fetch(REQUIREJS_URL);\n if (!res.ok) {\n throw new Error(`Could not fetch requirejs ${res.status} ${res.statusText}`);\n }\n\n const requireJsSource = await res.text();\n\n return new Promise((resolve, reject) => {\n const iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n iframe.onload = () => {\n const contentWindow = iframe.contentWindow;\n if (!contentWindow) return reject('Cannot load in isolated: no contentWindow, origin error?');\n\n contentWindow.window.eval(requireJsSource);\n const requirejs: IRequireJS = {\n require: (contentWindow.window as any).require,\n define: (contentWindow.window as any).define,\n };\n if (!requirejs.require || !requirejs.define)\n return reject(\n 'Require.js loading did not result in `require` and `define` objects attachment to window',\n );\n\n requirejs.require.config({ baseUrl });\n\n resolve(requirejs);\n iframe.onload = null;\n };\n document.body.appendChild(iframe);\n });\n}\n\nexport class RequireJsLoader {\n requested: boolean;\n readonly baseUrl: string;\n readonly ready: Promise;\n requirejs?: IRequireJS;\n private resolveFn: (value: IRequireJS | PromiseLike) => void;\n\n constructor(baseUrl?: string) {\n this.baseUrl = baseUrl ?? REQUIREJS_CDN_URL;\n this.requested = false;\n this.resolveFn = () => ({});\n this.ready = new Promise((resolve) => (this.resolveFn = resolve));\n }\n\n async load(postLoadFn?: (require: Require, define: RequireDefine) => Promise | void) {\n if (!this.requested) {\n this.requested = true;\n this.requirejs = await fetchAndLoadInFrame(this.baseUrl);\n await postLoadFn?.(this.requirejs.require, this.requirejs.define);\n this.resolveFn(this.requirejs);\n }\n return this.ready;\n }\n}\n","import type { IRequireJS } from './requireJsLoader';\n\nconst cdn = 'https://cdn.jsdelivr.net/npm/';\n\n/**\n * Load a package using requirejs and return a promise\n */\nfunction requirePromise(requirejs: IRequireJS, moduleName: string) {\n return new Promise((resolve, reject) => requirejs.require([`${moduleName}`], resolve, reject));\n}\n\n/**\n * The URL structure is /npm/package@version/file.js\n */\nfunction moduleNameToCDNUrl(moduleName: string, moduleVersion: string) {\n let packageName = moduleName;\n let fileName = 'index'; // default filename\n // if a '/' is present, like 'foo/bar', packageName is changed to 'foo', and path to 'bar'\n // We first find the first '/'\n let index = moduleName.indexOf('/');\n if (index !== -1 && moduleName[0] === '@') {\n // if we have a namespace, it's a different story\n // @foo/bar/baz should translate to @foo/bar and baz\n // so we find the 2nd '/'\n index = moduleName.indexOf('/', index + 1);\n }\n if (index !== -1) {\n fileName = moduleName.substr(index + 1);\n packageName = moduleName.substr(0, index);\n }\n return `${cdn}${packageName}@${moduleVersion}/dist/${fileName}`;\n}\n\nasync function requireFromCDN(requirejs: IRequireJS, moduleName: string, moduleVersion: string) {\n const url = moduleNameToCDNUrl(moduleName, moduleVersion);\n const conf: { paths: { [key: string]: string } } = { paths: {} };\n conf.paths[moduleName] = url;\n requirejs.require.config(conf);\n\n try {\n // note: await needed here for try/catch behaviour\n const module = await requirePromise(requirejs, moduleName);\n return module;\n } catch (err: any) {\n console.error(`thebe:loader requirejs error on cdn require`, err);\n throw err;\n }\n}\n\n/**\n * Load an amd module locally and fall back to specified CDN if unavailable.\n *\n * @param moduleName The name of the module to load..\n * @param version The semver range for the module, if loaded from a CDN.\n *\n * By default, the CDN service used is cdn.jsdelivr.net. However, this default can be\n * overridden by specifying another URL via the HTML attribute\n * \"data-jupyter-widgets-cdn\" on a script tag of the page.\n *\n * The semver range is only used with the CDN.\n */\nexport async function requireLoader(\n requirejs: IRequireJS,\n moduleName: string,\n moduleVersion: string,\n useCDNOnly = false,\n): Promise {\n console.debug(`thebe:loader loading ${moduleName}@${moduleVersion}`);\n if (useCDNOnly) {\n return requireFromCDN(requirejs, moduleName, moduleVersion);\n } else {\n if (requirejs.require.defined(moduleName)) {\n return requirePromise(requirejs, moduleName);\n }\n console.debug(`thebe:loader falling back to ${cdn} for ${moduleName}@${moduleVersion}`);\n return requireFromCDN(requirejs, moduleName, moduleVersion);\n }\n}\n","import type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport type { Widget } from '@lumino/widgets';\nimport * as LuminoWidget from '@lumino/widgets';\nimport { MessageLoop } from '@lumino/messaging';\nimport { KernelWidgetManager, WidgetRenderer, output } from '@jupyter-widgets/jupyterlab-manager';\nimport * as base from '@jupyter-widgets/base';\nimport * as controls from '@jupyter-widgets/controls';\nimport { shortId } from './utils';\nimport { RequireJsLoader } from './requireJsLoader';\nimport { requireLoader } from './loader';\nimport type { Kernel } from '@jupyterlab/services';\n\nexport const WIDGET_STATE_MIMETYPE = 'application/vnd.jupyter.widget-state+json';\nexport const WIDGET_VIEW_MIMETYPE = 'application/vnd.jupyter.widget-view+json';\n\n/**\n * @deprecated use WIDGET_VIEW_MIMETYPE\n */\nexport const WIDGET_MIMETYPE = WIDGET_VIEW_MIMETYPE;\n\n/**\n * A Widget Manager class for Thebe using the context-free KernelWidgetManager from\n * the JupyterLab Manager and inspierd by the implementation in Voila here:\n * https://github.dev/voila-dashboards/voila/blob/main/packages/voila/src/manager.ts\n *\n */\nexport class ThebeManager extends KernelWidgetManager {\n id: string;\n _loader: RequireJsLoader;\n\n constructor(kernel: Kernel.IKernelConnection, rendermime: IRenderMimeRegistry) {\n super(kernel, rendermime);\n\n this.id = shortId();\n /** ensure this registry always gets the widget renderer.\n * This is essential for cases where widgets are rendered heirarchically\n */\n this.rendermime.addFactory(\n {\n safe: false,\n mimeTypes: [WIDGET_VIEW_MIMETYPE],\n createRenderer: (options) => new WidgetRenderer(options, this as any),\n },\n 1,\n );\n\n this._registerWidgets();\n this._loader = new RequireJsLoader();\n }\n\n /**\n * TODO implement a reasonable method for thebe-core that can load serialized widget state\n * see: https://github.dev/voila-dashboards/voila/blob/7090eb3e30c0c4aa25c2b7d5d2d45e8de1333b3b/packages/voila/src/manager.ts#L52\n *\n */\n async build_widgets(): Promise {\n throw new Error('ThebeManager:build_widgets not implmented');\n }\n\n async display_view(msg: any, view: any, options: any): Promise {\n if (options.el) {\n LuminoWidget.Widget.attach(view.luminoWidget, options.el);\n }\n if (view.el) {\n view.el.setAttribute('data-thebe-jupyter-widget', '');\n view.el.addEventListener('jupyterWidgetResize', () => {\n MessageLoop.postMessage(view.luminoWidget, LuminoWidget.Widget.ResizeMessage.UnknownSize);\n });\n }\n return view.luminoWidget;\n }\n\n async loadClass(\n className: string,\n moduleName: string,\n moduleVersion: string,\n ): Promise {\n if (!this._loader.requested) {\n console.debug(`thebe:manager:loadClass initial requirejs load ${this.id}`);\n this._loader.load((require, define) => {\n define('@jupyter-widgets/base', base as any);\n define('@jupyter-widgets/controls', controls as any);\n define('@jupyter-widgets/output', output as any);\n });\n }\n\n console.debug(`thebe:manager:loadClass ${moduleName}@${moduleVersion}`);\n const rjs = await this._loader.ready;\n\n if (\n moduleName === '@jupyter-widgets/base' ||\n moduleName === '@jupyter-widgets/controls' ||\n moduleName === '@jupyter-widgets/output'\n ) {\n return super.loadClass(className, moduleName, moduleVersion);\n } else {\n let mod;\n try {\n mod = await requireLoader(rjs, moduleName, moduleVersion);\n } catch (err) {\n console.error(`thebe:manager:loadClass loader error`, err);\n throw err;\n }\n if (mod[className]) {\n return mod[className];\n } else {\n console.error(\n `thebe:manager:loadClass ${className} not found in module ${moduleName}@${moduleVersion}`,\n );\n throw new Error(`Class ${className} not found in module ${moduleName}@${moduleVersion}`);\n }\n }\n }\n\n private _registerWidgets() {\n this.register({\n name: '@jupyter-widgets/base',\n version: base.JUPYTER_WIDGETS_VERSION,\n exports: base as unknown as base.ExportData, // TODO improve typing\n });\n this.register({\n name: '@jupyter-widgets/controls',\n version: controls.JUPYTER_CONTROLS_VERSION,\n exports: controls as unknown as base.ExportData, // TODO improve typing\n });\n this.register({\n name: '@jupyter-widgets/output',\n version: output.OUTPUT_WIDGET_VERSION,\n exports: output as any,\n });\n }\n}\n","import type { Config } from './config';\nimport type { EventObject, EventSubject, StatusEvent, ErrorStatusEvent } from './events';\nimport { ThebeEventType } from './events';\n\nexport class EventEmitter {\n private _id: string;\n private _config: Config;\n private _subject: EventSubject;\n private _object: EventObject;\n\n constructor(id: string, config: Config, subject: EventSubject, object: EventObject) {\n this._id = id;\n this._config = config;\n this._subject = subject;\n this._object = object;\n }\n\n triggerStatus({ status, message }: { status: StatusEvent; message: string }) {\n console.debug(`${status} ${message}`);\n this._config.events.trigger(ThebeEventType.status, {\n subject: this._subject,\n id: this._id,\n object: this._object,\n status,\n message,\n });\n }\n\n triggerError({ status, message }: { status: ErrorStatusEvent; message: string }) {\n console.debug(`Error [${this._subject}][${this._id}] ${message}`);\n\n this._config.events.trigger(ThebeEventType.error, {\n subject: this._subject,\n id: this._id,\n object: this._object,\n status,\n message,\n });\n }\n}\n","import type { ISessionConnection } from '@jupyterlab/services/lib/session/session';\nimport { ErrorStatusEvent, EventSubject, SessionStatusEvent } from './events';\nimport { ThebeManager } from './manager';\nimport type ThebeServer from './server';\nimport { EventEmitter } from './emitter';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\n\nclass ThebeSession {\n readonly server: ThebeServer;\n readonly manager: ThebeManager;\n // see https://github.dev/jupyterlab/jupyterlab/blob/d48e0c04efb786561137fb20773fc15788507f0a/packages/logconsole/src/widget.ts line 43\n private connection: ISessionConnection;\n private events: EventEmitter;\n\n constructor(\n server: ThebeServer,\n connection: ISessionConnection,\n rendermime: IRenderMimeRegistry,\n manager?: ThebeManager,\n ) {\n this.server = server;\n this.connection = connection;\n this.events = new EventEmitter(this.connection.id, server.config, EventSubject.session, this);\n\n if (this.connection.kernel == null) throw Error('ThebeSession - kernel is null');\n this.manager = manager ?? new ThebeManager(this.connection.kernel, rendermime);\n\n this.connection.statusChanged.connect((_, s) => {\n // 'unknown' | 'starting' | 'idle' | 'busy' | 'terminating' | 'restarting' | 'autorestarting' | 'dead'\n let status;\n switch (s) {\n case 'starting':\n case 'restarting':\n case 'autorestarting':\n status = SessionStatusEvent.starting;\n break;\n case 'idle':\n case 'busy':\n status = SessionStatusEvent.ready;\n break;\n case 'terminating':\n case 'dead':\n default:\n status = SessionStatusEvent.shutdown;\n break;\n }\n\n this.events.triggerStatus({\n status,\n message: `kernel ${this.connection.name} status changed to ${status}[${s}]`,\n });\n if (s === 'dead') {\n this.events.triggerError({\n status: ErrorStatusEvent.session,\n message: `kernel ${this.connection.name} is dead`,\n });\n this.dispose();\n }\n });\n\n this.connection.disposed.connect(() => {\n this.events.triggerStatus({\n status: SessionStatusEvent.shutdown,\n message: `kernel ${this.connection.name} disposed`,\n });\n });\n\n this.events.triggerStatus({\n status: SessionStatusEvent.ready,\n message: `ThebeSession created, kernel '${this.connection.kernel?.name}' available`,\n });\n }\n\n get id() {\n return this.connection.id;\n }\n\n get kernel() {\n return this.connection?.kernel;\n }\n\n get path() {\n return this.connection.path;\n }\n\n get name() {\n return this.connection.name;\n }\n\n async restart() {\n console.debug(`requesting restart for kernel ${this.id}`);\n const p = this.connection.kernel?.restart();\n\n this.events.triggerStatus({\n status: SessionStatusEvent.starting,\n message: `Kernel restart requested`,\n });\n\n await p;\n\n this.events.triggerStatus({\n status: SessionStatusEvent.ready,\n message: `session restarted, kernel '${this.connection.kernel?.name}' available`,\n });\n }\n\n async shutdown() {\n if (this.connection.isDisposed) return;\n await this.connection.shutdown();\n this.events.triggerStatus({\n status: SessionStatusEvent.shutdown,\n message: `session ${this.name}`,\n });\n this.dispose();\n }\n\n dispose() {\n if (!this.connection.isDisposed) this.connection.dispose();\n }\n}\n\nexport default ThebeSession;\n","import type {\n BinderUrlSet,\n KernelOptions,\n RepoProviderSpec,\n RestAPIContentsResponse,\n ServerRestAPI,\n ServerRuntime,\n ServerSettings,\n SessionIModel,\n} from './types';\nimport type { Config } from './config';\nimport type { ServiceManager, Session } from '@jupyterlab/services';\nimport type { LiteServerConfig } from 'thebe-lite';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport type { StatusEvent } from './events';\nimport { WELL_KNOWN_REPO_PROVIDERS, makeBinderUrls } from './url';\nimport { getExistingServer, saveServerInfo } from './sessions';\nimport {\n KernelManager,\n KernelSpecAPI,\n ServerConnection,\n SessionManager,\n} from '@jupyterlab/services';\nimport ThebeSession from './session';\nimport { shortId } from './utils';\nimport { ServerStatusEvent, EventSubject, ErrorStatusEvent } from './events';\nimport { EventEmitter } from './emitter';\n\nasync function responseToJson(res: Response) {\n if (!res.ok) throw Error(`${res.status} - ${res.statusText}`);\n const json = await res.json();\n return json as RestAPIContentsResponse;\n}\n\nfunction errorAsString(errorLike: any): string {\n if (typeof errorLike === 'string') return errorLike;\n if (errorLike.message) return errorLike.message;\n if (errorLike.status && errorLike.statusText)\n return `${errorLike.status} - ${errorLike.statusText}`;\n return JSON.stringify(errorLike);\n}\n\nclass ThebeServer implements ServerRuntime, ServerRestAPI {\n readonly id: string;\n readonly config: Config;\n readonly ready: Promise;\n sessionManager?: Session.IManager;\n serviceManager?: ServiceManager; // jlite only\n repoProviders?: RepoProviderSpec[];\n binderUrls?: BinderUrlSet;\n userServerUrl?: string;\n private resolveReadyFn?: (value: ThebeServer | PromiseLike) => void;\n private rejectReadyFn?: (reason?: any) => void;\n private _isDisposed: boolean;\n private events: EventEmitter;\n\n constructor(config: Config) {\n this.id = shortId();\n this.config = config;\n this.events = new EventEmitter(this.id, config, EventSubject.server, this);\n this.ready = new Promise((resolve, reject) => {\n this.resolveReadyFn = resolve;\n this.rejectReadyFn = reject;\n });\n this._isDisposed = false;\n }\n\n get isBinder(): boolean {\n return !!this.binderUrls;\n }\n\n get isReady(): boolean {\n return this.sessionManager?.isReady ?? false;\n }\n\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n get settings() {\n return this.sessionManager?.serverSettings;\n }\n\n async shutdownSession(id: string) {\n return this.sessionManager?.shutdown(id);\n }\n\n async shutdownAllSessions() {\n return this.sessionManager?.shutdownAll();\n }\n\n async check(): Promise {\n const resp = await ThebeServer.status(\n this.sessionManager?.serverSettings ?? this.config.serverSettings,\n );\n return resp.ok;\n }\n\n dispose() {\n if (this._isDisposed) return;\n if (!this.serviceManager?.isDisposed) this.serviceManager?.dispose();\n if (!this.sessionManager?.isDisposed) this.sessionManager?.dispose();\n\n // Implementing the flag at this level as\n this._isDisposed = true;\n }\n\n async startNewSession(\n rendermime: IRenderMimeRegistry,\n\n kernelOptions?: KernelOptions,\n ): Promise {\n await this.ready;\n\n if (!this.sessionManager) {\n throw Error('Requesting session from a server, with no SessionManager available');\n }\n\n await this.sessionManager.ready;\n\n // name is assumed to be a non empty string but is otherwise not required\n // if a notebook name has been supplied on the path, use that otherwise use a default\n // https://jupyterlab.readthedocs.io/en/3.4.x/api/modules/services.session.html#isessionoptions\n let path = kernelOptions?.path ?? this.config.kernels.path;\n let name = 'thebe.ipynb';\n const match = path.match(/\\/*([a-zA-Z0-9-]+.ipynb)$/);\n if (match) {\n name = match[1];\n }\n\n const kernelName = kernelOptions?.kernelName ?? this.config.kernels.kernelName;\n\n console.debug('thebe:api:startNewSession server', this);\n console.debug('thebe:api:startNewSession', { name, path, kernelName });\n\n if (this.serviceManager) {\n // Temporary Fix: thebe-lite does not yet support filesystem based resouces fully,\n // so we can't use a path that points to a sub folder.\n path = path.slice(1).replace(/\\//g, '-');\n }\n\n const connection = await this.sessionManager?.startNew({\n name,\n path,\n type: 'notebook',\n kernel: {\n name: kernelName,\n },\n });\n\n return new ThebeSession(this, connection, rendermime);\n }\n\n async listRunningSessions(): Promise {\n await this.ready;\n const iter = this.sessionManager?.running();\n const models: SessionIModel[] = [];\n let result = iter?.next();\n while (result && !result.done) {\n models.push(result.value);\n result = iter?.next();\n }\n return models;\n }\n\n async refreshRunningSessions(): Promise {\n await this.ready;\n await this.sessionManager?.refreshRunning();\n return this.listRunningSessions();\n }\n\n async connectToExistingSession(model: SessionIModel, rendermime: IRenderMimeRegistry) {\n await this.ready;\n if (!this.sessionManager) {\n throw Error('Requesting session from a server, with no SessionManager available');\n }\n\n await this.sessionManager.ready;\n\n const connection = this.sessionManager?.connectTo({ model });\n return new ThebeSession(this, connection, rendermime);\n }\n\n async clearSavedBinderSessions() {\n const urls = this.makeBinderUrls();\n window.localStorage.removeItem(urls.storageKey);\n }\n\n /**\n * Connect to a Jupyter server directly\n *\n */\n async connectToJupyterServer(): Promise {\n console.debug('thebe:api:connectToJupyterServer:serverSettings:', this.config.serverSettings);\n const serverSettings = ServerConnection.makeSettings(this.config.serverSettings);\n\n // ping the server to check it is alive before trying to\n // hook up services\n try {\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Checking server url`,\n });\n await ThebeServer.status(serverSettings);\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Server reachable`,\n });\n // eslint-disable-next-line no-empty\n } catch (err: any) {\n const message = `Server not reachable (${serverSettings.baseUrl}) - ${err}`;\n this.events.triggerError({\n status: ErrorStatusEvent.error,\n message,\n });\n this.rejectReadyFn?.(message);\n return;\n }\n\n const kernelManager = new KernelManager({ serverSettings });\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Created KernelManager`,\n });\n\n this.sessionManager = new SessionManager({\n kernelManager,\n serverSettings,\n });\n\n this.sessionManager.connectionFailure.connect((_, err) => {\n this.events.triggerError({\n status: ErrorStatusEvent.server,\n message: `connection failure: ${err}`,\n });\n });\n\n this.sessionManager.runningChanged.connect((_, models) => {\n this.events.triggerStatus({\n status: ServerStatusEvent.ready,\n message: `${models.length} running sessions changed: ${models\n .map((m) => m.name)\n .join(',')}`,\n });\n });\n\n this.events.triggerStatus({\n status: ServerStatusEvent.ready,\n message: `Created SessionManager`,\n });\n\n // Resolve the ready promise\n return this.sessionManager.ready.then(\n () => {\n this.userServerUrl = `${serverSettings.baseUrl}?token=${serverSettings.token}`;\n this.events.triggerStatus({\n status: ServerStatusEvent.ready,\n message: `Server connection ready`,\n });\n this.resolveReadyFn?.(this);\n },\n (err) => this.rejectReadyFn?.(errorAsString(err)),\n );\n }\n\n /**\n * Connect to Jupyterlite Server\n */\n async connectToJupyterLiteServer(config?: LiteServerConfig): Promise {\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Connecting to JupyterLite`,\n });\n\n if (!window.thebeLite)\n throw new Error(\n `thebe-lite is not available at window.thebeLite - load this onto your page before loading thebe or thebe-core.`,\n );\n\n this.serviceManager = await window.thebeLite.startJupyterLiteServer(config);\n\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Started JupyterLite server`,\n });\n\n console.debug(\n 'thebe:api:connectToJupyterLiteServer:serverSettings:',\n this.serviceManager.serverSettings,\n );\n\n this.sessionManager = this.serviceManager.sessions;\n\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Received SessionMananger from JupyterLite`,\n });\n\n return this.sessionManager?.ready.then(\n () => {\n this.userServerUrl = '/'; // TODO bundle jlite UI `${this.serviceManager?.serverSettings.baseUrl}?token=${this.serviceManager?.serverSettings.token}`;\n this.events.triggerStatus({\n status: ServerStatusEvent.ready,\n message: `Server connection established`,\n });\n this.resolveReadyFn?.(this);\n },\n (err) => this.rejectReadyFn?.(errorAsString(err)),\n );\n }\n\n makeBinderUrls() {\n return makeBinderUrls(this.config, this.repoProviders ?? WELL_KNOWN_REPO_PROVIDERS);\n }\n\n async checkForSavedBinderSession() {\n try {\n const { storageKey } = makeBinderUrls(\n this.config,\n this.repoProviders ?? WELL_KNOWN_REPO_PROVIDERS,\n );\n return getExistingServer(this.config.savedSessions, storageKey);\n } catch (err: any) {\n this.events.triggerError({\n status: ErrorStatusEvent.error,\n message: `${err} - Failed to check for saved session.`,\n });\n return null;\n }\n }\n\n /**\n * Connect to a Binder instance in order to\n * access a Jupyter server that can provide kernels\n *\n * @param ctx\n * @param opts\n * @returns\n */\n async connectToServerViaBinder(customProviders?: RepoProviderSpec[]): Promise {\n // request new server\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Connecting to binderhub at ${this.config.binder.binderUrl}`,\n });\n\n // TODO binder connection setup probably better as a a factory independent of the server\n this.repoProviders = [...WELL_KNOWN_REPO_PROVIDERS, ...(customProviders ?? [])];\n\n try {\n this.binderUrls = makeBinderUrls(this.config, this.repoProviders);\n } catch (err: any) {\n this.events.triggerError({\n status: ErrorStatusEvent.error,\n message: `${err} - Failed to connect to binderhub at ${this.config.binder.binderUrl}`,\n });\n return;\n }\n const urls = this.binderUrls;\n\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Binder build url is ${urls.build}`,\n });\n\n if (this.config.savedSessions.enabled) {\n console.debug('thebe:server:connectToServerViaBinder Checking for saved session...');\n // the follow function will ping the server based on the settings and only return\n // non-null if the server is still alive. So highly likely that the remainder of\n // the connection calls below, work.\n const existingSettings = await this.checkForSavedBinderSession();\n if (existingSettings) {\n // Connect to the existing session\n const serverSettings = ServerConnection.makeSettings(existingSettings);\n const kernelManager = new KernelManager({ serverSettings });\n\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Created KernelManager`,\n });\n\n this.sessionManager = new SessionManager({\n kernelManager,\n serverSettings,\n });\n\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Created KernelManager`,\n });\n\n return this.sessionManager.ready.then(\n () => {\n this.userServerUrl = `${serverSettings.baseUrl}?token=${serverSettings.token}`;\n this.events.triggerStatus({\n status: ServerStatusEvent.ready,\n message: `Re-connected to binder server`,\n });\n this.resolveReadyFn?.(this);\n },\n (err) => this.rejectReadyFn?.(errorAsString(err)),\n );\n // else drop out of this block and request a new session\n }\n }\n\n // TODO we can get rid of one level of promise here?\n // Talk to the binder server\n const state: { status: StatusEvent } = {\n status: ServerStatusEvent.launching,\n };\n const es = new EventSource(urls.build);\n this.events.triggerStatus({\n status: state.status,\n message: `Opened connection to binder: ${urls.build}`,\n });\n\n // handle errors\n es.onerror = (evt: Event) => {\n console.error(`Lost connection to binder: ${urls.build}`, evt);\n es?.close();\n state.status = ErrorStatusEvent.error;\n const data = (evt as MessageEvent)?.data;\n const phase = data ? data.phase : 'unknown';\n const message = `Lost connection to binder: ${urls.build}\\nphase: ${phase} - ${\n data ? data.message : 'no message'\n }`;\n this.events.triggerError({\n status: ErrorStatusEvent.error,\n message,\n });\n this.rejectReadyFn?.(message);\n };\n\n es.onmessage = async (evt: MessageEvent) => {\n const msg: {\n // TODO must be in Jupyterlab types somewhere\n phase: string;\n message: string;\n url: string;\n token: string;\n } = JSON.parse(evt.data);\n\n const phase = msg.phase?.toLowerCase() ?? '';\n switch (phase) {\n case 'failed':\n es?.close();\n state.status = ErrorStatusEvent.error;\n this.events.triggerError({\n status: ErrorStatusEvent.error,\n message: `Binder: failed to build - ${urls.build} - ${msg.message}`,\n });\n this.rejectReadyFn?.(msg.message);\n break;\n case 'ready':\n {\n es?.close();\n\n const settings: ServerSettings = {\n baseUrl: msg.url,\n wsUrl: 'ws' + msg.url.slice(4),\n token: msg.token,\n appendToken: true,\n };\n\n const serverSettings = ServerConnection.makeSettings(settings);\n const kernelManager = new KernelManager({ serverSettings });\n this.sessionManager = new SessionManager({\n kernelManager,\n serverSettings,\n });\n\n if (this.config.savedSessions.enabled) {\n saveServerInfo(urls.storageKey, this.id, serverSettings);\n console.debug(\n `thebe:server:connectToServerViaBinder Saved session for ${this.id} at ${urls.build}`,\n );\n }\n\n // promise has already been returned to the caller\n // so we can await here\n await this.sessionManager.ready;\n\n this.userServerUrl = `${msg.url}?token=${msg.token}`;\n\n state.status = ServerStatusEvent.ready;\n this.events.triggerStatus({\n status: state.status,\n message: `Binder server is ready: ${msg.message}`,\n });\n\n this.resolveReadyFn?.(this);\n }\n break;\n default:\n this.events.triggerStatus({\n status: state.status,\n message: `Binder is: ${phase} - ${msg.message}`,\n });\n }\n };\n }\n\n //\n // ServerRestAPI Implementation\n //\n getFetchUrl(relativeUrl: string) {\n // TODO use ServerConnection.makeRequest - this willadd the token\n // and use any internal fetch overrides\n // TODO BUG this is the wrong serverSetting, they should be for the active connection\n if (!this.sessionManager)\n throw new Error('Must connect to a server before requesting KernelSpecs');\n if (!this.sessionManager?.serverSettings)\n throw new Error('No server settings available in session manager');\n const settings = this.sessionManager?.serverSettings;\n const baseUrl = new URL(settings.baseUrl);\n const url = new URL(`${baseUrl.pathname}${relativeUrl}`.replace('//', '/'), baseUrl.origin);\n url.searchParams.append('token', settings.token);\n return url;\n }\n\n static status(serverSettings: ServerSettings) {\n return ServerConnection.makeRequest(\n `${serverSettings.baseUrl}api/status`,\n {},\n ServerConnection.makeSettings(serverSettings),\n );\n }\n\n async getKernelSpecs() {\n if (!this.sessionManager)\n throw new Error('Must connect to a server before requesting KernelSpecs');\n return KernelSpecAPI.getSpecs(\n ServerConnection.makeSettings(this.sessionManager?.serverSettings),\n );\n }\n\n async getContents(opts: {\n path: string;\n type?: 'notebook' | 'file' | 'directory';\n format?: 'text' | 'base64';\n returnContent?: boolean;\n }) {\n const url = this.getFetchUrl(`/api/contents/${opts.path}`);\n if (opts.type) url.searchParams.append('type', opts.type);\n if (opts.format) url.searchParams.append('format', opts.format);\n url.searchParams.append('content', opts.returnContent ? '1' : '0');\n return responseToJson(await fetch(url));\n }\n\n async duplicateFile(opts: {\n path: string;\n copy_from: string;\n ext?: string;\n type?: 'notebook' | 'file';\n }) {\n const url = this.getFetchUrl(`/api/contents/${opts.path}`);\n const { copy_from, ext, type } = opts;\n return responseToJson(\n await fetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ copy_from, ext, type }),\n }),\n );\n }\n\n async createDirectory(opts: { path: string }) {\n const url = this.getFetchUrl(`/api/contents/${opts.path}`);\n return responseToJson(\n await fetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ type: 'directory' }),\n }),\n );\n }\n\n async renameContents(opts: { path: string; newPath: string }) {\n const { path, newPath } = opts;\n const url = this.getFetchUrl(`/api/contents/${path}`);\n return responseToJson(\n await fetch(url, {\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ path: newPath }),\n }),\n );\n }\n\n async uploadFile(opts: {\n path: string;\n content: string;\n format?: 'json' | 'text' | 'base64';\n type?: 'notebook' | 'file';\n }) {\n const { path, content, format, type } = opts;\n const url = this.getFetchUrl(`/api/contents/${path}`);\n console.debug('thebe:api:server:uploadFile', url);\n return responseToJson(\n await fetch(url, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n path,\n content,\n format: format ?? 'json',\n type: type ?? 'notebook',\n }),\n }),\n );\n }\n}\n\nexport default ThebeServer;\n","import * as widgets from './widgets';\n/**\n * A mime renderer factory for raw html.\n */\nexport const htmlRendererFactory = {\n safe: true,\n mimeTypes: ['text/html'],\n defaultRank: 50,\n createRenderer: options => new widgets.RenderedHTML(options)\n};\n/**\n * A mime renderer factory for images.\n */\nexport const imageRendererFactory = {\n safe: true,\n mimeTypes: [\n 'image/bmp',\n 'image/png',\n 'image/jpeg',\n 'image/gif',\n 'image/webp'\n ],\n defaultRank: 90,\n createRenderer: options => new widgets.RenderedImage(options)\n};\n/**\n * A mime renderer factory for LaTeX.\n */\nexport const latexRendererFactory = {\n safe: true,\n mimeTypes: ['text/latex'],\n defaultRank: 70,\n createRenderer: options => new widgets.RenderedLatex(options)\n};\n/**\n * A mime renderer factory for Markdown.\n */\nexport const markdownRendererFactory = {\n safe: true,\n mimeTypes: ['text/markdown'],\n defaultRank: 60,\n createRenderer: options => new widgets.RenderedMarkdown(options)\n};\n/**\n * A mime renderer factory for svg.\n */\nexport const svgRendererFactory = {\n safe: false,\n mimeTypes: ['image/svg+xml'],\n defaultRank: 80,\n createRenderer: options => new widgets.RenderedSVG(options)\n};\n/**\n * A mime renderer factory for rendering stderr outputs\n */\nexport const errorRendererFactory = {\n safe: true,\n mimeTypes: ['application/vnd.jupyter.stderr'],\n defaultRank: 110,\n createRenderer: options => new widgets.RenderedError(options)\n};\n/**\n * A mime renderer factory for plain and jupyter console text data.\n */\nexport const textRendererFactory = {\n safe: true,\n mimeTypes: ['text/plain', 'application/vnd.jupyter.stdout'],\n defaultRank: 120,\n createRenderer: options => new widgets.RenderedText(options)\n};\n/**\n * A placeholder factory for rendered JavaScript.\n */\nexport const javaScriptRendererFactory = {\n safe: false,\n mimeTypes: ['text/javascript', 'application/javascript'],\n defaultRank: 110,\n createRenderer: options => new widgets.RenderedJavaScript(options)\n};\n/**\n * The standard factories provided by the rendermime package.\n */\nexport const standardRendererFactories = [\n htmlRendererFactory,\n markdownRendererFactory,\n latexRendererFactory,\n svgRendererFactory,\n imageRendererFactory,\n javaScriptRendererFactory,\n errorRendererFactory,\n textRendererFactory\n];\n//# sourceMappingURL=factories.js.map","/* eslint-disable camelcase */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport sanitize from 'sanitize-html';\n/**\n * Helper class that contains regular expressions for inline CSS style validation.\n *\n * Which properties (and values) to allow is largely based on the Google Caja project:\n * https://github.com/google/caja\n *\n * The regular expressions are largly based on the syntax definition found at\n * https://developer.mozilla.org/en-US/docs/Web/CSS.\n */\nclass CssProp {\n static reg(r) {\n return new RegExp('^' + r + '$', 'i');\n }\n}\n/*\n * Numeric base expressions used to help build more complex regular expressions\n */\nCssProp.N = {\n integer: `[+-]?[0-9]+`,\n integer_pos: `[+]?[0-9]+`,\n integer_zero_ff: `([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,\n number: `[+-]?([0-9]*[.])?[0-9]+(e-?[0-9]*)?`,\n number_pos: `[+]?([0-9]*[.])?[0-9]+(e-?[0-9]*)?`,\n number_zero_hundred: `[+]?(([0-9]|[1-9][0-9])([.][0-9]+)?|100)`,\n number_zero_one: `[+]?(1([.][0]+)?|0?([.][0-9]+)?)`\n};\n/*\n * Base expressions of common CSS syntax elements\n */\nCssProp.B = {\n angle: `(${CssProp.N.number}(deg|rad|grad|turn)|0)`,\n frequency: `${CssProp.N.number}(Hz|kHz)`,\n ident: String.raw `-?([_a-z]|[\\xA0-\\xFF]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])([_a-z0-9-]|[\\xA0-\\xFF]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*`,\n len_or_perc: `(0|${CssProp.N.number}(px|em|rem|ex|in|cm|mm|pt|pc|%))`,\n length: `(${CssProp.N.number}(px|em|rem|ex|in|cm|mm|pt|pc)|0)`,\n length_pos: `(${CssProp.N.number_pos}(px|em|rem|ex|in|cm|mm|pt|pc)|0)`,\n percentage: `${CssProp.N.number}%`,\n percentage_pos: `${CssProp.N.number_pos}%`,\n percentage_zero_hundred: `${CssProp.N.number_zero_hundred}%`,\n string: String.raw `(\\\"([^\\n\\r\\f\\\\\"]|\\\\\\n|\\r\\n|\\r|\\f|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*\\\")|(\\'([^\\n\\r\\f\\\\']|\\\\\\n|\\r\\n|\\r|\\f|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*\\')`,\n time: `${CssProp.N.number}(s|ms)`,\n url: `url\\\\(.*?\\\\)`,\n z_index: `[+-]?[0-9]{1,7}`\n};\n/*\n * Atomic (i.e. not dependant on other regular expressions) sub RegEx segments\n */\nCssProp.A = {\n absolute_size: `xx-small|x-small|small|medium|large|x-large|xx-large`,\n attachment: `scroll|fixed|local`,\n bg_origin: `border-box|padding-box|content-box`,\n border_style: `none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset`,\n box: `border-box|padding-box|content-box`,\n display_inside: `auto|block|table|flex|grid`,\n display_outside: `block-level|inline-level|none|table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption`,\n ending_shape: `circle|ellipse`,\n generic_family: `serif|sans-serif|cursive|fantasy|monospace`,\n generic_voice: `male|female|child`,\n relative_size: `smaller|larger`,\n repeat_style: `repeat-x|repeat-y|((?:repeat|space|round|no-repeat)(?:\\\\s*(?:repeat|space|round|no-repeat))?)`,\n side_or_corner: `(left|right)?\\\\s*(top|bottom)?`,\n single_animation_direction: `normal|reverse|alternate|alternate-reverse`,\n single_animation_fill_mode: `none|forwards|backwards|both`,\n single_animation_play_state: `running|paused`\n};\n/*\n * Color definition sub expressions\n */\nCssProp._COLOR = {\n hex: `\\\\#(0x)?[0-9a-f]+`,\n name: `aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|transparent|violet|wheat|white|whitesmoke|yellow|yellowgreen`,\n rgb: String.raw `rgb\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*\\)`,\n rgba: String.raw `rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(${CssProp.N.integer_zero_ff}|${CssProp.N.number_zero_one}|${CssProp.B.percentage_zero_hundred})\\s*\\)`\n};\n/*\n * Compound (i.e. dependant on other (sub) regular expressions) sub RegEx segments\n */\nCssProp._C = {\n alpha: `${CssProp.N.integer_zero_ff}|${CssProp.N.number_zero_one}|${CssProp.B.percentage_zero_hundred}`,\n alphavalue: CssProp.N.number_zero_one,\n bg_position: `((${CssProp.B.len_or_perc}|left|center|right|top|bottom)\\\\s*){1,4}`,\n bg_size: `(${CssProp.B.length_pos}|${CssProp.B.percentage}|auto){1,2}|cover|contain`,\n border_width: `thin|medium|thick|${CssProp.B.length}`,\n bottom: `${CssProp.B.length}|auto`,\n color: `${CssProp._COLOR.hex}|${CssProp._COLOR.rgb}|${CssProp._COLOR.rgba}|${CssProp._COLOR.name}`,\n color_stop_length: `(${CssProp.B.len_or_perc}\\\\s*){1,2}`,\n linear_color_hint: `${CssProp.B.len_or_perc}`,\n family_name: `${CssProp.B.string}|(${CssProp.B.ident}\\\\s*)+`,\n image_decl: CssProp.B.url,\n left: `${CssProp.B.length}|auto`,\n loose_quotable_words: `(${CssProp.B.ident})+`,\n margin_width: `${CssProp.B.len_or_perc}|auto`,\n padding_width: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}`,\n page_url: CssProp.B.url,\n position: `((${CssProp.B.len_or_perc}|left|center|right|top|bottom)\\\\s*){1,4}`,\n right: `${CssProp.B.length}|auto`,\n shadow: '',\n size: `closest-side|farthest-side|closest-corner|farthest-corner|${CssProp.B.length}|(${CssProp.B.len_or_perc})\\\\s+(${CssProp.B.len_or_perc})`,\n top: `${CssProp.B.length}|auto`\n};\nCssProp._C1 = {\n image_list: `image\\\\(\\\\s*(${CssProp.B.url})*\\\\s*(${CssProp.B.url}|${CssProp._C.color})\\\\s*\\\\)`,\n linear_color_stop: `(${CssProp._C.color})(\\\\s*${CssProp._C.color_stop_length})?`,\n shadow: `((${CssProp._C.color})\\\\s+((${CssProp.B.length})\\\\s*){2,4}(\\s+inset)?)|((inset\\\\s+)?((${CssProp.B.length})\\\\s*){2,4}\\\\s*(${CssProp._C.color})?)`\n};\nCssProp._C2 = {\n color_stop_list: `((${CssProp._C1.linear_color_stop})(\\\\s*(${CssProp._C.linear_color_hint}))?\\\\s*,\\\\s*)+(${CssProp._C1.linear_color_stop})`,\n shape: `rect\\\\(\\\\s*(${CssProp._C.top})\\\\s*,\\\\s*(${CssProp._C.right})\\\\s*,\\\\s*(${CssProp._C.bottom})\\\\s*,\\\\s*(${CssProp._C.left})\\\\s*\\\\)`\n};\nCssProp._C3 = {\n linear_gradient: `linear-gradient\\\\((((${CssProp.B.angle})|to\\\\s+(${CssProp.A.side_or_corner}))\\\\s*,\\\\s*)?\\\\s*(${CssProp._C2.color_stop_list})\\\\s*\\\\)`,\n radial_gradient: `radial-gradient\\\\(((((${CssProp.A.ending_shape})|(${CssProp._C.size}))\\\\s*)*\\\\s*(at\\\\s+${CssProp._C.position})?\\\\s*,\\\\s*)?\\\\s*(${CssProp._C2.color_stop_list})\\\\s*\\\\)`\n};\nCssProp._C4 = {\n image: `${CssProp.B.url}|${CssProp._C3.linear_gradient}|${CssProp._C3.radial_gradient}|${CssProp._C1.image_list}`,\n bg_image: `(${CssProp.B.url}|${CssProp._C3.linear_gradient}|${CssProp._C3.radial_gradient}|${CssProp._C1.image_list})|none`\n};\nCssProp.C = {\n ...CssProp._C,\n ...CssProp._C1,\n ...CssProp._C2,\n ...CssProp._C3,\n ...CssProp._C4\n};\n/*\n * Property value regular expressions not dependant on other sub expressions\n */\nCssProp.AP = {\n border_collapse: `collapse|separate`,\n box: `normal|none|contents`,\n box_sizing: `content-box|padding-box|border-box`,\n caption_side: `top|bottom`,\n clear: `none|left|right|both`,\n direction: `ltr|rtl`,\n empty_cells: `show|hide`,\n float: `left|right|none`,\n font_stretch: `normal|wider|narrower|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded`,\n font_style: `normal|italic|oblique`,\n font_variant: `normal|small-caps`,\n font_weight: `normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900`,\n list_style_position: `inside|outside`,\n list_style_type: `disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-latin|upper-latin|armenian|georgian|lower-alpha|upper-alpha|none`,\n overflow: `visible|hidden|scroll|auto`,\n overflow_wrap: `normal|break-word`,\n overflow_x: `visible|hidden|scroll|auto|no-display|no-content`,\n page_break_after: `auto|always|avoid|left|right`,\n page_break_before: `auto|always|avoid|left|right`,\n page_break_inside: `avoid|auto`,\n position: `static|relative|absolute`,\n resize: `none|both|horizontal|vertical`,\n speak: `normal|none|spell-out`,\n speak_header: `once|always`,\n speak_numeral: `digits|continuous`,\n speak_punctuation: `code|none`,\n table_layout: `auto|fixed`,\n text_align: `left|right|center|justify`,\n text_decoration: `none|((underline|overline|line-through|blink)\\\\s*)+`,\n text_transform: `capitalize|uppercase|lowercase|none`,\n text_wrap: `normal|unrestricted|none|suppress`,\n unicode_bidi: `normal|embed|bidi-override`,\n visibility: `visible|hidden|collapse`,\n white_space: `normal|pre|nowrap|pre-wrap|pre-line`,\n word_break: `normal|keep-all|break-all`\n};\n/*\n * Compound propertiy value regular expressions (i.e. dependant on other sub expressions)\n */\nCssProp._CP = {\n background_attachment: `${CssProp.A.attachment}(,\\\\s*${CssProp.A.attachment})*`,\n background_color: CssProp.C.color,\n background_origin: `${CssProp.A.box}(,\\\\s*${CssProp.A.box})*`,\n background_repeat: `${CssProp.A.repeat_style}(,\\\\s*${CssProp.A.repeat_style})*`,\n border: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\\\s*){1,3}`,\n border_radius: `((${CssProp.B.len_or_perc})\\\\s*){1,4}(\\\\/\\\\s*((${CssProp.B.len_or_perc})\\\\s*){1,4})?`,\n border_spacing: `${CssProp.B.length}\\\\s*(${CssProp.B.length})?`,\n border_top_color: CssProp.C.color,\n border_top_style: CssProp.A.border_style,\n border_width: `((${CssProp.C.border_width})\\\\s*){1,4}`,\n color: CssProp.C.color,\n cursor: `(${CssProp.B.url}(\\\\s*,\\\\s*)?)*(auto|crosshair|default|pointer|move|e-resize|ne-resize|nw-resize|n-resize|se-resize|sw-resize|s-resize|w-resize|text|wait|help|progress|all-scroll|col-resize|hand|no-drop|not-allowed|row-resize|vertical-text)`,\n display: `inline|block|list-item|run-in|inline-list-item|inline-block|table|inline-table|table-cell|table-caption|flex|inline-flex|grid|inline-grid|${CssProp.A.display_inside}|${CssProp.A.display_outside}|inherit|inline-box|inline-stack`,\n display_outside: CssProp.A.display_outside,\n elevation: `${CssProp.B.angle}|below|level|above|higher|lower`,\n font_family: `(${CssProp.C.family_name}|${CssProp.A.generic_family})(,\\\\s*(${CssProp.C.family_name}|${CssProp.A.generic_family}))*`,\n height: `${CssProp.B.length}|${CssProp.B.percentage}|auto`,\n letter_spacing: `normal|${CssProp.B.length}`,\n list_style_image: `${CssProp.C.image}|none`,\n margin_right: CssProp.C.margin_width,\n max_height: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|none|auto`,\n min_height: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|auto`,\n opacity: CssProp.C.alphavalue,\n outline_color: `${CssProp.C.color}|invert`,\n outline_width: CssProp.C.border_width,\n padding: `((${CssProp.C.padding_width})\\\\s*){1,4}`,\n padding_top: CssProp.C.padding_width,\n pitch_range: CssProp.N.number,\n right: `${CssProp.B.length}|${CssProp.B.percentage}|auto`,\n stress: CssProp.N.number,\n text_indent: `${CssProp.B.length}|${CssProp.B.percentage}`,\n text_shadow: `none|${CssProp.C.shadow}(,\\\\s*(${CssProp.C.shadow}))*`,\n volume: `${CssProp.N.number_pos}|${CssProp.B.percentage_pos}|silent|x-soft|soft|medium|loud|x-loud`,\n word_wrap: CssProp.AP.overflow_wrap,\n zoom: `normal|${CssProp.N.number_pos}|${CssProp.B.percentage_pos}`,\n backface_visibility: CssProp.AP.visibility,\n background_clip: `${CssProp.A.box}(,\\\\s*(${CssProp.A.box}))*`,\n background_position: `${CssProp.C.bg_position}(,\\\\s*(${CssProp.C.bg_position}))*`,\n border_bottom_color: CssProp.C.color,\n border_bottom_style: CssProp.A.border_style,\n border_color: `((${CssProp.C.color})\\\\s*){1,4}`,\n border_left_color: CssProp.C.color,\n border_right_color: CssProp.C.color,\n border_style: `((${CssProp.A.border_style})\\\\s*){1,4}`,\n border_top_left_radius: `(${CssProp.B.length}|${CssProp.B.percentage})(\\\\s*(${CssProp.B.length}|${CssProp.B.percentage}))?`,\n border_top_width: CssProp.C.border_width,\n box_shadow: `none|${CssProp.C.shadow}(,\\\\s*(${CssProp.C.shadow}))*`,\n clip: `${CssProp.C.shape}|auto`,\n display_inside: CssProp.A.display_inside,\n font_size: `${CssProp.A.absolute_size}|${CssProp.A.relative_size}|${CssProp.B.length_pos}|${CssProp.B.percentage_pos}`,\n line_height: `normal|${CssProp.N.number_pos}|${CssProp.B.length_pos}|${CssProp.B.percentage_pos}`,\n margin_left: CssProp.C.margin_width,\n max_width: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|none|auto`,\n outline_style: CssProp.A.border_style,\n padding_bottom: CssProp.C.padding_width,\n padding_right: CssProp.C.padding_width,\n perspective: `none|${CssProp.B.length}`,\n richness: CssProp.N.number,\n text_overflow: `((clip|ellipsis|${CssProp.B.string})\\\\s*){1,2}`,\n top: `${CssProp.B.length}|${CssProp.B.percentage}|auto`,\n width: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|auto`,\n z_index: `auto|${CssProp.B.z_index}`,\n // Simplified background\n background: `(((${CssProp.C.bg_position}\\\\s*(\\\\/\\\\s*${CssProp.C.bg_size})?)|(${CssProp.A.repeat_style})|(${CssProp.A.attachment})|(${CssProp.A.bg_origin})|(${CssProp.C.bg_image})|(${CssProp.C.color}))\\\\s*)+`,\n background_size: `${CssProp.C.bg_size}(,\\\\s*${CssProp.C.bg_size})*`,\n border_bottom_left_radius: `(${CssProp.B.length}|${CssProp.B.percentage})(\\\\s*(${CssProp.B.length}|${CssProp.B.percentage}))?`,\n border_bottom_width: CssProp.C.border_width,\n border_left_style: CssProp.A.border_style,\n border_right_style: CssProp.A.border_style,\n border_top: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\\\s*){1,3}`,\n bottom: `${CssProp.B.len_or_perc}|auto`,\n list_style: `((${CssProp.AP.list_style_type}|${CssProp.AP.list_style_position}|${CssProp.C.image}|none})\\\\s*){1,3}`,\n margin_top: CssProp.C.margin_width,\n outline: `((${CssProp.C.color}|invert|${CssProp.A.border_style}|${CssProp.C.border_width})\\\\s*){1,3}`,\n overflow_y: CssProp.AP.overflow_x,\n pitch: `${CssProp.B.frequency}|x-low|low|medium|high|x-high`,\n vertical_align: `baseline|sub|super|top|text-top|middle|bottom|text-bottom|${CssProp.B.len_or_perc}`,\n word_spacing: `normal|${CssProp.B.length}`,\n background_image: `${CssProp.C.bg_image}(,\\\\s*${CssProp.C.bg_image})*`,\n border_bottom_right_radius: `(${CssProp.B.length}|${CssProp.B.percentage})(\\\\s*(${CssProp.B.length}|${CssProp.B.percentage}))?`,\n border_left_width: CssProp.C.border_width,\n border_right_width: CssProp.C.border_width,\n left: `${CssProp.B.len_or_perc}|auto`,\n margin_bottom: CssProp.C.margin_width,\n pause_after: `${CssProp.B.time}|${CssProp.B.percentage}`,\n speech_rate: `${CssProp.N.number}|x-slow|slow|medium|fast|x-fast|faster|slower`,\n transition_duration: `${CssProp.B.time}(,\\\\s*${CssProp.B.time})*`,\n border_bottom: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\\\s*){1,3}`,\n border_right: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\\\s*){1,3}`,\n margin: `((${CssProp.C.margin_width})\\\\s*){1,4}`,\n padding_left: CssProp.C.padding_width,\n border_left: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\\\s*){1,3}`,\n quotes: `(${CssProp.B.string}\\\\s*${CssProp.B.string})+|none`,\n border_top_right_radius: `(${CssProp.B.length}|${CssProp.B.percentage})(\\\\s*(${CssProp.B.length}|${CssProp.B.percentage}))?`,\n min_width: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|auto`\n};\nCssProp._CP1 = {\n font: `(((((${CssProp.AP.font_style}|${CssProp.AP.font_variant}|${CssProp.AP.font_weight})\\\\s*){1,3})?\\\\s*(${CssProp._CP.font_size})\\\\s*(\\\\/\\\\s*(${CssProp._CP.line_height}))?\\\\s+(${CssProp._CP.font_family}))|caption|icon|menu|message-box|small-caption|status-bar)`\n};\nCssProp.CP = { ...CssProp._CP, ...CssProp._CP1 };\n// CSS Property value validation regular expressions for use with sanitize-html\nCssProp.BORDER_COLLAPSE = CssProp.reg(CssProp.AP.border_collapse);\nCssProp.BOX = CssProp.reg(CssProp.AP.box);\nCssProp.BOX_SIZING = CssProp.reg(CssProp.AP.box_sizing);\nCssProp.CAPTION_SIDE = CssProp.reg(CssProp.AP.caption_side);\nCssProp.CLEAR = CssProp.reg(CssProp.AP.clear);\nCssProp.DIRECTION = CssProp.reg(CssProp.AP.direction);\nCssProp.EMPTY_CELLS = CssProp.reg(CssProp.AP.empty_cells);\nCssProp.FLOAT = CssProp.reg(CssProp.AP.float);\nCssProp.FONT_STRETCH = CssProp.reg(CssProp.AP.font_stretch);\nCssProp.FONT_STYLE = CssProp.reg(CssProp.AP.font_style);\nCssProp.FONT_VARIANT = CssProp.reg(CssProp.AP.font_variant);\nCssProp.FONT_WEIGHT = CssProp.reg(CssProp.AP.font_weight);\nCssProp.LIST_STYLE_POSITION = CssProp.reg(CssProp.AP.list_style_position);\nCssProp.LIST_STYLE_TYPE = CssProp.reg(CssProp.AP.list_style_type);\nCssProp.OVERFLOW = CssProp.reg(CssProp.AP.overflow);\nCssProp.OVERFLOW_WRAP = CssProp.reg(CssProp.AP.overflow_wrap);\nCssProp.OVERFLOW_X = CssProp.reg(CssProp.AP.overflow_x);\nCssProp.PAGE_BREAK_AFTER = CssProp.reg(CssProp.AP.page_break_after);\nCssProp.PAGE_BREAK_BEFORE = CssProp.reg(CssProp.AP.page_break_before);\nCssProp.PAGE_BREAK_INSIDE = CssProp.reg(CssProp.AP.page_break_inside);\nCssProp.POSITION = CssProp.reg(CssProp.AP.position);\nCssProp.RESIZE = CssProp.reg(CssProp.AP.resize);\nCssProp.SPEAK = CssProp.reg(CssProp.AP.speak);\nCssProp.SPEAK_HEADER = CssProp.reg(CssProp.AP.speak_header);\nCssProp.SPEAK_NUMERAL = CssProp.reg(CssProp.AP.speak_numeral);\nCssProp.SPEAK_PUNCTUATION = CssProp.reg(CssProp.AP.speak_punctuation);\nCssProp.TABLE_LAYOUT = CssProp.reg(CssProp.AP.table_layout);\nCssProp.TEXT_ALIGN = CssProp.reg(CssProp.AP.text_align);\nCssProp.TEXT_DECORATION = CssProp.reg(CssProp.AP.text_decoration);\nCssProp.TEXT_TRANSFORM = CssProp.reg(CssProp.AP.text_transform);\nCssProp.TEXT_WRAP = CssProp.reg(CssProp.AP.text_wrap);\nCssProp.UNICODE_BIDI = CssProp.reg(CssProp.AP.unicode_bidi);\nCssProp.VISIBILITY = CssProp.reg(CssProp.AP.visibility);\nCssProp.WHITE_SPACE = CssProp.reg(CssProp.AP.white_space);\nCssProp.WORD_BREAK = CssProp.reg(CssProp.AP.word_break);\nCssProp.BACKGROUND_ATTACHMENT = CssProp.reg(CssProp.CP.background_attachment);\nCssProp.BACKGROUND_COLOR = CssProp.reg(CssProp.CP.background_color);\nCssProp.BACKGROUND_ORIGIN = CssProp.reg(CssProp.CP.background_origin);\nCssProp.BACKGROUND_REPEAT = CssProp.reg(CssProp.CP.background_repeat);\nCssProp.BORDER = CssProp.reg(CssProp.CP.border);\nCssProp.BORDER_RADIUS = CssProp.reg(CssProp.CP.border_radius);\nCssProp.BORDER_SPACING = CssProp.reg(CssProp.CP.border_spacing);\nCssProp.BORDER_TOP_COLOR = CssProp.reg(CssProp.CP.border_top_color);\nCssProp.BORDER_TOP_STYLE = CssProp.reg(CssProp.CP.border_top_style);\nCssProp.BORDER_WIDTH = CssProp.reg(CssProp.CP.border_width);\nCssProp.COLOR = CssProp.reg(CssProp.CP.color);\nCssProp.CURSOR = CssProp.reg(CssProp.CP.cursor);\nCssProp.DISPLAY = CssProp.reg(CssProp.CP.display);\nCssProp.DISPLAY_OUTSIDE = CssProp.reg(CssProp.CP.display_outside);\nCssProp.ELEVATION = CssProp.reg(CssProp.CP.elevation);\nCssProp.FONT_FAMILY = CssProp.reg(CssProp.CP.font_family);\nCssProp.HEIGHT = CssProp.reg(CssProp.CP.height);\nCssProp.LETTER_SPACING = CssProp.reg(CssProp.CP.letter_spacing);\nCssProp.LIST_STYLE_IMAGE = CssProp.reg(CssProp.CP.list_style_image);\nCssProp.MARGIN_RIGHT = CssProp.reg(CssProp.CP.margin_right);\nCssProp.MAX_HEIGHT = CssProp.reg(CssProp.CP.max_height);\nCssProp.MIN_HEIGHT = CssProp.reg(CssProp.CP.min_height);\nCssProp.OPACITY = CssProp.reg(CssProp.CP.opacity);\nCssProp.OUTLINE_COLOR = CssProp.reg(CssProp.CP.outline_color);\nCssProp.OUTLINE_WIDTH = CssProp.reg(CssProp.CP.outline_width);\nCssProp.PADDING = CssProp.reg(CssProp.CP.padding);\nCssProp.PADDING_TOP = CssProp.reg(CssProp.CP.padding_top);\nCssProp.PITCH_RANGE = CssProp.reg(CssProp.CP.pitch_range);\nCssProp.RIGHT = CssProp.reg(CssProp.CP.right);\nCssProp.STRESS = CssProp.reg(CssProp.CP.stress);\nCssProp.TEXT_INDENT = CssProp.reg(CssProp.CP.text_indent);\nCssProp.TEXT_SHADOW = CssProp.reg(CssProp.CP.text_shadow);\nCssProp.VOLUME = CssProp.reg(CssProp.CP.volume);\nCssProp.WORD_WRAP = CssProp.reg(CssProp.CP.word_wrap);\nCssProp.ZOOM = CssProp.reg(CssProp.CP.zoom);\nCssProp.BACKFACE_VISIBILITY = CssProp.reg(CssProp.CP.backface_visibility);\nCssProp.BACKGROUND_CLIP = CssProp.reg(CssProp.CP.background_clip);\nCssProp.BACKGROUND_POSITION = CssProp.reg(CssProp.CP.background_position);\nCssProp.BORDER_BOTTOM_COLOR = CssProp.reg(CssProp.CP.border_bottom_color);\nCssProp.BORDER_BOTTOM_STYLE = CssProp.reg(CssProp.CP.border_bottom_style);\nCssProp.BORDER_COLOR = CssProp.reg(CssProp.CP.border_color);\nCssProp.BORDER_LEFT_COLOR = CssProp.reg(CssProp.CP.border_left_color);\nCssProp.BORDER_RIGHT_COLOR = CssProp.reg(CssProp.CP.border_right_color);\nCssProp.BORDER_STYLE = CssProp.reg(CssProp.CP.border_style);\nCssProp.BORDER_TOP_LEFT_RADIUS = CssProp.reg(CssProp.CP.border_top_left_radius);\nCssProp.BORDER_TOP_WIDTH = CssProp.reg(CssProp.CP.border_top_width);\nCssProp.BOX_SHADOW = CssProp.reg(CssProp.CP.box_shadow);\nCssProp.CLIP = CssProp.reg(CssProp.CP.clip);\nCssProp.DISPLAY_INSIDE = CssProp.reg(CssProp.CP.display_inside);\nCssProp.FONT_SIZE = CssProp.reg(CssProp.CP.font_size);\nCssProp.LINE_HEIGHT = CssProp.reg(CssProp.CP.line_height);\nCssProp.MARGIN_LEFT = CssProp.reg(CssProp.CP.margin_left);\nCssProp.MAX_WIDTH = CssProp.reg(CssProp.CP.max_width);\nCssProp.OUTLINE_STYLE = CssProp.reg(CssProp.CP.outline_style);\nCssProp.PADDING_BOTTOM = CssProp.reg(CssProp.CP.padding_bottom);\nCssProp.PADDING_RIGHT = CssProp.reg(CssProp.CP.padding_right);\nCssProp.PERSPECTIVE = CssProp.reg(CssProp.CP.perspective);\nCssProp.RICHNESS = CssProp.reg(CssProp.CP.richness);\nCssProp.TEXT_OVERFLOW = CssProp.reg(CssProp.CP.text_overflow);\nCssProp.TOP = CssProp.reg(CssProp.CP.top);\nCssProp.WIDTH = CssProp.reg(CssProp.CP.width);\nCssProp.Z_INDEX = CssProp.reg(CssProp.CP.z_index);\nCssProp.BACKGROUND = CssProp.reg(CssProp.CP.background);\nCssProp.BACKGROUND_SIZE = CssProp.reg(CssProp.CP.background_size);\nCssProp.BORDER_BOTTOM_LEFT_RADIUS = CssProp.reg(CssProp.CP.border_bottom_left_radius);\nCssProp.BORDER_BOTTOM_WIDTH = CssProp.reg(CssProp.CP.border_bottom_width);\nCssProp.BORDER_LEFT_STYLE = CssProp.reg(CssProp.CP.border_left_style);\nCssProp.BORDER_RIGHT_STYLE = CssProp.reg(CssProp.CP.border_right_style);\nCssProp.BORDER_TOP = CssProp.reg(CssProp.CP.border_top);\nCssProp.BOTTOM = CssProp.reg(CssProp.CP.bottom);\nCssProp.LIST_STYLE = CssProp.reg(CssProp.CP.list_style);\nCssProp.MARGIN_TOP = CssProp.reg(CssProp.CP.margin_top);\nCssProp.OUTLINE = CssProp.reg(CssProp.CP.outline);\nCssProp.OVERFLOW_Y = CssProp.reg(CssProp.CP.overflow_y);\nCssProp.PITCH = CssProp.reg(CssProp.CP.pitch);\nCssProp.VERTICAL_ALIGN = CssProp.reg(CssProp.CP.vertical_align);\nCssProp.WORD_SPACING = CssProp.reg(CssProp.CP.word_spacing);\nCssProp.BACKGROUND_IMAGE = CssProp.reg(CssProp.CP.background_image);\nCssProp.BORDER_BOTTOM_RIGHT_RADIUS = CssProp.reg(CssProp.CP.border_bottom_right_radius);\nCssProp.BORDER_LEFT_WIDTH = CssProp.reg(CssProp.CP.border_left_width);\nCssProp.BORDER_RIGHT_WIDTH = CssProp.reg(CssProp.CP.border_right_width);\nCssProp.LEFT = CssProp.reg(CssProp.CP.left);\nCssProp.MARGIN_BOTTOM = CssProp.reg(CssProp.CP.margin_bottom);\nCssProp.PAUSE_AFTER = CssProp.reg(CssProp.CP.pause_after);\nCssProp.SPEECH_RATE = CssProp.reg(CssProp.CP.speech_rate);\nCssProp.TRANSITION_DURATION = CssProp.reg(CssProp.CP.transition_duration);\nCssProp.BORDER_BOTTOM = CssProp.reg(CssProp.CP.border_bottom);\nCssProp.BORDER_RIGHT = CssProp.reg(CssProp.CP.border_right);\nCssProp.MARGIN = CssProp.reg(CssProp.CP.margin);\nCssProp.PADDING_LEFT = CssProp.reg(CssProp.CP.padding_left);\nCssProp.BORDER_LEFT = CssProp.reg(CssProp.CP.border_left);\nCssProp.FONT = CssProp.reg(CssProp.CP.font);\nCssProp.QUOTES = CssProp.reg(CssProp.CP.quotes);\nCssProp.BORDER_TOP_RIGHT_RADIUS = CssProp.reg(CssProp.CP.border_top_right_radius);\nCssProp.MIN_WIDTH = CssProp.reg(CssProp.CP.min_width);\n/**\n * A class to sanitize HTML strings.\n */\nexport class Sanitizer {\n constructor() {\n this._autolink = true;\n this._options = {\n // HTML tags that are allowed to be used. Tags were extracted from Google Caja\n allowedTags: [\n 'a',\n 'abbr',\n 'acronym',\n 'address',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'colspan',\n 'command',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dir',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'font',\n 'footer',\n 'form',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'header',\n 'hgroup',\n 'hr',\n 'i',\n // 'iframe' is allowed by Google Caja, but disallowed by default by sanitize-html\n // , 'iframe'\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'map',\n 'mark',\n 'menu',\n 'meter',\n 'nav',\n 'nobr',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n 'pre',\n 'progress',\n 'q',\n 'rowspan',\n 's',\n 'samp',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n 'strike',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'table',\n 'tbody',\n 'td',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'tr',\n 'track',\n 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr'\n ],\n // Attributes that HTML tags are allowed to have, extracted from Google Caja.\n // See https://github.com/jupyterlab/jupyterlab/issues/1812#issuecomment-285848435\n allowedAttributes: {\n '*': [\n 'class',\n 'dir',\n 'draggable',\n 'hidden',\n 'id',\n 'inert',\n 'itemprop',\n 'itemref',\n 'itemscope',\n 'lang',\n 'spellcheck',\n 'style',\n 'title',\n 'translate'\n ],\n // 'rel' and 'target' were *not* allowed by Google Caja\n a: [\n 'accesskey',\n 'coords',\n 'href',\n 'hreflang',\n 'name',\n 'rel',\n 'shape',\n 'tabindex',\n 'target',\n 'type'\n ],\n area: [\n 'accesskey',\n 'alt',\n 'coords',\n 'href',\n 'nohref',\n 'shape',\n 'tabindex'\n ],\n // 'autoplay' was *not* allowed by Google Caja\n audio: [\n 'autoplay',\n 'controls',\n 'loop',\n 'mediagroup',\n 'muted',\n 'preload',\n 'src'\n ],\n bdo: ['dir'],\n blockquote: ['cite'],\n br: ['clear'],\n button: [\n 'accesskey',\n 'data-commandlinker-args',\n 'data-commandlinker-command',\n 'disabled',\n 'name',\n 'tabindex',\n 'type',\n 'value'\n ],\n canvas: ['height', 'width'],\n caption: ['align'],\n col: ['align', 'char', 'charoff', 'span', 'valign', 'width'],\n colgroup: ['align', 'char', 'charoff', 'span', 'valign', 'width'],\n command: [\n 'checked',\n 'command',\n 'disabled',\n 'icon',\n 'label',\n 'radiogroup',\n 'type'\n ],\n data: ['value'],\n del: ['cite', 'datetime'],\n details: ['open'],\n dir: ['compact'],\n div: ['align'],\n dl: ['compact'],\n fieldset: ['disabled'],\n font: ['color', 'face', 'size'],\n form: [\n 'accept',\n 'autocomplete',\n 'enctype',\n 'method',\n 'name',\n 'novalidate'\n ],\n h1: ['align'],\n h2: ['align'],\n h3: ['align'],\n h4: ['align'],\n h5: ['align'],\n h6: ['align'],\n hr: ['align', 'noshade', 'size', 'width'],\n iframe: [\n 'align',\n 'frameborder',\n 'height',\n 'marginheight',\n 'marginwidth',\n 'width'\n ],\n img: [\n 'align',\n 'alt',\n 'border',\n 'height',\n 'hspace',\n 'ismap',\n 'name',\n 'src',\n 'usemap',\n 'vspace',\n 'width'\n ],\n input: [\n 'accept',\n 'accesskey',\n 'align',\n 'alt',\n 'autocomplete',\n 'checked',\n 'disabled',\n 'inputmode',\n 'ismap',\n 'list',\n 'max',\n 'maxlength',\n 'min',\n 'multiple',\n 'name',\n 'placeholder',\n 'readonly',\n 'required',\n 'size',\n 'src',\n 'step',\n 'tabindex',\n 'type',\n 'usemap',\n 'value'\n ],\n ins: ['cite', 'datetime'],\n label: ['accesskey', 'for'],\n legend: ['accesskey', 'align'],\n li: ['type', 'value'],\n map: ['name'],\n menu: ['compact', 'label', 'type'],\n meter: ['high', 'low', 'max', 'min', 'value'],\n ol: ['compact', 'reversed', 'start', 'type'],\n optgroup: ['disabled', 'label'],\n option: ['disabled', 'label', 'selected', 'value'],\n output: ['for', 'name'],\n p: ['align'],\n pre: ['width'],\n progress: ['max', 'min', 'value'],\n q: ['cite'],\n select: [\n 'autocomplete',\n 'disabled',\n 'multiple',\n 'name',\n 'required',\n 'size',\n 'tabindex'\n ],\n source: ['type'],\n table: [\n 'align',\n 'bgcolor',\n 'border',\n 'cellpadding',\n 'cellspacing',\n 'frame',\n 'rules',\n 'summary',\n 'width'\n ],\n tbody: ['align', 'char', 'charoff', 'valign'],\n td: [\n 'abbr',\n 'align',\n 'axis',\n 'bgcolor',\n 'char',\n 'charoff',\n 'colspan',\n 'headers',\n 'height',\n 'nowrap',\n 'rowspan',\n 'scope',\n 'valign',\n 'width'\n ],\n textarea: [\n 'accesskey',\n 'autocomplete',\n 'cols',\n 'disabled',\n 'inputmode',\n 'name',\n 'placeholder',\n 'readonly',\n 'required',\n 'rows',\n 'tabindex',\n 'wrap'\n ],\n tfoot: ['align', 'char', 'charoff', 'valign'],\n th: [\n 'abbr',\n 'align',\n 'axis',\n 'bgcolor',\n 'char',\n 'charoff',\n 'colspan',\n 'headers',\n 'height',\n 'nowrap',\n 'rowspan',\n 'scope',\n 'valign',\n 'width'\n ],\n thead: ['align', 'char', 'charoff', 'valign'],\n tr: ['align', 'bgcolor', 'char', 'charoff', 'valign'],\n track: ['default', 'kind', 'label', 'srclang'],\n ul: ['compact', 'type'],\n video: [\n 'autoplay',\n 'controls',\n 'height',\n 'loop',\n 'mediagroup',\n 'muted',\n 'poster',\n 'preload',\n 'src',\n 'width'\n ]\n },\n // Inline CSS styles that HTML tags may have (and their allowed values)\n allowedStyles: {\n // To simplify the data, all styles are allowed on all tags that allow the style attribute\n '*': {\n 'backface-visibility': [CssProp.BACKFACE_VISIBILITY],\n background: [CssProp.BACKGROUND],\n 'background-attachment': [CssProp.BACKGROUND_ATTACHMENT],\n 'background-clip': [CssProp.BACKGROUND_CLIP],\n 'background-color': [CssProp.BACKGROUND_COLOR],\n 'background-image': [CssProp.BACKGROUND_IMAGE],\n 'background-origin': [CssProp.BACKGROUND_ORIGIN],\n 'background-position': [CssProp.BACKGROUND_POSITION],\n 'background-repeat': [CssProp.BACKGROUND_REPEAT],\n 'background-size': [CssProp.BACKGROUND_SIZE],\n border: [CssProp.BORDER],\n 'border-bottom': [CssProp.BORDER_BOTTOM],\n 'border-bottom-color': [CssProp.BORDER_BOTTOM_COLOR],\n 'border-bottom-left-radius': [CssProp.BORDER_BOTTOM_LEFT_RADIUS],\n 'border-bottom-right-radius': [CssProp.BORDER_BOTTOM_RIGHT_RADIUS],\n 'border-bottom-style': [CssProp.BORDER_BOTTOM_STYLE],\n 'border-bottom-width': [CssProp.BORDER_BOTTOM_WIDTH],\n 'border-collapse': [CssProp.BORDER_COLLAPSE],\n 'border-color': [CssProp.BORDER_COLOR],\n 'border-left': [CssProp.BORDER_LEFT],\n 'border-left-color': [CssProp.BORDER_LEFT_COLOR],\n 'border-left-style': [CssProp.BORDER_LEFT_STYLE],\n 'border-left-width': [CssProp.BORDER_LEFT_WIDTH],\n 'border-radius': [CssProp.BORDER_RADIUS],\n 'border-right': [CssProp.BORDER_RIGHT],\n 'border-right-color': [CssProp.BORDER_RIGHT_COLOR],\n 'border-right-style': [CssProp.BORDER_RIGHT_STYLE],\n 'border-right-width': [CssProp.BORDER_RIGHT_WIDTH],\n 'border-spacing': [CssProp.BORDER_SPACING],\n 'border-style': [CssProp.BORDER_STYLE],\n 'border-top': [CssProp.BORDER_TOP],\n 'border-top-color': [CssProp.BORDER_TOP_COLOR],\n 'border-top-left-radius': [CssProp.BORDER_TOP_LEFT_RADIUS],\n 'border-top-right-radius': [CssProp.BORDER_TOP_RIGHT_RADIUS],\n 'border-top-style': [CssProp.BORDER_TOP_STYLE],\n 'border-top-width': [CssProp.BORDER_TOP_WIDTH],\n 'border-width': [CssProp.BORDER_WIDTH],\n bottom: [CssProp.BOTTOM],\n box: [CssProp.BOX],\n 'box-shadow': [CssProp.BOX_SHADOW],\n 'box-sizing': [CssProp.BOX_SIZING],\n 'caption-side': [CssProp.CAPTION_SIDE],\n clear: [CssProp.CLEAR],\n clip: [CssProp.CLIP],\n color: [CssProp.COLOR],\n cursor: [CssProp.CURSOR],\n direction: [CssProp.DIRECTION],\n display: [CssProp.DISPLAY],\n 'display-inside': [CssProp.DISPLAY_INSIDE],\n 'display-outside': [CssProp.DISPLAY_OUTSIDE],\n elevation: [CssProp.ELEVATION],\n 'empty-cells': [CssProp.EMPTY_CELLS],\n float: [CssProp.FLOAT],\n font: [CssProp.FONT],\n 'font-family': [CssProp.FONT_FAMILY],\n 'font-size': [CssProp.FONT_SIZE],\n 'font-stretch': [CssProp.FONT_STRETCH],\n 'font-style': [CssProp.FONT_STYLE],\n 'font-variant': [CssProp.FONT_VARIANT],\n 'font-weight': [CssProp.FONT_WEIGHT],\n height: [CssProp.HEIGHT],\n left: [CssProp.LEFT],\n 'letter-spacing': [CssProp.LETTER_SPACING],\n 'line-height': [CssProp.LINE_HEIGHT],\n 'list-style': [CssProp.LIST_STYLE],\n 'list-style-image': [CssProp.LIST_STYLE_IMAGE],\n 'list-style-position': [CssProp.LIST_STYLE_POSITION],\n 'list-style-type': [CssProp.LIST_STYLE_TYPE],\n margin: [CssProp.MARGIN],\n 'margin-bottom': [CssProp.MARGIN_BOTTOM],\n 'margin-left': [CssProp.MARGIN_LEFT],\n 'margin-right': [CssProp.MARGIN_RIGHT],\n 'margin-top': [CssProp.MARGIN_TOP],\n 'max-height': [CssProp.MAX_HEIGHT],\n 'max-width': [CssProp.MAX_WIDTH],\n 'min-height': [CssProp.MIN_HEIGHT],\n 'min-width': [CssProp.MIN_WIDTH],\n opacity: [CssProp.OPACITY],\n outline: [CssProp.OUTLINE],\n 'outline-color': [CssProp.OUTLINE_COLOR],\n 'outline-style': [CssProp.OUTLINE_STYLE],\n 'outline-width': [CssProp.OUTLINE_WIDTH],\n overflow: [CssProp.OVERFLOW],\n 'overflow-wrap': [CssProp.OVERFLOW_WRAP],\n 'overflow-x': [CssProp.OVERFLOW_X],\n 'overflow-y': [CssProp.OVERFLOW_Y],\n padding: [CssProp.PADDING],\n 'padding-bottom': [CssProp.PADDING_BOTTOM],\n 'padding-left': [CssProp.PADDING_LEFT],\n 'padding-right': [CssProp.PADDING_RIGHT],\n 'padding-top': [CssProp.PADDING_TOP],\n 'page-break-after': [CssProp.PAGE_BREAK_AFTER],\n 'page-break-before': [CssProp.PAGE_BREAK_BEFORE],\n 'page-break-inside': [CssProp.PAGE_BREAK_INSIDE],\n 'pause-after': [CssProp.PAUSE_AFTER],\n perspective: [CssProp.PERSPECTIVE],\n pitch: [CssProp.PITCH],\n 'pitch-range': [CssProp.PITCH_RANGE],\n position: [CssProp.POSITION],\n quotes: [CssProp.QUOTES],\n resize: [CssProp.RESIZE],\n richness: [CssProp.RICHNESS],\n right: [CssProp.RIGHT],\n speak: [CssProp.SPEAK],\n 'speak-header': [CssProp.SPEAK_HEADER],\n 'speak-numeral': [CssProp.SPEAK_NUMERAL],\n 'speak-punctuation': [CssProp.SPEAK_PUNCTUATION],\n 'speech-rate': [CssProp.SPEECH_RATE],\n stress: [CssProp.STRESS],\n 'table-layout': [CssProp.TABLE_LAYOUT],\n 'text-align': [CssProp.TEXT_ALIGN],\n 'text-decoration': [CssProp.TEXT_DECORATION],\n 'text-indent': [CssProp.TEXT_INDENT],\n 'text-overflow': [CssProp.TEXT_OVERFLOW],\n 'text-shadow': [CssProp.TEXT_SHADOW],\n 'text-transform': [CssProp.TEXT_TRANSFORM],\n 'text-wrap': [CssProp.TEXT_WRAP],\n top: [CssProp.TOP],\n 'unicode-bidi': [CssProp.UNICODE_BIDI],\n 'vertical-align': [CssProp.VERTICAL_ALIGN],\n visibility: [CssProp.VISIBILITY],\n volume: [CssProp.VOLUME],\n 'white-space': [CssProp.WHITE_SPACE],\n width: [CssProp.WIDTH],\n 'word-break': [CssProp.WORD_BREAK],\n 'word-spacing': [CssProp.WORD_SPACING],\n 'word-wrap': [CssProp.WORD_WRAP],\n 'z-index': [CssProp.Z_INDEX],\n zoom: [CssProp.ZOOM]\n }\n },\n transformTags: {\n // Set the \"rel\" attribute for tags to \"nofollow\".\n a: sanitize.simpleTransform('a', { rel: 'nofollow' }),\n // Set the \"disabled\" attribute for tags.\n input: sanitize.simpleTransform('input', { disabled: 'disabled' })\n },\n allowedSchemes: [...sanitize.defaults.allowedSchemes],\n allowedSchemesByTag: {\n // Allow 'attachment:' img src (used for markdown cell attachments).\n img: sanitize.defaults.allowedSchemes.concat(['attachment'])\n },\n // Override of the default option, so we can skip 'src' attribute validation.\n // 'src' Attributes are validated to be URIs, which does not allow for embedded (image) data.\n // Since embedded data is no longer deemed to be a threat, validation can be skipped.\n // See https://github.com/jupyterlab/jupyterlab/issues/5183\n allowedSchemesAppliedToAttributes: ['href', 'cite']\n };\n }\n /**\n * Sanitize an HTML string.\n *\n * @param dirty - The dirty text.\n *\n * @param options - The optional sanitization options.\n *\n * @returns The sanitized string.\n */\n sanitize(dirty, options) {\n return sanitize(dirty, { ...this._options, ...(options || {}) });\n }\n /**\n * @returns Whether to replace URLs by HTML anchors.\n */\n getAutolink() {\n return this._autolink;\n }\n /**\n * Set the allowed schemes\n *\n * @param scheme Allowed schemes\n */\n setAllowedSchemes(scheme) {\n // Force copy of `scheme`\n this._options.allowedSchemes = [...scheme];\n }\n /**\n * Set the URL replacement boolean.\n *\n * @param autolink URL replacement boolean.\n */\n setAutolink(autolink) {\n this._autolink = autolink;\n }\n}\n//# sourceMappingURL=sanitizer.js.map","/**\n * The default mime model implementation.\n */\nexport class MimeModel {\n /**\n * Construct a new mime model.\n */\n constructor(options = {}) {\n this.trusted = !!options.trusted;\n this._data = options.data || {};\n this._metadata = options.metadata || {};\n this._callback = options.callback || Private.noOp;\n }\n /**\n * The data associated with the model.\n */\n get data() {\n return this._data;\n }\n /**\n * The metadata associated with the model.\n */\n get metadata() {\n return this._metadata;\n }\n /**\n * Set the data associated with the model.\n *\n * #### Notes\n * Depending on the implementation of the mime model,\n * this call may or may not have deferred effects,\n */\n setData(options) {\n this._data = options.data || this._data;\n this._metadata = options.metadata || this._metadata;\n this._callback(options);\n }\n}\n/**\n * The namespace for module private data.\n */\nvar Private;\n(function (Private) {\n /**\n * A no-op callback function.\n */\n function noOp() {\n /* no-op */\n }\n Private.noOp = noOp;\n})(Private || (Private = {}));\n//# sourceMappingURL=mimemodel.js.map","/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\nimport { Sanitizer } from '@jupyterlab/apputils';\nimport { PageConfig, PathExt, URLExt } from '@jupyterlab/coreutils';\nimport { nullTranslator } from '@jupyterlab/translation';\nimport { MimeModel } from './mimemodel';\n/**\n * An object which manages mime renderer factories.\n *\n * This object is used to render mime models using registered mime\n * renderers, selecting the preferred mime renderer to render the\n * model into a widget.\n *\n * #### Notes\n * This class is not intended to be subclassed.\n */\nexport class RenderMimeRegistry {\n /**\n * Construct a new rendermime.\n *\n * @param options - The options for initializing the instance.\n */\n constructor(options = {}) {\n var _a, _b, _c, _d, _e, _f;\n this._id = 0;\n this._ranks = {};\n this._types = null;\n this._factories = {};\n // Parse the options.\n this.translator = (_a = options.translator) !== null && _a !== void 0 ? _a : nullTranslator;\n this.resolver = (_b = options.resolver) !== null && _b !== void 0 ? _b : null;\n this.linkHandler = (_c = options.linkHandler) !== null && _c !== void 0 ? _c : null;\n this.latexTypesetter = (_d = options.latexTypesetter) !== null && _d !== void 0 ? _d : null;\n this.markdownParser = (_e = options.markdownParser) !== null && _e !== void 0 ? _e : null;\n this.sanitizer = (_f = options.sanitizer) !== null && _f !== void 0 ? _f : new Sanitizer();\n // Add the initial factories.\n if (options.initialFactories) {\n for (const factory of options.initialFactories) {\n this.addFactory(factory);\n }\n }\n }\n /**\n * The ordered list of mimeTypes.\n */\n get mimeTypes() {\n return this._types || (this._types = Private.sortedTypes(this._ranks));\n }\n /**\n * Find the preferred mime type for a mime bundle.\n *\n * @param bundle - The bundle of mime data.\n *\n * @param safe - How to consider safe/unsafe factories. If 'ensure',\n * it will only consider safe factories. If 'any', any factory will be\n * considered. If 'prefer', unsafe factories will be considered, but\n * only after the safe options have been exhausted.\n *\n * @returns The preferred mime type from the available factories,\n * or `undefined` if the mime type cannot be rendered.\n */\n preferredMimeType(bundle, safe = 'ensure') {\n // Try to find a safe factory first, if preferred.\n if (safe === 'ensure' || safe === 'prefer') {\n for (const mt of this.mimeTypes) {\n if (mt in bundle && this._factories[mt].safe) {\n return mt;\n }\n }\n }\n if (safe !== 'ensure') {\n // Otherwise, search for the best factory among all factories.\n for (const mt of this.mimeTypes) {\n if (mt in bundle) {\n return mt;\n }\n }\n }\n // Otherwise, no matching mime type exists.\n return undefined;\n }\n /**\n * Create a renderer for a mime type.\n *\n * @param mimeType - The mime type of interest.\n *\n * @returns A new renderer for the given mime type.\n *\n * @throws An error if no factory exists for the mime type.\n */\n createRenderer(mimeType) {\n // Throw an error if no factory exists for the mime type.\n if (!(mimeType in this._factories)) {\n throw new Error(`No factory for mime type: '${mimeType}'`);\n }\n // Invoke the best factory for the given mime type.\n return this._factories[mimeType].createRenderer({\n mimeType,\n resolver: this.resolver,\n sanitizer: this.sanitizer,\n linkHandler: this.linkHandler,\n latexTypesetter: this.latexTypesetter,\n markdownParser: this.markdownParser,\n translator: this.translator\n });\n }\n /**\n * Create a new mime model. This is a convenience method.\n *\n * @options - The options used to create the model.\n *\n * @returns A new mime model.\n */\n createModel(options = {}) {\n return new MimeModel(options);\n }\n /**\n * Create a clone of this rendermime instance.\n *\n * @param options - The options for configuring the clone.\n *\n * @returns A new independent clone of the rendermime.\n */\n clone(options = {}) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;\n // Create the clone.\n const clone = new RenderMimeRegistry({\n resolver: (_b = (_a = options.resolver) !== null && _a !== void 0 ? _a : this.resolver) !== null && _b !== void 0 ? _b : undefined,\n sanitizer: (_d = (_c = options.sanitizer) !== null && _c !== void 0 ? _c : this.sanitizer) !== null && _d !== void 0 ? _d : undefined,\n linkHandler: (_f = (_e = options.linkHandler) !== null && _e !== void 0 ? _e : this.linkHandler) !== null && _f !== void 0 ? _f : undefined,\n latexTypesetter: (_h = (_g = options.latexTypesetter) !== null && _g !== void 0 ? _g : this.latexTypesetter) !== null && _h !== void 0 ? _h : undefined,\n markdownParser: (_k = (_j = options.markdownParser) !== null && _j !== void 0 ? _j : this.markdownParser) !== null && _k !== void 0 ? _k : undefined,\n translator: this.translator\n });\n // Clone the internal state.\n clone._factories = { ...this._factories };\n clone._ranks = { ...this._ranks };\n clone._id = this._id;\n // Return the cloned object.\n return clone;\n }\n /**\n * Get the renderer factory registered for a mime type.\n *\n * @param mimeType - The mime type of interest.\n *\n * @returns The factory for the mime type, or `undefined`.\n */\n getFactory(mimeType) {\n return this._factories[mimeType];\n }\n /**\n * Add a renderer factory to the rendermime.\n *\n * @param factory - The renderer factory of interest.\n *\n * @param rank - The rank of the renderer. A lower rank indicates\n * a higher priority for rendering. If not given, the rank will\n * defer to the `defaultRank` of the factory. If no `defaultRank`\n * is given, it will default to 100.\n *\n * #### Notes\n * The renderer will replace an existing renderer for the given\n * mimeType.\n */\n addFactory(factory, rank) {\n if (rank === undefined) {\n rank = factory.defaultRank;\n if (rank === undefined) {\n rank = 100;\n }\n }\n for (const mt of factory.mimeTypes) {\n this._factories[mt] = factory;\n this._ranks[mt] = { rank, id: this._id++ };\n }\n this._types = null;\n }\n /**\n * Remove a mime type.\n *\n * @param mimeType - The mime type of interest.\n */\n removeMimeType(mimeType) {\n delete this._factories[mimeType];\n delete this._ranks[mimeType];\n this._types = null;\n }\n /**\n * Get the rank for a given mime type.\n *\n * @param mimeType - The mime type of interest.\n *\n * @returns The rank of the mime type or undefined.\n */\n getRank(mimeType) {\n const rank = this._ranks[mimeType];\n return rank && rank.rank;\n }\n /**\n * Set the rank of a given mime type.\n *\n * @param mimeType - The mime type of interest.\n *\n * @param rank - The new rank to assign.\n *\n * #### Notes\n * This is a no-op if the mime type is not registered.\n */\n setRank(mimeType, rank) {\n if (!this._ranks[mimeType]) {\n return;\n }\n const id = this._id++;\n this._ranks[mimeType] = { rank, id };\n this._types = null;\n }\n}\n/**\n * The namespace for `RenderMimeRegistry` class statics.\n */\n(function (RenderMimeRegistry) {\n /**\n * A default resolver that uses a given reference path and a contents manager.\n */\n class UrlResolver {\n /**\n * Create a new url resolver.\n */\n constructor(options) {\n this._path = options.path;\n this._contents = options.contents;\n }\n /**\n * The path of the object, from which local urls can be derived.\n */\n get path() {\n return this._path;\n }\n set path(value) {\n this._path = value;\n }\n /**\n * Resolve a relative url to an absolute url path.\n */\n async resolveUrl(url) {\n if (this.isLocal(url)) {\n const cwd = encodeURI(PathExt.dirname(this.path));\n url = PathExt.resolve(cwd, url);\n }\n return url;\n }\n /**\n * Get the download url of a given absolute url path.\n *\n * #### Notes\n * The returned URL may include a query parameter.\n */\n async getDownloadUrl(urlPath) {\n if (this.isLocal(urlPath)) {\n // decode url->path before passing to contents api\n return this._contents.getDownloadUrl(decodeURIComponent(urlPath));\n }\n return urlPath;\n }\n /**\n * Whether the URL should be handled by the resolver\n * or not.\n *\n * @param allowRoot - Whether the paths starting at Unix-style filesystem root (`/`) are permitted.\n *\n * #### Notes\n * This is similar to the `isLocal` check in `URLExt`,\n * but it also checks whether the path points to any\n * of the `IDrive`s that may be registered with the contents\n * manager.\n */\n isLocal(url, allowRoot = false) {\n if (this.isMalformed(url)) {\n return false;\n }\n return (URLExt.isLocal(url, allowRoot) ||\n !!this._contents.driveName(decodeURI(url)));\n }\n /**\n * Resolve a path from Jupyter kernel to a path:\n * - relative to `root_dir` (preferrably) this is in jupyter-server scope,\n * - path understood and known by kernel (if such a path exists).\n * Returns `null` if there is no file matching provided path in neither\n * kernel nor jupyter-server contents manager.\n */\n async resolvePath(path) {\n // TODO: a clean implementation would be server-side and depends on:\n // https://github.com/jupyter-server/jupyter_server/issues/1280\n const rootDir = PageConfig.getOption('rootUri').replace('file://', '');\n // Workaround: expand `~` path using root dir (if it matches).\n if (path.startsWith('~/') && rootDir.startsWith('/home/')) {\n // For now we assume that kernel is in root dir.\n path = rootDir.split('/').slice(0, 3).join('/') + path.substring(1);\n }\n if (path.startsWith(rootDir) || path.startsWith('./')) {\n try {\n const relativePath = path.replace(rootDir, '');\n // If file exists on the server we have guessed right\n const response = await this._contents.get(relativePath, {\n content: false\n });\n return {\n path: response.path,\n scope: 'server'\n };\n }\n catch (error) {\n // The file seems like should be on the server but is not.\n console.warn(`Could not resolve location of ${path} on server`);\n return null;\n }\n }\n // The file is not accessible from jupyter-server but maybe it is\n // available from DAP `source`; we assume the path is available\n // from kernel because currently we have no way of checking this\n // without introducing a cycle (unless we were to set the debugger\n // service instance on the resolver later).\n return {\n path: path,\n scope: 'kernel'\n };\n }\n /**\n * Whether the URL can be decoded using `decodeURI`.\n */\n isMalformed(url) {\n try {\n decodeURI(url);\n return false;\n }\n catch (error) {\n if (error instanceof URIError) {\n return true;\n }\n throw error;\n }\n }\n }\n RenderMimeRegistry.UrlResolver = UrlResolver;\n})(RenderMimeRegistry || (RenderMimeRegistry = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * Get the mime types in the map, ordered by rank.\n */\n function sortedTypes(map) {\n return Object.keys(map).sort((a, b) => {\n const p1 = map[a];\n const p2 = map[b];\n if (p1.rank !== p2.rank) {\n return p1.rank - p2.rank;\n }\n return p1.id - p2.id;\n });\n }\n Private.sortedTypes = sortedTypes;\n})(Private || (Private = {}));\n//# sourceMappingURL=registry.js.map","/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module mathjax2\n */\nimport { PromiseDelegate } from '@lumino/coreutils';\n/**\n * The MathJax Typesetter.\n */\nexport class MathJaxTypesetter {\n /**\n * Create a new MathJax typesetter.\n */\n constructor(options) {\n this._initPromise = new PromiseDelegate();\n this._initialized = false;\n this._url = options.url;\n this._config = options.config;\n }\n /**\n * Typeset the math in a node.\n *\n * #### Notes\n * MathJax schedules the typesetting asynchronously,\n * but there are not currently any callbacks or Promises\n * firing when it is done.\n */\n typeset(node) {\n if (!this._initialized) {\n this._init();\n }\n void this._initPromise.promise.then(() => {\n MathJax.Hub.Queue(['Typeset', MathJax.Hub, node]);\n try {\n MathJax.Hub.Queue(['Require', MathJax.Ajax, '[MathJax]/extensions/TeX/AMSmath.js'], () => {\n MathJax.InputJax.TeX.resetEquationNumbers();\n });\n }\n catch (e) {\n console.error('Error queueing resetEquationNumbers:', e);\n }\n });\n }\n /**\n * Initialize MathJax.\n */\n _init() {\n const head = document.getElementsByTagName('head')[0];\n const script = document.createElement('script');\n script.type = 'text/javascript';\n script.src = `${this._url}?config=${this._config}&delayStartupUntil=configured`;\n script.charset = 'utf-8';\n head.appendChild(script);\n script.addEventListener('load', () => {\n this._onLoad();\n });\n this._initialized = true;\n }\n /**\n * Handle MathJax loading.\n */\n _onLoad() {\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [\n ['$', '$'],\n ['\\\\(', '\\\\)']\n ],\n displayMath: [\n ['$$', '$$'],\n ['\\\\[', '\\\\]']\n ],\n processEscapes: true,\n processEnvironments: true\n },\n // Center justify equations in code and markdown cells. Elsewhere\n // we use CSS to left justify single line equations in code cells.\n displayAlign: 'center',\n CommonHTML: {\n linebreaks: { automatic: true }\n },\n 'HTML-CSS': {\n availableFonts: [],\n imageFont: null,\n preferredFont: null,\n webFont: 'STIX-Web',\n styles: { '.MathJax_Display': { margin: 0 } },\n linebreaks: { automatic: true }\n },\n skipStartupTypeset: true,\n messageStyle: 'none'\n });\n MathJax.Hub.Register.StartupHook('End Config', () => {\n var _a, _b, _c, _d, _e, _f;\n // Disable `:hover span` styles which cause performance issues in Chromium browsers\n // c-f https://github.com/jupyterlab/jupyterlab/issues/9757\n // Note that we cannot overwrite them in config earlier due to how `CombineConfig`\n // is implemented in MathJax 2 (it does not allow removing styles, just expanding).\n (_c = (_b = (_a = MathJax.Hub) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.MathEvents) === null || _c === void 0 ? true : delete _c.styles['.MathJax_Hover_Arrow:hover span'];\n (_f = (_e = (_d = MathJax.Hub) === null || _d === void 0 ? void 0 : _d.config) === null || _e === void 0 ? void 0 : _e.MathMenu) === null || _f === void 0 ? true : delete _f.styles['.MathJax_MenuClose:hover span'];\n });\n MathJax.Hub.Configured();\n this._initPromise.resolve(void 0);\n }\n}\n//# sourceMappingURL=index.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { ServerConnection } from '@jupyterlab/services';\n/**\n * Any object is \"printable\" if it implements the `IPrintable` interface.\n *\n * To do this it, it must have a method called `Printing.symbol` which returns either a function\n * to print the object or null if it cannot be printed.\n *\n * One way of printing is to use the `printWidget` function, which creates a hidden iframe\n * and copies the DOM nodes from your widget to that iframe and printing just that iframe.\n *\n * Another way to print is to use the `printURL` function, which takes a URL and prints that page.\n */\nexport var Printing;\n(function (Printing) {\n /**\n * Symbol to use for a method that returns a function to print an object.\n */\n Printing.symbol = Symbol('printable');\n /**\n * Returns whether an object implements a print method.\n */\n function isPrintable(a) {\n if (typeof a !== 'object' || !a) {\n return false;\n }\n return Printing.symbol in a;\n }\n Printing.isPrintable = isPrintable;\n /**\n * Returns the print function for an object, or null if it does not provide a handler.\n */\n function getPrintFunction(val) {\n if (isPrintable(val)) {\n return val[Printing.symbol]();\n }\n return null;\n }\n Printing.getPrintFunction = getPrintFunction;\n /**\n * Prints a widget by copying it's DOM node\n * to a hidden iframe and printing that iframe.\n */\n function printWidget(widget) {\n return printContent(widget.node);\n }\n Printing.printWidget = printWidget;\n /**\n * Prints a URL by loading it into an iframe.\n *\n * @param url URL to load into an iframe.\n */\n async function printURL(url) {\n const settings = ServerConnection.makeSettings();\n const text = await (await ServerConnection.makeRequest(url, {}, settings)).text();\n return printContent(text);\n }\n Printing.printURL = printURL;\n /**\n * Prints a URL or an element in an iframe and then removes the iframe after printing.\n */\n async function printContent(textOrEl) {\n const isText = typeof textOrEl === 'string';\n const iframe = createIFrame();\n const parent = window.document.body;\n parent.appendChild(iframe);\n if (isText) {\n iframe.srcdoc = textOrEl;\n await resolveWhenLoaded(iframe);\n }\n else {\n iframe.src = 'about:blank';\n await resolveWhenLoaded(iframe);\n setIFrameNode(iframe, textOrEl);\n }\n const printed = resolveAfterEvent();\n launchPrint(iframe.contentWindow);\n // Once the print dialog has been dismissed, we regain event handling,\n // and it should be safe to discard the hidden iframe.\n await printed;\n parent.removeChild(iframe);\n }\n /**\n * Creates a new hidden iframe and appends it to the document\n *\n * Modified from\n * https://github.com/joseluisq/printd/blob/eb7948d602583c055ab6dee3ee294b6a421da4b6/src/index.ts#L24\n */\n function createIFrame() {\n const el = window.document.createElement('iframe');\n // We need both allow-modals and allow-same-origin to be able to\n // call print in the iframe.\n // We intentionally do not allow scripts:\n // https://github.com/jupyterlab/jupyterlab/pull/5850#pullrequestreview-230899790\n el.setAttribute('sandbox', 'allow-modals allow-same-origin');\n const css = 'visibility:hidden;width:0;height:0;position:absolute;z-index:-9999;bottom:0;';\n el.setAttribute('style', css);\n el.setAttribute('width', '0');\n el.setAttribute('height', '0');\n return el;\n }\n /**\n * Copies a node from the base document to the iframe.\n */\n function setIFrameNode(iframe, node) {\n iframe.contentDocument.body.appendChild(node.cloneNode(true));\n iframe.contentDocument.close();\n }\n /**\n * Promise that resolves when all resources are loaded in the window.\n */\n function resolveWhenLoaded(iframe) {\n return new Promise(resolve => {\n iframe.onload = () => resolve();\n });\n }\n /**\n * A promise that resolves after the next mousedown, mousemove, or\n * keydown event. We use this as a proxy for determining when the\n * main window has regained control after the print dialog is removed.\n *\n * We can't use the usual window.onafterprint handler because we\n * disallow Javascript execution in the print iframe.\n */\n function resolveAfterEvent() {\n return new Promise(resolve => {\n const onEvent = () => {\n document.removeEventListener('mousemove', onEvent, true);\n document.removeEventListener('mousedown', onEvent, true);\n document.removeEventListener('keydown', onEvent, true);\n resolve();\n };\n document.addEventListener('mousemove', onEvent, true);\n document.addEventListener('mousedown', onEvent, true);\n document.addEventListener('keydown', onEvent, true);\n });\n }\n /**\n * Prints a content window.\n */\n function launchPrint(contentWindow) {\n const result = contentWindow.document.execCommand('print', false);\n // execCommand won't work in firefox so we call the `print` method instead if it fails\n // https://github.com/joseluisq/printd/blob/eb7948d602583c055ab6dee3ee294b6a421da4b6/src/index.ts#L148\n if (!result) {\n contentWindow.print();\n }\n }\n})(Printing || (Printing = {}));\n//# sourceMappingURL=printing.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module json-extension\n */\nimport { Printing } from '@jupyterlab/apputils';\nimport { nullTranslator } from '@jupyterlab/translation';\nimport { Widget } from '@lumino/widgets';\nimport * as React from 'react';\nimport { createRoot } from 'react-dom/client';\n/**\n * The CSS class to add to the JSON Widget.\n */\nconst CSS_CLASS = 'jp-RenderedJSON';\n/**\n * The MIME type for JSON.\n */\nexport const MIME_TYPE = 'application/json';\n// NOTE: not standardized yet\nexport const MIME_TYPES_JSONL = [\n 'text/jsonl',\n 'application/jsonl',\n 'application/json-lines'\n];\n/**\n * A renderer for JSON data.\n */\nexport class RenderedJSON extends Widget {\n /**\n * Create a new widget for rendering JSON.\n */\n constructor(options) {\n super();\n this._rootDOM = null;\n this.addClass(CSS_CLASS);\n this.addClass('CodeMirror');\n this._mimeType = options.mimeType;\n this.translator = options.translator || nullTranslator;\n }\n [Printing.symbol]() {\n return () => Printing.printWidget(this);\n }\n /**\n * Render JSON into this widget's node.\n */\n async renderModel(model) {\n const { Component } = await import('./component');\n let data;\n // handle if json-lines format\n if (MIME_TYPES_JSONL.indexOf(this._mimeType) >= 0) {\n // convert into proper json\n const lines = (model.data[this._mimeType] || '')\n .trim()\n .split(/\\n/);\n data = JSON.parse(`[${lines.join(',')}]`);\n }\n else {\n data = (model.data[this._mimeType] || {});\n }\n const metadata = (model.metadata[this._mimeType] || {});\n if (this._rootDOM === null) {\n this._rootDOM = createRoot(this.node);\n }\n return new Promise((resolve, reject) => {\n this._rootDOM.render(React.createElement(Component, { data: data, metadata: metadata, translator: this.translator, forwardedRef: () => resolve() }));\n });\n }\n /**\n * Called before the widget is detached from the DOM.\n */\n onBeforeDetach(msg) {\n // Unmount the component so it can tear down.\n if (this._rootDOM) {\n this._rootDOM.unmount();\n this._rootDOM = null;\n }\n }\n}\n/**\n * A mime renderer factory for JSON data.\n */\nexport const rendererFactory = {\n safe: true,\n mimeTypes: [MIME_TYPE, ...MIME_TYPES_JSONL],\n createRenderer: options => new RenderedJSON(options)\n};\nconst extensions = [\n {\n id: '@jupyterlab/json-extension:factory',\n description: 'Adds renderer for JSON content.',\n rendererFactory,\n rank: 0,\n dataType: 'json',\n documentWidgetFactoryOptions: {\n name: 'JSON',\n // TODO: how to translate label of the factory?\n primaryFileType: 'json',\n fileTypes: ['json', 'notebook', 'geojson'],\n defaultFor: ['json']\n }\n },\n {\n id: '@jupyterlab/json-lines-extension:factory',\n description: 'Adds renderer for JSONLines content.',\n rendererFactory,\n rank: 0,\n dataType: 'string',\n documentWidgetFactoryOptions: {\n name: 'JSONLines',\n primaryFileType: 'jsonl',\n fileTypes: ['jsonl', 'ndjson'],\n defaultFor: ['jsonl', 'ndjson']\n }\n }\n];\nexport default extensions;\n//# sourceMappingURL=index.js.map","import {\n makeBinderOptions,\n makeKernelOptions,\n makeSavedSessionOptions,\n makeServerSettings,\n} from './options';\nimport { ThebeEvents } from './events';\nimport type {\n BinderOptions,\n KernelOptions,\n CoreOptions,\n SavedSessionOptions,\n ServerSettings,\n MathjaxOptions,\n} from './types';\n\nexport class Config {\n private _options: Required<\n Omit\n >;\n private _binderOptions: Required;\n private _savedSessions: Required;\n private _kernelOptions: Required;\n private _serverSettings: Required> & { wsUrl?: string };\n private _events: ThebeEvents;\n\n constructor(opts: CoreOptions = {}, extraConfig?: { events?: ThebeEvents }) {\n this._events = extraConfig?.events ?? new ThebeEvents();\n\n this._options = {\n mathjaxUrl:\n opts.mathjaxUrl ?? 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js',\n mathjaxConfig: opts.mathjaxConfig ?? 'TeX-AMS_CHTML-full,Safe',\n };\n\n this._binderOptions = makeBinderOptions(opts.binderOptions ?? {});\n this._savedSessions = makeSavedSessionOptions(opts.savedSessionOptions ?? {});\n this._kernelOptions = makeKernelOptions(opts.kernelOptions ?? {});\n this._serverSettings = makeServerSettings(opts.serverSettings ?? {});\n\n console.debug('thebe:config:constructor', this);\n }\n\n get events() {\n return this._events;\n }\n\n get base() {\n return this._options;\n }\n\n get mathjax(): MathjaxOptions {\n return {\n mathjaxUrl: this._options.mathjaxUrl,\n mathjaxConfig: this._options.mathjaxConfig,\n };\n }\n\n get binder() {\n return this._binderOptions;\n }\n\n get savedSessions() {\n return this._savedSessions;\n }\n\n get kernels() {\n return this._kernelOptions;\n }\n\n get serverSettings() {\n return this._serverSettings;\n }\n\n set serverSettings(newSettings: Required> & { wsUrl?: string }) {\n this._serverSettings = newSettings;\n }\n}\n","import { Config } from './config';\nimport type { ThebeEvents } from './events';\nimport type {\n ServerSettings,\n BinderOptions,\n KernelOptions,\n CoreOptions,\n SavedSessionOptions,\n MathjaxOptions,\n} from './types';\nimport { shortId } from './utils';\n\nexport function makeBinderOptions(opts: BinderOptions) {\n return {\n repo: 'executablebooks/thebe-binder-base',\n ref: 'HEAD',\n binderUrl: 'https://mybinder.org',\n repoProvider: 'github',\n ...opts,\n };\n}\n\nexport function makeSavedSessionOptions(opts: SavedSessionOptions): Required {\n return {\n enabled: true,\n maxAge: 86400,\n storagePrefix: 'thebe-binder',\n ...opts,\n };\n}\n\nexport function makeKernelOptions(opts: KernelOptions): Required {\n return {\n path: opts.path ?? '/',\n kernelName: opts.kernelName ?? 'python',\n };\n}\n\nexport function makeServerSettings(settings: ServerSettings): Required {\n const baseUrl = settings.baseUrl ?? 'http://localhost:8888';\n const wsUrl = settings.wsUrl ?? baseUrl.replace(/^http/, 'ws');\n\n return {\n token: shortId(), // randomized default token to prevent accidental access to a local server\n appendToken: true,\n ...settings,\n wsUrl,\n baseUrl,\n };\n}\n\nexport function makeMathjaxOptions(opts?: MathjaxOptions) {\n return {\n mathjaxUrl: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js',\n mathjaxConfig: 'TeX-AMS_CHTML-full,Safe',\n ...opts,\n };\n}\n\nexport function makeConfiguration(\n options: CoreOptions & { [k: string]: any },\n events?: ThebeEvents,\n) {\n return new Config(options, { events });\n}\n\nexport function ensureCoreOptions(\n options: CoreOptions & { [k: string]: any },\n events?: ThebeEvents,\n): Required {\n const config = new Config(options, { events });\n\n return {\n ...config.base,\n binderOptions: config.binder,\n savedSessionOptions: config.savedSessions,\n kernelOptions: config.kernels,\n serverSettings: config.serverSettings,\n };\n}\n","import type { IRenderMime } from '@jupyterlab/rendermime';\nimport {\n RenderMimeRegistry,\n htmlRendererFactory,\n markdownRendererFactory,\n latexRendererFactory,\n svgRendererFactory,\n imageRendererFactory,\n textRendererFactory,\n} from '@jupyterlab/rendermime';\nimport type { MathjaxOptions } from './types';\nimport { MathJaxTypesetter } from '@jupyterlab/mathjax2';\nimport { rendererFactory as javascriptRendererFactory } from '@jupyterlab/javascript-extension';\nimport { rendererFactory as jsonRendererFactory } from '@jupyterlab/json-extension';\nimport { makeMathjaxOptions } from './options';\n\nconst EXTENDED_FACTORIES = [\n htmlRendererFactory,\n markdownRendererFactory,\n latexRendererFactory,\n svgRendererFactory,\n imageRendererFactory,\n javascriptRendererFactory,\n textRendererFactory,\n];\n\nlet RENDERERS: IRenderMime.IRendererFactory[] | null = null;\n\nexport function getRenderers(mathjax: MathjaxOptions) {\n if (RENDERERS == null) {\n RENDERERS = EXTENDED_FACTORIES.filter((f) => {\n // filter out latex renderer if mathjax is unavailable\n if (f.mimeTypes.indexOf('text/latex') >= 0) {\n if (mathjax.mathjaxUrl) {\n return true;\n } else {\n console.debug('thebe:getRenderers MathJax unavailable');\n return false;\n }\n } else {\n return true;\n }\n });\n }\n let latexTypesetter;\n if (mathjax.mathjaxUrl && mathjax.mathjaxConfig) {\n latexTypesetter = new MathJaxTypesetter({\n url: mathjax.mathjaxUrl,\n config: mathjax.mathjaxConfig,\n });\n }\n return {\n initialFactories: [...RENDERERS],\n latexTypesetter,\n };\n}\n\nexport function makeRenderMimeRegistry(mathjax?: MathjaxOptions) {\n const rendermime = new RenderMimeRegistry(getRenderers(mathjax ?? makeMathjaxOptions()));\n rendermime.addFactory(jsonRendererFactory, 10);\n return rendermime;\n}\n","import type * as nbformat from '@jupyterlab/nbformat';\nimport { makeRenderMimeRegistry } from './rendermime';\nimport { OutputArea, OutputAreaModel } from '@jupyterlab/outputarea';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport type { IPassiveCell, MathjaxOptions } from './types';\nimport { makeMathjaxOptions } from './options';\nimport { Widget } from '@lumino/widgets';\nimport { MessageLoop } from '@lumino/messaging';\n\nclass PassiveCellRenderer implements IPassiveCell {\n readonly id: string;\n readonly rendermime: IRenderMimeRegistry;\n initialOutputs: nbformat.IOutput[];\n\n protected model: OutputAreaModel;\n protected area: OutputArea;\n\n constructor(\n id: string,\n initialOutputs?: nbformat.IOutput[],\n rendermime?: IRenderMimeRegistry,\n mathjax?: MathjaxOptions,\n ) {\n this.id = id;\n this.rendermime = rendermime ?? makeRenderMimeRegistry(mathjax ?? makeMathjaxOptions());\n this.model = new OutputAreaModel({ trusted: true });\n this.area = new OutputArea({\n model: this.model,\n rendermime: this.rendermime,\n });\n this.initialOutputs = initialOutputs ?? [];\n }\n\n /**\n * Serialize the model state to JSON\n */\n get outputs(): nbformat.IOutput[] {\n return this.model.toJSON();\n }\n\n get isAttachedToDOM() {\n return this.area.isAttached;\n }\n\n attachToDOM(\n el?: HTMLElement,\n opts: { strict?: boolean; appendExisting?: boolean } = { strict: false, appendExisting: true },\n ) {\n if (!this.area || !el) {\n console.error(\n `thebe:renderer:attachToDOM - could not attach to DOM - area: ${this.area}, el: ${el}`,\n );\n return;\n }\n if (this.area.isAttached) {\n // TODO should we detach and reattach?\n console.debug(`thebe:renderer:attachToDOM - already attached`);\n if (opts.strict) return;\n } else {\n // if the target element has contents, preserve it but wrap it in our output area\n console.debug(`thebe:renderer:attachToDOM ${this.id} - appending existing contents`);\n if (opts.appendExisting && el.innerHTML) {\n this.area.model.add({\n output_type: 'display_data',\n data: {\n 'text/html': el.innerHTML,\n },\n });\n }\n }\n\n el.textContent = '';\n\n const div = document.createElement('div');\n div.style.position = 'relative';\n div.className = 'thebe-output';\n el.append(div);\n\n MessageLoop.sendMessage(this.area, Widget.Msg.BeforeAttach);\n div.appendChild(this.area.node);\n MessageLoop.sendMessage(this.area, Widget.Msg.AfterAttach);\n }\n\n setOutputText(text: string) {\n if (!this.area) return;\n this.area.model.clear(true);\n this.area.model.add({\n output_type: 'stream',\n name: 'stdout',\n text,\n });\n }\n\n /**\n * Clears the output area model\n *\n * @returns\n */\n clear() {\n if (!this.area) return;\n this.area.model.clear();\n }\n\n /**\n * Will trigger the output to render an error with text taken from the optional argument\n *\n * @param error\n * @returns\n */\n clearOnError(error?: any) {\n if (!this.area) return;\n this.area.model.clear();\n this.area.model.add({\n output_type: 'stream',\n name: 'stderr',\n text: `Failed to execute. ${error ?? ''} Please refresh the page.`,\n });\n }\n\n /**\n * Render output data directly from json\n *\n * @param outputs - serialised jupyter outputs\n * @returns\n */\n render(outputs: nbformat.IOutput[]) {\n this.model.fromJSON(outputs);\n }\n}\n\nexport default PassiveCellRenderer;\n","import type { CellKind, IThebeCell, IThebeCellExecuteReturn, JsonObject } from './types';\nimport type ThebeSession from './session';\nimport PassiveCellRenderer from './passive';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport type { Config } from './config';\nimport { CellStatusEvent, ErrorStatusEvent, errorToMessage, EventSubject } from './events';\nimport { EventEmitter } from './emitter';\nimport type { ICodeCell, IError, IOutput } from '@jupyterlab/nbformat';\nimport { ensureString, shortId } from './utils';\n\nclass ThebeCodeCell extends PassiveCellRenderer implements IThebeCell {\n kind: CellKind;\n notebookId: string;\n source: string;\n metadata: JsonObject;\n session?: ThebeSession;\n executionCount: number | null;\n protected busy: boolean;\n protected events: EventEmitter;\n\n constructor(\n id: string,\n notebookId: string,\n source: string,\n outputs: IOutput[],\n config: Config,\n metadata: JsonObject,\n rendermime: IRenderMimeRegistry,\n ) {\n super(id, outputs, rendermime);\n this.kind = 'code';\n this.events = new EventEmitter(id, config, EventSubject.cell, this);\n this.notebookId = notebookId;\n this.source = source;\n this.metadata = metadata;\n this.busy = false;\n this.executionCount = null;\n console.debug('thebe:cell constructor', this);\n }\n\n static fromICodeCell(\n icc: ICodeCell,\n notebookId: string,\n config: Config,\n rendermime: IRenderMimeRegistry,\n ) {\n const cell = new ThebeCodeCell(\n icc.id ?? shortId(),\n notebookId,\n ensureString(icc.source),\n icc.outputs ?? [],\n config,\n icc.metadata,\n rendermime,\n );\n Object.assign(cell.metadata, icc.metadata);\n\n return cell;\n }\n\n get isBusy() {\n return this.busy;\n }\n\n get isAttached() {\n return this.session !== undefined;\n }\n\n get tags(): string[] {\n return this.metadata.tags ?? [];\n }\n\n /**\n * Attaches to the session and adds the widgets factory to the rendermine registry\n * call this version if using ThebeCell in isolation, otherwise call ThebeNotebook::attachSession\n *\n * @param session\n */\n attachSession(session: ThebeSession) {\n this.session = session;\n this.events.triggerStatus({\n status: CellStatusEvent.attached,\n message: 'Attached to session',\n });\n }\n\n /**\n * Detaches from the session and removes the widgets factory from the rendermine registry\n * call this version if using ThebeCell in isolation, otherwise call ThebeNotebook::detachSession\n *\n */\n detachSession() {\n this.session = undefined;\n this.events.triggerStatus({\n status: CellStatusEvent.detached,\n message: 'Detached from session',\n });\n }\n\n setAsBusy() {\n console.debug(`thebe:renderer:message:busy ${this.id}`);\n this.busy = true;\n this.events.triggerStatus({\n status: CellStatusEvent.executing,\n message: 'Executing...',\n });\n }\n\n setAsIdle() {\n console.debug(`thebe:renderer:message:completed ${this.id}`);\n this.busy = false;\n this.events.triggerStatus({\n status: CellStatusEvent.idle,\n message: 'Completed',\n });\n }\n\n /**\n * reset the DOM representation of the cell to the initial state\n * along with the execution count\n *\n * @param hideWidgets boolean - if true, hide widgets\n */\n initOutputs(initialOutputs: IOutput[]) {\n this.initialOutputs = initialOutputs;\n this.render(initialOutputs);\n this.executionCount = null;\n }\n\n /**\n * reset the DOM representation of the cell to the initial state\n * along with the execution count\n *\n * @param hideWidgets boolean - if true, hide widgets\n */\n reset() {\n this.render(this.initialOutputs);\n this.executionCount = null;\n }\n\n /**\n * TODO\n * - pass execute_count or timestamp or something back to redux on success/failure?\n *\n * @param source?\n * @returns\n */\n async execute(source?: string): Promise {\n if (!this.session || !this.session.kernel) {\n console.warn('Attempting to execute on a cell without an attached kernel');\n return null;\n }\n\n const code = source ?? this.source;\n\n try {\n console.debug(`thebe:renderer:execute ${this.id}`);\n if (!this.isBusy) this.setAsBusy();\n\n this.area.future = this.session.kernel.requestExecute({ code });\n\n // TODO consider how to enable execution without the await here\n const reply = await this.area.future.done;\n this.executionCount = reply.content.execution_count;\n\n let executeErrors: IError[] | undefined;\n for (let i = 0; i < this.model.length; i++) {\n const out = this.model.get(i);\n console.debug('thebecell:execute:output', { out: out.toJSON() });\n if (out.type === 'error') {\n const json = out.toJSON() as IError;\n if (json.ename === 'stderr') {\n this.events.triggerError({\n status: ErrorStatusEvent.warning,\n message: errorToMessage(json),\n });\n } else {\n if (!executeErrors) executeErrors = [json];\n else executeErrors?.push(json);\n this.events.triggerError({\n status: ErrorStatusEvent.executeError,\n message: errorToMessage(json),\n });\n }\n }\n }\n\n this.setAsIdle();\n return {\n id: this.id,\n height: this.area.node.offsetHeight,\n width: this.area.node.offsetWidth,\n error: executeErrors,\n };\n } catch (err: any) {\n console.error('thebe:renderer:execute Error:', err);\n this.clearOnError(err);\n this.events.triggerError(err.message);\n return null;\n }\n }\n}\n\nexport default ThebeCodeCell;\n","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type { ICell, IOutput } from '@jupyterlab/nbformat';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport PassiveCellRenderer from './passive';\nimport type ThebeSession from './session';\nimport type { CellKind, IThebeCell, IThebeCellExecuteReturn, JsonObject } from './types';\nimport { ensureString, shortId } from './utils';\nimport type ThebeNotebook from './notebook';\n\n/**\n * A Thebe cell that is exepected to contain markdown (or raw) source.\n *\n * Currently this just separates content cells from code cells and thebe provides no\n * special handling for markdown cells.\n *\n */\nexport default class ThebeMarkdownCell extends PassiveCellRenderer implements IThebeCell {\n id: string;\n notebookId: string;\n kind: CellKind;\n source: string;\n busy: boolean;\n metadata: JsonObject;\n\n constructor(\n id: string,\n notebookId: string,\n source: string,\n metadata: JsonObject,\n rendermime: IRenderMimeRegistry,\n ) {\n super(id, [], rendermime);\n this.kind = 'markdown';\n this.id = id;\n this.notebookId = notebookId;\n this.source = source;\n this.busy = false;\n this.metadata = metadata;\n }\n\n static fromICell(ic: ICell, notebookId: string, rendermime: IRenderMimeRegistry) {\n const cell = new ThebeMarkdownCell(\n typeof ic.id === 'string' ? ic.id : shortId(),\n notebookId,\n ensureString(ic.source),\n ic.metadata,\n rendermime,\n );\n return cell;\n }\n\n get isAttachedToDOM() {\n return false;\n }\n\n get isBusy() {\n return false;\n }\n\n get isAttached() {\n return false;\n }\n\n get executionCount(): number | null {\n return null;\n }\n\n setAsBusy(): void {\n // no-op\n }\n\n setAsIdle(): void {\n // no-op\n }\n\n initOutputs(initialOutputs: IOutput[]) {\n // no-op\n }\n\n reset() {\n // no-op\n }\n\n attachToDOM(el?: HTMLElement) {\n // could potentially allow for markdown rendering here\n }\n\n attachSession(session: ThebeSession) {\n // no-op\n }\n\n detachSession(): void {\n // no-op\n }\n\n setOutputText(text: string) {\n // no-op\n }\n\n clear() {\n // no-op\n }\n\n clearOnError(error?: any) {\n // no-op\n }\n\n messageBusy(): void {\n // no-op\n }\n\n messageCompleted(): void {\n // no-op\n }\n\n messageError(message: string): void {\n // no-op\n }\n\n render(outputs: IOutput[]): void {\n // no-op\n }\n\n get tags(): string[] {\n return [];\n }\n\n get outputs() {\n return [] as IOutput[];\n }\n\n async execute(source?: string): Promise {\n // could potentially allow for markdown rendering here\n return { id: this.id, height: 0, width: 0 };\n }\n}\n","import ThebeCodeCell from './cell';\nimport type ThebeSession from './session';\nimport type { IThebeCell, IThebeCellExecuteReturn } from './types';\nimport { shortId } from './utils';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport type { Config } from './config';\nimport { EventSubject, NotebookStatusEvent } from './events';\nimport { EventEmitter } from './emitter';\nimport type { ICodeCell, INotebookContent, INotebookMetadata } from '@jupyterlab/nbformat';\nimport ThebeMarkdownCell from './markdown';\n\nexport interface CodeBlock {\n id: string;\n source: string;\n [x: string]: any;\n}\n\nfunction coerceToObject(maybe: any): Record {\n if (typeof maybe === 'object') return maybe;\n if (Array.isArray(maybe)) return Object.fromEntries(maybe.map((v, k) => [k, v]));\n return {};\n}\n\nclass ThebeNotebook {\n readonly id: string;\n readonly rendermime: IRenderMimeRegistry;\n cells: IThebeCell[];\n metadata: INotebookMetadata;\n widgetState: Record;\n session?: ThebeSession;\n protected events: EventEmitter;\n\n constructor(\n id: string,\n config: Config,\n rendermime: IRenderMimeRegistry,\n metadata?: INotebookMetadata,\n ) {\n this.id = id;\n this.events = new EventEmitter(id, config, EventSubject.notebook, this);\n this.cells = [];\n this.metadata = metadata ?? {};\n this.widgetState = coerceToObject(metadata?.widgets);\n this.rendermime = rendermime;\n console.debug('thebe:notebook constructor', this);\n }\n\n static fromCodeBlocks(blocks: CodeBlock[], config: Config, rendermime: IRenderMimeRegistry) {\n const id = shortId();\n const notebook = new ThebeNotebook(id, config, rendermime);\n notebook.cells = blocks.map((c) => {\n const metadata = {};\n const cell = new ThebeCodeCell(\n c.id,\n notebook.id,\n c.source,\n c.outputs ?? [],\n config,\n metadata,\n notebook.rendermime,\n );\n console.debug(`thebe:notebook:fromCodeBlocks Initializing cell ${c.id}`);\n return cell;\n });\n\n return notebook;\n }\n\n static fromIpynb(ipynb: INotebookContent, config: Config, rendermime: IRenderMimeRegistry) {\n const notebook = new ThebeNotebook(shortId(), config, rendermime);\n\n Object.assign(notebook.metadata, ipynb.metadata);\n\n notebook.cells = ipynb.cells.map((c) => {\n if ((c as ICodeCell).cell_type === 'code')\n return ThebeCodeCell.fromICodeCell(\n c as ICodeCell,\n notebook.id,\n config,\n notebook.rendermime,\n );\n return ThebeMarkdownCell.fromICell(c, notebook.id, notebook.rendermime);\n });\n\n return notebook;\n }\n\n get parameters() {\n const p = this.findCells('parameters');\n if (!p || p?.length === 0) return undefined;\n if (p.length > 1) console.warn(`Mulitple parameter cells found in notebook ${this.id}`);\n return p;\n }\n\n /**\n @deprecated\n */\n get widgets() {\n return this.findCells('widget') ?? [];\n }\n\n get last() {\n if (this.cells.length === 0) throw new Error('empty notebook');\n return this.cells[this.cells.length - 1];\n }\n\n get markdown() {\n return this.cells.filter((c) => c.kind === 'markdown');\n }\n\n get code() {\n return this.cells.filter((c) => c.kind === 'code');\n }\n\n /**\n * reset the notebook to its initial state by resetting each cell\n *\n * @param hideWidgets boolean\n */\n reset() {\n this.cells.forEach((cell) => cell.reset());\n }\n\n numCells() {\n return this.cells?.length ?? 0;\n }\n\n findCells(tag: string) {\n const found = this.cells.filter((c) => c.tags.includes(tag));\n return found.length > 0 ? found : undefined;\n }\n\n getCell(idx: number) {\n if (!this.cells) throw Error('Dag not initialized');\n if (idx >= this.cells.length)\n throw Error(`Notebook.cells index out of range: ${idx}:${this.cells.length}`);\n return this.cells[idx];\n }\n\n getCellById(id: string) {\n const cell = this.cells?.find((c) => c.id === id);\n return cell;\n }\n\n lastCell() {\n if (!this.cells) throw Error('Notebook not initialized');\n return this.cells[this.cells.length - 1];\n }\n\n updateParameters(newSource: string, interpolate = false) {\n if (interpolate) throw new Error('Not implemented yet');\n if (this.parameters) this.parameters[0].source = newSource;\n }\n\n async waitForKernel(kernel: Promise) {\n return kernel.then((k) => {\n this.attachSession(k);\n return k;\n });\n }\n\n attachSession(session: ThebeSession) {\n if (!session.kernel) throw Error('ThebeNotebook - cannot connect to session, no kernel');\n // note all cells in a notebook share the rendermime registry\n // we only need to add the widgets factory once\n this.session = session;\n this.cells?.forEach((cell) => (cell.session = session));\n this.events.triggerStatus({\n status: NotebookStatusEvent.attached,\n message: 'Attached to session',\n });\n }\n\n detachSession() {\n this.cells?.map((cell) => (cell.session = undefined));\n this.session = undefined;\n this.events.triggerStatus({\n status: NotebookStatusEvent.detached,\n message: 'Detached from session',\n });\n }\n\n clear() {\n this.cells.forEach((cell) => cell.clear());\n }\n\n async executeUpTo(\n cellId: string,\n stopOnError = false,\n preprocessor?: (s: string) => string,\n ): Promise<(IThebeCellExecuteReturn | null)[]> {\n if (!this.cells) return [];\n this.events.triggerStatus({\n status: NotebookStatusEvent.executing,\n message: `executeUpTo ${cellId}`,\n });\n const idx = this.cells.findIndex((c) => c.id === cellId);\n if (idx === -1) return [];\n const cellsToExecute = this.cells.slice(0, idx + 1);\n cellsToExecute.map((cell) => cell.setAsBusy());\n const result = await this.executeCells(\n cellsToExecute.map((c) => c.id),\n stopOnError,\n preprocessor,\n );\n // TODO intercept errors here\n this.events.triggerStatus({\n status: NotebookStatusEvent.idle,\n message: `executeUpTo ${cellId}`,\n });\n\n return result;\n }\n\n async executeOnly(\n cellId: string,\n preprocessor?: (s: string) => string,\n ): Promise {\n if (!this.cells) return null;\n this.events.triggerStatus({\n status: NotebookStatusEvent.executing,\n message: `executeOnly ${cellId}`,\n });\n const result = await this.executeCells([cellId], false, preprocessor);\n this.events.triggerStatus({\n status: NotebookStatusEvent.idle,\n message: `executeUpTo ${cellId}`,\n });\n\n return result[0];\n }\n\n async executeCells(\n cellIds: string[],\n stopOnError = false,\n preprocessor?: (s: string) => string,\n ): Promise<(IThebeCellExecuteReturn | null)[]> {\n if (!this.cells) return [];\n this.events.triggerStatus({\n status: NotebookStatusEvent.executing,\n message: `executeCells ${cellIds.length} cells`,\n });\n const cells = this.cells.filter((c) => {\n const found = cellIds.find((id) => id === c.id);\n if (!found) {\n console.warn(`Cell ${c.id} not found in notebook`);\n }\n return Boolean(found);\n });\n\n let result: (IThebeCellExecuteReturn | null)[] = [];\n\n if (stopOnError) {\n let skipRemaining = false;\n for (const cell of cells) {\n if (skipRemaining) continue;\n const cellReturn = await cell.execute(\n preprocessor ? preprocessor(cell.source) : cell.source,\n );\n if (cellReturn == null || cellReturn.error) skipRemaining = true;\n result.push(cellReturn);\n }\n } else {\n result = await Promise.all(\n cells.map((cell) => cell.execute(preprocessor ? preprocessor(cell.source) : cell.source)),\n );\n }\n\n this.events.triggerStatus({\n status: NotebookStatusEvent.idle,\n message: `executeCells executed ${cellIds.length} cells`,\n });\n return result;\n }\n\n async executeAll(\n stopOnError = false,\n preprocessor?: (s: string) => string,\n ): Promise<(IThebeCellExecuteReturn | null)[]> {\n if (!this.cells) return [];\n\n this.events.triggerStatus({\n status: NotebookStatusEvent.executing,\n message: `executeAll`,\n });\n\n this.cells.map((cell) => cell.setAsBusy());\n\n const result = await this.executeCells(\n this.cells.map((c) => c.id),\n stopOnError,\n preprocessor,\n );\n\n this.events.triggerStatus({\n status: NotebookStatusEvent.idle,\n message: `executeAll`,\n });\n\n return result;\n }\n}\n\nexport default ThebeNotebook;\n","import ThebeServer from '../server';\nimport type { CodeBlock } from '../notebook';\nimport ThebeNotebook from '../notebook';\nimport type { INotebookContent } from '@jupyterlab/nbformat';\nimport type { Config } from '..';\nimport { ThebeEvents } from '../events';\nimport { makeConfiguration } from '../options';\nimport { makeRenderMimeRegistry } from '../rendermime';\nimport * as coreModule from '../index';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\n\nexport function connectToBinder(config: Config): ThebeServer {\n const server: ThebeServer = new ThebeServer(config);\n console.debug(`thebe:api:connect binder 📡`, config.binder);\n server.connectToServerViaBinder();\n return server;\n}\n\nexport function connectToJupyter(config: Config): ThebeServer {\n const server: ThebeServer = new ThebeServer(config);\n console.debug(`thebe:api:connect direct 🔌`, config.serverSettings);\n server.connectToJupyterServer();\n return server;\n}\n\nexport function connectToJupyterLite(config: Config): ThebeServer {\n const server: ThebeServer = new ThebeServer(config);\n console.debug(`thebe:api:connect JupyterLite 🤘`);\n server.connectToJupyterLiteServer();\n return server;\n}\n\nexport function makeEvents() {\n return new ThebeEvents();\n}\n\nexport function makeServer(config: Config) {\n return new ThebeServer(config);\n}\n\nexport function setupNotebookFromBlocks(\n blocks: CodeBlock[],\n config: Config,\n rendermime: IRenderMimeRegistry,\n) {\n return ThebeNotebook.fromCodeBlocks(blocks, config, rendermime);\n}\n\nexport function setupNotebookFromIpynb(\n ipynb: INotebookContent,\n config: Config,\n rendermime: IRenderMimeRegistry,\n) {\n return ThebeNotebook.fromIpynb(ipynb, config, rendermime);\n}\n\nexport function setupThebeCore() {\n console.debug(`thebe:api:setupThebeCore`, { coreModule });\n window.thebeCore = Object.assign(window.thebeCore ?? {}, {\n module: coreModule,\n api: {\n makeConfiguration,\n makeEvents,\n makeServer,\n makeRenderMimeRegistry,\n connectToBinder,\n connectToJupyter,\n connectToJupyterLite,\n setupNotebookFromBlocks,\n setupNotebookFromIpynb,\n },\n });\n}\n","/* eslint-disable import/no-duplicates */\n/**\n * thebe/index.js is the entrypoint for the webpack build and will\n * be invoked on module load, seting up context with an independent store\n * and adding to the window object.\n */\nimport type ThebeServer from '../server';\nimport type { CodeBlock } from '../notebook';\nimport type ThebeNotebook from '../notebook';\nimport type { CoreOptions } from '../types';\nimport type { Config } from '../config';\nimport type { ThebeEvents } from '../events';\nimport type { ThebeLiteGlobal } from 'thebe-lite';\nimport type * as coreModule from '../index';\nimport type { INotebookContent } from '@jupyterlab/nbformat';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport { setupThebeCore } from './api';\n\n/**\n * This file is the main entrypoint for the cjs bundle\n * For the TS module, use setupThebeCore()\n */\n\nexport interface JsApi {\n makeEvents: () => ThebeEvents;\n makeConfiguration: (options: Partial, events?: ThebeEvents) => Config;\n makeServer: (config: Config) => ThebeServer;\n makeRenderMimeRegistry: (mathjax?: coreModule.MathjaxOptions | undefined) => IRenderMimeRegistry;\n connectToBinder: (config: Config) => ThebeServer;\n connectToJupyter: (config: Config) => ThebeServer;\n connectToJupyterLite: (config: Config) => ThebeServer;\n setupNotebookFromBlocks: (\n blocks: CodeBlock[],\n config: Config,\n rendermime: IRenderMimeRegistry,\n ) => ThebeNotebook;\n setupNotebookFromIpynb: (\n ipynb: INotebookContent,\n config: Config,\n rendermime: IRenderMimeRegistry,\n ) => ThebeNotebook;\n}\n\nexport type ThebeCore = typeof coreModule;\n\nexport interface ThebeCoreGlobal {\n module: ThebeCore;\n api: JsApi;\n}\n\ndeclare global {\n interface Window {\n define: any;\n requirejs: any;\n thebeLite?: ThebeLiteGlobal;\n thebeCore?: ThebeCoreGlobal;\n }\n}\n\nif (typeof window !== 'undefined') setupThebeCore();\n","import api from \"!../../../../packages/thebe/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../../packages/thebe/node_modules/css-loader/dist/cjs.js!./output.css\";\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport * as outputBase from '@jupyter-widgets/output';\nimport { JupyterLuminoPanelWidget } from '@jupyter-widgets/base';\nimport { OutputAreaModel, OutputArea } from '@jupyterlab/outputarea';\nimport $ from 'jquery';\nimport '../css/output.css';\nexport class OutputModel extends outputBase.OutputModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { msg_id: '', outputs: [] });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n this._outputs = new OutputAreaModel({ trusted: true });\n this.listenTo(this, 'change:outputs', this.setOutputs);\n this.setOutputs();\n }\n get outputs() {\n return this._outputs;\n }\n clear_output(wait = false) {\n this._outputs.clear(wait);\n }\n setOutputs(model, value, options) {\n if (!(options && options.newMessage)) {\n // fromJSON does not clear the existing output\n this.clear_output();\n // fromJSON does not copy the message, so we make a deep copy\n this._outputs.fromJSON(JSON.parse(JSON.stringify(this.get('outputs'))));\n }\n }\n}\nexport class OutputView extends outputBase.OutputView {\n _createElement(tagName) {\n this.luminoWidget = new JupyterLuminoPanelWidget({ view: this });\n return this.luminoWidget.node;\n }\n _setElement(el) {\n if (this.el || el !== this.luminoWidget.node) {\n // Boxes don't allow setting the element beyond the initial creation.\n throw new Error('Cannot reset the DOM element.');\n }\n this.el = this.luminoWidget.node;\n this.$el = $(this.luminoWidget.node);\n }\n render() {\n super.render();\n this._outputView = new OutputArea({\n rendermime: this.model.widget_manager.renderMime,\n model: this.model.outputs,\n });\n this.luminoWidget.insertWidget(0, this._outputView);\n this.luminoWidget.addClass('jupyter-widgets');\n this.luminoWidget.addClass('widget-output');\n this.update();\n }\n remove() {\n this._outputView.dispose();\n return super.remove();\n }\n}\n//# sourceMappingURL=output.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { Widget } from '@lumino/widgets';\nexport const WIDGET_MIMETYPE = 'application/vnd.jupyter.widget-view+json';\n// Renderer to allow the output widget to render sub-widgets\nexport class WidgetRenderer extends Widget {\n constructor(options, manager) {\n super();\n this.mimeType = options.mimeType;\n this._manager = manager;\n }\n async renderModel(model) {\n const source = model.data[this.mimeType];\n if (!this._manager.has_model(source.model_id)) {\n this.node.textContent = 'Error creating widget: could not find model';\n this.addClass('jupyter-widgets');\n return;\n }\n try {\n const wModel = await this._manager.get_model(source.model_id);\n const wView = await this._manager.create_view(wModel);\n Widget.attach(wView.luminoWidget, this.node);\n }\n catch (err) {\n console.log('Error displaying widget');\n console.log(err);\n this.node.textContent = 'Error displaying widget';\n this.addClass('jupyter-widgets');\n }\n }\n}\n//# sourceMappingURL=output_renderers.js.map","import type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport type { IManagerState } from '@jupyter-widgets/base-manager';\nimport { ManagerBase } from '@jupyter-widgets/base-manager';\nimport * as base from '@jupyter-widgets/base';\nimport * as controls from '@jupyter-widgets/controls';\nimport * as output from '@jupyter-widgets/html-manager/lib/output';\nimport { WidgetRenderer } from '@jupyter-widgets/html-manager/lib/output_renderers';\nimport { shortId } from './utils';\nimport { RequireJsLoader } from './requireJsLoader';\nimport { requireLoader } from './loader';\nimport { WIDGET_VIEW_MIMETYPE } from './manager';\n\nexport function makeThebePassiveManager(\n rendermime: IRenderMimeRegistry,\n widgetState?: IManagerState,\n) {\n return new ThebePassiveManager(rendermime, widgetState);\n}\n\n/**\n * A Widget Manager class for Thebe using the context-free KernelWidgetManager from\n * the JupyterLab Manager and inspierd by the implementation in Voila here:\n * https://github.dev/voila-dashboards/voila/blob/main/packages/voila/src/manager.ts\n *\n */\nexport class ThebePassiveManager extends ManagerBase {\n id: string;\n _loader: RequireJsLoader;\n _onMessageFn?: (msg: any) => void;\n rendermime: IRenderMimeRegistry;\n views: Record = {};\n models: base.WidgetModel[];\n\n constructor(\n rendermime: IRenderMimeRegistry,\n widgetState?: IManagerState,\n opts?: {\n onMessage: (msg: any) => void;\n },\n ) {\n super();\n\n this.id = shortId();\n this.models = [];\n this._loader = new RequireJsLoader();\n this._onMessageFn = opts?.onMessage;\n\n if (widgetState) {\n this.load_state(widgetState);\n }\n this.rendermime = rendermime;\n rendermime.addFactory(\n {\n safe: false,\n mimeTypes: [WIDGET_VIEW_MIMETYPE],\n createRenderer: (options) => new WidgetRenderer(options, this as any),\n },\n 1,\n );\n }\n\n _onMessage(msg: any) {\n this._onMessageFn?.(msg);\n }\n\n /**\n * An accessor allowing us to use the @jupyter-widgets/html-manager/lib/output_renderers\n */\n get renderMime() {\n return this.rendermime;\n }\n\n /**\n * TODO implement a reasonable method for thebe-core that can load serialized widget state\n * see: https://github.dev/voila-dashboards/voila/blob/7090eb3e30c0c4aa25c2b7d5d2d45e8de1333b3b/packages/voila/src/manager.ts#L52\n */\n async load_state(state: IManagerState): Promise {\n this.models = await this.set_state(state);\n return this.models;\n }\n\n _get_comm_info() {\n return Promise.resolve({\n on_close: () => {\n return;\n },\n on_msg:\n this._onMessage ??\n (() => {\n return;\n }),\n close: () => {\n return;\n },\n });\n }\n\n _create_comm() {\n return Promise.reject('no comms available');\n }\n\n async display_view(view: any, el?: HTMLElement): Promise {\n if (el) {\n el.appendChild(view.luminoWidget.node);\n }\n if (view.el) {\n view.el.setAttribute('data-thebe-jupyter-widget', '');\n }\n return view.luminoWidget;\n }\n\n async loadClass(\n className: string,\n moduleName: string,\n moduleVersion: string,\n ): Promise {\n if (!this._loader.requested) {\n console.debug(`thebe:manager:loadClass initial requirejs load ${this.id}`);\n this._loader.load((require, define) => {\n define('@jupyter-widgets/base', base as any);\n define('@jupyter-widgets/controls', controls as any);\n define('@jupyter-widgets/output', output as any);\n });\n }\n\n console.debug(`thebe:manager:loadClass ${moduleName}@${moduleVersion}`);\n const rjs = await this._loader.ready;\n\n if (moduleName === '@jupyter-widgets/base') {\n return (base as Record)[className];\n } else if (moduleName === '@jupyter-widgets/controls') {\n return (controls as Record)[className];\n } else if (moduleName === '@jupyter-widgets/output') {\n return (output as Record)[className];\n } else {\n let mod;\n try {\n mod = await requireLoader(rjs, moduleName, moduleVersion);\n } catch (err) {\n console.error(`thebe:manager:loadClass loader error`, err);\n throw err;\n }\n if (mod[className]) {\n return mod[className];\n } else {\n console.error(\n `thebe:manager:loadClass ${className} not found in module ${moduleName}@${moduleVersion}`,\n );\n throw new Error(`Class ${className} not found in module ${moduleName}@${moduleVersion}`);\n }\n }\n }\n}\n","import type { Options } from './options';\n\nexport class ActivateWidget {\n options: Partial;\n\n constructor(options?: Options) {\n this.options = options ?? {};\n }\n\n mount() {\n const el = document.querySelector('.thebe-activate');\n\n const box = document.createElement('div');\n box.classList.add('thebe-activate');\n\n const btn = document.createElement('button');\n btn.textContent = 'Activate';\n btn.classList.add('thebe-activate-button');\n btn.onclick = () => window.thebe.bootstrap(this.options);\n\n box.appendChild(btn);\n\n el?.replaceWith(box);\n }\n}\n","import CodeMirror from 'codemirror/lib/codemirror';\nimport 'codemirror/lib/codemirror.css';\nimport 'codemirror/mode/python/python.js';\nimport 'codemirror/addon/hint/show-hint';\nimport 'codemirror/addon/display/autorefresh';\nimport 'codemirror/theme/abcdef.css';\nimport 'codemirror/theme/darcula.css';\nimport 'codemirror/theme/idea.css';\n\nimport type { Options } from './options';\nimport type { IThebeCell } from 'thebe-core';\nimport type { ICompleteReplyMsg } from '@jupyterlab/services/lib/kernel/messages';\nimport type { CellDOMPlaceholder } from './types';\n\ninterface DefaultCodeMirrorConfig {\n theme: 'default';\n mode: 'python';\n readOnly: false;\n autoRefresh: true;\n lineNumbers: true;\n styleActiveLine: true;\n matchBrackets: true;\n}\n\ninterface PageCodeMirrorConfig {\n mode?: string;\n readOnly?: boolean;\n}\n\ninterface RequiredCodeMirrorConfig {\n value: string;\n extraKeys: {\n 'Shift-Enter': () => void;\n 'Ctrl-Space': () => void;\n Esc: () => void;\n };\n}\n\nexport function setupCodemirror(\n options: Options,\n item: CellDOMPlaceholder,\n cell: IThebeCell,\n cellEl: HTMLElement,\n editorEl: HTMLElement,\n setBusy: (id: string) => void,\n clearBusy: (id: string) => void,\n) {\n const { source: sourceEl } = item.placeholders;\n const modeFromPage = sourceEl.getAttribute('data-language') || 'python';\n const isReadOnlyFromPage = sourceEl.getAttribute('data-readonly');\n console.debug(`thebe:setupCodemirror isReadOnly: ${isReadOnlyFromPage}`);\n\n async function execute() {\n console.debug(`thebe:codemirror:shift-enter execute`);\n try {\n setBusy(cell.id);\n await cell.execute(cell.source);\n clearBusy(cell.id);\n } catch (error) {\n cell.clearOnError(error);\n }\n }\n\n const ref: { cm?: any } = { cm: undefined };\n\n function unFocus() {\n ref.cm?.display.input.blur();\n }\n\n function codeCompletion() {\n console.debug(`thebe:codemirror:codeCompletion`);\n const code = ref.cm?.getValue();\n const cursor = ref.cm?.getDoc().getCursor();\n if (cell.session?.kernel) {\n cell.session?.kernel\n .requestComplete({\n code,\n cursor_pos: ref.cm?.getDoc().indexFromPos(cursor),\n })\n .then((value: ICompleteReplyMsg) => {\n if (value.content.status === 'ok') {\n const from = ref.cm?.getDoc().posFromIndex(value.content.cursor_start);\n const to = ref.cm?.getDoc().posFromIndex(value.content.cursor_end);\n ref.cm?.showHint({\n container: editorEl,\n hint: () => {\n return {\n from: from,\n to: to,\n list: (value.content as { matches: string[] }).matches,\n };\n },\n });\n }\n });\n }\n }\n\n const defaultSettings: DefaultCodeMirrorConfig = {\n theme: 'default',\n mode: 'python',\n readOnly: false,\n autoRefresh: true,\n lineNumbers: true,\n styleActiveLine: true,\n matchBrackets: true,\n };\n\n const configFromPage: PageCodeMirrorConfig = {\n mode: modeFromPage,\n readOnly: undefined,\n };\n\n if (isReadOnlyFromPage != null) {\n // override settings using the cell attribute\n configFromPage.readOnly = isReadOnlyFromPage == 'false' ? false : true;\n }\n\n const requiredSettings: RequiredCodeMirrorConfig = {\n value: cell.source,\n extraKeys: {\n 'Shift-Enter': execute,\n 'Ctrl-Space': codeCompletion,\n Esc: unFocus,\n },\n };\n\n const codeMirrorConfig = Object.assign(\n {},\n defaultSettings,\n options.codeMirrorConfig ?? {},\n configFromPage,\n requiredSettings,\n );\n console.debug('thebe:setupCodemirror:codeMirrorConfig', codeMirrorConfig);\n\n ref.cm = new CodeMirror(editorEl as HTMLElement, codeMirrorConfig);\n // TODO enable loading of mode js files via configuration\n // see https://github.com/jupyterlab/jupyterlab/blob/3.6.x/packages/codemirror/src/mode.ts for\n // an example of how to do this\n ref.cm.setOption('mode', codeMirrorConfig.mode);\n\n // All cells in the notebook automatically update their sources on change\n ref.cm.on('change', () => {\n const code = ref.cm.getValue();\n cell.source = code;\n ref.cm.refresh();\n });\n\n if (codeMirrorConfig.readOnly) {\n ref.cm.display.lineDiv.setAttribute('data-readonly', 'true');\n editorEl.setAttribute('data-readonly', 'true');\n cellEl.setAttribute('data-readonly', 'true');\n }\n\n ref.cm.refresh();\n\n return ref.cm;\n}\n","import { ThebeEvents, setupThebeCore } from 'thebe-core';\nimport * as thebe from './thebe';\n\nexport * from './types';\nexport * from './thebe';\n\nexport function setupGlobals() {\n const events = new ThebeEvents();\n\n window.thebe = Object.assign(window.thebe ?? {}, {\n ...thebe,\n events,\n trigger: events.trigger.bind(events),\n on: events.on.bind(events),\n one: events.one.bind(events),\n off: events.off.bind(events),\n });\n\n window.thebelab = window.thebe;\n}\n\nif ((window as any) !== undefined) {\n setupThebeCore();\n setupGlobals();\n\n document.addEventListener('DOMContentLoaded', () => {\n const options = thebe.getPageConfig();\n if (options.mountStatusWidget) {\n thebe.mountStatusWidget();\n }\n if (options.mountActivateWidget) {\n thebe.mountActivateWidget(options);\n }\n if (options['bootstrap']) {\n thebe.bootstrap(options);\n }\n });\n}\n","import type { CoreOptions } from 'thebe-core';\nimport { ensureCoreOptions } from 'thebe-core';\nimport merge from 'lodash.merge';\nimport JSON5 from 'json5';\n\n// Exposing @jupyter-widgets/base and @jupyter-widgets/controls as amd\n// modules for custom widget bundles that depend on it.\n\nexport interface ThebeOptions {\n bootstrap?: boolean;\n useBinder?: boolean;\n useJupyterLite?: boolean;\n requestKernel?: boolean;\n // UI related options\n selector?: string;\n outputSelector?: string;\n predefinedOutput?: boolean;\n mountStatusWidget?: boolean;\n mountActivateWidget?: boolean;\n mountRunButton?: boolean;\n mountRunAllButton?: boolean;\n mountRestartButton?: boolean;\n mountRestartAllButton?: boolean;\n preRenderHook?: (() => void) | null;\n // thebe specific options\n stripPrompts?: {\n inPrompt?: string;\n continuationPrompt?: string;\n };\n stripOutputPrompts?: { outPrompt?: string };\n codeMirrorConfig?: {\n theme?: string;\n readOnly?: boolean;\n mode?: string;\n autoRefresh?: boolean;\n lineNumbers?: boolean;\n styleActiveLine?: boolean;\n matchBrackets?: boolean;\n };\n}\n\nexport type Options = ThebeOptions & CoreOptions;\n\nexport const defaultSelector = '[data-executable]';\nexport const defaultOutputSelector = '[data-output]';\n\n// options\nexport const defaultOptions: ThebeOptions = {\n bootstrap: false,\n useBinder: true,\n useJupyterLite: false,\n requestKernel: true,\n preRenderHook: null,\n predefinedOutput: true,\n mountStatusWidget: true,\n mountActivateWidget: true,\n selector: defaultSelector,\n outputSelector: defaultOutputSelector,\n mountRunButton: true,\n mountRunAllButton: true,\n mountRestartButton: true,\n mountRestartAllButton: true,\n codeMirrorConfig: {},\n};\n\nlet _pageConfigData: Options | undefined;\n\nconst getKeyValue =\n (key: U) =>\n (obj: T) =>\n obj[key];\n\nexport function mergeOptions(options: Partial): Options {\n const optionsOnPage = getPageConfig();\n const merged = merge({}, optionsOnPage, options);\n if (!merged.codeMirrorConfig && (merged.binderOptions as any).codeMirrorConfig) {\n merged.codeMirrorConfig = (merged.binderOptions as any).codeMirrorConfig;\n }\n return { ...merged, ...ensureCoreOptions(merged) };\n}\n\nexport function resetPageConfig() {\n _pageConfigData = undefined;\n}\n\nexport function getPageConfig(): Options {\n ensurePageConfigLoaded();\n return _pageConfigData as Options;\n}\n\nexport function getPageConfigValue(key: keyof Options) {\n const config = getPageConfig();\n if (!config) return getKeyValue(key)(config);\n}\n\nexport function ensurePageConfigLoaded() {\n if (!_pageConfigData) {\n let fragments = {};\n const elList = document.querySelectorAll(\"script[type='text/x-thebe-config']\");\n elList.forEach((el) => {\n if (el.getAttribute('data-thebe-loaded')) return;\n el.setAttribute('data-thebe-loaded', 'true');\n if (!el.textContent) return;\n let pageConfigFragment = undefined;\n try {\n pageConfigFragment = JSON5.parse(el.textContent);\n if (pageConfigFragment) {\n console.debug('loading thebe config', pageConfigFragment);\n fragments = merge(fragments, pageConfigFragment);\n } else {\n console.debug('No thebeConfig found in ', el);\n }\n } catch (e) {\n console.error('Error loading thebe config', e, el.textContent);\n }\n });\n\n _pageConfigData = { ...defaultOptions, ...fragments };\n }\n return _pageConfigData;\n}\n","import type { IThebeCell, ThebeNotebook } from 'thebe-core';\nimport type { Options } from './options';\nimport { randomId } from './utils';\nimport type { CellDOMItem, CellDOMPlaceholder } from './types';\nimport { setupCodemirror } from './codemirror';\n\n/**\n * findCells will find cells and outputs, associating outputs with cells\n * in fifo priority\n *\n * Note: this mirrors the original thebe behaviour\n *\n * @param selector\n * @param outputSelector\n * @returns\n */\nexport function findCells(selector: string, outputSelector: string): CellDOMPlaceholder[] {\n const cellEls = Array.from(document.querySelectorAll(selector));\n const outputEls = Array.from(document.querySelectorAll(outputSelector));\n return cellEls.map((el, idx) => ({\n id: randomId(),\n placeholders: {\n source: el,\n output: idx < outputEls.length ? outputEls[idx] : undefined,\n },\n }));\n}\n\nfunction buildButton(\n parent: Element,\n classSlug: string,\n text: string,\n title: string,\n onClickCb?: () => void,\n) {\n const btn = document.createElement('button');\n btn.classList.add('thebe-button', `thebe-${classSlug}-button`);\n btn.textContent = text;\n btn.setAttribute('title', title);\n btn.onclick = onClickCb ?? (() => console.debug(`thebe:${classSlug}`));\n parent.append(btn);\n return btn;\n}\n\nfunction buildButtonBusySpinner(parent: Element) {\n const outer = document.createElement('div');\n outer.classList.add('thebe-busy');\n outer.style.display = 'none';\n const inner = document.createElement('div');\n inner.classList.add('thebe-busy-spinner');\n outer.appendChild(inner);\n parent.append(outer);\n return outer;\n}\n\nfunction getButtonsBusy(id: string) {\n const cell = document.querySelector(`[data-thebe-id=${id}]`);\n const busy = cell?.getElementsByClassName('thebe-busy').item(0);\n if (!busy) return;\n return busy as HTMLElement;\n}\n\nexport function setButtonsBusy(id: string) {\n const busy = getButtonsBusy(id);\n if (busy) {\n busy.style.display = 'inline-block';\n }\n}\n\nexport function clearButtonsBusy(id: string) {\n setTimeout(() => {\n const busy = getButtonsBusy(id);\n if (busy) busy.style.display = 'none';\n }, 200);\n}\n\nfunction buildCellUI(\n options: Options,\n item: CellDOMPlaceholder,\n notebook: ThebeNotebook,\n cell: IThebeCell,\n): CellDOMItem {\n console.debug(`thebe:buildCellUI CellId:${item.id}`);\n const box = document.createElement('div');\n box.classList.add('thebe-cell');\n box.setAttribute('data-thebe-id', item.id);\n\n console.debug(`thebe:buildCellUI building editor`);\n const editor = document.createElement('div');\n editor.classList.add('thebe-input');\n box.append(editor);\n\n console.debug(`thebe:buildCellUI setup CodeMirror`);\n setupCodemirror(options, item, cell, box, editor, setButtonsBusy, clearButtonsBusy);\n\n console.debug(`thebe:buildCellUI adding cell controls`);\n let run, runAll, restart, restartAll;\n\n const controls = document.createElement('div');\n controls.classList.add('thebe-controls');\n\n if (options.mountRunButton)\n run = buildButton(controls, 'run', 'run', 'run this cell', async () => {\n console.debug(`thebe:run:${cell.id} run`);\n setButtonsBusy(cell.id);\n await cell.execute(cell.source);\n clearButtonsBusy(cell.id);\n });\n\n if (options.mountRunAllButton) {\n runAll = buildButton(controls, 'runall', 'run all', 'run all cells', async () => {\n console.debug(`thebe:run:${cell.id} runall`);\n notebook.cells?.forEach(({ id }: { id: string }) => setButtonsBusy(id));\n // TODO notebook should return an array of promises, one for each cell\n // TODO return the cell id along with the each promise\n await notebook.executeAll();\n notebook.cells?.forEach(({ id }: { id: string }) => clearButtonsBusy(id));\n });\n }\n\n if (options.mountRestartButton) {\n restart = buildButton(controls, 'restart', 'restart', 'restart the kernel', async () => {\n console.debug(`thebe:run:${cell.id} restart`);\n await notebook.session?.kernel?.restart();\n });\n }\n\n if (options.mountRestartAllButton) {\n restartAll = buildButton(\n controls,\n 'restartall',\n 'restart & run all',\n 'restart the kernel and run all cells',\n async () => {\n console.debug(`thebe:run:${cell.id} runall`);\n notebook.cells?.forEach(({ id }) => setButtonsBusy(id));\n // TODO notebook should return an array of promises, one for each cell\n // TODO return the cell id along with the each promise\n await notebook.executeAll();\n notebook.cells?.forEach(({ id }) => clearButtonsBusy(id));\n },\n );\n }\n\n buildButtonBusySpinner(controls);\n box.append(controls);\n\n // no output placeholder for this cell, append a new element\n let output = item.placeholders.output;\n if (output) {\n console.debug(`thebe:buildCellUI using output placeholder`);\n } else {\n console.debug(`thebe:buildCellUI no output placeholder for this cell, append a new element`);\n output = document.createElement('div');\n output.classList.add('thebe-output');\n box.append(output);\n }\n\n // preserve id of original placeholder\n box.id = item.placeholders.source.id;\n item.placeholders.source.replaceWith(box);\n\n // this must happen after the box/host is attached\n cell.attachToDOM(output as HTMLElement);\n\n return {\n ...item,\n ui: {\n cell: box,\n editor,\n output,\n buttons: {\n run,\n runAll,\n restart,\n restartAll,\n },\n },\n };\n}\n\nexport function renderAllCells(\n options: Options,\n notebook: ThebeNotebook,\n placeholders: CellDOMPlaceholder[],\n) {\n return placeholders.map((p) => {\n const cell = notebook.getCellById(p.id);\n if (!cell) return p;\n return buildCellUI(options, p, notebook, cell);\n });\n}\n","import type { ThebeEventData } from 'thebe-core';\nimport { ErrorStatusEvent, EventSubject, ServerStatusEvent, SessionStatusEvent } from 'thebe-core';\n\n// Functions for the thebe activate button and status field\nexport class KernelStatus {\n stub: string;\n constructor() {\n this.stub = 'Status:';\n this._registerHandlers();\n }\n\n _registerHandlers() {\n window.thebe.on('status', (name: string, { subject, status, message }: ThebeEventData) => {\n if (\n subject !== EventSubject.server &&\n subject !== EventSubject.session &&\n subject !== EventSubject.kernel\n )\n return;\n const field = this._fieldElement();\n if (field) {\n switch (status) {\n case ServerStatusEvent.launching:\n field.className = `thebe-status-field thebe-status-${status}`;\n field.textContent = 'Launching...';\n break;\n case ErrorStatusEvent.error:\n field.className = `thebe-status-field thebe-status-${status}`;\n field.textContent = 'Failed to connect to server';\n break;\n case ServerStatusEvent.closed:\n field.className = `thebe-status-field thebe-status-${status}`;\n field.textContent = 'Server connection closed';\n break;\n case SessionStatusEvent.shutdown:\n field.className = `thebe-status-field thebe-status-${status}`;\n field.textContent = 'Session is dead';\n break;\n case SessionStatusEvent.starting:\n field.className = `thebe-status-field thebe-status-${status}`;\n field.textContent = 'Starting session';\n break;\n case SessionStatusEvent.ready:\n field.className = `thebe-status-field thebe-status-session-ready`;\n field.textContent = 'Kernel Connected';\n break;\n case ServerStatusEvent.ready:\n field.className = `thebe-status-field thebe-status-server-ready`;\n field.textContent = 'Conected to Server';\n break;\n }\n }\n\n const msg = this._messageElement();\n if (msg) msg.textContent = message;\n });\n }\n\n _messageElement() {\n const collection = document.getElementsByClassName('thebe-status-message');\n return collection.length ? collection.item(0) : undefined;\n }\n\n _fieldElement() {\n const collection = document.getElementsByClassName('thebe-status-field');\n return collection.length ? collection.item(0) : undefined;\n }\n\n /**\n * Mount the status field widget.\n *\n * Contents of the element with class `thebe-status-field` will be replaced with a status widget\n *\n * @returns true if an element with the expected class was found\n */\n mount() {\n const el = document.querySelector('.thebe-status');\n if (!el) {\n console.debug('KernelStatus mount requested but no .thebe-status element found on page');\n return;\n }\n\n const box = document.createElement('div');\n box.className = 'thebe-status thebe-status-mounted';\n box.setAttribute('title', this.stub);\n\n const stub = document.createElement('span');\n stub.classList.add('thebe-status-stub');\n stub.textContent = this.stub;\n box.appendChild(stub);\n\n const field = document.createElement('span');\n field.classList.add('thebe-status-field');\n field.textContent = 'No Kernel Attached';\n\n const message = document.createElement('div');\n message.classList.add('thebe-status-message');\n\n box.append(stub, field, message);\n\n el.replaceWith(box);\n\n return el !== undefined;\n }\n\n unmount() {\n const el = document.querySelector('.thebe-status');\n if (!el) return;\n let child = el.lastElementChild;\n while (child) {\n el.removeChild(child);\n child = el.lastElementChild;\n }\n return el;\n }\n}\n","import { defaultOutputSelector, defaultSelector, mergeOptions } from './options';\nimport { findCells, renderAllCells } from './render';\nimport { stripPrompts, stripOutputPrompts } from './utils';\nimport { KernelStatus } from './status';\nimport { ActivateWidget } from './activate';\n\n// Exposing @jupyter-widgets/base and @jupyter-widgets/controls as amd\n// modules for custom widget bundles that depend on it.\n\nimport * as base from '@jupyter-widgets/base';\nimport * as controls from '@jupyter-widgets/controls';\nimport { output } from '@jupyter-widgets/jupyterlab-manager';\nimport type { Options } from './options';\nimport {\n makeConfiguration,\n makeRenderMimeRegistry,\n setupNotebookFromBlocks,\n ThebeServer,\n} from 'thebe-core';\nimport type { CellDOMPlaceholder } from './types';\n\nif (typeof window !== 'undefined' && typeof window.define !== 'undefined') {\n window.define('@jupyter-widgets/base', base);\n window.define('@jupyter-widgets/controls', controls);\n window.define('@jupyter-widgets/output', output);\n}\n\nexport * from './render';\nexport {\n Options,\n mergeOptions,\n getPageConfig,\n getPageConfigValue,\n ensurePageConfigLoaded,\n} from './options';\nexport * from './utils';\n\nexport function mountStatusWidget() {\n window.thebe.kernelStatus = new KernelStatus();\n window.thebe.kernelStatus.mount();\n}\n\nexport function mountActivateWidget(options: Options = {}) {\n window.thebe.activateButton = new ActivateWidget(options);\n window.thebe.activateButton.mount();\n}\n\n/**\n * Bootstrap the library based on the configuration given.\n *\n * If bootstrap === true in the configuration and the library is loaded statically\n * then this function will be called automatically on the document load event.\n *\n * @param {Object} options Object containing thebe options.\n * Same structure as x-thebe-options.\n * @returns {Promise} Promise for connected Kernel object\n */\nexport async function bootstrap(opts: Partial = {}) {\n // bootstrap thebe on the page\n // merge defaults, pageConfig, etc.\n const options = mergeOptions({ useBinder: true, requestKernel: true, ...opts });\n\n if (options.preRenderHook) options.preRenderHook();\n if (options.stripPrompts) stripPrompts(options);\n if (options.stripOutputPrompts) stripOutputPrompts(options);\n\n const { selector, outputSelector } = options;\n const items: CellDOMPlaceholder[] = findCells(\n selector ?? defaultSelector,\n outputSelector ?? defaultOutputSelector,\n );\n\n const codeWithIds = items.map(({ id, placeholders: { source: el } }) => {\n return { id, source: el.textContent?.trim() ?? '' };\n });\n\n const config = makeConfiguration(options, window.thebe.events);\n const rendermime = makeRenderMimeRegistry(config.mathjax);\n\n const notebook = setupNotebookFromBlocks(codeWithIds, config, rendermime);\n window.thebe.notebook = notebook;\n\n renderAllCells(options, notebook, items);\n\n // starting to talk to binder / server is deferred until here so that any page\n // errors cause failure first\n\n const server = new ThebeServer(config);\n\n // connect to a resource\n if (options.useBinder) {\n console.debug(`thebe:api:connect useBinder`, config.base, config.binder);\n server.connectToServerViaBinder();\n } else if (options.useJupyterLite) {\n console.debug(`thebe:api:connect JupyterLite`, config.base);\n server.connectToJupyterLiteServer();\n } else {\n server.connectToJupyterServer();\n }\n\n window.thebe.server = server;\n\n if (!opts.requestKernel) {\n return { server, notebook };\n }\n\n await server.ready;\n\n const session = await server.startNewSession(rendermime);\n if (session != null) notebook.attachSession(session);\n\n window.thebe.session = session ?? undefined;\n\n return {\n server,\n session,\n notebook,\n };\n}\n","import type { Options } from './options';\nimport { defaultSelector } from './options';\n\nexport function stripPrompts({ selector, stripPrompts: prompts }: Options) {\n // strip prompts from a cell\n document.querySelectorAll(selector ?? defaultSelector).forEach((el) => {\n splitCell(el, prompts);\n });\n}\n\nexport function stripOutputPrompts({ selector, stripOutputPrompts: prompts }: Options) {\n // strip output prompts from a cell\n document.querySelectorAll(selector ?? defaultSelector).forEach((el) => {\n splitCellOutputPrompt(el, prompts);\n });\n}\n\nfunction appendNewCell(el: Element, text: string) {\n const pre = document.createElement('pre');\n pre.setAttribute('data-executable', 'data-executable');\n pre.textContent = text;\n el.appendChild(pre);\n}\n\nfunction splitCell(\n el: Element,\n {\n inPrompt,\n continuationPrompt,\n }: {\n inPrompt?: string;\n continuationPrompt?: string;\n } = {},\n) {\n const rawText = el.textContent?.trim() ?? '';\n if (!inPrompt || rawText.indexOf(inPrompt) == -1) {\n return el;\n }\n const listOfCellContents: string[] = [];\n let cellContents: string | null = null;\n rawText.split('\\n').map((line) => {\n line = line.trim();\n if (line.slice(0, inPrompt.length) === inPrompt) {\n // line with a prompt\n line = line.slice(inPrompt.length) + '\\n';\n if (cellContents) {\n cellContents += line;\n } else {\n cellContents = line;\n }\n } else if (\n continuationPrompt &&\n line.slice(0, continuationPrompt.length) === continuationPrompt\n ) {\n // line with a continuation prompt\n cellContents += line.slice(continuationPrompt.length) + '\\n';\n } else {\n // output line\n if (cellContents) {\n listOfCellContents.push(cellContents);\n cellContents = null;\n }\n }\n });\n if (cellContents) {\n listOfCellContents.push(cellContents);\n }\n // clear the parent element\n el.innerHTML = '';\n // add the thebe-able cells\n listOfCellContents.forEach((cell) => appendNewCell(el, cell));\n}\n\nfunction splitCellOutputPrompt(el: Element, { outPrompt }: { outPrompt?: string } = {}) {\n const rawText = el.textContent?.trim() ?? '';\n if (!outPrompt || rawText.indexOf(outPrompt) == -1) {\n return el;\n }\n const listOfCellContents: string[] = [];\n let cellContents: string | null = null;\n rawText.split('\\n').map((line) => {\n line = line.trim();\n if (line.slice(0, outPrompt.length) === outPrompt) {\n // output line\n if (cellContents) {\n listOfCellContents.push(cellContents);\n cellContents = null;\n }\n } else {\n // input line\n if (cellContents) {\n cellContents += line + '\\n';\n } else {\n cellContents = line + '\\n';\n }\n }\n });\n if (cellContents) {\n listOfCellContents.push(cellContents);\n }\n // clear the parent element\n el.innerHTML = '';\n // add the thebe-able cells\n listOfCellContents.forEach((cell) => appendNewCell(el, cell));\n}\n\nexport function randomId() {\n const uint32 = window.crypto.getRandomValues(new Uint32Array(1))[0];\n return 'id-' + uint32.toString(8);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","'use strict';\n\nvar required = require('requires-port')\n , qs = require('querystringify')\n , controlOrWhitespace = /^[\\x00-\\x20\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+/\n , CRHTLF = /[\\n\\r\\t]/g\n , slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\\/\\//\n , port = /:\\d+$/\n , protocolre = /^([a-z][a-z0-9.+-]*:)?(\\/\\/)?([\\\\/]+)?([\\S\\s]*)/i\n , windowsDriveLetter = /^[a-zA-Z]:/;\n\n/**\n * Remove control characters and whitespace from the beginning of a string.\n *\n * @param {Object|String} str String to trim.\n * @returns {String} A new string representing `str` stripped of control\n * characters and whitespace from its beginning.\n * @public\n */\nfunction trimLeft(str) {\n return (str ? str : '').toString().replace(controlOrWhitespace, '');\n}\n\n/**\n * These are the parse rules for the URL parser, it informs the parser\n * about:\n *\n * 0. The char it Needs to parse, if it's a string it should be done using\n * indexOf, RegExp using exec and NaN means set as current value.\n * 1. The property we should set when parsing this value.\n * 2. Indication if it's backwards or forward parsing, when set as number it's\n * the value of extra chars that should be split off.\n * 3. Inherit from location if non existing in the parser.\n * 4. `toLowerCase` the resulting value.\n */\nvar rules = [\n ['#', 'hash'], // Extract from the back.\n ['?', 'query'], // Extract from the back.\n function sanitize(address, url) { // Sanitize what is left of the address\n return isSpecial(url.protocol) ? address.replace(/\\\\/g, '/') : address;\n },\n ['/', 'pathname'], // Extract from the back.\n ['@', 'auth', 1], // Extract from the front.\n [NaN, 'host', undefined, 1, 1], // Set left over value.\n [/:(\\d*)$/, 'port', undefined, 1], // RegExp the back.\n [NaN, 'hostname', undefined, 1, 1] // Set left over.\n];\n\n/**\n * These properties should not be copied or inherited from. This is only needed\n * for all non blob URL's as a blob URL does not include a hash, only the\n * origin.\n *\n * @type {Object}\n * @private\n */\nvar ignore = { hash: 1, query: 1 };\n\n/**\n * The location object differs when your code is loaded through a normal page,\n * Worker or through a worker using a blob. And with the blobble begins the\n * trouble as the location object will contain the URL of the blob, not the\n * location of the page where our code is loaded in. The actual origin is\n * encoded in the `pathname` so we can thankfully generate a good \"default\"\n * location from it so we can generate proper relative URL's again.\n *\n * @param {Object|String} loc Optional default location object.\n * @returns {Object} lolcation object.\n * @public\n */\nfunction lolcation(loc) {\n var globalVar;\n\n if (typeof window !== 'undefined') globalVar = window;\n else if (typeof global !== 'undefined') globalVar = global;\n else if (typeof self !== 'undefined') globalVar = self;\n else globalVar = {};\n\n var location = globalVar.location || {};\n loc = loc || location;\n\n var finaldestination = {}\n , type = typeof loc\n , key;\n\n if ('blob:' === loc.protocol) {\n finaldestination = new Url(unescape(loc.pathname), {});\n } else if ('string' === type) {\n finaldestination = new Url(loc, {});\n for (key in ignore) delete finaldestination[key];\n } else if ('object' === type) {\n for (key in loc) {\n if (key in ignore) continue;\n finaldestination[key] = loc[key];\n }\n\n if (finaldestination.slashes === undefined) {\n finaldestination.slashes = slashes.test(loc.href);\n }\n }\n\n return finaldestination;\n}\n\n/**\n * Check whether a protocol scheme is special.\n *\n * @param {String} The protocol scheme of the URL\n * @return {Boolean} `true` if the protocol scheme is special, else `false`\n * @private\n */\nfunction isSpecial(scheme) {\n return (\n scheme === 'file:' ||\n scheme === 'ftp:' ||\n scheme === 'http:' ||\n scheme === 'https:' ||\n scheme === 'ws:' ||\n scheme === 'wss:'\n );\n}\n\n/**\n * @typedef ProtocolExtract\n * @type Object\n * @property {String} protocol Protocol matched in the URL, in lowercase.\n * @property {Boolean} slashes `true` if protocol is followed by \"//\", else `false`.\n * @property {String} rest Rest of the URL that is not part of the protocol.\n */\n\n/**\n * Extract protocol information from a URL with/without double slash (\"//\").\n *\n * @param {String} address URL we want to extract from.\n * @param {Object} location\n * @return {ProtocolExtract} Extracted information.\n * @private\n */\nfunction extractProtocol(address, location) {\n address = trimLeft(address);\n address = address.replace(CRHTLF, '');\n location = location || {};\n\n var match = protocolre.exec(address);\n var protocol = match[1] ? match[1].toLowerCase() : '';\n var forwardSlashes = !!match[2];\n var otherSlashes = !!match[3];\n var slashesCount = 0;\n var rest;\n\n if (forwardSlashes) {\n if (otherSlashes) {\n rest = match[2] + match[3] + match[4];\n slashesCount = match[2].length + match[3].length;\n } else {\n rest = match[2] + match[4];\n slashesCount = match[2].length;\n }\n } else {\n if (otherSlashes) {\n rest = match[3] + match[4];\n slashesCount = match[3].length;\n } else {\n rest = match[4]\n }\n }\n\n if (protocol === 'file:') {\n if (slashesCount >= 2) {\n rest = rest.slice(2);\n }\n } else if (isSpecial(protocol)) {\n rest = match[4];\n } else if (protocol) {\n if (forwardSlashes) {\n rest = rest.slice(2);\n }\n } else if (slashesCount >= 2 && isSpecial(location.protocol)) {\n rest = match[4];\n }\n\n return {\n protocol: protocol,\n slashes: forwardSlashes || isSpecial(protocol),\n slashesCount: slashesCount,\n rest: rest\n };\n}\n\n/**\n * Resolve a relative URL pathname against a base URL pathname.\n *\n * @param {String} relative Pathname of the relative URL.\n * @param {String} base Pathname of the base URL.\n * @return {String} Resolved pathname.\n * @private\n */\nfunction resolve(relative, base) {\n if (relative === '') return base;\n\n var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/'))\n , i = path.length\n , last = path[i - 1]\n , unshift = false\n , up = 0;\n\n while (i--) {\n if (path[i] === '.') {\n path.splice(i, 1);\n } else if (path[i] === '..') {\n path.splice(i, 1);\n up++;\n } else if (up) {\n if (i === 0) unshift = true;\n path.splice(i, 1);\n up--;\n }\n }\n\n if (unshift) path.unshift('');\n if (last === '.' || last === '..') path.push('');\n\n return path.join('/');\n}\n\n/**\n * The actual URL instance. Instead of returning an object we've opted-in to\n * create an actual constructor as it's much more memory efficient and\n * faster and it pleases my OCD.\n *\n * It is worth noting that we should not use `URL` as class name to prevent\n * clashes with the global URL instance that got introduced in browsers.\n *\n * @constructor\n * @param {String} address URL we want to parse.\n * @param {Object|String} [location] Location defaults for relative paths.\n * @param {Boolean|Function} [parser] Parser for the query string.\n * @private\n */\nfunction Url(address, location, parser) {\n address = trimLeft(address);\n address = address.replace(CRHTLF, '');\n\n if (!(this instanceof Url)) {\n return new Url(address, location, parser);\n }\n\n var relative, extracted, parse, instruction, index, key\n , instructions = rules.slice()\n , type = typeof location\n , url = this\n , i = 0;\n\n //\n // The following if statements allows this module two have compatibility with\n // 2 different API:\n //\n // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments\n // where the boolean indicates that the query string should also be parsed.\n //\n // 2. The `URL` interface of the browser which accepts a URL, object as\n // arguments. The supplied object will be used as default values / fall-back\n // for relative paths.\n //\n if ('object' !== type && 'string' !== type) {\n parser = location;\n location = null;\n }\n\n if (parser && 'function' !== typeof parser) parser = qs.parse;\n\n location = lolcation(location);\n\n //\n // Extract protocol information before running the instructions.\n //\n extracted = extractProtocol(address || '', location);\n relative = !extracted.protocol && !extracted.slashes;\n url.slashes = extracted.slashes || relative && location.slashes;\n url.protocol = extracted.protocol || location.protocol || '';\n address = extracted.rest;\n\n //\n // When the authority component is absent the URL starts with a path\n // component.\n //\n if (\n extracted.protocol === 'file:' && (\n extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) ||\n (!extracted.slashes &&\n (extracted.protocol ||\n extracted.slashesCount < 2 ||\n !isSpecial(url.protocol)))\n ) {\n instructions[3] = [/(.*)/, 'pathname'];\n }\n\n for (; i < instructions.length; i++) {\n instruction = instructions[i];\n\n if (typeof instruction === 'function') {\n address = instruction(address, url);\n continue;\n }\n\n parse = instruction[0];\n key = instruction[1];\n\n if (parse !== parse) {\n url[key] = address;\n } else if ('string' === typeof parse) {\n index = parse === '@'\n ? address.lastIndexOf(parse)\n : address.indexOf(parse);\n\n if (~index) {\n if ('number' === typeof instruction[2]) {\n url[key] = address.slice(0, index);\n address = address.slice(index + instruction[2]);\n } else {\n url[key] = address.slice(index);\n address = address.slice(0, index);\n }\n }\n } else if ((index = parse.exec(address))) {\n url[key] = index[1];\n address = address.slice(0, index.index);\n }\n\n url[key] = url[key] || (\n relative && instruction[3] ? location[key] || '' : ''\n );\n\n //\n // Hostname, host and protocol should be lowercased so they can be used to\n // create a proper `origin`.\n //\n if (instruction[4]) url[key] = url[key].toLowerCase();\n }\n\n //\n // Also parse the supplied query string in to an object. If we're supplied\n // with a custom parser as function use that instead of the default build-in\n // parser.\n //\n if (parser) url.query = parser(url.query);\n\n //\n // If the URL is relative, resolve the pathname against the base URL.\n //\n if (\n relative\n && location.slashes\n && url.pathname.charAt(0) !== '/'\n && (url.pathname !== '' || location.pathname !== '')\n ) {\n url.pathname = resolve(url.pathname, location.pathname);\n }\n\n //\n // Default to a / for pathname if none exists. This normalizes the URL\n // to always have a /\n //\n if (url.pathname.charAt(0) !== '/' && isSpecial(url.protocol)) {\n url.pathname = '/' + url.pathname;\n }\n\n //\n // We should not add port numbers if they are already the default port number\n // for a given protocol. As the host also contains the port number we're going\n // override it with the hostname which contains no port number.\n //\n if (!required(url.port, url.protocol)) {\n url.host = url.hostname;\n url.port = '';\n }\n\n //\n // Parse down the `auth` for the username and password.\n //\n url.username = url.password = '';\n\n if (url.auth) {\n index = url.auth.indexOf(':');\n\n if (~index) {\n url.username = url.auth.slice(0, index);\n url.username = encodeURIComponent(decodeURIComponent(url.username));\n\n url.password = url.auth.slice(index + 1);\n url.password = encodeURIComponent(decodeURIComponent(url.password))\n } else {\n url.username = encodeURIComponent(decodeURIComponent(url.auth));\n }\n\n url.auth = url.password ? url.username +':'+ url.password : url.username;\n }\n\n url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host\n ? url.protocol +'//'+ url.host\n : 'null';\n\n //\n // The href is just the compiled result.\n //\n url.href = url.toString();\n}\n\n/**\n * This is convenience method for changing properties in the URL instance to\n * insure that they all propagate correctly.\n *\n * @param {String} part Property we need to adjust.\n * @param {Mixed} value The newly assigned value.\n * @param {Boolean|Function} fn When setting the query, it will be the function\n * used to parse the query.\n * When setting the protocol, double slash will be\n * removed from the final url if it is true.\n * @returns {URL} URL instance for chaining.\n * @public\n */\nfunction set(part, value, fn) {\n var url = this;\n\n switch (part) {\n case 'query':\n if ('string' === typeof value && value.length) {\n value = (fn || qs.parse)(value);\n }\n\n url[part] = value;\n break;\n\n case 'port':\n url[part] = value;\n\n if (!required(value, url.protocol)) {\n url.host = url.hostname;\n url[part] = '';\n } else if (value) {\n url.host = url.hostname +':'+ value;\n }\n\n break;\n\n case 'hostname':\n url[part] = value;\n\n if (url.port) value += ':'+ url.port;\n url.host = value;\n break;\n\n case 'host':\n url[part] = value;\n\n if (port.test(value)) {\n value = value.split(':');\n url.port = value.pop();\n url.hostname = value.join(':');\n } else {\n url.hostname = value;\n url.port = '';\n }\n\n break;\n\n case 'protocol':\n url.protocol = value.toLowerCase();\n url.slashes = !fn;\n break;\n\n case 'pathname':\n case 'hash':\n if (value) {\n var char = part === 'pathname' ? '/' : '#';\n url[part] = value.charAt(0) !== char ? char + value : value;\n } else {\n url[part] = value;\n }\n break;\n\n case 'username':\n case 'password':\n url[part] = encodeURIComponent(value);\n break;\n\n case 'auth':\n var index = value.indexOf(':');\n\n if (~index) {\n url.username = value.slice(0, index);\n url.username = encodeURIComponent(decodeURIComponent(url.username));\n\n url.password = value.slice(index + 1);\n url.password = encodeURIComponent(decodeURIComponent(url.password));\n } else {\n url.username = encodeURIComponent(decodeURIComponent(value));\n }\n }\n\n for (var i = 0; i < rules.length; i++) {\n var ins = rules[i];\n\n if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase();\n }\n\n url.auth = url.password ? url.username +':'+ url.password : url.username;\n\n url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host\n ? url.protocol +'//'+ url.host\n : 'null';\n\n url.href = url.toString();\n\n return url;\n}\n\n/**\n * Transform the properties back in to a valid and full URL string.\n *\n * @param {Function} stringify Optional query stringify function.\n * @returns {String} Compiled version of the URL.\n * @public\n */\nfunction toString(stringify) {\n if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;\n\n var query\n , url = this\n , host = url.host\n , protocol = url.protocol;\n\n if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';\n\n var result =\n protocol +\n ((url.protocol && url.slashes) || isSpecial(url.protocol) ? '//' : '');\n\n if (url.username) {\n result += url.username;\n if (url.password) result += ':'+ url.password;\n result += '@';\n } else if (url.password) {\n result += ':'+ url.password;\n result += '@';\n } else if (\n url.protocol !== 'file:' &&\n isSpecial(url.protocol) &&\n !host &&\n url.pathname !== '/'\n ) {\n //\n // Add back the empty userinfo, otherwise the original invalid URL\n // might be transformed into a valid one with `url.pathname` as host.\n //\n result += '@';\n }\n\n //\n // Trailing colon is removed from `url.host` when it is parsed. If it still\n // ends with a colon, then add back the trailing colon that was removed. This\n // prevents an invalid URL from being transformed into a valid one.\n //\n if (host[host.length - 1] === ':' || (port.test(url.hostname) && !url.port)) {\n host += ':';\n }\n\n result += host + url.pathname;\n\n query = 'object' === typeof url.query ? stringify(url.query) : url.query;\n if (query) result += '?' !== query.charAt(0) ? '?'+ query : query;\n\n if (url.hash) result += url.hash;\n\n return result;\n}\n\nUrl.prototype = { set: set, toString: toString };\n\n//\n// Expose the URL parser and some additional properties that might be useful for\n// others or testing.\n//\nUrl.extractProtocol = extractProtocol;\nUrl.location = lolcation;\nUrl.trimLeft = trimLeft;\nUrl.qs = qs;\n\nmodule.exports = Url;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { UUID, JSONExt } from '@lumino/coreutils';\nimport _isEqual from 'lodash/isEqual';\n/**\n * Find all strings in the first argument that are not in the second.\n */\nexport function difference(a, b) {\n return a.filter((v) => b.indexOf(v) === -1);\n}\n/**\n * Compare two objects deeply to see if they are equal.\n */\nexport function isEqual(a, b) {\n return _isEqual(a, b);\n}\n/**\n * A polyfill for Object.assign\n *\n * This is from code that Typescript 2.4 generates for a polyfill.\n */\nexport const assign = Object.assign ||\n function (t, ...args) {\n for (let i = 1; i < args.length; i++) {\n const s = args[i];\n for (const p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) {\n t[p] = s[p];\n }\n }\n }\n return t;\n };\n/**\n * Generate a UUID\n *\n * http://www.ietf.org/rfc/rfc4122.txt\n */\nexport function uuid() {\n return UUID.uuid4();\n}\n/**\n * Resolve a promiseful dictionary.\n * Returns a single Promise.\n */\nexport function resolvePromisesDict(d) {\n const keys = Object.keys(d);\n const values = [];\n keys.forEach(function (key) {\n values.push(d[key]);\n });\n return Promise.all(values).then((v) => {\n const d = {};\n for (let i = 0; i < keys.length; i++) {\n d[keys[i]] = v[i];\n }\n return d;\n });\n}\n/**\n * Creates a wrappable Promise rejection function.\n *\n * Creates a function that logs an error message before rethrowing\n * the original error that caused the promise to reject.\n */\nexport function reject(message, log) {\n return function promiseRejection(error) {\n if (log) {\n console.error(new Error(message));\n }\n throw error;\n };\n}\n/**\n * Takes an object 'state' and fills in buffer[i] at 'path' buffer_paths[i]\n * where buffer_paths[i] is a list indicating where in the object buffer[i] should\n * be placed\n * Example: state = {a: 1, b: {}, c: [0, null]}\n * buffers = [array1, array2]\n * buffer_paths = [['b', 'data'], ['c', 1]]\n * Will lead to {a: 1, b: {data: array1}, c: [0, array2]}\n */\nexport function put_buffers(state, buffer_paths, buffers) {\n for (let i = 0; i < buffer_paths.length; i++) {\n const buffer_path = buffer_paths[i];\n // make sure the buffers are DataViews\n let buffer = buffers[i];\n if (!(buffer instanceof DataView)) {\n buffer = new DataView(buffer instanceof ArrayBuffer ? buffer : buffer.buffer);\n }\n // say we want to set state[x][y][z] = buffer\n let obj = state;\n // we first get obj = state[x][y]\n for (let j = 0; j < buffer_path.length - 1; j++) {\n obj = obj[buffer_path[j]];\n }\n // and then set: obj[z] = buffer\n obj[buffer_path[buffer_path.length - 1]] = buffer;\n }\n}\nexport function isSerializable(object) {\n var _a;\n return (_a = (typeof object === 'object' && object && 'toJSON' in object)) !== null && _a !== void 0 ? _a : false;\n}\nexport function isObject(data) {\n return JSONExt.isObject(data);\n}\n/**\n * The inverse of put_buffers, return an objects with the new state where all buffers(ArrayBuffer)\n * are removed. If a buffer is a member of an object, that object is cloned, and the key removed. If a buffer\n * is an element of an array, that array is cloned, and the element is set to null.\n * See put_buffers for the meaning of buffer_paths\n * Returns an object with the new state (.state) an array with paths to the buffers (.buffer_paths),\n * and the buffers associated to those paths (.buffers).\n */\nexport function remove_buffers(state) {\n const buffers = [];\n const buffer_paths = [];\n // if we need to remove an object from a list, we need to clone that list, otherwise we may modify\n // the internal state of the widget model\n // however, we do not want to clone everything, for performance\n function remove(obj, path) {\n if (isSerializable(obj)) {\n // We need to get the JSON form of the object before recursing.\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON()_behavior\n obj = obj.toJSON();\n }\n if (Array.isArray(obj)) {\n let is_cloned = false;\n for (let i = 0; i < obj.length; i++) {\n const value = obj[i];\n if (value) {\n if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) {\n if (!is_cloned) {\n obj = obj.slice();\n is_cloned = true;\n }\n buffers.push(ArrayBuffer.isView(value) ? value.buffer : value);\n buffer_paths.push(path.concat([i]));\n // easier to just keep the array, but clear the entry, otherwise we have to think\n // about array length, much easier this way\n obj[i] = null;\n }\n else {\n const new_value = remove(value, path.concat([i]));\n // only assigned when the value changes, we may serialize objects that don't support assignment\n if (new_value !== value) {\n if (!is_cloned) {\n obj = obj.slice();\n is_cloned = true;\n }\n obj[i] = new_value;\n }\n }\n }\n }\n }\n else if (isObject(obj)) {\n for (const key in obj) {\n let is_cloned = false;\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const value = obj[key];\n if (value) {\n if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) {\n if (!is_cloned) {\n obj = Object.assign({}, obj);\n is_cloned = true;\n }\n buffers.push(ArrayBuffer.isView(value) ? value.buffer : value);\n buffer_paths.push(path.concat([key]));\n delete obj[key]; // for objects/dicts we just delete them\n }\n else {\n const new_value = remove(value, path.concat([key]));\n // only assigned when the value changes, we may serialize objects that don't support assignment\n if (new_value !== value) {\n if (!is_cloned) {\n obj = Object.assign({}, obj);\n is_cloned = true;\n }\n obj[key] = new_value;\n }\n }\n }\n }\n }\n }\n return obj;\n }\n const new_state = remove(state, []);\n return { state: new_state, buffers: buffers, buffer_paths: buffer_paths };\n}\nexport const BROKEN_FILE_SVG_ICON = `\n\n \n \n \n \n \n\n`;\n//# sourceMappingURL=utils.js.map","// This file contains a modified version of the set function from the Backbone\n// (see\n// https://github.com/jashkenas/backbone/blob/05fde9e201f7e2137796663081105cd6dad12a98/backbone.js#L460,\n// with changes below marked with an EDIT comment). This file in Backbone has the following license.\n// (c) 2010-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n// Backbone may be freely distributed under the MIT license.\n// For all details and documentation:\n// http://backbonejs.org\n// Backbone's full license is below (from https://github.com/jashkenas/backbone/blob/05fde9e201f7e2137796663081105cd6dad12a98/LICENSE)\n/*\nCopyright (c) 2010-2015 Jeremy Ashkenas, DocumentCloud\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n*/\nimport * as utils from './utils';\nimport { JSONExt } from '@lumino/coreutils';\n// Set a hash of model attributes on the object, firing `\"change\"`. This is\n// the core primitive operation of a model, updating the data and notifying\n// anyone who needs to know about the change in state. The heart of the beast.\n// This *MUST* be called with the model as the `this` context.\nexport function set(key, val, options) {\n if (key == null) {\n return this;\n }\n // Handle both `\"key\", value` and `{key: value}` -style arguments.\n let attrs;\n if (JSONExt.isObject(key)) {\n attrs = key;\n options = val;\n }\n else {\n (attrs = {})[key] = val;\n }\n options || (options = {});\n // Run validation.\n if (!this._validate(attrs, options)) {\n return false;\n }\n // Extract attributes and options.\n const unset = options.unset;\n const silent = options.silent;\n const changes = [];\n const changing = this._changing;\n this._changing = true;\n try {\n if (!changing) {\n // EDIT: changed to use object spread instead of _.clone\n this._previousAttributes = Object.assign({}, this.attributes);\n this.changed = {};\n }\n const current = this.attributes;\n const changed = this.changed;\n const prev = this._previousAttributes;\n // For each `set` attribute, update or delete the current value.\n for (const attr in attrs) {\n val = attrs[attr];\n // EDIT: the following two lines use our isEqual instead of _.isEqual\n if (!utils.isEqual(current[attr], val)) {\n changes.push(attr);\n }\n if (!utils.isEqual(prev[attr], val)) {\n changed[attr] = val;\n }\n else {\n delete changed[attr];\n }\n unset ? delete current[attr] : (current[attr] = val);\n }\n // Update the `id`.\n this.id = this.get(this.idAttribute);\n // Trigger all relevant attribute changes.\n if (!silent) {\n if (changes.length) {\n this._pending = options;\n }\n for (let i = 0; i < changes.length; i++) {\n this.trigger('change:' + changes[i], this, current[changes[i]], options);\n }\n }\n // You might be wondering why there's a `while` loop here. Changes can\n // be recursively nested within `\"change\"` events.\n if (changing) {\n return this;\n }\n if (!silent) {\n while (this._pending) {\n options = this._pending;\n this._pending = false;\n this.trigger('change', this, options);\n }\n }\n }\n finally {\n this._pending = false;\n this._changing = false;\n }\n return this;\n}\n//# sourceMappingURL=backbone-patch.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*\n This file contains substantial portions of https://github.com/akre54/Backbone.NativeView/blob/521188d9554b53d95d70ed34f878d8ac9fc10df2/backbone.nativeview.js, which has the following license:\n\n(c) 2015 Adam Krebs, Jimmy Yuen Ho Wong\nBackbone.NativeView may be freely distributed under the MIT license.\n\nCopyright (c) 2014 Adam Krebs\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\n*/\nimport * as Backbone from 'backbone';\n// Caches a local reference to `Element.prototype` for faster access.\nconst ElementProto = typeof Element !== 'undefined' ? Element.prototype : undefined;\n// Find the right `Element#matches` for IE>=9 and modern browsers.\nfunction matchesFallback(selector) {\n const matches = (this.document || this.ownerDocument).querySelectorAll(selector);\n let i = matches.length;\n while (--i >= 0 && matches.item(i) !== this) {\n continue;\n }\n return i > -1;\n}\nconst matchesSelector = ElementProto\n ? ElementProto.matches ||\n ElementProto['webkitMatchesSelector'] ||\n ElementProto['mozMatchesSelector'] ||\n ElementProto['msMatchesSelector'] ||\n ElementProto['oMatchesSelector'] ||\n matchesFallback\n : matchesFallback;\nexport class NativeView extends Backbone.View {\n _removeElement() {\n this.undelegateEvents();\n if (this.el.parentNode) {\n this.el.parentNode.removeChild(this.el);\n }\n }\n // Apply the `element` to the view.\n _setElement(element) {\n this.el = element;\n }\n // Set a hash of attributes to the view's `el`. We use the \"prop\" version\n // if available, falling back to `setAttribute` for the catch-all.\n _setAttributes(attrs) {\n for (const attr in attrs) {\n attr in this.el\n ? (this.el[attr] = attrs[attr])\n : this.el.setAttribute(attr, attrs[attr]);\n }\n }\n delegate(eventName, selector, listener) {\n if (typeof selector !== 'string') {\n listener = selector;\n selector = null;\n }\n // We have to initialize this here, instead of in the constructor, because the\n // super constructor eventually calls this method before we get a chance to initialize\n // this._domEvents to an empty list.\n if (this._domEvents === void 0) {\n this._domEvents = [];\n }\n const root = this.el;\n const handler = selector\n ? function (e) {\n let node = e.target || e.srcElement;\n for (; node && node !== root; node = node.parentNode) {\n if (matchesSelector.call(node, selector)) {\n e.delegateTarget = node;\n if (listener.handleEvent) {\n return listener.handleEvent(e);\n }\n else {\n return listener(e);\n }\n }\n }\n }\n : listener;\n this.el.addEventListener(eventName, handler, false);\n this._domEvents.push({ eventName, handler, listener, selector });\n return handler;\n }\n undelegate(eventName, selector, listener) {\n if (typeof selector === 'function') {\n listener = selector;\n selector = null;\n }\n if (this.el && this._domEvents) {\n const handlers = this._domEvents.slice();\n let i = handlers.length;\n while (i--) {\n const item = handlers[i];\n const match = item.eventName === eventName &&\n (listener ? item.listener === listener : true) &&\n (selector ? item.selector === selector : true);\n if (!match) {\n continue;\n }\n this.el.removeEventListener(item.eventName, item.handler, false);\n this._domEvents.splice(i, 1);\n }\n }\n return this;\n }\n // Remove all events created with `delegate` from `el`\n undelegateEvents() {\n if (this.el && this._domEvents) {\n const len = this._domEvents.length;\n for (let i = 0; i < len; i++) {\n const item = this._domEvents[i];\n this.el.removeEventListener(item.eventName, item.handler, false);\n }\n this._domEvents.length = 0;\n }\n return this;\n }\n}\n//# sourceMappingURL=nativeview.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nexport const JUPYTER_WIDGETS_VERSION = '2.0.0';\nexport const PROTOCOL_VERSION = '2.1.0';\n//# sourceMappingURL=version.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport * as utils from './utils';\nimport * as backbonePatch from './backbone-patch';\nimport * as Backbone from 'backbone';\nimport $ from 'jquery';\nimport { NativeView } from './nativeview';\nimport { JSONExt } from '@lumino/coreutils';\nimport { MessageLoop } from '@lumino/messaging';\nimport { Widget, Panel } from '@lumino/widgets';\nimport { JUPYTER_WIDGETS_VERSION } from './version';\n/**\n * The magic key used in the widget graph serialization.\n */\nconst IPY_MODEL_ = 'IPY_MODEL_';\n/**\n * Replace model ids with models recursively.\n */\nexport function unpack_models(value, manager // actually required, but typed to be compatible with ISerializers\n) {\n if (Array.isArray(value)) {\n const unpacked = [];\n for (const sub_value of value) {\n unpacked.push(unpack_models(sub_value, manager));\n }\n return Promise.all(unpacked);\n }\n else if (value instanceof Object && typeof value !== 'string') {\n const unpacked = {};\n for (const [key, sub_value] of Object.entries(value)) {\n unpacked[key] = unpack_models(sub_value, manager);\n }\n return utils.resolvePromisesDict(unpacked);\n }\n else if (typeof value === 'string' && value.slice(0, 10) === IPY_MODEL_) {\n // get_model returns a promise already\n return manager.get_model(value.slice(10, value.length));\n }\n else {\n return Promise.resolve(value);\n }\n}\n/** Replace models with ids recursively.\n *\n * If the commonly-used `unpack_models` is given as the `deseralize` method,\n * pack_models would be the appropriate `serialize`.\n * However, the default serialize method will have the same effect, when\n * `unpack_models` is used as the deserialize method.\n * This is to ensure backwards compatibility, see:\n * https://github.com/jupyter-widgets/ipywidgets/pull/3738/commits/f9e27328bb631eb5247a7a6563595d3e655492c7#diff-efb19099381ae8911dd7f69b015a0138d08da7164512c1ee112aa75100bc9be2\n */\nexport function pack_models(value, widget) {\n if (Array.isArray(value)) {\n const model_ids = [];\n for (const model of value) {\n model_ids.push(pack_models(model, widget));\n }\n return model_ids;\n }\n else if (value instanceof WidgetModel) {\n return `${IPY_MODEL_}${value.model_id}`;\n }\n else if (value instanceof Object && typeof value !== 'string') {\n const packed = {};\n for (const [key, sub_value] of Object.entries(value)) {\n packed[key] = pack_models(sub_value, widget);\n }\n }\n else {\n return value;\n }\n}\nexport class WidgetModel extends Backbone.Model {\n /**\n * The default attributes.\n */\n defaults() {\n return {\n _model_module: '@jupyter-widgets/base',\n _model_name: 'WidgetModel',\n _model_module_version: JUPYTER_WIDGETS_VERSION,\n _view_module: '@jupyter-widgets/base',\n _view_name: null,\n _view_module_version: JUPYTER_WIDGETS_VERSION,\n _view_count: null,\n };\n }\n /**\n * Test to see if the model has been synced with the server.\n *\n * #### Notes\n * As of backbone 1.1, backbone ignores `patch` if it thinks the\n * model has never been pushed.\n */\n isNew() {\n return false;\n }\n /**\n * Constructor\n *\n * Initializes a WidgetModel instance. Called by the Backbone constructor.\n *\n * Parameters\n * ----------\n * widget_manager : WidgetManager instance\n * model_id : string\n * An ID unique to this model.\n * comm : Comm instance (optional)\n */\n initialize(attributes, options) {\n this._expectedEchoMsgIds = new Map();\n this._attrsToUpdate = new Set();\n super.initialize(attributes, options);\n // Attributes should be initialized here, since user initialization may depend on it\n this.widget_manager = options.widget_manager;\n this.model_id = options.model_id;\n const comm = options.comm;\n this.views = Object.create(null);\n this.state_change = Promise.resolve();\n this._closed = false;\n this._state_lock = null;\n this._msg_buffer = null;\n this._msg_buffer_callbacks = null;\n this._pending_msgs = 0;\n // _buffered_state_diff must be created *after* the super.initialize\n // call above. See the note in the set() method below.\n this._buffered_state_diff = {};\n if (comm) {\n // Remember comm associated with the model.\n this.comm = comm;\n // Hook comm messages up to model.\n comm.on_close(this._handle_comm_closed.bind(this));\n comm.on_msg(this._handle_comm_msg.bind(this));\n this.comm_live = true;\n }\n else {\n this.comm_live = false;\n }\n }\n get comm_live() {\n return this._comm_live;\n }\n set comm_live(x) {\n this._comm_live = x;\n this.trigger('comm_live_update');\n }\n /**\n * Send a custom msg over the comm.\n */\n send(content, callbacks, buffers) {\n if (this.comm !== undefined) {\n const data = { method: 'custom', content: content };\n this.comm.send(data, callbacks, {}, buffers);\n }\n }\n /**\n * Close model\n *\n * @param comm_closed - true if the comm is already being closed. If false, the comm will be closed.\n *\n * @returns - a promise that is fulfilled when all the associated views have been removed.\n */\n close(comm_closed = false) {\n // can only be closed once.\n if (this._closed) {\n return Promise.resolve();\n }\n this._closed = true;\n if (this.comm && !comm_closed) {\n this.comm.close();\n }\n this.stopListening();\n this.trigger('destroy', this);\n if (this.comm) {\n delete this.comm;\n }\n // Delete all views of this model\n if (this.views) {\n const views = Object.keys(this.views).map((id) => {\n return this.views[id].then((view) => view.remove());\n });\n delete this.views;\n return Promise.all(views).then(() => {\n return;\n });\n }\n return Promise.resolve();\n }\n /**\n * Handle when a widget comm is closed.\n */\n _handle_comm_closed(msg) {\n this.trigger('comm:close');\n this.close(true);\n }\n /**\n * Handle incoming comm msg.\n */\n _handle_comm_msg(msg) {\n const data = msg.content.data;\n const method = data.method;\n switch (method) {\n case 'update':\n case 'echo_update':\n this.state_change = this.state_change\n .then(() => {\n var _a, _b, _c;\n const state = data.state;\n const buffer_paths = (_a = data.buffer_paths) !== null && _a !== void 0 ? _a : [];\n const buffers = (_c = (_b = msg.buffers) === null || _b === void 0 ? void 0 : _b.slice(0, buffer_paths.length)) !== null && _c !== void 0 ? _c : [];\n utils.put_buffers(state, buffer_paths, buffers);\n if (msg.parent_header && method === 'echo_update') {\n const msgId = msg.parent_header.msg_id;\n // we may have echos coming from other clients, we only care about\n // dropping echos for which we expected a reply\n const expectedEcho = Object.keys(state).filter((attrName) => this._expectedEchoMsgIds.has(attrName));\n expectedEcho.forEach((attrName) => {\n // Skip echo messages until we get the reply we are expecting.\n const isOldMessage = this._expectedEchoMsgIds.get(attrName) !== msgId;\n if (isOldMessage) {\n // Ignore an echo update that comes before our echo.\n delete state[attrName];\n }\n else {\n // we got our echo confirmation, so stop looking for it\n this._expectedEchoMsgIds.delete(attrName);\n // Start accepting echo updates unless we plan to send out a new state soon\n if (this._msg_buffer !== null &&\n Object.prototype.hasOwnProperty.call(this._msg_buffer, attrName)) {\n delete state[attrName];\n }\n }\n });\n }\n return this.constructor._deserialize_state(\n // Combine the state updates, with preference for kernel updates\n state, this.widget_manager);\n })\n .then((state) => {\n this.set_state(state);\n })\n .catch(utils.reject(`Could not process update msg for model id: ${this.model_id}`, true));\n return this.state_change;\n case 'custom':\n this.trigger('msg:custom', data.content, msg.buffers);\n return Promise.resolve();\n }\n return Promise.resolve();\n }\n /**\n * Handle when a widget is updated from the backend.\n *\n * This function is meant for internal use only. Values set here will not be propagated on a sync.\n */\n set_state(state) {\n this._state_lock = state;\n try {\n this.set(state);\n }\n catch (e) {\n console.error(`Error setting state: ${e instanceof Error ? e.message : e}`);\n }\n finally {\n this._state_lock = null;\n }\n }\n /**\n * Get the serializable state of the model.\n *\n * If drop_default is truthy, attributes that are equal to their default\n * values are dropped.\n */\n get_state(drop_defaults) {\n const fullState = this.attributes;\n if (drop_defaults) {\n // if defaults is a function, call it\n const d = this.defaults;\n const defaults = typeof d === 'function' ? d.call(this) : d;\n const state = {};\n Object.keys(fullState).forEach((key) => {\n if (!utils.isEqual(fullState[key], defaults[key])) {\n state[key] = fullState[key];\n }\n });\n return state;\n }\n else {\n return Object.assign({}, fullState);\n }\n }\n /**\n * Handle status msgs.\n *\n * execution_state : ('busy', 'idle', 'starting')\n */\n _handle_status(msg) {\n if (this.comm !== void 0) {\n if (msg.content.execution_state === 'idle') {\n this._pending_msgs--;\n // Sanity check for logic errors that may push this below zero.\n if (this._pending_msgs < 0) {\n console.error(`Jupyter Widgets message throttle: Pending messages < 0 (=${this._pending_msgs}), which is unexpected. Resetting to 0 to continue.`);\n this._pending_msgs = 0; // do not break message throttling in case of unexpected errors\n }\n // Send buffer if one is waiting and we are below the throttle.\n if (this._msg_buffer !== null && this._pending_msgs < 1) {\n const msgId = this.send_sync_message(this._msg_buffer, this._msg_buffer_callbacks);\n this.rememberLastUpdateFor(msgId);\n this._msg_buffer = null;\n this._msg_buffer_callbacks = null;\n }\n }\n }\n }\n /**\n * Create msg callbacks for a comm msg.\n */\n callbacks(view) {\n return this.widget_manager.callbacks(view);\n }\n /**\n * Set one or more values.\n *\n * We just call the super method, in which val and options are optional.\n * Handles both \"key\", value and {key: value} -style arguments.\n */\n set(key, val, options) {\n // Call our patched backbone set. See #1642 and #1643.\n const return_value = backbonePatch.set.call(this, key, val, options);\n // Backbone only remembers the diff of the most recent set()\n // operation. Calling set multiple times in a row results in a\n // loss of change information. Here we keep our own running diff.\n //\n // We don't buffer the state set in the constructor (including\n // defaults), so we first check to see if we've initialized _buffered_state_diff.\n // which happens after the constructor sets attributes at creation.\n if (this._buffered_state_diff !== void 0) {\n const attrs = this.changedAttributes() || {};\n // The state_lock lists attributes that are currently being changed\n // right now from a kernel message. We don't want to send these\n // non-changes back to the kernel, so we delete them out of attrs if\n // they haven't changed from their state_lock value.\n // The state lock could be null or undefined (if set is being called from\n // the initializer).\n if (this._state_lock) {\n for (const key of Object.keys(this._state_lock)) {\n if (attrs[key] === this._state_lock[key]) {\n delete attrs[key];\n }\n }\n }\n // _buffered_state_diff_synced lists things that have already been sent to the kernel during a top-level call to .set(), so we don't need to buffer these things either.\n if (this._buffered_state_diff_synced) {\n for (const key of Object.keys(this._buffered_state_diff_synced)) {\n if (attrs[key] === this._buffered_state_diff_synced[key]) {\n delete attrs[key];\n }\n }\n }\n this._buffered_state_diff = utils.assign(this._buffered_state_diff, attrs);\n }\n // If this ended a top-level call to .set, then reset _buffered_state_diff_synced\n if (this._changing === false) {\n this._buffered_state_diff_synced = {};\n }\n return return_value;\n }\n /**\n * Handle sync to the back-end. Called when a model.save() is called.\n *\n * Make sure a comm exists.\n *\n * Parameters\n * ----------\n * method : create, update, patch, delete, read\n * create/update always send the full attribute set\n * patch - only send attributes listed in options.attrs, and if we\n * are queuing up messages, combine with previous messages that have\n * not been sent yet\n * model : the model we are syncing\n * will normally be the same as `this`\n * options : dict\n * the `attrs` key, if it exists, gives an {attr: value} dict that\n * should be synced, otherwise, sync all attributes.\n *\n */\n sync(method, model, options = {}) {\n // the typing is to return `any` since the super.sync method returns a JqXHR, but we just return false if there is an error.\n if (this.comm === undefined) {\n throw 'Syncing error: no comm channel defined';\n }\n const attrs = method === 'patch'\n ? options.attrs\n : model.get_state(options.drop_defaults);\n // The state_lock lists attributes that are currently being changed\n // right now from a kernel message. We don't want to send these\n // non-changes back to the kernel, so we delete them out of attrs if\n // they haven't changed from their state_lock value.\n // The state lock could be null or undefined (if this is triggered\n // from the initializer).\n if (this._state_lock) {\n for (const key of Object.keys(this._state_lock)) {\n if (attrs[key] === this._state_lock[key]) {\n delete attrs[key];\n }\n }\n }\n Object.keys(attrs).forEach((attrName) => {\n this._attrsToUpdate.add(attrName);\n });\n const msgState = this.serialize(attrs);\n if (Object.keys(msgState).length > 0) {\n // If this message was sent via backbone itself, it will not\n // have any callbacks. It's important that we create callbacks\n // so we can listen for status messages, etc...\n const callbacks = options.callbacks || this.callbacks();\n // Check throttle.\n if (this._pending_msgs >= 1) {\n // The throttle has been exceeded, buffer the current msg so\n // it can be sent once the kernel has finished processing\n // some of the existing messages.\n // Combine updates if it is a 'patch' sync, otherwise replace updates\n switch (method) {\n case 'patch':\n this._msg_buffer = utils.assign(this._msg_buffer || {}, msgState);\n break;\n case 'update':\n case 'create':\n this._msg_buffer = msgState;\n break;\n default:\n throw 'unrecognized syncing method';\n }\n this._msg_buffer_callbacks = callbacks;\n }\n else {\n // We haven't exceeded the throttle, send the message like\n // normal.\n const msgId = this.send_sync_message(attrs, callbacks);\n this.rememberLastUpdateFor(msgId);\n // Since the comm is a one-way communication, assume the message\n // arrived and was processed successfully.\n // Don't call options.success since we don't have a model back from\n // the server. Note that this means we don't have the Backbone\n // 'sync' event.\n }\n }\n }\n rememberLastUpdateFor(msgId) {\n this._attrsToUpdate.forEach((attrName) => {\n this._expectedEchoMsgIds.set(attrName, msgId);\n });\n this._attrsToUpdate = new Set();\n }\n /**\n * Serialize widget state.\n *\n * A serializer is a function which takes in a state attribute and a widget,\n * and synchronously returns a JSONable object. The returned object will\n * have toJSON called if possible, and the final result should be a\n * primitive object that is a snapshot of the widget state that may have\n * binary array buffers.\n */\n serialize(state) {\n const serializers = this.constructor.serializers ||\n JSONExt.emptyObject;\n for (const k of Object.keys(state)) {\n try {\n if (serializers[k] && serializers[k].serialize) {\n state[k] = serializers[k].serialize(state[k], this);\n }\n else {\n // the default serializer just deep-copies the object\n state[k] = JSON.parse(JSON.stringify(state[k]));\n }\n if (state[k] && state[k].toJSON) {\n state[k] = state[k].toJSON();\n }\n }\n catch (e) {\n console.error('Error serializing widget state attribute: ', k);\n throw e;\n }\n }\n return state;\n }\n /**\n * Send a sync message to the kernel.\n *\n * If a message is sent successfully, this returns the message ID of that\n * message. Otherwise it returns an empty string\n */\n send_sync_message(state, callbacks = {}) {\n if (!this.comm) {\n return '';\n }\n try {\n // Make a 2-deep copy so we don't modify the caller's callbacks object.\n callbacks = {\n shell: Object.assign({}, callbacks.shell),\n iopub: Object.assign({}, callbacks.iopub),\n input: callbacks.input,\n };\n // Save the caller's status callback so we can call it after we handle the message.\n const statuscb = callbacks.iopub.status;\n callbacks.iopub.status = (msg) => {\n this._handle_status(msg);\n if (statuscb) {\n statuscb(msg);\n }\n };\n // split out the binary buffers\n const split = utils.remove_buffers(state);\n const msgId = this.comm.send({\n method: 'update',\n state: split.state,\n buffer_paths: split.buffer_paths,\n }, callbacks, {}, split.buffers);\n this._pending_msgs++;\n return msgId;\n }\n catch (e) {\n console.error('Could not send widget sync message', e);\n }\n return '';\n }\n /**\n * Push this model's state to the back-end\n *\n * This invokes a Backbone.Sync.\n */\n save_changes(callbacks) {\n if (this.comm_live) {\n const options = { patch: true };\n if (callbacks) {\n options.callbacks = callbacks;\n }\n this.save(this._buffered_state_diff, options);\n // If we are currently in a .set() call, save what state we have synced\n // to the kernel so we don't buffer it again as we come out of the .set call.\n if (this._changing) {\n utils.assign(this._buffered_state_diff_synced, this._buffered_state_diff);\n }\n this._buffered_state_diff = {};\n }\n }\n /**\n * on_some_change(['key1', 'key2'], foo, context) differs from\n * on('change:key1 change:key2', foo, context).\n * If the widget attributes key1 and key2 are both modified,\n * the second form will result in foo being called twice\n * while the first will call foo only once.\n */\n on_some_change(keys, callback, context) {\n this.on('change', (...args) => {\n if (keys.some(this.hasChanged, this)) {\n callback.apply(context, args);\n }\n }, this);\n }\n /**\n * Serialize the model. See the deserialization function at the top of this file\n * and the kernel-side serializer/deserializer.\n */\n toJSON(options) {\n return `IPY_MODEL_${this.model_id}`;\n }\n /**\n * Returns a promise for the deserialized state. The second argument\n * is an instance of widget manager, which is required for the\n * deserialization of widget models.\n */\n static _deserialize_state(state, manager) {\n const serializers = this.serializers;\n let deserialized;\n if (serializers) {\n deserialized = {};\n for (const k in state) {\n if (serializers[k] && serializers[k].deserialize) {\n deserialized[k] = serializers[k].deserialize(state[k], manager);\n }\n else {\n deserialized[k] = state[k];\n }\n }\n }\n else {\n deserialized = state;\n }\n return utils.resolvePromisesDict(deserialized);\n }\n}\nexport class DOMWidgetModel extends WidgetModel {\n defaults() {\n return utils.assign(super.defaults(), {\n _dom_classes: [],\n tabbable: null,\n tooltip: null,\n // We do not declare defaults for the layout and style attributes.\n // Those defaults are constructed on the kernel side and synced here\n // as needed, and our code here copes with those attributes being\n // undefined. See\n // https://github.com/jupyter-widgets/ipywidgets/issues/1620 and\n // https://github.com/jupyter-widgets/ipywidgets/pull/1621\n });\n }\n}\nDOMWidgetModel.serializers = Object.assign(Object.assign({}, WidgetModel.serializers), { layout: { deserialize: unpack_models }, style: { deserialize: unpack_models } });\nexport class WidgetView extends NativeView {\n /**\n * Public constructor.\n */\n constructor(options) {\n super(options);\n }\n /**\n * Initializer, called at the end of the constructor.\n */\n initialize(parameters) {\n this.listenTo(this.model, 'change', (model, options) => {\n const changed = Object.keys(this.model.changedAttributes() || {});\n if (changed[0] === '_view_count' && changed.length === 1) {\n // Just the view count was updated\n return;\n }\n this.update(options);\n });\n this.options = parameters.options;\n this.once('remove', () => {\n if (typeof this.model.get('_view_count') === 'number') {\n this.model.set('_view_count', this.model.get('_view_count') - 1);\n this.model.save_changes();\n }\n });\n this.once('displayed', () => {\n if (typeof this.model.get('_view_count') === 'number') {\n this.model.set('_view_count', this.model.get('_view_count') + 1);\n this.model.save_changes();\n }\n });\n this.displayed = new Promise((resolve, reject) => {\n this.once('displayed', resolve);\n this.model.on('msg:custom', this.handle_message.bind(this));\n });\n }\n /**\n * Handle message sent to the front end.\n *\n * Used to focus or blur the widget.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.el.focus();\n }\n else if (content.do === 'blur') {\n this.el.blur();\n }\n }\n /**\n * Triggered on model change.\n *\n * Update view to be consistent with this.model\n */\n update(options) {\n return;\n }\n /**\n * Render a view\n *\n * @returns the view or a promise to the view.\n */\n render() {\n return;\n }\n create_child_view(child_model, options = {}) {\n options = Object.assign({ parent: this }, options);\n return this.model.widget_manager\n .create_view(child_model, options)\n .catch(utils.reject('Could not create child view', true));\n }\n /**\n * Create msg callbacks for a comm msg.\n */\n callbacks() {\n return this.model.callbacks(this);\n }\n /**\n * Send a custom msg associated with this view.\n */\n send(content, buffers) {\n this.model.send(content, this.callbacks(), buffers);\n }\n touch() {\n this.model.save_changes(this.callbacks());\n }\n remove() {\n // Raise a remove event when the view is removed.\n super.remove();\n this.trigger('remove');\n return this;\n }\n}\nexport class JupyterLuminoWidget extends Widget {\n constructor(options) {\n const view = options.view;\n // Cast as any since we cannot delete a mandatory value\n delete options.view;\n super(options);\n this._view = view;\n }\n /**\n * Dispose the widget.\n *\n * This causes the view to be destroyed as well with 'remove'\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n super.dispose();\n this._view.remove();\n this._view = null;\n }\n /**\n * Process the Lumino message.\n *\n * Any custom Lumino widget used inside a Jupyter widget should override\n * the processMessage function like this.\n */\n processMessage(msg) {\n super.processMessage(msg);\n this._view.processLuminoMessage(msg);\n }\n}\n/**\n * @deprecated Use {@link JupyterLuminoWidget} instead (Since 8.0).\n */\nexport const JupyterPhosphorWidget = JupyterLuminoWidget;\nexport class JupyterLuminoPanelWidget extends Panel {\n constructor(options) {\n const view = options.view;\n delete options.view;\n super(options);\n this._view = view;\n }\n /**\n * Process the Lumino message.\n *\n * Any custom Lumino widget used inside a Jupyter widget should override\n * the processMessage function like this.\n */\n processMessage(msg) {\n super.processMessage(msg);\n this._view.processLuminoMessage(msg);\n }\n /**\n * Dispose the widget.\n *\n * This causes the view to be destroyed as well with 'remove'\n */\n dispose() {\n var _a;\n if (this.isDisposed) {\n return;\n }\n super.dispose();\n (_a = this._view) === null || _a === void 0 ? void 0 : _a.remove();\n this._view = null;\n }\n}\nexport class DOMWidgetView extends WidgetView {\n /**\n * Public constructor\n */\n initialize(parameters) {\n super.initialize(parameters);\n this.listenTo(this.model, 'change:_dom_classes', (model, new_classes) => {\n const old_classes = model.previous('_dom_classes');\n this.update_classes(old_classes, new_classes);\n });\n this.layoutPromise = Promise.resolve();\n this.listenTo(this.model, 'change:layout', (model, value) => {\n this.setLayout(value, model.previous('layout'));\n });\n this.stylePromise = Promise.resolve();\n this.listenTo(this.model, 'change:style', (model, value) => {\n this.setStyle(value, model.previous('style'));\n });\n this.displayed.then(() => {\n this.update_classes([], this.model.get('_dom_classes'));\n this.setLayout(this.model.get('layout'));\n this.setStyle(this.model.get('style'));\n });\n this._comm_live_update();\n this.listenTo(this.model, 'comm_live_update', () => {\n this._comm_live_update();\n });\n this.listenTo(this.model, 'change:tooltip', this.updateTooltip);\n this.updateTooltip();\n }\n setLayout(layout, oldLayout) {\n if (layout) {\n this.layoutPromise = this.layoutPromise.then((oldLayoutView) => {\n if (oldLayoutView) {\n oldLayoutView.unlayout();\n this.stopListening(oldLayoutView.model);\n oldLayoutView.remove();\n }\n return this.create_child_view(layout)\n .then((view) => {\n // Trigger the displayed event of the child view.\n return this.displayed.then(() => {\n view.trigger('displayed');\n this.listenTo(view.model, 'change', () => {\n // Post (asynchronous) so layout changes can take\n // effect first.\n MessageLoop.postMessage(this.luminoWidget, Widget.ResizeMessage.UnknownSize);\n });\n MessageLoop.postMessage(this.luminoWidget, Widget.ResizeMessage.UnknownSize);\n this.trigger('layout-changed');\n return view;\n });\n })\n .catch(utils.reject('Could not add LayoutView to DOMWidgetView', true));\n });\n }\n }\n setStyle(style, oldStyle) {\n if (style) {\n this.stylePromise = this.stylePromise.then((oldStyleView) => {\n if (oldStyleView) {\n oldStyleView.unstyle();\n this.stopListening(oldStyleView.model);\n oldStyleView.remove();\n }\n return this.create_child_view(style)\n .then((view) => {\n // Trigger the displayed event of the child view.\n return this.displayed.then(() => {\n view.trigger('displayed');\n this.trigger('style-changed');\n // Unlike for the layout attribute, style changes don't\n // trigger Lumino resize messages.\n return view;\n });\n })\n .catch(utils.reject('Could not add styleView to DOMWidgetView', true));\n });\n }\n }\n updateTooltip() {\n const title = this.model.get('tooltip');\n if (!title) {\n this.el.removeAttribute('title');\n }\n else if (this.model.get('description').length === 0) {\n this.el.setAttribute('title', title);\n }\n }\n /**\n * Update the DOM classes applied to an element, default to this.el.\n */\n update_classes(old_classes, new_classes, el) {\n if (el === undefined) {\n el = this.el;\n }\n utils.difference(old_classes, new_classes).map(function (c) {\n if (el.classList) {\n // classList is not supported by IE for svg elements\n el.classList.remove(c);\n }\n else {\n el.setAttribute('class', el.getAttribute('class').replace(c, ''));\n }\n });\n utils.difference(new_classes, old_classes).map(function (c) {\n if (el.classList) {\n // classList is not supported by IE for svg elements\n el.classList.add(c);\n }\n else {\n el.setAttribute('class', el.getAttribute('class').concat(' ', c));\n }\n });\n }\n /**\n * Update the DOM classes applied to the widget based on a single\n * trait's value.\n *\n * Given a trait value classes map, this function automatically\n * handles applying the appropriate classes to the widget element\n * and removing classes that are no longer valid.\n *\n * Parameters\n * ----------\n * class_map: dictionary\n * Dictionary of trait values to class lists.\n * Example:\n * {\n * success: ['alert', 'alert-success'],\n * info: ['alert', 'alert-info'],\n * warning: ['alert', 'alert-warning'],\n * danger: ['alert', 'alert-danger']\n * };\n * trait_name: string\n * Name of the trait to check the value of.\n * el: optional DOM element handle, defaults to this.el\n * Element that the classes are applied to.\n */\n update_mapped_classes(class_map, trait_name, el) {\n let key = this.model.previous(trait_name);\n const old_classes = class_map[key] ? class_map[key] : [];\n key = this.model.get(trait_name);\n const new_classes = class_map[key] ? class_map[key] : [];\n this.update_classes(old_classes, new_classes, el || this.el);\n }\n set_mapped_classes(class_map, trait_name, el) {\n const key = this.model.get(trait_name);\n const new_classes = class_map[key] ? class_map[key] : [];\n this.update_classes([], new_classes, el || this.el);\n }\n _setElement(el) {\n if (this.luminoWidget) {\n this.luminoWidget.dispose();\n }\n this.$el = el instanceof $ ? el : $(el);\n this.el = this.$el[0];\n this.luminoWidget = new JupyterLuminoWidget({\n node: el,\n view: this,\n });\n }\n remove() {\n if (this.luminoWidget) {\n this.luminoWidget.dispose();\n }\n return super.remove();\n }\n processLuminoMessage(msg) {\n switch (msg.type) {\n case 'after-attach':\n this.trigger('displayed');\n break;\n case 'show':\n this.trigger('shown');\n break;\n }\n }\n _comm_live_update() {\n if (this.model.comm_live) {\n this.luminoWidget.removeClass('jupyter-widgets-disconnected');\n }\n else {\n this.luminoWidget.addClass('jupyter-widgets-disconnected');\n }\n }\n updateTabindex() {\n const tabbable = this.model.get('tabbable');\n if (tabbable === true) {\n this.el.setAttribute('tabIndex', '0');\n }\n else if (tabbable === false) {\n this.el.setAttribute('tabIndex', '-1');\n }\n else if (tabbable === null) {\n this.el.removeAttribute('tabIndex');\n }\n }\n /**\n * @deprecated Use {@link luminoWidget} instead (Since 8.0).\n */\n get pWidget() {\n return this.luminoWidget;\n }\n}\n//# sourceMappingURL=widget.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { assign } from './utils';\nimport { WidgetModel, WidgetView } from './widget';\n/**\n * css properties exposed by the layout widget with their default values.\n */\nconst css_properties = {\n align_content: null,\n align_items: null,\n align_self: null,\n border_top: null,\n border_right: null,\n border_bottom: null,\n border_left: null,\n bottom: null,\n display: null,\n flex: null,\n flex_flow: null,\n height: null,\n justify_content: null,\n justify_items: null,\n left: null,\n margin: null,\n max_height: null,\n max_width: null,\n min_height: null,\n min_width: null,\n overflow: null,\n order: null,\n padding: null,\n right: null,\n top: null,\n visibility: null,\n width: null,\n // image-specific\n object_fit: null,\n object_position: null,\n // container\n grid_auto_columns: null,\n grid_auto_flow: null,\n grid_auto_rows: null,\n grid_gap: null,\n grid_template_rows: null,\n grid_template_columns: null,\n grid_template_areas: null,\n // items\n grid_row: null,\n grid_column: null,\n grid_area: null,\n};\nexport class LayoutModel extends WidgetModel {\n defaults() {\n return assign(super.defaults(), {\n _model_name: 'LayoutModel',\n _view_name: 'LayoutView',\n }, css_properties);\n }\n}\nexport class LayoutView extends WidgetView {\n /**\n * Public constructor\n */\n initialize(parameters) {\n this._traitNames = [];\n super.initialize(parameters);\n // Register the traits that live on the Python side\n for (const key of Object.keys(css_properties)) {\n this.registerTrait(key);\n }\n }\n /**\n * Register a CSS trait that is known by the model\n * @param trait\n */\n registerTrait(trait) {\n this._traitNames.push(trait);\n // Listen to changes, and set the value on change.\n this.listenTo(this.model, 'change:' + trait, (model, value) => {\n this.handleChange(trait, value);\n });\n // Set the initial value on display.\n this.handleChange(trait, this.model.get(trait));\n }\n /**\n * Get the the name of the css property from the trait name\n * @param model attribute name\n * @return css property name\n */\n css_name(trait) {\n return trait.replace(/_/g, '-');\n }\n /**\n * Handles when a trait value changes\n */\n handleChange(trait, value) {\n // should be synchronous so that we can measure later.\n const parent = this.options.parent;\n if (parent) {\n if (value === null) {\n parent.el.style.removeProperty(this.css_name(trait));\n }\n else {\n parent.el.style.setProperty(this.css_name(trait), value);\n }\n }\n else {\n console.warn('Style not applied because a parent view does not exist');\n }\n }\n /**\n * Remove the styling from the parent view.\n */\n unlayout() {\n const parent = this.options.parent;\n this._traitNames.forEach((trait) => {\n if (parent) {\n parent.el.style.removeProperty(this.css_name(trait));\n }\n else {\n console.warn('Style not removed because a parent view does not exist');\n }\n }, this);\n }\n}\n//# sourceMappingURL=widget_layout.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { assign } from './utils';\nimport { WidgetModel, WidgetView } from './widget';\n/**\n * Three functions to deal with some CSS attributes\n * to make them easier to use.\n */\nexport class StyleModel extends WidgetModel {\n defaults() {\n const Derived = this.constructor;\n return assign(super.defaults(), {\n _model_name: 'StyleModel',\n _view_name: 'StyleView',\n }, Object.keys(Derived.styleProperties).reduce((obj, key) => {\n obj[key] = Derived.styleProperties[key].default;\n return obj;\n }, {}));\n }\n}\nStyleModel.styleProperties = {};\nexport class StyleView extends WidgetView {\n /**\n * Public constructor\n */\n initialize(parameters) {\n this._traitNames = [];\n super.initialize(parameters);\n // Register the traits that live on the Python side\n const ModelType = this.model.constructor;\n for (const key of Object.keys(ModelType.styleProperties)) {\n this.registerTrait(key);\n }\n // Set the initial styles\n this.style();\n }\n /**\n * Register a CSS trait that is known by the model\n * @param trait\n */\n registerTrait(trait) {\n this._traitNames.push(trait);\n // Listen to changes, and set the value on change.\n this.listenTo(this.model, 'change:' + trait, (model, value) => {\n this.handleChange(trait, value);\n });\n }\n /**\n * Handles when a trait value changes\n */\n handleChange(trait, value) {\n // should be synchronous so that we can measure later.\n const parent = this.options.parent;\n if (parent) {\n const ModelType = this.model.constructor;\n const styleProperties = ModelType.styleProperties;\n const attribute = styleProperties[trait].attribute;\n const selector = styleProperties[trait].selector;\n const elements = selector\n ? parent.el.querySelectorAll(selector)\n : [parent.el];\n if (value === null) {\n for (let i = 0; i !== elements.length; ++i) {\n elements[i].style.removeProperty(attribute);\n }\n }\n else {\n for (let i = 0; i !== elements.length; ++i) {\n elements[i].style.setProperty(attribute, value);\n }\n }\n }\n else {\n console.warn('Style not applied because a parent view does not exist');\n }\n }\n /**\n * Apply styles for all registered traits\n */\n style() {\n for (const trait of this._traitNames) {\n this.handleChange(trait, this.model.get(trait));\n }\n }\n /**\n * Remove the styling from the parent view.\n */\n unstyle() {\n const parent = this.options.parent;\n const ModelType = this.model.constructor;\n const styleProperties = ModelType.styleProperties;\n this._traitNames.forEach((trait) => {\n if (parent) {\n const attribute = styleProperties[trait].attribute;\n const selector = styleProperties[trait].selector;\n const elements = selector\n ? parent.el.querySelectorAll(selector)\n : [parent.el];\n for (let i = 0; i !== elements.length; ++i) {\n elements[i].style.removeProperty(attribute);\n }\n }\n else {\n console.warn('Style not removed because a parent view does not exist');\n }\n }, this);\n }\n}\n//# sourceMappingURL=widget_style.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nexport var shims;\n(function (shims) {\n let services;\n (function (services) {\n /**\n * Public constructor\n * @param jsServicesKernel - @jupyterlab/services Kernel.IKernel instance\n */\n class CommManager {\n constructor(jsServicesKernel) {\n this.targets = Object.create(null);\n this.comms = Object.create(null);\n this.init_kernel(jsServicesKernel);\n }\n /**\n * Hookup kernel events.\n * @param {Kernel.IKernel} jsServicesKernel - @jupyterlab/services Kernel.IKernel instance\n */\n init_kernel(jsServicesKernel) {\n this.kernel = jsServicesKernel; // These aren't really the same.\n this.jsServicesKernel = jsServicesKernel;\n }\n /**\n * Creates a new connected comm\n */\n async new_comm(target_name, data, callbacks, metadata, comm_id, buffers) {\n const c = this.jsServicesKernel.createComm(target_name, comm_id);\n const comm = new Comm(c);\n this.register_comm(comm);\n comm.open(data, callbacks, metadata, buffers);\n return comm;\n }\n /**\n * Register a comm target\n * @param {string} target_name\n * @param {(Comm, object) => void} f - callback that is called when the\n * comm is made. Signature of f(comm, msg).\n */\n register_target(target_name, f) {\n const handle = this.jsServicesKernel.registerCommTarget(target_name, (jsServicesComm, msg) => {\n // Create the comm.\n const comm = new Comm(jsServicesComm);\n this.register_comm(comm);\n // Call the callback for the comm.\n try {\n return f(comm, msg);\n }\n catch (e) {\n comm.close();\n console.error(e);\n console.error(new Error('Exception opening new comm'));\n }\n });\n this.targets[target_name] = handle;\n }\n /**\n * Unregisters a comm target\n * @param {string} target_name\n */\n unregister_target(target_name, f) {\n const handle = this.targets[target_name];\n handle.dispose();\n delete this.targets[target_name];\n }\n /**\n * Register a comm in the mapping\n */\n register_comm(comm) {\n this.comms[comm.comm_id] = Promise.resolve(comm);\n comm.kernel = this.kernel;\n return comm.comm_id;\n }\n }\n services.CommManager = CommManager;\n /**\n * Public constructor\n * @param {IComm} jsServicesComm - @jupyterlab/services IComm instance\n */\n class Comm {\n constructor(jsServicesComm) {\n this.jsServicesComm = jsServicesComm;\n }\n /**\n * Comm id\n * @return {string}\n */\n get comm_id() {\n return this.jsServicesComm.commId;\n }\n /**\n * Target name\n * @return {string}\n */\n get target_name() {\n return this.jsServicesComm.targetName;\n }\n /**\n * Opens a sibling comm in the backend\n * @param data\n * @param callbacks\n * @param metadata\n * @return msg id\n */\n open(data, callbacks, metadata, buffers) {\n const future = this.jsServicesComm.open(data, metadata, buffers);\n this._hookupCallbacks(future, callbacks);\n return future.msg.header.msg_id;\n }\n /**\n * Sends a message to the sibling comm in the backend\n * @param data\n * @param callbacks\n * @param metadata\n * @param buffers\n * @return message id\n */\n send(data, callbacks, metadata, buffers) {\n const future = this.jsServicesComm.send(data, metadata, buffers);\n this._hookupCallbacks(future, callbacks);\n return future.msg.header.msg_id;\n }\n /**\n * Closes the sibling comm in the backend\n * @param data\n * @param callbacks\n * @param metadata\n * @return msg id\n */\n close(data, callbacks, metadata, buffers) {\n const future = this.jsServicesComm.close(data, metadata, buffers);\n this._hookupCallbacks(future, callbacks);\n return future.msg.header.msg_id;\n }\n /**\n * Register a message handler\n * @param callback, which is given a message\n */\n on_msg(callback) {\n this.jsServicesComm.onMsg = callback.bind(this);\n }\n /**\n * Register a handler for when the comm is closed by the backend\n * @param callback, which is given a message\n */\n on_close(callback) {\n this.jsServicesComm.onClose = callback.bind(this);\n }\n /**\n * Hooks callback object up with @jupyterlab/services IKernelFuture\n * @param @jupyterlab/services IKernelFuture instance\n * @param callbacks\n */\n _hookupCallbacks(future, callbacks) {\n if (callbacks) {\n future.onReply = function (msg) {\n if (callbacks.shell && callbacks.shell.reply) {\n callbacks.shell.reply(msg);\n }\n };\n future.onStdin = function (msg) {\n if (callbacks.input) {\n callbacks.input(msg);\n }\n };\n future.onIOPub = function (msg) {\n if (callbacks.iopub) {\n if (callbacks.iopub.status && msg.header.msg_type === 'status') {\n callbacks.iopub.status(msg);\n }\n else if (callbacks.iopub.clear_output &&\n msg.header.msg_type === 'clear_output') {\n callbacks.iopub.clear_output(msg);\n }\n else if (callbacks.iopub.output) {\n switch (msg.header.msg_type) {\n case 'display_data':\n case 'execute_result':\n case 'stream':\n case 'error':\n callbacks.iopub.output(msg);\n break;\n default:\n break;\n }\n }\n }\n };\n }\n }\n }\n services.Comm = Comm;\n })(services = shims.services || (shims.services = {}));\n})(shims || (shims = {}));\n//# sourceMappingURL=services-shim.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * - create_view and remove_view are default functions called when adding or removing views\n * - create_view takes a model and an index and returns a view or a promise for a view for that model\n * - remove_view takes a view and destroys it (including calling `view.remove()`)\n * - each time the update() function is called with a new list, the create and remove\n * callbacks will be called in an order so that if you append the views created in the\n * create callback and remove the views in the remove callback, you will duplicate\n * the order of the list.\n * - the remove callback defaults to just removing the view (e.g., pass in null for the second parameter)\n * - the context defaults to the created ViewList. If you pass another context, the create and remove\n * will be called in that context.\n */\nexport class ViewList {\n constructor(create_view, remove_view, context) {\n this.initialize(create_view, remove_view, context);\n }\n initialize(create_view, remove_view, context) {\n this._handler_context = context || this;\n this._models = [];\n this.views = []; // list of promises for views\n this._create_view = create_view;\n this._remove_view =\n remove_view ||\n function (view) {\n view.remove();\n };\n }\n /**\n * the create_view, remove_view, and context arguments override the defaults\n * specified when the list is created.\n * after this function, the .views attribute is a list of promises for views\n * if you want to perform some action on the list of views, do something like\n * `Promise.all(myviewlist.views).then(function(views) {...});`\n */\n update(new_models, create_view, remove_view, context) {\n const remove = remove_view || this._remove_view;\n const create = create_view || this._create_view;\n context = context || this._handler_context;\n let i = 0;\n // first, skip past the beginning of the lists if they are identical\n for (; i < new_models.length; i++) {\n if (i >= this._models.length || new_models[i] !== this._models[i]) {\n break;\n }\n }\n const first_removed = i;\n // Remove the non-matching items from the old list.\n const removed = this.views.splice(first_removed, this.views.length - first_removed);\n for (let j = 0; j < removed.length; j++) {\n removed[j].then(function (view) {\n remove.call(context, view);\n });\n }\n // Add the rest of the new list items.\n for (; i < new_models.length; i++) {\n this.views.push(Promise.resolve(create.call(context, new_models[i], i)));\n }\n // make a copy of the input array\n this._models = new_models.slice();\n // return a promise that resolves to all of the resolved views\n return Promise.all(this.views);\n }\n /**\n * removes every view in the list; convenience function for `.update([])`\n * that should be faster\n * returns a promise that resolves after this removal is done\n */\n remove() {\n return Promise.all(this.views).then((views) => {\n views.forEach((value) => this._remove_view.call(this._handler_context, value));\n this.views = [];\n this._models = [];\n });\n }\n /**\n * Dispose this viewlist.\n *\n * A synchronous function which just deletes references to child views. This\n * function does not call .remove() on child views because that is\n * asynchronous. Use this in cases where child views will be removed in\n * another way.\n */\n dispose() {\n this.views = null;\n this._models = null;\n }\n}\n//# sourceMappingURL=viewlist.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { Token } from '@lumino/coreutils';\n/**\n * A runtime interface token for a widget registry.\n */\nexport const IJupyterWidgetRegistry = new Token('jupyter.extensions.jupyterWidgetRegistry');\n//# sourceMappingURL=registry.js.map","import { DOMWidgetModel, DOMWidgetView, } from './widget';\nimport { JUPYTER_WIDGETS_VERSION } from './version';\nimport { BROKEN_FILE_SVG_ICON } from './utils';\n// create a Widget Model that captures an error object\nexport function createErrorWidgetModel(error, msg) {\n class ErrorWidget extends DOMWidgetModel {\n constructor(attributes, options) {\n attributes = Object.assign(Object.assign({}, attributes), { _view_name: 'ErrorWidgetView', _view_module: '@jupyter-widgets/base', _model_module_version: JUPYTER_WIDGETS_VERSION, _view_module_version: JUPYTER_WIDGETS_VERSION, msg: msg, error: error });\n super(attributes, options);\n this.comm_live = true;\n }\n }\n return ErrorWidget;\n}\nexport class ErrorWidgetView extends DOMWidgetView {\n generateErrorMessage() {\n return {\n msg: this.model.get('msg'),\n stack: String(this.model.get('error').stack),\n };\n }\n render() {\n const { msg, stack } = this.generateErrorMessage();\n this.el.classList.add('jupyter-widgets');\n const content = document.createElement('div');\n content.classList.add('jupyter-widgets-error-widget', 'icon-error');\n content.innerHTML = BROKEN_FILE_SVG_ICON;\n const text = document.createElement('pre');\n text.style.textAlign = 'center';\n text.innerText = 'Click to show javascript error.';\n content.append(text);\n this.el.appendChild(content);\n let width;\n let height;\n this.el.onclick = () => {\n if (content.classList.contains('icon-error')) {\n height = height || content.clientHeight;\n width = width || content.clientWidth;\n content.classList.remove('icon-error');\n content.innerHTML = `\n
[Open Browser Console for more detailed log - Double click to close this message]\\n${msg}\\n${stack}
\n `;\n content.style.height = `${height}px`;\n content.style.width = `${width}px`;\n content.classList.add('text-error');\n }\n };\n this.el.ondblclick = () => {\n if (content.classList.contains('text-error')) {\n content.classList.remove('text-error');\n content.innerHTML = BROKEN_FILE_SVG_ICON;\n content.append(text);\n content.classList.add('icon-error');\n }\n };\n }\n}\nexport function createErrorWidgetView(error, msg) {\n return class InnerErrorWidgetView extends ErrorWidgetView {\n generateErrorMessage() {\n return {\n msg,\n stack: String(error instanceof Error ? error.stack : error),\n };\n }\n };\n}\n//# sourceMappingURL=errorwidget.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nexport { uuid, resolvePromisesDict } from '@jupyter-widgets/base';\n/**\n * Apply MathJax rendering to an element, and optionally set its text.\n *\n * If MathJax is not available, make no changes.\n *\n * Parameters\n * ----------\n * element: Node\n * text: optional string\n */\nexport function typeset(element, text) {\n if (text !== void 0) {\n element.textContent = text;\n }\n if (window.MathJax !== void 0) {\n MathJax.Hub.Queue(['Typeset', MathJax.Hub, element]);\n }\n}\n/**\n * escape text to HTML\n */\nexport function escape_html(text) {\n const esc = document.createElement('div');\n esc.textContent = text;\n return esc.innerHTML;\n}\n/**\n * Creates a wrappable Promise rejection function.\n */\nexport function reject(message, log) {\n return function promiseRejection(error) {\n if (log) {\n console.error(new Error(message));\n }\n throw error;\n };\n}\n//# sourceMappingURL=utils.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetModel, DOMWidgetView, StyleModel, } from '@jupyter-widgets/base';\nimport { typeset } from './utils';\nimport { JUPYTER_CONTROLS_VERSION } from './version';\nexport class DescriptionStyleModel extends StyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'DescriptionStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nDescriptionStyleModel.styleProperties = {\n description_width: {\n selector: '.widget-label',\n attribute: 'width',\n default: null,\n },\n};\nexport class DescriptionModel extends DOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'DescriptionModel', _view_name: 'DescriptionView', _view_module: '@jupyter-widgets/controls', _model_module: '@jupyter-widgets/controls', _view_module_version: JUPYTER_CONTROLS_VERSION, _model_module_version: JUPYTER_CONTROLS_VERSION, description: '', description_allow_html: false });\n }\n}\nexport class DescriptionView extends DOMWidgetView {\n render() {\n this.label = document.createElement('label');\n this.el.appendChild(this.label);\n this.label.className = 'widget-label';\n this.label.style.display = 'none';\n this.listenTo(this.model, 'change:description', this.updateDescription);\n this.listenTo(this.model, 'change:description_allow_html', this.updateDescription);\n this.listenTo(this.model, 'change:tabbable', this.updateTabindex);\n this.updateDescription();\n this.updateTabindex();\n this.updateTooltip();\n }\n typeset(element, text) {\n this.displayed.then(() => typeset(element, text));\n }\n updateDescription() {\n const description = this.model.get('description');\n if (description.length === 0) {\n this.label.style.display = 'none';\n }\n else {\n if (this.model.get('description_allow_html')) {\n this.label.innerHTML =\n this.model.widget_manager.inline_sanitize(description);\n }\n else {\n this.label.textContent = description;\n }\n this.typeset(this.label);\n this.label.style.display = '';\n }\n }\n updateTooltip() {\n if (!this.label)\n return;\n this.label.title = this.model.get('tooltip');\n }\n}\n/**\n * For backwards compatibility with jupyter-js-widgets 2.x.\n *\n * Use DescriptionModel instead.\n */\nexport class LabeledDOMWidgetModel extends DescriptionModel {\n}\n/**\n * For backwards compatibility with jupyter-js-widgets 2.x.\n *\n * Use DescriptionView instead.\n */\nexport class LabeledDOMWidgetView extends DescriptionView {\n}\n//# sourceMappingURL=widget_description.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n// widget_core implements some common patterns for the core widget collection\n// that are not to be used directly by third-party widget authors.\nimport { DOMWidgetModel, WidgetModel } from '@jupyter-widgets/base';\nimport { DescriptionModel } from './widget_description';\nimport { JUPYTER_CONTROLS_VERSION } from './version';\nexport class CoreWidgetModel extends WidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'CoreWidgetModel', _view_module: '@jupyter-widgets/controls', _model_module: '@jupyter-widgets/controls', _view_module_version: JUPYTER_CONTROLS_VERSION, _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nexport class CoreDOMWidgetModel extends DOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'CoreDOMWidgetModel', _view_module: '@jupyter-widgets/controls', _model_module: '@jupyter-widgets/controls', _view_module_version: JUPYTER_CONTROLS_VERSION, _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nexport class CoreDescriptionModel extends DescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'CoreDescriptionModel', _view_module: '@jupyter-widgets/controls', _model_module: '@jupyter-widgets/controls', _view_module_version: JUPYTER_CONTROLS_VERSION, _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\n//# sourceMappingURL=widget_core.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { unpack_models } from '@jupyter-widgets/base';\nimport { CoreWidgetModel } from './widget_core';\nexport class DirectionalLinkModel extends CoreWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { target: undefined, source: undefined, _model_name: 'DirectionalLinkModel' });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n this.on('change', this.updateBindings, this);\n this.updateBindings();\n }\n updateValue(sourceModel, sourceAttr, targetModel, targetAttr) {\n if (this._updating) {\n return;\n }\n this._updating = true;\n try {\n if (targetModel) {\n targetModel.set(targetAttr, sourceModel.get(sourceAttr));\n targetModel.save_changes();\n }\n }\n finally {\n this._updating = false;\n }\n }\n updateBindings() {\n this.cleanup();\n [this.sourceModel, this.sourceAttr] = this.get('source') || [null, null];\n [this.targetModel, this.targetAttr] = this.get('target') || [null, null];\n if (this.sourceModel) {\n this.listenTo(this.sourceModel, 'change:' + this.sourceAttr, () => {\n this.updateValue(this.sourceModel, this.sourceAttr, this.targetModel, this.targetAttr);\n });\n this.updateValue(this.sourceModel, this.sourceAttr, this.targetModel, this.targetAttr);\n this.listenToOnce(this.sourceModel, 'destroy', this.cleanup);\n }\n if (this.targetModel) {\n this.listenToOnce(this.targetModel, 'destroy', this.cleanup);\n }\n }\n cleanup() {\n // Stop listening to 'change' and 'destroy' events of the source and target\n if (this.sourceModel) {\n this.stopListening(this.sourceModel, 'change:' + this.sourceAttr, undefined);\n this.stopListening(this.sourceModel, 'destroy', undefined);\n }\n if (this.targetModel) {\n this.stopListening(this.targetModel, 'destroy', undefined);\n }\n }\n}\nDirectionalLinkModel.serializers = Object.assign(Object.assign({}, CoreWidgetModel.serializers), { target: { deserialize: unpack_models }, source: { deserialize: unpack_models } });\nexport class LinkModel extends DirectionalLinkModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'LinkModel' });\n }\n updateBindings() {\n super.updateBindings();\n if (this.targetModel) {\n this.listenTo(this.targetModel, 'change:' + this.targetAttr, () => {\n this.updateValue(this.targetModel, this.targetAttr, this.sourceModel, this.sourceAttr);\n });\n }\n }\n cleanup() {\n super.cleanup();\n if (this.targetModel) {\n this.stopListening(this.targetModel, 'change:' + this.targetAttr, undefined);\n }\n }\n}\n//# sourceMappingURL=widget_link.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView } from '@jupyter-widgets/base';\nimport { CoreDescriptionModel } from './widget_core';\nimport { DescriptionStyleModel, DescriptionView } from './widget_description';\nexport class CheckboxStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'CheckboxStyleModel' });\n }\n}\nCheckboxStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { background: {\n selector: '',\n attribute: 'background',\n default: null,\n } });\nexport class ToggleButtonStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ToggleButtonStyleModel' });\n }\n}\nToggleButtonStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { font_family: {\n selector: '',\n attribute: 'font-family',\n default: '',\n }, font_size: {\n selector: '',\n attribute: 'font-size',\n default: '',\n }, font_style: {\n selector: '',\n attribute: 'font-style',\n default: '',\n }, font_variant: {\n selector: '',\n attribute: 'font-variant',\n default: '',\n }, font_weight: {\n selector: '',\n attribute: 'font-weight',\n default: '',\n }, text_color: {\n selector: '',\n attribute: 'color',\n default: '',\n }, text_decoration: {\n selector: '',\n attribute: 'text-decoration',\n default: '',\n } });\nexport class BoolModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: false, disabled: false, _model_name: 'BoolModel' });\n }\n}\nexport class CheckboxModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { indent: true, style: null, _view_name: 'CheckboxView', _model_name: 'CheckboxModel' });\n }\n}\nexport class CheckboxView extends DescriptionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-checkbox');\n // adding a zero-width space to the label to help\n // the browser set the baseline correctly\n this.label.innerHTML = '​';\n // label containing the checkbox and description span\n this.checkboxLabel = document.createElement('label');\n this.checkboxLabel.classList.add('widget-label-basic');\n this.el.appendChild(this.checkboxLabel);\n // checkbox\n this.checkbox = document.createElement('input');\n this.checkbox.setAttribute('type', 'checkbox');\n this.checkboxLabel.appendChild(this.checkbox);\n // span to the right of the checkbox that will render the description\n this.descriptionSpan = document.createElement('span');\n this.checkboxLabel.appendChild(this.descriptionSpan);\n this.listenTo(this.model, 'change:indent', this.updateIndent);\n this.listenTo(this.model, 'change:tabbable', this.updateTabindex);\n this.update(); // Set defaults.\n this.updateDescription();\n this.updateIndent();\n this.updateTabindex();\n this.updateTooltip();\n }\n /**\n * Overridden from super class\n *\n * Update the description span (rather than the label) since\n * we want the description to the right of the checkbox.\n */\n updateDescription() {\n // can be called before the view is fully initialized\n if (this.checkboxLabel == null) {\n return;\n }\n const description = this.model.get('description');\n if (this.model.get('description_allow_html')) {\n this.descriptionSpan.innerHTML =\n this.model.widget_manager.inline_sanitize(description);\n }\n else {\n this.descriptionSpan.textContent = description;\n }\n this.typeset(this.descriptionSpan);\n this.descriptionSpan.title = description;\n this.checkbox.title = description;\n }\n /**\n * Update the visibility of the label in the super class\n * to provide the optional indent.\n */\n updateIndent() {\n const indent = this.model.get('indent');\n this.label.style.display = indent ? '' : 'none';\n }\n updateTabindex() {\n if (!this.checkbox) {\n return; // we might be constructing the parent\n }\n const tabbable = this.model.get('tabbable');\n if (tabbable === true) {\n this.checkbox.setAttribute('tabIndex', '0');\n }\n else if (tabbable === false) {\n this.checkbox.setAttribute('tabIndex', '-1');\n }\n else if (tabbable === null) {\n this.checkbox.removeAttribute('tabIndex');\n }\n }\n updateTooltip() {\n if (!this.checkbox)\n return; // we might be constructing the parent\n const title = this.model.get('tooltip');\n if (!title) {\n this.checkbox.removeAttribute('title');\n }\n else if (this.model.get('description').length === 0) {\n this.checkbox.setAttribute('title', title);\n }\n }\n events() {\n return {\n 'click input[type=\"checkbox\"]': '_handle_click',\n };\n }\n /**\n * Handles when the checkbox is clicked.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n _handle_click() {\n const value = this.model.get('value');\n this.model.set('value', !value, { updated_view: this });\n this.touch();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n this.checkbox.checked = this.model.get('value');\n if (options === undefined || options.updated_view != this) {\n this.checkbox.disabled = this.model.get('disabled');\n }\n return super.update();\n }\n /**\n * Handle message sent to the front end.\n *\n * Used to focus or blur the widget.\n */\n handle_message(content) {\n if (content.do == 'focus') {\n this.checkbox.focus();\n }\n else if (content.do == 'blur') {\n this.checkbox.blur();\n }\n }\n}\nexport class ToggleButtonModel extends BoolModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'ToggleButtonView', _model_name: 'ToggleButtonModel', tooltip: '', icon: '', button_style: '', style: null });\n }\n}\nexport class ToggleButtonView extends DOMWidgetView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('jupyter-button');\n this.el.classList.add('widget-toggle-button');\n this.listenTo(this.model, 'change:button_style', this.update_button_style);\n this.listenTo(this.model, 'change:tabbable', this.updateTabindex);\n this.set_button_style();\n this.update(); // Set defaults.\n }\n update_button_style() {\n this.update_mapped_classes(ToggleButtonView.class_map, 'button_style');\n }\n set_button_style() {\n this.set_mapped_classes(ToggleButtonView.class_map, 'button_style');\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if (this.model.get('value')) {\n this.el.classList.add('mod-active');\n }\n else {\n this.el.classList.remove('mod-active');\n }\n if (options === undefined || options.updated_view !== this) {\n this.el.disabled = this.model.get('disabled');\n this.el.setAttribute('tabbable', this.model.get('tabbable'));\n this.el.setAttribute('title', this.model.get('tooltip'));\n const description = this.model.get('description');\n const icon = this.model.get('icon');\n if (description.trim().length === 0 && icon.trim().length === 0) {\n this.el.innerHTML = ' '; // Preserve button height\n }\n else {\n this.el.textContent = '';\n if (icon.trim().length) {\n const i = document.createElement('i');\n this.el.appendChild(i);\n i.classList.add('fa');\n i.classList.add('fa-' + icon);\n }\n this.el.appendChild(document.createTextNode(description));\n }\n }\n this.updateTabindex();\n return super.update();\n }\n events() {\n return {\n // Dictionary of events and their handlers.\n click: '_handle_click',\n };\n }\n /**\n * Handles and validates user input.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n _handle_click(event) {\n event.preventDefault();\n const value = this.model.get('value');\n this.model.set('value', !value, { updated_view: this });\n this.touch();\n }\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'button';\n }\n}\nToggleButtonView.class_map = {\n primary: ['mod-primary'],\n success: ['mod-success'],\n info: ['mod-info'],\n warning: ['mod-warning'],\n danger: ['mod-danger'],\n};\nexport class ValidModel extends BoolModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { readout: 'Invalid', _view_name: 'ValidView', _model_name: 'ValidModel' });\n }\n}\nexport class ValidView extends DescriptionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-valid');\n this.el.classList.add('widget-inline-hbox');\n this.icon = document.createElement('i');\n this.icon.classList.add('fa', 'fa-fw');\n this.el.appendChild(this.icon);\n this.readout = document.createElement('span');\n this.readout.classList.add('widget-valid-readout');\n this.readout.classList.add('widget-readout');\n this.el.appendChild(this.readout);\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n this.el.classList.remove('mod-valid');\n this.el.classList.remove('mod-invalid');\n this.icon.classList.remove('fa-check');\n this.icon.classList.remove('fa-times');\n this.readout.textContent = this.model.get('readout');\n if (this.model.get('value')) {\n this.el.classList.add('mod-valid');\n this.icon.classList.add('fa-check');\n }\n else {\n this.el.classList.add('mod-invalid');\n this.icon.classList.add('fa-times');\n }\n }\n}\n//# sourceMappingURL=widget_bool.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView, StyleModel } from '@jupyter-widgets/base';\nimport { CoreDOMWidgetModel } from './widget_core';\nimport { JUPYTER_CONTROLS_VERSION } from './version';\nexport class ButtonStyleModel extends StyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ButtonStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nButtonStyleModel.styleProperties = {\n button_color: {\n selector: '',\n attribute: 'background-color',\n default: null,\n },\n font_family: {\n selector: '',\n attribute: 'font-family',\n default: '',\n },\n font_size: {\n selector: '',\n attribute: 'font-size',\n default: '',\n },\n font_style: {\n selector: '',\n attribute: 'font-style',\n default: '',\n },\n font_variant: {\n selector: '',\n attribute: 'font-variant',\n default: '',\n },\n font_weight: {\n selector: '',\n attribute: 'font-weight',\n default: '',\n },\n text_color: {\n selector: '',\n attribute: 'color',\n default: '',\n },\n text_decoration: {\n selector: '',\n attribute: 'text-decoration',\n default: '',\n },\n};\nexport class ButtonModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { description: '', tooltip: '', disabled: false, icon: '', button_style: '', _view_name: 'ButtonView', _model_name: 'ButtonModel', style: null });\n }\n}\nexport class ButtonView extends DOMWidgetView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('jupyter-button');\n this.el.classList.add('widget-button');\n this.listenTo(this.model, 'change:button_style', this.update_button_style);\n this.listenTo(this.model, 'change:tabbable', this.updateTabindex);\n this.set_button_style();\n this.update(); // Set defaults.\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n this.el.disabled = this.model.get('disabled');\n this.updateTabindex();\n const tooltip = this.model.get('tooltip');\n const description = this.model.get('description');\n const icon = this.model.get('icon');\n this.el.setAttribute('title', tooltip !== null && tooltip !== void 0 ? tooltip : description);\n if (description.length || icon.length) {\n this.el.textContent = '';\n if (icon.length) {\n const i = document.createElement('i');\n i.classList.add('fa');\n i.classList.add(...icon\n .split(/[\\s]+/)\n .filter(Boolean)\n .map((v) => `fa-${v}`));\n if (description.length === 0) {\n i.classList.add('center');\n }\n this.el.appendChild(i);\n }\n this.el.appendChild(document.createTextNode(description));\n }\n return super.update();\n }\n update_button_style() {\n this.update_mapped_classes(ButtonView.class_map, 'button_style');\n }\n set_button_style() {\n this.set_mapped_classes(ButtonView.class_map, 'button_style');\n }\n /**\n * Dictionary of events and handlers\n */\n events() {\n // TODO: return typing not needed in Typescript later than 1.8.x\n // See http://stackoverflow.com/questions/22077023/why-cant-i-indirectly-return-an-object-literal-to-satisfy-an-index-signature-re and https://github.com/Microsoft/TypeScript/pull/7029\n return { click: '_handle_click' };\n }\n /**\n * Handles when the button is clicked.\n */\n _handle_click(event) {\n event.preventDefault();\n this.send({ event: 'click' });\n }\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'button';\n }\n}\nButtonView.class_map = {\n primary: ['mod-primary'],\n success: ['mod-success'],\n info: ['mod-info'],\n warning: ['mod-warning'],\n danger: ['mod-danger'],\n};\n//# sourceMappingURL=widget_button.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView, unpack_models, ViewList, JupyterLuminoPanelWidget, reject, } from '@jupyter-widgets/base';\nimport { CoreDOMWidgetModel } from './widget_core';\nimport { ArrayExt } from '@lumino/algorithm';\nimport { MessageLoop } from '@lumino/messaging';\nimport { Widget } from '@lumino/widgets';\nimport $ from 'jquery';\nexport class BoxModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'BoxView', _model_name: 'BoxModel', children: [], box_style: '' });\n }\n}\nBoxModel.serializers = Object.assign(Object.assign({}, CoreDOMWidgetModel.serializers), { children: { deserialize: unpack_models } });\nexport class HBoxModel extends BoxModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'HBoxView', _model_name: 'HBoxModel' });\n }\n}\nexport class VBoxModel extends BoxModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'VBoxView', _model_name: 'VBoxModel' });\n }\n}\nexport class BoxView extends DOMWidgetView {\n _createElement(tagName) {\n this.luminoWidget = new JupyterLuminoPanelWidget({ view: this });\n return this.luminoWidget.node;\n }\n _setElement(el) {\n if (this.el || el !== this.luminoWidget.node) {\n // Boxes don't allow setting the element beyond the initial creation.\n throw new Error('Cannot reset the DOM element.');\n }\n this.el = this.luminoWidget.node;\n this.$el = $(this.luminoWidget.node);\n }\n initialize(parameters) {\n super.initialize(parameters);\n this.children_views = new ViewList(this.add_child_model, null, this);\n this.listenTo(this.model, 'change:children', this.update_children);\n this.listenTo(this.model, 'change:box_style', this.update_box_style);\n this.luminoWidget.addClass('jupyter-widgets');\n this.luminoWidget.addClass('widget-container');\n this.luminoWidget.addClass('widget-box');\n }\n render() {\n super.render();\n this.update_children();\n this.set_box_style();\n }\n update_children() {\n var _a;\n (_a = this.children_views) === null || _a === void 0 ? void 0 : _a.update(this.model.get('children')).then((views) => {\n // Notify all children that their sizes may have changed.\n views.forEach((view) => {\n MessageLoop.postMessage(view.luminoWidget, Widget.ResizeMessage.UnknownSize);\n });\n });\n }\n update_box_style() {\n this.update_mapped_classes(BoxView.class_map, 'box_style');\n }\n set_box_style() {\n this.set_mapped_classes(BoxView.class_map, 'box_style');\n }\n add_child_model(model) {\n // we insert a dummy element so the order is preserved when we add\n // the rendered content later.\n const dummy = new Widget();\n this.luminoWidget.addWidget(dummy);\n return this.create_child_view(model)\n .then((view) => {\n // replace the dummy widget with the new one.\n const i = ArrayExt.firstIndexOf(this.luminoWidget.widgets, dummy);\n this.luminoWidget.insertWidget(i, view.luminoWidget);\n dummy.dispose();\n return view;\n })\n .catch(reject('Could not add child view to box', true));\n }\n remove() {\n this.children_views = null;\n super.remove();\n }\n}\nBoxView.class_map = {\n success: ['alert', 'alert-success'],\n info: ['alert', 'alert-info'],\n warning: ['alert', 'alert-warning'],\n danger: ['alert', 'alert-danger'],\n};\nexport class HBoxView extends BoxView {\n /**\n * Public constructor\n */\n initialize(parameters) {\n super.initialize(parameters);\n this.luminoWidget.addClass('widget-hbox');\n }\n}\nexport class VBoxView extends BoxView {\n /**\n * Public constructor\n */\n initialize(parameters) {\n super.initialize(parameters);\n this.luminoWidget.addClass('widget-vbox');\n }\n}\nexport class GridBoxView extends BoxView {\n /**\n * Public constructor\n */\n initialize(parameters) {\n super.initialize(parameters);\n this.luminoWidget.addClass('widget-gridbox');\n // display needn't be set to flex and grid\n this.luminoWidget.removeClass('widget-box');\n }\n}\nexport class GridBoxModel extends BoxModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'GridBoxView', _model_name: 'GridBoxModel' });\n }\n}\n//# sourceMappingURL=widget_box.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView } from '@jupyter-widgets/base';\nimport { CoreDOMWidgetModel } from './widget_core';\nexport class ImageModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ImageModel', _view_name: 'ImageView', format: 'png', width: '', height: '', value: new DataView(new ArrayBuffer(0)) });\n }\n}\nImageModel.serializers = Object.assign(Object.assign({}, CoreDOMWidgetModel.serializers), { value: {\n serialize: (value) => {\n return new DataView(value.buffer.slice(0));\n },\n } });\nexport class ImageView extends DOMWidgetView {\n render() {\n /**\n * Called when view is rendered.\n */\n super.render();\n this.luminoWidget.addClass('jupyter-widgets');\n this.luminoWidget.addClass('widget-image');\n this.update(); // Set defaults.\n }\n update() {\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n let url;\n const format = this.model.get('format');\n const value = this.model.get('value');\n if (format !== 'url') {\n const blob = new Blob([value], {\n type: `image/${this.model.get('format')}`,\n });\n url = URL.createObjectURL(blob);\n }\n else {\n url = new TextDecoder('utf-8').decode(value.buffer);\n }\n // Clean up the old objectURL\n const oldurl = this.el.src;\n this.el.src = url;\n if (oldurl) {\n URL.revokeObjectURL(oldurl);\n }\n const width = this.model.get('width');\n if (width !== undefined && width.length > 0) {\n this.el.setAttribute('width', width);\n }\n else {\n this.el.removeAttribute('width');\n }\n const height = this.model.get('height');\n if (height !== undefined && height.length > 0) {\n this.el.setAttribute('height', height);\n }\n else {\n this.el.removeAttribute('height');\n }\n return super.update();\n }\n remove() {\n if (this.el.src) {\n URL.revokeObjectURL(this.el.src);\n }\n super.remove();\n }\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'img';\n }\n}\n//# sourceMappingURL=widget_image.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView } from '@jupyter-widgets/base';\nimport { CoreDOMWidgetModel } from './widget_core';\nexport class VideoModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'VideoModel', _view_name: 'VideoView', format: 'mp4', width: '', height: '', autoplay: true, loop: true, controls: true, value: new DataView(new ArrayBuffer(0)) });\n }\n}\nVideoModel.serializers = Object.assign(Object.assign({}, CoreDOMWidgetModel.serializers), { value: {\n serialize: (value) => {\n return new DataView(value.buffer.slice(0));\n },\n } });\nexport class VideoView extends DOMWidgetView {\n render() {\n /**\n * Called when view is rendered.\n */\n super.render();\n this.luminoWidget.addClass('jupyter-widgets');\n this.luminoWidget.addClass('widget-image');\n this.update(); // Set defaults.\n }\n update() {\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n let url;\n const format = this.model.get('format');\n const value = this.model.get('value');\n if (format !== 'url') {\n const blob = new Blob([value], {\n type: `video/${this.model.get('format')}`,\n });\n url = URL.createObjectURL(blob);\n }\n else {\n url = new TextDecoder('utf-8').decode(value.buffer);\n }\n // Clean up the old objectURL\n const oldurl = this.el.src;\n this.el.src = url;\n if (oldurl) {\n URL.revokeObjectURL(oldurl);\n }\n // Height and width\n const width = this.model.get('width');\n if (width !== undefined && width.length > 0) {\n this.el.setAttribute('width', width);\n }\n else {\n this.el.removeAttribute('width');\n }\n const height = this.model.get('height');\n if (height !== undefined && height.length > 0) {\n this.el.setAttribute('height', height);\n }\n else {\n this.el.removeAttribute('height');\n }\n // Video attributes\n this.el.loop = this.model.get('loop');\n this.el.autoplay = this.model.get('autoplay');\n this.el.controls = this.model.get('controls');\n return super.update();\n }\n remove() {\n if (this.el.src) {\n URL.revokeObjectURL(this.el.src);\n }\n super.remove();\n }\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'video';\n }\n}\n//# sourceMappingURL=widget_video.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView } from '@jupyter-widgets/base';\nimport { CoreDOMWidgetModel } from './widget_core';\nexport class AudioModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'AudioModel', _view_name: 'AudioView', format: 'mp3', autoplay: true, loop: true, controls: true, value: new DataView(new ArrayBuffer(0)) });\n }\n}\nAudioModel.serializers = Object.assign(Object.assign({}, CoreDOMWidgetModel.serializers), { value: {\n serialize: (value) => {\n return new DataView(value.buffer.slice(0));\n },\n } });\nexport class AudioView extends DOMWidgetView {\n render() {\n /**\n * Called when view is rendered.\n */\n super.render();\n this.luminoWidget.addClass('jupyter-widgets');\n this.update(); // Set defaults.\n }\n update() {\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n let url;\n const format = this.model.get('format');\n const value = this.model.get('value');\n if (format !== 'url') {\n const blob = new Blob([value], {\n type: `audio/${this.model.get('format')}`,\n });\n url = URL.createObjectURL(blob);\n }\n else {\n url = new TextDecoder('utf-8').decode(value.buffer);\n }\n // Clean up the old objectURL\n const oldurl = this.el.src;\n this.el.src = url;\n if (oldurl) {\n URL.revokeObjectURL(oldurl);\n }\n // Audio attributes\n this.el.loop = this.model.get('loop');\n this.el.autoplay = this.model.get('autoplay');\n this.el.controls = this.model.get('controls');\n return super.update();\n }\n remove() {\n if (this.el.src) {\n URL.revokeObjectURL(this.el.src);\n }\n super.remove();\n }\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'audio';\n }\n}\n//# sourceMappingURL=widget_audio.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDescriptionModel } from './widget_core';\nimport { DescriptionView } from './widget_description';\nimport { uuid } from './utils';\nconst named_colors = {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgrey: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkslategrey: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dimgrey: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n grey: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n indianred: '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgreen: '#90ee90',\n lightgray: '#d3d3d3',\n lightgrey: '#d3d3d3',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightslategrey: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370db',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#db7093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n slategrey: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32',\n};\nexport class ColorPickerModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: 'black', concise: false, _model_name: 'ColorPickerModel', _view_name: 'ColorPickerView' });\n }\n}\nexport class ColorPickerView extends DescriptionView {\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-colorpicker');\n this._color_container = document.createElement('div');\n this._color_container.className =\n 'widget-inline-hbox widget-colorpicker-input';\n this.el.appendChild(this._color_container);\n this._textbox = document.createElement('input');\n this._textbox.setAttribute('type', 'text');\n this._textbox.id = this.label.htmlFor = uuid();\n this._color_container.appendChild(this._textbox);\n this._textbox.value = this.model.get('value');\n this._colorpicker = document.createElement('input');\n this._colorpicker.setAttribute('type', 'color');\n this._color_container.appendChild(this._colorpicker);\n this.listenTo(this.model, 'change:value', this._update_value);\n this.listenTo(this.model, 'change:concise', this._update_concise);\n this._update_concise();\n this._update_value();\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if (options === undefined || options.updated_view != this) {\n const disabled = this.model.get('disabled');\n this._textbox.disabled = disabled;\n this._colorpicker.disabled = disabled;\n }\n return super.update();\n }\n events() {\n // Typescript doesn't understand that these functions are called, so we\n // specifically use them here so it knows they are being used.\n void this._picker_change;\n void this._text_change;\n return {\n 'change [type=\"color\"]': '_picker_change',\n 'change [type=\"text\"]': '_text_change',\n };\n }\n _update_value() {\n const value = this.model.get('value');\n this._colorpicker.value = color2hex(value);\n this._textbox.value = value;\n }\n _update_concise() {\n const concise = this.model.get('concise');\n if (concise) {\n this.el.classList.add('concise');\n this._textbox.style.display = 'none';\n }\n else {\n this.el.classList.remove('concise');\n this._textbox.style.display = '';\n }\n }\n _picker_change() {\n this.model.set('value', this._colorpicker.value);\n this.touch();\n }\n _text_change() {\n const value = this._validate_color(this._textbox.value, this.model.get('value'));\n this.model.set('value', value);\n this.touch();\n }\n _validate_color(color, fallback) {\n return color.match(/#[a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?$/) ||\n named_colors[color.toLowerCase()]\n ? color\n : fallback;\n }\n}\n/*\n * From a valid html color (named color, 6-digits or 3-digits hex format)\n * return a 6-digits hexadecimal color #rrggbb.\n */\nfunction color2hex(color) {\n return named_colors[color.toLowerCase()] || rgb3_to_rgb6(color);\n}\nfunction rgb3_to_rgb6(rgb) {\n if (rgb.length === 7) {\n return rgb;\n }\n else {\n return ('#' +\n rgb.charAt(1) +\n rgb.charAt(1) +\n rgb.charAt(2) +\n rgb.charAt(2) +\n rgb.charAt(3) +\n rgb.charAt(3));\n }\n}\n//# sourceMappingURL=widget_color.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DescriptionView } from './widget_description';\nimport { CoreDescriptionModel } from './widget_core';\nimport { uuid } from './utils';\nexport function serialize_date(value) {\n if (value === null) {\n return null;\n }\n else {\n return {\n year: value.getUTCFullYear(),\n month: value.getUTCMonth(),\n date: value.getUTCDate(),\n };\n }\n}\nexport function deserialize_date(value) {\n if (value === null) {\n return null;\n }\n else {\n const date = new Date();\n date.setUTCFullYear(value.year, value.month, value.date);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n}\nexport class DatePickerModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: null, _model_name: 'DatePickerModel', _view_name: 'DatePickerView' });\n }\n}\nDatePickerModel.serializers = Object.assign(Object.assign({}, CoreDescriptionModel.serializers), { value: {\n serialize: serialize_date,\n deserialize: deserialize_date,\n } });\nexport class DatePickerView extends DescriptionView {\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-datepicker');\n this._datepicker = document.createElement('input');\n this._datepicker.setAttribute('type', 'date');\n this._datepicker.id = this.label.htmlFor = uuid();\n this.el.appendChild(this._datepicker);\n this.listenTo(this.model, 'change:value', this._update_value);\n this._update_value();\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if (options === undefined || options.updated_view !== this) {\n this._datepicker.disabled = this.model.get('disabled');\n }\n return super.update();\n }\n events() {\n // Typescript doesn't understand that these functions are called, so we\n // specifically use them here so it knows they are being used.\n void this._picker_change;\n void this._picker_focusout;\n return {\n 'change [type=\"date\"]': '_picker_change',\n 'focusout [type=\"date\"]': '_picker_focusout',\n };\n }\n _update_value() {\n const value = this.model.get('value');\n this._datepicker.valueAsDate = value;\n }\n _picker_change() {\n if (!this._datepicker.validity.badInput) {\n this.model.set('value', this._datepicker.valueAsDate);\n this.touch();\n }\n }\n _picker_focusout() {\n if (this._datepicker.validity.badInput) {\n this.model.set('value', null);\n this.touch();\n }\n }\n}\n//# sourceMappingURL=widget_date.js.map","// Copyright (c) Vidar Tonaas Fauske\n// Distributed under the terms of the Modified BSD License.\nimport { uuid } from './utils';\nimport { DescriptionView } from './widget_description';\nimport { CoreDescriptionModel } from './widget_core';\nconst PARSER = /(\\d\\d):(\\d\\d)(:(\\d\\d)(.(\\d{1,3})\\d*)?)?/;\nexport function serialize_time(value) {\n if (value === null) {\n return null;\n }\n else {\n const res = PARSER.exec(value);\n if (res === null) {\n return null;\n }\n return {\n hours: Math.min(23, parseInt(res[1], 10)),\n minutes: Math.min(59, parseInt(res[2], 10)),\n seconds: res[4] ? Math.min(59, parseInt(res[4], 10)) : 0,\n milliseconds: res[6] ? parseInt(res[6], 10) : 0,\n };\n }\n}\nexport function deserialize_time(value) {\n if (value === null) {\n return null;\n }\n else {\n const parts = [\n `${value.hours.toString().padStart(2, '0')}:${value.minutes\n .toString()\n .padStart(2, '0')}`,\n ];\n if (value.seconds > 0 || value.milliseconds > 0) {\n parts.push(`:${value.seconds.toString().padStart(2, '0')}`);\n if (value.milliseconds > 0) {\n parts.push(`.${value.milliseconds.toString().padStart(3, '0')}`);\n }\n }\n return parts.join('');\n }\n}\nexport const time_serializers = {\n serialize: serialize_time,\n deserialize: deserialize_time,\n};\nexport class TimeModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: TimeModel.model_name, _view_name: TimeModel.view_name, value: null, disabled: false, min: null, max: null, step: 60 });\n }\n}\nTimeModel.serializers = Object.assign(Object.assign({}, CoreDescriptionModel.serializers), { value: time_serializers, min: time_serializers, max: time_serializers });\nTimeModel.model_name = 'TimeModel';\nTimeModel.view_name = 'TimeView';\nexport class TimeView extends DescriptionView {\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-timepicker');\n this._timepicker = document.createElement('input');\n this._timepicker.setAttribute('type', 'time');\n this._timepicker.id = this.label.htmlFor = uuid();\n this.el.appendChild(this._timepicker);\n this.listenTo(this.model, 'change:value', this._update_value);\n this.listenTo(this.model, 'change', this.update2);\n this._update_value();\n this.update2();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update2(model, options) {\n if (options === undefined || options.updated_view !== this) {\n this._timepicker.disabled = this.model.get('disabled');\n this._timepicker.min = this.model.get('min');\n this._timepicker.max = this.model.get('max');\n this._timepicker.step = this.model.get('step');\n }\n return super.update();\n }\n events() {\n // Typescript doesn't understand that these functions are called, so we\n // specifically use them here so it knows they are being used.\n void this._picker_change;\n void this._picker_focusout;\n return {\n 'change [type=\"time\"]': '_picker_change',\n 'focusout [type=\"time\"]': '_picker_focusout',\n };\n }\n _update_value(model, newValue, options) {\n if (options === undefined || options.updated_view !== this) {\n this._timepicker.value = this.model.get('value');\n }\n }\n _picker_change() {\n if (!this._timepicker.validity.badInput) {\n this.model.set('value', this._timepicker.value, { updated_view: this });\n this.touch();\n }\n }\n _picker_focusout() {\n if (this._timepicker.validity.badInput) {\n this.model.set('value', null, { updated_view: this });\n this.touch();\n }\n }\n}\n//# sourceMappingURL=widget_time.js.map","// Copyright (c) Vidar Tonaas Fauske\n// Distributed under the terms of the Modified BSD License.\nimport { uuid } from './utils';\nimport { DescriptionView } from './widget_description';\nimport { CoreDescriptionModel } from './widget_core';\nimport { serialize_time } from './widget_time';\nexport function serialize_datetime(value) {\n if (value === null) {\n return null;\n }\n else {\n return {\n year: value.getUTCFullYear(),\n month: value.getUTCMonth(),\n date: value.getUTCDate(),\n hours: value.getUTCHours(),\n minutes: value.getUTCMinutes(),\n seconds: value.getUTCSeconds(),\n milliseconds: value.getUTCMilliseconds(),\n };\n }\n}\nexport function deserialize_datetime(value) {\n if (value === null) {\n return null;\n }\n else {\n const date = new Date();\n date.setUTCFullYear(value.year, value.month, value.date);\n date.setUTCHours(value.hours, value.minutes, value.seconds, value.milliseconds);\n return date;\n }\n}\nexport const datetime_serializers = {\n serialize: serialize_datetime,\n deserialize: deserialize_datetime,\n};\nexport class DatetimeModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'DatetimeModel', _view_name: 'DatetimeView', value: null, disabled: false, min: null, max: null });\n }\n}\nDatetimeModel.serializers = Object.assign(Object.assign({}, CoreDescriptionModel.serializers), { value: datetime_serializers, min: datetime_serializers, max: datetime_serializers });\nexport class DatetimeView extends DescriptionView {\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-datetimepicker');\n const test = document.createElement('input');\n test.type = 'datetime-local';\n if (test.type === 'text') {\n // No native support, split into date and time input:\n this._datepicker = document.createElement('input');\n this._datepicker.setAttribute('type', 'date');\n this._datepicker.id = this.label.htmlFor = uuid();\n this._timepicker = document.createElement('input');\n this._timepicker.setAttribute('type', 'time');\n this._timepicker.id = uuid();\n this.el.appendChild(this._datepicker);\n this.el.appendChild(this._timepicker);\n }\n else {\n this._datetimepicker = test;\n this._datetimepicker.id = this.label.htmlFor = uuid();\n this.el.appendChild(this._datetimepicker);\n }\n this.listenTo(this.model, 'change:value', this._update_value);\n this.listenTo(this.model, 'change', this.update2);\n this._update_value();\n this.update2();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update2(model, options) {\n if (options === undefined || options.updated_view !== this) {\n const min = this.model.get('min');\n const max = this.model.get('max');\n if (this._datetimepicker) {\n this._datetimepicker.disabled = this.model.get('disabled');\n this._datetimepicker.min = Private.dt_as_dt_string(min);\n this._datetimepicker.max = Private.dt_as_dt_string(max);\n }\n else {\n this._datepicker.disabled = this.model.get('disabled');\n this._datepicker.min = Private.dt_as_date_string(min);\n this._datepicker.max = Private.dt_as_date_string(max);\n this._timepicker.disabled = this.model.get('disabled');\n // Don't support min/max time here.\n // It could be added by enabling min time if value is min date,\n // and enabling max time if value is max date, but leave as\n // TODO for now.\n }\n }\n }\n events() {\n // Typescript doesn't understand that these functions are called, so we\n // specifically use them here so it knows they are being used.\n void this._picker_change;\n void this._picker_focusout;\n return {\n 'change [type=\"date\"]': '_picker_change',\n 'change [type=\"time\"]': '_picker_change',\n 'change [type=\"datetime-local\"]': '_picker_change',\n 'focusout [type=\"date\"]': '_picker_focusout',\n 'focusout [type=\"datetime-local\"]': '_picker_focusout',\n 'focusout [type=\"time\"]': '_picker_focusout',\n };\n }\n _update_value(model, newValue, options) {\n if (options === undefined || options.updated_view !== this) {\n const value = this.model.get('value');\n if (this._datetimepicker) {\n this._datetimepicker.value = Private.dt_as_dt_string(value);\n }\n else {\n this._datepicker.valueAsDate = value;\n this._timepicker.value = Private.dt_as_time_string(value);\n }\n }\n }\n _picker_change() {\n if (this._datetimepicker) {\n if (!this._datetimepicker.validity.badInput) {\n const v = this._datetimepicker.value;\n let date = v ? new Date(v) : null;\n if (date && isNaN(date.valueOf())) {\n date = null;\n }\n this.model.set('value', date, { updated_view: this });\n this.touch();\n }\n }\n else {\n if (!this._datepicker.validity.badInput &&\n !this._timepicker.validity.badInput) {\n const date = this._datepicker.valueAsDate;\n const time = serialize_time(this._timepicker.value);\n if (date !== null && time !== null) {\n // * Use local time *\n date.setHours(time.hours, time.minutes, time.seconds, time.milliseconds);\n }\n this.model.set('value', time !== null && date, { updated_view: this });\n this.touch();\n }\n }\n }\n _picker_focusout() {\n const pickers = [this._datetimepicker, this._datepicker, this._timepicker];\n if (pickers.some((p) => p && p.validity.badInput)) {\n this.model.set('value', null);\n this.touch();\n }\n }\n}\nvar Private;\n(function (Private) {\n // eslint-disable-next-line no-inner-declarations\n function dt_as_dt_string(value) {\n if (value === null) {\n return '';\n }\n // Replicate `toISOString()` but in local time zone:\n const parts = [];\n parts.push(`${value.getFullYear().toString().padStart(4, '0')}`);\n parts.push(`-${(value.getMonth() + 1).toString().padStart(2, '0')}`);\n parts.push(`-${value.getDate().toString().padStart(2, '0')}`);\n parts.push(`T${value.getHours().toString().padStart(2, '0')}`);\n parts.push(`:${value.getMinutes().toString().padStart(2, '0')}`);\n if (value.getSeconds() > 0 || value.getMilliseconds() > 0) {\n parts.push(`:${value.getSeconds().toString().padStart(2, '0')}`);\n if (value.getMilliseconds() > 0) {\n parts.push(`.${value.getMilliseconds().toString().padStart(3, '0')}`);\n }\n }\n return parts.join('');\n }\n Private.dt_as_dt_string = dt_as_dt_string;\n // eslint-disable-next-line no-inner-declarations\n function dt_as_date_string(value) {\n return value ? dt_as_dt_string(value).split('T', 2)[0] : '';\n }\n Private.dt_as_date_string = dt_as_date_string;\n // eslint-disable-next-line no-inner-declarations\n function dt_as_time_string(value) {\n return value ? dt_as_dt_string(value).split('T', 2)[1] : '';\n }\n Private.dt_as_time_string = dt_as_time_string;\n})(Private || (Private = {}));\nexport function serialize_naive(value) {\n if (value === null) {\n return null;\n }\n else {\n return {\n year: value.getFullYear(),\n month: value.getMonth(),\n date: value.getDate(),\n hours: value.getHours(),\n minutes: value.getMinutes(),\n seconds: value.getSeconds(),\n milliseconds: value.getMilliseconds(),\n };\n }\n}\nexport function deserialize_naive(value) {\n if (value === null) {\n return null;\n }\n else {\n const date = new Date();\n date.setFullYear(value.year, value.month, value.date);\n date.setHours(value.hours, value.minutes, value.seconds, value.milliseconds);\n return date;\n }\n}\nexport const naive_serializers = {\n serialize: serialize_naive,\n deserialize: deserialize_naive,\n};\nexport class NaiveDatetimeModel extends DatetimeModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'NaiveDatetimeModel' });\n }\n}\nNaiveDatetimeModel.serializers = Object.assign(Object.assign({}, CoreDescriptionModel.serializers), { value: naive_serializers, min: naive_serializers, max: naive_serializers });\n//# sourceMappingURL=widget_datetime.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDescriptionModel } from './widget_core';\nimport { DescriptionStyleModel, DescriptionView } from './widget_description';\nimport { DOMWidgetView } from '@jupyter-widgets/base';\nimport { uuid } from './utils';\nimport { format } from 'd3-format';\nimport noUiSlider from 'nouislider';\nexport class IntModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'IntModel', value: 0 });\n }\n}\nexport class BoundedIntModel extends IntModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'BoundedIntModel', max: 100, min: 0 });\n }\n}\nexport class SliderStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SliderStyleModel' });\n }\n}\nSliderStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { handle_color: {\n selector: '.noUi-handle',\n attribute: 'background-color',\n default: null,\n } });\nexport class IntSliderModel extends BoundedIntModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'IntSliderModel', _view_name: 'IntSliderView', step: 1, orientation: 'horizontal', readout: true, readout_format: 'd', continuous_update: true, style: null, disabled: false });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n this.on('change:readout_format', this.update_readout_format, this);\n this.update_readout_format();\n }\n update_readout_format() {\n this.readout_formatter = format(this.get('readout_format'));\n }\n}\nexport class IntRangeSliderModel extends IntSliderModel {\n}\nexport class BaseIntSliderView extends DescriptionView {\n constructor() {\n super(...arguments);\n this._parse_value = parseInt;\n }\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-slider');\n this.el.classList.add('widget-hslider');\n // Creating noUiSlider instance and scaffolding\n this.$slider = document.createElement('div');\n this.$slider.classList.add('slider');\n // Put the slider in a container\n this.slider_container = document.createElement('div');\n this.slider_container.classList.add('slider-container');\n this.slider_container.appendChild(this.$slider);\n this.el.appendChild(this.slider_container);\n this.readout = document.createElement('div');\n this.el.appendChild(this.readout);\n this.readout.classList.add('widget-readout');\n this.readout.contentEditable = 'true';\n this.readout.style.display = 'none';\n // noUiSlider constructor and event handlers\n this.createSlider();\n // Event handlers\n this.model.on('change:orientation', this.regenSlider, this);\n this.model.on('change:max', this.updateSliderOptions, this);\n this.model.on('change:min', this.updateSliderOptions, this);\n this.model.on('change:step', this.updateSliderOptions, this);\n this.model.on('change:value', this.updateSliderValue, this);\n // Set defaults.\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if (options === undefined || options.updated_view !== this) {\n if (this.model.get('disabled')) {\n this.readout.contentEditable = 'false';\n this.$slider.setAttribute('disabled', true);\n }\n else {\n this.readout.contentEditable = 'true';\n this.$slider.removeAttribute('disabled');\n }\n // Use the right CSS classes for vertical & horizontal sliders\n const orientation = this.model.get('orientation');\n if (orientation === 'vertical') {\n this.el.classList.remove('widget-hslider');\n this.el.classList.add('widget-vslider');\n this.el.classList.remove('widget-inline-hbox');\n this.el.classList.add('widget-inline-vbox');\n }\n else {\n this.el.classList.remove('widget-vslider');\n this.el.classList.add('widget-hslider');\n this.el.classList.remove('widget-inline-vbox');\n this.el.classList.add('widget-inline-hbox');\n }\n const readout = this.model.get('readout');\n if (readout) {\n this.readout.style.display = '';\n this.displayed.then(() => {\n if (this.readout_overflow()) {\n this.readout.classList.add('overflow');\n }\n else {\n this.readout.classList.remove('overflow');\n }\n });\n }\n else {\n this.readout.style.display = 'none';\n }\n }\n return super.update();\n }\n /**\n * Returns true if the readout box content overflows.\n */\n readout_overflow() {\n return this.readout.scrollWidth > this.readout.clientWidth;\n }\n events() {\n return {\n // Dictionary of events and their handlers.\n 'blur [contentEditable=true]': 'handleTextChange',\n 'keydown [contentEditable=true]': 'handleKeyDown',\n };\n }\n handleKeyDown(e) {\n if (e.keyCode === 13) {\n /* keyboard keycodes `enter` */\n e.preventDefault();\n this.handleTextChange();\n }\n }\n /**\n * Create a new noUiSlider object\n */\n createSlider() {\n const orientation = this.model.get('orientation');\n const behavior = this.model.get('behavior');\n noUiSlider.create(this.$slider, {\n start: this.model.get('value'),\n connect: true,\n behaviour: behavior,\n range: {\n min: this.model.get('min'),\n max: this.model.get('max'),\n },\n step: this.model.get('step'),\n animate: false,\n orientation: orientation,\n direction: orientation === 'horizontal' ? 'ltr' : 'rtl',\n format: {\n from: (value) => Number(value),\n to: (value) => this._validate_slide_value(value),\n },\n });\n // Using noUiSlider's 'update' and 'change' events.\n // See reference: https://refreshless.com/nouislider/events-callbacks/\n this.$slider.noUiSlider.on('update', (values, handle) => {\n this.handleSliderUpdateEvent(values, handle);\n });\n this.$slider.noUiSlider.on('change', (values, handle) => {\n this.handleSliderChangeEvent(values, handle);\n });\n }\n /**\n * Recreate/Regenerate a slider object\n * noUiSlider does not support in-place mutation of the orientation\n * state. We therefore need to destroy the current instance\n * and create a new one with the new properties. This is\n * handled in a separate function and has a dedicated event\n * handler.\n */\n regenSlider(e) {\n this.$slider.noUiSlider.destroy();\n this.createSlider();\n }\n /**\n * Validate the value of the slider before sending it to the back-end\n * and applying it to the other views on the page.\n */\n _validate_slide_value(x) {\n return Math.round(x);\n }\n}\nexport class IntRangeSliderView extends BaseIntSliderView {\n constructor() {\n super(...arguments);\n // range numbers can be separated by a hyphen, colon, or an en-dash\n this._range_regex = /^\\s*([+-]?\\d+)\\s*[-:–]\\s*([+-]?\\d+)/;\n }\n update(options) {\n super.update(options);\n const value = this.model.get('value');\n this.readout.textContent = this.valueToString(value);\n if (this.model.get('value') !== value) {\n this.model.set('value', value, { updated_view: this });\n this.touch();\n }\n }\n /**\n * Write value to a string\n */\n valueToString(value) {\n const format = this.model.readout_formatter;\n return value\n .map(function (v) {\n return format(v);\n })\n .join(' – ');\n }\n /**\n * Parse value from a string\n */\n stringToValue(text) {\n if (text === null) {\n return null;\n }\n // ranges can be expressed either 'val-val' or 'val:val' (+spaces)\n const match = this._range_regex.exec(text);\n if (match) {\n return [this._parse_value(match[1]), this._parse_value(match[2])];\n }\n else {\n return null;\n }\n }\n handleTextChange() {\n let value = this.stringToValue(this.readout.textContent);\n const vmin = this.model.get('min');\n const vmax = this.model.get('max');\n // reject input where NaN or lower > upper\n if (value === null ||\n isNaN(value[0]) ||\n isNaN(value[1]) ||\n value[0] > value[1]) {\n this.readout.textContent = this.valueToString(this.model.get('value'));\n }\n else {\n // clamp to range\n value = [\n Math.max(Math.min(value[0], vmax), vmin),\n Math.max(Math.min(value[1], vmax), vmin),\n ];\n if (value[0] !== this.model.get('value')[0] ||\n value[1] !== this.model.get('value')[1]) {\n this.readout.textContent = this.valueToString(value);\n this.model.set('value', value);\n this.touch();\n }\n else {\n this.readout.textContent = this.valueToString(this.model.get('value'));\n }\n }\n }\n /**\n * Called when the slider handle is released after dragging,\n * or by tapping or moving by the arrow keys.\n */\n handleSliderChangeEvent(values, handle) {\n const actual_value = values.map(this._validate_slide_value);\n this.readout.textContent = this.valueToString(actual_value);\n this.handleSliderChanged(values, handle);\n }\n /**\n * Called whilst the slider is dragged, tapped or moved by the arrow keys.\n */\n handleSliderUpdateEvent(values, handle) {\n const actual_value = values.map(this._validate_slide_value);\n this.readout.textContent = this.valueToString(actual_value);\n // Only persist the value while sliding if the continuous_update\n // trait is set to true.\n if (this.model.get('continuous_update')) {\n this.handleSliderChanged(values, handle);\n }\n }\n handleSliderChanged(values, handle) {\n const actual_value = values.map(this._validate_slide_value);\n this.model.set('value', actual_value, { updated_view: this });\n this.touch();\n }\n updateSliderOptions(e) {\n this.$slider.noUiSlider.updateOptions({\n start: this.model.get('value'),\n range: {\n min: this.model.get('min'),\n max: this.model.get('max'),\n },\n step: this.model.get('step'),\n });\n }\n updateSliderValue(model, _, options) {\n if (options.updated_view === this) {\n return;\n }\n const prev_value = this.$slider.noUiSlider.get();\n const value = this.model.get('value');\n if (prev_value[0] !== value[0] || prev_value[1] !== value[1]) {\n this.$slider.noUiSlider.set(value);\n }\n }\n}\nexport class IntSliderView extends BaseIntSliderView {\n update(options) {\n super.update(options);\n const min = this.model.get('min');\n const max = this.model.get('max');\n let value = this.model.get('value');\n if (value > max) {\n value = max;\n }\n else if (value < min) {\n value = min;\n }\n this.readout.textContent = this.valueToString(value);\n if (this.model.get('value') !== value) {\n this.model.set('value', value, { updated_view: this });\n this.touch();\n }\n }\n valueToString(value) {\n const format = this.model.readout_formatter;\n return format(value);\n }\n stringToValue(text) {\n return this._parse_value(text);\n }\n handleTextChange() {\n var _a;\n let value = this.stringToValue((_a = this.readout.textContent) !== null && _a !== void 0 ? _a : '');\n const vmin = this.model.get('min');\n const vmax = this.model.get('max');\n if (isNaN(value)) {\n this.readout.textContent = this.valueToString(this.model.get('value'));\n }\n else {\n value = Math.max(Math.min(value, vmax), vmin);\n if (value !== this.model.get('value')) {\n this.readout.textContent = this.valueToString(value);\n this.model.set('value', value);\n this.touch();\n }\n else {\n this.readout.textContent = this.valueToString(this.model.get('value'));\n }\n }\n }\n handleSliderChangeEvent(values, handle) {\n const actual_value = values.map(this._validate_slide_value);\n this.readout.textContent = this.valueToString(actual_value);\n this.handleSliderChanged(values, handle);\n }\n handleSliderUpdateEvent(values, handle) {\n const actual_value = values.map(this._validate_slide_value);\n this.readout.textContent = this.valueToString(actual_value);\n // Only persist the value while sliding if the continuous_update\n // trait is set to true.\n if (this.model.get('continuous_update')) {\n this.handleSliderChanged(values, handle);\n }\n }\n handleSliderChanged(values, handle) {\n const actual_value = this._validate_slide_value(values[handle]);\n const model_value = this.model.get('value');\n if (parseFloat(model_value) !== actual_value) {\n this.model.set('value', actual_value, { updated_view: this });\n this.touch();\n }\n }\n updateSliderOptions(e) {\n this.$slider.noUiSlider.updateOptions({\n start: this.model.get('value'),\n range: {\n min: this.model.get('min'),\n max: this.model.get('max'),\n },\n step: this.model.get('step'),\n });\n }\n updateSliderValue(model, _, options) {\n if (options.updated_view === this) {\n return;\n }\n const prev_value = this.$slider.noUiSlider.get();\n const value = this.model.get('value');\n if (prev_value !== value) {\n this.$slider.noUiSlider.set(value);\n }\n }\n}\nexport class IntTextModel extends IntModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'IntTextModel', _view_name: 'IntTextView', disabled: false, continuous_update: false });\n }\n}\nexport class BoundedIntTextModel extends BoundedIntModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'BoundedIntTextModel', _view_name: 'IntTextView', disabled: false, continuous_update: false, step: 1 });\n }\n}\nexport class IntTextView extends DescriptionView {\n constructor() {\n super(...arguments);\n this._parse_value = parseInt;\n this._default_step = '1';\n }\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-text');\n this.textbox = document.createElement('input');\n this.textbox.type = 'number';\n this.textbox.required = true;\n this.textbox.id = this.label.htmlFor = uuid();\n this.el.appendChild(this.textbox);\n this.update(); // Set defaults.\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if (options === undefined || options.updated_view !== this) {\n const value = this.model.get('value');\n if (this._parse_value(this.textbox.value) !== value) {\n this.textbox.value = value.toString();\n }\n if (this.model.get('min') !== undefined) {\n this.textbox.min = this.model.get('min');\n }\n if (this.model.get('max') !== undefined) {\n this.textbox.max = this.model.get('max');\n }\n if (this.model.get('step') !== undefined &&\n this.model.get('step') !== null) {\n this.textbox.step = this.model.get('step');\n }\n else {\n this.textbox.step = this._default_step;\n }\n this.textbox.disabled = this.model.get('disabled');\n }\n return super.update();\n }\n events() {\n return {\n 'keydown input': 'handleKeyDown',\n 'keypress input': 'handleKeypress',\n 'keyup input': 'handleKeyUp',\n 'input input': 'handleChanging',\n 'change input': 'handleChanged',\n };\n }\n /**\n * Handle key down\n *\n * Stop propagation so the event isn't sent to the application.\n */\n handleKeyDown(e) {\n e.stopPropagation();\n }\n /**\n * Handles key press\n */\n handleKeypress(e) {\n if (/[e,. ]/.test(String.fromCharCode(e.keyCode))) {\n e.preventDefault();\n }\n }\n /**\n * Handle key up\n */\n handleKeyUp(e) {\n if (e.altKey || e.ctrlKey) {\n return;\n }\n const target = e.target;\n /* remove invalid characters */\n let value = target.value;\n value = value.replace(/[e,.\\s]/g, '');\n if (value.length >= 1) {\n const subvalue = value.substr(1);\n value = value[0] + subvalue.replace(/[+-]/g, '');\n }\n if (target.value !== value) {\n e.preventDefault();\n target.value = value;\n }\n }\n /**\n * Call the submit handler if continuous update is true and we are not\n * obviously incomplete.\n */\n handleChanging(e) {\n const target = e.target;\n const trimmed = target.value.trim();\n if (trimmed === '' || ['-', '-.', '.', '+.', '+'].indexOf(trimmed) >= 0) {\n // incomplete number\n return;\n }\n if (this.model.get('continuous_update')) {\n this.handleChanged(e);\n }\n }\n /**\n * Applies validated input.\n */\n handleChanged(e) {\n const target = e.target;\n let numericalValue = this._parse_value(target.value);\n // If parse failed, reset value to value stored in model.\n if (isNaN(numericalValue)) {\n target.value = this.model.get('value');\n }\n else {\n // Handle both the unbounded and bounded case by\n // checking to see if the max/min properties are defined\n let boundedValue = numericalValue;\n if (this.model.get('max') !== undefined) {\n boundedValue = Math.min(this.model.get('max'), boundedValue);\n }\n if (this.model.get('min') !== undefined) {\n boundedValue = Math.max(this.model.get('min'), boundedValue);\n }\n if (boundedValue !== numericalValue) {\n target.value = boundedValue;\n numericalValue = boundedValue;\n }\n // Apply the value if it has changed.\n if (numericalValue !== this.model.get('value')) {\n this.model.set('value', numericalValue, { updated_view: this });\n this.touch();\n }\n }\n }\n}\nexport class ProgressStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ProgressStyleModel' });\n }\n}\nProgressStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { bar_color: {\n selector: '.progress-bar',\n attribute: 'background-color',\n default: null,\n } });\nexport class IntProgressModel extends BoundedIntModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'IntProgressModel', _view_name: 'ProgressView', orientation: 'horizontal', bar_style: '', style: null });\n }\n}\nexport class ProgressView extends DescriptionView {\n initialize(parameters) {\n super.initialize(parameters);\n this.listenTo(this.model, 'change:bar_style', this.update_bar_style);\n this.luminoWidget.addClass('jupyter-widgets');\n }\n render() {\n super.render();\n const orientation = this.model.get('orientation');\n const className = orientation === 'horizontal' ? 'widget-hprogress' : 'widget-vprogress';\n this.el.classList.add(className);\n this.progress = document.createElement('div');\n this.progress.classList.add('progress');\n this.progress.style.position = 'relative';\n this.el.appendChild(this.progress);\n this.bar = document.createElement('div');\n this.bar.classList.add('progress-bar');\n this.bar.style.position = 'absolute';\n this.bar.style.bottom = '0px';\n this.bar.style.left = '0px';\n this.progress.appendChild(this.bar);\n // Set defaults.\n this.update();\n this.set_bar_style();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n const value = this.model.get('value');\n const max = this.model.get('max');\n const min = this.model.get('min');\n const orientation = this.model.get('orientation');\n const percent = (100.0 * (value - min)) / (max - min);\n if (orientation === 'horizontal') {\n this.el.classList.remove('widget-inline-vbox');\n this.el.classList.remove('widget-vprogress');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-hprogress');\n this.bar.style.width = percent + '%';\n this.bar.style.height = '100%';\n }\n else {\n this.el.classList.remove('widget-inline-hbox');\n this.el.classList.remove('widget-hprogress');\n this.el.classList.add('widget-inline-vbox');\n this.el.classList.add('widget-vprogress');\n this.bar.style.width = '100%';\n this.bar.style.height = percent + '%';\n }\n return super.update();\n }\n update_bar_style() {\n this.update_mapped_classes(ProgressView.class_map, 'bar_style', this.bar);\n }\n set_bar_style() {\n this.set_mapped_classes(ProgressView.class_map, 'bar_style', this.bar);\n }\n}\nProgressView.class_map = {\n success: ['progress-bar-success'],\n info: ['progress-bar-info'],\n warning: ['progress-bar-warning'],\n danger: ['progress-bar-danger'],\n};\nexport class PlayModel extends BoundedIntModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'PlayModel', _view_name: 'PlayView', repeat: false, playing: false, show_repeat: true, interval: 100, step: 1, disabled: false });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n }\n loop() {\n if (!this.get('playing')) {\n return;\n }\n const next_value = this.get('value') + this.get('step');\n if (next_value <= this.get('max')) {\n this.set('value', next_value);\n this.schedule_next();\n }\n else {\n if (this.get('repeat')) {\n this.set('value', this.get('min'));\n this.schedule_next();\n }\n else {\n this.pause();\n }\n }\n this.save_changes();\n }\n schedule_next() {\n this._timerId = window.setTimeout(this.loop.bind(this), this.get('interval'));\n }\n stop() {\n this.pause();\n this.set('value', this.get('min'));\n this.save_changes();\n }\n pause() {\n window.clearTimeout(this._timerId);\n this._timerId = undefined;\n this.set('playing', false);\n this.save_changes();\n }\n animate() {\n if (this._timerId !== undefined) {\n return;\n }\n if (this.get('value') === this.get('max')) {\n // if the value is at the end, reset it first, and then schedule the next\n this.set('value', this.get('min'));\n this.schedule_next();\n this.save_changes();\n }\n else {\n // otherwise directly start with the next value\n // loop will call save_changes in this case\n this.loop();\n }\n this.save_changes();\n }\n play() {\n this.set('playing', !this.get('playing'));\n this.save_changes();\n }\n repeat() {\n this.set('repeat', !this.get('repeat'));\n this.save_changes();\n }\n}\nexport class PlayView extends DOMWidgetView {\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n this.el.classList.add('widget-play');\n this.playPauseButton = document.createElement('button');\n this.stopButton = document.createElement('button');\n this.repeatButton = document.createElement('button');\n this.playPauseButton.className = 'jupyter-button';\n this.stopButton.className = 'jupyter-button';\n this.repeatButton.className = 'jupyter-button';\n this.el.appendChild(this.playPauseButton); // Toggle button with playing\n this.el.appendChild(this.stopButton); // Disable if not playing\n this.el.appendChild(this.repeatButton); // Always enabled, but may be hidden\n const playIcon = document.createElement('i');\n playIcon.className = 'fa fa-play';\n this.playPauseButton.appendChild(playIcon);\n const stopIcon = document.createElement('i');\n stopIcon.className = 'fa fa-stop';\n this.stopButton.appendChild(stopIcon);\n const repeatIcon = document.createElement('i');\n repeatIcon.className = 'fa fa-retweet';\n this.repeatButton.appendChild(repeatIcon);\n this.playPauseButton.onclick = this.model.play.bind(this.model);\n this.stopButton.onclick = this.model.stop.bind(this.model);\n this.repeatButton.onclick = this.model.repeat.bind(this.model);\n this.listenTo(this.model, 'change:playing', this.onPlayingChanged);\n this.listenTo(this.model, 'change:repeat', this.updateRepeat);\n this.listenTo(this.model, 'change:show_repeat', this.updateRepeat);\n this.updatePlaying();\n this.updateRepeat();\n this.update();\n }\n update() {\n const disabled = this.model.get('disabled');\n this.playPauseButton.disabled = disabled;\n this.stopButton.disabled = disabled;\n this.repeatButton.disabled = disabled;\n this.updatePlaying();\n }\n onPlayingChanged() {\n this.updatePlaying();\n const previous = this.model.previous('playing');\n const current = this.model.get('playing');\n if (!previous && current) {\n this.model.animate();\n }\n else {\n this.model.pause();\n }\n }\n updatePlaying() {\n const playing = this.model.get('playing');\n const icon = this.playPauseButton.getElementsByTagName('i')[0];\n if (playing) {\n icon.className = 'fa fa-pause';\n }\n else {\n icon.className = 'fa fa-play';\n }\n }\n updateRepeat() {\n const repeat = this.model.get('repeat');\n this.repeatButton.style.display = this.model.get('show_repeat')\n ? this.playPauseButton.style.display\n : 'none';\n if (repeat) {\n this.repeatButton.classList.add('mod-active');\n }\n else {\n this.repeatButton.classList.remove('mod-active');\n }\n }\n}\n//# sourceMappingURL=widget_int.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDescriptionModel } from './widget_core';\nimport { BaseIntSliderView, IntRangeSliderView, IntSliderView, IntTextView, } from './widget_int';\nimport { format } from 'd3-format';\nimport noUiSlider from 'nouislider';\nexport class FloatModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'FloatModel', value: 0 });\n }\n}\nexport class BoundedFloatModel extends FloatModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'BoundedFloatModel', max: 100.0, min: 0.0 });\n }\n}\nexport class FloatSliderModel extends BoundedFloatModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'FloatSliderModel', _view_name: 'FloatSliderView', step: 1.0, orientation: 'horizontal', _range: false, readout: true, readout_format: '.2f', slider_color: null, continuous_update: true, disabled: false });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n this.on('change:readout_format', this.update_readout_format, this);\n this.update_readout_format();\n }\n update_readout_format() {\n this.readout_formatter = format(this.get('readout_format'));\n }\n}\nexport class FloatLogSliderModel extends BoundedFloatModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'FloatLogSliderModel', _view_name: 'FloatLogSliderView', step: 0.1, orientation: 'horizontal', _range: false, readout: true, readout_format: '.3g', slider_color: null, continuous_update: true, disabled: false, base: 10, value: 1.0, min: 0, max: 4 });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n this.on('change:readout_format', this.update_readout_format, this);\n this.update_readout_format();\n }\n update_readout_format() {\n this.readout_formatter = format(this.get('readout_format'));\n }\n}\nexport class FloatRangeSliderModel extends FloatSliderModel {\n}\nexport class FloatSliderView extends IntSliderView {\n constructor() {\n super(...arguments);\n this._parse_value = parseFloat;\n }\n /**\n * Validate the value of the slider before sending it to the back-end\n * and applying it to the other views on the page.\n */\n _validate_slide_value(x) {\n return x;\n }\n}\nexport class FloatLogSliderView extends BaseIntSliderView {\n constructor() {\n super(...arguments);\n this._parse_value = parseFloat;\n }\n update(options) {\n super.update(options);\n const value = this.model.get('value');\n this.readout.textContent = this.valueToString(value);\n }\n /**\n * Convert from value to exponent\n *\n * @param value the widget value\n * @returns the log-value between the min/max exponents\n */\n logCalc(value) {\n const min = this.model.get('min');\n const max = this.model.get('max');\n const base = this.model.get('base');\n let log_value = Math.log(value) / Math.log(base);\n if (log_value > max) {\n log_value = max;\n }\n else if (log_value < min) {\n log_value = min;\n }\n return log_value;\n }\n createSlider() {\n var _a;\n const orientation = this.model.get('orientation');\n const behavior = this.model.get('behavior');\n noUiSlider.create(this.$slider, {\n start: this.logCalc(this.model.get('value')),\n behaviour: behavior,\n range: {\n min: this.model.get('min'),\n max: this.model.get('max'),\n },\n step: (_a = this.model.get('step')) !== null && _a !== void 0 ? _a : undefined,\n animate: false,\n orientation: orientation,\n direction: orientation === 'horizontal' ? 'ltr' : 'rtl',\n format: {\n from: (value) => Number(value),\n to: (value) => value,\n },\n });\n // Using noUiSlider's 'update' and 'change' events.\n // See reference: https://refreshless.com/nouislider/events-callbacks/\n this.$slider.noUiSlider.on('update', (values, handle) => {\n this.handleSliderUpdateEvent(values, handle);\n });\n this.$slider.noUiSlider.on('change', (values, handle) => {\n this.handleSliderChangeEvent(values, handle);\n });\n }\n /**\n * Write value to a string\n */\n valueToString(value) {\n const format = this.model.readout_formatter;\n return format(value);\n }\n /**\n * Parse value from a string\n */\n stringToValue(text) {\n return text === null ? NaN : this._parse_value(text);\n }\n /**\n * this handles the entry of text into the contentEditable label first, the\n * value is checked if it contains a parseable value then it is clamped\n * within the min-max range of the slider finally, the model is updated if\n * the value is to be changed\n *\n * if any of these conditions are not met, the text is reset\n */\n handleTextChange() {\n let value = this.stringToValue(this.readout.textContent);\n const vmin = this.model.get('min');\n const vmax = this.model.get('max');\n const base = this.model.get('base');\n if (isNaN(value)) {\n this.readout.textContent = this.valueToString(this.model.get('value'));\n }\n else {\n value = Math.max(Math.min(value, Math.pow(base, vmax)), Math.pow(base, vmin));\n if (value !== this.model.get('value')) {\n this.readout.textContent = this.valueToString(value);\n this.model.set('value', value);\n this.touch();\n }\n else {\n this.readout.textContent = this.valueToString(this.model.get('value'));\n }\n }\n }\n /**\n * Called whilst the slider is dragged, tapped or moved by the arrow keys.\n */\n handleSliderUpdateEvent(values, handle) {\n const base = this.model.get('base');\n const actual_value = Math.pow(base, this._validate_slide_value(values[0]));\n this.readout.textContent = this.valueToString(actual_value);\n // Only persist the value while sliding if the continuous_update\n // trait is set to true.\n if (this.model.get('continuous_update')) {\n this.handleSliderChanged(values, handle);\n }\n }\n /**\n * Called when the slider handle is released after dragging,\n * or by tapping or moving by the arrow keys.\n */\n handleSliderChangeEvent(values, handle) {\n const base = this.model.get('base');\n const actual_value = Math.pow(base, this._validate_slide_value(values[0]));\n this.readout.textContent = this.valueToString(actual_value);\n this.handleSliderChanged(values, handle);\n }\n /**\n * Called when the slider value has changed.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n handleSliderChanged(values, handle) {\n if (this._updating_slider) {\n return;\n }\n const base = this.model.get('base');\n const actual_value = Math.pow(base, this._validate_slide_value(values[0]));\n this.model.set('value', actual_value, { updated_view: this });\n this.touch();\n }\n updateSliderValue(model, value, options) {\n if (options.updated_view === this) {\n return;\n }\n const log_value = this.logCalc(this.model.get('value'));\n this.$slider.noUiSlider.set(log_value);\n }\n updateSliderOptions(e) {\n this.$slider.noUiSlider.updateOptions({\n start: this.logCalc(this.model.get('value')),\n range: {\n min: this.model.get('min'),\n max: this.model.get('max'),\n },\n step: this.model.get('step'),\n });\n }\n _validate_slide_value(x) {\n return x;\n }\n}\nexport class FloatRangeSliderView extends IntRangeSliderView {\n constructor() {\n super(...arguments);\n this._parse_value = parseFloat;\n // matches: whitespace?, float, whitespace?, (hyphen, colon, or en-dash), whitespace?, float\n this._range_regex = /^\\s*([+-]?(?:\\d*\\.?\\d+|\\d+\\.)(?:[eE][-:]?\\d+)?)\\s*[-:–]\\s*([+-]?(?:\\d*\\.?\\d+|\\d+\\.)(?:[eE][+-]?\\d+)?)/;\n }\n /**\n * Validate the value of the slider before sending it to the back-end\n * and applying it to the other views on the page.\n */\n _validate_slide_value(x) {\n return x;\n }\n}\nexport class FloatTextModel extends FloatModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'FloatTextModel', _view_name: 'FloatTextView', disabled: false, continuous_update: false });\n }\n}\nexport class BoundedFloatTextModel extends BoundedFloatModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'BoundedFloatTextModel', _view_name: 'FloatTextView', disabled: false, continuous_update: false, step: 0.1 });\n }\n}\nexport class FloatTextView extends IntTextView {\n constructor() {\n super(...arguments);\n this._parse_value = parseFloat;\n this._default_step = 'any';\n }\n /**\n * Handle key press\n */\n handleKeypress(e) {\n // Overwrite IntTextView's handleKeypress\n // which prevents decimal points.\n e.stopPropagation();\n }\n /**\n * Handle key up\n */\n handleKeyUp(e) {\n // Overwrite IntTextView's handleKeyUp\n // which prevents decimal points.\n }\n}\nexport class FloatProgressModel extends BoundedFloatModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'FloatProgressModel', _view_name: 'ProgressView', orientation: 'horizontal', bar_style: '', style: null });\n }\n}\n//# sourceMappingURL=widget_float.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDOMWidgetModel } from './widget_core';\nimport { DOMWidgetView, unpack_models, ViewList, JupyterLuminoPanelWidget, reject, } from '@jupyter-widgets/base';\nimport { Widget, Panel } from '@lumino/widgets';\nimport { ArrayExt } from '@lumino/algorithm';\nimport * as utils from './utils';\nimport $ from 'jquery';\nexport class ControllerButtonModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ControllerButtonModel', _view_name: 'ControllerButtonView', value: 0.0, pressed: false });\n }\n}\n/**\n * Very simple view for a gamepad button.\n */\nexport class ControllerButtonView extends DOMWidgetView {\n render() {\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-controller-button');\n this.el.style.width = 'fit-content';\n this.support = document.createElement('div');\n this.support.style.position = 'relative';\n this.support.style.margin = '1px';\n this.support.style.width = '16px';\n this.support.style.height = '16px';\n this.support.style.border = '1px solid black';\n this.support.style.background = 'lightgray';\n this.el.appendChild(this.support);\n this.bar = document.createElement('div');\n this.bar.style.position = 'absolute';\n this.bar.style.width = '100%';\n this.bar.style.bottom = '0px';\n this.bar.style.background = 'gray';\n this.support.appendChild(this.bar);\n this.update();\n this.label = document.createElement('div');\n this.label.textContent = this.model.get('description');\n this.label.style.textAlign = 'center';\n this.el.appendChild(this.label);\n }\n update() {\n this.bar.style.height = 100 * this.model.get('value') + '%';\n }\n}\nexport class ControllerAxisModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ControllerAxisModel', _view_name: 'ControllerAxisView', value: 0.0 });\n }\n}\n/**\n * Very simple view for a gamepad axis.\n */\nexport class ControllerAxisView extends DOMWidgetView {\n render() {\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-controller-axis');\n this.el.style.width = '16px';\n this.el.style.padding = '4px';\n this.support = document.createElement('div');\n this.support.style.position = 'relative';\n this.support.style.margin = '1px';\n this.support.style.width = '4px';\n this.support.style.height = '64px';\n this.support.style.border = '1px solid black';\n this.support.style.background = 'lightgray';\n this.bullet = document.createElement('div');\n this.bullet.style.position = 'absolute';\n this.bullet.style.margin = '-3px';\n this.bullet.style.boxSizing = 'unset';\n this.bullet.style.width = '10px';\n this.bullet.style.height = '10px';\n this.bullet.style.background = 'gray';\n this.label = document.createElement('div');\n this.label.textContent = this.model.get('description');\n this.label.style.textAlign = 'center';\n this.support.appendChild(this.bullet);\n this.el.appendChild(this.support);\n this.el.appendChild(this.label);\n this.update();\n }\n update() {\n this.bullet.style.top = 50 * (this.model.get('value') + 1) + '%';\n }\n}\nexport class ControllerModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ControllerModel', _view_name: 'ControllerView', index: 0, name: '', mapping: '', connected: false, timestamp: 0, buttons: [], axes: [] });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n if (navigator.getGamepads === void 0) {\n // Checks if the browser supports the gamepad API\n this.readout = 'This browser does not support gamepads.';\n console.error(this.readout);\n }\n else {\n // Start the wait loop, and listen to updates of the only\n // user-provided attribute, the gamepad index.\n this.readout = 'Connect gamepad and press any button.';\n if (this.get('connected')) {\n // No need to re-create Button and Axis widgets, re-use\n // the models provided by the backend which may already\n // be wired to other things.\n this.update_loop();\n }\n else {\n // Wait for a gamepad to be connected.\n this.wait_loop();\n }\n }\n }\n /**\n * Waits for a gamepad to be connected at the provided index.\n * Once one is connected, it will start the update loop, which\n * populates the update of axes and button values.\n */\n wait_loop() {\n const index = this.get('index');\n const pad = navigator.getGamepads()[index];\n if (pad) {\n this.setup(pad).then((controls) => {\n this.set(controls);\n this.save_changes();\n window.requestAnimationFrame(this.update_loop.bind(this));\n });\n }\n else {\n window.requestAnimationFrame(this.wait_loop.bind(this));\n }\n }\n /**\n * Given a native gamepad object, returns a promise for a dictionary of\n * controls, of the form\n * {\n * buttons: list of Button models,\n * axes: list of Axis models,\n * }\n */\n setup(pad) {\n // Set up the main gamepad attributes\n this.set({\n name: pad.id,\n mapping: pad.mapping,\n connected: pad.connected,\n timestamp: pad.timestamp,\n });\n // Create buttons and axes. When done, start the update loop\n return utils.resolvePromisesDict({\n buttons: Promise.all(pad.buttons.map((btn, index) => {\n return this._create_button_model(index);\n })),\n axes: Promise.all(pad.axes.map((axis, index) => {\n return this._create_axis_model(index);\n })),\n });\n }\n /**\n * Update axes and buttons values, until the gamepad is disconnected.\n * When the gamepad is disconnected, this.reset_gamepad is called.\n */\n update_loop() {\n const index = this.get('index');\n const id = this.get('name');\n const pad = navigator.getGamepads()[index];\n if (pad && index === pad.index && id === pad.id) {\n this.set({\n timestamp: pad.timestamp,\n connected: pad.connected,\n });\n this.save_changes();\n this.get('buttons').forEach(function (model, index) {\n model.set({\n value: pad.buttons[index].value,\n pressed: pad.buttons[index].pressed,\n });\n model.save_changes();\n });\n this.get('axes').forEach(function (model, index) {\n model.set('value', pad.axes[index]);\n model.save_changes();\n });\n window.requestAnimationFrame(this.update_loop.bind(this));\n }\n else {\n this.reset_gamepad();\n }\n }\n /**\n * Resets the gamepad attributes, and start the wait_loop.\n */\n reset_gamepad() {\n this.get('buttons').forEach(function (button) {\n button.close();\n });\n this.get('axes').forEach(function (axis) {\n axis.close();\n });\n this.set({\n name: '',\n mapping: '',\n connected: false,\n timestamp: 0.0,\n buttons: [],\n axes: [],\n });\n this.save_changes();\n window.requestAnimationFrame(this.wait_loop.bind(this));\n }\n /**\n * Creates a gamepad button widget.\n */\n _create_button_model(index) {\n return this.widget_manager\n .new_widget({\n model_name: 'ControllerButtonModel',\n model_module: '@jupyter-widgets/controls',\n model_module_version: this.get('_model_module_version'),\n view_name: 'ControllerButtonView',\n view_module: '@jupyter-widgets/controls',\n view_module_version: this.get('_view_module_version'),\n })\n .then(function (model) {\n model.set('description', index);\n return model;\n });\n }\n /**\n * Creates a gamepad axis widget.\n */\n _create_axis_model(index) {\n return this.widget_manager\n .new_widget({\n model_name: 'ControllerAxisModel',\n model_module: '@jupyter-widgets/controls',\n model_module_version: this.get('_model_module_version'),\n view_name: 'ControllerAxisView',\n view_module: '@jupyter-widgets/controls',\n view_module_version: this.get('_view_module_version'),\n })\n .then(function (model) {\n model.set('description', index);\n return model;\n });\n }\n}\nControllerModel.serializers = Object.assign(Object.assign({}, CoreDOMWidgetModel.serializers), { buttons: { deserialize: unpack_models }, axes: { deserialize: unpack_models } });\n/**\n * A simple view for a gamepad.\n */\nexport class ControllerView extends DOMWidgetView {\n _createElement(tagName) {\n this.luminoWidget = new JupyterLuminoPanelWidget({ view: this });\n return this.luminoWidget.node;\n }\n _setElement(el) {\n if (this.el || el !== this.luminoWidget.node) {\n // Boxes don't allow setting the element beyond the initial creation.\n throw new Error('Cannot reset the DOM element.');\n }\n this.el = this.luminoWidget.node;\n this.$el = $(this.luminoWidget.node);\n }\n initialize(parameters) {\n super.initialize(parameters);\n this.button_views = new ViewList(this.add_button, null, this);\n this.listenTo(this.model, 'change:buttons', (model, value) => {\n this.button_views.update(value);\n });\n this.axis_views = new ViewList(this.add_axis, null, this);\n this.listenTo(this.model, 'change:axes', (model, value) => {\n this.axis_views.update(value);\n });\n this.listenTo(this.model, 'change:name', this.update_label);\n }\n render() {\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-controller');\n this.label = document.createElement('div');\n this.el.appendChild(this.label);\n this.axis_box = new Panel();\n this.axis_box.node.style.display = 'flex';\n this.luminoWidget.addWidget(this.axis_box);\n this.button_box = new Panel();\n this.button_box.node.style.display = 'flex';\n this.luminoWidget.addWidget(this.button_box);\n this.button_views.update(this.model.get('buttons'));\n this.axis_views.update(this.model.get('axes'));\n this.update_label();\n }\n update_label() {\n this.label.textContent = this.model.get('name') || this.model.readout;\n }\n add_button(model) {\n // we insert a dummy element so the order is preserved when we add\n // the rendered content later.\n const dummy = new Widget();\n this.button_box.addWidget(dummy);\n return this.create_child_view(model)\n .then((view) => {\n // replace the dummy widget with the new one.\n const i = ArrayExt.firstIndexOf(this.button_box.widgets, dummy);\n this.button_box.insertWidget(i, view.luminoWidget);\n dummy.dispose();\n return view;\n })\n .catch(reject('Could not add child button view to controller', true));\n }\n add_axis(model) {\n // we insert a dummy element so the order is preserved when we add\n // the rendered content later.\n const dummy = new Widget();\n this.axis_box.addWidget(dummy);\n return this.create_child_view(model)\n .then((view) => {\n // replace the dummy widget with the new one.\n const i = ArrayExt.firstIndexOf(this.axis_box.widgets, dummy);\n this.axis_box.insertWidget(i, view.luminoWidget);\n dummy.dispose();\n return view;\n })\n .catch(reject('Could not add child axis view to controller', true));\n }\n remove() {\n super.remove();\n this.button_views.remove();\n this.axis_views.remove();\n }\n}\n//# sourceMappingURL=widget_controller.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDescriptionModel } from './widget_core';\nimport { DescriptionStyleModel, DescriptionView } from './widget_description';\nimport { uuid } from './utils';\nimport noUiSlider from 'nouislider';\nimport * as utils from './utils';\nexport class SelectionModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SelectionModel', index: '', _options_labels: [], disabled: false });\n }\n}\nexport class SelectionView extends DescriptionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render(); // Incl. setting some defaults.\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n super.update();\n // Disable listbox if needed\n if (this.listbox) {\n this.listbox.disabled = this.model.get('disabled');\n }\n // Set tabindex\n this.updateTabindex();\n this.updateTooltip();\n }\n updateTabindex() {\n if (!this.listbox) {\n return; // we might be constructing the parent\n }\n const tabbable = this.model.get('tabbable');\n if (tabbable === true) {\n this.listbox.setAttribute('tabIndex', '0');\n }\n else if (tabbable === false) {\n this.listbox.setAttribute('tabIndex', '-1');\n }\n else if (tabbable === null) {\n this.listbox.removeAttribute('tabIndex');\n }\n }\n updateTooltip() {\n if (!this.listbox)\n return; // we might be constructing the parent\n const title = this.model.get('tooltip');\n if (!title) {\n this.listbox.removeAttribute('title');\n }\n else if (this.model.get('description').length === 0) {\n this.listbox.setAttribute('title', title);\n }\n }\n}\nexport class DropdownModel extends SelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'DropdownModel', _view_name: 'DropdownView', button_style: '' });\n }\n}\n// TODO: Make a Lumino dropdown control, wrapped in DropdownView. Also, fix\n// bugs in keyboard handling. See\n// https://github.com/jupyter-widgets/ipywidgets/issues/1055 and\n// https://github.com/jupyter-widgets/ipywidgets/issues/1049\n// For now, we subclass SelectView to provide DropdownView\n// For the old code, see commit f68bfbc566f3a78a8f3350b438db8ed523ce3642\nexport class DropdownView extends SelectionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-dropdown');\n this.listbox = document.createElement('select');\n this.listbox.id = this.label.htmlFor = uuid();\n this.el.appendChild(this.listbox);\n this._updateOptions();\n this.update();\n }\n /**\n * Update the contents of this view\n */\n update(options) {\n // Debounce set calls from ourselves:\n if ((options === null || options === void 0 ? void 0 : options.updated_view) !== this) {\n const optsChanged = this.model.hasChanged('_options_labels');\n if (optsChanged) {\n // Need to update options:\n this._updateOptions();\n }\n }\n // Select the correct element\n const index = this.model.get('index');\n this.listbox.selectedIndex = index === null ? -1 : index;\n return super.update();\n }\n _updateOptions() {\n this.listbox.textContent = '';\n const items = this.model.get('_options_labels');\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n const option = document.createElement('option');\n option.textContent = item.replace(/ /g, '\\xa0'); // space ->  \n option.setAttribute('data-value', encodeURIComponent(item));\n option.value = item;\n this.listbox.appendChild(option);\n }\n }\n events() {\n return {\n 'change select': '_handle_change',\n };\n }\n /**\n * Handle when a new value is selected.\n */\n _handle_change() {\n this.model.set('index', this.listbox.selectedIndex === -1 ? null : this.listbox.selectedIndex, { updated_view: this });\n this.touch();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.listbox.focus();\n }\n else if (content.do === 'blur') {\n this.listbox.blur();\n }\n }\n}\nexport class SelectModel extends SelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SelectModel', _view_name: 'SelectView', rows: 5 });\n }\n}\nexport class SelectView extends SelectionView {\n /**\n * Public constructor.\n */\n initialize(parameters) {\n super.initialize(parameters);\n // Create listbox here so that subclasses can modify it before it is populated in render()\n this.listbox = document.createElement('select');\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-select');\n this.listbox.id = this.label.htmlFor = uuid();\n this.el.appendChild(this.listbox);\n this._updateOptions();\n this.update();\n this.updateSelection();\n }\n /**\n * Update the contents of this view\n */\n update(options) {\n // Don't update options/index on set calls from ourselves:\n if ((options === null || options === void 0 ? void 0 : options.updated_view) !== this) {\n const optsChange = this.model.hasChanged('_options_labels');\n const idxChange = this.model.hasChanged('index');\n if (optsChange || idxChange) {\n // Stash the index to guard against change events\n const idx = this.model.get('index');\n if (optsChange) {\n this._updateOptions();\n }\n this.updateSelection(idx);\n }\n }\n super.update();\n let rows = this.model.get('rows');\n if (rows === null) {\n rows = '';\n }\n this.listbox.setAttribute('size', rows);\n }\n updateSelection(index) {\n index = index || this.model.get('index');\n this.listbox.selectedIndex = index === null ? -1 : index;\n }\n _updateOptions() {\n this.listbox.textContent = '';\n const items = this.model.get('_options_labels');\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n const option = document.createElement('option');\n option.textContent = item.replace(/ /g, '\\xa0'); // space ->  \n option.setAttribute('data-value', encodeURIComponent(item));\n option.value = item;\n this.listbox.appendChild(option);\n }\n }\n events() {\n return {\n 'change select': '_handle_change',\n };\n }\n /**\n * Handle when a new value is selected.\n */\n _handle_change() {\n this.model.set('index', this.listbox.selectedIndex, { updated_view: this });\n this.touch();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do == 'focus') {\n this.listbox.focus();\n }\n else if (content.do == 'blur') {\n this.listbox.blur();\n }\n }\n}\nexport class RadioButtonsModel extends SelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'RadioButtonsModel', _view_name: 'RadioButtonsView', tooltips: [], icons: [], button_style: '' });\n }\n}\nexport class RadioButtonsView extends DescriptionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-radio');\n this.container = document.createElement('div');\n this.el.appendChild(this.container);\n this.container.classList.add('widget-radio-box');\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n const items = this.model.get('_options_labels');\n const radios = Array.from(this.container.querySelectorAll('input[type=\"radio\"]')).map((x) => x.value);\n let stale = items.length !== radios.length;\n if (!stale) {\n for (let i = 0, len = items.length; i < len; ++i) {\n if (radios[i] !== items[i]) {\n stale = true;\n break;\n }\n }\n }\n if (stale && (options === undefined || options.updated_view !== this)) {\n // Add items to the DOM.\n this.container.textContent = '';\n items.forEach((item, index) => {\n const label = document.createElement('label');\n label.textContent = item;\n this.container.appendChild(label);\n const radio = document.createElement('input');\n radio.setAttribute('type', 'radio');\n radio.value = index.toString();\n radio.setAttribute('data-value', encodeURIComponent(item));\n label.appendChild(radio);\n });\n }\n items.forEach((item, index) => {\n const item_query = 'input[data-value=\"' + encodeURIComponent(item) + '\"]';\n const radio = this.container.querySelectorAll(item_query);\n if (radio.length > 0) {\n const radio_el = radio[0];\n radio_el.checked = this.model.get('index') === index;\n radio_el.disabled = this.model.get('disabled');\n }\n });\n // Schedule adjustPadding asynchronously to\n // allow dom elements to be created properly\n setTimeout(this.adjustPadding, 0, this);\n return super.update(options);\n }\n /**\n * Adjust Padding to Multiple of Line Height\n *\n * Adjust margins so that the overall height\n * is a multiple of a single line height.\n *\n * This widget needs it because radio options\n * are spaced tighter than individual widgets\n * yet we would like the full widget line up properly\n * when displayed side-by-side with other widgets.\n */\n adjustPadding(e) {\n // Vertical margins on a widget\n const elStyles = window.getComputedStyle(e.el);\n const margins = parseInt(elStyles.marginTop, 10) + parseInt(elStyles.marginBottom, 10);\n // Total spaces taken by a single-line widget\n const lineHeight = e.label.offsetHeight + margins;\n // Current adjustment value on this widget\n const cStyles = window.getComputedStyle(e.container);\n const containerMargin = parseInt(cStyles.marginBottom, 10);\n // How far we are off from a multiple of single windget lines\n const diff = (e.el.offsetHeight + margins - containerMargin) % lineHeight;\n // Apply the new adjustment\n const extraMargin = diff === 0 ? 0 : lineHeight - diff;\n e.container.style.marginBottom = extraMargin + 'px';\n }\n events() {\n return {\n 'click input[type=\"radio\"]': '_handle_click',\n };\n }\n /**\n * Handle when a value is clicked.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n _handle_click(event) {\n const target = event.target;\n this.model.set('index', parseInt(target.value, 10), { updated_view: this });\n this.touch();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do == 'focus') {\n const firstItem = this.container.firstElementChild;\n firstItem.focus();\n }\n else if (content.do == 'blur') {\n for (let i = 0; i < this.container.children.length; i++) {\n const item = this.container.children[i];\n item.blur();\n }\n }\n }\n}\nexport class ToggleButtonsStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ToggleButtonsStyleModel' });\n }\n}\nToggleButtonsStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { button_width: {\n selector: '.widget-toggle-button',\n attribute: 'width',\n default: null,\n }, font_weight: {\n selector: '.widget-toggle-button',\n attribute: 'font-weight',\n default: '',\n } });\nexport class ToggleButtonsModel extends SelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ToggleButtonsModel', _view_name: 'ToggleButtonsView' });\n }\n}\nexport class ToggleButtonsView extends DescriptionView {\n initialize(options) {\n this._css_state = {};\n super.initialize(options);\n this.listenTo(this.model, 'change:button_style', this.update_button_style);\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-toggle-buttons');\n this.buttongroup = document.createElement('div');\n this.el.appendChild(this.buttongroup);\n this.update();\n this.set_button_style();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n const items = this.model.get('_options_labels');\n const icons = this.model.get('icons') || [];\n const previous_icons = this.model.previous('icons') || [];\n const previous_bstyle = ToggleButtonsView.classMap[this.model.previous('button_style')] || '';\n const tooltips = this.model.get('tooltips') || [];\n const disabled = this.model.get('disabled');\n const buttons = this.buttongroup.querySelectorAll('button');\n const values = Array.from(buttons).map((x) => x.value);\n let stale = false;\n for (let i = 0, len = items.length; i < len; ++i) {\n if (values[i] !== items[i] || icons[i] !== previous_icons[i]) {\n stale = true;\n break;\n }\n }\n if (stale && (options === undefined || options.updated_view !== this)) {\n // Add items to the DOM.\n this.buttongroup.textContent = '';\n items.forEach((item, index) => {\n let item_html;\n const empty = item.trim().length === 0 &&\n (!icons[index] || icons[index].trim().length === 0);\n if (empty) {\n item_html = ' ';\n }\n else {\n item_html = utils.escape_html(item);\n }\n const icon = document.createElement('i');\n const button = document.createElement('button');\n if (icons[index]) {\n icon.className = 'fa fa-' + icons[index];\n }\n button.setAttribute('type', 'button');\n button.className = 'widget-toggle-button jupyter-button';\n if (previous_bstyle) {\n button.classList.add(previous_bstyle);\n }\n button.innerHTML = item_html;\n button.setAttribute('data-value', encodeURIComponent(item));\n button.setAttribute('value', index.toString());\n button.appendChild(icon);\n button.disabled = disabled;\n if (tooltips[index]) {\n button.setAttribute('title', tooltips[index]);\n }\n this.update_style_traits(button);\n this.buttongroup.appendChild(button);\n });\n }\n // Select active button.\n items.forEach((item, index) => {\n const item_query = '[data-value=\"' + encodeURIComponent(item) + '\"]';\n const button = this.buttongroup.querySelector(item_query);\n if (this.model.get('index') === index) {\n button.classList.add('mod-active');\n }\n else {\n button.classList.remove('mod-active');\n }\n });\n this.stylePromise.then(function (style) {\n if (style) {\n style.style();\n }\n });\n return super.update(options);\n }\n update_style_traits(button) {\n for (const name in this._css_state) {\n if (Object.prototype.hasOwnProperty.call(this._css_state, 'name')) {\n if (name === 'margin') {\n this.buttongroup.style[name] = this._css_state[name];\n }\n else if (name !== 'width') {\n if (button) {\n button.style[name] = this._css_state[name];\n }\n else {\n const buttons = this.buttongroup.querySelectorAll('button');\n if (buttons.length) {\n buttons[0].style[name] = this._css_state[name];\n }\n }\n }\n }\n }\n }\n update_button_style() {\n const buttons = this.buttongroup.querySelectorAll('button');\n for (let i = 0; i < buttons.length; i++) {\n this.update_mapped_classes(ToggleButtonsView.classMap, 'button_style', buttons[i]);\n }\n }\n set_button_style() {\n const buttons = this.buttongroup.querySelectorAll('button');\n for (let i = 0; i < buttons.length; i++) {\n this.set_mapped_classes(ToggleButtonsView.classMap, 'button_style', buttons[i]);\n }\n }\n events() {\n return {\n 'click button': '_handle_click',\n };\n }\n /**\n * Handle when a value is clicked.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n _handle_click(event) {\n const target = event.target;\n this.model.set('index', parseInt(target.value, 10), { updated_view: this });\n this.touch();\n // We also send a clicked event, since the value is only set if it changed.\n // See https://github.com/jupyter-widgets/ipywidgets/issues/763\n this.send({ event: 'click' });\n }\n}\n(function (ToggleButtonsView) {\n ToggleButtonsView.classMap = {\n primary: ['mod-primary'],\n success: ['mod-success'],\n info: ['mod-info'],\n warning: ['mod-warning'],\n danger: ['mod-danger'],\n };\n})(ToggleButtonsView || (ToggleButtonsView = {}));\nexport class SelectionSliderModel extends SelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SelectionSliderModel', _view_name: 'SelectionSliderView', orientation: 'horizontal', readout: true, continuous_update: true });\n }\n}\nexport class SelectionSliderView extends DescriptionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-hslider');\n this.el.classList.add('widget-slider');\n // Creating noUiSlider instance and scaffolding\n this.$slider = document.createElement('div');\n this.$slider.classList.add('slider');\n // Put the slider in a container\n this.slider_container = document.createElement('div');\n this.slider_container.classList.add('slider-container');\n this.slider_container.appendChild(this.$slider);\n this.el.appendChild(this.slider_container);\n this.readout = document.createElement('div');\n this.el.appendChild(this.readout);\n this.readout.classList.add('widget-readout');\n this.readout.style.display = 'none';\n // noUiSlider constructor and event handlers\n this.createSlider();\n // Event handlers\n this.model.on('change:orientation', this.regenSlider, this);\n this.model.on('change:index', this.updateSliderValue, this);\n // Set defaults.\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if ((options === null || options === void 0 ? void 0 : options.updated_view) !== this) {\n this.updateSliderOptions(this.model);\n const orientation = this.model.get('orientation');\n const disabled = this.model.get('disabled');\n if (disabled) {\n this.readout.contentEditable = 'false';\n this.$slider.setAttribute('disabled', true);\n }\n else {\n this.readout.contentEditable = 'true';\n this.$slider.removeAttribute('disabled');\n }\n // Use the right CSS classes for vertical & horizontal sliders\n if (orientation === 'vertical') {\n this.el.classList.remove('widget-hslider');\n this.el.classList.remove('widget-inline-hbox');\n this.el.classList.add('widget-vslider');\n this.el.classList.add('widget-inline-vbox');\n }\n else {\n this.el.classList.remove('widget-vslider');\n this.el.classList.remove('widget-inline-vbox');\n this.el.classList.add('widget-hslider');\n this.el.classList.add('widget-inline-hbox');\n }\n const readout = this.model.get('readout');\n if (readout) {\n // this.$readout.show();\n this.readout.style.display = '';\n }\n else {\n // this.$readout.hide();\n this.readout.style.display = 'none';\n }\n this.updateSelection();\n }\n return super.update(options);\n }\n regenSlider(e) {\n this.$slider.noUiSlider.destroy();\n this.createSlider();\n }\n createSlider() {\n const labels = this.model.get('_options_labels');\n const min = 0;\n const max = labels.length - 1;\n const orientation = this.model.get('orientation');\n const behavior = this.model.get('behavior');\n noUiSlider.create(this.$slider, {\n start: this.model.get('index'),\n connect: true,\n behaviour: behavior,\n range: {\n min: min,\n max: max,\n },\n step: 1,\n animate: false,\n orientation: orientation,\n direction: orientation === 'horizontal' ? 'ltr' : 'rtl',\n format: {\n from: (value) => Number(value),\n to: (value) => Math.round(value),\n },\n });\n // Using noUiSlider's 'update' and 'change' events.\n // See reference: https://refreshless.com/nouislider/events-callbacks/\n this.$slider.noUiSlider.on('update', (values, handle) => {\n this.handleSliderUpdateEvent(values, handle);\n });\n this.$slider.noUiSlider.on('change', (values, handle) => {\n this.handleSliderChangeEvent(values, handle);\n });\n }\n events() {\n return {\n slide: 'handleSliderChange',\n slidestop: 'handleSliderChanged',\n };\n }\n updateSelection() {\n const index = this.model.get('index');\n this.updateReadout(index);\n }\n updateReadout(index) {\n const value = this.model.get('_options_labels')[index];\n this.readout.textContent = value;\n }\n /**\n * Called whilst the slider is dragged, tapped or moved by the arrow keys.\n */\n handleSliderUpdateEvent(values, handle) {\n const index = values[0];\n this.updateReadout(index);\n // Only persist the value while sliding if the continuous_update\n // trait is set to true.\n if (this.model.get('continuous_update')) {\n this.handleSliderChanged(values, handle);\n }\n }\n /**\n * Called when the slider handle is released after dragging,\n * or by tapping or moving by the arrow keys.\n */\n handleSliderChangeEvent(values, handle) {\n const index = values[0];\n this.updateReadout(index);\n this.handleSliderChanged(values, handle);\n }\n /**\n * Called when the slider value has changed.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n handleSliderChanged(values, handle) {\n const index = values[0];\n this.updateReadout(index);\n this.model.set('index', index, { updated_view: this });\n this.touch();\n }\n updateSliderOptions(e) {\n const labels = this.model.get('_options_labels');\n const min = 0;\n const max = labels.length - 1;\n this.$slider.noUiSlider.updateOptions({\n start: this.model.get('index'),\n range: {\n min: min,\n max: max,\n },\n step: 1,\n });\n }\n updateSliderValue(model, _, options) {\n if (options.updated_view === this) {\n return;\n }\n const prev_index = this.$slider.noUiSlider.get();\n const index = this.model.get('index');\n if (prev_index !== index) {\n this.$slider.noUiSlider.set(index);\n }\n }\n}\nexport class MultipleSelectionModel extends SelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'MultipleSelectionModel' });\n }\n}\nexport class SelectMultipleModel extends MultipleSelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SelectMultipleModel', _view_name: 'SelectMultipleView', rows: null });\n }\n}\nexport class SelectMultipleView extends SelectView {\n /**\n * Public constructor.\n */\n initialize(parameters) {\n super.initialize(parameters);\n this.listbox.multiple = true;\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-select-multiple');\n }\n updateSelection() {\n const selected = this.model.get('index') || [];\n const listboxOptions = this.listbox.options;\n // Clear the selection\n this.listbox.selectedIndex = -1;\n // Select the appropriate options\n selected.forEach((i) => {\n listboxOptions[i].selected = true;\n });\n }\n /**\n * Handle when a new value is selected.\n */\n _handle_change() {\n const index = Array.prototype.map.call(this.listbox.selectedOptions || [], function (option) {\n return option.index;\n });\n this.model.set('index', index, { updated_view: this });\n this.touch();\n }\n}\nexport class SelectionRangeSliderModel extends MultipleSelectionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SelectionSliderModel', _view_name: 'SelectionSliderView', orientation: 'horizontal', readout: true, continuous_update: true });\n }\n}\nexport class SelectionRangeSliderView extends SelectionSliderView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n }\n updateSelection(index) {\n index = index || this.model.get('index');\n this.updateReadout(index);\n }\n updateReadout(index) {\n const labels = this.model.get('_options_labels');\n const minValue = labels[index[0]];\n const maxValue = labels[index[1]];\n this.readout.textContent = `${minValue}-${maxValue}`;\n }\n /**\n * Called when the slider value is changing.\n */\n handleSliderUpdateEvent(values, handle) {\n const intValues = values.map(Math.trunc);\n this.updateReadout(intValues);\n // Only persist the value while sliding if the continuous_update\n // trait is set to true.\n if (this.model.get('continuous_update')) {\n this.handleSliderChanged(values, handle);\n }\n }\n /**\n * Called when the slider value has changed.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n handleSliderChanged(values, handle) {\n const intValues = values.map(Math.round);\n this.updateReadout(intValues);\n // set index to a snapshot of the values passed by the slider\n this.model.set('index', intValues.slice(), { updated_view: this });\n this.touch();\n }\n updateSliderValue(model, _, options) {\n if (options.updated_view === this) {\n return;\n }\n // Rounding values to avoid floating point precision error for the if statement below\n const prev_index = this.$slider.noUiSlider.get().map(Math.round);\n const index = this.model.get('index').map(Math.round);\n if (prev_index[0] !== index[0] || prev_index[1] !== index[1]) {\n this.$slider.noUiSlider.set(index);\n }\n }\n}\n//# sourceMappingURL=widget_selection.js.map","/* This file has code derived from Lumino. The license for this Lumino code is:\n\nCopyright (c) 2019 Project Jupyter Contributors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\nCopyright (c) 2014-2017, PhosphorJS Contributors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\nimport { MessageLoop } from '@lumino/messaging';\nimport { Signal } from '@lumino/signaling';\nimport { Platform } from '@lumino/domutils';\nimport { Panel, PanelLayout, TabBar, Widget } from '@lumino/widgets';\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a [[PanelLayout]].\n */\nexport class EventedPanel extends Panel {\n constructor() {\n super(...arguments);\n this._widgetRemoved = new Signal(this);\n }\n /**\n * A signal emitted when a widget is removed from the panel.\n */\n get widgetRemoved() {\n return this._widgetRemoved;\n }\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n onChildRemoved(msg) {\n this._widgetRemoved.emit(msg.child);\n }\n}\n/**\n * A widget which combines a `TabBar` and a `EventedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n *\n * TODO: Support setting the direction??\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options = {}) {\n super();\n this._currentChanged = new Signal(this);\n this.addClass('jupyter-widget-TabPanel');\n // Create the tab bar and contents panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('jupyter-widget-TabPanel-tabBar');\n this.tabContents = new EventedPanel();\n this.tabContents.addClass('jupyter-widget-TabPanel-tabContents');\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n // Connect the evented panel signal handlers.\n this.tabContents.widgetRemoved.connect(this._onWidgetRemoved, this);\n // Create the layout.\n const layout = new PanelLayout();\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.tabContents);\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged() {\n return this._currentChanged;\n }\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentIndex() {\n const currentIndex = this.tabBar.currentIndex;\n // Lumino tab bars have an index of -1 if no tab is selected\n return currentIndex === -1 ? null : currentIndex;\n }\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `null`.\n */\n set currentIndex(value) {\n this.tabBar.currentIndex = value === null ? -1 : value;\n }\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget() {\n const title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable() {\n return this.tabBar.tabsMovable;\n }\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value) {\n this.tabBar.tabsMovable = value;\n }\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets() {\n return this.tabContents.widgets;\n }\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget) {\n this.insertWidget(this.widgets.length, widget);\n }\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index, widget) {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.tabContents.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n }\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n _onCurrentChanged(sender, args) {\n // Extract the previous and current title from the args.\n const { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n // Extract the widgets from the titles.\n const previousWidget = previousTitle ? previousTitle.owner : null;\n const currentWidget = currentTitle ? currentTitle.owner : null;\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget,\n });\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n _onTabActivateRequested(sender, args) {\n args.title.owner.activate();\n }\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n _onTabCloseRequested(sender, args) {\n args.title.owner.close();\n }\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n _onTabMoved(sender, args) {\n this.tabContents.insertWidget(args.toIndex, args.title.owner);\n }\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n _onWidgetRemoved(sender, widget) {\n this.tabBar.removeTab(widget.title);\n }\n}\n//# sourceMappingURL=tabpanel.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * A variety of convenience methods for maintaining a current selection\n */\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Signal } from '@lumino/signaling';\nexport class Selection {\n constructor(sequence, options = {}) {\n this._array = null;\n this._value = null;\n this._previousValue = null;\n this._selectionChanged = new Signal(this);\n this._array = sequence;\n this._insertBehavior = options.insertBehavior || 'select-item-if-needed';\n this._removeBehavior = options.removeBehavior || 'select-item-after';\n }\n /**\n * A signal emitted when the current item is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected item is changed either\n * through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current item\n * changes due to other items being inserted, removed, or moved, but the\n * current item remains the same. It is only emitted when the actual current\n * item is changed.\n */\n get selectionChanged() {\n return this._selectionChanged;\n }\n /**\n * Adjust for setting an item.\n *\n * This should be called *after* the set.\n *\n * @param index - The index set.\n * @param oldValue - The old value at the index.\n */\n adjustSelectionForSet(index) {\n // We just need to send a signal if the currentValue changed.\n // Get the current index and value.\n const pi = this.index;\n const pv = this.value;\n // Exit early if this doesn't affect the selection\n if (index !== pi) {\n return;\n }\n this._updateSelectedValue();\n const cv = this.value;\n // The previous item is now null, since it is no longer in the array.\n this._previousValue = null;\n // Send signal if there was a change\n if (pv !== cv) {\n // Emit the current changed signal.\n this._selectionChanged.emit({\n previousIndex: pi,\n previousValue: pv,\n currentIndex: pi,\n currentValue: cv,\n });\n }\n }\n /**\n * Get the currently selected item.\n *\n * #### Notes\n * This will be `null` if no item is selected.\n */\n get value() {\n return this._value;\n }\n /**\n * Set the currently selected item.\n *\n * #### Notes\n * If the item does not exist in the vector, the currentValue will be set to\n * `null`. This selects the first entry equal to the desired item.\n */\n set value(value) {\n if (value === null || this._array === null) {\n this.index = null;\n }\n else {\n this.index = ArrayExt.firstIndexOf(this._array, value);\n }\n }\n /**\n * Get the index of the currently selected item.\n *\n * #### Notes\n * This will be `null` if no item is selected.\n */\n get index() {\n return this._index;\n }\n /**\n * Set the index of the currently selected tab.\n *\n * @param index - The index to select.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `null`, which\n * indicates no item is selected.\n */\n set index(index) {\n // Coerce the value to an index.\n let i;\n if (index !== null && this._array !== null) {\n i = Math.floor(index);\n if (i < 0 || i >= this._array.length) {\n i = null;\n }\n }\n else {\n i = null;\n }\n // Bail early if the index will not change.\n if (this._index === i) {\n return;\n }\n // Look up the previous index and item.\n const pi = this._index;\n const pv = this._value;\n // Update the state\n this._index = i;\n this._updateSelectedValue();\n this._previousValue = pv;\n // Emit the current changed signal.\n this._selectionChanged.emit({\n previousIndex: pi,\n previousValue: pv,\n currentIndex: i,\n currentValue: this._value,\n });\n }\n /**\n * Get the selection behavior when inserting a tab.\n */\n get insertBehavior() {\n return this._insertBehavior;\n }\n /**\n * Set the selection behavior when inserting a tab.\n */\n set insertBehavior(value) {\n this._insertBehavior = value;\n }\n /**\n * Get the selection behavior when removing a tab.\n */\n get removeBehavior() {\n return this._removeBehavior;\n }\n /**\n * Set the selection behavior when removing a tab.\n */\n set removeBehavior(value) {\n this._removeBehavior = value;\n }\n /**\n * Adjust the current index for a tab insert operation.\n *\n * @param i - The new index of the inserted item.\n * @param j - The inserted item.\n *\n * #### Notes\n * This method accounts for the tab bar's insertion behavior when adjusting\n * the current index and emitting the changed signal. This should be called\n * after the insertion.\n */\n adjustSelectionForInsert(i, item) {\n // Lookup commonly used variables.\n const cv = this._value;\n const ci = this._index;\n const bh = this._insertBehavior;\n // Handle the behavior where the new item is always selected,\n // or the behavior where the new item is selected if needed.\n if (bh === 'select-item' ||\n (bh === 'select-item-if-needed' && ci === null)) {\n this._index = i;\n this._value = item;\n this._previousValue = cv;\n this._selectionChanged.emit({\n previousIndex: ci,\n previousValue: cv,\n currentIndex: i,\n currentValue: item,\n });\n return;\n }\n // Otherwise, silently adjust the current index if needed.\n if (ci !== null && ci >= i) {\n this._index++;\n }\n }\n /**\n * Clear the selection and history.\n */\n clearSelection() {\n // Get the current index and item.\n const pi = this._index;\n const pv = this._value;\n // Reset the current index and previous item.\n this._index = null;\n this._value = null;\n this._previousValue = null;\n // If no item was selected, there's nothing else to do.\n if (pi === null) {\n return;\n }\n // Emit the current changed signal.\n this._selectionChanged.emit({\n previousIndex: pi,\n previousValue: pv,\n currentIndex: this._index,\n currentValue: this._value,\n });\n }\n /**\n * Adjust the current index for an item remove operation.\n *\n * @param i - The former index of the removed item.\n * @param item - The removed item.\n *\n * #### Notes\n * This method accounts for the remove behavior when adjusting the current\n * index and emitting the changed signal. It should be called after the item\n * is removed.\n */\n adjustSelectionForRemove(i, item) {\n // If we have no selection, there is nothing to do\n if (this._index === null) {\n return;\n }\n // Lookup commonly used variables.\n const ci = this._index;\n const bh = this._removeBehavior;\n // Silently adjust the index if the current item is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._index--;\n }\n return;\n }\n // No item gets selected if the vector is empty.\n if (!this._array || this._array.length === 0) {\n // Reset the current index and previous item.\n this._index = null;\n this._value = null;\n this._previousValue = null;\n this._selectionChanged.emit({\n previousIndex: i,\n previousValue: item,\n currentIndex: this._index,\n currentValue: this._value,\n });\n return;\n }\n // Handle behavior where the next sibling item is selected.\n if (bh === 'select-item-after') {\n this._index = Math.min(i, this._array.length - 1);\n this._updateSelectedValue();\n this._previousValue = null;\n this._selectionChanged.emit({\n previousIndex: i,\n previousValue: item,\n currentIndex: this._index,\n currentValue: this._value,\n });\n return;\n }\n // Handle behavior where the previous sibling item is selected.\n if (bh === 'select-item-before') {\n this._index = Math.max(0, i - 1);\n this._updateSelectedValue();\n this._previousValue = null;\n this._selectionChanged.emit({\n previousIndex: i,\n previousValue: item,\n currentIndex: this._index,\n currentValue: this._value,\n });\n return;\n }\n // Handle behavior where the previous history item is selected.\n if (bh === 'select-previous-item') {\n if (this._previousValue) {\n this.value = this._previousValue;\n }\n else {\n this._index = Math.min(i, this._array.length - 1);\n this._updateSelectedValue();\n }\n this._previousValue = null;\n this._selectionChanged.emit({\n previousIndex: i,\n previousValue: item,\n currentIndex: this._index,\n currentValue: this.value,\n });\n return;\n }\n // Otherwise, no item gets selected.\n this._index = null;\n this._value = null;\n this._previousValue = null;\n this._selectionChanged.emit({\n previousIndex: i,\n previousValue: item,\n currentIndex: this._index,\n currentValue: this._value,\n });\n }\n /**\n * Set the current value based on the current index.\n */\n _updateSelectedValue() {\n const i = this._index;\n this._value = i !== null && this._array ? this._array[i] : null;\n }\n}\n//# sourceMappingURL=currentselection.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Signal } from '@lumino/signaling';\nimport { Panel, PanelLayout, Widget } from '@lumino/widgets';\nimport { Selection } from './currentselection';\n/**\n * The class name added to Collapse instances.\n */\nconst COLLAPSE_CLASS = 'jupyter-widget-Collapse';\n/**\n * The class name added to a Collapse's header.\n */\nconst COLLAPSE_HEADER_CLASS = 'jupyter-widget-Collapse-header';\n/**\n * The class name added to a Collapse's contents.\n */\nconst COLLAPSE_CONTENTS_CLASS = 'jupyter-widget-Collapse-contents';\n/**\n * The class name added to a Collapse when it is opened\n */\nconst COLLAPSE_CLASS_OPEN = 'jupyter-widget-Collapse-open';\n/**\n * A panel that supports a collapsible header, made from the widget's title.\n * Clicking on the title expands or contracts the widget.\n */\nexport class Collapse extends Widget {\n constructor(options) {\n super(options);\n this._collapseChanged = new Signal(this);\n this.addClass(COLLAPSE_CLASS);\n this._header = new Widget();\n this._header.addClass(COLLAPSE_HEADER_CLASS);\n this._header.node.addEventListener('click', this);\n // Fontawesome icon for caret\n const icon = document.createElement('i');\n icon.classList.add('fa', 'fa-fw', 'fa-caret-right');\n this._header.node.appendChild(icon);\n // Label content\n this._header.node.appendChild(document.createElement('span'));\n this._content = new Panel();\n this._content.addClass(COLLAPSE_CONTENTS_CLASS);\n const layout = new PanelLayout();\n this.layout = layout;\n layout.addWidget(this._header);\n layout.addWidget(this._content);\n if (options.widget) {\n this.widget = options.widget;\n }\n this.collapsed = false;\n }\n dispose() {\n if (this.isDisposed) {\n return;\n }\n super.dispose();\n this._header = null;\n this._widget = null;\n this._content = null;\n }\n get widget() {\n return this._widget;\n }\n set widget(widget) {\n const oldWidget = this._widget;\n if (oldWidget) {\n oldWidget.disposed.disconnect(this._onChildDisposed, this);\n oldWidget.title.changed.disconnect(this._onTitleChanged, this);\n oldWidget.parent = null;\n }\n this._widget = widget;\n widget.disposed.connect(this._onChildDisposed, this);\n widget.title.changed.connect(this._onTitleChanged, this);\n this._onTitleChanged(widget.title);\n this._content.addWidget(widget);\n }\n get collapsed() {\n return this._collapsed;\n }\n set collapsed(value) {\n // TODO: should we have this check here?\n if (value === this._collapsed) {\n return;\n }\n if (value) {\n this._collapse();\n }\n else {\n this._uncollapse();\n }\n }\n toggle() {\n this.collapsed = !this.collapsed;\n }\n get collapseChanged() {\n return this._collapseChanged;\n }\n _collapse() {\n this._collapsed = true;\n if (this._content) {\n this._content.hide();\n }\n this.removeClass(COLLAPSE_CLASS_OPEN);\n this._header.node.children[0].classList.add('fa-caret-right');\n this._header.node.children[0].classList.remove('fa-caret-down');\n this._collapseChanged.emit(void 0);\n }\n _uncollapse() {\n this._collapsed = false;\n if (this._content) {\n this._content.show();\n }\n this.addClass(COLLAPSE_CLASS_OPEN);\n this._header.node.children[0].classList.add('fa-caret-down');\n this._header.node.children[0].classList.remove('fa-caret-right');\n this._collapseChanged.emit(void 0);\n }\n /**\n * Handle the DOM events for the Collapse widget.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event) {\n switch (event.type) {\n case 'click':\n this._evtClick(event);\n break;\n default:\n break;\n }\n }\n _evtClick(event) {\n this.toggle();\n }\n /**\n * Handle the `changed` signal of a title object.\n */\n _onTitleChanged(sender) {\n this._header.node.children[1].textContent = this._widget.title.label;\n }\n _onChildDisposed(sender) {\n this.dispose();\n }\n}\n/**\n * The class name added to Accordion instances.\n */\nconst ACCORDION_CLASS = 'jupyter-widget-Accordion';\n/**\n * The class name added to an Accordion child.\n */\nconst ACCORDION_CHILD_CLASS = 'jupyter-widget-Accordion-child';\nconst ACCORDION_CHILD_ACTIVE_CLASS = 'jupyter-widget-Accordion-child-active';\n/**\n * A panel that supports a collapsible header, made from the widget's title.\n * Clicking on the title expands or contracts the widget.\n */\nexport class Accordion extends Panel {\n constructor(options) {\n super(options);\n this._selection = new Selection(this.widgets);\n this._selection.selectionChanged.connect(this._onSelectionChanged, this);\n this.addClass(ACCORDION_CLASS);\n }\n /**\n * A read-only sequence of the widgets in the panel.\n *\n * #### Notes\n * This is a read-only property.\n */\n /* get widgets(): ISequence {\n return new ArraySequence(toArray(map((this.layout as PanelLayout).widgets, (w: Collapse) => w.widget)));\n }\n */\n get collapseWidgets() {\n return this.layout.widgets;\n }\n get selection() {\n return this._selection;\n }\n indexOf(widget) {\n return ArrayExt.findFirstIndex(this.collapseWidgets, (w) => w.widget === widget);\n }\n /**\n * Add a widget to the end of the accordion.\n *\n * @param widget - The widget to add to the accordion.\n *\n * @returns The Collapse widget wrapping the added widget.\n *\n * #### Notes\n * The widget will be wrapped in a CollapsedWidget.\n */\n addWidget(widget) {\n const collapse = this._wrapWidget(widget);\n collapse.collapsed = true;\n super.addWidget(collapse);\n this._selection.adjustSelectionForInsert(this.widgets.length - 1, collapse);\n return collapse;\n }\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the accordion.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index, widget) {\n const collapse = this._wrapWidget(widget);\n collapse.collapsed = true;\n super.insertWidget(index, collapse);\n this._selection.adjustSelectionForInsert(index, collapse);\n }\n removeWidget(widget) {\n const index = this.indexOf(widget);\n if (index >= 0) {\n const collapse = this.collapseWidgets[index];\n widget.parent = null;\n collapse.dispose();\n this._selection.adjustSelectionForRemove(index, null);\n }\n }\n _wrapWidget(widget) {\n const collapse = new Collapse({ widget });\n collapse.addClass(ACCORDION_CHILD_CLASS);\n collapse.collapseChanged.connect(this._onCollapseChange, this);\n return collapse;\n }\n _onCollapseChange(sender) {\n if (!sender.collapsed) {\n this._selection.value = sender;\n }\n else if (this._selection.value === sender && sender.collapsed) {\n this._selection.value = null;\n }\n }\n _onSelectionChanged(sender, change) {\n // Collapse previous widget, open current widget\n const pv = change.previousValue;\n const cv = change.currentValue;\n if (pv) {\n pv.collapsed = true;\n pv.removeClass(ACCORDION_CHILD_ACTIVE_CLASS);\n }\n if (cv) {\n cv.collapsed = false;\n cv.addClass(ACCORDION_CHILD_ACTIVE_CLASS);\n }\n }\n}\n//# sourceMappingURL=accordion.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DOMWidgetView, ViewList, reject, } from '@jupyter-widgets/base';\nimport { BoxModel, BoxView } from './widget_box';\nimport { TabPanel } from './lumino/tabpanel';\nimport { Accordion } from './lumino/accordion';\nimport { Widget } from '@lumino/widgets';\nimport { each, ArrayExt } from '@lumino/algorithm';\nimport { MessageLoop } from '@lumino/messaging';\nimport $ from 'jquery';\nexport class SelectionContainerModel extends BoxModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'SelectionContainerModel', selected_index: null, titles: [] });\n }\n}\nexport class AccordionModel extends SelectionContainerModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'AccordionModel', _view_name: 'AccordionView' });\n }\n}\n// We implement our own tab widget since Phoshpor's TabPanel uses an absolute\n// positioning BoxLayout, but we want a more an html/css-based Panel layout.\nexport class JupyterLuminoAccordionWidget extends Accordion {\n constructor(options) {\n const view = options.view;\n delete options.view;\n super(options);\n this._view = view;\n }\n /**\n * Process the Lumino message.\n *\n * Any custom Lumino widget used inside a Jupyter widget should override\n * the processMessage function like this.\n */\n processMessage(msg) {\n var _a;\n super.processMessage(msg);\n (_a = this._view) === null || _a === void 0 ? void 0 : _a.processLuminoMessage(msg);\n }\n /**\n * Dispose the widget.\n *\n * This causes the view to be destroyed as well with 'remove'\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n super.dispose();\n this._view.remove();\n this._view = null;\n }\n}\nexport class AccordionView extends DOMWidgetView {\n _createElement(tagName) {\n this.luminoWidget = new JupyterLuminoAccordionWidget({ view: this });\n return this.luminoWidget.node;\n }\n _setElement(el) {\n if (this.el || el !== this.luminoWidget.node) {\n // Accordions don't allow setting the element beyond the initial creation.\n throw new Error('Cannot reset the DOM element.');\n }\n this.el = this.luminoWidget.node;\n this.$el = $(this.luminoWidget.node);\n }\n initialize(parameters) {\n super.initialize(parameters);\n this.children_views = new ViewList(this.add_child_view, this.remove_child_view, this);\n this.listenTo(this.model, 'change:children', () => this.updateChildren());\n this.listenTo(this.model, 'change:selected_index', () => this.update_selected_index());\n this.listenTo(this.model, 'change:titles', () => this.update_titles());\n }\n /**\n * Called when view is rendered.\n */\n render() {\n var _a;\n super.render();\n const accordion = this.luminoWidget;\n accordion.addClass('jupyter-widgets');\n accordion.addClass('widget-accordion');\n accordion.addClass('widget-container');\n accordion.selection.selectionChanged.connect((sender) => {\n if (!this.updatingChildren) {\n this.model.set('selected_index', accordion.selection.index);\n this.touch();\n }\n });\n (_a = this.children_views) === null || _a === void 0 ? void 0 : _a.update(this.model.get('children'));\n this.update_titles();\n this.update_selected_index();\n }\n /**\n * Update children\n */\n updateChildren() {\n var _a;\n // While we are updating, the index may not be valid, so deselect the\n // tabs before updating so we don't get spurious changes in the index,\n // which would then set off another sync cycle.\n this.updatingChildren = true;\n this.luminoWidget.selection.index = null;\n (_a = this.children_views) === null || _a === void 0 ? void 0 : _a.update(this.model.get('children'));\n this.update_selected_index();\n this.updatingChildren = false;\n }\n /**\n * Set header titles\n */\n update_titles() {\n const collapsed = this.luminoWidget.collapseWidgets;\n const titles = this.model.get('titles');\n for (let i = 0; i < collapsed.length; i++) {\n if (titles[i] !== void 0) {\n collapsed[i].widget.title.label = titles[i];\n }\n }\n }\n /**\n * Make the rendering and selected index consistent.\n */\n update_selected_index() {\n this.luminoWidget.selection.index = this.model.get('selected_index');\n }\n /**\n * Called when a child is removed from children list.\n */\n remove_child_view(view) {\n this.luminoWidget.removeWidget(view.luminoWidget);\n view.remove();\n }\n /**\n * Called when a child is added to children list.\n */\n add_child_view(model, index) {\n // Placeholder widget to keep our position in the tab panel while we create the view.\n const accordion = this.luminoWidget;\n const placeholder = new Widget();\n placeholder.title.label = this.model.get('titles')[index] || '';\n accordion.addWidget(placeholder);\n return this.create_child_view(model)\n .then((view) => {\n const widget = view.luminoWidget;\n widget.title.label = placeholder.title.label;\n const collapse = accordion.collapseWidgets[accordion.indexOf(placeholder)];\n collapse.widget = widget;\n placeholder.dispose();\n return view;\n })\n .catch(reject('Could not add child view to box', true));\n }\n remove() {\n this.children_views = null;\n super.remove();\n }\n}\nexport class TabModel extends SelectionContainerModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'TabModel', _view_name: 'TabView' });\n }\n}\n// We implement our own tab widget since Phoshpor's TabPanel uses an absolute\n// positioning BoxLayout, but we want a more an html/css-based Panel layout.\nexport class JupyterLuminoTabPanelWidget extends TabPanel {\n constructor(options) {\n const view = options.view;\n delete options.view;\n super(options);\n this._view = view;\n // We want the view's messages to be the messages the tabContents panel\n // gets.\n MessageLoop.installMessageHook(this.tabContents, (handler, msg) => {\n // There may be times when we want the view's handler to be called\n // *after* the message has been processed by the widget, in which\n // case we'll need to revisit using a message hook.\n this._view.processLuminoMessage(msg);\n return true;\n });\n }\n /**\n * Dispose the widget.\n *\n * This causes the view to be destroyed as well with 'remove'\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n super.dispose();\n this._view.remove();\n this._view = null;\n }\n}\nexport class TabView extends DOMWidgetView {\n constructor() {\n super(...arguments);\n this.updatingTabs = false;\n }\n _createElement(tagName) {\n this.luminoWidget = new JupyterLuminoTabPanelWidget({\n view: this,\n });\n return this.luminoWidget.node;\n }\n _setElement(el) {\n if (this.el || el !== this.luminoWidget.node) {\n // TabViews don't allow setting the element beyond the initial creation.\n throw new Error('Cannot reset the DOM element.');\n }\n this.el = this.luminoWidget.node;\n this.$el = $(this.luminoWidget.node);\n }\n /**\n * Public constructor.\n */\n initialize(parameters) {\n super.initialize(parameters);\n this.childrenViews = new ViewList(this.addChildView, (view) => {\n view.remove();\n }, this);\n this.listenTo(this.model, 'change:children', () => this.updateTabs());\n this.listenTo(this.model, 'change:titles', () => this.updateTitles());\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n const tabs = this.luminoWidget;\n tabs.addClass('jupyter-widgets');\n tabs.addClass('widget-container');\n tabs.addClass('jupyter-widget-tab');\n tabs.addClass('widget-tab');\n tabs.tabsMovable = true;\n tabs.tabBar.insertBehavior = 'none'; // needed for insert behavior, see below.\n tabs.tabBar.currentChanged.connect(this._onTabChanged, this);\n tabs.tabBar.tabMoved.connect(this._onTabMoved, this);\n tabs.tabBar.addClass('widget-tab-bar');\n tabs.tabContents.addClass('widget-tab-contents');\n // TODO: expose this option in python\n tabs.tabBar.tabsMovable = false;\n this.updateTabs();\n this.update();\n }\n /**\n * Render tab views based on the current model's children.\n */\n updateTabs() {\n var _a;\n // While we are updating, the index may not be valid, so deselect the\n // tabs before updating so we don't get spurious changes in the index,\n // which would then set off another sync cycle.\n this.updatingTabs = true;\n this.luminoWidget.currentIndex = null;\n (_a = this.childrenViews) === null || _a === void 0 ? void 0 : _a.update(this.model.get('children'));\n this.luminoWidget.currentIndex = this.model.get('selected_index');\n this.updatingTabs = false;\n }\n /**\n * Called when a child is added to children list.\n */\n addChildView(model, index) {\n // Placeholder widget to keep our position in the tab panel while we create the view.\n const label = this.model.get('titles')[index] || '';\n const tabs = this.luminoWidget;\n const placeholder = new Widget();\n placeholder.title.label = label;\n tabs.addWidget(placeholder);\n return this.create_child_view(model)\n .then((view) => {\n const widget = view.luminoWidget;\n widget.title.label = placeholder.title.label;\n widget.title.closable = false;\n const i = ArrayExt.firstIndexOf(tabs.widgets, placeholder);\n // insert after placeholder so that if placeholder is selected, the\n // real widget will be selected now (this depends on the tab bar\n // insert behavior)\n tabs.insertWidget(i + 1, widget);\n placeholder.dispose();\n return view;\n })\n .catch(reject('Could not add child view to box', true));\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n // Update the selected index in the overall update method because it\n // should be run after the tabs have been updated. Otherwise the\n // selected index may not be a valid tab in the tab bar.\n this.updateSelectedIndex();\n return super.update();\n }\n /**\n * Updates the tab page titles.\n */\n updateTitles() {\n const titles = this.model.get('titles') || [];\n each(this.luminoWidget.widgets, (widget, i) => {\n widget.title.label = titles[i] || '';\n });\n }\n /**\n * Updates the selected index.\n */\n updateSelectedIndex() {\n this.luminoWidget.currentIndex = this.model.get('selected_index');\n }\n remove() {\n this.childrenViews = null;\n super.remove();\n }\n _onTabChanged(sender, args) {\n if (!this.updatingTabs) {\n const i = args.currentIndex;\n this.model.set('selected_index', i === -1 ? null : i);\n this.touch();\n }\n }\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n _onTabMoved(sender, args) {\n const children = this.model.get('children').slice();\n ArrayExt.move(children, args.fromIndex, args.toIndex);\n this.model.set('children', children);\n this.touch();\n }\n}\nexport class StackModel extends SelectionContainerModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'StackModel', _view_name: 'StackView' });\n }\n}\nexport class StackView extends BoxView {\n initialize(parameters) {\n super.initialize(parameters);\n this.listenTo(this.model, 'change:selected_index', this.update_children);\n }\n update_children() {\n var _a;\n let child;\n if (this.model.get('selected_index') === null) {\n child = [];\n }\n else {\n child = [this.model.get('children')[this.model.get('selected_index')]];\n }\n (_a = this.children_views) === null || _a === void 0 ? void 0 : _a.update(child).then((views) => {\n // Notify all children that their sizes may have changed.\n views.forEach((view) => {\n MessageLoop.postMessage(view.luminoWidget, Widget.ResizeMessage.UnknownSize);\n });\n });\n }\n}\n//# sourceMappingURL=widget_selectioncontainer.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport * as d3Color from 'd3-color';\nimport * as d3Format from 'd3-format';\nimport { CoreDOMWidgetModel } from './widget_core';\nimport { DOMWidgetView, uuid } from '@jupyter-widgets/base';\n/**\n * Returns a new string after removing any leading and trailing whitespaces.\n * The original string is left unchanged.\n */\nfunction trim(value) {\n return value.replace(/^\\s+|\\s+$/g, '');\n}\n/**\n * Clamp a number between min and max and return the result.\n */\nfunction clamp(value, min, max) {\n return Math.min(Math.max(value, min), max);\n}\n/**\n * Remove children from an HTMLElement\n */\nfunction removeChildren(el) {\n while (el.firstChild) {\n el.removeChild(el.firstChild);\n }\n}\n/**\n * Selection class which keeps track on selected indices.\n */\nclass Selection {\n constructor(start, dx, max) {\n this.start = start;\n this.dx = dx;\n this.max = max;\n }\n /**\n * Check if a given index is currently selected.\n */\n isSelected(index) {\n let min;\n let max;\n if (this.dx >= 0) {\n min = this.start;\n max = this.start + this.dx;\n }\n else {\n min = this.start + this.dx;\n max = this.start;\n }\n return min <= index && index < max;\n }\n /**\n * Update selection\n */\n updateSelection(dx) {\n this.dx += dx;\n if (this.start + this.dx > this.max) {\n this.dx = this.max - this.start;\n }\n if (this.start + this.dx < 0) {\n this.dx = -this.start;\n }\n }\n}\nclass TagsInputBaseModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: [], placeholder: '\\u200b', allowed_tags: null, allow_duplicates: true });\n }\n}\nclass TagsInputBaseView extends DOMWidgetView {\n constructor() {\n super(...arguments);\n this.hoveredTag = null;\n this.hoveredTagIndex = null;\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('jupyter-widget-tagsinput');\n this.taginputWrapper = document.createElement('div');\n // The taginput is hidden until the user focuses on the widget\n // Unless there is no value\n if (this.model.get('value').length) {\n this.taginputWrapper.style.display = 'none';\n }\n else {\n this.taginputWrapper.style.display = 'inline-block';\n }\n this.datalistID = uuid();\n this.taginput = document.createElement('input');\n this.taginput.classList.add('jupyter-widget-tag');\n this.taginput.classList.add('jupyter-widget-taginput');\n this.taginput.setAttribute('list', this.datalistID);\n this.taginput.setAttribute('type', 'text');\n this.autocompleteList = document.createElement('datalist');\n this.autocompleteList.id = this.datalistID;\n this.updateAutocomplete();\n this.model.on('change:allowed_tags', this.updateAutocomplete.bind(this));\n this.updatePlaceholder();\n this.model.on('change:placeholder', this.updatePlaceholder.bind(this));\n this.taginputWrapper.classList.add('widget-text');\n this.taginputWrapper.appendChild(this.taginput);\n this.taginputWrapper.appendChild(this.autocompleteList);\n this.el.onclick = this.focus.bind(this);\n this.el.ondrop = (event) => {\n // Put the tag at the end of the list if there is no currently hovered tag\n const index = this.hoveredTagIndex == null ? this.tags.length : this.hoveredTagIndex;\n return this.ondrop(event, index);\n };\n this.el.ondragover = this.ondragover.bind(this);\n this.taginput.onchange = this.handleValueAdded.bind(this);\n this.taginput.oninput = this.resizeInput.bind(this);\n this.taginput.onkeydown = this.handleKeyEvent.bind(this);\n this.taginput.onblur = this.loseFocus.bind(this);\n this.resizeInput();\n this.inputIndex = this.model.get('value').length;\n this.selection = null;\n this.preventLoosingFocus = false;\n this.update();\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n // Prevent hiding the input element and clearing the selection when updating everything\n this.preventLoosingFocus = true;\n removeChildren(this.el);\n this.tags = [];\n const value = this.model.get('value');\n for (const idx in value) {\n const index = parseInt(idx);\n const tag = this.createTag(value[index], index, this.selection != null && this.selection.isSelected(index));\n // Drag and drop\n tag.draggable = true;\n tag.ondragstart = ((index, value) => {\n return (event) => {\n this.ondragstart(event, index, value, this.model.model_id);\n };\n })(index, value[index]);\n tag.ondrop = ((index) => {\n return (event) => {\n this.ondrop(event, index);\n };\n })(index);\n tag.ondragover = this.ondragover.bind(this);\n tag.ondragenter = ((index) => {\n return (event) => {\n this.ondragenter(event, index);\n };\n })(index);\n tag.ondragend = this.ondragend.bind(this);\n this.tags.push(tag);\n this.el.appendChild(tag);\n }\n this.el.insertBefore(this.taginputWrapper, this.el.children[this.inputIndex]);\n // The taginput is hidden until the user focuses on the widget\n // Unless there is no value\n if (this.model.get('value').length) {\n this.taginputWrapper.style.display = 'none';\n }\n else {\n this.taginputWrapper.style.display = 'inline-block';\n }\n this.preventLoosingFocus = false;\n return super.update();\n }\n /**\n * Update the auto-completion list\n */\n updateAutocomplete() {\n removeChildren(this.autocompleteList);\n const allowedTags = this.model.get('allowed_tags');\n for (const tag of allowedTags) {\n const option = document.createElement('option');\n option.value = tag;\n this.autocompleteList.appendChild(option);\n }\n }\n /**\n * Update the auto-completion list\n */\n updatePlaceholder() {\n this.taginput.placeholder = this.model.get('placeholder');\n this.resizeInput();\n }\n /**\n * Update the tags, called when the selection has changed and we need to update the tags CSS\n */\n updateTags() {\n const value = this.model.get('value');\n for (const idx in this.tags) {\n const index = parseInt(idx);\n this.updateTag(this.tags[index], value[index], index, this.selection != null && this.selection.isSelected(index));\n }\n }\n /**\n * Handle a new value is added from the input element\n */\n handleValueAdded(event) {\n const newTagValue = trim(this.taginput.value);\n const tagIndex = this.inputIndex;\n if (newTagValue == '') {\n return;\n }\n this.inputIndex++;\n const tagAdded = this.addTag(tagIndex, newTagValue);\n if (tagAdded) {\n // Clear the input and keep focus on it allowing the user to add more tags\n this.taginput.value = '';\n this.resizeInput();\n this.focus();\n }\n }\n /**\n * Add a new tag with a value of `tagValue` at the `index` position\n * Return true if the tag was correctly added, false otherwise\n */\n addTag(index, tagValue) {\n const value = this.model.get('value');\n let newTagValue;\n try {\n newTagValue = this.validateValue(tagValue);\n }\n catch (error) {\n return false;\n }\n const allowedTagValues = this.model.get('allowed_tags');\n if (allowedTagValues.length && !allowedTagValues.includes(newTagValue)) {\n // Do nothing for now, maybe show a proper error message?\n return false;\n }\n if (!this.model.get('allow_duplicates') && value.includes(newTagValue)) {\n // Do nothing for now, maybe add an animation to highlight the tag?\n return false;\n }\n // Clearing the current selection before setting the new value\n this.selection = null;\n // Making a copy so that backbone sees the change, and insert the new tag\n const newValue = [...value];\n newValue.splice(index, 0, newTagValue);\n this.model.set('value', newValue);\n this.model.save_changes();\n return true;\n }\n /**\n * Resize the input element\n */\n resizeInput() {\n let content;\n if (this.taginput.value.length != 0) {\n content = this.taginput.value;\n }\n else {\n content = this.model.get('placeholder');\n }\n const size = content.length + 1;\n this.taginput.setAttribute('size', String(size));\n }\n /**\n * Handle key events on the input element\n */\n handleKeyEvent(event) {\n const valueLength = this.model.get('value').length;\n // Do nothing if the user is typing something\n if (this.taginput.value.length) {\n return;\n }\n const currentElement = this.inputIndex;\n switch (event.key) {\n case 'ArrowLeft':\n if (event.ctrlKey && event.shiftKey) {\n this.select(currentElement, -currentElement);\n }\n if (!event.ctrlKey && event.shiftKey) {\n this.select(currentElement, -1);\n }\n if (event.ctrlKey) {\n this.inputIndex = 0;\n }\n else {\n this.inputIndex--;\n }\n break;\n case 'ArrowRight':\n if (event.ctrlKey && event.shiftKey) {\n this.select(currentElement, valueLength - currentElement);\n }\n if (!event.ctrlKey && event.shiftKey) {\n this.select(currentElement, 1);\n }\n if (event.ctrlKey) {\n this.inputIndex = valueLength;\n }\n else {\n this.inputIndex++;\n }\n break;\n case 'Backspace':\n if (this.selection) {\n this.removeSelectedTags();\n }\n else {\n this.removeTag(this.inputIndex - 1);\n }\n break;\n case 'Delete':\n if (this.selection) {\n this.removeSelectedTags();\n }\n else {\n this.removeTag(this.inputIndex);\n }\n break;\n default:\n // Do nothing by default\n return;\n break;\n }\n // Reset selection is shift key is not pressed\n if (!event.shiftKey) {\n this.selection = null;\n }\n this.inputIndex = clamp(this.inputIndex, 0, valueLength);\n this.update();\n this.focus();\n }\n /**\n * Function that gets called when a tag with a given `value` is being dragged.\n */\n ondragstart(event, index, tagValue, origin) {\n if (event.dataTransfer == null) {\n return;\n }\n event.dataTransfer.setData('index', String(index));\n event.dataTransfer.setData('tagValue', String(tagValue));\n event.dataTransfer.setData('origin', origin);\n }\n /**\n * Function that gets called when a tag has been dragged on the tag at the `index` position.\n */\n ondrop(event, index) {\n if (event.dataTransfer == null) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n const draggedTagValue = event.dataTransfer.getData('tagValue');\n const draggedTagindex = parseInt(event.dataTransfer.getData('index'));\n const sameOrigin = event.dataTransfer.getData('origin') == this.model.model_id;\n // If something else than a tag was dropped, draggedTagindex should be NaN\n if (isNaN(draggedTagindex)) {\n return;\n }\n // If it's the same origin, the drag and drop results in a reordering\n if (sameOrigin) {\n const value = this.model.get('value');\n const newValue = [...value];\n // If the old position is on the left of the new position, we need to re-index the new position\n // after removing the tag at the old position\n if (draggedTagindex < index) {\n index--;\n }\n newValue.splice(draggedTagindex, 1); // Removing at the old position\n newValue.splice(index, 0, draggedTagValue); // Adding at the new one\n this.model.set('value', newValue);\n this.model.save_changes();\n return;\n }\n // Else we add a new tag with the given draggedTagValue\n this.addTag(index, draggedTagValue);\n }\n ondragover(event) {\n // This is needed for the drag and drop to work\n event.preventDefault();\n }\n ondragenter(event, index) {\n if (this.hoveredTag != null && this.hoveredTag != this.tags[index]) {\n this.hoveredTag.style.marginLeft = '1px';\n }\n this.hoveredTag = this.tags[index];\n this.hoveredTagIndex = index;\n this.hoveredTag.style.marginLeft = '30px';\n }\n ondragend() {\n if (this.hoveredTag != null) {\n this.hoveredTag.style.marginLeft = '1px';\n }\n this.hoveredTag = null;\n this.hoveredTagIndex = null;\n }\n /**\n * Select tags from `start` to `start + dx` not included.\n */\n select(start, dx) {\n const valueLength = this.model.get('value').length;\n if (!this.selection) {\n this.selection = new Selection(start, dx, valueLength);\n }\n else {\n this.selection.updateSelection(dx);\n }\n }\n /**\n * Remove all the selected tags.\n */\n removeSelectedTags() {\n const value = [...this.model.get('value')];\n const valueLength = value.length;\n // It is simpler to remove from right to left\n for (let idx = valueLength - 1; idx >= 0; idx--) {\n if (this.selection != null && this.selection.isSelected(idx)) {\n value.splice(idx, 1);\n // Move the input to the left if we remove a tag that is before the input\n if (idx < this.inputIndex) {\n this.inputIndex--;\n }\n }\n }\n this.model.set('value', value);\n this.model.save_changes();\n }\n /**\n * Remove a tag given its index in the list\n */\n removeTag(tagIndex) {\n const value = [...this.model.get('value')];\n value.splice(tagIndex, 1);\n // Move the input to the left if we remove a tag that is before the input\n if (tagIndex < this.inputIndex) {\n this.inputIndex--;\n }\n this.model.set('value', value);\n this.model.save_changes();\n }\n /**\n * Focus on the input element\n */\n focus() {\n this.taginputWrapper.style.display = 'inline-block';\n this.taginput.focus();\n }\n /**\n * Lose focus on the input element\n */\n loseFocus() {\n if (this.preventLoosingFocus) {\n return;\n }\n // Only hide the input if we have tags displayed\n if (this.model.get('value').length) {\n this.taginputWrapper.style.display = 'none';\n }\n this.selection = null;\n this.updateTags();\n }\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'div';\n }\n /**\n * Validate an input tag typed by the user, returning the correct tag type. This should be overridden in subclasses.\n */\n validateValue(value) {\n return value;\n }\n}\nexport class TagsInputModel extends TagsInputBaseModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: [], tag_style: '', _view_name: 'TagsInputView', _model_name: 'TagsInputModel' });\n }\n}\nexport class TagsInputView extends TagsInputBaseView {\n /**\n * Create the string tag\n */\n createTag(value, index, selected) {\n const tag = document.createElement('div');\n const style = this.model.get('tag_style');\n tag.classList.add('jupyter-widget-tag');\n tag.classList.add(TagsInputView.class_map[style]);\n if (selected) {\n tag.classList.add('mod-active');\n }\n tag.appendChild(document.createTextNode(this.getTagText(value)));\n const i = document.createElement('i');\n i.classList.add('fa');\n i.classList.add('fa-times');\n i.classList.add('jupyter-widget-tag-close');\n tag.appendChild(i);\n i.onmousedown = ((index) => {\n return () => {\n this.removeTag(index);\n this.loseFocus();\n };\n })(index);\n return tag;\n }\n /**\n * Returns the text that should be displayed in the tag element\n */\n getTagText(value) {\n return value;\n }\n /**\n * Update a given tag\n */\n updateTag(tag, value, index, selected) {\n if (selected) {\n tag.classList.add('mod-active');\n }\n else {\n tag.classList.remove('mod-active');\n }\n }\n}\nTagsInputView.class_map = {\n primary: 'mod-primary',\n success: 'mod-success',\n info: 'mod-info',\n warning: 'mod-warning',\n danger: 'mod-danger',\n};\nexport class ColorsInputModel extends TagsInputBaseModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: [], _view_name: 'ColorsInputView', _model_name: 'ColorsInputModel' });\n }\n}\nexport class ColorsInputView extends TagsInputBaseView {\n /**\n * Create the Color tag\n */\n createTag(value, index, selected) {\n const tag = document.createElement('div');\n const color = value;\n const darkerColor = d3Color.color(value).darker().toString();\n tag.classList.add('jupyter-widget-tag');\n tag.classList.add('jupyter-widget-colortag');\n if (!selected) {\n tag.style.backgroundColor = color;\n }\n else {\n tag.classList.add('mod-active');\n tag.style.backgroundColor = darkerColor;\n }\n const i = document.createElement('i');\n i.classList.add('fa');\n i.classList.add('fa-times');\n i.classList.add('jupyter-widget-tag-close');\n tag.appendChild(i);\n i.onmousedown = ((index) => {\n return () => {\n this.removeTag(index);\n this.loseFocus();\n };\n })(index);\n return tag;\n }\n /**\n * Update a given tag\n */\n updateTag(tag, value, index, selected) {\n const color = value;\n const darkerColor = d3Color.color(value).darker().toString();\n if (!selected) {\n tag.classList.remove('mod-active');\n tag.style.backgroundColor = color;\n }\n else {\n tag.classList.add('mod-active');\n tag.style.backgroundColor = darkerColor;\n }\n }\n /**\n * Validate an input tag typed by the user, returning the correct tag type. This should be overridden in subclasses.\n */\n validateValue(value) {\n if (d3Color.color(value) == null) {\n throw value + ' is not a valid Color';\n }\n return value;\n }\n}\nclass NumbersInputModel extends TagsInputModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { min: null, max: null });\n }\n}\nclass NumbersInputView extends TagsInputView {\n render() {\n // Initialize text formatter\n this.model.on('change:format', () => {\n this.formatter = d3Format.format(this.model.get('format'));\n this.update();\n });\n this.formatter = d3Format.format(this.model.get('format'));\n super.render();\n }\n /**\n * Returns the text that should be displayed in the tag element\n */\n getTagText(value) {\n return this.formatter(this.parseNumber(value));\n }\n /**\n * Validate an input tag typed by the user, returning the correct tag type. This should be overridden in subclasses.\n */\n validateValue(value) {\n const parsed = this.parseNumber(value);\n const min = this.model.get('min');\n const max = this.model.get('max');\n if (isNaN(parsed) ||\n (min != null && parsed < min) ||\n (max != null && parsed > max)) {\n throw (value +\n ' is not a valid number, it should be in the range [' +\n min +\n ', ' +\n max +\n ']');\n }\n return parsed;\n }\n}\nexport class FloatsInputModel extends NumbersInputModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'FloatsInputView', _model_name: 'FloatsInputModel', format: '.1f' });\n }\n}\nexport class FloatsInputView extends NumbersInputView {\n parseNumber(value) {\n return parseFloat(value);\n }\n}\nexport class IntsInputModel extends NumbersInputModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'IntsInputView', _model_name: 'IntsInputModel', format: 'd' });\n }\n}\nexport class IntsInputView extends NumbersInputView {\n parseNumber(value) {\n const int = parseInt(value);\n if (int != parseFloat(value)) {\n throw value + ' should be an integer';\n }\n return int;\n }\n}\n//# sourceMappingURL=widget_tagsinput.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDescriptionModel } from './widget_core';\nimport { DescriptionStyleModel, DescriptionView } from './widget_description';\nimport { uuid } from './utils';\nimport { JUPYTER_CONTROLS_VERSION } from './version';\n/**\n * Class name for a combobox with an invalid value.\n */\nconst INVALID_VALUE_CLASS = 'jpwidgets-invalidComboValue';\nclass StringStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'StringStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nStringStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { background: {\n selector: '',\n attribute: 'background',\n default: null,\n }, font_size: {\n selector: '',\n attribute: 'font-size',\n default: '',\n }, text_color: {\n selector: '',\n attribute: 'color',\n default: '',\n } });\nexport class HTMLStyleModel extends StringStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'HTMLStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nHTMLStyleModel.styleProperties = Object.assign({}, StringStyleModel.styleProperties);\nexport class HTMLMathStyleModel extends StringStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'HTMLMathStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nHTMLMathStyleModel.styleProperties = Object.assign({}, StringStyleModel.styleProperties);\nexport class LabelStyleModel extends StringStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'LabelStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nLabelStyleModel.styleProperties = Object.assign(Object.assign({}, StringStyleModel.styleProperties), { font_family: {\n selector: '',\n attribute: 'font-family',\n default: '',\n }, font_style: {\n selector: '',\n attribute: 'font-style',\n default: '',\n }, font_variant: {\n selector: '',\n attribute: 'font-variant',\n default: '',\n }, font_weight: {\n selector: '',\n attribute: 'font-weight',\n default: '',\n }, text_decoration: {\n selector: '',\n attribute: 'text-decoration',\n default: '',\n } });\nexport class TextStyleModel extends DescriptionStyleModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'TextStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: JUPYTER_CONTROLS_VERSION });\n }\n}\nTextStyleModel.styleProperties = Object.assign(Object.assign({}, DescriptionStyleModel.styleProperties), { background: {\n selector: '.widget-input',\n attribute: 'background',\n default: null,\n }, font_size: {\n selector: '.widget-input',\n attribute: 'font-size',\n default: '',\n }, text_color: {\n selector: '.widget-input',\n attribute: 'color',\n default: '',\n } });\nexport class StringModel extends CoreDescriptionModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { value: '', disabled: false, placeholder: '\\u200b', _model_name: 'StringModel' });\n }\n}\nexport class StringView extends DescriptionView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render(); // Incl. setting some defaults.\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-inline-hbox');\n }\n}\nexport class HTMLModel extends StringModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'HTMLView', _model_name: 'HTMLModel' });\n }\n}\nexport class HTMLView extends StringView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-html');\n this.content = document.createElement('div');\n this.content.classList.add('widget-html-content');\n this.el.appendChild(this.content);\n this.update(); // Set defaults.\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n this.content.innerHTML = this.model.get('value');\n return super.update();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.content.focus();\n }\n else if (content.do === 'blur') {\n this.content.blur();\n }\n }\n}\nexport class HTMLMathModel extends StringModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'HTMLMathView', _model_name: 'HTMLMathModel' });\n }\n}\nexport class HTMLMathView extends StringView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-htmlmath');\n this.content = document.createElement('div');\n this.content.classList.add('widget-htmlmath-content');\n this.el.appendChild(this.content);\n this.update(); // Set defaults.\n }\n /**\n * Update the contents of this view\n */\n update() {\n this.content.innerHTML = this.model.get('value');\n this.typeset(this.content);\n return super.update();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.content.focus();\n }\n else if (content.do === 'blur') {\n this.content.blur();\n }\n }\n}\nexport class LabelModel extends StringModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'LabelView', _model_name: 'LabelModel' });\n }\n}\nexport class LabelView extends StringView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-label');\n this.update(); // Set defaults.\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update() {\n this.typeset(this.el, this.model.get('value'));\n return super.update();\n }\n}\nexport class TextareaModel extends StringModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'TextareaView', _model_name: 'TextareaModel', rows: null, continuous_update: true });\n }\n}\nexport class TextareaView extends StringView {\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-textarea');\n this.textbox = document.createElement('textarea');\n this.textbox.setAttribute('rows', '5');\n this.textbox.id = this.label.htmlFor = uuid();\n this.textbox.classList.add('widget-input');\n this.el.appendChild(this.textbox);\n this.update(); // Set defaults.\n this.listenTo(this.model, 'change:placeholder', (model, value, options) => {\n this.update_placeholder(value);\n });\n this.update_placeholder();\n this.updateTooltip();\n }\n update_placeholder(value) {\n const v = value || this.model.get('placeholder');\n this.textbox.setAttribute('placeholder', v.toString());\n }\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n update(options) {\n if (options === undefined || options.updated_view !== this) {\n this.textbox.value = this.model.get('value');\n let rows = this.model.get('rows');\n if (rows === null) {\n rows = '';\n }\n this.textbox.setAttribute('rows', rows);\n this.textbox.disabled = this.model.get('disabled');\n }\n this.updateTabindex();\n this.updateTooltip();\n return super.update();\n }\n updateTabindex() {\n if (!this.textbox) {\n return; // we might be constructing the parent\n }\n const tabbable = this.model.get('tabbable');\n if (tabbable === true) {\n this.textbox.setAttribute('tabIndex', '0');\n }\n else if (tabbable === false) {\n this.textbox.setAttribute('tabIndex', '-1');\n }\n else if (tabbable === null) {\n this.textbox.removeAttribute('tabIndex');\n }\n }\n updateTooltip() {\n if (!this.textbox)\n return; // we might be constructing the parent\n const title = this.model.get('tooltip');\n if (!title) {\n this.textbox.removeAttribute('title');\n }\n else if (this.model.get('description').length === 0) {\n this.textbox.setAttribute('title', title);\n }\n }\n events() {\n return {\n 'keydown input': 'handleKeyDown',\n 'keypress input': 'handleKeypress',\n 'input textarea': 'handleChanging',\n 'change textarea': 'handleChanged',\n };\n }\n /**\n * Handle key down\n *\n * Stop propagation so the event isn't sent to the application.\n */\n handleKeyDown(e) {\n e.stopPropagation();\n }\n /**\n * Handles key press\n *\n * Stop propagation so the keypress isn't sent to the application.\n */\n handleKeypress(e) {\n e.stopPropagation();\n }\n /**\n * Triggered on input change\n */\n handleChanging(e) {\n if (this.model.get('continuous_update')) {\n this.handleChanged(e);\n }\n }\n /**\n * Sync the value with the kernel.\n *\n * @param e Event\n */\n handleChanged(e) {\n const target = e.target;\n this.model.set('value', target.value, { updated_view: this });\n this.touch();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.textbox.focus();\n }\n else if (content.do === 'blur') {\n this.textbox.blur();\n }\n }\n}\nexport class TextModel extends StringModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'TextView', _model_name: 'TextModel', continuous_update: true });\n }\n}\nexport class TextView extends StringView {\n constructor() {\n super(...arguments);\n this.inputType = 'text';\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this.el.classList.add('widget-text');\n this.textbox = document.createElement('input');\n this.textbox.setAttribute('type', this.inputType);\n this.textbox.id = this.label.htmlFor = uuid();\n this.textbox.classList.add('widget-input');\n this.el.appendChild(this.textbox);\n this.update(); // Set defaults.\n this.listenTo(this.model, 'change:placeholder', (model, value, options) => {\n this.update_placeholder(value);\n });\n this.update_placeholder();\n this.updateTabindex();\n this.updateTooltip();\n }\n update_placeholder(value) {\n this.textbox.setAttribute('placeholder', value || this.model.get('placeholder'));\n }\n updateTabindex() {\n if (!this.textbox) {\n return; // we might be constructing the parent\n }\n const tabbable = this.model.get('tabbable');\n if (tabbable === true) {\n this.textbox.setAttribute('tabIndex', '0');\n }\n else if (tabbable === false) {\n this.textbox.setAttribute('tabIndex', '-1');\n }\n else if (tabbable === null) {\n this.textbox.removeAttribute('tabIndex');\n }\n }\n updateTooltip() {\n if (!this.textbox)\n return; // we might be constructing the parent\n const title = this.model.get('tooltip');\n if (!title) {\n this.textbox.removeAttribute('title');\n }\n else if (this.model.get('description').length === 0) {\n this.textbox.setAttribute('title', title);\n }\n }\n update(options) {\n /**\n * Update the contents of this view\n *\n * Called when the model is changed. The model may have been\n * changed by another view or by a state update from the back-end.\n */\n if (options === undefined || options.updated_view !== this) {\n if (this.textbox.value !== this.model.get('value')) {\n this.textbox.value = this.model.get('value');\n }\n this.textbox.disabled = this.model.get('disabled');\n }\n return super.update();\n }\n events() {\n return {\n 'keydown input': 'handleKeyDown',\n 'keypress input': 'handleKeypress',\n 'input input': 'handleChanging',\n 'change input': 'handleChanged',\n };\n }\n /**\n * Handle key down\n *\n * Stop propagation so the keypress isn't sent to the application.\n */\n handleKeyDown(e) {\n e.stopPropagation();\n }\n /**\n * Handles text submission\n */\n handleKeypress(e) {\n e.stopPropagation();\n // The submit message is deprecated in widgets 7\n if (e.keyCode === 13) {\n // Return key\n this.send({ event: 'submit' });\n }\n }\n /**\n * Handles user input.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n handleChanging(e) {\n if (this.model.get('continuous_update')) {\n this.handleChanged(e);\n }\n }\n /**\n * Handles user input.\n *\n * Calling model.set will trigger all of the other views of the\n * model to update.\n */\n handleChanged(e) {\n const target = e.target;\n this.model.set('value', target.value, { updated_view: this });\n this.touch();\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.textbox.focus();\n }\n else if (content.do === 'blur') {\n this.textbox.blur();\n }\n }\n}\nexport class PasswordModel extends TextModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _view_name: 'PasswordView', _model_name: 'PasswordModel' });\n }\n}\nexport class PasswordView extends TextView {\n constructor() {\n super(...arguments);\n this.inputType = 'password';\n }\n}\n/**\n * Combobox widget model class.\n */\nexport class ComboboxModel extends TextModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'ComboboxModel', _view_name: 'ComboboxView', options: [], ensure_options: false });\n }\n}\n/**\n * Combobox widget view class.\n */\nexport class ComboboxView extends TextView {\n constructor() {\n super(...arguments);\n this.isInitialRender = true;\n }\n render() {\n this.datalist = document.createElement('datalist');\n this.datalist.id = uuid();\n super.render();\n this.textbox.setAttribute('list', this.datalist.id);\n this.el.appendChild(this.datalist);\n this.updateTooltip();\n }\n update(options) {\n super.update(options);\n if (!this.datalist) {\n return;\n }\n const valid = this.isValid(this.model.get('value'));\n this.highlightValidState(valid);\n // Check if we need to update options\n if ((options !== undefined && options.updated_view) ||\n (!this.model.hasChanged('options') && !this.isInitialRender)) {\n // Value update only, keep current options\n return;\n }\n this.isInitialRender = false;\n const opts = this.model.get('options');\n const optionFragment = document.createDocumentFragment();\n for (const v of opts) {\n const o = document.createElement('option');\n o.value = v;\n optionFragment.appendChild(o);\n }\n this.datalist.replaceChildren(...optionFragment.children);\n }\n isValid(value) {\n if (true === this.model.get('ensure_option')) {\n const options = this.model.get('options');\n if (options.indexOf(value) === -1) {\n return false;\n }\n }\n return true;\n }\n handleChanging(e) {\n // Override to validate value\n const target = e.target;\n const valid = this.isValid(target.value);\n this.highlightValidState(valid);\n if (valid) {\n super.handleChanging(e);\n }\n }\n handleChanged(e) {\n // Override to validate value\n const target = e.target;\n const valid = this.isValid(target.value);\n this.highlightValidState(valid);\n if (valid) {\n super.handleChanged(e);\n }\n }\n /**\n * Handle message sent to the front end.\n */\n handle_message(content) {\n if (content.do === 'focus') {\n this.textbox.focus();\n }\n else if (content.do === 'blur') {\n this.textbox.blur();\n }\n }\n highlightValidState(valid) {\n this.textbox.classList.toggle(INVALID_VALUE_CLASS, !valid);\n }\n}\n//# sourceMappingURL=widget_string.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { CoreDOMWidgetModel } from './widget_core';\nimport { DOMWidgetView } from '@jupyter-widgets/base';\nexport class FileUploadModel extends CoreDOMWidgetModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { _model_name: 'FileUploadModel', _view_name: 'FileUploadView', accept: '', description: 'Upload', disabled: false, icon: 'upload', button_style: '', multiple: false, value: [], error: '', style: null });\n }\n}\nFileUploadModel.serializers = Object.assign(Object.assign({}, CoreDOMWidgetModel.serializers), { \n // use a dummy serializer for value to circumvent the default serializer.\n value: { serialize: (x) => x } });\nexport class FileUploadView extends DOMWidgetView {\n preinitialize() {\n // Must set this before the initialize method creates the element\n this.tagName = 'button';\n }\n render() {\n super.render();\n this.el.classList.add('jupyter-widgets');\n this.el.classList.add('widget-upload');\n this.el.classList.add('jupyter-button');\n this.fileInput = document.createElement('input');\n this.fileInput.type = 'file';\n this.fileInput.style.display = 'none';\n this.el.addEventListener('click', () => {\n this.fileInput.click();\n });\n this.fileInput.addEventListener('click', () => {\n this.fileInput.value = '';\n });\n this.fileInput.addEventListener('change', () => {\n var _a;\n const promisesFile = [];\n Array.from((_a = this.fileInput.files) !== null && _a !== void 0 ? _a : []).forEach((file) => {\n promisesFile.push(new Promise((resolve, reject) => {\n const fileReader = new FileReader();\n fileReader.onload = () => {\n // We know we can read the result as an array buffer since\n // we use the `.readAsArrayBuffer` method\n const content = fileReader.result;\n resolve({\n content,\n name: file.name,\n type: file.type,\n size: file.size,\n last_modified: file.lastModified,\n });\n };\n fileReader.onerror = () => {\n reject();\n };\n fileReader.onabort = fileReader.onerror;\n fileReader.readAsArrayBuffer(file);\n }));\n });\n Promise.all(promisesFile)\n .then((files) => {\n this.model.set({\n value: files,\n error: '',\n });\n this.touch();\n })\n .catch((err) => {\n console.error('error in file upload: %o', err);\n this.model.set({\n error: err,\n });\n this.touch();\n });\n });\n this.listenTo(this.model, 'change:button_style', this.update_button_style);\n this.set_button_style();\n this.update(); // Set defaults.\n }\n update() {\n this.el.disabled = this.model.get('disabled');\n this.el.setAttribute('title', this.model.get('tooltip'));\n const value = this.model.get('value');\n const description = `${this.model.get('description')} (${value.length})`;\n const icon = this.model.get('icon');\n if (description.length || icon.length) {\n this.el.textContent = '';\n if (icon.length) {\n const i = document.createElement('i');\n i.classList.add('fa');\n i.classList.add('fa-' + icon);\n if (description.length === 0) {\n i.classList.add('center');\n }\n this.el.appendChild(i);\n }\n this.el.appendChild(document.createTextNode(description));\n }\n this.fileInput.accept = this.model.get('accept');\n this.fileInput.multiple = this.model.get('multiple');\n return super.update();\n }\n update_button_style() {\n this.update_mapped_classes(FileUploadView.class_map, 'button_style', this.el);\n }\n set_button_style() {\n this.set_mapped_classes(FileUploadView.class_map, 'button_style', this.el);\n }\n}\nFileUploadView.class_map = {\n primary: ['mod-primary'],\n success: ['mod-success'],\n info: ['mod-info'],\n warning: ['mod-warning'],\n danger: ['mod-danger'],\n};\n//# sourceMappingURL=widget_upload.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nexport * from './utils';\nexport * from './version';\nexport * from './widget_link';\nexport * from './widget_bool';\nexport * from './widget_button';\nexport * from './widget_box';\nexport * from './widget_image';\nexport * from './widget_video';\nexport * from './widget_audio';\nexport * from './widget_color';\nexport * from './widget_date';\nexport * from './widget_datetime';\nexport * from './widget_time';\nexport * from './widget_int';\nexport * from './widget_float';\nexport * from './widget_controller';\nexport * from './widget_selection';\nexport * from './widget_selectioncontainer';\nexport * from './widget_tagsinput';\nexport * from './widget_string';\nexport * from './widget_description';\nexport * from './widget_upload';\nexport const version = require('../package.json').version;\n//# sourceMappingURL=index.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * The version of the Jupyter controls widget attribute spec that this package\n * implements.\n */\nexport const JUPYTER_CONTROLS_VERSION = '2.0.0';\n//# sourceMappingURL=version.js.map","/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\nimport { Token } from '@lumino/coreutils';\n/**\n * The setting registry token.\n */\nexport const ISettingRegistry = new Token('@jupyterlab/coreutils:ISettingRegistry', `A service for the JupyterLab settings system.\n Use this if you want to store settings for your application.\n See \"schemaDir\" for more information.`);\n//# sourceMappingURL=tokens.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { Token } from '@lumino/coreutils';\n/**\n * The notebook widget factory token.\n */\nexport const INotebookWidgetFactory = new Token('@jupyterlab/notebook:INotebookWidgetFactory', 'A service to create the notebook viewer.');\n/**\n * The notebook tools token.\n */\nexport const INotebookTools = new Token('@jupyterlab/notebook:INotebookTools', `A service for the \"Notebook Tools\" panel in the\n right sidebar. Use this to add your own functionality to the panel.`);\n/**\n * The notebook tracker token.\n */\nexport const INotebookTracker = new Token('@jupyterlab/notebook:INotebookTracker', `A widget tracker for notebooks.\n Use this if you want to be able to iterate over and interact with notebooks\n created by the application.`);\n/**\n * The notebook cell executor token.\n */\nexport const INotebookCellExecutor = new Token('@jupyterlab/notebook:INotebookCellExecutor', `The notebook cell executor`);\n//# sourceMappingURL=tokens.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { Token } from '@lumino/coreutils';\n/**\n * The main menu token.\n */\nexport const IMainMenu = new Token('@jupyterlab/mainmenu:IMainMenu', `A service for the main menu bar for the application.\n Use this if you want to add your own menu items or provide implementations for standardized menu items for specific activities.`);\n//# sourceMappingURL=tokens.js.map","/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\nimport { Token } from '@lumino/coreutils';\n/**\n * The rendermime token.\n */\nexport const IRenderMimeRegistry = new Token('@jupyterlab/rendermime:IRenderMimeRegistry', 'A service for the rendermime registry for the application. Use this to create renderers for various mime-types in your extension. Many times it will be easier to create a \"mime renderer extension\" rather than using this service directly.');\n/**\n * The latex typesetter token.\n */\nexport const ILatexTypesetter = new Token('@jupyterlab/rendermime:ILatexTypesetter', 'A service for the LaTeX typesetter for the application. Use this if you want to typeset math in your extension.');\n/**\n * The markdown parser token.\n */\nexport const IMarkdownParser = new Token('@jupyterlab/rendermime:IMarkdownParser', 'A service for rendering markdown syntax as HTML content.');\n//# sourceMappingURL=tokens.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { Token } from '@lumino/coreutils';\n/**\n * The Logger Registry token.\n */\nexport const ILoggerRegistry = new Token('@jupyterlab/logconsole:ILoggerRegistry', 'A service providing a logger infrastructure.');\n//# sourceMappingURL=tokens.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for array-specific algorithms.\n */\nvar ArrayExt;\n(function (ArrayExt) {\n /**\n * Find the index of the first occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.firstIndexOf(data, 'red'); // -1\n * ArrayExt.firstIndexOf(data, 'one'); // 0\n * ArrayExt.firstIndexOf(data, 'one', 1); // 4\n * ArrayExt.firstIndexOf(data, 'two', 2); // -1\n * ArrayExt.firstIndexOf(data, 'two', 2, 1); // 1\n * ```\n */\n function firstIndexOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.firstIndexOf = firstIndexOf;\n /**\n * Find the index of the last occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.lastIndexOf(data, 'red'); // -1\n * ArrayExt.lastIndexOf(data, 'one'); // 4\n * ArrayExt.lastIndexOf(data, 'one', 1); // 0\n * ArrayExt.lastIndexOf(data, 'two', 0); // -1\n * ArrayExt.lastIndexOf(data, 'two', 0, 1); // 1\n * ```\n */\n function lastIndexOf(array, value, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (start < stop) {\n span = start + 1 + (n - stop);\n }\n else {\n span = start - stop + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start - i + n) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.lastIndexOf = lastIndexOf;\n /**\n * Find the index of the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstIndex(data, isEven); // 1\n * ArrayExt.findFirstIndex(data, isEven, 4); // 5\n * ArrayExt.findFirstIndex(data, isEven, 6); // -1\n * ArrayExt.findFirstIndex(data, isEven, 6, 5); // 1\n * ```\n */\n function findFirstIndex(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findFirstIndex = findFirstIndex;\n /**\n * Find the index of the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastIndex(data, isEven); // 5\n * ArrayExt.findLastIndex(data, isEven, 4); // 3\n * ArrayExt.findLastIndex(data, isEven, 0); // -1\n * ArrayExt.findLastIndex(data, isEven, 0, 1); // 5\n * ```\n */\n function findLastIndex(array, fn, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let d;\n if (start < stop) {\n d = start + 1 + (n - stop);\n }\n else {\n d = start - stop + 1;\n }\n for (let i = 0; i < d; ++i) {\n let j = (start - i + n) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findLastIndex = findLastIndex;\n /**\n * Find the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstValue(data, isEven); // 2\n * ArrayExt.findFirstValue(data, isEven, 2); // 4\n * ArrayExt.findFirstValue(data, isEven, 6); // undefined\n * ArrayExt.findFirstValue(data, isEven, 6, 5); // 2\n * ```\n */\n function findFirstValue(array, fn, start = 0, stop = -1) {\n let index = findFirstIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findFirstValue = findFirstValue;\n /**\n * Find the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The last matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastValue(data, isEven); // 2\n * ArrayExt.findLastValue(data, isEven, 4); // 4\n * ArrayExt.findLastValue(data, isEven, 0); // undefined\n * ArrayExt.findLastValue(data, isEven, 0, 1); // 2\n * ```\n */\n function findLastValue(array, fn, start = -1, stop = 0) {\n let index = findLastIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findLastValue = findLastValue;\n /**\n * Find the index of the first element which compares `>=` to a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>=` to the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.lowerBound(data, 0, numberCmp); // 0\n * ArrayExt.lowerBound(data, 6, numberCmp); // 3\n * ArrayExt.lowerBound(data, 7, numberCmp); // 3\n * ArrayExt.lowerBound(data, -1, numberCmp); // 0\n * ArrayExt.lowerBound(data, 10, numberCmp); // 6\n * ```\n */\n function lowerBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) < 0) {\n begin = middle + 1;\n span -= half + 1;\n }\n else {\n span = half;\n }\n }\n return begin;\n }\n ArrayExt.lowerBound = lowerBound;\n /**\n * Find the index of the first element which compares `>` than a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>` than the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.upperBound(data, 0, numberCmp); // 1\n * ArrayExt.upperBound(data, 6, numberCmp); // 3\n * ArrayExt.upperBound(data, 7, numberCmp); // 5\n * ArrayExt.upperBound(data, -1, numberCmp); // 0\n * ArrayExt.upperBound(data, 10, numberCmp); // 6\n * ```\n */\n function upperBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) > 0) {\n span = half;\n }\n else {\n begin = middle + 1;\n span -= half + 1;\n }\n }\n return begin;\n }\n ArrayExt.upperBound = upperBound;\n /**\n * Test whether two arrays are shallowly equal.\n *\n * @param a - The first array-like object to compare.\n *\n * @param b - The second array-like object to compare.\n *\n * @param fn - The comparison function to apply to the elements. It\n * should return `true` if the elements are \"equal\". The default\n * compares elements using strict `===` equality.\n *\n * @returns Whether the two arrays are shallowly equal.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * Modifying the length of the arrays while comparing.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let d1 = [0, 3, 4, 7, 7, 9];\n * let d2 = [0, 3, 4, 7, 7, 9];\n * let d3 = [42];\n * ArrayExt.shallowEqual(d1, d2); // true\n * ArrayExt.shallowEqual(d2, d3); // false\n * ```\n */\n function shallowEqual(a, b, fn) {\n // Check for object identity first.\n if (a === b) {\n return true;\n }\n // Bail early if the lengths are different.\n if (a.length !== b.length) {\n return false;\n }\n // Compare each element for equality.\n for (let i = 0, n = a.length; i < n; ++i) {\n if (fn ? !fn(a[i], b[i]) : a[i] !== b[i]) {\n return false;\n }\n }\n // The array are shallowly equal.\n return true;\n }\n ArrayExt.shallowEqual = shallowEqual;\n /**\n * Create a slice of an array subject to an optional step.\n *\n * @param array - The array-like object of interest.\n *\n * @param options - The options for configuring the slice.\n *\n * @returns A new array with the specified values.\n *\n * @throws An exception if the slice `step` is `0`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start`, `stop`, or `step` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]\n * ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]\n * ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]\n * ```\n */\n function slice(array, options = {}) {\n // Extract the options.\n let { start, stop, step } = options;\n // Set up the `step` value.\n if (step === undefined) {\n step = 1;\n }\n // Validate the step size.\n if (step === 0) {\n throw new Error('Slice `step` cannot be zero.');\n }\n // Look up the length of the array.\n let n = array.length;\n // Set up the `start` value.\n if (start === undefined) {\n start = step < 0 ? n - 1 : 0;\n }\n else if (start < 0) {\n start = Math.max(start + n, step < 0 ? -1 : 0);\n }\n else if (start >= n) {\n start = step < 0 ? n - 1 : n;\n }\n // Set up the `stop` value.\n if (stop === undefined) {\n stop = step < 0 ? -1 : n;\n }\n else if (stop < 0) {\n stop = Math.max(stop + n, step < 0 ? -1 : 0);\n }\n else if (stop >= n) {\n stop = step < 0 ? n - 1 : n;\n }\n // Compute the slice length.\n let length;\n if ((step < 0 && stop >= start) || (step > 0 && start >= stop)) {\n length = 0;\n }\n else if (step < 0) {\n length = Math.floor((stop - start + 1) / step + 1);\n }\n else {\n length = Math.floor((stop - start - 1) / step + 1);\n }\n // Compute the sliced result.\n let result = [];\n for (let i = 0; i < length; ++i) {\n result[i] = array[start + i * step];\n }\n // Return the result.\n return result;\n }\n ArrayExt.slice = slice;\n /**\n * Move an element in an array from one index to another.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param fromIndex - The index of the element to move. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param toIndex - The target index of the element. Negative\n * values are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `fromIndex` or `toIndex` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.move(data, 1, 2); // [0, 2, 1, 3, 4]\n * ArrayExt.move(data, 4, 2); // [0, 2, 4, 1, 3]\n * ```\n */\n function move(array, fromIndex, toIndex) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (fromIndex < 0) {\n fromIndex = Math.max(0, fromIndex + n);\n }\n else {\n fromIndex = Math.min(fromIndex, n - 1);\n }\n if (toIndex < 0) {\n toIndex = Math.max(0, toIndex + n);\n }\n else {\n toIndex = Math.min(toIndex, n - 1);\n }\n if (fromIndex === toIndex) {\n return;\n }\n let value = array[fromIndex];\n let d = fromIndex < toIndex ? 1 : -1;\n for (let i = fromIndex; i !== toIndex; i += d) {\n array[i] = array[i + d];\n }\n array[toIndex] = value;\n }\n ArrayExt.move = move;\n /**\n * Reverse an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param start - The index of the first element in the range to be\n * reversed, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * reversed, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` index which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.reverse(data, 1, 3); // [0, 3, 2, 1, 4]\n * ArrayExt.reverse(data, 3); // [0, 3, 2, 4, 1]\n * ArrayExt.reverse(data); // [1, 4, 2, 3, 0]\n * ```\n */\n function reverse(array, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n while (start < stop) {\n let a = array[start];\n let b = array[stop];\n array[start++] = b;\n array[stop--] = a;\n }\n }\n ArrayExt.reverse = reverse;\n /**\n * Rotate the elements of an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param delta - The amount of rotation to apply to the elements. A\n * positive value will rotate the elements to the left. A negative\n * value will rotate the elements to the right.\n *\n * @param start - The index of the first element in the range to be\n * rotated, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * rotated, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `delta`, `start`, or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.rotate(data, 2); // [2, 3, 4, 0, 1]\n * ArrayExt.rotate(data, -2); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 10); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 9); // [4, 0, 1, 2, 3]\n * ArrayExt.rotate(data, 2, 1, 3); // [4, 2, 0, 1, 3]\n * ```\n */\n function rotate(array, delta, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n if (start >= stop) {\n return;\n }\n let length = stop - start + 1;\n if (delta > 0) {\n delta = delta % length;\n }\n else if (delta < 0) {\n delta = ((delta % length) + length) % length;\n }\n if (delta === 0) {\n return;\n }\n let pivot = start + delta;\n reverse(array, start, pivot - 1);\n reverse(array, pivot, stop);\n reverse(array, start, stop);\n }\n ArrayExt.rotate = rotate;\n /**\n * Fill an array with a static value.\n *\n * @param array - The mutable array-like object to fill.\n *\n * @param value - The static value to use to fill the array.\n *\n * @param start - The index of the first element in the range to be\n * filled, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * filled, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Notes\n * If `stop < start` the fill will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four'];\n * ArrayExt.fill(data, 'r'); // ['r', 'r', 'r', 'r']\n * ArrayExt.fill(data, 'g', 1); // ['r', 'g', 'g', 'g']\n * ArrayExt.fill(data, 'b', 2, 3); // ['r', 'g', 'b', 'b']\n * ArrayExt.fill(data, 'z', 3, 1); // ['z', 'z', 'b', 'z']\n * ```\n */\n function fill(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n array[(start + i) % n] = value;\n }\n }\n ArrayExt.fill = fill;\n /**\n * Insert a value into an array at a specific index.\n *\n * @param array - The array of interest.\n *\n * @param index - The index at which to insert the value. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2];\n * ArrayExt.insert(data, 0, -1); // [-1, 0, 1, 2]\n * ArrayExt.insert(data, 2, 12); // [-1, 0, 12, 1, 2]\n * ArrayExt.insert(data, -1, 7); // [-1, 0, 12, 1, 7, 2]\n * ArrayExt.insert(data, 6, 19); // [-1, 0, 12, 1, 7, 2, 19]\n * ```\n */\n function insert(array, index, value) {\n let n = array.length;\n if (index < 0) {\n index = Math.max(0, index + n);\n }\n else {\n index = Math.min(index, n);\n }\n for (let i = n; i > index; --i) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n }\n ArrayExt.insert = insert;\n /**\n * Remove and return a value at a specific index in an array.\n *\n * @param array - The array of interest.\n *\n * @param index - The index of the value to remove. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The value at the specified index, or `undefined` if the\n * index is out of range.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeAt(data, 2); // 23\n * ArrayExt.removeAt(data, -2); // 12\n * ArrayExt.removeAt(data, 10); // undefined;\n * ```\n */\n function removeAt(array, index) {\n let n = array.length;\n if (index < 0) {\n index += n;\n }\n if (index < 0 || index >= n) {\n return undefined;\n }\n let value = array[index];\n for (let i = index + 1; i < n; ++i) {\n array[i - 1] = array[i];\n }\n array.length = n - 1;\n return value;\n }\n ArrayExt.removeAt = removeAt;\n /**\n * Remove the first occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstOf(data, 12); // 1\n * ArrayExt.removeFirstOf(data, 17); // -1\n * ArrayExt.removeFirstOf(data, 39, 3); // -1\n * ArrayExt.removeFirstOf(data, 39, 3, 2); // 2\n * ```\n */\n function removeFirstOf(array, value, start = 0, stop = -1) {\n let index = firstIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeFirstOf = removeFirstOf;\n /**\n * Remove the last occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastOf(data, 12); // 5\n * ArrayExt.removeLastOf(data, 17); // -1\n * ArrayExt.removeLastOf(data, 39, 2); // -1\n * ArrayExt.removeLastOf(data, 39, 2, 3); // 3\n * ```\n */\n function removeLastOf(array, value, start = -1, stop = 0) {\n let index = lastIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeLastOf = removeLastOf;\n /**\n * Remove all occurrences of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [14, 12, 23, 39, 14, 12, 19, 14];\n * ArrayExt.removeAllOf(data, 12); // 2\n * ArrayExt.removeAllOf(data, 17); // 0\n * ArrayExt.removeAllOf(data, 14, 1, 4); // 1\n * ```\n */\n function removeAllOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && array[i] === value) {\n count++;\n }\n else if (stop < start &&\n (i <= stop || i >= start) &&\n array[i] === value) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllOf = removeAllOf;\n /**\n * Remove the first occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstWhere(data, isEven); // { index: 0, value: 0 }\n * ArrayExt.removeFirstWhere(data, isEven, 2); // { index: 3, value: 14 }\n * ArrayExt.removeFirstWhere(data, isEven, 4); // { index: -1, value: undefined }\n * ```\n */\n function removeFirstWhere(array, fn, start = 0, stop = -1) {\n let value;\n let index = findFirstIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeFirstWhere = removeFirstWhere;\n /**\n * Remove the last occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastWhere(data, isEven); // { index: 5, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2); // { index: 1, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2, 1); // { index: -1, value: undefined }\n * ```\n */\n function removeLastWhere(array, fn, start = -1, stop = 0) {\n let value;\n let index = findLastIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeLastWhere = removeLastWhere;\n /**\n * Remove all occurrences of values which match a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * function isNegative(value: number): boolean {\n * return value < 0;\n * }\n *\n * let data = [0, 12, -13, -9, 23, 39, 14, -15, 12, 75];\n * ArrayExt.removeAllWhere(data, isEven); // 4\n * ArrayExt.removeAllWhere(data, isNegative, 0, 3); // 2\n * ```\n */\n function removeAllWhere(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && fn(array[i], i)) {\n count++;\n }\n else if (stop < start && (i <= stop || i >= start) && fn(array[i], i)) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllWhere = removeAllWhere;\n})(ArrayExt || (ArrayExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Chain together several iterables.\n *\n * @deprecated\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields the values of the iterables\n * in the order in which they are supplied.\n *\n * #### Example\n * ```typescript\n * import { chain } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = chain(data1, data2);\n *\n * Array.from(stream); // [1, 2, 3, 4, 5, 6]\n * ```\n */\nfunction* chain(...objects) {\n for (const object of objects) {\n yield* object;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an empty iterator.\n *\n * @returns A new iterator which yields nothing.\n *\n * #### Example\n * ```typescript\n * import { empty } from '@lumino/algorithm';\n *\n * let stream = empty();\n *\n * Array.from(stream); // []\n * ```\n */\n// eslint-disable-next-line require-yield\nfunction* empty() {\n return;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Enumerate an iterable object.\n *\n * @param object - The iterable object of interest.\n *\n * @param start - The starting enum value. The default is `0`.\n *\n * @returns An iterator which yields the enumerated values.\n *\n * #### Example\n * ```typescript\n * import { enumerate } from '@lumino/algorithm';\n *\n * let data = ['foo', 'bar', 'baz'];\n *\n * let stream = enumerate(data, 1);\n *\n * Array.from(stream); // [[1, 'foo'], [2, 'bar'], [3, 'baz']]\n * ```\n */\nfunction* enumerate(object, start = 0) {\n for (const value of object) {\n yield [start++, value];\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Filter an iterable for values which pass a test.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns An iterator which yields the values which pass the test.\n *\n * #### Example\n * ```typescript\n * import { filter } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = filter(data, value => value % 2 === 0);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* filter(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Find the first value in an iterable which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { find } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * find(data, isCat).name; // 'fluffy'\n * ```\n */\nfunction find(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return value;\n }\n }\n return undefined;\n}\n/**\n * Find the index of the first value which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { findIndex } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * findIndex(data, isCat); // 1\n * ```\n */\nfunction findIndex(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return index - 1;\n }\n }\n return -1;\n}\n/**\n * Find the minimum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The minimum value in the iterable. If multiple values are\n * equivalent to the minimum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { min } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * min([7, 4, 0, 3, 9, 4], numberCmp); // 0\n * ```\n */\nfunction min(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) < 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the maximum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The maximum value in the iterable. If multiple values are\n * equivalent to the maximum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { max } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * max([7, 4, 0, 3, 9, 4], numberCmp); // 9\n * ```\n */\nfunction max(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) > 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the minimum and maximum values in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns A 2-tuple of the `[min, max]` values in the iterable. If\n * multiple values are equivalent, the left-most values are returned.\n * If the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { minmax } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * minmax([7, 4, 0, 3, 9, 4], numberCmp); // [0, 9]\n * ```\n */\nfunction minmax(object, fn) {\n let empty = true;\n let vmin;\n let vmax;\n for (const value of object) {\n if (empty) {\n vmin = value;\n vmax = value;\n empty = false;\n }\n else if (fn(value, vmin) < 0) {\n vmin = value;\n }\n else if (fn(value, vmax) > 0) {\n vmax = value;\n }\n }\n return empty ? undefined : [vmin, vmax];\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an array from an iterable of values.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new array of values from the given object.\n *\n * #### Example\n * ```typescript\n * import { toArray } from '@lumino/algorithm';\n *\n * let stream = [1, 2, 3, 4, 5, 6][Symbol.iterator]();\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6];\n * ```\n */\nfunction toArray(object) {\n return Array.from(object);\n}\n/**\n * Create an object from an iterable of key/value pairs.\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new object mapping keys to values.\n *\n * #### Example\n * ```typescript\n * import { toObject } from '@lumino/algorithm';\n *\n * let data: [string, number][] = [['one', 1], ['two', 2], ['three', 3]];\n *\n * toObject(data); // { one: 1, two: 2, three: 3 }\n * ```\n */\nfunction toObject(object) {\n const result = {};\n for (const [key, value] of object) {\n result[key] = value;\n }\n return result;\n}\n/**\n * Invoke a function for each value in an iterable.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The callback function to invoke for each value.\n *\n * #### Notes\n * Iteration can be terminated early by returning `false` from the\n * callback function.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each } from '@lumino/algorithm';\n *\n * let data = [5, 7, 0, -2, 9];\n *\n * each(data, value => { console.log(value); });\n * ```\n */\nfunction each(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return;\n }\n }\n}\n/**\n * Test whether all values in an iterable satisfy a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if all values pass the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `false` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { every } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * every(data, value => value % 2 === 0); // false\n * every(data, value => value % 2 === 1); // true\n * ```\n */\nfunction every(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Test whether any value in an iterable satisfies a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if any value passes the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `true` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { some } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * some(data, value => value === 7); // true\n * some(data, value => value === 3); // false\n * ```\n */\nfunction some(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return true;\n }\n }\n return false;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Transform the values of an iterable with a mapping function.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n *\n * @returns An iterator which yields the transformed values.\n *\n * #### Example\n * ```typescript\n * import { map } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3];\n *\n * let stream = map(data, value => value * 2);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* map(object, fn) {\n let index = 0;\n for (const value of object) {\n yield fn(value, index++);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator of evenly spaced values.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns An iterator which produces evenly spaced values.\n *\n * #### Notes\n * In the single argument form of `range(stop)`, `start` defaults to\n * `0` and `step` defaults to `1`.\n *\n * In the two argument form of `range(start, stop)`, `step` defaults\n * to `1`.\n *\n * #### Example\n * ```typescript\n * import { range } from '@lumino/algorithm';\n *\n * let stream = range(2, 4);\n *\n * Array.from(stream); // [2, 3]\n * ```\n */\nfunction* range(start, stop, step) {\n if (stop === undefined) {\n stop = start;\n start = 0;\n step = 1;\n }\n else if (step === undefined) {\n step = 1;\n }\n const length = Private.rangeLength(start, stop, step);\n for (let index = 0; index < length; index++) {\n yield start + step * index;\n }\n}\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * Compute the effective length of a range.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns The number of steps need to traverse the range.\n */\n function rangeLength(start, stop, step) {\n if (step === 0) {\n return Infinity;\n }\n if (start > stop && step > 0) {\n return 0;\n }\n if (start < stop && step < 0) {\n return 0;\n }\n return Math.ceil((stop - start) / step);\n }\n Private.rangeLength = rangeLength;\n})(Private || (Private = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nfunction reduce(object, fn, initial) {\n // Setup the iterator and fetch the first value.\n const it = object[Symbol.iterator]();\n let index = 0;\n let first = it.next();\n // An empty iterator and no initial value is an error.\n if (first.done && initial === undefined) {\n throw new TypeError('Reduce of empty iterable with no initial value.');\n }\n // If the iterator is empty, return the initial value.\n if (first.done) {\n return initial;\n }\n // If the iterator has a single item and no initial value, the\n // reducer is not invoked and the first item is the return value.\n let second = it.next();\n if (second.done && initial === undefined) {\n return first.value;\n }\n // If iterator has a single item and an initial value is provided,\n // the reducer is invoked and that result is the return value.\n if (second.done) {\n return fn(initial, first.value, index++);\n }\n // Setup the initial accumlated value.\n let accumulator;\n if (initial === undefined) {\n accumulator = fn(first.value, second.value, index++);\n }\n else {\n accumulator = fn(fn(initial, first.value, index++), second.value, index++);\n }\n // Iterate the rest of the values, updating the accumulator.\n let next;\n while (!(next = it.next()).done) {\n accumulator = fn(accumulator, next.value, index++);\n }\n // Return the final accumulated value.\n return accumulator;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator which repeats a value a number of times.\n *\n * @deprecated\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n *\n * @returns A new iterator which repeats the specified value.\n *\n * #### Example\n * ```typescript\n * import { repeat } from '@lumino/algorithm';\n *\n * let stream = repeat(7, 3);\n *\n * Array.from(stream); // [7, 7, 7]\n * ```\n */\nfunction* repeat(value, count) {\n while (0 < count--) {\n yield value;\n }\n}\n/**\n * Create an iterator which yields a value a single time.\n *\n * @deprecated\n *\n * @param value - The value to wrap in an iterator.\n *\n * @returns A new iterator which yields the value a single time.\n *\n * #### Example\n * ```typescript\n * import { once } from '@lumino/algorithm';\n *\n * let stream = once(7);\n *\n * Array.from(stream); // [7]\n * ```\n */\nfunction* once(value) {\n yield value;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator for a retroable object.\n *\n * @param object - The retroable or array-like object of interest.\n *\n * @returns An iterator which traverses the object's values in reverse.\n *\n * #### Example\n * ```typescript\n * import { retro } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = retro(data);\n *\n * Array.from(stream); // [6, 5, 4, 3, 2, 1]\n * ```\n */\nfunction* retro(object) {\n if (typeof object.retro === 'function') {\n yield* object.retro();\n }\n else {\n for (let index = object.length - 1; index > -1; index--) {\n yield object[index];\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Topologically sort an iterable of edges.\n *\n * @param edges - The iterable object of edges to sort.\n * An edge is represented as a 2-tuple of `[fromNode, toNode]`.\n *\n * @returns The topologically sorted array of nodes.\n *\n * #### Notes\n * If a cycle is present in the graph, the cycle will be ignored and\n * the return value will be only approximately sorted.\n *\n * #### Example\n * ```typescript\n * import { topologicSort } from '@lumino/algorithm';\n *\n * let data = [\n * ['d', 'e'],\n * ['c', 'd'],\n * ['a', 'b'],\n * ['b', 'c']\n * ];\n *\n * topologicSort(data); // ['a', 'b', 'c', 'd', 'e']\n * ```\n */\nfunction topologicSort(edges) {\n // Setup the shared sorting state.\n let sorted = [];\n let visited = new Set();\n let graph = new Map();\n // Add the edges to the graph.\n for (const edge of edges) {\n addEdge(edge);\n }\n // Visit each node in the graph.\n for (const [k] of graph) {\n visit(k);\n }\n // Return the sorted results.\n return sorted;\n // Add an edge to the graph.\n function addEdge(edge) {\n let [fromNode, toNode] = edge;\n let children = graph.get(toNode);\n if (children) {\n children.push(fromNode);\n }\n else {\n graph.set(toNode, [fromNode]);\n }\n }\n // Recursively visit the node.\n function visit(node) {\n if (visited.has(node)) {\n return;\n }\n visited.add(node);\n let children = graph.get(node);\n if (children) {\n for (const child of children) {\n visit(child);\n }\n }\n sorted.push(node);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate over an iterable using a stepped increment.\n *\n * @param object - The iterable object of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n *\n * @returns An iterator which traverses the iterable step-wise.\n *\n * #### Example\n * ```typescript\n * import { stride } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = stride(data, 2);\n *\n * Array.from(stream); // [1, 3, 5];\n * ```\n */\nfunction* stride(object, step) {\n let count = 0;\n for (const value of object) {\n if (0 === count++ % step) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for string-specific algorithms.\n */\nvar StringExt;\n(function (StringExt) {\n /**\n * Find the indices of characters in a source text.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The matched indices, or `null` if there is no match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * In order for there to be a match, all of the characters in `query`\n * **must** appear in `source` in the order given by `query`.\n *\n * Characters are matched using strict `===` equality.\n */\n function findIndices(source, query, start = 0) {\n let indices = new Array(query.length);\n for (let i = 0, j = start, n = query.length; i < n; ++i, ++j) {\n j = source.indexOf(query[i], j);\n if (j === -1) {\n return null;\n }\n indices[i] = j;\n }\n return indices;\n }\n StringExt.findIndices = findIndices;\n /**\n * A string matcher which uses a sum-of-squares algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-squares approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The index of each\n * matching character is squared and added to the score. This means\n * that early and consecutive character matches are preferred, while\n * late matches are heavily penalized.\n */\n function matchSumOfSquares(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i] - start;\n score += j * j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfSquares = matchSumOfSquares;\n /**\n * A string matcher which uses a sum-of-deltas algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-deltas approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The delta between\n * the indices are summed to create the score. This means that groups\n * of matched characters are preferred, while fragmented matches are\n * penalized.\n */\n function matchSumOfDeltas(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n let last = start - 1;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i];\n score += j - last - 1;\n last = j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfDeltas = matchSumOfDeltas;\n /**\n * Highlight the matched characters of a source text.\n *\n * @param source - The text which should be highlighted.\n *\n * @param indices - The indices of the matched characters. They must\n * appear in increasing order and must be in bounds of the source.\n *\n * @param fn - The function to apply to the matched chunks.\n *\n * @returns An array of unmatched and highlighted chunks.\n */\n function highlight(source, indices, fn) {\n // Set up the result array.\n let result = [];\n // Set up the counter variables.\n let k = 0;\n let last = 0;\n let n = indices.length;\n // Iterator over each index.\n while (k < n) {\n // Set up the chunk indices.\n let i = indices[k];\n let j = indices[k];\n // Advance the right chunk index until it's non-contiguous.\n while (++k < n && indices[k] === j + 1) {\n j++;\n }\n // Extract the unmatched text.\n if (last < i) {\n result.push(source.slice(last, i));\n }\n // Extract and highlight the matched text.\n if (i < j + 1) {\n result.push(fn(source.slice(i, j + 1)));\n }\n // Update the last visited index.\n last = j + 1;\n }\n // Extract any remaining unmatched text.\n if (last < source.length) {\n result.push(source.slice(last));\n }\n // Return the highlighted result.\n return result;\n }\n StringExt.highlight = highlight;\n /**\n * A 3-way string comparison function.\n *\n * @param a - The first string of interest.\n *\n * @param b - The second string of interest.\n *\n * @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.\n */\n function cmp(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n StringExt.cmp = cmp;\n})(StringExt || (StringExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Take a fixed number of items from an iterable.\n *\n * @param object - The iterable object of interest.\n *\n * @param count - The number of items to take from the iterable.\n *\n * @returns An iterator which yields the specified number of items\n * from the source iterable.\n *\n * #### Notes\n * The returned iterator will exhaust early if the source iterable\n * contains an insufficient number of items.\n *\n * #### Example\n * ```typescript\n * import { take } from '@lumino/algorithm';\n *\n * let stream = take([5, 4, 3, 2, 1, 0, -1], 3);\n *\n * Array.from(stream); // [5, 4, 3]\n * ```\n */\nfunction* take(object, count) {\n if (count < 1) {\n return;\n }\n const it = object[Symbol.iterator]();\n let item;\n while (0 < count-- && !(item = it.next()).done) {\n yield item.value;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate several iterables in lockstep.\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields successive tuples of values where\n * each value is taken in turn from the provided iterables. It will\n * be as long as the shortest provided iterable.\n *\n * #### Example\n * ```typescript\n * import { zip } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = zip(data1, data2);\n *\n * Array.from(stream); // [[1, 4], [2, 5], [3, 6]]\n * ```\n */\nfunction* zip(...objects) {\n const iters = objects.map(obj => obj[Symbol.iterator]());\n let tuple = iters.map(it => it.next());\n for (; every(tuple, item => !item.done); tuple = iters.map(it => it.next())) {\n yield tuple.map(item => item.value);\n }\n}\n\nexport { ArrayExt, StringExt, chain, each, empty, enumerate, every, filter, find, findIndex, map, max, min, minmax, once, range, reduce, repeat, retro, some, stride, take, toArray, toObject, topologicSort, zip };\n//# sourceMappingURL=index.es6.js.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * A class which attaches a value to an external object.\n *\n * #### Notes\n * Attached properties are used to extend the state of an object with\n * semantic data from an unrelated class. They also encapsulate value\n * creation, coercion, and notification.\n *\n * Because attached property values are stored in a hash table, which\n * in turn is stored in a WeakMap keyed on the owner object, there is\n * non-trivial storage overhead involved in their use. The pattern is\n * therefore best used for the storage of rare data.\n */\nvar AttachedProperty = /** @class */ (function () {\n /**\n * Construct a new attached property.\n *\n * @param options - The options for initializing the property.\n */\n function AttachedProperty(options) {\n this._pid = Private.nextPID();\n this.name = options.name;\n this._create = options.create;\n this._coerce = options.coerce || null;\n this._compare = options.compare || null;\n this._changed = options.changed || null;\n }\n /**\n * Get the current value of the property for a given owner.\n *\n * @param owner - The property owner of interest.\n *\n * @returns The current value of the property.\n *\n * #### Notes\n * If the value has not yet been set, the default value will be\n * computed and assigned as the current value of the property.\n */\n AttachedProperty.prototype.get = function (owner) {\n var value;\n var map = Private.ensureMap(owner);\n if (this._pid in map) {\n value = map[this._pid];\n }\n else {\n value = map[this._pid] = this._createValue(owner);\n }\n return value;\n };\n /**\n * Set the current value of the property for a given owner.\n *\n * @param owner - The property owner of interest.\n *\n * @param value - The value for the property.\n *\n * #### Notes\n * If the value has not yet been set, the default value will be\n * computed and used as the previous value for the comparison.\n */\n AttachedProperty.prototype.set = function (owner, value) {\n var oldValue;\n var map = Private.ensureMap(owner);\n if (this._pid in map) {\n oldValue = map[this._pid];\n }\n else {\n oldValue = map[this._pid] = this._createValue(owner);\n }\n var newValue = this._coerceValue(owner, value);\n this._maybeNotify(owner, oldValue, (map[this._pid] = newValue));\n };\n /**\n * Explicitly coerce the current property value for a given owner.\n *\n * @param owner - The property owner of interest.\n *\n * #### Notes\n * If the value has not yet been set, the default value will be\n * computed and used as the previous value for the comparison.\n */\n AttachedProperty.prototype.coerce = function (owner) {\n var oldValue;\n var map = Private.ensureMap(owner);\n if (this._pid in map) {\n oldValue = map[this._pid];\n }\n else {\n oldValue = map[this._pid] = this._createValue(owner);\n }\n var newValue = this._coerceValue(owner, oldValue);\n this._maybeNotify(owner, oldValue, (map[this._pid] = newValue));\n };\n /**\n * Get or create the default value for the given owner.\n */\n AttachedProperty.prototype._createValue = function (owner) {\n var create = this._create;\n return create(owner);\n };\n /**\n * Coerce the value for the given owner.\n */\n AttachedProperty.prototype._coerceValue = function (owner, value) {\n var coerce = this._coerce;\n return coerce ? coerce(owner, value) : value;\n };\n /**\n * Compare the old value and new value for equality.\n */\n AttachedProperty.prototype._compareValue = function (oldValue, newValue) {\n var compare = this._compare;\n return compare ? compare(oldValue, newValue) : oldValue === newValue;\n };\n /**\n * Run the change notification if the given values are different.\n */\n AttachedProperty.prototype._maybeNotify = function (owner, oldValue, newValue) {\n var changed = this._changed;\n if (changed && !this._compareValue(oldValue, newValue)) {\n changed(owner, oldValue, newValue);\n }\n };\n return AttachedProperty;\n}());\n/**\n * The namespace for the `AttachedProperty` class statics.\n */\n(function (AttachedProperty) {\n /**\n * Clear the stored property data for the given owner.\n *\n * @param owner - The property owner of interest.\n *\n * #### Notes\n * This will clear all property values for the owner, but it will\n * **not** run the change notification for any of the properties.\n */\n function clearData(owner) {\n Private.ownerData.delete(owner);\n }\n AttachedProperty.clearData = clearData;\n})(AttachedProperty || (AttachedProperty = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * A weak mapping of property owner to property map.\n */\n Private.ownerData = new WeakMap();\n /**\n * A function which computes successive unique property ids.\n */\n Private.nextPID = (function () {\n var id = 0;\n return function () {\n var rand = Math.random();\n var stem = (\"\" + rand).slice(2);\n return \"pid-\" + stem + \"-\" + id++;\n };\n })();\n /**\n * Lookup the data map for the property owner.\n *\n * This will create the map if one does not already exist.\n */\n function ensureMap(owner) {\n var map = Private.ownerData.get(owner);\n if (map) {\n return map;\n }\n map = Object.create(null);\n Private.ownerData.set(owner, map);\n return map;\n }\n Private.ensureMap = ensureMap;\n})(Private || (Private = {}));\n\nexport { AttachedProperty };\n//# sourceMappingURL=index.es6.js.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { PromiseDelegate } from '@lumino/coreutils';\nimport { Panel } from '@lumino/widgets';\n/**\n * A renderer for widgets.\n */\nexport class WidgetRenderer extends Panel {\n constructor(options, manager) {\n super();\n this._manager = new PromiseDelegate();\n this._rerenderMimeModel = null;\n this.mimeType = options.mimeType;\n if (manager) {\n this.manager = manager;\n }\n }\n /**\n * The widget manager.\n */\n set manager(value) {\n value.restored.connect(this._rerender, this);\n this._manager.resolve(value);\n }\n async renderModel(model) {\n const source = model.data[this.mimeType];\n // Let's be optimistic, and hope the widget state will come later.\n this.node.textContent = 'Loading widget...';\n const manager = await this._manager.promise;\n // If there is no model id, the view was removed, so hide the node.\n if (source.model_id === '') {\n this.hide();\n return Promise.resolve();\n }\n let wModel;\n try {\n // Presume we have a DOMWidgetModel. Should we check for sure?\n wModel = (await manager.get_model(source.model_id));\n }\n catch (err) {\n if (manager.restoredStatus) {\n // The manager has been restored, so this error won't be going away.\n this.node.textContent = 'Error displaying widget: model not found';\n this.addClass('jupyter-widgets');\n console.error(err);\n return;\n }\n // Store the model for a possible rerender\n this._rerenderMimeModel = model;\n return;\n }\n // Successful getting the model, so we don't need to try to rerender.\n this._rerenderMimeModel = null;\n let widget;\n try {\n widget = (await manager.create_view(wModel)).luminoWidget;\n }\n catch (err) {\n this.node.textContent = 'Error displaying widget';\n this.addClass('jupyter-widgets');\n console.error(err);\n return;\n }\n // Clear any previous loading message.\n this.node.textContent = '';\n this.addWidget(widget);\n // When the widget is disposed, hide this container and make sure we\n // change the output model to reflect the view was closed.\n widget.disposed.connect(() => {\n this.hide();\n source.model_id = '';\n });\n }\n /**\n * Dispose the resources held by the manager.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._manager = null;\n super.dispose();\n }\n _rerender() {\n if (this._rerenderMimeModel) {\n // Clear the error message\n this.node.textContent = '';\n this.removeClass('jupyter-widgets');\n // Attempt to rerender.\n this.renderModel(this._rerenderMimeModel);\n }\n }\n}\n//# sourceMappingURL=renderer.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { maxSatisfying } from 'semver';\n/**\n * A cache using semver ranges to retrieve values.\n */\nexport class SemVerCache {\n constructor() {\n this._cache = Object.create(null);\n }\n set(key, version, object) {\n if (!(key in this._cache)) {\n this._cache[key] = Object.create(null);\n }\n if (!(version in this._cache[key])) {\n this._cache[key][version] = object;\n }\n else {\n throw `Version ${version} of key ${key} already registered.`;\n }\n }\n get(key, semver) {\n if (key in this._cache) {\n const versions = this._cache[key];\n const best = maxSatisfying(Object.keys(versions), semver);\n if (best !== null) {\n return versions[best];\n }\n }\n }\n getAllVersions(key) {\n if (key in this._cache) {\n return this._cache[key];\n }\n }\n}\n//# sourceMappingURL=semvercache.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { shims, } from '@jupyter-widgets/base';\nimport { ManagerBase, serialize_state, } from '@jupyter-widgets/base-manager';\nimport { Signal } from '@lumino/signaling';\nimport { valid } from 'semver';\nimport { SemVerCache } from './semvercache';\n/**\n * The mime type for a widget view.\n */\nexport const WIDGET_VIEW_MIMETYPE = 'application/vnd.jupyter.widget-view+json';\n/**\n * The mime type for widget state data.\n */\nexport const WIDGET_STATE_MIMETYPE = 'application/vnd.jupyter.widget-state+json';\n/**\n * A widget manager that returns Lumino widgets.\n */\nexport class LabWidgetManager extends ManagerBase {\n constructor(rendermime) {\n super();\n // _handleCommOpen is an attribute, not a method, so `this` is captured in a\n // single object that can be registered and removed\n this._handleCommOpen = async (comm, msg) => {\n const oldComm = new shims.services.Comm(comm);\n await this.handle_comm_open(oldComm, msg);\n };\n this._restored = new Signal(this);\n this._restoredStatus = false;\n this._kernelRestoreInProgress = false;\n this._isDisposed = false;\n this._registry = new SemVerCache();\n this._modelsSync = new Map();\n this._onUnhandledIOPubMessage = new Signal(this);\n this._rendermime = rendermime;\n }\n /**\n * Default callback handler to emit unhandled kernel messages.\n */\n callbacks(view) {\n return {\n iopub: {\n output: (msg) => {\n this._onUnhandledIOPubMessage.emit(msg);\n },\n },\n };\n }\n /**\n * Register a new kernel\n */\n _handleKernelChanged({ oldValue, newValue, }) {\n if (oldValue) {\n oldValue.removeCommTarget(this.comm_target_name, this._handleCommOpen);\n }\n if (newValue) {\n newValue.registerCommTarget(this.comm_target_name, this._handleCommOpen);\n }\n }\n /**\n * Disconnect the widget manager from the kernel, setting each model's comm\n * as dead.\n */\n disconnect() {\n super.disconnect();\n this._restoredStatus = false;\n }\n async _loadFromKernel() {\n var _a;\n if (!this.kernel) {\n throw new Error('Kernel not set');\n }\n if (((_a = this.kernel) === null || _a === void 0 ? void 0 : _a.handleComms) === false) {\n // A \"load\" for a kernel that does not handle comms does nothing.\n return;\n }\n return super._loadFromKernel();\n }\n /**\n * Create a comm.\n */\n async _create_comm(target_name, model_id, data, metadata, buffers) {\n const kernel = this.kernel;\n if (!kernel) {\n throw new Error('No current kernel');\n }\n const comm = kernel.createComm(target_name, model_id);\n if (data || metadata) {\n comm.open(data, metadata, buffers);\n }\n return new shims.services.Comm(comm);\n }\n /**\n * Get the currently-registered comms.\n */\n async _get_comm_info() {\n const kernel = this.kernel;\n if (!kernel) {\n throw new Error('No current kernel');\n }\n const reply = await kernel.requestCommInfo({\n target_name: this.comm_target_name,\n });\n if (reply.content.status === 'ok') {\n return reply.content.comms;\n }\n else {\n return {};\n }\n }\n /**\n * Get whether the manager is disposed.\n *\n * #### Notes\n * This is a read-only property.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose the resources held by the manager.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n if (this._commRegistration) {\n this._commRegistration.dispose();\n }\n }\n /**\n * Resolve a URL relative to the current notebook location.\n */\n async resolveUrl(url) {\n return url;\n }\n /**\n * Load a class and return a promise to the loaded object.\n */\n async loadClass(className, moduleName, moduleVersion) {\n // Special-case the Jupyter base and controls packages. If we have just a\n // plain version, with no indication of the compatible range, prepend a ^ to\n // get all compatible versions. We may eventually apply this logic to all\n // widget modules. See issues #2006 and #2017 for more discussion.\n if ((moduleName === '@jupyter-widgets/base' ||\n moduleName === '@jupyter-widgets/controls') &&\n valid(moduleVersion)) {\n moduleVersion = `^${moduleVersion}`;\n }\n const allVersions = this._registry.getAllVersions(moduleName);\n if (!allVersions) {\n throw new Error(`No version of module ${moduleName} is registered`);\n }\n const mod = this._registry.get(moduleName, moduleVersion);\n if (!mod) {\n const registeredVersionList = Object.keys(allVersions);\n throw new Error(`Module ${moduleName}, version ${moduleVersion} is not registered, however, \\\n ${registeredVersionList.join(',')} ${registeredVersionList.length > 1 ? 'are' : 'is'}`);\n }\n let module;\n if (typeof mod === 'function') {\n module = await mod();\n }\n else {\n module = await mod;\n }\n const cls = module[className];\n if (!cls) {\n throw new Error(`Class ${className} not found in module ${moduleName}`);\n }\n return cls;\n }\n get rendermime() {\n return this._rendermime;\n }\n /**\n * A signal emitted when state is restored to the widget manager.\n *\n * #### Notes\n * This indicates that previously-unavailable widget models might be available now.\n */\n get restored() {\n return this._restored;\n }\n /**\n * Whether the state has been restored yet or not.\n */\n get restoredStatus() {\n return this._restoredStatus;\n }\n /**\n * A signal emitted for unhandled iopub kernel messages.\n *\n */\n get onUnhandledIOPubMessage() {\n return this._onUnhandledIOPubMessage;\n }\n register(data) {\n this._registry.set(data.name, data.version, data.exports);\n }\n /**\n * Register a widget model.\n */\n register_model(model_id, modelPromise) {\n super.register_model(model_id, modelPromise);\n // Update the synchronous model map\n modelPromise.then((model) => {\n this._modelsSync.set(model_id, model);\n model.once('comm:close', () => {\n this._modelsSync.delete(model_id);\n });\n });\n }\n /**\n * Close all widgets and empty the widget state.\n * @return Promise that resolves when the widget state is cleared.\n */\n async clear_state() {\n await super.clear_state();\n this._modelsSync = new Map();\n }\n /**\n * Synchronously get the state of the live widgets in the widget manager.\n *\n * This includes all of the live widget models, and follows the format given in\n * the @jupyter-widgets/schema package.\n *\n * @param options - The options for what state to return.\n * @returns A state dictionary\n */\n get_state_sync(options = {}) {\n const models = [];\n for (const model of this._modelsSync.values()) {\n if (model.comm_live) {\n models.push(model);\n }\n }\n return serialize_state(models, options);\n }\n}\n/**\n * A widget manager that returns Lumino widgets.\n */\nexport class KernelWidgetManager extends LabWidgetManager {\n constructor(kernel, rendermime) {\n super(rendermime);\n this._kernel = kernel;\n kernel.statusChanged.connect((sender, args) => {\n this._handleKernelStatusChange(args);\n });\n kernel.connectionStatusChanged.connect((sender, args) => {\n this._handleKernelConnectionStatusChange(args);\n });\n this._handleKernelChanged({\n name: 'kernel',\n oldValue: null,\n newValue: kernel,\n });\n this.restoreWidgets();\n }\n _handleKernelConnectionStatusChange(status) {\n if (status === 'connected') {\n // Only restore if we aren't currently trying to restore from the kernel\n // (for example, in our initial restore from the constructor).\n if (!this._kernelRestoreInProgress) {\n this.restoreWidgets();\n }\n }\n }\n _handleKernelStatusChange(status) {\n if (status === 'restarting') {\n this.disconnect();\n }\n }\n /**\n * Restore widgets from kernel and saved state.\n */\n async restoreWidgets() {\n try {\n this._kernelRestoreInProgress = true;\n await this._loadFromKernel();\n this._restoredStatus = true;\n this._restored.emit();\n }\n catch (err) {\n // Do nothing\n }\n this._kernelRestoreInProgress = false;\n }\n /**\n * Dispose the resources held by the manager.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._kernel = null;\n super.dispose();\n }\n get kernel() {\n return this._kernel;\n }\n}\n/**\n * A widget manager that returns phosphor widgets.\n */\nexport class WidgetManager extends LabWidgetManager {\n constructor(context, rendermime, settings) {\n var _a, _b;\n super(rendermime);\n this._context = context;\n context.sessionContext.kernelChanged.connect((sender, args) => {\n this._handleKernelChanged(args);\n });\n context.sessionContext.statusChanged.connect((sender, args) => {\n this._handleKernelStatusChange(args);\n });\n context.sessionContext.connectionStatusChanged.connect((sender, args) => {\n this._handleKernelConnectionStatusChange(args);\n });\n if ((_a = context.sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel) {\n this._handleKernelChanged({\n name: 'kernel',\n oldValue: null,\n newValue: (_b = context.sessionContext.session) === null || _b === void 0 ? void 0 : _b.kernel,\n });\n }\n this.restoreWidgets(this._context.model);\n this._settings = settings;\n context.saveState.connect((sender, saveState) => {\n if (saveState === 'started' && settings.saveState) {\n this._saveState();\n }\n });\n }\n /**\n * Save the widget state to the context model.\n */\n _saveState() {\n const state = this.get_state_sync({ drop_defaults: true });\n if (this._context.model.setMetadata) {\n this._context.model.setMetadata('widgets', {\n 'application/vnd.jupyter.widget-state+json': state,\n });\n }\n else {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore JupyterLab 3 support\n this._context.model.metadata.set('widgets', {\n 'application/vnd.jupyter.widget-state+json': state,\n });\n }\n }\n _handleKernelConnectionStatusChange(status) {\n if (status === 'connected') {\n // Only restore if we aren't currently trying to restore from the kernel\n // (for example, in our initial restore from the constructor).\n if (!this._kernelRestoreInProgress) {\n // We only want to restore widgets from the kernel, not ones saved in the notebook.\n this.restoreWidgets(this._context.model, {\n loadKernel: true,\n loadNotebook: false,\n });\n }\n }\n }\n _handleKernelStatusChange(status) {\n if (status === 'restarting') {\n this.disconnect();\n }\n }\n /**\n * Restore widgets from kernel and saved state.\n */\n async restoreWidgets(notebook, { loadKernel, loadNotebook } = { loadKernel: true, loadNotebook: true }) {\n try {\n if (loadKernel) {\n try {\n this._kernelRestoreInProgress = true;\n await this._loadFromKernel();\n }\n finally {\n this._kernelRestoreInProgress = false;\n }\n }\n if (loadNotebook) {\n await this._loadFromNotebook(notebook);\n }\n // If the restore worked above, then update our state.\n this._restoredStatus = true;\n this._restored.emit();\n }\n catch (err) {\n // Do nothing if the restore did not work.\n }\n }\n /**\n * Load widget state from notebook metadata\n */\n async _loadFromNotebook(notebook) {\n const widget_md = notebook.getMetadata\n ? notebook.getMetadata('widgets')\n : // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore JupyterLab 3 support\n notebook.metadata.get('widgets');\n // Restore any widgets from saved state that are not live\n if (widget_md && widget_md[WIDGET_STATE_MIMETYPE]) {\n let state = widget_md[WIDGET_STATE_MIMETYPE];\n state = this.filterExistingModelState(state);\n await this.set_state(state);\n }\n }\n /**\n * Dispose the resources held by the manager.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._context = null;\n super.dispose();\n }\n /**\n * Resolve a URL relative to the current notebook location.\n */\n async resolveUrl(url) {\n const partial = await this.context.urlResolver.resolveUrl(url);\n return this.context.urlResolver.getDownloadUrl(partial);\n }\n get context() {\n return this._context;\n }\n get kernel() {\n var _a, _b, _c;\n return (_c = (_b = (_a = this._context.sessionContext) === null || _a === void 0 ? void 0 : _a.session) === null || _b === void 0 ? void 0 : _b.kernel) !== null && _c !== void 0 ? _c : null;\n }\n /**\n * Register a widget model.\n */\n register_model(model_id, modelPromise) {\n super.register_model(model_id, modelPromise);\n this.setDirty();\n }\n /**\n * Close all widgets and empty the widget state.\n * @return Promise that resolves when the widget state is cleared.\n */\n async clear_state() {\n await super.clear_state();\n this.setDirty();\n }\n /**\n * Set the dirty state of the notebook model if applicable.\n *\n * TODO: perhaps should also set dirty when any model changes any data\n */\n setDirty() {\n if (this._settings.saveState) {\n this._context.model.dirty = true;\n }\n }\n}\n//# sourceMappingURL=manager.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport * as outputBase from '@jupyter-widgets/output';\nimport { JupyterLuminoPanelWidget } from '@jupyter-widgets/base';\nimport { WidgetManager } from './manager';\nimport { OutputAreaModel, OutputArea } from '@jupyterlab/outputarea';\nimport $ from 'jquery';\nexport const OUTPUT_WIDGET_VERSION = outputBase.OUTPUT_WIDGET_VERSION;\nexport class OutputModel extends outputBase.OutputModel {\n defaults() {\n return Object.assign(Object.assign({}, super.defaults()), { msg_id: '', outputs: [] });\n }\n initialize(attributes, options) {\n super.initialize(attributes, options);\n // The output area model is trusted since widgets are only rendered in trusted contexts.\n this._outputs = new OutputAreaModel({ trusted: true });\n this._msgHook = (msg) => {\n this.add(msg);\n return false;\n };\n // if the context is available, react on kernel changes\n if (this.widget_manager instanceof WidgetManager) {\n this.widget_manager.context.sessionContext.kernelChanged.connect((sender, args) => {\n this._handleKernelChanged(args);\n });\n }\n this.listenTo(this, 'change:msg_id', this.reset_msg_id);\n this.listenTo(this, 'change:outputs', this.setOutputs);\n this.setOutputs();\n }\n /**\n * Register a new kernel\n */\n _handleKernelChanged({ oldValue, }) {\n const msgId = this.get('msg_id');\n if (msgId && oldValue) {\n oldValue.removeMessageHook(msgId, this._msgHook);\n this.set('msg_id', null);\n }\n }\n /**\n * Reset the message id.\n */\n reset_msg_id() {\n const kernel = this.widget_manager.kernel;\n const msgId = this.get('msg_id');\n const oldMsgId = this.previous('msg_id');\n // Clear any old handler.\n if (oldMsgId && kernel) {\n kernel.removeMessageHook(oldMsgId, this._msgHook);\n }\n // Register any new handler.\n if (msgId && kernel) {\n kernel.registerMessageHook(msgId, this._msgHook);\n }\n }\n add(msg) {\n const msgType = msg.header.msg_type;\n switch (msgType) {\n case 'execute_result':\n case 'display_data':\n case 'stream':\n case 'error': {\n const model = msg.content;\n model.output_type = msgType;\n this._outputs.add(model);\n break;\n }\n case 'clear_output':\n this.clear_output(msg.content.wait);\n break;\n default:\n break;\n }\n this.set('outputs', this._outputs.toJSON(), { newMessage: true });\n this.save_changes();\n }\n clear_output(wait = false) {\n this._outputs.clear(wait);\n }\n get outputs() {\n return this._outputs;\n }\n setOutputs(model, value, options) {\n if (!(options && options.newMessage)) {\n // fromJSON does not clear the existing output\n this.clear_output();\n // fromJSON does not copy the message, so we make a deep copy\n this._outputs.fromJSON(JSON.parse(JSON.stringify(this.get('outputs'))));\n }\n }\n}\nexport class OutputView extends outputBase.OutputView {\n _createElement(tagName) {\n this.luminoWidget = new JupyterLuminoPanelWidget({ view: this });\n return this.luminoWidget.node;\n }\n _setElement(el) {\n if (this.el || el !== this.luminoWidget.node) {\n // Boxes don't allow setting the element beyond the initial creation.\n throw new Error('Cannot reset the DOM element.');\n }\n this.el = this.luminoWidget.node;\n this.$el = $(this.luminoWidget.node);\n }\n /**\n * Called when view is rendered.\n */\n render() {\n super.render();\n this._outputView = new OutputArea({\n rendermime: this.model.widget_manager.rendermime,\n contentFactory: OutputArea.defaultContentFactory,\n model: this.model.outputs,\n });\n // TODO: why is this a readonly property now?\n // this._outputView.model = this.model.outputs;\n // TODO: why is this on the model now?\n // this._outputView.trusted = true;\n this.luminoWidget.insertWidget(0, this._outputView);\n this.luminoWidget.addClass('jupyter-widgets');\n this.luminoWidget.addClass('widget-output');\n this.update(); // Set defaults.\n }\n remove() {\n this._outputView.dispose();\n return super.remove();\n }\n}\n//# sourceMappingURL=output.js.map","import api from \"!../../../style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../css-loader/dist/cjs.js!./index.css\";\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","import api from \"!../../../style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../css-loader/dist/cjs.js!./widgets-base.css\";\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { ISettingRegistry } from '@jupyterlab/settingregistry';\nimport { INotebookTracker, } from '@jupyterlab/notebook';\nimport { IMainMenu } from '@jupyterlab/mainmenu';\nimport { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport { ILoggerRegistry } from '@jupyterlab/logconsole';\nimport { filter } from '@lumino/algorithm';\nimport { DisposableDelegate } from '@lumino/disposable';\nimport { AttachedProperty } from '@lumino/properties';\nimport { WidgetRenderer } from './renderer';\nimport { WidgetManager, WIDGET_VIEW_MIMETYPE } from './manager';\nimport { OutputModel, OutputView, OUTPUT_WIDGET_VERSION } from './output';\nimport * as base from '@jupyter-widgets/base';\n// We import only the version from the specific module in controls so that the\n// controls code can be split and dynamically loaded in webpack.\nimport { JUPYTER_CONTROLS_VERSION } from '@jupyter-widgets/controls/lib/version';\nimport '@jupyter-widgets/base/css/index.css';\nimport '@jupyter-widgets/controls/css/widgets-base.css';\nimport { KernelMessage } from '@jupyterlab/services';\nimport { ITranslator, nullTranslator } from '@jupyterlab/translation';\nconst WIDGET_REGISTRY = [];\n/**\n * The cached settings.\n */\nconst SETTINGS = { saveState: false };\n/**\n * Iterate through all widget renderers in a notebook.\n */\nfunction* widgetRenderers(nb) {\n for (const cell of nb.widgets) {\n if (cell.model.type === 'code') {\n for (const codecell of cell.outputArea.widgets) {\n // We use Array.from instead of using Lumino 2 (JLab 4) iterator\n // This is to support Lumino 1 (JLab 3) as well\n for (const output of Array.from(codecell.children())) {\n if (output instanceof WidgetRenderer) {\n yield output;\n }\n }\n }\n }\n }\n}\n/**\n * Iterate through all matching linked output views\n */\nfunction* outputViews(app, path) {\n const linkedViews = filter(app.shell.widgets(), (w) => w.id.startsWith('LinkedOutputView-') && w.path === path);\n // We use Array.from instead of using Lumino 2 (JLab 4) iterator\n // This is to support Lumino 1 (JLab 3) as well\n for (const view of Array.from(linkedViews)) {\n for (const outputs of Array.from(view.children())) {\n for (const output of Array.from(outputs.children())) {\n if (output instanceof WidgetRenderer) {\n yield output;\n }\n }\n }\n }\n}\nfunction* chain(...args) {\n for (const it of args) {\n yield* it;\n }\n}\nexport function registerWidgetManager(context, rendermime, renderers) {\n let wManager = Private.widgetManagerProperty.get(context);\n if (!wManager) {\n wManager = new WidgetManager(context, rendermime, SETTINGS);\n WIDGET_REGISTRY.forEach((data) => wManager.register(data));\n Private.widgetManagerProperty.set(context, wManager);\n }\n for (const r of renderers) {\n r.manager = wManager;\n }\n // Replace the placeholder widget renderer with one bound to this widget\n // manager.\n rendermime.removeMimeType(WIDGET_VIEW_MIMETYPE);\n rendermime.addFactory({\n safe: false,\n mimeTypes: [WIDGET_VIEW_MIMETYPE],\n createRenderer: (options) => new WidgetRenderer(options, wManager),\n }, -10);\n return new DisposableDelegate(() => {\n if (rendermime) {\n rendermime.removeMimeType(WIDGET_VIEW_MIMETYPE);\n }\n wManager.dispose();\n });\n}\n/**\n * The widget manager provider.\n */\nexport const managerPlugin = {\n id: '@jupyter-widgets/jupyterlab-manager:plugin',\n requires: [IRenderMimeRegistry],\n optional: [\n INotebookTracker,\n ISettingRegistry,\n IMainMenu,\n ILoggerRegistry,\n ITranslator,\n ],\n provides: base.IJupyterWidgetRegistry,\n activate: activateWidgetExtension,\n autoStart: true,\n};\nfunction updateSettings(settings) {\n SETTINGS.saveState = settings.get('saveState').composite;\n}\n/**\n * Activate the widget extension.\n */\nfunction activateWidgetExtension(app, rendermime, tracker, settingRegistry, menu, loggerRegistry, translator) {\n const { commands } = app;\n const trans = (translator !== null && translator !== void 0 ? translator : nullTranslator).load('jupyterlab_widgets');\n const bindUnhandledIOPubMessageSignal = (nb) => {\n if (!loggerRegistry) {\n return;\n }\n const wManager = Private.widgetManagerProperty.get(nb.context);\n if (wManager) {\n wManager.onUnhandledIOPubMessage.connect((sender, msg) => {\n const logger = loggerRegistry.getLogger(nb.context.path);\n let level = 'warning';\n if (KernelMessage.isErrorMsg(msg) ||\n (KernelMessage.isStreamMsg(msg) && msg.content.name === 'stderr')) {\n level = 'error';\n }\n const data = Object.assign(Object.assign({}, msg.content), { output_type: msg.header.msg_type });\n logger.rendermime = nb.content.rendermime;\n logger.log({ type: 'output', data, level });\n });\n }\n };\n if (settingRegistry !== null) {\n settingRegistry\n .load(managerPlugin.id)\n .then((settings) => {\n settings.changed.connect(updateSettings);\n updateSettings(settings);\n })\n .catch((reason) => {\n console.error(reason.message);\n });\n }\n // Add a placeholder widget renderer.\n rendermime.addFactory({\n safe: false,\n mimeTypes: [WIDGET_VIEW_MIMETYPE],\n createRenderer: (options) => new WidgetRenderer(options),\n }, -10);\n if (tracker !== null) {\n tracker.forEach((panel) => {\n registerWidgetManager(panel.context, panel.content.rendermime, chain(widgetRenderers(panel.content), outputViews(app, panel.context.path)));\n bindUnhandledIOPubMessageSignal(panel);\n });\n tracker.widgetAdded.connect((sender, panel) => {\n registerWidgetManager(panel.context, panel.content.rendermime, chain(widgetRenderers(panel.content), outputViews(app, panel.context.path)));\n bindUnhandledIOPubMessageSignal(panel);\n });\n }\n if (settingRegistry !== null) {\n // Add a command for automatically saving (jupyter-)widget state.\n commands.addCommand('@jupyter-widgets/jupyterlab-manager:saveWidgetState', {\n label: trans.__('Save Widget State Automatically'),\n execute: (args) => {\n return settingRegistry\n .set(managerPlugin.id, 'saveState', !SETTINGS.saveState)\n .catch((reason) => {\n console.error(`Failed to set ${managerPlugin.id}: ${reason.message}`);\n });\n },\n isToggled: () => SETTINGS.saveState,\n });\n }\n if (menu) {\n menu.settingsMenu.addGroup([\n { command: '@jupyter-widgets/jupyterlab-manager:saveWidgetState' },\n ]);\n }\n return {\n registerWidget(data) {\n WIDGET_REGISTRY.push(data);\n },\n };\n}\n/**\n * The base widgets.\n */\nexport const baseWidgetsPlugin = {\n id: `@jupyter-widgets/jupyterlab-manager:base-${base.JUPYTER_WIDGETS_VERSION}`,\n requires: [base.IJupyterWidgetRegistry],\n autoStart: true,\n activate: (app, registry) => {\n registry.registerWidget({\n name: '@jupyter-widgets/base',\n version: base.JUPYTER_WIDGETS_VERSION,\n exports: {\n WidgetModel: base.WidgetModel,\n WidgetView: base.WidgetView,\n DOMWidgetView: base.DOMWidgetView,\n DOMWidgetModel: base.DOMWidgetModel,\n LayoutModel: base.LayoutModel,\n LayoutView: base.LayoutView,\n StyleModel: base.StyleModel,\n StyleView: base.StyleView,\n ErrorWidgetView: base.ErrorWidgetView,\n },\n });\n },\n};\n/**\n * The control widgets.\n */\nexport const controlWidgetsPlugin = {\n id: `@jupyter-widgets/jupyterlab-manager:controls-${JUPYTER_CONTROLS_VERSION}`,\n requires: [base.IJupyterWidgetRegistry],\n autoStart: true,\n activate: (app, registry) => {\n registry.registerWidget({\n name: '@jupyter-widgets/controls',\n version: JUPYTER_CONTROLS_VERSION,\n exports: () => {\n return new Promise((resolve, reject) => {\n require.ensure(['@jupyter-widgets/controls'], (require) => {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n resolve(require('@jupyter-widgets/controls'));\n }, (err) => {\n reject(err);\n }, '@jupyter-widgets/controls');\n });\n },\n });\n },\n};\n/**\n * The output widget.\n */\nexport const outputWidgetPlugin = {\n id: `@jupyter-widgets/jupyterlab-manager:output-${OUTPUT_WIDGET_VERSION}`,\n requires: [base.IJupyterWidgetRegistry],\n autoStart: true,\n activate: (app, registry) => {\n registry.registerWidget({\n name: '@jupyter-widgets/output',\n version: OUTPUT_WIDGET_VERSION,\n exports: { OutputModel, OutputView },\n });\n },\n};\nexport default [\n managerPlugin,\n baseWidgetsPlugin,\n controlWidgetsPlugin,\n outputWidgetPlugin,\n];\nvar Private;\n(function (Private) {\n /**\n * A private attached property for a widget manager.\n */\n Private.widgetManagerProperty = new AttachedProperty({\n name: 'widgetManager',\n create: (owner) => undefined,\n });\n})(Private || (Private = {}));\n//# sourceMappingURL=plugin.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport WidgetManagerProvider from './plugin';\nimport * as output from './output';\nexport default WidgetManagerProvider;\nexport { registerWidgetManager } from './plugin';\nexport { KernelWidgetManager, LabWidgetManager, WidgetManager, } from './manager';\nexport { WidgetRenderer } from './renderer';\nexport { output };\n//# sourceMappingURL=index.js.map","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Distributed under the terms of the Modified BSD License.\\n|----------------------------------------------------------------------------*/\\n\\n/* */\\n.jupyter-widgets.widget-output .jp-OutputArea-prompt, /* */\\n.jupyter-widgets.jupyter-widget-output .jp-OutputArea-prompt {\\n display: none;\\n}\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/@jupyter-widgets/html-manager/css/output.css\"],\"names\":[],\"mappings\":\"AAAA;;;8EAG8E;;AAE9E,iBAAiB;AACjB;;EAEE,aAAa;AACf\",\"sourcesContent\":[\"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Distributed under the terms of the Modified BSD License.\\n|----------------------------------------------------------------------------*/\\n\\n/* */\\n.jupyter-widgets.widget-output .jp-OutputArea-prompt, /* */\\n.jupyter-widgets.jupyter-widget-output .jp-OutputArea-prompt {\\n display: none;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* BASICS */\\n\\n.CodeMirror {\\n /* Set height, width, borders, and global font properties here */\\n font-family: monospace;\\n height: 300px;\\n color: black;\\n direction: ltr;\\n}\\n\\n/* PADDING */\\n\\n.CodeMirror-lines {\\n padding: 4px 0; /* Vertical padding around content */\\n}\\n.CodeMirror pre.CodeMirror-line,\\n.CodeMirror pre.CodeMirror-line-like {\\n padding: 0 4px; /* Horizontal padding of content */\\n}\\n\\n.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\\n background-color: white; /* The little square between H and V scrollbars */\\n}\\n\\n/* GUTTER */\\n\\n.CodeMirror-gutters {\\n border-right: 1px solid #ddd;\\n background-color: #f7f7f7;\\n white-space: nowrap;\\n}\\n.CodeMirror-linenumbers {}\\n.CodeMirror-linenumber {\\n padding: 0 3px 0 5px;\\n min-width: 20px;\\n text-align: right;\\n color: #999;\\n white-space: nowrap;\\n}\\n\\n.CodeMirror-guttermarker { color: black; }\\n.CodeMirror-guttermarker-subtle { color: #999; }\\n\\n/* CURSOR */\\n\\n.CodeMirror-cursor {\\n border-left: 1px solid black;\\n border-right: none;\\n width: 0;\\n}\\n/* Shown when moving in bi-directional text */\\n.CodeMirror div.CodeMirror-secondarycursor {\\n border-left: 1px solid silver;\\n}\\n.cm-fat-cursor .CodeMirror-cursor {\\n width: auto;\\n border: 0 !important;\\n background: #7e7;\\n}\\n.cm-fat-cursor div.CodeMirror-cursors {\\n z-index: 1;\\n}\\n.cm-fat-cursor-mark {\\n background-color: rgba(20, 255, 20, 0.5);\\n -webkit-animation: blink 1.06s steps(1) infinite;\\n -moz-animation: blink 1.06s steps(1) infinite;\\n animation: blink 1.06s steps(1) infinite;\\n}\\n.cm-animate-fat-cursor {\\n width: auto;\\n border: 0;\\n -webkit-animation: blink 1.06s steps(1) infinite;\\n -moz-animation: blink 1.06s steps(1) infinite;\\n animation: blink 1.06s steps(1) infinite;\\n background-color: #7e7;\\n}\\n@-moz-keyframes blink {\\n 0% {}\\n 50% { background-color: transparent; }\\n 100% {}\\n}\\n@-webkit-keyframes blink {\\n 0% {}\\n 50% { background-color: transparent; }\\n 100% {}\\n}\\n@keyframes blink {\\n 0% {}\\n 50% { background-color: transparent; }\\n 100% {}\\n}\\n\\n/* Can style cursor different in overwrite (non-insert) mode */\\n.CodeMirror-overwrite .CodeMirror-cursor {}\\n\\n.cm-tab { display: inline-block; text-decoration: inherit; }\\n\\n.CodeMirror-rulers {\\n position: absolute;\\n left: 0; right: 0; top: -50px; bottom: 0;\\n overflow: hidden;\\n}\\n.CodeMirror-ruler {\\n border-left: 1px solid #ccc;\\n top: 0; bottom: 0;\\n position: absolute;\\n}\\n\\n/* DEFAULT THEME */\\n\\n.cm-s-default .cm-header {color: blue;}\\n.cm-s-default .cm-quote {color: #090;}\\n.cm-negative {color: #d44;}\\n.cm-positive {color: #292;}\\n.cm-header, .cm-strong {font-weight: bold;}\\n.cm-em {font-style: italic;}\\n.cm-link {text-decoration: underline;}\\n.cm-strikethrough {text-decoration: line-through;}\\n\\n.cm-s-default .cm-keyword {color: #708;}\\n.cm-s-default .cm-atom {color: #219;}\\n.cm-s-default .cm-number {color: #164;}\\n.cm-s-default .cm-def {color: #00f;}\\n.cm-s-default .cm-variable,\\n.cm-s-default .cm-punctuation,\\n.cm-s-default .cm-property,\\n.cm-s-default .cm-operator {}\\n.cm-s-default .cm-variable-2 {color: #05a;}\\n.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}\\n.cm-s-default .cm-comment {color: #a50;}\\n.cm-s-default .cm-string {color: #a11;}\\n.cm-s-default .cm-string-2 {color: #f50;}\\n.cm-s-default .cm-meta {color: #555;}\\n.cm-s-default .cm-qualifier {color: #555;}\\n.cm-s-default .cm-builtin {color: #30a;}\\n.cm-s-default .cm-bracket {color: #997;}\\n.cm-s-default .cm-tag {color: #170;}\\n.cm-s-default .cm-attribute {color: #00c;}\\n.cm-s-default .cm-hr {color: #999;}\\n.cm-s-default .cm-link {color: #00c;}\\n\\n.cm-s-default .cm-error {color: #f00;}\\n.cm-invalidchar {color: #f00;}\\n\\n.CodeMirror-composing { border-bottom: 2px solid; }\\n\\n/* Default styles for common addons */\\n\\ndiv.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}\\ndiv.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}\\n.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }\\n.CodeMirror-activeline-background {background: #e8f2ff;}\\n\\n/* STOP */\\n\\n/* The rest of this file contains styles related to the mechanics of\\n the editor. You probably shouldn't touch them. */\\n\\n.CodeMirror {\\n position: relative;\\n overflow: hidden;\\n background: white;\\n}\\n\\n.CodeMirror-scroll {\\n overflow: scroll !important; /* Things will break if this is overridden */\\n /* 50px is the magic margin used to hide the element's real scrollbars */\\n /* See overflow: hidden in .CodeMirror */\\n margin-bottom: -50px; margin-right: -50px;\\n padding-bottom: 50px;\\n height: 100%;\\n outline: none; /* Prevent dragging from highlighting the element */\\n position: relative;\\n}\\n.CodeMirror-sizer {\\n position: relative;\\n border-right: 50px solid transparent;\\n}\\n\\n/* The fake, visible scrollbars. Used to force redraw during scrolling\\n before actual scrolling happens, thus preventing shaking and\\n flickering artifacts. */\\n.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\\n position: absolute;\\n z-index: 6;\\n display: none;\\n outline: none;\\n}\\n.CodeMirror-vscrollbar {\\n right: 0; top: 0;\\n overflow-x: hidden;\\n overflow-y: scroll;\\n}\\n.CodeMirror-hscrollbar {\\n bottom: 0; left: 0;\\n overflow-y: hidden;\\n overflow-x: scroll;\\n}\\n.CodeMirror-scrollbar-filler {\\n right: 0; bottom: 0;\\n}\\n.CodeMirror-gutter-filler {\\n left: 0; bottom: 0;\\n}\\n\\n.CodeMirror-gutters {\\n position: absolute; left: 0; top: 0;\\n min-height: 100%;\\n z-index: 3;\\n}\\n.CodeMirror-gutter {\\n white-space: normal;\\n height: 100%;\\n display: inline-block;\\n vertical-align: top;\\n margin-bottom: -50px;\\n}\\n.CodeMirror-gutter-wrapper {\\n position: absolute;\\n z-index: 4;\\n background: none !important;\\n border: none !important;\\n}\\n.CodeMirror-gutter-background {\\n position: absolute;\\n top: 0; bottom: 0;\\n z-index: 4;\\n}\\n.CodeMirror-gutter-elt {\\n position: absolute;\\n cursor: default;\\n z-index: 4;\\n}\\n.CodeMirror-gutter-wrapper ::selection { background-color: transparent }\\n.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }\\n\\n.CodeMirror-lines {\\n cursor: text;\\n min-height: 1px; /* prevents collapsing before first draw */\\n}\\n.CodeMirror pre.CodeMirror-line,\\n.CodeMirror pre.CodeMirror-line-like {\\n /* Reset some styles that the rest of the page might have set */\\n -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;\\n border-width: 0;\\n background: transparent;\\n font-family: inherit;\\n font-size: inherit;\\n margin: 0;\\n white-space: pre;\\n word-wrap: normal;\\n line-height: inherit;\\n color: inherit;\\n z-index: 2;\\n position: relative;\\n overflow: visible;\\n -webkit-tap-highlight-color: transparent;\\n -webkit-font-variant-ligatures: contextual;\\n font-variant-ligatures: contextual;\\n}\\n.CodeMirror-wrap pre.CodeMirror-line,\\n.CodeMirror-wrap pre.CodeMirror-line-like {\\n word-wrap: break-word;\\n white-space: pre-wrap;\\n word-break: normal;\\n}\\n\\n.CodeMirror-linebackground {\\n position: absolute;\\n left: 0; right: 0; top: 0; bottom: 0;\\n z-index: 0;\\n}\\n\\n.CodeMirror-linewidget {\\n position: relative;\\n z-index: 2;\\n padding: 0.1px; /* Force widget margins to stay inside of the container */\\n}\\n\\n.CodeMirror-widget {}\\n\\n.CodeMirror-rtl pre { direction: rtl; }\\n\\n.CodeMirror-code {\\n outline: none;\\n}\\n\\n/* Force content-box sizing for the elements where we expect it */\\n.CodeMirror-scroll,\\n.CodeMirror-sizer,\\n.CodeMirror-gutter,\\n.CodeMirror-gutters,\\n.CodeMirror-linenumber {\\n -moz-box-sizing: content-box;\\n box-sizing: content-box;\\n}\\n\\n.CodeMirror-measure {\\n position: absolute;\\n width: 100%;\\n height: 0;\\n overflow: hidden;\\n visibility: hidden;\\n}\\n\\n.CodeMirror-cursor {\\n position: absolute;\\n pointer-events: none;\\n}\\n.CodeMirror-measure pre { position: static; }\\n\\ndiv.CodeMirror-cursors {\\n visibility: hidden;\\n position: relative;\\n z-index: 3;\\n}\\ndiv.CodeMirror-dragcursors {\\n visibility: visible;\\n}\\n\\n.CodeMirror-focused div.CodeMirror-cursors {\\n visibility: visible;\\n}\\n\\n.CodeMirror-selected { background: #d9d9d9; }\\n.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }\\n.CodeMirror-crosshair { cursor: crosshair; }\\n.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }\\n.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }\\n\\n.cm-searching {\\n background-color: #ffa;\\n background-color: rgba(255, 255, 0, .4);\\n}\\n\\n/* Used to force a border model for a node */\\n.cm-force-border { padding-right: .1px; }\\n\\n@media print {\\n /* Hide the cursor when printing */\\n .CodeMirror div.CodeMirror-cursors {\\n visibility: hidden;\\n }\\n}\\n\\n/* See issue #2901 */\\n.cm-tab-wrap-hack:after { content: ''; }\\n\\n/* Help users use markselection to safely style text background */\\nspan.CodeMirror-selectedtext { background: none; }\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/codemirror/lib/codemirror.css\"],\"names\":[],\"mappings\":\"AAAA,WAAW;;AAEX;EACE,gEAAgE;EAChE,sBAAsB;EACtB,aAAa;EACb,YAAY;EACZ,cAAc;AAChB;;AAEA,YAAY;;AAEZ;EACE,cAAc,EAAE,oCAAoC;AACtD;AACA;;EAEE,cAAc,EAAE,kCAAkC;AACpD;;AAEA;EACE,uBAAuB,EAAE,iDAAiD;AAC5E;;AAEA,WAAW;;AAEX;EACE,4BAA4B;EAC5B,yBAAyB;EACzB,mBAAmB;AACrB;AACA,yBAAyB;AACzB;EACE,oBAAoB;EACpB,eAAe;EACf,iBAAiB;EACjB,WAAW;EACX,mBAAmB;AACrB;;AAEA,2BAA2B,YAAY,EAAE;AACzC,kCAAkC,WAAW,EAAE;;AAE/C,WAAW;;AAEX;EACE,4BAA4B;EAC5B,kBAAkB;EAClB,QAAQ;AACV;AACA,6CAA6C;AAC7C;EACE,6BAA6B;AAC/B;AACA;EACE,WAAW;EACX,oBAAoB;EACpB,gBAAgB;AAClB;AACA;EACE,UAAU;AACZ;AACA;EACE,wCAAwC;EACxC,gDAAgD;EAChD,6CAA6C;EAC7C,wCAAwC;AAC1C;AACA;EACE,WAAW;EACX,SAAS;EACT,gDAAgD;EAChD,6CAA6C;EAC7C,wCAAwC;EACxC,sBAAsB;AACxB;AACA;EACE,IAAI;EACJ,MAAM,6BAA6B,EAAE;EACrC,MAAM;AACR;AACA;EACE,IAAI;EACJ,MAAM,6BAA6B,EAAE;EACrC,MAAM;AACR;AACA;EACE,IAAI;EACJ,MAAM,6BAA6B,EAAE;EACrC,MAAM;AACR;;AAEA,8DAA8D;AAC9D,0CAA0C;;AAE1C,UAAU,qBAAqB,EAAE,wBAAwB,EAAE;;AAE3D;EACE,kBAAkB;EAClB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS;EACxC,gBAAgB;AAClB;AACA;EACE,2BAA2B;EAC3B,MAAM,EAAE,SAAS;EACjB,kBAAkB;AACpB;;AAEA,kBAAkB;;AAElB,0BAA0B,WAAW,CAAC;AACtC,yBAAyB,WAAW,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,wBAAwB,iBAAiB,CAAC;AAC1C,QAAQ,kBAAkB,CAAC;AAC3B,UAAU,0BAA0B,CAAC;AACrC,mBAAmB,6BAA6B,CAAC;;AAEjD,2BAA2B,WAAW,CAAC;AACvC,wBAAwB,WAAW,CAAC;AACpC,0BAA0B,WAAW,CAAC;AACtC,uBAAuB,WAAW,CAAC;AACnC;;;4BAG4B;AAC5B,8BAA8B,WAAW,CAAC;AAC1C,sDAAsD,WAAW,CAAC;AAClE,2BAA2B,WAAW,CAAC;AACvC,0BAA0B,WAAW,CAAC;AACtC,4BAA4B,WAAW,CAAC;AACxC,wBAAwB,WAAW,CAAC;AACpC,6BAA6B,WAAW,CAAC;AACzC,2BAA2B,WAAW,CAAC;AACvC,2BAA2B,WAAW,CAAC;AACvC,uBAAuB,WAAW,CAAC;AACnC,6BAA6B,WAAW,CAAC;AACzC,sBAAsB,WAAW,CAAC;AAClC,wBAAwB,WAAW,CAAC;;AAEpC,yBAAyB,WAAW,CAAC;AACrC,iBAAiB,WAAW,CAAC;;AAE7B,wBAAwB,wBAAwB,EAAE;;AAElD,qCAAqC;;AAErC,gDAAgD,WAAW,CAAC;AAC5D,mDAAmD,WAAW,CAAC;AAC/D,0BAA0B,iCAAiC,EAAE;AAC7D,mCAAmC,mBAAmB,CAAC;;AAEvD,SAAS;;AAET;mDACmD;;AAEnD;EACE,kBAAkB;EAClB,gBAAgB;EAChB,iBAAiB;AACnB;;AAEA;EACE,2BAA2B,EAAE,4CAA4C;EACzE,wEAAwE;EACxE,wCAAwC;EACxC,oBAAoB,EAAE,mBAAmB;EACzC,oBAAoB;EACpB,YAAY;EACZ,aAAa,EAAE,mDAAmD;EAClE,kBAAkB;AACpB;AACA;EACE,kBAAkB;EAClB,oCAAoC;AACtC;;AAEA;;0BAE0B;AAC1B;EACE,kBAAkB;EAClB,UAAU;EACV,aAAa;EACb,aAAa;AACf;AACA;EACE,QAAQ,EAAE,MAAM;EAChB,kBAAkB;EAClB,kBAAkB;AACpB;AACA;EACE,SAAS,EAAE,OAAO;EAClB,kBAAkB;EAClB,kBAAkB;AACpB;AACA;EACE,QAAQ,EAAE,SAAS;AACrB;AACA;EACE,OAAO,EAAE,SAAS;AACpB;;AAEA;EACE,kBAAkB,EAAE,OAAO,EAAE,MAAM;EACnC,gBAAgB;EAChB,UAAU;AACZ;AACA;EACE,mBAAmB;EACnB,YAAY;EACZ,qBAAqB;EACrB,mBAAmB;EACnB,oBAAoB;AACtB;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,2BAA2B;EAC3B,uBAAuB;AACzB;AACA;EACE,kBAAkB;EAClB,MAAM,EAAE,SAAS;EACjB,UAAU;AACZ;AACA;EACE,kBAAkB;EAClB,eAAe;EACf,UAAU;AACZ;AACA,yCAAyC,8BAA8B;AACvE,8CAA8C,8BAA8B;;AAE5E;EACE,YAAY;EACZ,eAAe,EAAE,0CAA0C;AAC7D;AACA;;EAEE,+DAA+D;EAC/D,qBAAqB,EAAE,wBAAwB,EAAE,gBAAgB;EACjE,eAAe;EACf,uBAAuB;EACvB,oBAAoB;EACpB,kBAAkB;EAClB,SAAS;EACT,gBAAgB;EAChB,iBAAiB;EACjB,oBAAoB;EACpB,cAAc;EACd,UAAU;EACV,kBAAkB;EAClB,iBAAiB;EACjB,wCAAwC;EACxC,0CAA0C;EAC1C,kCAAkC;AACpC;AACA;;EAEE,qBAAqB;EACrB,qBAAqB;EACrB,kBAAkB;AACpB;;AAEA;EACE,kBAAkB;EAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS;EACpC,UAAU;AACZ;;AAEA;EACE,kBAAkB;EAClB,UAAU;EACV,cAAc,EAAE,yDAAyD;AAC3E;;AAEA,oBAAoB;;AAEpB,sBAAsB,cAAc,EAAE;;AAEtC;EACE,aAAa;AACf;;AAEA,iEAAiE;AACjE;;;;;EAKE,4BAA4B;EAC5B,uBAAuB;AACzB;;AAEA;EACE,kBAAkB;EAClB,WAAW;EACX,SAAS;EACT,gBAAgB;EAChB,kBAAkB;AACpB;;AAEA;EACE,kBAAkB;EAClB,oBAAoB;AACtB;AACA,0BAA0B,gBAAgB,EAAE;;AAE5C;EACE,kBAAkB;EAClB,kBAAkB;EAClB,UAAU;AACZ;AACA;EACE,mBAAmB;AACrB;;AAEA;EACE,mBAAmB;AACrB;;AAEA,uBAAuB,mBAAmB,EAAE;AAC5C,2CAA2C,mBAAmB,EAAE;AAChE,wBAAwB,iBAAiB,EAAE;AAC3C,6GAA6G,mBAAmB,EAAE;AAClI,4HAA4H,mBAAmB,EAAE;;AAEjJ;EACE,sBAAsB;EACtB,uCAAuC;AACzC;;AAEA,4CAA4C;AAC5C,mBAAmB,mBAAmB,EAAE;;AAExC;EACE,kCAAkC;EAClC;IACE,kBAAkB;EACpB;AACF;;AAEA,oBAAoB;AACpB,0BAA0B,WAAW,EAAE;;AAEvC,iEAAiE;AACjE,+BAA+B,gBAAgB,EAAE\",\"sourcesContent\":[\"/* BASICS */\\n\\n.CodeMirror {\\n /* Set height, width, borders, and global font properties here */\\n font-family: monospace;\\n height: 300px;\\n color: black;\\n direction: ltr;\\n}\\n\\n/* PADDING */\\n\\n.CodeMirror-lines {\\n padding: 4px 0; /* Vertical padding around content */\\n}\\n.CodeMirror pre.CodeMirror-line,\\n.CodeMirror pre.CodeMirror-line-like {\\n padding: 0 4px; /* Horizontal padding of content */\\n}\\n\\n.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\\n background-color: white; /* The little square between H and V scrollbars */\\n}\\n\\n/* GUTTER */\\n\\n.CodeMirror-gutters {\\n border-right: 1px solid #ddd;\\n background-color: #f7f7f7;\\n white-space: nowrap;\\n}\\n.CodeMirror-linenumbers {}\\n.CodeMirror-linenumber {\\n padding: 0 3px 0 5px;\\n min-width: 20px;\\n text-align: right;\\n color: #999;\\n white-space: nowrap;\\n}\\n\\n.CodeMirror-guttermarker { color: black; }\\n.CodeMirror-guttermarker-subtle { color: #999; }\\n\\n/* CURSOR */\\n\\n.CodeMirror-cursor {\\n border-left: 1px solid black;\\n border-right: none;\\n width: 0;\\n}\\n/* Shown when moving in bi-directional text */\\n.CodeMirror div.CodeMirror-secondarycursor {\\n border-left: 1px solid silver;\\n}\\n.cm-fat-cursor .CodeMirror-cursor {\\n width: auto;\\n border: 0 !important;\\n background: #7e7;\\n}\\n.cm-fat-cursor div.CodeMirror-cursors {\\n z-index: 1;\\n}\\n.cm-fat-cursor-mark {\\n background-color: rgba(20, 255, 20, 0.5);\\n -webkit-animation: blink 1.06s steps(1) infinite;\\n -moz-animation: blink 1.06s steps(1) infinite;\\n animation: blink 1.06s steps(1) infinite;\\n}\\n.cm-animate-fat-cursor {\\n width: auto;\\n border: 0;\\n -webkit-animation: blink 1.06s steps(1) infinite;\\n -moz-animation: blink 1.06s steps(1) infinite;\\n animation: blink 1.06s steps(1) infinite;\\n background-color: #7e7;\\n}\\n@-moz-keyframes blink {\\n 0% {}\\n 50% { background-color: transparent; }\\n 100% {}\\n}\\n@-webkit-keyframes blink {\\n 0% {}\\n 50% { background-color: transparent; }\\n 100% {}\\n}\\n@keyframes blink {\\n 0% {}\\n 50% { background-color: transparent; }\\n 100% {}\\n}\\n\\n/* Can style cursor different in overwrite (non-insert) mode */\\n.CodeMirror-overwrite .CodeMirror-cursor {}\\n\\n.cm-tab { display: inline-block; text-decoration: inherit; }\\n\\n.CodeMirror-rulers {\\n position: absolute;\\n left: 0; right: 0; top: -50px; bottom: 0;\\n overflow: hidden;\\n}\\n.CodeMirror-ruler {\\n border-left: 1px solid #ccc;\\n top: 0; bottom: 0;\\n position: absolute;\\n}\\n\\n/* DEFAULT THEME */\\n\\n.cm-s-default .cm-header {color: blue;}\\n.cm-s-default .cm-quote {color: #090;}\\n.cm-negative {color: #d44;}\\n.cm-positive {color: #292;}\\n.cm-header, .cm-strong {font-weight: bold;}\\n.cm-em {font-style: italic;}\\n.cm-link {text-decoration: underline;}\\n.cm-strikethrough {text-decoration: line-through;}\\n\\n.cm-s-default .cm-keyword {color: #708;}\\n.cm-s-default .cm-atom {color: #219;}\\n.cm-s-default .cm-number {color: #164;}\\n.cm-s-default .cm-def {color: #00f;}\\n.cm-s-default .cm-variable,\\n.cm-s-default .cm-punctuation,\\n.cm-s-default .cm-property,\\n.cm-s-default .cm-operator {}\\n.cm-s-default .cm-variable-2 {color: #05a;}\\n.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}\\n.cm-s-default .cm-comment {color: #a50;}\\n.cm-s-default .cm-string {color: #a11;}\\n.cm-s-default .cm-string-2 {color: #f50;}\\n.cm-s-default .cm-meta {color: #555;}\\n.cm-s-default .cm-qualifier {color: #555;}\\n.cm-s-default .cm-builtin {color: #30a;}\\n.cm-s-default .cm-bracket {color: #997;}\\n.cm-s-default .cm-tag {color: #170;}\\n.cm-s-default .cm-attribute {color: #00c;}\\n.cm-s-default .cm-hr {color: #999;}\\n.cm-s-default .cm-link {color: #00c;}\\n\\n.cm-s-default .cm-error {color: #f00;}\\n.cm-invalidchar {color: #f00;}\\n\\n.CodeMirror-composing { border-bottom: 2px solid; }\\n\\n/* Default styles for common addons */\\n\\ndiv.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}\\ndiv.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}\\n.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }\\n.CodeMirror-activeline-background {background: #e8f2ff;}\\n\\n/* STOP */\\n\\n/* The rest of this file contains styles related to the mechanics of\\n the editor. You probably shouldn't touch them. */\\n\\n.CodeMirror {\\n position: relative;\\n overflow: hidden;\\n background: white;\\n}\\n\\n.CodeMirror-scroll {\\n overflow: scroll !important; /* Things will break if this is overridden */\\n /* 50px is the magic margin used to hide the element's real scrollbars */\\n /* See overflow: hidden in .CodeMirror */\\n margin-bottom: -50px; margin-right: -50px;\\n padding-bottom: 50px;\\n height: 100%;\\n outline: none; /* Prevent dragging from highlighting the element */\\n position: relative;\\n}\\n.CodeMirror-sizer {\\n position: relative;\\n border-right: 50px solid transparent;\\n}\\n\\n/* The fake, visible scrollbars. Used to force redraw during scrolling\\n before actual scrolling happens, thus preventing shaking and\\n flickering artifacts. */\\n.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\\n position: absolute;\\n z-index: 6;\\n display: none;\\n outline: none;\\n}\\n.CodeMirror-vscrollbar {\\n right: 0; top: 0;\\n overflow-x: hidden;\\n overflow-y: scroll;\\n}\\n.CodeMirror-hscrollbar {\\n bottom: 0; left: 0;\\n overflow-y: hidden;\\n overflow-x: scroll;\\n}\\n.CodeMirror-scrollbar-filler {\\n right: 0; bottom: 0;\\n}\\n.CodeMirror-gutter-filler {\\n left: 0; bottom: 0;\\n}\\n\\n.CodeMirror-gutters {\\n position: absolute; left: 0; top: 0;\\n min-height: 100%;\\n z-index: 3;\\n}\\n.CodeMirror-gutter {\\n white-space: normal;\\n height: 100%;\\n display: inline-block;\\n vertical-align: top;\\n margin-bottom: -50px;\\n}\\n.CodeMirror-gutter-wrapper {\\n position: absolute;\\n z-index: 4;\\n background: none !important;\\n border: none !important;\\n}\\n.CodeMirror-gutter-background {\\n position: absolute;\\n top: 0; bottom: 0;\\n z-index: 4;\\n}\\n.CodeMirror-gutter-elt {\\n position: absolute;\\n cursor: default;\\n z-index: 4;\\n}\\n.CodeMirror-gutter-wrapper ::selection { background-color: transparent }\\n.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }\\n\\n.CodeMirror-lines {\\n cursor: text;\\n min-height: 1px; /* prevents collapsing before first draw */\\n}\\n.CodeMirror pre.CodeMirror-line,\\n.CodeMirror pre.CodeMirror-line-like {\\n /* Reset some styles that the rest of the page might have set */\\n -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;\\n border-width: 0;\\n background: transparent;\\n font-family: inherit;\\n font-size: inherit;\\n margin: 0;\\n white-space: pre;\\n word-wrap: normal;\\n line-height: inherit;\\n color: inherit;\\n z-index: 2;\\n position: relative;\\n overflow: visible;\\n -webkit-tap-highlight-color: transparent;\\n -webkit-font-variant-ligatures: contextual;\\n font-variant-ligatures: contextual;\\n}\\n.CodeMirror-wrap pre.CodeMirror-line,\\n.CodeMirror-wrap pre.CodeMirror-line-like {\\n word-wrap: break-word;\\n white-space: pre-wrap;\\n word-break: normal;\\n}\\n\\n.CodeMirror-linebackground {\\n position: absolute;\\n left: 0; right: 0; top: 0; bottom: 0;\\n z-index: 0;\\n}\\n\\n.CodeMirror-linewidget {\\n position: relative;\\n z-index: 2;\\n padding: 0.1px; /* Force widget margins to stay inside of the container */\\n}\\n\\n.CodeMirror-widget {}\\n\\n.CodeMirror-rtl pre { direction: rtl; }\\n\\n.CodeMirror-code {\\n outline: none;\\n}\\n\\n/* Force content-box sizing for the elements where we expect it */\\n.CodeMirror-scroll,\\n.CodeMirror-sizer,\\n.CodeMirror-gutter,\\n.CodeMirror-gutters,\\n.CodeMirror-linenumber {\\n -moz-box-sizing: content-box;\\n box-sizing: content-box;\\n}\\n\\n.CodeMirror-measure {\\n position: absolute;\\n width: 100%;\\n height: 0;\\n overflow: hidden;\\n visibility: hidden;\\n}\\n\\n.CodeMirror-cursor {\\n position: absolute;\\n pointer-events: none;\\n}\\n.CodeMirror-measure pre { position: static; }\\n\\ndiv.CodeMirror-cursors {\\n visibility: hidden;\\n position: relative;\\n z-index: 3;\\n}\\ndiv.CodeMirror-dragcursors {\\n visibility: visible;\\n}\\n\\n.CodeMirror-focused div.CodeMirror-cursors {\\n visibility: visible;\\n}\\n\\n.CodeMirror-selected { background: #d9d9d9; }\\n.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }\\n.CodeMirror-crosshair { cursor: crosshair; }\\n.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }\\n.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }\\n\\n.cm-searching {\\n background-color: #ffa;\\n background-color: rgba(255, 255, 0, .4);\\n}\\n\\n/* Used to force a border model for a node */\\n.cm-force-border { padding-right: .1px; }\\n\\n@media print {\\n /* Hide the cursor when printing */\\n .CodeMirror div.CodeMirror-cursors {\\n visibility: hidden;\\n }\\n}\\n\\n/* See issue #2901 */\\n.cm-tab-wrap-hack:after { content: ''; }\\n\\n/* Help users use markselection to safely style text background */\\nspan.CodeMirror-selectedtext { background: none; }\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".cm-s-abcdef.CodeMirror { background: #0f0f0f; color: #defdef; }\\n.cm-s-abcdef div.CodeMirror-selected { background: #515151; }\\n.cm-s-abcdef .CodeMirror-line::selection, .cm-s-abcdef .CodeMirror-line > span::selection, .cm-s-abcdef .CodeMirror-line > span > span::selection { background: rgba(56, 56, 56, 0.99); }\\n.cm-s-abcdef .CodeMirror-line::-moz-selection, .cm-s-abcdef .CodeMirror-line > span::-moz-selection, .cm-s-abcdef .CodeMirror-line > span > span::-moz-selection { background: rgba(56, 56, 56, 0.99); }\\n.cm-s-abcdef .CodeMirror-gutters { background: #555; border-right: 2px solid #314151; }\\n.cm-s-abcdef .CodeMirror-guttermarker { color: #222; }\\n.cm-s-abcdef .CodeMirror-guttermarker-subtle { color: azure; }\\n.cm-s-abcdef .CodeMirror-linenumber { color: #FFFFFF; }\\n.cm-s-abcdef .CodeMirror-cursor { border-left: 1px solid #00FF00; }\\n\\n.cm-s-abcdef span.cm-keyword { color: darkgoldenrod; font-weight: bold; }\\n.cm-s-abcdef span.cm-atom { color: #77F; }\\n.cm-s-abcdef span.cm-number { color: violet; }\\n.cm-s-abcdef span.cm-def { color: #fffabc; }\\n.cm-s-abcdef span.cm-variable { color: #abcdef; }\\n.cm-s-abcdef span.cm-variable-2 { color: #cacbcc; }\\n.cm-s-abcdef span.cm-variable-3, .cm-s-abcdef span.cm-type { color: #def; }\\n.cm-s-abcdef span.cm-property { color: #fedcba; }\\n.cm-s-abcdef span.cm-operator { color: #ff0; }\\n.cm-s-abcdef span.cm-comment { color: #7a7b7c; font-style: italic;}\\n.cm-s-abcdef span.cm-string { color: #2b4; }\\n.cm-s-abcdef span.cm-meta { color: #C9F; }\\n.cm-s-abcdef span.cm-qualifier { color: #FFF700; }\\n.cm-s-abcdef span.cm-builtin { color: #30aabc; }\\n.cm-s-abcdef span.cm-bracket { color: #8a8a8a; }\\n.cm-s-abcdef span.cm-tag { color: #FFDD44; }\\n.cm-s-abcdef span.cm-attribute { color: #DDFF00; }\\n.cm-s-abcdef span.cm-error { color: #FF0000; }\\n.cm-s-abcdef span.cm-header { color: aquamarine; font-weight: bold; }\\n.cm-s-abcdef span.cm-link { color: blueviolet; }\\n\\n.cm-s-abcdef .CodeMirror-activeline-background { background: #314151; }\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/codemirror/theme/abcdef.css\"],\"names\":[],\"mappings\":\"AAAA,0BAA0B,mBAAmB,EAAE,cAAc,EAAE;AAC/D,uCAAuC,mBAAmB,EAAE;AAC5D,oJAAoJ,kCAAkC,EAAE;AACxL,mKAAmK,kCAAkC,EAAE;AACvM,mCAAmC,gBAAgB,EAAE,+BAA+B,EAAE;AACtF,wCAAwC,WAAW,EAAE;AACrD,+CAA+C,YAAY,EAAE;AAC7D,sCAAsC,cAAc,EAAE;AACtD,kCAAkC,8BAA8B,EAAE;;AAElE,+BAA+B,oBAAoB,EAAE,iBAAiB,EAAE;AACxE,4BAA4B,WAAW,EAAE;AACzC,8BAA8B,aAAa,EAAE;AAC7C,2BAA2B,cAAc,EAAE;AAC3C,gCAAgC,cAAc,EAAE;AAChD,kCAAkC,cAAc,EAAE;AAClD,6DAA6D,WAAW,EAAE;AAC1E,gCAAgC,cAAc,EAAE;AAChD,gCAAgC,WAAW,EAAE;AAC7C,+BAA+B,cAAc,EAAE,kBAAkB,CAAC;AAClE,8BAA8B,WAAW,EAAE;AAC3C,4BAA4B,WAAW,EAAE;AACzC,iCAAiC,cAAc,EAAE;AACjD,+BAA+B,cAAc,EAAE;AAC/C,+BAA+B,cAAc,EAAE;AAC/C,2BAA2B,cAAc,EAAE;AAC3C,iCAAiC,cAAc,EAAE;AACjD,6BAA6B,cAAc,EAAE;AAC7C,8BAA8B,iBAAiB,EAAE,iBAAiB,EAAE;AACpE,4BAA4B,iBAAiB,EAAE;;AAE/C,iDAAiD,mBAAmB,EAAE\",\"sourcesContent\":[\".cm-s-abcdef.CodeMirror { background: #0f0f0f; color: #defdef; }\\n.cm-s-abcdef div.CodeMirror-selected { background: #515151; }\\n.cm-s-abcdef .CodeMirror-line::selection, .cm-s-abcdef .CodeMirror-line > span::selection, .cm-s-abcdef .CodeMirror-line > span > span::selection { background: rgba(56, 56, 56, 0.99); }\\n.cm-s-abcdef .CodeMirror-line::-moz-selection, .cm-s-abcdef .CodeMirror-line > span::-moz-selection, .cm-s-abcdef .CodeMirror-line > span > span::-moz-selection { background: rgba(56, 56, 56, 0.99); }\\n.cm-s-abcdef .CodeMirror-gutters { background: #555; border-right: 2px solid #314151; }\\n.cm-s-abcdef .CodeMirror-guttermarker { color: #222; }\\n.cm-s-abcdef .CodeMirror-guttermarker-subtle { color: azure; }\\n.cm-s-abcdef .CodeMirror-linenumber { color: #FFFFFF; }\\n.cm-s-abcdef .CodeMirror-cursor { border-left: 1px solid #00FF00; }\\n\\n.cm-s-abcdef span.cm-keyword { color: darkgoldenrod; font-weight: bold; }\\n.cm-s-abcdef span.cm-atom { color: #77F; }\\n.cm-s-abcdef span.cm-number { color: violet; }\\n.cm-s-abcdef span.cm-def { color: #fffabc; }\\n.cm-s-abcdef span.cm-variable { color: #abcdef; }\\n.cm-s-abcdef span.cm-variable-2 { color: #cacbcc; }\\n.cm-s-abcdef span.cm-variable-3, .cm-s-abcdef span.cm-type { color: #def; }\\n.cm-s-abcdef span.cm-property { color: #fedcba; }\\n.cm-s-abcdef span.cm-operator { color: #ff0; }\\n.cm-s-abcdef span.cm-comment { color: #7a7b7c; font-style: italic;}\\n.cm-s-abcdef span.cm-string { color: #2b4; }\\n.cm-s-abcdef span.cm-meta { color: #C9F; }\\n.cm-s-abcdef span.cm-qualifier { color: #FFF700; }\\n.cm-s-abcdef span.cm-builtin { color: #30aabc; }\\n.cm-s-abcdef span.cm-bracket { color: #8a8a8a; }\\n.cm-s-abcdef span.cm-tag { color: #FFDD44; }\\n.cm-s-abcdef span.cm-attribute { color: #DDFF00; }\\n.cm-s-abcdef span.cm-error { color: #FF0000; }\\n.cm-s-abcdef span.cm-header { color: aquamarine; font-weight: bold; }\\n.cm-s-abcdef span.cm-link { color: blueviolet; }\\n\\n.cm-s-abcdef .CodeMirror-activeline-background { background: #314151; }\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/**\\n Name: IntelliJ IDEA darcula theme\\n From IntelliJ IDEA by JetBrains\\n */\\n\\n.cm-s-darcula { font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;}\\n.cm-s-darcula.CodeMirror { background: #2B2B2B; color: #A9B7C6; }\\n\\n.cm-s-darcula span.cm-meta { color: #BBB529; }\\n.cm-s-darcula span.cm-number { color: #6897BB; }\\n.cm-s-darcula span.cm-keyword { color: #CC7832; line-height: 1em; font-weight: bold; }\\n.cm-s-darcula span.cm-def { color: #A9B7C6; font-style: italic; }\\n.cm-s-darcula span.cm-variable { color: #A9B7C6; }\\n.cm-s-darcula span.cm-variable-2 { color: #A9B7C6; }\\n.cm-s-darcula span.cm-variable-3 { color: #9876AA; }\\n.cm-s-darcula span.cm-type { color: #AABBCC; font-weight: bold; }\\n.cm-s-darcula span.cm-property { color: #FFC66D; }\\n.cm-s-darcula span.cm-operator { color: #A9B7C6; }\\n.cm-s-darcula span.cm-string { color: #6A8759; }\\n.cm-s-darcula span.cm-string-2 { color: #6A8759; }\\n.cm-s-darcula span.cm-comment { color: #61A151; font-style: italic; }\\n.cm-s-darcula span.cm-link { color: #CC7832; }\\n.cm-s-darcula span.cm-atom { color: #CC7832; }\\n.cm-s-darcula span.cm-error { color: #BC3F3C; }\\n.cm-s-darcula span.cm-tag { color: #629755; font-weight: bold; font-style: italic; text-decoration: underline; }\\n.cm-s-darcula span.cm-attribute { color: #6897bb; }\\n.cm-s-darcula span.cm-qualifier { color: #6A8759; }\\n.cm-s-darcula span.cm-bracket { color: #A9B7C6; }\\n.cm-s-darcula span.cm-builtin { color: #FF9E59; }\\n.cm-s-darcula span.cm-special { color: #FF9E59; }\\n.cm-s-darcula span.cm-matchhighlight { color: #FFFFFF; background-color: rgba(50, 89, 48, .7); font-weight: normal;}\\n.cm-s-darcula span.cm-searching { color: #FFFFFF; background-color: rgba(61, 115, 59, .7); font-weight: normal;}\\n\\n.cm-s-darcula .CodeMirror-cursor { border-left: 1px solid #A9B7C6; }\\n.cm-s-darcula .CodeMirror-activeline-background { background: #323232; }\\n.cm-s-darcula .CodeMirror-gutters { background: #313335; border-right: 1px solid #313335; }\\n.cm-s-darcula .CodeMirror-guttermarker { color: #FFEE80; }\\n.cm-s-darcula .CodeMirror-guttermarker-subtle { color: #D0D0D0; }\\n.cm-s-darcula .CodeMirrir-linenumber { color: #606366; }\\n.cm-s-darcula .CodeMirror-matchingbracket { background-color: #3B514D; color: #FFEF28 !important; font-weight: bold; }\\n\\n.cm-s-darcula div.CodeMirror-selected { background: #214283; }\\n\\n.CodeMirror-hints.darcula {\\n font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;\\n color: #9C9E9E;\\n background-color: #3B3E3F !important;\\n}\\n\\n.CodeMirror-hints.darcula .CodeMirror-hint-active {\\n background-color: #494D4E !important;\\n color: #9C9E9E !important;\\n}\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/codemirror/theme/darcula.css\"],\"names\":[],\"mappings\":\"AAAA;;;EAGE;;AAEF,iBAAiB,0JAA0J,CAAC;AAC5K,2BAA2B,mBAAmB,EAAE,cAAc,EAAE;;AAEhE,6BAA6B,cAAc,EAAE;AAC7C,+BAA+B,cAAc,EAAE;AAC/C,gCAAgC,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE;AACrF,4BAA4B,cAAc,EAAE,kBAAkB,EAAE;AAChE,iCAAiC,cAAc,EAAE;AACjD,mCAAmC,cAAc,EAAE;AACnD,mCAAmC,cAAc,EAAE;AACnD,6BAA6B,cAAc,EAAE,iBAAiB,EAAE;AAChE,iCAAiC,cAAc,EAAE;AACjD,iCAAiC,cAAc,EAAE;AACjD,+BAA+B,cAAc,EAAE;AAC/C,iCAAiC,cAAc,EAAE;AACjD,gCAAgC,cAAc,EAAE,kBAAkB,EAAE;AACpE,6BAA6B,cAAc,EAAE;AAC7C,6BAA6B,cAAc,EAAE;AAC7C,8BAA8B,cAAc,EAAE;AAC9C,4BAA4B,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE;AAC/G,kCAAkC,cAAc,EAAE;AAClD,kCAAkC,cAAc,EAAE;AAClD,gCAAgC,cAAc,EAAE;AAChD,gCAAgC,cAAc,EAAE;AAChD,gCAAgC,cAAc,EAAE;AAChD,uCAAuC,cAAc,EAAE,sCAAsC,EAAE,mBAAmB,CAAC;AACnH,kCAAkC,cAAc,EAAE,uCAAuC,EAAE,mBAAmB,CAAC;;AAE/G,mCAAmC,8BAA8B,EAAE;AACnE,kDAAkD,mBAAmB,EAAE;AACvE,oCAAoC,mBAAmB,EAAE,+BAA+B,EAAE;AAC1F,yCAAyC,cAAc,EAAE;AACzD,gDAAgD,cAAc,EAAE;AAChE,uCAAuC,cAAc,EAAE;AACvD,4CAA4C,yBAAyB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE;;AAErH,wCAAwC,mBAAmB,EAAE;;AAE7D;EACE,8DAA8D;EAC9D,cAAc;EACd,oCAAoC;AACtC;;AAEA;EACE,oCAAoC;EACpC,yBAAyB;AAC3B\",\"sourcesContent\":[\"/**\\n Name: IntelliJ IDEA darcula theme\\n From IntelliJ IDEA by JetBrains\\n */\\n\\n.cm-s-darcula { font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;}\\n.cm-s-darcula.CodeMirror { background: #2B2B2B; color: #A9B7C6; }\\n\\n.cm-s-darcula span.cm-meta { color: #BBB529; }\\n.cm-s-darcula span.cm-number { color: #6897BB; }\\n.cm-s-darcula span.cm-keyword { color: #CC7832; line-height: 1em; font-weight: bold; }\\n.cm-s-darcula span.cm-def { color: #A9B7C6; font-style: italic; }\\n.cm-s-darcula span.cm-variable { color: #A9B7C6; }\\n.cm-s-darcula span.cm-variable-2 { color: #A9B7C6; }\\n.cm-s-darcula span.cm-variable-3 { color: #9876AA; }\\n.cm-s-darcula span.cm-type { color: #AABBCC; font-weight: bold; }\\n.cm-s-darcula span.cm-property { color: #FFC66D; }\\n.cm-s-darcula span.cm-operator { color: #A9B7C6; }\\n.cm-s-darcula span.cm-string { color: #6A8759; }\\n.cm-s-darcula span.cm-string-2 { color: #6A8759; }\\n.cm-s-darcula span.cm-comment { color: #61A151; font-style: italic; }\\n.cm-s-darcula span.cm-link { color: #CC7832; }\\n.cm-s-darcula span.cm-atom { color: #CC7832; }\\n.cm-s-darcula span.cm-error { color: #BC3F3C; }\\n.cm-s-darcula span.cm-tag { color: #629755; font-weight: bold; font-style: italic; text-decoration: underline; }\\n.cm-s-darcula span.cm-attribute { color: #6897bb; }\\n.cm-s-darcula span.cm-qualifier { color: #6A8759; }\\n.cm-s-darcula span.cm-bracket { color: #A9B7C6; }\\n.cm-s-darcula span.cm-builtin { color: #FF9E59; }\\n.cm-s-darcula span.cm-special { color: #FF9E59; }\\n.cm-s-darcula span.cm-matchhighlight { color: #FFFFFF; background-color: rgba(50, 89, 48, .7); font-weight: normal;}\\n.cm-s-darcula span.cm-searching { color: #FFFFFF; background-color: rgba(61, 115, 59, .7); font-weight: normal;}\\n\\n.cm-s-darcula .CodeMirror-cursor { border-left: 1px solid #A9B7C6; }\\n.cm-s-darcula .CodeMirror-activeline-background { background: #323232; }\\n.cm-s-darcula .CodeMirror-gutters { background: #313335; border-right: 1px solid #313335; }\\n.cm-s-darcula .CodeMirror-guttermarker { color: #FFEE80; }\\n.cm-s-darcula .CodeMirror-guttermarker-subtle { color: #D0D0D0; }\\n.cm-s-darcula .CodeMirrir-linenumber { color: #606366; }\\n.cm-s-darcula .CodeMirror-matchingbracket { background-color: #3B514D; color: #FFEF28 !important; font-weight: bold; }\\n\\n.cm-s-darcula div.CodeMirror-selected { background: #214283; }\\n\\n.CodeMirror-hints.darcula {\\n font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;\\n color: #9C9E9E;\\n background-color: #3B3E3F !important;\\n}\\n\\n.CodeMirror-hints.darcula .CodeMirror-hint-active {\\n background-color: #494D4E !important;\\n color: #9C9E9E !important;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/**\\n Name: IDEA default theme\\n From IntelliJ IDEA by JetBrains\\n */\\n\\n.cm-s-idea span.cm-meta { color: #808000; }\\n.cm-s-idea span.cm-number { color: #0000FF; }\\n.cm-s-idea span.cm-keyword { line-height: 1em; font-weight: bold; color: #000080; }\\n.cm-s-idea span.cm-atom { font-weight: bold; color: #000080; }\\n.cm-s-idea span.cm-def { color: #000000; }\\n.cm-s-idea span.cm-variable { color: black; }\\n.cm-s-idea span.cm-variable-2 { color: black; }\\n.cm-s-idea span.cm-variable-3, .cm-s-idea span.cm-type { color: black; }\\n.cm-s-idea span.cm-property { color: black; }\\n.cm-s-idea span.cm-operator { color: black; }\\n.cm-s-idea span.cm-comment { color: #808080; }\\n.cm-s-idea span.cm-string { color: #008000; }\\n.cm-s-idea span.cm-string-2 { color: #008000; }\\n.cm-s-idea span.cm-qualifier { color: #555; }\\n.cm-s-idea span.cm-error { color: #FF0000; }\\n.cm-s-idea span.cm-attribute { color: #0000FF; }\\n.cm-s-idea span.cm-tag { color: #000080; }\\n.cm-s-idea span.cm-link { color: #0000FF; }\\n.cm-s-idea .CodeMirror-activeline-background { background: #FFFAE3; }\\n\\n.cm-s-idea span.cm-builtin { color: #30a; }\\n.cm-s-idea span.cm-bracket { color: #cc7; }\\n.cm-s-idea { font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;}\\n\\n\\n.cm-s-idea .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }\\n\\n.CodeMirror-hints.idea {\\n font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;\\n color: #616569;\\n background-color: #ebf3fd !important;\\n}\\n\\n.CodeMirror-hints.idea .CodeMirror-hint-active {\\n background-color: #a2b8c9 !important;\\n color: #5c6065 !important;\\n}\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/codemirror/theme/idea.css\"],\"names\":[],\"mappings\":\"AAAA;;;EAGE;;AAEF,0BAA0B,cAAc,EAAE;AAC1C,4BAA4B,cAAc,EAAE;AAC5C,6BAA6B,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE;AAClF,0BAA0B,iBAAiB,EAAE,cAAc,EAAE;AAC7D,yBAAyB,cAAc,EAAE;AACzC,8BAA8B,YAAY,EAAE;AAC5C,gCAAgC,YAAY,EAAE;AAC9C,yDAAyD,YAAY,EAAE;AACvE,8BAA8B,YAAY,EAAE;AAC5C,8BAA8B,YAAY,EAAE;AAC5C,6BAA6B,cAAc,EAAE;AAC7C,4BAA4B,cAAc,EAAE;AAC5C,8BAA8B,cAAc,EAAE;AAC9C,+BAA+B,WAAW,EAAE;AAC5C,2BAA2B,cAAc,EAAE;AAC3C,+BAA+B,cAAc,EAAE;AAC/C,yBAAyB,cAAc,EAAE;AACzC,0BAA0B,cAAc,EAAE;AAC1C,+CAA+C,mBAAmB,EAAE;;AAEpE,6BAA6B,WAAW,EAAE;AAC1C,6BAA6B,WAAW,EAAE;AAC1C,cAAc,gJAAgJ,CAAC;;;AAG/J,yCAAyC,sBAAsB,EAAE,sBAAsB,EAAE;;AAEzF;EACE,8DAA8D;EAC9D,cAAc;EACd,oCAAoC;AACtC;;AAEA;EACE,oCAAoC;EACpC,yBAAyB;AAC3B\",\"sourcesContent\":[\"/**\\n Name: IDEA default theme\\n From IntelliJ IDEA by JetBrains\\n */\\n\\n.cm-s-idea span.cm-meta { color: #808000; }\\n.cm-s-idea span.cm-number { color: #0000FF; }\\n.cm-s-idea span.cm-keyword { line-height: 1em; font-weight: bold; color: #000080; }\\n.cm-s-idea span.cm-atom { font-weight: bold; color: #000080; }\\n.cm-s-idea span.cm-def { color: #000000; }\\n.cm-s-idea span.cm-variable { color: black; }\\n.cm-s-idea span.cm-variable-2 { color: black; }\\n.cm-s-idea span.cm-variable-3, .cm-s-idea span.cm-type { color: black; }\\n.cm-s-idea span.cm-property { color: black; }\\n.cm-s-idea span.cm-operator { color: black; }\\n.cm-s-idea span.cm-comment { color: #808080; }\\n.cm-s-idea span.cm-string { color: #008000; }\\n.cm-s-idea span.cm-string-2 { color: #008000; }\\n.cm-s-idea span.cm-qualifier { color: #555; }\\n.cm-s-idea span.cm-error { color: #FF0000; }\\n.cm-s-idea span.cm-attribute { color: #0000FF; }\\n.cm-s-idea span.cm-tag { color: #000080; }\\n.cm-s-idea span.cm-link { color: #0000FF; }\\n.cm-s-idea .CodeMirror-activeline-background { background: #FFFAE3; }\\n\\n.cm-s-idea span.cm-builtin { color: #30a; }\\n.cm-s-idea span.cm-bracket { color: #cc7; }\\n.cm-s-idea { font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;}\\n\\n\\n.cm-s-idea .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }\\n\\n.CodeMirror-hints.idea {\\n font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;\\n color: #616569;\\n background-color: #ebf3fd !important;\\n}\\n\\n.CodeMirror-hints.idea .CodeMirror-hint-active {\\n background-color: #a2b8c9 !important;\\n color: #5c6065 !important;\\n}\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* Copyright (c) Jupyter Development Team.\\n * Distributed under the terms of the Modified BSD License.\\n */\\n\\n.jupyter-widgets-disconnected::before {\\n content: '\\\\f127'; /* chain-broken */\\n display: inline-block;\\n font: normal normal 900 14px/1 'Font Awesome 5 Free', 'FontAwesome';\\n text-rendering: auto;\\n -webkit-font-smoothing: antialiased;\\n -moz-osx-font-smoothing: grayscale;\\n color: #d9534f;\\n padding: 3px;\\n align-self: flex-start;\\n}\\n\\n.jupyter-widgets-error-widget {\\n display: flex;\\n flex-direction: column;\\n justify-content: center;\\n height: 100%;\\n border: solid 1px red;\\n margin: 0 auto;\\n}\\n\\n.jupyter-widgets-error-widget.icon-error {\\n min-width: var(--jp-widgets-inline-width-short);\\n}\\n.jupyter-widgets-error-widget.text-error {\\n min-width: calc(2 * var(--jp-widgets-inline-width));\\n min-height: calc(3 * var(--jp-widgets-inline-height));\\n}\\n\\n.jupyter-widgets-error-widget p {\\n text-align: center;\\n}\\n\\n.jupyter-widgets-error-widget.text-error pre::first-line {\\n font-weight: bold;\\n}\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./node_modules/@jupyter-widgets/base/css/index.css\"],\"names\":[],\"mappings\":\"AAAA;;EAEE;;AAEF;EACE,gBAAgB,EAAE,iBAAiB;EACnC,qBAAqB;EACrB,mEAAmE;EACnE,oBAAoB;EACpB,mCAAmC;EACnC,kCAAkC;EAClC,cAAc;EACd,YAAY;EACZ,sBAAsB;AACxB;;AAEA;EACE,aAAa;EACb,sBAAsB;EACtB,uBAAuB;EACvB,YAAY;EACZ,qBAAqB;EACrB,cAAc;AAChB;;AAEA;EACE,+CAA+C;AACjD;AACA;EACE,mDAAmD;EACnD,qDAAqD;AACvD;;AAEA;EACE,kBAAkB;AACpB;;AAEA;EACE,iBAAiB;AACnB\",\"sourcesContent\":[\"/* Copyright (c) Jupyter Development Team.\\n * Distributed under the terms of the Modified BSD License.\\n */\\n\\n.jupyter-widgets-disconnected::before {\\n content: '\\\\f127'; /* chain-broken */\\n display: inline-block;\\n font: normal normal 900 14px/1 'Font Awesome 5 Free', 'FontAwesome';\\n text-rendering: auto;\\n -webkit-font-smoothing: antialiased;\\n -moz-osx-font-smoothing: grayscale;\\n color: #d9534f;\\n padding: 3px;\\n align-self: flex-start;\\n}\\n\\n.jupyter-widgets-error-widget {\\n display: flex;\\n flex-direction: column;\\n justify-content: center;\\n height: 100%;\\n border: solid 1px red;\\n margin: 0 auto;\\n}\\n\\n.jupyter-widgets-error-widget.icon-error {\\n min-width: var(--jp-widgets-inline-width-short);\\n}\\n.jupyter-widgets-error-widget.text-error {\\n min-width: calc(2 * var(--jp-widgets-inline-width));\\n min-height: calc(3 * var(--jp-widgets-inline-height));\\n}\\n\\n.jupyter-widgets-error-widget p {\\n text-align: center;\\n}\\n\\n.jupyter-widgets-error-widget.text-error pre::first-line {\\n font-weight: bold;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* This file has code derived from Lumino CSS files, as noted below. The license for this Lumino code is:\\n\\nCopyright (c) 2019 Project Jupyter Contributors\\nAll rights reserved.\\n\\nRedistribution and use in source and binary forms, with or without\\nmodification, are permitted provided that the following conditions are met:\\n\\n1. Redistributions of source code must retain the above copyright notice, this\\n list of conditions and the following disclaimer.\\n\\n2. Redistributions in binary form must reproduce the above copyright notice,\\n this list of conditions and the following disclaimer in the documentation\\n and/or other materials provided with the distribution.\\n\\n3. Neither the name of the copyright holder nor the names of its\\n contributors may be used to endorse or promote products derived from\\n this software without specific prior written permission.\\n\\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\"\\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\\n\\n\\nCopyright (c) 2014-2017, PhosphorJS Contributors\\nAll rights reserved.\\n\\nRedistribution and use in source and binary forms, with or without\\nmodification, are permitted provided that the following conditions are met:\\n\\n* Redistributions of source code must retain the above copyright notice, this\\n list of conditions and the following disclaimer.\\n\\n* Redistributions in binary form must reproduce the above copyright notice,\\n this list of conditions and the following disclaimer in the documentation\\n and/or other materials provided with the distribution.\\n\\n* Neither the name of the copyright holder nor the names of its\\n contributors may be used to endorse or promote products derived from\\n this software without specific prior written permission.\\n\\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\"\\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\\n*/\\n\\n/*\\n * The following section is derived from https://github.com/jupyterlab/lumino/blob/23b9d075ebc5b73ab148b6ebfc20af97f85714c4/packages/widgets/style/tabbar.css \\n * We've scoped the rules so that they are consistent with exactly our code.\\n */\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar {\\n display: flex;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n -ms-user-select: none;\\n user-select: none;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='horizontal'], /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar[data-orientation='horizontal'], /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar[data-orientation='horizontal'] {\\n flex-direction: row;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='vertical'], /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar[data-orientation='vertical'], /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar[data-orientation='vertical'] {\\n flex-direction: column;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar > .lm-TabBar-content {\\n margin: 0;\\n padding: 0;\\n display: flex;\\n flex: 1 1 auto;\\n list-style-type: none;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar[data-orientation='horizontal']\\n > .p-TabBar-content,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar[data-orientation='horizontal']\\n> .p-TabBar-content,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar[data-orientation='horizontal']\\n > .lm-TabBar-content {\\n flex-direction: row;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar[data-orientation='vertical']\\n > .p-TabBar-content,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar[data-orientation='vertical']\\n> .p-TabBar-content,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar[data-orientation='vertical']\\n > .lm-TabBar-content {\\n flex-direction: column;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab {\\n display: flex;\\n flex-direction: row;\\n box-sizing: border-box;\\n overflow: hidden;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabIcon,\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabCloseIcon {\\n flex: 0 0 auto;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabLabel {\\n flex: 1 1 auto;\\n overflow: hidden;\\n white-space: nowrap;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-hidden, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab.p-mod-hidden, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab.lm-mod-hidden {\\n display: none !important;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar.p-mod-dragging .p-TabBar-tab, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar.p-mod-dragging .p-TabBar-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar.lm-mod-dragging .lm-TabBar-tab {\\n position: relative;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar.p-mod-dragging[data-orientation='horizontal']\\n .p-TabBar-tab,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .p-TabBar.p-mod-dragging[data-orientation='horizontal']\\n .p-TabBar-tab,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar.lm-mod-dragging[data-orientation='horizontal']\\n .lm-TabBar-tab {\\n left: 0;\\n transition: left 150ms ease;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar.p-mod-dragging[data-orientation='vertical']\\n .p-TabBar-tab,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar.p-mod-dragging[data-orientation='vertical']\\n.p-TabBar-tab,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar.lm-mod-dragging[data-orientation='vertical']\\n .lm-TabBar-tab {\\n top: 0;\\n transition: top 150ms ease;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar.p-mod-dragging\\n .p-TabBar-tab.p-mod-dragging,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar.p-mod-dragging\\n.p-TabBar-tab.p-mod-dragging,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar.lm-mod-dragging\\n .lm-TabBar-tab.lm-mod-dragging {\\n transition: none;\\n}\\n\\n/* End tabbar.css */\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./node_modules/@jupyter-widgets/controls/css/lumino.css\"],\"names\":[],\"mappings\":\"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DC;;AAED;;;EAGE;;AAEF,iBAAiB;AACjB;;;EAGE,aAAa;EACb,yBAAyB;EACzB,sBAAsB;EACtB,qBAAqB;EACrB,iBAAiB;AACnB;;AAEA,iBAAiB;AACjB;;;EAGE,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;;EAGE,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;;EAGE,SAAS;EACT,UAAU;EACV,aAAa;EACb,cAAc;EACd,qBAAqB;AACvB;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;EAYE,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;EAYE,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;;EAGE,aAAa;EACb,mBAAmB;EACnB,sBAAsB;EACtB,gBAAgB;AAClB;;AAEA,iBAAiB;AACjB;;;;;;EAME,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;;EAGE,cAAc;EACd,gBAAgB;EAChB,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;;EAGE,wBAAwB;AAC1B;;AAEA,iBAAiB;AACjB;;;EAGE,kBAAkB;AACpB;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;EAYE,OAAO;EACP,2BAA2B;AAC7B;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;EAYE,MAAM;EACN,0BAA0B;AAC5B;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;EAYE,gBAAgB;AAClB;;AAEA,mBAAmB\",\"sourcesContent\":[\"/* This file has code derived from Lumino CSS files, as noted below. The license for this Lumino code is:\\n\\nCopyright (c) 2019 Project Jupyter Contributors\\nAll rights reserved.\\n\\nRedistribution and use in source and binary forms, with or without\\nmodification, are permitted provided that the following conditions are met:\\n\\n1. Redistributions of source code must retain the above copyright notice, this\\n list of conditions and the following disclaimer.\\n\\n2. Redistributions in binary form must reproduce the above copyright notice,\\n this list of conditions and the following disclaimer in the documentation\\n and/or other materials provided with the distribution.\\n\\n3. Neither the name of the copyright holder nor the names of its\\n contributors may be used to endorse or promote products derived from\\n this software without specific prior written permission.\\n\\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\"\\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\\n\\n\\nCopyright (c) 2014-2017, PhosphorJS Contributors\\nAll rights reserved.\\n\\nRedistribution and use in source and binary forms, with or without\\nmodification, are permitted provided that the following conditions are met:\\n\\n* Redistributions of source code must retain the above copyright notice, this\\n list of conditions and the following disclaimer.\\n\\n* Redistributions in binary form must reproduce the above copyright notice,\\n this list of conditions and the following disclaimer in the documentation\\n and/or other materials provided with the distribution.\\n\\n* Neither the name of the copyright holder nor the names of its\\n contributors may be used to endorse or promote products derived from\\n this software without specific prior written permission.\\n\\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\"\\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\\n*/\\n\\n/*\\n * The following section is derived from https://github.com/jupyterlab/lumino/blob/23b9d075ebc5b73ab148b6ebfc20af97f85714c4/packages/widgets/style/tabbar.css \\n * We've scoped the rules so that they are consistent with exactly our code.\\n */\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar {\\n display: flex;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n -ms-user-select: none;\\n user-select: none;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='horizontal'], /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar[data-orientation='horizontal'], /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar[data-orientation='horizontal'] {\\n flex-direction: row;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='vertical'], /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar[data-orientation='vertical'], /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar[data-orientation='vertical'] {\\n flex-direction: column;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar > .lm-TabBar-content {\\n margin: 0;\\n padding: 0;\\n display: flex;\\n flex: 1 1 auto;\\n list-style-type: none;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar[data-orientation='horizontal']\\n > .p-TabBar-content,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar[data-orientation='horizontal']\\n> .p-TabBar-content,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar[data-orientation='horizontal']\\n > .lm-TabBar-content {\\n flex-direction: row;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar[data-orientation='vertical']\\n > .p-TabBar-content,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar[data-orientation='vertical']\\n> .p-TabBar-content,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar[data-orientation='vertical']\\n > .lm-TabBar-content {\\n flex-direction: column;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab {\\n display: flex;\\n flex-direction: row;\\n box-sizing: border-box;\\n overflow: hidden;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabIcon,\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabCloseIcon {\\n flex: 0 0 auto;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabLabel {\\n flex: 1 1 auto;\\n overflow: hidden;\\n white-space: nowrap;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-hidden, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab.p-mod-hidden, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab.lm-mod-hidden {\\n display: none !important;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar.p-mod-dragging .p-TabBar-tab, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar.p-mod-dragging .p-TabBar-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar.lm-mod-dragging .lm-TabBar-tab {\\n position: relative;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar.p-mod-dragging[data-orientation='horizontal']\\n .p-TabBar-tab,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .p-TabBar.p-mod-dragging[data-orientation='horizontal']\\n .p-TabBar-tab,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar.lm-mod-dragging[data-orientation='horizontal']\\n .lm-TabBar-tab {\\n left: 0;\\n transition: left 150ms ease;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar.p-mod-dragging[data-orientation='vertical']\\n .p-TabBar-tab,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar.p-mod-dragging[data-orientation='vertical']\\n.p-TabBar-tab,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar.lm-mod-dragging[data-orientation='vertical']\\n .lm-TabBar-tab {\\n top: 0;\\n transition: top 150ms ease;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar.p-mod-dragging\\n .p-TabBar-tab.p-mod-dragging,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar.p-mod-dragging\\n.p-TabBar-tab.p-mod-dragging,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar.lm-mod-dragging\\n .lm-TabBar-tab.lm-mod-dragging {\\n transition: none;\\n}\\n\\n/* End tabbar.css */\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/*\\n\\nThe nouislider.css file is autogenerated from nouislider.less, which imports and wraps the nouislider/src/nouislider.less styles.\\n\\nMIT License\\n\\nCopyright (c) 2019 Léon Gersen\\n\\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \\\"Software\\\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\\n\\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\\n\\nTHE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\\n*/\\n/* The .widget-slider class is deprecated */\\n.widget-slider,\\n.jupyter-widget-slider {\\n /* Functional styling;\\n * These styles are required for noUiSlider to function.\\n * You don't need to change these rules to apply your design.\\n */\\n /* Wrapper for all connect elements.\\n */\\n /* Offset direction\\n */\\n /* Give origins 0 height/width so they don't interfere with clicking the\\n * connect elements.\\n */\\n /* Slider size and handle placement;\\n */\\n /* Styling;\\n * Giving the connect element a border radius causes issues with using transform: scale\\n */\\n /* Handles and cursors;\\n */\\n /* Handle stripes;\\n */\\n /* Disabled state;\\n */\\n /* Base;\\n *\\n */\\n /* Values;\\n *\\n */\\n /* Markings;\\n *\\n */\\n /* Horizontal layout;\\n *\\n */\\n /* Vertical layout;\\n *\\n */\\n /* Copyright (c) Jupyter Development Team.\\n * Distributed under the terms of the Modified BSD License.\\n */\\n /* Custom CSS for nouislider */\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target,\\n.widget-slider .noUi-target *,\\n.jupyter-widget-slider .noUi-target * {\\n -webkit-touch-callout: none;\\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\\n -webkit-user-select: none;\\n -ms-touch-action: none;\\n touch-action: none;\\n -ms-user-select: none;\\n -moz-user-select: none;\\n user-select: none;\\n -moz-box-sizing: border-box;\\n box-sizing: border-box;\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target {\\n position: relative;\\n}\\n.widget-slider .noUi-base,\\n.jupyter-widget-slider .noUi-base,\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n width: 100%;\\n height: 100%;\\n position: relative;\\n z-index: 1;\\n}\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n overflow: hidden;\\n z-index: 0;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect,\\n.widget-slider .noUi-origin,\\n.jupyter-widget-slider .noUi-origin {\\n will-change: transform;\\n position: absolute;\\n z-index: 1;\\n top: 0;\\n right: 0;\\n -ms-transform-origin: 0 0;\\n -webkit-transform-origin: 0 0;\\n -webkit-transform-style: preserve-3d;\\n transform-origin: 0 0;\\n transform-style: flat;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect {\\n height: 100%;\\n width: 100%;\\n}\\n.widget-slider .noUi-origin,\\n.jupyter-widget-slider .noUi-origin {\\n height: 10%;\\n width: 10%;\\n}\\n.widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-origin,\\n.jupyter-widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-origin {\\n left: 0;\\n right: auto;\\n}\\n.widget-slider .noUi-vertical .noUi-origin,\\n.jupyter-widget-slider .noUi-vertical .noUi-origin {\\n width: 0;\\n}\\n.widget-slider .noUi-horizontal .noUi-origin,\\n.jupyter-widget-slider .noUi-horizontal .noUi-origin {\\n height: 0;\\n}\\n.widget-slider .noUi-handle,\\n.jupyter-widget-slider .noUi-handle {\\n -webkit-backface-visibility: hidden;\\n backface-visibility: hidden;\\n position: absolute;\\n}\\n.widget-slider .noUi-touch-area,\\n.jupyter-widget-slider .noUi-touch-area {\\n height: 100%;\\n width: 100%;\\n}\\n.widget-slider .noUi-state-tap .noUi-connect,\\n.jupyter-widget-slider .noUi-state-tap .noUi-connect,\\n.widget-slider .noUi-state-tap .noUi-origin,\\n.jupyter-widget-slider .noUi-state-tap .noUi-origin {\\n -webkit-transition: transform 0.3s;\\n transition: transform 0.3s;\\n}\\n.widget-slider .noUi-state-drag *,\\n.jupyter-widget-slider .noUi-state-drag * {\\n cursor: inherit !important;\\n}\\n.widget-slider .noUi-horizontal,\\n.jupyter-widget-slider .noUi-horizontal {\\n height: 18px;\\n}\\n.widget-slider .noUi-horizontal .noUi-handle,\\n.jupyter-widget-slider .noUi-horizontal .noUi-handle {\\n width: 34px;\\n height: 28px;\\n right: -17px;\\n top: -6px;\\n}\\n.widget-slider .noUi-vertical,\\n.jupyter-widget-slider .noUi-vertical {\\n width: 18px;\\n}\\n.widget-slider .noUi-vertical .noUi-handle,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle {\\n width: 28px;\\n height: 34px;\\n right: -6px;\\n top: -17px;\\n}\\n.widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-handle,\\n.jupyter-widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-handle {\\n left: -17px;\\n right: auto;\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target {\\n background: #FAFAFA;\\n border-radius: 4px;\\n border: 1px solid #D3D3D3;\\n box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB;\\n}\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n border-radius: 3px;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect {\\n background: #3FB8AF;\\n}\\n.widget-slider .noUi-draggable,\\n.jupyter-widget-slider .noUi-draggable {\\n cursor: ew-resize;\\n}\\n.widget-slider .noUi-vertical .noUi-draggable,\\n.jupyter-widget-slider .noUi-vertical .noUi-draggable {\\n cursor: ns-resize;\\n}\\n.widget-slider .noUi-handle,\\n.jupyter-widget-slider .noUi-handle {\\n border: 1px solid #D9D9D9;\\n border-radius: 3px;\\n background: #FFF;\\n cursor: default;\\n box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #EBEBEB, 0 3px 6px -3px #BBB;\\n}\\n.widget-slider .noUi-active,\\n.jupyter-widget-slider .noUi-active {\\n box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB;\\n}\\n.widget-slider .noUi-handle:before,\\n.jupyter-widget-slider .noUi-handle:before,\\n.widget-slider .noUi-handle:after,\\n.jupyter-widget-slider .noUi-handle:after {\\n content: \\\"\\\";\\n display: block;\\n position: absolute;\\n height: 14px;\\n width: 1px;\\n background: #E8E7E6;\\n left: 14px;\\n top: 6px;\\n}\\n.widget-slider .noUi-handle:after,\\n.jupyter-widget-slider .noUi-handle:after {\\n left: 17px;\\n}\\n.widget-slider .noUi-vertical .noUi-handle:before,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle:before,\\n.widget-slider .noUi-vertical .noUi-handle:after,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle:after {\\n width: 14px;\\n height: 1px;\\n left: 6px;\\n top: 14px;\\n}\\n.widget-slider .noUi-vertical .noUi-handle:after,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle:after {\\n top: 17px;\\n}\\n.widget-slider [disabled] .noUi-connect,\\n.jupyter-widget-slider [disabled] .noUi-connect {\\n background: #B8B8B8;\\n}\\n.widget-slider [disabled].noUi-target,\\n.jupyter-widget-slider [disabled].noUi-target,\\n.widget-slider [disabled].noUi-handle,\\n.jupyter-widget-slider [disabled].noUi-handle,\\n.widget-slider [disabled] .noUi-handle,\\n.jupyter-widget-slider [disabled] .noUi-handle {\\n cursor: not-allowed;\\n}\\n.widget-slider .noUi-pips,\\n.jupyter-widget-slider .noUi-pips,\\n.widget-slider .noUi-pips *,\\n.jupyter-widget-slider .noUi-pips * {\\n -moz-box-sizing: border-box;\\n box-sizing: border-box;\\n}\\n.widget-slider .noUi-pips,\\n.jupyter-widget-slider .noUi-pips {\\n position: absolute;\\n color: #999;\\n}\\n.widget-slider .noUi-value,\\n.jupyter-widget-slider .noUi-value {\\n position: absolute;\\n white-space: nowrap;\\n text-align: center;\\n}\\n.widget-slider .noUi-value-sub,\\n.jupyter-widget-slider .noUi-value-sub {\\n color: #ccc;\\n font-size: 10px;\\n}\\n.widget-slider .noUi-marker,\\n.jupyter-widget-slider .noUi-marker {\\n position: absolute;\\n background: #CCC;\\n}\\n.widget-slider .noUi-marker-sub,\\n.jupyter-widget-slider .noUi-marker-sub {\\n background: #AAA;\\n}\\n.widget-slider .noUi-marker-large,\\n.jupyter-widget-slider .noUi-marker-large {\\n background: #AAA;\\n}\\n.widget-slider .noUi-pips-horizontal,\\n.jupyter-widget-slider .noUi-pips-horizontal {\\n padding: 10px 0;\\n height: 80px;\\n top: 100%;\\n left: 0;\\n width: 100%;\\n}\\n.widget-slider .noUi-value-horizontal,\\n.jupyter-widget-slider .noUi-value-horizontal {\\n -webkit-transform: translate(-50%, 50%);\\n transform: translate(-50%, 50%);\\n}\\n.noUi-rtl .widget-slider .noUi-value-horizontal,\\n.noUi-rtl .jupyter-widget-slider .noUi-value-horizontal {\\n -webkit-transform: translate(50%, 50%);\\n transform: translate(50%, 50%);\\n}\\n.widget-slider .noUi-marker-horizontal.noUi-marker,\\n.jupyter-widget-slider .noUi-marker-horizontal.noUi-marker {\\n margin-left: -1px;\\n width: 2px;\\n height: 5px;\\n}\\n.widget-slider .noUi-marker-horizontal.noUi-marker-sub,\\n.jupyter-widget-slider .noUi-marker-horizontal.noUi-marker-sub {\\n height: 10px;\\n}\\n.widget-slider .noUi-marker-horizontal.noUi-marker-large,\\n.jupyter-widget-slider .noUi-marker-horizontal.noUi-marker-large {\\n height: 15px;\\n}\\n.widget-slider .noUi-pips-vertical,\\n.jupyter-widget-slider .noUi-pips-vertical {\\n padding: 0 10px;\\n height: 100%;\\n top: 0;\\n left: 100%;\\n}\\n.widget-slider .noUi-value-vertical,\\n.jupyter-widget-slider .noUi-value-vertical {\\n -webkit-transform: translate(0, -50%);\\n transform: translate(0, -50%);\\n padding-left: 25px;\\n}\\n.noUi-rtl .widget-slider .noUi-value-vertical,\\n.noUi-rtl .jupyter-widget-slider .noUi-value-vertical {\\n -webkit-transform: translate(0, 50%);\\n transform: translate(0, 50%);\\n}\\n.widget-slider .noUi-marker-vertical.noUi-marker,\\n.jupyter-widget-slider .noUi-marker-vertical.noUi-marker {\\n width: 5px;\\n height: 2px;\\n margin-top: -1px;\\n}\\n.widget-slider .noUi-marker-vertical.noUi-marker-sub,\\n.jupyter-widget-slider .noUi-marker-vertical.noUi-marker-sub {\\n width: 10px;\\n}\\n.widget-slider .noUi-marker-vertical.noUi-marker-large,\\n.jupyter-widget-slider .noUi-marker-vertical.noUi-marker-large {\\n width: 15px;\\n}\\n.widget-slider .noUi-tooltip,\\n.jupyter-widget-slider .noUi-tooltip {\\n display: block;\\n position: absolute;\\n border: 1px solid #D9D9D9;\\n border-radius: 3px;\\n background: #fff;\\n color: #000;\\n padding: 5px;\\n text-align: center;\\n white-space: nowrap;\\n}\\n.widget-slider .noUi-horizontal .noUi-tooltip,\\n.jupyter-widget-slider .noUi-horizontal .noUi-tooltip {\\n -webkit-transform: translate(-50%, 0);\\n transform: translate(-50%, 0);\\n left: 50%;\\n bottom: 120%;\\n}\\n.widget-slider .noUi-vertical .noUi-tooltip,\\n.jupyter-widget-slider .noUi-vertical .noUi-tooltip {\\n -webkit-transform: translate(0, -50%);\\n transform: translate(0, -50%);\\n top: 50%;\\n right: 120%;\\n}\\n.widget-slider .noUi-horizontal .noUi-origin > .noUi-tooltip,\\n.jupyter-widget-slider .noUi-horizontal .noUi-origin > .noUi-tooltip {\\n -webkit-transform: translate(50%, 0);\\n transform: translate(50%, 0);\\n left: auto;\\n bottom: 10px;\\n}\\n.widget-slider .noUi-vertical .noUi-origin > .noUi-tooltip,\\n.jupyter-widget-slider .noUi-vertical .noUi-origin > .noUi-tooltip {\\n -webkit-transform: translate(0, -18px);\\n transform: translate(0, -18px);\\n top: auto;\\n right: 28px;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect {\\n background: #2196f3;\\n}\\n.widget-slider .noUi-horizontal,\\n.jupyter-widget-slider .noUi-horizontal {\\n height: var(--jp-widgets-slider-track-thickness);\\n}\\n.widget-slider .noUi-vertical,\\n.jupyter-widget-slider .noUi-vertical {\\n width: var(--jp-widgets-slider-track-thickness);\\n height: 100%;\\n}\\n.widget-slider .noUi-horizontal .noUi-handle,\\n.jupyter-widget-slider .noUi-horizontal .noUi-handle {\\n width: var(--jp-widgets-slider-handle-size);\\n height: var(--jp-widgets-slider-handle-size);\\n border-radius: 50%;\\n top: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-handle-size)) / 2);\\n right: calc(var(--jp-widgets-slider-handle-size) / -2);\\n}\\n.widget-slider .noUi-vertical .noUi-handle,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle {\\n height: var(--jp-widgets-slider-handle-size);\\n width: var(--jp-widgets-slider-handle-size);\\n border-radius: 50%;\\n right: calc((var(--jp-widgets-slider-handle-size) - var(--jp-widgets-slider-track-thickness)) / -2);\\n top: calc(var(--jp-widgets-slider-handle-size) / -2);\\n}\\n.widget-slider .noUi-handle:after,\\n.jupyter-widget-slider .noUi-handle:after {\\n content: none;\\n}\\n.widget-slider .noUi-handle:before,\\n.jupyter-widget-slider .noUi-handle:before {\\n content: none;\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target {\\n background: #fafafa;\\n border-radius: 4px;\\n border: 1px;\\n /* box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB; */\\n}\\n.widget-slider .ui-slider,\\n.jupyter-widget-slider .ui-slider {\\n border: var(--jp-widgets-slider-border-width) solid var(--jp-layout-color3);\\n background: var(--jp-layout-color3);\\n box-sizing: border-box;\\n position: relative;\\n border-radius: 0px;\\n}\\n.widget-slider .noUi-handle,\\n.jupyter-widget-slider .noUi-handle {\\n width: var(--jp-widgets-slider-handle-size);\\n border: 1px solid #d9d9d9;\\n border-radius: 3px;\\n background: #fff;\\n cursor: default;\\n box-shadow: none;\\n outline: none;\\n}\\n.widget-slider .noUi-target:not([disabled]) .noUi-handle:hover,\\n.jupyter-widget-slider .noUi-target:not([disabled]) .noUi-handle:hover,\\n.widget-slider .noUi-target:not([disabled]) .noUi-handle:focus,\\n.jupyter-widget-slider .noUi-target:not([disabled]) .noUi-handle:focus {\\n background-color: var(--jp-widgets-slider-active-handle-color);\\n border: var(--jp-widgets-slider-border-width) solid var(--jp-widgets-slider-active-handle-color);\\n}\\n.widget-slider [disabled].noUi-target,\\n.jupyter-widget-slider [disabled].noUi-target {\\n opacity: 0.35;\\n}\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n overflow: visible;\\n z-index: 0;\\n background: var(--jp-layout-color3);\\n}\\n.widget-slider .noUi-vertical .noUi-connect,\\n.jupyter-widget-slider .noUi-vertical .noUi-connect {\\n width: calc(100% + 2px);\\n right: -1px;\\n}\\n.widget-slider .noUi-horizontal .noUi-connect,\\n.jupyter-widget-slider .noUi-horizontal .noUi-connect {\\n height: calc(100% + 2px);\\n top: -1px;\\n}\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./node_modules/@jupyter-widgets/controls/css/nouislider.css\"],\"names\":[],\"mappings\":\"AAAA;;;;;;;;;;;;;CAaC;AACD,2CAA2C;AAC3C;;EAEE;;;EAGA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA,8BAA8B;AAChC;AACA;;;;EAIE,2BAA2B;EAC3B,6CAA6C;EAC7C,yBAAyB;EACzB,sBAAsB;EACtB,kBAAkB;EAClB,qBAAqB;EACrB,sBAAsB;EACtB,iBAAiB;EACjB,2BAA2B;EAC3B,sBAAsB;AACxB;AACA;;EAEE,kBAAkB;AACpB;AACA;;;;EAIE,WAAW;EACX,YAAY;EACZ,kBAAkB;EAClB,UAAU;AACZ;AACA;;EAEE,gBAAgB;EAChB,UAAU;AACZ;AACA;;;;EAIE,sBAAsB;EACtB,kBAAkB;EAClB,UAAU;EACV,MAAM;EACN,QAAQ;EACR,yBAAyB;EACzB,6BAA6B;EAC7B,oCAAoC;EACpC,qBAAqB;EACrB,qBAAqB;AACvB;AACA;;EAEE,YAAY;EACZ,WAAW;AACb;AACA;;EAEE,WAAW;EACX,UAAU;AACZ;AACA;;EAEE,OAAO;EACP,WAAW;AACb;AACA;;EAEE,QAAQ;AACV;AACA;;EAEE,SAAS;AACX;AACA;;EAEE,mCAAmC;EACnC,2BAA2B;EAC3B,kBAAkB;AACpB;AACA;;EAEE,YAAY;EACZ,WAAW;AACb;AACA;;;;EAIE,kCAAkC;EAClC,0BAA0B;AAC5B;AACA;;EAEE,0BAA0B;AAC5B;AACA;;EAEE,YAAY;AACd;AACA;;EAEE,WAAW;EACX,YAAY;EACZ,YAAY;EACZ,SAAS;AACX;AACA;;EAEE,WAAW;AACb;AACA;;EAEE,WAAW;EACX,YAAY;EACZ,WAAW;EACX,UAAU;AACZ;AACA;;EAEE,WAAW;EACX,WAAW;AACb;AACA;;EAEE,mBAAmB;EACnB,kBAAkB;EAClB,yBAAyB;EACzB,wDAAwD;AAC1D;AACA;;EAEE,kBAAkB;AACpB;AACA;;EAEE,mBAAmB;AACrB;AACA;;EAEE,iBAAiB;AACnB;AACA;;EAEE,iBAAiB;AACnB;AACA;;EAEE,yBAAyB;EACzB,kBAAkB;EAClB,gBAAgB;EAChB,eAAe;EACf,4EAA4E;AAC9E;AACA;;EAEE,yEAAyE;AAC3E;AACA;;;;EAIE,WAAW;EACX,cAAc;EACd,kBAAkB;EAClB,YAAY;EACZ,UAAU;EACV,mBAAmB;EACnB,UAAU;EACV,QAAQ;AACV;AACA;;EAEE,UAAU;AACZ;AACA;;;;EAIE,WAAW;EACX,WAAW;EACX,SAAS;EACT,SAAS;AACX;AACA;;EAEE,SAAS;AACX;AACA;;EAEE,mBAAmB;AACrB;AACA;;;;;;EAME,mBAAmB;AACrB;AACA;;;;EAIE,2BAA2B;EAC3B,sBAAsB;AACxB;AACA;;EAEE,kBAAkB;EAClB,WAAW;AACb;AACA;;EAEE,kBAAkB;EAClB,mBAAmB;EACnB,kBAAkB;AACpB;AACA;;EAEE,WAAW;EACX,eAAe;AACjB;AACA;;EAEE,kBAAkB;EAClB,gBAAgB;AAClB;AACA;;EAEE,gBAAgB;AAClB;AACA;;EAEE,gBAAgB;AAClB;AACA;;EAEE,eAAe;EACf,YAAY;EACZ,SAAS;EACT,OAAO;EACP,WAAW;AACb;AACA;;EAEE,uCAAuC;EACvC,+BAA+B;AACjC;AACA;;EAEE,sCAAsC;EACtC,8BAA8B;AAChC;AACA;;EAEE,iBAAiB;EACjB,UAAU;EACV,WAAW;AACb;AACA;;EAEE,YAAY;AACd;AACA;;EAEE,YAAY;AACd;AACA;;EAEE,eAAe;EACf,YAAY;EACZ,MAAM;EACN,UAAU;AACZ;AACA;;EAEE,qCAAqC;EACrC,6BAA6B;EAC7B,kBAAkB;AACpB;AACA;;EAEE,oCAAoC;EACpC,4BAA4B;AAC9B;AACA;;EAEE,UAAU;EACV,WAAW;EACX,gBAAgB;AAClB;AACA;;EAEE,WAAW;AACb;AACA;;EAEE,WAAW;AACb;AACA;;EAEE,cAAc;EACd,kBAAkB;EAClB,yBAAyB;EACzB,kBAAkB;EAClB,gBAAgB;EAChB,WAAW;EACX,YAAY;EACZ,kBAAkB;EAClB,mBAAmB;AACrB;AACA;;EAEE,qCAAqC;EACrC,6BAA6B;EAC7B,SAAS;EACT,YAAY;AACd;AACA;;EAEE,qCAAqC;EACrC,6BAA6B;EAC7B,QAAQ;EACR,WAAW;AACb;AACA;;EAEE,oCAAoC;EACpC,4BAA4B;EAC5B,UAAU;EACV,YAAY;AACd;AACA;;EAEE,sCAAsC;EACtC,8BAA8B;EAC9B,SAAS;EACT,WAAW;AACb;AACA;;EAEE,mBAAmB;AACrB;AACA;;EAEE,gDAAgD;AAClD;AACA;;EAEE,+CAA+C;EAC/C,YAAY;AACd;AACA;;EAEE,2CAA2C;EAC3C,4CAA4C;EAC5C,kBAAkB;EAClB,gGAAgG;EAChG,sDAAsD;AACxD;AACA;;EAEE,4CAA4C;EAC5C,2CAA2C;EAC3C,kBAAkB;EAClB,mGAAmG;EACnG,oDAAoD;AACtD;AACA;;EAEE,aAAa;AACf;AACA;;EAEE,aAAa;AACf;AACA;;EAEE,mBAAmB;EACnB,kBAAkB;EAClB,WAAW;EACX,8DAA8D;AAChE;AACA;;EAEE,2EAA2E;EAC3E,mCAAmC;EACnC,sBAAsB;EACtB,kBAAkB;EAClB,kBAAkB;AACpB;AACA;;EAEE,2CAA2C;EAC3C,yBAAyB;EACzB,kBAAkB;EAClB,gBAAgB;EAChB,eAAe;EACf,gBAAgB;EAChB,aAAa;AACf;AACA;;;;EAIE,8DAA8D;EAC9D,gGAAgG;AAClG;AACA;;EAEE,aAAa;AACf;AACA;;EAEE,iBAAiB;EACjB,UAAU;EACV,mCAAmC;AACrC;AACA;;EAEE,uBAAuB;EACvB,WAAW;AACb;AACA;;EAEE,wBAAwB;EACxB,SAAS;AACX\",\"sourcesContent\":[\"/*\\n\\nThe nouislider.css file is autogenerated from nouislider.less, which imports and wraps the nouislider/src/nouislider.less styles.\\n\\nMIT License\\n\\nCopyright (c) 2019 Léon Gersen\\n\\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \\\"Software\\\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\\n\\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\\n\\nTHE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\\n*/\\n/* The .widget-slider class is deprecated */\\n.widget-slider,\\n.jupyter-widget-slider {\\n /* Functional styling;\\n * These styles are required for noUiSlider to function.\\n * You don't need to change these rules to apply your design.\\n */\\n /* Wrapper for all connect elements.\\n */\\n /* Offset direction\\n */\\n /* Give origins 0 height/width so they don't interfere with clicking the\\n * connect elements.\\n */\\n /* Slider size and handle placement;\\n */\\n /* Styling;\\n * Giving the connect element a border radius causes issues with using transform: scale\\n */\\n /* Handles and cursors;\\n */\\n /* Handle stripes;\\n */\\n /* Disabled state;\\n */\\n /* Base;\\n *\\n */\\n /* Values;\\n *\\n */\\n /* Markings;\\n *\\n */\\n /* Horizontal layout;\\n *\\n */\\n /* Vertical layout;\\n *\\n */\\n /* Copyright (c) Jupyter Development Team.\\n * Distributed under the terms of the Modified BSD License.\\n */\\n /* Custom CSS for nouislider */\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target,\\n.widget-slider .noUi-target *,\\n.jupyter-widget-slider .noUi-target * {\\n -webkit-touch-callout: none;\\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\\n -webkit-user-select: none;\\n -ms-touch-action: none;\\n touch-action: none;\\n -ms-user-select: none;\\n -moz-user-select: none;\\n user-select: none;\\n -moz-box-sizing: border-box;\\n box-sizing: border-box;\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target {\\n position: relative;\\n}\\n.widget-slider .noUi-base,\\n.jupyter-widget-slider .noUi-base,\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n width: 100%;\\n height: 100%;\\n position: relative;\\n z-index: 1;\\n}\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n overflow: hidden;\\n z-index: 0;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect,\\n.widget-slider .noUi-origin,\\n.jupyter-widget-slider .noUi-origin {\\n will-change: transform;\\n position: absolute;\\n z-index: 1;\\n top: 0;\\n right: 0;\\n -ms-transform-origin: 0 0;\\n -webkit-transform-origin: 0 0;\\n -webkit-transform-style: preserve-3d;\\n transform-origin: 0 0;\\n transform-style: flat;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect {\\n height: 100%;\\n width: 100%;\\n}\\n.widget-slider .noUi-origin,\\n.jupyter-widget-slider .noUi-origin {\\n height: 10%;\\n width: 10%;\\n}\\n.widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-origin,\\n.jupyter-widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-origin {\\n left: 0;\\n right: auto;\\n}\\n.widget-slider .noUi-vertical .noUi-origin,\\n.jupyter-widget-slider .noUi-vertical .noUi-origin {\\n width: 0;\\n}\\n.widget-slider .noUi-horizontal .noUi-origin,\\n.jupyter-widget-slider .noUi-horizontal .noUi-origin {\\n height: 0;\\n}\\n.widget-slider .noUi-handle,\\n.jupyter-widget-slider .noUi-handle {\\n -webkit-backface-visibility: hidden;\\n backface-visibility: hidden;\\n position: absolute;\\n}\\n.widget-slider .noUi-touch-area,\\n.jupyter-widget-slider .noUi-touch-area {\\n height: 100%;\\n width: 100%;\\n}\\n.widget-slider .noUi-state-tap .noUi-connect,\\n.jupyter-widget-slider .noUi-state-tap .noUi-connect,\\n.widget-slider .noUi-state-tap .noUi-origin,\\n.jupyter-widget-slider .noUi-state-tap .noUi-origin {\\n -webkit-transition: transform 0.3s;\\n transition: transform 0.3s;\\n}\\n.widget-slider .noUi-state-drag *,\\n.jupyter-widget-slider .noUi-state-drag * {\\n cursor: inherit !important;\\n}\\n.widget-slider .noUi-horizontal,\\n.jupyter-widget-slider .noUi-horizontal {\\n height: 18px;\\n}\\n.widget-slider .noUi-horizontal .noUi-handle,\\n.jupyter-widget-slider .noUi-horizontal .noUi-handle {\\n width: 34px;\\n height: 28px;\\n right: -17px;\\n top: -6px;\\n}\\n.widget-slider .noUi-vertical,\\n.jupyter-widget-slider .noUi-vertical {\\n width: 18px;\\n}\\n.widget-slider .noUi-vertical .noUi-handle,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle {\\n width: 28px;\\n height: 34px;\\n right: -6px;\\n top: -17px;\\n}\\n.widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-handle,\\n.jupyter-widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-handle {\\n left: -17px;\\n right: auto;\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target {\\n background: #FAFAFA;\\n border-radius: 4px;\\n border: 1px solid #D3D3D3;\\n box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB;\\n}\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n border-radius: 3px;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect {\\n background: #3FB8AF;\\n}\\n.widget-slider .noUi-draggable,\\n.jupyter-widget-slider .noUi-draggable {\\n cursor: ew-resize;\\n}\\n.widget-slider .noUi-vertical .noUi-draggable,\\n.jupyter-widget-slider .noUi-vertical .noUi-draggable {\\n cursor: ns-resize;\\n}\\n.widget-slider .noUi-handle,\\n.jupyter-widget-slider .noUi-handle {\\n border: 1px solid #D9D9D9;\\n border-radius: 3px;\\n background: #FFF;\\n cursor: default;\\n box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #EBEBEB, 0 3px 6px -3px #BBB;\\n}\\n.widget-slider .noUi-active,\\n.jupyter-widget-slider .noUi-active {\\n box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB;\\n}\\n.widget-slider .noUi-handle:before,\\n.jupyter-widget-slider .noUi-handle:before,\\n.widget-slider .noUi-handle:after,\\n.jupyter-widget-slider .noUi-handle:after {\\n content: \\\"\\\";\\n display: block;\\n position: absolute;\\n height: 14px;\\n width: 1px;\\n background: #E8E7E6;\\n left: 14px;\\n top: 6px;\\n}\\n.widget-slider .noUi-handle:after,\\n.jupyter-widget-slider .noUi-handle:after {\\n left: 17px;\\n}\\n.widget-slider .noUi-vertical .noUi-handle:before,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle:before,\\n.widget-slider .noUi-vertical .noUi-handle:after,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle:after {\\n width: 14px;\\n height: 1px;\\n left: 6px;\\n top: 14px;\\n}\\n.widget-slider .noUi-vertical .noUi-handle:after,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle:after {\\n top: 17px;\\n}\\n.widget-slider [disabled] .noUi-connect,\\n.jupyter-widget-slider [disabled] .noUi-connect {\\n background: #B8B8B8;\\n}\\n.widget-slider [disabled].noUi-target,\\n.jupyter-widget-slider [disabled].noUi-target,\\n.widget-slider [disabled].noUi-handle,\\n.jupyter-widget-slider [disabled].noUi-handle,\\n.widget-slider [disabled] .noUi-handle,\\n.jupyter-widget-slider [disabled] .noUi-handle {\\n cursor: not-allowed;\\n}\\n.widget-slider .noUi-pips,\\n.jupyter-widget-slider .noUi-pips,\\n.widget-slider .noUi-pips *,\\n.jupyter-widget-slider .noUi-pips * {\\n -moz-box-sizing: border-box;\\n box-sizing: border-box;\\n}\\n.widget-slider .noUi-pips,\\n.jupyter-widget-slider .noUi-pips {\\n position: absolute;\\n color: #999;\\n}\\n.widget-slider .noUi-value,\\n.jupyter-widget-slider .noUi-value {\\n position: absolute;\\n white-space: nowrap;\\n text-align: center;\\n}\\n.widget-slider .noUi-value-sub,\\n.jupyter-widget-slider .noUi-value-sub {\\n color: #ccc;\\n font-size: 10px;\\n}\\n.widget-slider .noUi-marker,\\n.jupyter-widget-slider .noUi-marker {\\n position: absolute;\\n background: #CCC;\\n}\\n.widget-slider .noUi-marker-sub,\\n.jupyter-widget-slider .noUi-marker-sub {\\n background: #AAA;\\n}\\n.widget-slider .noUi-marker-large,\\n.jupyter-widget-slider .noUi-marker-large {\\n background: #AAA;\\n}\\n.widget-slider .noUi-pips-horizontal,\\n.jupyter-widget-slider .noUi-pips-horizontal {\\n padding: 10px 0;\\n height: 80px;\\n top: 100%;\\n left: 0;\\n width: 100%;\\n}\\n.widget-slider .noUi-value-horizontal,\\n.jupyter-widget-slider .noUi-value-horizontal {\\n -webkit-transform: translate(-50%, 50%);\\n transform: translate(-50%, 50%);\\n}\\n.noUi-rtl .widget-slider .noUi-value-horizontal,\\n.noUi-rtl .jupyter-widget-slider .noUi-value-horizontal {\\n -webkit-transform: translate(50%, 50%);\\n transform: translate(50%, 50%);\\n}\\n.widget-slider .noUi-marker-horizontal.noUi-marker,\\n.jupyter-widget-slider .noUi-marker-horizontal.noUi-marker {\\n margin-left: -1px;\\n width: 2px;\\n height: 5px;\\n}\\n.widget-slider .noUi-marker-horizontal.noUi-marker-sub,\\n.jupyter-widget-slider .noUi-marker-horizontal.noUi-marker-sub {\\n height: 10px;\\n}\\n.widget-slider .noUi-marker-horizontal.noUi-marker-large,\\n.jupyter-widget-slider .noUi-marker-horizontal.noUi-marker-large {\\n height: 15px;\\n}\\n.widget-slider .noUi-pips-vertical,\\n.jupyter-widget-slider .noUi-pips-vertical {\\n padding: 0 10px;\\n height: 100%;\\n top: 0;\\n left: 100%;\\n}\\n.widget-slider .noUi-value-vertical,\\n.jupyter-widget-slider .noUi-value-vertical {\\n -webkit-transform: translate(0, -50%);\\n transform: translate(0, -50%);\\n padding-left: 25px;\\n}\\n.noUi-rtl .widget-slider .noUi-value-vertical,\\n.noUi-rtl .jupyter-widget-slider .noUi-value-vertical {\\n -webkit-transform: translate(0, 50%);\\n transform: translate(0, 50%);\\n}\\n.widget-slider .noUi-marker-vertical.noUi-marker,\\n.jupyter-widget-slider .noUi-marker-vertical.noUi-marker {\\n width: 5px;\\n height: 2px;\\n margin-top: -1px;\\n}\\n.widget-slider .noUi-marker-vertical.noUi-marker-sub,\\n.jupyter-widget-slider .noUi-marker-vertical.noUi-marker-sub {\\n width: 10px;\\n}\\n.widget-slider .noUi-marker-vertical.noUi-marker-large,\\n.jupyter-widget-slider .noUi-marker-vertical.noUi-marker-large {\\n width: 15px;\\n}\\n.widget-slider .noUi-tooltip,\\n.jupyter-widget-slider .noUi-tooltip {\\n display: block;\\n position: absolute;\\n border: 1px solid #D9D9D9;\\n border-radius: 3px;\\n background: #fff;\\n color: #000;\\n padding: 5px;\\n text-align: center;\\n white-space: nowrap;\\n}\\n.widget-slider .noUi-horizontal .noUi-tooltip,\\n.jupyter-widget-slider .noUi-horizontal .noUi-tooltip {\\n -webkit-transform: translate(-50%, 0);\\n transform: translate(-50%, 0);\\n left: 50%;\\n bottom: 120%;\\n}\\n.widget-slider .noUi-vertical .noUi-tooltip,\\n.jupyter-widget-slider .noUi-vertical .noUi-tooltip {\\n -webkit-transform: translate(0, -50%);\\n transform: translate(0, -50%);\\n top: 50%;\\n right: 120%;\\n}\\n.widget-slider .noUi-horizontal .noUi-origin > .noUi-tooltip,\\n.jupyter-widget-slider .noUi-horizontal .noUi-origin > .noUi-tooltip {\\n -webkit-transform: translate(50%, 0);\\n transform: translate(50%, 0);\\n left: auto;\\n bottom: 10px;\\n}\\n.widget-slider .noUi-vertical .noUi-origin > .noUi-tooltip,\\n.jupyter-widget-slider .noUi-vertical .noUi-origin > .noUi-tooltip {\\n -webkit-transform: translate(0, -18px);\\n transform: translate(0, -18px);\\n top: auto;\\n right: 28px;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect {\\n background: #2196f3;\\n}\\n.widget-slider .noUi-horizontal,\\n.jupyter-widget-slider .noUi-horizontal {\\n height: var(--jp-widgets-slider-track-thickness);\\n}\\n.widget-slider .noUi-vertical,\\n.jupyter-widget-slider .noUi-vertical {\\n width: var(--jp-widgets-slider-track-thickness);\\n height: 100%;\\n}\\n.widget-slider .noUi-horizontal .noUi-handle,\\n.jupyter-widget-slider .noUi-horizontal .noUi-handle {\\n width: var(--jp-widgets-slider-handle-size);\\n height: var(--jp-widgets-slider-handle-size);\\n border-radius: 50%;\\n top: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-handle-size)) / 2);\\n right: calc(var(--jp-widgets-slider-handle-size) / -2);\\n}\\n.widget-slider .noUi-vertical .noUi-handle,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle {\\n height: var(--jp-widgets-slider-handle-size);\\n width: var(--jp-widgets-slider-handle-size);\\n border-radius: 50%;\\n right: calc((var(--jp-widgets-slider-handle-size) - var(--jp-widgets-slider-track-thickness)) / -2);\\n top: calc(var(--jp-widgets-slider-handle-size) / -2);\\n}\\n.widget-slider .noUi-handle:after,\\n.jupyter-widget-slider .noUi-handle:after {\\n content: none;\\n}\\n.widget-slider .noUi-handle:before,\\n.jupyter-widget-slider .noUi-handle:before {\\n content: none;\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target {\\n background: #fafafa;\\n border-radius: 4px;\\n border: 1px;\\n /* box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB; */\\n}\\n.widget-slider .ui-slider,\\n.jupyter-widget-slider .ui-slider {\\n border: var(--jp-widgets-slider-border-width) solid var(--jp-layout-color3);\\n background: var(--jp-layout-color3);\\n box-sizing: border-box;\\n position: relative;\\n border-radius: 0px;\\n}\\n.widget-slider .noUi-handle,\\n.jupyter-widget-slider .noUi-handle {\\n width: var(--jp-widgets-slider-handle-size);\\n border: 1px solid #d9d9d9;\\n border-radius: 3px;\\n background: #fff;\\n cursor: default;\\n box-shadow: none;\\n outline: none;\\n}\\n.widget-slider .noUi-target:not([disabled]) .noUi-handle:hover,\\n.jupyter-widget-slider .noUi-target:not([disabled]) .noUi-handle:hover,\\n.widget-slider .noUi-target:not([disabled]) .noUi-handle:focus,\\n.jupyter-widget-slider .noUi-target:not([disabled]) .noUi-handle:focus {\\n background-color: var(--jp-widgets-slider-active-handle-color);\\n border: var(--jp-widgets-slider-border-width) solid var(--jp-widgets-slider-active-handle-color);\\n}\\n.widget-slider [disabled].noUi-target,\\n.jupyter-widget-slider [disabled].noUi-target {\\n opacity: 0.35;\\n}\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n overflow: visible;\\n z-index: 0;\\n background: var(--jp-layout-color3);\\n}\\n.widget-slider .noUi-vertical .noUi-connect,\\n.jupyter-widget-slider .noUi-vertical .noUi-connect {\\n width: calc(100% + 2px);\\n right: -1px;\\n}\\n.widget-slider .noUi-horizontal .noUi-connect,\\n.jupyter-widget-slider .noUi-horizontal .noUi-connect {\\n height: calc(100% + 2px);\\n top: -1px;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../css-loader/dist/runtime/api.js\";\nimport ___CSS_LOADER_AT_RULE_IMPORT_0___ from \"-!../../../css-loader/dist/cjs.js!./lumino.css\";\nimport ___CSS_LOADER_AT_RULE_IMPORT_1___ from \"-!../../../css-loader/dist/cjs.js!./nouislider.css\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);\n___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_1___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* Copyright (c) Jupyter Development Team.\\n * Distributed under the terms of the Modified BSD License.\\n */\\n\\n/*\\n * We assume that the CSS variables in\\n * https://github.com/jupyterlab/jupyterlab/blob/master/src/default-theme/variables.css\\n * have been defined.\\n */\\n\\n:root {\\n --jp-widgets-color: var(--jp-content-font-color1);\\n --jp-widgets-label-color: var(--jp-widgets-color);\\n --jp-widgets-readout-color: var(--jp-widgets-color);\\n --jp-widgets-font-size: var(--jp-ui-font-size1);\\n --jp-widgets-margin: 2px;\\n --jp-widgets-inline-height: 28px;\\n --jp-widgets-inline-width: 300px;\\n --jp-widgets-inline-width-short: calc(\\n var(--jp-widgets-inline-width) / 2 - var(--jp-widgets-margin)\\n );\\n --jp-widgets-inline-width-tiny: calc(\\n var(--jp-widgets-inline-width-short) / 2 - var(--jp-widgets-margin)\\n );\\n --jp-widgets-inline-margin: 4px; /* margin between inline elements */\\n --jp-widgets-inline-label-width: 80px;\\n --jp-widgets-border-width: var(--jp-border-width);\\n --jp-widgets-vertical-height: 200px;\\n --jp-widgets-horizontal-tab-height: 24px;\\n --jp-widgets-horizontal-tab-width: 144px;\\n --jp-widgets-horizontal-tab-top-border: 2px;\\n --jp-widgets-progress-thickness: 20px;\\n --jp-widgets-container-padding: 15px;\\n --jp-widgets-input-padding: 4px;\\n --jp-widgets-radio-item-height-adjustment: 8px;\\n --jp-widgets-radio-item-height: calc(\\n var(--jp-widgets-inline-height) -\\n var(--jp-widgets-radio-item-height-adjustment)\\n );\\n --jp-widgets-slider-track-thickness: 4px;\\n --jp-widgets-slider-border-width: var(--jp-widgets-border-width);\\n --jp-widgets-slider-handle-size: 16px;\\n --jp-widgets-slider-handle-border-color: var(--jp-border-color1);\\n --jp-widgets-slider-handle-background-color: var(--jp-layout-color1);\\n --jp-widgets-slider-active-handle-color: var(--jp-brand-color1);\\n --jp-widgets-menu-item-height: 24px;\\n --jp-widgets-dropdown-arrow: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxOCAxOCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTggMTg7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDpub25lO30KPC9zdHlsZT4KPHBhdGggZD0iTTUuMiw1LjlMOSw5LjdsMy44LTMuOGwxLjIsMS4ybC00LjksNWwtNC45LTVMNS4yLDUuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTAtMC42aDE4djE4SDBWLTAuNnoiLz4KPC9zdmc+Cg');\\n --jp-widgets-input-color: var(--jp-ui-font-color1);\\n --jp-widgets-input-background-color: var(--jp-layout-color1);\\n --jp-widgets-input-border-color: var(--jp-border-color1);\\n --jp-widgets-input-focus-border-color: var(--jp-brand-color2);\\n --jp-widgets-input-border-width: var(--jp-widgets-border-width);\\n --jp-widgets-disabled-opacity: 0.6;\\n\\n /* From Material Design Lite */\\n --md-shadow-key-umbra-opacity: 0.2;\\n --md-shadow-key-penumbra-opacity: 0.14;\\n --md-shadow-ambient-shadow-opacity: 0.12;\\n}\\n\\n.jupyter-widgets {\\n margin: var(--jp-widgets-margin);\\n box-sizing: border-box;\\n color: var(--jp-widgets-color);\\n overflow: visible;\\n}\\n\\n.jp-Output-result > .jupyter-widgets {\\n margin-left: 0;\\n margin-right: 0;\\n}\\n\\n/* vbox and hbox */\\n\\n/* */\\n.widget-inline-hbox, /* */\\n .jupyter-widget-inline-hbox {\\n /* Horizontal widgets */\\n box-sizing: border-box;\\n display: flex;\\n flex-direction: row;\\n align-items: baseline;\\n}\\n\\n/* */\\n.widget-inline-vbox, /* */\\n .jupyter-widget-inline-vbox {\\n /* Vertical Widgets */\\n box-sizing: border-box;\\n display: flex;\\n flex-direction: column;\\n align-items: center;\\n}\\n\\n/* */\\n.widget-box, /* */\\n.jupyter-widget-box {\\n box-sizing: border-box;\\n display: flex;\\n margin: 0;\\n overflow: auto;\\n}\\n\\n/* */\\n.widget-gridbox, /* */\\n.jupyter-widget-gridbox {\\n box-sizing: border-box;\\n display: grid;\\n margin: 0;\\n overflow: auto;\\n}\\n\\n/* */\\n.widget-hbox, /* */\\n.jupyter-widget-hbox {\\n flex-direction: row;\\n}\\n\\n/* */\\n.widget-vbox, /* */\\n.jupyter-widget-vbox {\\n flex-direction: column;\\n}\\n\\n/* General Tags Styling */\\n\\n.jupyter-widget-tagsinput {\\n display: flex;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n overflow: auto;\\n\\n cursor: text;\\n}\\n\\n.jupyter-widget-tag {\\n padding-left: 10px;\\n padding-right: 10px;\\n padding-top: 0px;\\n padding-bottom: 0px;\\n display: inline-block;\\n white-space: nowrap;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n text-align: center;\\n font-size: var(--jp-widgets-font-size);\\n\\n height: calc(var(--jp-widgets-inline-height) - 2px);\\n border: 0px solid;\\n line-height: calc(var(--jp-widgets-inline-height) - 2px);\\n box-shadow: none;\\n\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color2);\\n border-color: var(--jp-border-color2);\\n border: none;\\n user-select: none;\\n\\n cursor: grab;\\n transition: margin-left 200ms;\\n margin: 1px 1px 1px 1px;\\n}\\n\\n.jupyter-widget-tag.mod-active {\\n /* MD Lite 4dp shadow */\\n box-shadow: 0 4px 5px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\\n 0 1px 10px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity)),\\n 0 2px 4px -1px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity));\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color3);\\n}\\n\\n.jupyter-widget-colortag {\\n color: var(--jp-inverse-ui-font-color1);\\n}\\n\\n.jupyter-widget-colortag.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n}\\n\\n.jupyter-widget-taginput {\\n color: var(--jp-ui-font-color0);\\n background-color: var(--jp-layout-color0);\\n\\n cursor: text;\\n text-align: left;\\n}\\n\\n.jupyter-widget-taginput:focus {\\n outline: none;\\n}\\n\\n.jupyter-widget-tag-close {\\n margin-left: var(--jp-widgets-inline-margin);\\n padding: 2px 0px 2px 2px;\\n}\\n\\n.jupyter-widget-tag-close:hover {\\n cursor: pointer;\\n}\\n\\n/* Tag \\\"Primary\\\" Styling */\\n\\n.jupyter-widget-tag.mod-primary {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-brand-color1);\\n}\\n\\n.jupyter-widget-tag.mod-primary.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-brand-color0);\\n}\\n\\n/* Tag \\\"Success\\\" Styling */\\n\\n.jupyter-widget-tag.mod-success {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-success-color1);\\n}\\n\\n.jupyter-widget-tag.mod-success.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-success-color0);\\n}\\n\\n/* Tag \\\"Info\\\" Styling */\\n\\n.jupyter-widget-tag.mod-info {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-info-color1);\\n}\\n\\n.jupyter-widget-tag.mod-info.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-info-color0);\\n}\\n\\n/* Tag \\\"Warning\\\" Styling */\\n\\n.jupyter-widget-tag.mod-warning {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-warn-color1);\\n}\\n\\n.jupyter-widget-tag.mod-warning.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-warn-color0);\\n}\\n\\n/* Tag \\\"Danger\\\" Styling */\\n\\n.jupyter-widget-tag.mod-danger {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-error-color1);\\n}\\n\\n.jupyter-widget-tag.mod-danger.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-error-color0);\\n}\\n\\n/* General Button Styling */\\n\\n.jupyter-button {\\n padding-left: 10px;\\n padding-right: 10px;\\n padding-top: 0px;\\n padding-bottom: 0px;\\n display: inline-block;\\n white-space: nowrap;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n text-align: center;\\n font-size: var(--jp-widgets-font-size);\\n cursor: pointer;\\n\\n height: var(--jp-widgets-inline-height);\\n border: 0px solid;\\n line-height: var(--jp-widgets-inline-height);\\n box-shadow: none;\\n\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color2);\\n border-color: var(--jp-border-color2);\\n border: none;\\n user-select: none;\\n}\\n\\n.jupyter-button i.fa {\\n margin-right: var(--jp-widgets-inline-margin);\\n pointer-events: none;\\n}\\n\\n.jupyter-button:empty:before {\\n content: '\\\\200b'; /* zero-width space */\\n}\\n\\n.jupyter-widgets.jupyter-button:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n.jupyter-button i.fa.center {\\n margin-right: 0;\\n}\\n\\n.jupyter-button:hover:enabled,\\n.jupyter-button:focus:enabled {\\n /* MD Lite 2dp shadow */\\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\\n 0 3px 1px -2px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity)),\\n 0 1px 5px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity));\\n}\\n\\n.jupyter-button:active,\\n.jupyter-button.mod-active {\\n /* MD Lite 4dp shadow */\\n box-shadow: 0 4px 5px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\\n 0 1px 10px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity)),\\n 0 2px 4px -1px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity));\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color3);\\n}\\n\\n.jupyter-button:focus:enabled {\\n outline: 1px solid var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* Button \\\"Primary\\\" Styling */\\n\\n.jupyter-button.mod-primary {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-brand-color1);\\n}\\n\\n.jupyter-button.mod-primary.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-brand-color0);\\n}\\n\\n.jupyter-button.mod-primary:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-brand-color0);\\n}\\n\\n/* Button \\\"Success\\\" Styling */\\n\\n.jupyter-button.mod-success {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-success-color1);\\n}\\n\\n.jupyter-button.mod-success.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-success-color0);\\n}\\n\\n.jupyter-button.mod-success:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-success-color0);\\n}\\n\\n/* Button \\\"Info\\\" Styling */\\n\\n.jupyter-button.mod-info {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-info-color1);\\n}\\n\\n.jupyter-button.mod-info.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-info-color0);\\n}\\n\\n.jupyter-button.mod-info:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-info-color0);\\n}\\n\\n/* Button \\\"Warning\\\" Styling */\\n\\n.jupyter-button.mod-warning {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-warn-color1);\\n}\\n\\n.jupyter-button.mod-warning.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-warn-color0);\\n}\\n\\n.jupyter-button.mod-warning:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-warn-color0);\\n}\\n\\n/* Button \\\"Danger\\\" Styling */\\n\\n.jupyter-button.mod-danger {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-error-color1);\\n}\\n\\n.jupyter-button.mod-danger.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-error-color0);\\n}\\n\\n.jupyter-button.mod-danger:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-error-color0);\\n}\\n\\n/* Widget Button, Widget Toggle Button, Widget Upload */\\n\\n/* */\\n.widget-button, /* */\\n/* */ .widget-toggle-button, /* */\\n/* */ .widget-upload, /* */\\n.jupyter-widget-button,\\n.jupyter-widget-toggle-button,\\n.jupyter-widget-upload {\\n width: var(--jp-widgets-inline-width-short);\\n}\\n\\n/* Widget Label Styling */\\n\\n/* Override Bootstrap label css */\\n.jupyter-widgets label {\\n margin-bottom: initial;\\n}\\n\\n/* */\\n.widget-label-basic, /* */\\n.jupyter-widget-label-basic {\\n /* Basic Label */\\n color: var(--jp-widgets-label-color);\\n font-size: var(--jp-widgets-font-size);\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-label, /* */\\n.jupyter-widget-label {\\n /* Label */\\n color: var(--jp-widgets-label-color);\\n font-size: var(--jp-widgets-font-size);\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-inline-hbox .widget-label, /* */\\n.jupyter-widget-inline-hbox .jupyter-widget-label {\\n /* Horizontal Widget Label */\\n color: var(--jp-widgets-label-color);\\n text-align: right;\\n margin-right: calc(var(--jp-widgets-inline-margin) * 2);\\n width: var(--jp-widgets-inline-label-width);\\n flex-shrink: 0;\\n}\\n\\n/* */\\n.widget-inline-vbox .widget-label, /* */\\n.jupyter-widget-inline-vbox .jupyter-widget-label {\\n /* Vertical Widget Label */\\n color: var(--jp-widgets-label-color);\\n text-align: center;\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* Widget Readout Styling */\\n\\n/* */\\n.widget-readout, /* */\\n.jupyter-widget-readout {\\n color: var(--jp-widgets-readout-color);\\n font-size: var(--jp-widgets-font-size);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n overflow: hidden;\\n white-space: nowrap;\\n text-align: center;\\n}\\n\\n/* */\\n.widget-readout.overflow, /* */\\n.jupyter-widget-readout.overflow {\\n /* Overflowing Readout */\\n\\n /* From Material Design Lite\\n shadow-key-umbra-opacity: 0.2;\\n shadow-key-penumbra-opacity: 0.14;\\n shadow-ambient-shadow-opacity: 0.12;\\n */\\n -webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\\n 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n\\n -moz-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\\n 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n\\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2), 0 3px 1px -2px rgba(0, 0, 0, 0.14),\\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n}\\n\\n/* */\\n.widget-inline-hbox .widget-readout, /* */\\n.jupyter-widget-inline-hbox .jupyter-widget-readout {\\n /* Horizontal Readout */\\n text-align: center;\\n max-width: var(--jp-widgets-inline-width-short);\\n min-width: var(--jp-widgets-inline-width-tiny);\\n margin-left: var(--jp-widgets-inline-margin);\\n}\\n\\n/* */\\n.widget-inline-vbox .widget-readout, /* */\\n.jupyter-widget-inline-vbox .jupyter-widget-readout {\\n /* Vertical Readout */\\n margin-top: var(--jp-widgets-inline-margin);\\n /* as wide as the widget */\\n width: inherit;\\n}\\n\\n/* Widget Checkbox Styling */\\n\\n/* */\\n.widget-checkbox, /* */\\n.jupyter-widget-checkbox {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-checkbox input[type='checkbox'], /* */\\n.jupyter-widget-checkbox input[type='checkbox'] {\\n margin: 0px calc(var(--jp-widgets-inline-margin) * 2) 0px 0px;\\n line-height: var(--jp-widgets-inline-height);\\n font-size: large;\\n flex-grow: 1;\\n flex-shrink: 0;\\n align-self: center;\\n}\\n\\n/* Widget Valid Styling */\\n\\n/* */\\n.widget-valid, /* */\\n.jupyter-widget-valid {\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n width: var(--jp-widgets-inline-width-short);\\n font-size: var(--jp-widgets-font-size);\\n}\\n\\n/* */\\n.widget-valid i, /* */\\n.jupyter-widget-valid i {\\n line-height: var(--jp-widgets-inline-height);\\n margin-right: var(--jp-widgets-inline-margin);\\n margin-left: var(--jp-widgets-inline-margin);\\n}\\n\\n/* */\\n.widget-valid.mod-valid i, /* */\\n.jupyter-widget-valid.mod-valid i {\\n color: green;\\n}\\n\\n/* */\\n.widget-valid.mod-invalid i, /* */\\n.jupyter-widget-valid.mod-invalid i {\\n color: red;\\n}\\n\\n/* */\\n.widget-valid.mod-valid .widget-valid-readout, /* */\\n.jupyter-widget-valid.mod-valid .jupyter-widget-valid-readout {\\n display: none;\\n}\\n\\n/* Widget Text and TextArea Styling */\\n\\n/* */\\n.widget-textarea, /* */\\n/* */ .widget-text, /* */\\n.jupyter-widget-textarea,\\n.jupyter-widget-text {\\n width: var(--jp-widgets-inline-width);\\n}\\n\\n/* */\\n.widget-text input[type='text'], /* */\\n/* */ .widget-text input[type='number'], /* */\\n/* */ .widget-text input[type='password'], /* */\\n.jupyter-widget-text input[type='text'],\\n.jupyter-widget-text input[type='number'],\\n.jupyter-widget-text input[type='password'] {\\n height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-text input[type='text']:disabled, /* */\\n/* */ .widget-text input[type='number']:disabled, /* */\\n/* */ .widget-text input[type='password']:disabled, /* */\\n/* */ .widget-textarea textarea:disabled, /* */\\n.jupyter-widget-text input[type='text']:disabled,\\n.jupyter-widget-text input[type='number']:disabled,\\n.jupyter-widget-text input[type='password']:disabled,\\n.jupyter-widget-textarea textarea:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* */\\n.widget-text input[type='text'], /* */\\n/* */ .widget-text input[type='number'], /* */\\n/* */ .widget-text input[type='password'], /* */\\n/* */ .widget-textarea textarea, /* */\\n.jupyter-widget-text input[type='text'],\\n.jupyter-widget-text input[type='number'],\\n.jupyter-widget-text input[type='password'],\\n.jupyter-widget-textarea textarea {\\n box-sizing: border-box;\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n flex-grow: 1;\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n flex-shrink: 1;\\n outline: none !important;\\n}\\n\\n/* */\\n.widget-text input[type='text'], /* */\\n/* */ .widget-text input[type='password'], /* */\\n/* */ .widget-textarea textarea, /* */\\n.jupyter-widget-text input[type='text'],\\n.jupyter-widget-text input[type='password'],\\n.jupyter-widget-textarea textarea {\\n padding: var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n}\\n\\n/* */\\n.widget-text input[type='number'], /* */\\n.jupyter-widget-text input[type='number'] {\\n padding: var(--jp-widgets-input-padding) 0 var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n}\\n\\n/* */\\n.widget-textarea textarea, /* */\\n.jupyter-widget-textarea textarea {\\n height: inherit;\\n width: inherit;\\n}\\n\\n/* */\\n.widget-text input:focus, /* */\\n/* */ .widget-textarea textarea:focus, /* */\\n.jupyter-widget-text input:focus,\\n.jupyter-widget-textarea textarea:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* Horizontal Slider */\\n/* */\\n.widget-hslider, /* */\\n.jupyter-widget-hslider {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n\\n /* Override the align-items baseline. This way, the description and readout\\n still seem to align their baseline properly, and we don't have to have\\n align-self: stretch in the .slider-container. */\\n align-items: center;\\n}\\n\\n/* */\\n.widgets-slider .slider-container, /* */\\n.jupyter-widgets-slider .slider-container {\\n overflow: visible;\\n}\\n\\n/* */\\n.widget-hslider .slider-container, /* */\\n.jupyter-widget-hslider .slider-container {\\n margin-left: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n margin-right: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n}\\n\\n/* Vertical Slider */\\n\\n/* */\\n.widget-vbox .widget-label, /* */\\n.jupyter-widget-vbox .jupyter-widget-label {\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-vslider, /* */\\n.jupyter-widget-vslider {\\n /* Vertical Slider */\\n height: var(--jp-widgets-vertical-height);\\n width: var(--jp-widgets-inline-width-tiny);\\n}\\n\\n/* */\\n.widget-vslider .slider-container, /* */\\n.jupyter-widget-vslider .slider-container {\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n margin-left: auto;\\n margin-right: auto;\\n margin-bottom: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n margin-top: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n display: flex;\\n flex-direction: column;\\n}\\n\\n/* Widget Progress Styling */\\n\\n.progress-bar {\\n -webkit-transition: none;\\n -moz-transition: none;\\n -ms-transition: none;\\n -o-transition: none;\\n transition: none;\\n}\\n\\n.progress-bar {\\n height: var(--jp-widgets-inline-height);\\n}\\n\\n.progress-bar {\\n background-color: var(--jp-brand-color1);\\n}\\n\\n.progress-bar-success {\\n background-color: var(--jp-success-color1);\\n}\\n\\n.progress-bar-info {\\n background-color: var(--jp-info-color1);\\n}\\n\\n.progress-bar-warning {\\n background-color: var(--jp-warn-color1);\\n}\\n\\n.progress-bar-danger {\\n background-color: var(--jp-error-color1);\\n}\\n\\n.progress {\\n background-color: var(--jp-layout-color2);\\n border: none;\\n box-shadow: none;\\n}\\n\\n/* Horisontal Progress */\\n\\n/* */\\n.widget-hprogress, /* */\\n.jupyter-widget-hprogress {\\n /* Progress Bar */\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n width: var(--jp-widgets-inline-width);\\n align-items: center;\\n}\\n\\n/* */\\n.widget-hprogress .progress, /* */\\n.jupyter-widget-hprogress .progress {\\n flex-grow: 1;\\n margin-top: var(--jp-widgets-input-padding);\\n margin-bottom: var(--jp-widgets-input-padding);\\n align-self: stretch;\\n /* Override bootstrap style */\\n height: initial;\\n}\\n\\n/* Vertical Progress */\\n\\n/* */\\n.widget-vprogress, /* */\\n.jupyter-widget-vprogress {\\n height: var(--jp-widgets-vertical-height);\\n width: var(--jp-widgets-inline-width-tiny);\\n}\\n\\n/* */\\n.widget-vprogress .progress, /* */\\n.jupyter-widget-vprogress .progress {\\n flex-grow: 1;\\n width: var(--jp-widgets-progress-thickness);\\n margin-left: auto;\\n margin-right: auto;\\n margin-bottom: 0;\\n}\\n\\n/* Select Widget Styling */\\n\\n/* */\\n.widget-dropdown, /* */\\n.jupyter-widget-dropdown {\\n height: var(--jp-widgets-inline-height);\\n width: var(--jp-widgets-inline-width);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-dropdown > select, /* */\\n.jupyter-widget-dropdown > select {\\n padding-right: 20px;\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n border-radius: 0;\\n height: inherit;\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n box-sizing: border-box;\\n outline: none !important;\\n box-shadow: none;\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n vertical-align: top;\\n padding-left: calc(var(--jp-widgets-input-padding) * 2);\\n appearance: none;\\n -webkit-appearance: none;\\n -moz-appearance: none;\\n background-repeat: no-repeat;\\n background-size: 20px;\\n background-position: right center;\\n background-image: var(--jp-widgets-dropdown-arrow);\\n}\\n/* */\\n.widget-dropdown > select:focus, /* */\\n.jupyter-widget-dropdown > select:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* */\\n.widget-dropdown > select:disabled, /* */\\n.jupyter-widget-dropdown > select:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* To disable the dotted border in Firefox around select controls.\\n See http://stackoverflow.com/a/18853002 */\\n/* */\\n.widget-dropdown > select:-moz-focusring, /* */\\n.jupyter-widget-dropdown > select:-moz-focusring {\\n color: transparent;\\n text-shadow: 0 0 0 #000;\\n}\\n\\n/* Select and SelectMultiple */\\n\\n/* */\\n.widget-select, /* */\\n.jupyter-widget-select {\\n width: var(--jp-widgets-inline-width);\\n line-height: var(--jp-widgets-inline-height);\\n\\n /* Because Firefox defines the baseline of a select as the bottom of the\\n control, we align the entire control to the top and add padding to the\\n select to get an approximate first line baseline alignment. */\\n align-items: flex-start;\\n}\\n\\n/* */\\n.widget-select > select, /* */\\n.jupyter-widget-select > select {\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n outline: none !important;\\n overflow: auto;\\n height: inherit;\\n\\n /* Because Firefox defines the baseline of a select as the bottom of the\\n control, we align the entire control to the top and add padding to the\\n select to get an approximate first line baseline alignment. */\\n padding-top: 5px;\\n}\\n\\n/* */\\n.widget-select > select:focus, /* */\\n.jupyter-widget-select > select:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n.wiget-select > select > option,\\n.jupyter-wiget-select > select > option {\\n padding-left: var(--jp-widgets-input-padding);\\n line-height: var(--jp-widgets-inline-height);\\n /* line-height doesn't work on some browsers for select options */\\n padding-top: calc(\\n var(--jp-widgets-inline-height) - var(--jp-widgets-font-size) / 2\\n );\\n padding-bottom: calc(\\n var(--jp-widgets-inline-height) - var(--jp-widgets-font-size) / 2\\n );\\n}\\n\\n/* Toggle Buttons Styling */\\n\\n/* */\\n.widget-toggle-buttons, /* */\\n.jupyter-widget-toggle-buttons {\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-toggle-buttons .widget-toggle-button, /* */\\n.jupyter-widget-toggle-buttons .jupyter-widget-toggle-button {\\n margin-left: var(--jp-widgets-margin);\\n margin-right: var(--jp-widgets-margin);\\n}\\n\\n/* */\\n.widget-toggle-buttons .jupyter-button:disabled, /* */\\n.jupyter-widget-toggle-buttons .jupyter-button:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Radio Buttons Styling */\\n\\n/* */\\n.widget-radio, /* */\\n.jupyter-widget-radio {\\n width: var(--jp-widgets-inline-width);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-radio-box, /* */\\n.jupyter-widget-radio-box {\\n display: flex;\\n flex-direction: column;\\n align-items: stretch;\\n box-sizing: border-box;\\n flex-grow: 1;\\n margin-bottom: var(--jp-widgets-radio-item-height-adjustment);\\n}\\n\\n/* */\\n.widget-radio-box label, /* */\\n.jupyter-widget-radio-box label {\\n height: var(--jp-widgets-radio-item-height);\\n line-height: var(--jp-widgets-radio-item-height);\\n font-size: var(--jp-widgets-font-size);\\n}\\n\\n/* */\\n.widget-radio-box input, /* */\\n.jupyter-widget-radio-box input {\\n height: var(--jp-widgets-radio-item-height);\\n line-height: var(--jp-widgets-radio-item-height);\\n margin: 0 calc(var(--jp-widgets-input-padding) * 2) 0 1px;\\n float: left;\\n}\\n\\n/* Color Picker Styling */\\n\\n/* */\\n.widget-colorpicker, /* */\\n.jupyter-widget-colorpicker {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-colorpicker > .widget-colorpicker-input, /* */\\n.jupyter-widget-colorpicker > .jupyter-widget-colorpicker-input {\\n flex-grow: 1;\\n flex-shrink: 1;\\n min-width: var(--jp-widgets-inline-width-tiny);\\n}\\n\\n/* */\\n.widget-colorpicker input[type='color'], /* */\\n.jupyter-widget-colorpicker input[type='color'] {\\n width: var(--jp-widgets-inline-height);\\n height: var(--jp-widgets-inline-height);\\n padding: 0 2px; /* make the color square actually square on Chrome on OS X */\\n background: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n border-left: none;\\n flex-grow: 0;\\n flex-shrink: 0;\\n box-sizing: border-box;\\n align-self: stretch;\\n outline: none !important;\\n}\\n\\n/* */\\n.widget-colorpicker.concise input[type='color'], /* */\\n.jupyter-widget-colorpicker.concise input[type='color'] {\\n border-left: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n}\\n\\n/* */\\n.widget-colorpicker input[type='color']:focus, /* */\\n/* */ .widget-colorpicker input[type='text']:focus, /* */\\n.jupyter-widget-colorpicker input[type='color']:focus,\\n.jupyter-widget-colorpicker input[type='text']:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* */\\n.widget-colorpicker input[type='text'], /* */\\n.jupyter-widget-colorpicker input[type='text'] {\\n flex-grow: 1;\\n outline: none !important;\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n background: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n font-size: var(--jp-widgets-font-size);\\n padding: var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n flex-shrink: 1;\\n box-sizing: border-box;\\n}\\n\\n/* */\\n.widget-colorpicker input[type='text']:disabled, /* */\\n.jupyter-widget-colorpicker input[type='text']:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Date Picker Styling */\\n\\n/* */\\n.widget-datepicker, /* */\\n.jupyter-widget-datepicker {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-datepicker input[type='date'], /* */\\n.jupyter-widget-datepicker input[type='date'] {\\n flex-grow: 1;\\n flex-shrink: 1;\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n outline: none !important;\\n height: var(--jp-widgets-inline-height);\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n padding: var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n box-sizing: border-box;\\n}\\n\\n/* */\\n.widget-datepicker input[type='date']:focus, /* */\\n.jupyter-widget-datepicker input[type='date']:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* */\\n.widget-datepicker input[type='date']:invalid, /* */\\n.jupyter-widget-datepicker input[type='date']:invalid {\\n border-color: var(--jp-warn-color1);\\n}\\n\\n/* */\\n.widget-datepicker input[type='date']:disabled, /* */\\n.jupyter-widget-datepicker input[type='date']:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Play Widget */\\n\\n/* */\\n.widget-play, /* */\\n.jupyter-widget-play {\\n width: var(--jp-widgets-inline-width-short);\\n display: flex;\\n align-items: stretch;\\n}\\n\\n/* */\\n.widget-play .jupyter-button, /* */\\n.jupyter-widget-play .jupyter-button {\\n flex-grow: 1;\\n height: auto;\\n}\\n\\n/* */\\n.widget-play .jupyter-button:disabled, /* */\\n.jupyter-widget-play .jupyter-button:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Tab Widget */\\n\\n/* */\\n.jupyter-widgets.widget-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab {\\n display: flex;\\n flex-direction: column;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar {\\n /* Necessary so that a tab can be shifted down to overlay the border of the box below. */\\n overflow-x: visible;\\n overflow-y: visible;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar > .lm-TabBar-content {\\n /* Make sure that the tab grows from bottom up */\\n align-items: flex-end;\\n min-width: 0;\\n min-height: 0;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .widget-tab-contents, /* */\\n.jupyter-widgets.jupyter-widget-tab > .widget-tab-contents {\\n width: 100%;\\n box-sizing: border-box;\\n margin: 0;\\n background: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n border: var(--jp-border-width) solid var(--jp-border-color1);\\n padding: var(--jp-widgets-container-padding);\\n flex-grow: 1;\\n overflow: auto;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar {\\n font: var(--jp-widgets-font-size) Helvetica, Arial, sans-serif;\\n min-height: calc(\\n var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width)\\n );\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab {\\n flex: 0 1 var(--jp-widgets-horizontal-tab-width);\\n min-width: 35px;\\n min-height: calc(\\n var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width)\\n );\\n line-height: var(--jp-widgets-horizontal-tab-height);\\n margin-left: calc(-1 * var(--jp-border-width));\\n padding: 0px 10px;\\n background: var(--jp-layout-color2);\\n color: var(--jp-ui-font-color2);\\n border: var(--jp-border-width) solid var(--jp-border-color1);\\n border-bottom: none;\\n position: relative;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab.lm-mod-current {\\n color: var(--jp-ui-font-color0);\\n /* We want the background to match the tab content background */\\n background: var(--jp-layout-color1);\\n min-height: calc(\\n var(--jp-widgets-horizontal-tab-height) + 2 * var(--jp-border-width)\\n );\\n transform: translateY(var(--jp-border-width));\\n overflow: visible;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current:before, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current:before, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab.lm-mod-current:before {\\n position: absolute;\\n top: calc(-1 * var(--jp-border-width));\\n left: calc(-1 * var(--jp-border-width));\\n content: '';\\n height: var(--jp-widgets-horizontal-tab-top-border);\\n width: calc(100% + 2 * var(--jp-border-width));\\n background: var(--jp-brand-color1);\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab:first-child, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab:first-child, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab:first-child {\\n margin-left: 0;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar\\n .p-TabBar-tab:hover:not(.p-mod-current),\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .p-TabBar\\n .p-TabBar-tab:hover:not(.p-mod-current),\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar\\n .lm-TabBar-tab:hover:not(.lm-mod-current) {\\n background: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar\\n .p-mod-closable\\n > .p-TabBar-tabCloseIcon,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar\\n.p-mod-closable\\n> .p-TabBar-tabCloseIcon,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar\\n .lm-mod-closable\\n > .lm-TabBar-tabCloseIcon {\\n margin-left: 4px;\\n}\\n\\n/* This font-awesome strategy may not work across FA4 and FA5, but we don't\\nactually support closable tabs, so it really doesn't matter */\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar\\n .p-mod-closable\\n > .p-TabBar-tabCloseIcon:before,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-widget-tab\\n> .p-TabBar\\n.p-mod-closable\\n> .p-TabBar-tabCloseIcon:before,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar\\n .lm-mod-closable\\n > .lm-TabBar-tabCloseIcon:before {\\n font-family: FontAwesome;\\n content: '\\\\f00d'; /* close */\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n/* */ .jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabIcon,\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabLabel,\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabCloseIcon {\\n line-height: var(--jp-widgets-horizontal-tab-height);\\n}\\n\\n/* Accordion Widget */\\n\\n.jupyter-widget-Collapse {\\n display: flex;\\n flex-direction: column;\\n align-items: stretch;\\n}\\n\\n.jupyter-widget-Collapse-header {\\n padding: var(--jp-widgets-input-padding);\\n cursor: pointer;\\n color: var(--jp-ui-font-color2);\\n background-color: var(--jp-layout-color2);\\n border: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n padding: calc(var(--jp-widgets-container-padding) * 2 / 3)\\n var(--jp-widgets-container-padding);\\n font-weight: bold;\\n}\\n\\n.jupyter-widget-Collapse-header:hover {\\n background-color: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n}\\n\\n.jupyter-widget-Collapse-open > .jupyter-widget-Collapse-header {\\n background-color: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color0);\\n cursor: default;\\n border-bottom: none;\\n}\\n\\n.jupyter-widget-Collapse-contents {\\n padding: var(--jp-widgets-container-padding);\\n background-color: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n border-left: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n border-right: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n border-bottom: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n overflow: auto;\\n}\\n\\n.jupyter-widget-Accordion {\\n display: flex;\\n flex-direction: column;\\n align-items: stretch;\\n}\\n\\n.jupyter-widget-Accordion .jupyter-widget-Collapse {\\n margin-bottom: 0;\\n}\\n\\n.jupyter-widget-Accordion .jupyter-widget-Collapse + .jupyter-widget-Collapse {\\n margin-top: 4px;\\n}\\n\\n/* HTML widget */\\n\\n/* */\\n.widget-html, /* */\\n/* */ .widget-htmlmath, /* */\\n.jupyter-widget-html,\\n.jupyter-widget-htmlmath {\\n font-size: var(--jp-widgets-font-size);\\n}\\n\\n/* */\\n.widget-html > .widget-html-content, /* */\\n/* */.widget-htmlmath > .widget-html-content, /* */\\n.jupyter-widget-html > .jupyter-widget-html-content,\\n.jupyter-widget-htmlmath > .jupyter-widget-html-content {\\n /* Fill out the area in the HTML widget */\\n align-self: stretch;\\n flex-grow: 1;\\n flex-shrink: 1;\\n /* Makes sure the baseline is still aligned with other elements */\\n line-height: var(--jp-widgets-inline-height);\\n /* Make it possible to have absolutely-positioned elements in the html */\\n position: relative;\\n}\\n\\n/* Image widget */\\n\\n/* */\\n.widget-image, /* */\\n.jupyter-widget-image {\\n max-width: 100%;\\n height: auto;\\n}\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./node_modules/@jupyter-widgets/controls/css/widgets-base.css\"],\"names\":[],\"mappings\":\"AAAA;;EAEE;;AAEF;;;;EAIE;;AAKF;EACE,iDAAiD;EACjD,iDAAiD;EACjD,mDAAmD;EACnD,+CAA+C;EAC/C,wBAAwB;EACxB,gCAAgC;EAChC,gCAAgC;EAChC;;GAEC;EACD;;GAEC;EACD,+BAA+B,EAAE,mCAAmC;EACpE,qCAAqC;EACrC,iDAAiD;EACjD,mCAAmC;EACnC,wCAAwC;EACxC,wCAAwC;EACxC,2CAA2C;EAC3C,qCAAqC;EACrC,oCAAoC;EACpC,+BAA+B;EAC/B,8CAA8C;EAC9C;;;GAGC;EACD,wCAAwC;EACxC,gEAAgE;EAChE,qCAAqC;EACrC,gEAAgE;EAChE,oEAAoE;EACpE,+DAA+D;EAC/D,mCAAmC;EACnC,4uBAA4uB;EAC5uB,kDAAkD;EAClD,4DAA4D;EAC5D,wDAAwD;EACxD,6DAA6D;EAC7D,+DAA+D;EAC/D,kCAAkC;;EAElC,8BAA8B;EAC9B,kCAAkC;EAClC,sCAAsC;EACtC,wCAAwC;AAC1C;;AAEA;EACE,gCAAgC;EAChC,sBAAsB;EACtB,8BAA8B;EAC9B,iBAAiB;AACnB;;AAEA;EACE,cAAc;EACd,eAAe;AACjB;;AAEA,kBAAkB;;AAElB,iBAAiB;AACjB;;EAEE,uBAAuB;EACvB,sBAAsB;EACtB,aAAa;EACb,mBAAmB;EACnB,qBAAqB;AACvB;;AAEA,iBAAiB;AACjB;;EAEE,qBAAqB;EACrB,sBAAsB;EACtB,aAAa;EACb,sBAAsB;EACtB,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;EAEE,sBAAsB;EACtB,aAAa;EACb,SAAS;EACT,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;EAEE,sBAAsB;EACtB,aAAa;EACb,SAAS;EACT,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;EAEE,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;EAEE,sBAAsB;AACxB;;AAEA,yBAAyB;;AAEzB;EACE,aAAa;EACb,mBAAmB;EACnB,eAAe;EACf,mBAAmB;EACnB,cAAc;;EAEd,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,mBAAmB;EACnB,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,mBAAmB;EACnB,gBAAgB;EAChB,uBAAuB;EACvB,kBAAkB;EAClB,sCAAsC;;EAEtC,mDAAmD;EACnD,iBAAiB;EACjB,wDAAwD;EACxD,gBAAgB;;EAEhB,+BAA+B;EAC/B,yCAAyC;EACzC,qCAAqC;EACrC,YAAY;EACZ,iBAAiB;;EAEjB,YAAY;EACZ,6BAA6B;EAC7B,uBAAuB;AACzB;;AAEA;EACE,uBAAuB;EACvB;;oEAEkE;EAClE,+BAA+B;EAC/B,yCAAyC;AAC3C;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,+BAA+B;EAC/B,yCAAyC;;EAEzC,YAAY;EACZ,gBAAgB;AAClB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,4CAA4C;EAC5C,wBAAwB;AAC1B;;AAEA;EACE,eAAe;AACjB;;AAEA,0BAA0B;;AAE1B;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA,0BAA0B;;AAE1B;EACE,uCAAuC;EACvC,0CAA0C;AAC5C;;AAEA;EACE,uCAAuC;EACvC,0CAA0C;AAC5C;;AAEA,uBAAuB;;AAEvB;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA,0BAA0B;;AAE1B;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA,yBAAyB;;AAEzB;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA,2BAA2B;;AAE3B;EACE,kBAAkB;EAClB,mBAAmB;EACnB,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,mBAAmB;EACnB,gBAAgB;EAChB,uBAAuB;EACvB,kBAAkB;EAClB,sCAAsC;EACtC,eAAe;;EAEf,uCAAuC;EACvC,iBAAiB;EACjB,4CAA4C;EAC5C,gBAAgB;;EAEhB,+BAA+B;EAC/B,yCAAyC;EACzC,qCAAqC;EACrC,YAAY;EACZ,iBAAiB;AACnB;;AAEA;EACE,6CAA6C;EAC7C,oBAAoB;AACtB;;AAEA;EACE,gBAAgB,EAAE,qBAAqB;AACzC;;AAEA;EACE,2CAA2C;AAC7C;;AAEA;EACE,eAAe;AACjB;;AAEA;;EAEE,uBAAuB;EACvB;;sEAEoE;AACtE;;AAEA;;EAEE,uBAAuB;EACvB;;oEAEkE;EAClE,+BAA+B;EAC/B,yCAAyC;AAC3C;;AAEA;EACE,6DAA6D;AAC/D;;AAEA,6BAA6B;;AAE7B;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA,6BAA6B;;AAE7B;EACE,uCAAuC;EACvC,0CAA0C;AAC5C;;AAEA;EACE,uCAAuC;EACvC,0CAA0C;AAC5C;;AAEA;EACE,uCAAuC;EACvC,0CAA0C;AAC5C;;AAEA,0BAA0B;;AAE1B;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA,6BAA6B;;AAE7B;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA,4BAA4B;;AAE5B;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA,uDAAuD;;AAEvD,iBAAiB;AACjB;;;;;;EAME,2CAA2C;AAC7C;;AAEA,yBAAyB;;AAEzB,iCAAiC;AACjC;EACE,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;EAEE,gBAAgB;EAChB,oCAAoC;EACpC,sCAAsC;EACtC,gBAAgB;EAChB,uBAAuB;EACvB,mBAAmB;EACnB,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,UAAU;EACV,oCAAoC;EACpC,sCAAsC;EACtC,gBAAgB;EAChB,uBAAuB;EACvB,mBAAmB;EACnB,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,4BAA4B;EAC5B,oCAAoC;EACpC,iBAAiB;EACjB,uDAAuD;EACvD,2CAA2C;EAC3C,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;EAEE,0BAA0B;EAC1B,oCAAoC;EACpC,kBAAkB;EAClB,4CAA4C;AAC9C;;AAEA,2BAA2B;;AAE3B,iBAAiB;AACjB;;EAEE,sCAAsC;EACtC,sCAAsC;EACtC,uCAAuC;EACvC,4CAA4C;EAC5C,gBAAgB;EAChB,mBAAmB;EACnB,kBAAkB;AACpB;;AAEA,iBAAiB;AACjB;;EAEE,wBAAwB;;EAExB;;;;MAII;EACJ;uEACqE;;EAErE;uEACqE;;EAErE;mCACiC;AACnC;;AAEA,iBAAiB;AACjB;;EAEE,uBAAuB;EACvB,kBAAkB;EAClB,+CAA+C;EAC/C,8CAA8C;EAC9C,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,qBAAqB;EACrB,2CAA2C;EAC3C,0BAA0B;EAC1B,cAAc;AAChB;;AAEA,4BAA4B;;AAE5B,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,uCAAuC;EACvC,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,6DAA6D;EAC7D,4CAA4C;EAC5C,gBAAgB;EAChB,YAAY;EACZ,cAAc;EACd,kBAAkB;AACpB;;AAEA,yBAAyB;;AAEzB,iBAAiB;AACjB;;EAEE,uCAAuC;EACvC,4CAA4C;EAC5C,2CAA2C;EAC3C,sCAAsC;AACxC;;AAEA,iBAAiB;AACjB;;EAEE,4CAA4C;EAC5C,6CAA6C;EAC7C,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;AACd;;AAEA,iBAAiB;AACjB;;EAEE,UAAU;AACZ;;AAEA,iBAAiB;AACjB;;EAEE,aAAa;AACf;;AAEA,qCAAqC;;AAErC,iBAAiB;AACjB;;;;EAIE,qCAAqC;AACvC;;AAEA,iBAAiB;AACjB;;;;;;EAME,uCAAuC;AACzC;;AAEA,iBAAiB;AACjB;;;;;;;;EAQE,2CAA2C;AAC7C;;AAEA,iBAAiB;AACjB;;;;;;;;EAQE,sBAAsB;EACtB;wCACsC;EACtC,0DAA0D;EAC1D,oCAAoC;EACpC,sCAAsC;EACtC,YAAY;EACZ,YAAY,EAAE,gEAAgE;EAC9E,cAAc;EACd,wBAAwB;AAC1B;;AAEA,iBAAiB;AACjB;;;;;;EAME;6CAC2C;AAC7C;;AAEA,iBAAiB;AACjB;;EAEE;6CAC2C;AAC7C;;AAEA,iBAAiB;AACjB;;EAEE,eAAe;EACf,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;;;EAIE,wDAAwD;AAC1D;;AAEA,sBAAsB;AACtB,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,uCAAuC;EACvC,4CAA4C;;EAE5C;;mDAEiD;EACjD,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;EAEE,iBAAiB;AACnB;;AAEA,iBAAiB;AACjB;;EAEE;;;GAGC;EACD;;;GAGC;EACD,8CAA8C;AAChD;;AAEA,oBAAoB;;AAEpB,iBAAiB;AACjB;;EAEE,uCAAuC;EACvC,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,oBAAoB;EACpB,yCAAyC;EACzC,0CAA0C;AAC5C;;AAEA,iBAAiB;AACjB;;EAEE,8CAA8C;EAC9C,iBAAiB;EACjB,kBAAkB;EAClB;;;GAGC;EACD;;;GAGC;EACD,aAAa;EACb,sBAAsB;AACxB;;AAEA,4BAA4B;;AAE5B;EACE,wBAAwB;EACxB,qBAAqB;EACrB,oBAAoB;EACpB,mBAAmB;EACnB,gBAAgB;AAClB;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,wCAAwC;AAC1C;;AAEA;EACE,0CAA0C;AAC5C;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,wCAAwC;AAC1C;;AAEA;EACE,yCAAyC;EACzC,YAAY;EACZ,gBAAgB;AAClB;;AAEA,wBAAwB;;AAExB,iBAAiB;AACjB;;EAEE,iBAAiB;EACjB,uCAAuC;EACvC,4CAA4C;EAC5C,qCAAqC;EACrC,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;EACZ,2CAA2C;EAC3C,8CAA8C;EAC9C,mBAAmB;EACnB,6BAA6B;EAC7B,eAAe;AACjB;;AAEA,sBAAsB;;AAEtB,iBAAiB;AACjB;;EAEE,yCAAyC;EACzC,0CAA0C;AAC5C;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;EACZ,2CAA2C;EAC3C,iBAAiB;EACjB,kBAAkB;EAClB,gBAAgB;AAClB;;AAEA,0BAA0B;;AAE1B,iBAAiB;AACjB;;EAEE,uCAAuC;EACvC,qCAAqC;EACrC,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,mBAAmB;EACnB;wCACsC;EACtC,gBAAgB;EAChB,eAAe;EACf,8CAA8C;EAC9C,YAAY,EAAE,gEAAgE;EAC9E,sBAAsB;EACtB,wBAAwB;EACxB,gBAAgB;EAChB,0DAA0D;EAC1D,oCAAoC;EACpC,sCAAsC;EACtC,mBAAmB;EACnB,uDAAuD;EACvD,gBAAgB;EAChB,wBAAwB;EACxB,qBAAqB;EACrB,4BAA4B;EAC5B,qBAAqB;EACrB,iCAAiC;EACjC,kDAAkD;AACpD;AACA,iBAAiB;AACjB;;EAEE,wDAAwD;AAC1D;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;AAC7C;;AAEA;4CAC4C;AAC5C,iBAAiB;AACjB;;EAEE,kBAAkB;EAClB,uBAAuB;AACzB;;AAEA,8BAA8B;;AAE9B,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,4CAA4C;;EAE5C;;iEAE+D;EAC/D,uBAAuB;AACzB;;AAEA,iBAAiB;AACjB;;EAEE;wCACsC;EACtC,0DAA0D;EAC1D,oCAAoC;EACpC,sCAAsC;EACtC,8CAA8C;EAC9C,wBAAwB;EACxB,cAAc;EACd,eAAe;;EAEf;;iEAE+D;EAC/D,gBAAgB;AAClB;;AAEA,iBAAiB;AACjB;;EAEE,wDAAwD;AAC1D;;AAEA;;EAEE,6CAA6C;EAC7C,4CAA4C;EAC5C,iEAAiE;EACjE;;GAEC;EACD;;GAEC;AACH;;AAEA,2BAA2B;;AAE3B,iBAAiB;AACjB;;EAEE,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,sCAAsC;AACxC;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;AAC7C;;AAEA,0BAA0B;;AAE1B,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,aAAa;EACb,sBAAsB;EACtB,oBAAoB;EACpB,sBAAsB;EACtB,YAAY;EACZ,6DAA6D;AAC/D;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;EAC3C,gDAAgD;EAChD,sCAAsC;AACxC;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;EAC3C,gDAAgD;EAChD,yDAAyD;EACzD,WAAW;AACb;;AAEA,yBAAyB;;AAEzB,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,uCAAuC;EACvC,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;EACZ,cAAc;EACd,8CAA8C;AAChD;;AAEA,iBAAiB;AACjB;;EAEE,sCAAsC;EACtC,uCAAuC;EACvC,cAAc,EAAE,4DAA4D;EAC5E,oDAAoD;EACpD,oCAAoC;EACpC;wCACsC;EACtC,iBAAiB;EACjB,YAAY;EACZ,cAAc;EACd,sBAAsB;EACtB,mBAAmB;EACnB,wBAAwB;AAC1B;;AAEA,iBAAiB;AACjB;;EAEE;wCACsC;AACxC;;AAEA,iBAAiB;AACjB;;;;EAIE,wDAAwD;AAC1D;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;EACZ,wBAAwB;EACxB,uCAAuC;EACvC,4CAA4C;EAC5C,oDAAoD;EACpD,oCAAoC;EACpC;wCACsC;EACtC,sCAAsC;EACtC;6CAC2C;EAC3C,YAAY,EAAE,gEAAgE;EAC9E,cAAc;EACd,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;AAC7C;;AAEA,wBAAwB;;AAExB,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,uCAAuC;EACvC,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;EACZ,cAAc;EACd,YAAY,EAAE,gEAAgE;EAC9E,wBAAwB;EACxB,uCAAuC;EACvC;wCACsC;EACtC,0DAA0D;EAC1D,oCAAoC;EACpC,sCAAsC;EACtC;6CAC2C;EAC3C,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;EAEE,wDAAwD;AAC1D;;AAEA,iBAAiB;AACjB;;EAEE,mCAAmC;AACrC;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;AAC7C;;AAEA,gBAAgB;;AAEhB,iBAAiB;AACjB;;EAEE,2CAA2C;EAC3C,aAAa;EACb,oBAAoB;AACtB;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;EACZ,YAAY;AACd;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;AAC7C;;AAEA,eAAe;;AAEf,iBAAiB;AACjB;;EAEE,aAAa;EACb,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;;EAGE,wFAAwF;EACxF,mBAAmB;EACnB,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;;EAGE,gDAAgD;EAChD,qBAAqB;EACrB,YAAY;EACZ,aAAa;AACf;;AAEA,iBAAiB;AACjB;;EAEE,WAAW;EACX,sBAAsB;EACtB,SAAS;EACT,mCAAmC;EACnC,+BAA+B;EAC/B,4DAA4D;EAC5D,4CAA4C;EAC5C,YAAY;EACZ,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;;EAGE,8DAA8D;EAC9D;;GAEC;AACH;;AAEA,iBAAiB;AACjB;;;EAGE,gDAAgD;EAChD,eAAe;EACf;;GAEC;EACD,oDAAoD;EACpD,8CAA8C;EAC9C,iBAAiB;EACjB,mCAAmC;EACnC,+BAA+B;EAC/B,4DAA4D;EAC5D,mBAAmB;EACnB,kBAAkB;AACpB;;AAEA,iBAAiB;AACjB;;;EAGE,+BAA+B;EAC/B,+DAA+D;EAC/D,mCAAmC;EACnC;;GAEC;EACD,6CAA6C;EAC7C,iBAAiB;AACnB;;AAEA,iBAAiB;AACjB;;;EAGE,kBAAkB;EAClB,sCAAsC;EACtC,uCAAuC;EACvC,WAAW;EACX,mDAAmD;EACnD,8CAA8C;EAC9C,kCAAkC;AACpC;;AAEA,iBAAiB;AACjB;;;EAGE,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;EAYE,mCAAmC;EACnC,+BAA+B;AACjC;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;;;;EAeE,gBAAgB;AAClB;;AAEA;6DAC6D;AAC7D,iBAAiB;AACjB;;;;;;;;;;;;;;;EAeE,wBAAwB;EACxB,gBAAgB,EAAE,UAAU;AAC9B;;AAEA,iBAAiB;AACjB;;;;;;;;;EASE,oDAAoD;AACtD;;AAEA,qBAAqB;;AAErB;EACE,aAAa;EACb,sBAAsB;EACtB,oBAAoB;AACtB;;AAEA;EACE,wCAAwC;EACxC,eAAe;EACf,+BAA+B;EAC/B,yCAAyC;EACzC,oEAAoE;EACpE;uCACqC;EACrC,iBAAiB;AACnB;;AAEA;EACE,yCAAyC;EACzC,+BAA+B;AACjC;;AAEA;EACE,yCAAyC;EACzC,+BAA+B;EAC/B,eAAe;EACf,mBAAmB;AACrB;;AAEA;EACE,4CAA4C;EAC5C,yCAAyC;EACzC,+BAA+B;EAC/B,yEAAyE;EACzE,0EAA0E;EAC1E,2EAA2E;EAC3E,cAAc;AAChB;;AAEA;EACE,aAAa;EACb,sBAAsB;EACtB,oBAAoB;AACtB;;AAEA;EACE,gBAAgB;AAClB;;AAEA;EACE,eAAe;AACjB;;AAEA,gBAAgB;;AAEhB,iBAAiB;AACjB;;;;EAIE,sCAAsC;AACxC;;AAEA,iBAAiB;AACjB;;;;EAIE,yCAAyC;EACzC,mBAAmB;EACnB,YAAY;EACZ,cAAc;EACd,iEAAiE;EACjE,4CAA4C;EAC5C,wEAAwE;EACxE,kBAAkB;AACpB;;AAEA,kBAAkB;;AAElB,iBAAiB;AACjB;;EAEE,eAAe;EACf,YAAY;AACd\",\"sourcesContent\":[\"/* Copyright (c) Jupyter Development Team.\\n * Distributed under the terms of the Modified BSD License.\\n */\\n\\n/*\\n * We assume that the CSS variables in\\n * https://github.com/jupyterlab/jupyterlab/blob/master/src/default-theme/variables.css\\n * have been defined.\\n */\\n\\n@import './lumino.css';\\n@import './nouislider.css';\\n\\n:root {\\n --jp-widgets-color: var(--jp-content-font-color1);\\n --jp-widgets-label-color: var(--jp-widgets-color);\\n --jp-widgets-readout-color: var(--jp-widgets-color);\\n --jp-widgets-font-size: var(--jp-ui-font-size1);\\n --jp-widgets-margin: 2px;\\n --jp-widgets-inline-height: 28px;\\n --jp-widgets-inline-width: 300px;\\n --jp-widgets-inline-width-short: calc(\\n var(--jp-widgets-inline-width) / 2 - var(--jp-widgets-margin)\\n );\\n --jp-widgets-inline-width-tiny: calc(\\n var(--jp-widgets-inline-width-short) / 2 - var(--jp-widgets-margin)\\n );\\n --jp-widgets-inline-margin: 4px; /* margin between inline elements */\\n --jp-widgets-inline-label-width: 80px;\\n --jp-widgets-border-width: var(--jp-border-width);\\n --jp-widgets-vertical-height: 200px;\\n --jp-widgets-horizontal-tab-height: 24px;\\n --jp-widgets-horizontal-tab-width: 144px;\\n --jp-widgets-horizontal-tab-top-border: 2px;\\n --jp-widgets-progress-thickness: 20px;\\n --jp-widgets-container-padding: 15px;\\n --jp-widgets-input-padding: 4px;\\n --jp-widgets-radio-item-height-adjustment: 8px;\\n --jp-widgets-radio-item-height: calc(\\n var(--jp-widgets-inline-height) -\\n var(--jp-widgets-radio-item-height-adjustment)\\n );\\n --jp-widgets-slider-track-thickness: 4px;\\n --jp-widgets-slider-border-width: var(--jp-widgets-border-width);\\n --jp-widgets-slider-handle-size: 16px;\\n --jp-widgets-slider-handle-border-color: var(--jp-border-color1);\\n --jp-widgets-slider-handle-background-color: var(--jp-layout-color1);\\n --jp-widgets-slider-active-handle-color: var(--jp-brand-color1);\\n --jp-widgets-menu-item-height: 24px;\\n --jp-widgets-dropdown-arrow: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxOCAxOCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTggMTg7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDpub25lO30KPC9zdHlsZT4KPHBhdGggZD0iTTUuMiw1LjlMOSw5LjdsMy44LTMuOGwxLjIsMS4ybC00LjksNWwtNC45LTVMNS4yLDUuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTAtMC42aDE4djE4SDBWLTAuNnoiLz4KPC9zdmc+Cg');\\n --jp-widgets-input-color: var(--jp-ui-font-color1);\\n --jp-widgets-input-background-color: var(--jp-layout-color1);\\n --jp-widgets-input-border-color: var(--jp-border-color1);\\n --jp-widgets-input-focus-border-color: var(--jp-brand-color2);\\n --jp-widgets-input-border-width: var(--jp-widgets-border-width);\\n --jp-widgets-disabled-opacity: 0.6;\\n\\n /* From Material Design Lite */\\n --md-shadow-key-umbra-opacity: 0.2;\\n --md-shadow-key-penumbra-opacity: 0.14;\\n --md-shadow-ambient-shadow-opacity: 0.12;\\n}\\n\\n.jupyter-widgets {\\n margin: var(--jp-widgets-margin);\\n box-sizing: border-box;\\n color: var(--jp-widgets-color);\\n overflow: visible;\\n}\\n\\n.jp-Output-result > .jupyter-widgets {\\n margin-left: 0;\\n margin-right: 0;\\n}\\n\\n/* vbox and hbox */\\n\\n/* */\\n.widget-inline-hbox, /* */\\n .jupyter-widget-inline-hbox {\\n /* Horizontal widgets */\\n box-sizing: border-box;\\n display: flex;\\n flex-direction: row;\\n align-items: baseline;\\n}\\n\\n/* */\\n.widget-inline-vbox, /* */\\n .jupyter-widget-inline-vbox {\\n /* Vertical Widgets */\\n box-sizing: border-box;\\n display: flex;\\n flex-direction: column;\\n align-items: center;\\n}\\n\\n/* */\\n.widget-box, /* */\\n.jupyter-widget-box {\\n box-sizing: border-box;\\n display: flex;\\n margin: 0;\\n overflow: auto;\\n}\\n\\n/* */\\n.widget-gridbox, /* */\\n.jupyter-widget-gridbox {\\n box-sizing: border-box;\\n display: grid;\\n margin: 0;\\n overflow: auto;\\n}\\n\\n/* */\\n.widget-hbox, /* */\\n.jupyter-widget-hbox {\\n flex-direction: row;\\n}\\n\\n/* */\\n.widget-vbox, /* */\\n.jupyter-widget-vbox {\\n flex-direction: column;\\n}\\n\\n/* General Tags Styling */\\n\\n.jupyter-widget-tagsinput {\\n display: flex;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n overflow: auto;\\n\\n cursor: text;\\n}\\n\\n.jupyter-widget-tag {\\n padding-left: 10px;\\n padding-right: 10px;\\n padding-top: 0px;\\n padding-bottom: 0px;\\n display: inline-block;\\n white-space: nowrap;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n text-align: center;\\n font-size: var(--jp-widgets-font-size);\\n\\n height: calc(var(--jp-widgets-inline-height) - 2px);\\n border: 0px solid;\\n line-height: calc(var(--jp-widgets-inline-height) - 2px);\\n box-shadow: none;\\n\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color2);\\n border-color: var(--jp-border-color2);\\n border: none;\\n user-select: none;\\n\\n cursor: grab;\\n transition: margin-left 200ms;\\n margin: 1px 1px 1px 1px;\\n}\\n\\n.jupyter-widget-tag.mod-active {\\n /* MD Lite 4dp shadow */\\n box-shadow: 0 4px 5px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\\n 0 1px 10px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity)),\\n 0 2px 4px -1px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity));\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color3);\\n}\\n\\n.jupyter-widget-colortag {\\n color: var(--jp-inverse-ui-font-color1);\\n}\\n\\n.jupyter-widget-colortag.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n}\\n\\n.jupyter-widget-taginput {\\n color: var(--jp-ui-font-color0);\\n background-color: var(--jp-layout-color0);\\n\\n cursor: text;\\n text-align: left;\\n}\\n\\n.jupyter-widget-taginput:focus {\\n outline: none;\\n}\\n\\n.jupyter-widget-tag-close {\\n margin-left: var(--jp-widgets-inline-margin);\\n padding: 2px 0px 2px 2px;\\n}\\n\\n.jupyter-widget-tag-close:hover {\\n cursor: pointer;\\n}\\n\\n/* Tag \\\"Primary\\\" Styling */\\n\\n.jupyter-widget-tag.mod-primary {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-brand-color1);\\n}\\n\\n.jupyter-widget-tag.mod-primary.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-brand-color0);\\n}\\n\\n/* Tag \\\"Success\\\" Styling */\\n\\n.jupyter-widget-tag.mod-success {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-success-color1);\\n}\\n\\n.jupyter-widget-tag.mod-success.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-success-color0);\\n}\\n\\n/* Tag \\\"Info\\\" Styling */\\n\\n.jupyter-widget-tag.mod-info {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-info-color1);\\n}\\n\\n.jupyter-widget-tag.mod-info.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-info-color0);\\n}\\n\\n/* Tag \\\"Warning\\\" Styling */\\n\\n.jupyter-widget-tag.mod-warning {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-warn-color1);\\n}\\n\\n.jupyter-widget-tag.mod-warning.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-warn-color0);\\n}\\n\\n/* Tag \\\"Danger\\\" Styling */\\n\\n.jupyter-widget-tag.mod-danger {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-error-color1);\\n}\\n\\n.jupyter-widget-tag.mod-danger.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-error-color0);\\n}\\n\\n/* General Button Styling */\\n\\n.jupyter-button {\\n padding-left: 10px;\\n padding-right: 10px;\\n padding-top: 0px;\\n padding-bottom: 0px;\\n display: inline-block;\\n white-space: nowrap;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n text-align: center;\\n font-size: var(--jp-widgets-font-size);\\n cursor: pointer;\\n\\n height: var(--jp-widgets-inline-height);\\n border: 0px solid;\\n line-height: var(--jp-widgets-inline-height);\\n box-shadow: none;\\n\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color2);\\n border-color: var(--jp-border-color2);\\n border: none;\\n user-select: none;\\n}\\n\\n.jupyter-button i.fa {\\n margin-right: var(--jp-widgets-inline-margin);\\n pointer-events: none;\\n}\\n\\n.jupyter-button:empty:before {\\n content: '\\\\200b'; /* zero-width space */\\n}\\n\\n.jupyter-widgets.jupyter-button:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n.jupyter-button i.fa.center {\\n margin-right: 0;\\n}\\n\\n.jupyter-button:hover:enabled,\\n.jupyter-button:focus:enabled {\\n /* MD Lite 2dp shadow */\\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\\n 0 3px 1px -2px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity)),\\n 0 1px 5px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity));\\n}\\n\\n.jupyter-button:active,\\n.jupyter-button.mod-active {\\n /* MD Lite 4dp shadow */\\n box-shadow: 0 4px 5px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\\n 0 1px 10px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity)),\\n 0 2px 4px -1px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity));\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color3);\\n}\\n\\n.jupyter-button:focus:enabled {\\n outline: 1px solid var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* Button \\\"Primary\\\" Styling */\\n\\n.jupyter-button.mod-primary {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-brand-color1);\\n}\\n\\n.jupyter-button.mod-primary.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-brand-color0);\\n}\\n\\n.jupyter-button.mod-primary:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-brand-color0);\\n}\\n\\n/* Button \\\"Success\\\" Styling */\\n\\n.jupyter-button.mod-success {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-success-color1);\\n}\\n\\n.jupyter-button.mod-success.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-success-color0);\\n}\\n\\n.jupyter-button.mod-success:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-success-color0);\\n}\\n\\n/* Button \\\"Info\\\" Styling */\\n\\n.jupyter-button.mod-info {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-info-color1);\\n}\\n\\n.jupyter-button.mod-info.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-info-color0);\\n}\\n\\n.jupyter-button.mod-info:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-info-color0);\\n}\\n\\n/* Button \\\"Warning\\\" Styling */\\n\\n.jupyter-button.mod-warning {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-warn-color1);\\n}\\n\\n.jupyter-button.mod-warning.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-warn-color0);\\n}\\n\\n.jupyter-button.mod-warning:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-warn-color0);\\n}\\n\\n/* Button \\\"Danger\\\" Styling */\\n\\n.jupyter-button.mod-danger {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-error-color1);\\n}\\n\\n.jupyter-button.mod-danger.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-error-color0);\\n}\\n\\n.jupyter-button.mod-danger:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-error-color0);\\n}\\n\\n/* Widget Button, Widget Toggle Button, Widget Upload */\\n\\n/* */\\n.widget-button, /* */\\n/* */ .widget-toggle-button, /* */\\n/* */ .widget-upload, /* */\\n.jupyter-widget-button,\\n.jupyter-widget-toggle-button,\\n.jupyter-widget-upload {\\n width: var(--jp-widgets-inline-width-short);\\n}\\n\\n/* Widget Label Styling */\\n\\n/* Override Bootstrap label css */\\n.jupyter-widgets label {\\n margin-bottom: initial;\\n}\\n\\n/* */\\n.widget-label-basic, /* */\\n.jupyter-widget-label-basic {\\n /* Basic Label */\\n color: var(--jp-widgets-label-color);\\n font-size: var(--jp-widgets-font-size);\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-label, /* */\\n.jupyter-widget-label {\\n /* Label */\\n color: var(--jp-widgets-label-color);\\n font-size: var(--jp-widgets-font-size);\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-inline-hbox .widget-label, /* */\\n.jupyter-widget-inline-hbox .jupyter-widget-label {\\n /* Horizontal Widget Label */\\n color: var(--jp-widgets-label-color);\\n text-align: right;\\n margin-right: calc(var(--jp-widgets-inline-margin) * 2);\\n width: var(--jp-widgets-inline-label-width);\\n flex-shrink: 0;\\n}\\n\\n/* */\\n.widget-inline-vbox .widget-label, /* */\\n.jupyter-widget-inline-vbox .jupyter-widget-label {\\n /* Vertical Widget Label */\\n color: var(--jp-widgets-label-color);\\n text-align: center;\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* Widget Readout Styling */\\n\\n/* */\\n.widget-readout, /* */\\n.jupyter-widget-readout {\\n color: var(--jp-widgets-readout-color);\\n font-size: var(--jp-widgets-font-size);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n overflow: hidden;\\n white-space: nowrap;\\n text-align: center;\\n}\\n\\n/* */\\n.widget-readout.overflow, /* */\\n.jupyter-widget-readout.overflow {\\n /* Overflowing Readout */\\n\\n /* From Material Design Lite\\n shadow-key-umbra-opacity: 0.2;\\n shadow-key-penumbra-opacity: 0.14;\\n shadow-ambient-shadow-opacity: 0.12;\\n */\\n -webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\\n 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n\\n -moz-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\\n 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n\\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2), 0 3px 1px -2px rgba(0, 0, 0, 0.14),\\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n}\\n\\n/* */\\n.widget-inline-hbox .widget-readout, /* */\\n.jupyter-widget-inline-hbox .jupyter-widget-readout {\\n /* Horizontal Readout */\\n text-align: center;\\n max-width: var(--jp-widgets-inline-width-short);\\n min-width: var(--jp-widgets-inline-width-tiny);\\n margin-left: var(--jp-widgets-inline-margin);\\n}\\n\\n/* */\\n.widget-inline-vbox .widget-readout, /* */\\n.jupyter-widget-inline-vbox .jupyter-widget-readout {\\n /* Vertical Readout */\\n margin-top: var(--jp-widgets-inline-margin);\\n /* as wide as the widget */\\n width: inherit;\\n}\\n\\n/* Widget Checkbox Styling */\\n\\n/* */\\n.widget-checkbox, /* */\\n.jupyter-widget-checkbox {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-checkbox input[type='checkbox'], /* */\\n.jupyter-widget-checkbox input[type='checkbox'] {\\n margin: 0px calc(var(--jp-widgets-inline-margin) * 2) 0px 0px;\\n line-height: var(--jp-widgets-inline-height);\\n font-size: large;\\n flex-grow: 1;\\n flex-shrink: 0;\\n align-self: center;\\n}\\n\\n/* Widget Valid Styling */\\n\\n/* */\\n.widget-valid, /* */\\n.jupyter-widget-valid {\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n width: var(--jp-widgets-inline-width-short);\\n font-size: var(--jp-widgets-font-size);\\n}\\n\\n/* */\\n.widget-valid i, /* */\\n.jupyter-widget-valid i {\\n line-height: var(--jp-widgets-inline-height);\\n margin-right: var(--jp-widgets-inline-margin);\\n margin-left: var(--jp-widgets-inline-margin);\\n}\\n\\n/* */\\n.widget-valid.mod-valid i, /* */\\n.jupyter-widget-valid.mod-valid i {\\n color: green;\\n}\\n\\n/* */\\n.widget-valid.mod-invalid i, /* */\\n.jupyter-widget-valid.mod-invalid i {\\n color: red;\\n}\\n\\n/* */\\n.widget-valid.mod-valid .widget-valid-readout, /* */\\n.jupyter-widget-valid.mod-valid .jupyter-widget-valid-readout {\\n display: none;\\n}\\n\\n/* Widget Text and TextArea Styling */\\n\\n/* */\\n.widget-textarea, /* */\\n/* */ .widget-text, /* */\\n.jupyter-widget-textarea,\\n.jupyter-widget-text {\\n width: var(--jp-widgets-inline-width);\\n}\\n\\n/* */\\n.widget-text input[type='text'], /* */\\n/* */ .widget-text input[type='number'], /* */\\n/* */ .widget-text input[type='password'], /* */\\n.jupyter-widget-text input[type='text'],\\n.jupyter-widget-text input[type='number'],\\n.jupyter-widget-text input[type='password'] {\\n height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-text input[type='text']:disabled, /* */\\n/* */ .widget-text input[type='number']:disabled, /* */\\n/* */ .widget-text input[type='password']:disabled, /* */\\n/* */ .widget-textarea textarea:disabled, /* */\\n.jupyter-widget-text input[type='text']:disabled,\\n.jupyter-widget-text input[type='number']:disabled,\\n.jupyter-widget-text input[type='password']:disabled,\\n.jupyter-widget-textarea textarea:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* */\\n.widget-text input[type='text'], /* */\\n/* */ .widget-text input[type='number'], /* */\\n/* */ .widget-text input[type='password'], /* */\\n/* */ .widget-textarea textarea, /* */\\n.jupyter-widget-text input[type='text'],\\n.jupyter-widget-text input[type='number'],\\n.jupyter-widget-text input[type='password'],\\n.jupyter-widget-textarea textarea {\\n box-sizing: border-box;\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n flex-grow: 1;\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n flex-shrink: 1;\\n outline: none !important;\\n}\\n\\n/* */\\n.widget-text input[type='text'], /* */\\n/* */ .widget-text input[type='password'], /* */\\n/* */ .widget-textarea textarea, /* */\\n.jupyter-widget-text input[type='text'],\\n.jupyter-widget-text input[type='password'],\\n.jupyter-widget-textarea textarea {\\n padding: var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n}\\n\\n/* */\\n.widget-text input[type='number'], /* */\\n.jupyter-widget-text input[type='number'] {\\n padding: var(--jp-widgets-input-padding) 0 var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n}\\n\\n/* */\\n.widget-textarea textarea, /* */\\n.jupyter-widget-textarea textarea {\\n height: inherit;\\n width: inherit;\\n}\\n\\n/* */\\n.widget-text input:focus, /* */\\n/* */ .widget-textarea textarea:focus, /* */\\n.jupyter-widget-text input:focus,\\n.jupyter-widget-textarea textarea:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* Horizontal Slider */\\n/* */\\n.widget-hslider, /* */\\n.jupyter-widget-hslider {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n\\n /* Override the align-items baseline. This way, the description and readout\\n still seem to align their baseline properly, and we don't have to have\\n align-self: stretch in the .slider-container. */\\n align-items: center;\\n}\\n\\n/* */\\n.widgets-slider .slider-container, /* */\\n.jupyter-widgets-slider .slider-container {\\n overflow: visible;\\n}\\n\\n/* */\\n.widget-hslider .slider-container, /* */\\n.jupyter-widget-hslider .slider-container {\\n margin-left: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n margin-right: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n}\\n\\n/* Vertical Slider */\\n\\n/* */\\n.widget-vbox .widget-label, /* */\\n.jupyter-widget-vbox .jupyter-widget-label {\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-vslider, /* */\\n.jupyter-widget-vslider {\\n /* Vertical Slider */\\n height: var(--jp-widgets-vertical-height);\\n width: var(--jp-widgets-inline-width-tiny);\\n}\\n\\n/* */\\n.widget-vslider .slider-container, /* */\\n.jupyter-widget-vslider .slider-container {\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n margin-left: auto;\\n margin-right: auto;\\n margin-bottom: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n margin-top: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n display: flex;\\n flex-direction: column;\\n}\\n\\n/* Widget Progress Styling */\\n\\n.progress-bar {\\n -webkit-transition: none;\\n -moz-transition: none;\\n -ms-transition: none;\\n -o-transition: none;\\n transition: none;\\n}\\n\\n.progress-bar {\\n height: var(--jp-widgets-inline-height);\\n}\\n\\n.progress-bar {\\n background-color: var(--jp-brand-color1);\\n}\\n\\n.progress-bar-success {\\n background-color: var(--jp-success-color1);\\n}\\n\\n.progress-bar-info {\\n background-color: var(--jp-info-color1);\\n}\\n\\n.progress-bar-warning {\\n background-color: var(--jp-warn-color1);\\n}\\n\\n.progress-bar-danger {\\n background-color: var(--jp-error-color1);\\n}\\n\\n.progress {\\n background-color: var(--jp-layout-color2);\\n border: none;\\n box-shadow: none;\\n}\\n\\n/* Horisontal Progress */\\n\\n/* */\\n.widget-hprogress, /* */\\n.jupyter-widget-hprogress {\\n /* Progress Bar */\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n width: var(--jp-widgets-inline-width);\\n align-items: center;\\n}\\n\\n/* */\\n.widget-hprogress .progress, /* */\\n.jupyter-widget-hprogress .progress {\\n flex-grow: 1;\\n margin-top: var(--jp-widgets-input-padding);\\n margin-bottom: var(--jp-widgets-input-padding);\\n align-self: stretch;\\n /* Override bootstrap style */\\n height: initial;\\n}\\n\\n/* Vertical Progress */\\n\\n/* */\\n.widget-vprogress, /* */\\n.jupyter-widget-vprogress {\\n height: var(--jp-widgets-vertical-height);\\n width: var(--jp-widgets-inline-width-tiny);\\n}\\n\\n/* */\\n.widget-vprogress .progress, /* */\\n.jupyter-widget-vprogress .progress {\\n flex-grow: 1;\\n width: var(--jp-widgets-progress-thickness);\\n margin-left: auto;\\n margin-right: auto;\\n margin-bottom: 0;\\n}\\n\\n/* Select Widget Styling */\\n\\n/* */\\n.widget-dropdown, /* */\\n.jupyter-widget-dropdown {\\n height: var(--jp-widgets-inline-height);\\n width: var(--jp-widgets-inline-width);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-dropdown > select, /* */\\n.jupyter-widget-dropdown > select {\\n padding-right: 20px;\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n border-radius: 0;\\n height: inherit;\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n box-sizing: border-box;\\n outline: none !important;\\n box-shadow: none;\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n vertical-align: top;\\n padding-left: calc(var(--jp-widgets-input-padding) * 2);\\n appearance: none;\\n -webkit-appearance: none;\\n -moz-appearance: none;\\n background-repeat: no-repeat;\\n background-size: 20px;\\n background-position: right center;\\n background-image: var(--jp-widgets-dropdown-arrow);\\n}\\n/* */\\n.widget-dropdown > select:focus, /* */\\n.jupyter-widget-dropdown > select:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* */\\n.widget-dropdown > select:disabled, /* */\\n.jupyter-widget-dropdown > select:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* To disable the dotted border in Firefox around select controls.\\n See http://stackoverflow.com/a/18853002 */\\n/* */\\n.widget-dropdown > select:-moz-focusring, /* */\\n.jupyter-widget-dropdown > select:-moz-focusring {\\n color: transparent;\\n text-shadow: 0 0 0 #000;\\n}\\n\\n/* Select and SelectMultiple */\\n\\n/* */\\n.widget-select, /* */\\n.jupyter-widget-select {\\n width: var(--jp-widgets-inline-width);\\n line-height: var(--jp-widgets-inline-height);\\n\\n /* Because Firefox defines the baseline of a select as the bottom of the\\n control, we align the entire control to the top and add padding to the\\n select to get an approximate first line baseline alignment. */\\n align-items: flex-start;\\n}\\n\\n/* */\\n.widget-select > select, /* */\\n.jupyter-widget-select > select {\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n outline: none !important;\\n overflow: auto;\\n height: inherit;\\n\\n /* Because Firefox defines the baseline of a select as the bottom of the\\n control, we align the entire control to the top and add padding to the\\n select to get an approximate first line baseline alignment. */\\n padding-top: 5px;\\n}\\n\\n/* */\\n.widget-select > select:focus, /* */\\n.jupyter-widget-select > select:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n.wiget-select > select > option,\\n.jupyter-wiget-select > select > option {\\n padding-left: var(--jp-widgets-input-padding);\\n line-height: var(--jp-widgets-inline-height);\\n /* line-height doesn't work on some browsers for select options */\\n padding-top: calc(\\n var(--jp-widgets-inline-height) - var(--jp-widgets-font-size) / 2\\n );\\n padding-bottom: calc(\\n var(--jp-widgets-inline-height) - var(--jp-widgets-font-size) / 2\\n );\\n}\\n\\n/* Toggle Buttons Styling */\\n\\n/* */\\n.widget-toggle-buttons, /* */\\n.jupyter-widget-toggle-buttons {\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-toggle-buttons .widget-toggle-button, /* */\\n.jupyter-widget-toggle-buttons .jupyter-widget-toggle-button {\\n margin-left: var(--jp-widgets-margin);\\n margin-right: var(--jp-widgets-margin);\\n}\\n\\n/* */\\n.widget-toggle-buttons .jupyter-button:disabled, /* */\\n.jupyter-widget-toggle-buttons .jupyter-button:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Radio Buttons Styling */\\n\\n/* */\\n.widget-radio, /* */\\n.jupyter-widget-radio {\\n width: var(--jp-widgets-inline-width);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-radio-box, /* */\\n.jupyter-widget-radio-box {\\n display: flex;\\n flex-direction: column;\\n align-items: stretch;\\n box-sizing: border-box;\\n flex-grow: 1;\\n margin-bottom: var(--jp-widgets-radio-item-height-adjustment);\\n}\\n\\n/* */\\n.widget-radio-box label, /* */\\n.jupyter-widget-radio-box label {\\n height: var(--jp-widgets-radio-item-height);\\n line-height: var(--jp-widgets-radio-item-height);\\n font-size: var(--jp-widgets-font-size);\\n}\\n\\n/* */\\n.widget-radio-box input, /* */\\n.jupyter-widget-radio-box input {\\n height: var(--jp-widgets-radio-item-height);\\n line-height: var(--jp-widgets-radio-item-height);\\n margin: 0 calc(var(--jp-widgets-input-padding) * 2) 0 1px;\\n float: left;\\n}\\n\\n/* Color Picker Styling */\\n\\n/* */\\n.widget-colorpicker, /* */\\n.jupyter-widget-colorpicker {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-colorpicker > .widget-colorpicker-input, /* */\\n.jupyter-widget-colorpicker > .jupyter-widget-colorpicker-input {\\n flex-grow: 1;\\n flex-shrink: 1;\\n min-width: var(--jp-widgets-inline-width-tiny);\\n}\\n\\n/* */\\n.widget-colorpicker input[type='color'], /* */\\n.jupyter-widget-colorpicker input[type='color'] {\\n width: var(--jp-widgets-inline-height);\\n height: var(--jp-widgets-inline-height);\\n padding: 0 2px; /* make the color square actually square on Chrome on OS X */\\n background: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n border-left: none;\\n flex-grow: 0;\\n flex-shrink: 0;\\n box-sizing: border-box;\\n align-self: stretch;\\n outline: none !important;\\n}\\n\\n/* */\\n.widget-colorpicker.concise input[type='color'], /* */\\n.jupyter-widget-colorpicker.concise input[type='color'] {\\n border-left: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n}\\n\\n/* */\\n.widget-colorpicker input[type='color']:focus, /* */\\n/* */ .widget-colorpicker input[type='text']:focus, /* */\\n.jupyter-widget-colorpicker input[type='color']:focus,\\n.jupyter-widget-colorpicker input[type='text']:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* */\\n.widget-colorpicker input[type='text'], /* */\\n.jupyter-widget-colorpicker input[type='text'] {\\n flex-grow: 1;\\n outline: none !important;\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n background: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n font-size: var(--jp-widgets-font-size);\\n padding: var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n flex-shrink: 1;\\n box-sizing: border-box;\\n}\\n\\n/* */\\n.widget-colorpicker input[type='text']:disabled, /* */\\n.jupyter-widget-colorpicker input[type='text']:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Date Picker Styling */\\n\\n/* */\\n.widget-datepicker, /* */\\n.jupyter-widget-datepicker {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-datepicker input[type='date'], /* */\\n.jupyter-widget-datepicker input[type='date'] {\\n flex-grow: 1;\\n flex-shrink: 1;\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n outline: none !important;\\n height: var(--jp-widgets-inline-height);\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n padding: var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n box-sizing: border-box;\\n}\\n\\n/* */\\n.widget-datepicker input[type='date']:focus, /* */\\n.jupyter-widget-datepicker input[type='date']:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* */\\n.widget-datepicker input[type='date']:invalid, /* */\\n.jupyter-widget-datepicker input[type='date']:invalid {\\n border-color: var(--jp-warn-color1);\\n}\\n\\n/* */\\n.widget-datepicker input[type='date']:disabled, /* */\\n.jupyter-widget-datepicker input[type='date']:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Play Widget */\\n\\n/* */\\n.widget-play, /* */\\n.jupyter-widget-play {\\n width: var(--jp-widgets-inline-width-short);\\n display: flex;\\n align-items: stretch;\\n}\\n\\n/* */\\n.widget-play .jupyter-button, /* */\\n.jupyter-widget-play .jupyter-button {\\n flex-grow: 1;\\n height: auto;\\n}\\n\\n/* */\\n.widget-play .jupyter-button:disabled, /* */\\n.jupyter-widget-play .jupyter-button:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Tab Widget */\\n\\n/* */\\n.jupyter-widgets.widget-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab {\\n display: flex;\\n flex-direction: column;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar {\\n /* Necessary so that a tab can be shifted down to overlay the border of the box below. */\\n overflow-x: visible;\\n overflow-y: visible;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar > .lm-TabBar-content {\\n /* Make sure that the tab grows from bottom up */\\n align-items: flex-end;\\n min-width: 0;\\n min-height: 0;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .widget-tab-contents, /* */\\n.jupyter-widgets.jupyter-widget-tab > .widget-tab-contents {\\n width: 100%;\\n box-sizing: border-box;\\n margin: 0;\\n background: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n border: var(--jp-border-width) solid var(--jp-border-color1);\\n padding: var(--jp-widgets-container-padding);\\n flex-grow: 1;\\n overflow: auto;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar {\\n font: var(--jp-widgets-font-size) Helvetica, Arial, sans-serif;\\n min-height: calc(\\n var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width)\\n );\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab {\\n flex: 0 1 var(--jp-widgets-horizontal-tab-width);\\n min-width: 35px;\\n min-height: calc(\\n var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width)\\n );\\n line-height: var(--jp-widgets-horizontal-tab-height);\\n margin-left: calc(-1 * var(--jp-border-width));\\n padding: 0px 10px;\\n background: var(--jp-layout-color2);\\n color: var(--jp-ui-font-color2);\\n border: var(--jp-border-width) solid var(--jp-border-color1);\\n border-bottom: none;\\n position: relative;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab.lm-mod-current {\\n color: var(--jp-ui-font-color0);\\n /* We want the background to match the tab content background */\\n background: var(--jp-layout-color1);\\n min-height: calc(\\n var(--jp-widgets-horizontal-tab-height) + 2 * var(--jp-border-width)\\n );\\n transform: translateY(var(--jp-border-width));\\n overflow: visible;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current:before, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current:before, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab.lm-mod-current:before {\\n position: absolute;\\n top: calc(-1 * var(--jp-border-width));\\n left: calc(-1 * var(--jp-border-width));\\n content: '';\\n height: var(--jp-widgets-horizontal-tab-top-border);\\n width: calc(100% + 2 * var(--jp-border-width));\\n background: var(--jp-brand-color1);\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab:first-child, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab:first-child, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab:first-child {\\n margin-left: 0;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar\\n .p-TabBar-tab:hover:not(.p-mod-current),\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .p-TabBar\\n .p-TabBar-tab:hover:not(.p-mod-current),\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar\\n .lm-TabBar-tab:hover:not(.lm-mod-current) {\\n background: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar\\n .p-mod-closable\\n > .p-TabBar-tabCloseIcon,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar\\n.p-mod-closable\\n> .p-TabBar-tabCloseIcon,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar\\n .lm-mod-closable\\n > .lm-TabBar-tabCloseIcon {\\n margin-left: 4px;\\n}\\n\\n/* This font-awesome strategy may not work across FA4 and FA5, but we don't\\nactually support closable tabs, so it really doesn't matter */\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar\\n .p-mod-closable\\n > .p-TabBar-tabCloseIcon:before,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-widget-tab\\n> .p-TabBar\\n.p-mod-closable\\n> .p-TabBar-tabCloseIcon:before,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar\\n .lm-mod-closable\\n > .lm-TabBar-tabCloseIcon:before {\\n font-family: FontAwesome;\\n content: '\\\\f00d'; /* close */\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n/* */ .jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabIcon,\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabLabel,\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabCloseIcon {\\n line-height: var(--jp-widgets-horizontal-tab-height);\\n}\\n\\n/* Accordion Widget */\\n\\n.jupyter-widget-Collapse {\\n display: flex;\\n flex-direction: column;\\n align-items: stretch;\\n}\\n\\n.jupyter-widget-Collapse-header {\\n padding: var(--jp-widgets-input-padding);\\n cursor: pointer;\\n color: var(--jp-ui-font-color2);\\n background-color: var(--jp-layout-color2);\\n border: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n padding: calc(var(--jp-widgets-container-padding) * 2 / 3)\\n var(--jp-widgets-container-padding);\\n font-weight: bold;\\n}\\n\\n.jupyter-widget-Collapse-header:hover {\\n background-color: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n}\\n\\n.jupyter-widget-Collapse-open > .jupyter-widget-Collapse-header {\\n background-color: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color0);\\n cursor: default;\\n border-bottom: none;\\n}\\n\\n.jupyter-widget-Collapse-contents {\\n padding: var(--jp-widgets-container-padding);\\n background-color: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n border-left: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n border-right: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n border-bottom: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n overflow: auto;\\n}\\n\\n.jupyter-widget-Accordion {\\n display: flex;\\n flex-direction: column;\\n align-items: stretch;\\n}\\n\\n.jupyter-widget-Accordion .jupyter-widget-Collapse {\\n margin-bottom: 0;\\n}\\n\\n.jupyter-widget-Accordion .jupyter-widget-Collapse + .jupyter-widget-Collapse {\\n margin-top: 4px;\\n}\\n\\n/* HTML widget */\\n\\n/* */\\n.widget-html, /* */\\n/* */ .widget-htmlmath, /* */\\n.jupyter-widget-html,\\n.jupyter-widget-htmlmath {\\n font-size: var(--jp-widgets-font-size);\\n}\\n\\n/* */\\n.widget-html > .widget-html-content, /* */\\n/* */.widget-htmlmath > .widget-html-content, /* */\\n.jupyter-widget-html > .jupyter-widget-html-content,\\n.jupyter-widget-htmlmath > .jupyter-widget-html-content {\\n /* Fill out the area in the HTML widget */\\n align-self: stretch;\\n flex-grow: 1;\\n flex-shrink: 1;\\n /* Makes sure the baseline is still aligned with other elements */\\n line-height: var(--jp-widgets-inline-height);\\n /* Make it possible to have absolutely-positioned elements in the html */\\n position: relative;\\n}\\n\\n/* Image widget */\\n\\n/* */\\n.widget-image, /* */\\n.jupyter-widget-image {\\n max-width: 100%;\\n height: auto;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","\"use strict\";\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (cssWithMappingToString) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item);\n\n if (item[2]) {\n return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n }\n\n return content;\n }).join(\"\");\n }; // import a list of modules into the list\n // eslint-disable-next-line func-names\n\n\n list.i = function (modules, mediaQuery, dedupe) {\n if (typeof modules === \"string\") {\n // eslint-disable-next-line no-param-reassign\n modules = [[null, modules, \"\"]];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var i = 0; i < this.length; i++) {\n // eslint-disable-next-line prefer-destructuring\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _i = 0; _i < modules.length; _i++) {\n var item = [].concat(modules[_i]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (mediaQuery) {\n if (!item[2]) {\n item[2] = mediaQuery;\n } else {\n item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};","\"use strict\";\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nmodule.exports = function cssWithMappingToString(item) {\n var _item = _slicedToArray(item, 4),\n content = _item[1],\n cssMapping = _item[3];\n\n if (!cssMapping) {\n return content;\n }\n\n if (typeof btoa === \"function\") {\n // eslint-disable-next-line no-undef\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));\n var data = \"sourceMappingURL=data:application/json;charset=utf-8;base64,\".concat(base64);\n var sourceMapping = \"/*# \".concat(data, \" */\");\n var sourceURLs = cssMapping.sources.map(function (source) {\n return \"/*# sourceURL=\".concat(cssMapping.sourceRoot || \"\").concat(source, \" */\");\n });\n return [content].concat(sourceURLs).concat([sourceMapping]).join(\"\\n\");\n }\n\n return [content].join(\"\\n\");\n};","import api from \"!../../../packages/thebe/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../packages/thebe/node_modules/css-loader/dist/cjs.js!./codemirror.css\";\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","import api from \"!../../../packages/thebe/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../packages/thebe/node_modules/css-loader/dist/cjs.js!./abcdef.css\";\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","import api from \"!../../../packages/thebe/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../packages/thebe/node_modules/css-loader/dist/cjs.js!./darcula.css\";\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","import api from \"!../../../packages/thebe/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../packages/thebe/node_modules/css-loader/dist/cjs.js!./idea.css\";\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","\"use strict\";\n\nvar isOldIE = function isOldIE() {\n var memo;\n return function memorize() {\n if (typeof memo === 'undefined') {\n // Test for IE <= 9 as proposed by Browserhacks\n // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n // Tests for existence of standard globals is to allow style-loader\n // to operate correctly into non-standard environments\n // @see https://github.com/webpack-contrib/style-loader/issues/177\n memo = Boolean(window && document && document.all && !window.atob);\n }\n\n return memo;\n };\n}();\n\nvar getTarget = function getTarget() {\n var memo = {};\n return function memorize(target) {\n if (typeof memo[target] === 'undefined') {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDom.length; i++) {\n if (stylesInDom[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var index = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3]\n };\n\n if (index !== -1) {\n stylesInDom[index].references++;\n stylesInDom[index].updater(obj);\n } else {\n stylesInDom.push({\n identifier: identifier,\n updater: addStyle(obj, options),\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction insertStyleElement(options) {\n var style = document.createElement('style');\n var attributes = options.attributes || {};\n\n if (typeof attributes.nonce === 'undefined') {\n var nonce = typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;\n\n if (nonce) {\n attributes.nonce = nonce;\n }\n }\n\n Object.keys(attributes).forEach(function (key) {\n style.setAttribute(key, attributes[key]);\n });\n\n if (typeof options.insert === 'function') {\n options.insert(style);\n } else {\n var target = getTarget(options.insert || 'head');\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n }\n\n return style;\n}\n\nfunction removeStyleElement(style) {\n // istanbul ignore if\n if (style.parentNode === null) {\n return false;\n }\n\n style.parentNode.removeChild(style);\n}\n/* istanbul ignore next */\n\n\nvar replaceText = function replaceText() {\n var textStore = [];\n return function replace(index, replacement) {\n textStore[index] = replacement;\n return textStore.filter(Boolean).join('\\n');\n };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n /* istanbul ignore if */\n\n if (style.styleSheet) {\n style.styleSheet.cssText = replaceText(index, css);\n } else {\n var cssNode = document.createTextNode(css);\n var childNodes = style.childNodes;\n\n if (childNodes[index]) {\n style.removeChild(childNodes[index]);\n }\n\n if (childNodes.length) {\n style.insertBefore(cssNode, childNodes[index]);\n } else {\n style.appendChild(cssNode);\n }\n }\n}\n\nfunction applyToTag(style, options, obj) {\n var css = obj.css;\n var media = obj.media;\n var sourceMap = obj.sourceMap;\n\n if (media) {\n style.setAttribute('media', media);\n } else {\n style.removeAttribute('media');\n }\n\n if (sourceMap && typeof btoa !== 'undefined') {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n while (style.firstChild) {\n style.removeChild(style.firstChild);\n }\n\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n var style;\n var update;\n var remove;\n\n if (options.singleton) {\n var styleIndex = singletonCounter++;\n style = singleton || (singleton = insertStyleElement(options));\n update = applyToSingletonTag.bind(null, style, styleIndex, false);\n remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n } else {\n style = insertStyleElement(options);\n update = applyToTag.bind(null, style, options);\n\n remove = function remove() {\n removeStyleElement(style);\n };\n }\n\n update(obj);\n return function updateStyle(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n return;\n }\n\n update(obj = newObj);\n } else {\n remove();\n }\n };\n}\n\nmodule.exports = function (list, options) {\n options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of