notebook 7.0.0b4__py3-none-any.whl → 7.0.0rc0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of notebook might be problematic. Click here for more details.
- notebook/_version.py +1 -1
- notebook/app.py +17 -13
- notebook/static/1018.bundle.js +1 -1
- notebook/static/1198.bundle.js +1 -1
- notebook/static/1337.bundle.js +1 -1
- notebook/static/134.bundle.js +1 -0
- notebook/static/1408.bundle.js +1 -1
- notebook/static/1584.bundle.js +1 -1
- notebook/static/162.bundle.js +1 -1
- notebook/static/1647.bundle.js +1 -1
- notebook/static/1650.bundle.js +1 -1
- notebook/static/1682.bundle.js +1 -1
- notebook/static/1684.bundle.js +1 -1
- notebook/static/1809.bundle.js +1 -1
- notebook/static/1827.bundle.js +1 -1
- notebook/static/1833.bundle.js +1 -1
- notebook/static/1835.bundle.js +1 -1
- notebook/static/1950.bundle.js +1 -1
- notebook/static/1958.bundle.js +1 -1
- notebook/static/2007.bundle.js +1 -1
- notebook/static/2067.bundle.js +1 -1
- notebook/static/2088.bundle.js +1 -1
- notebook/static/2089.bundle.js +1 -1
- notebook/static/2122.bundle.js +1 -1
- notebook/static/2167.bundle.js +1 -1
- notebook/static/2184.bundle.js +1 -1
- notebook/static/2251.bundle.js +1 -1
- notebook/static/2311.bundle.js +1 -1
- notebook/static/2323.bundle.js +1 -1
- notebook/static/2330.bundle.js +1 -1
- notebook/static/2401.bundle.js +1 -1
- notebook/static/2479.bundle.js +1 -0
- notebook/static/2512.bundle.js +1 -1
- notebook/static/2607.bundle.js +1 -1
- notebook/static/2913.bundle.js +1 -1
- notebook/static/2924.bundle.js +1 -1
- notebook/static/2955.bundle.js +1 -0
- notebook/static/2979.bundle.js +1 -1
- notebook/static/3146.bundle.js +1 -1
- notebook/static/3213.bundle.js +1 -1
- notebook/static/3340.bundle.js +1 -1
- notebook/static/3360.bundle.js +1 -1
- notebook/static/3466.bundle.js +1 -1
- notebook/static/35.bundle.js +1 -1
- notebook/static/3676.bundle.js +1 -1
- notebook/static/3680.bundle.js +1 -1
- notebook/static/3768.bundle.js +1 -1
- notebook/static/377.bundle.js +1 -1
- notebook/static/3797.bundle.js +1 -1
- notebook/static/3863.bundle.js +1 -1
- notebook/static/3881.bundle.js +1 -1
- notebook/static/4042.bundle.js +1 -0
- notebook/static/4131.bundle.js +1 -1
- notebook/static/4205.bundle.js +1 -1
- notebook/static/4212.bundle.js +1 -1
- notebook/static/4234.bundle.js +1 -1
- notebook/static/4382.bundle.js +1 -1
- notebook/static/4558.bundle.js +1 -1
- notebook/static/4645.bundle.js +1 -1
- notebook/static/4746.bundle.js +1 -0
- notebook/static/4785.bundle.js +1 -1
- notebook/static/4810.bundle.js +1 -1
- notebook/static/4811.bundle.js +1 -1
- notebook/static/4837.bundle.js +1 -0
- notebook/static/5016.bundle.js +1 -1
- notebook/static/5088.bundle.js +1 -1
- notebook/static/5099.bundle.js +1 -1
- notebook/static/5125.bundle.js +2 -0
- notebook/static/5135.bundle.js +1 -1
- notebook/static/5261.bundle.js +1 -0
- notebook/static/5313.bundle.js +1 -1
- notebook/static/5325.bundle.js +1 -1
- notebook/static/5346.bundle.js +1 -1
- notebook/static/5426.bundle.js +1 -1
- notebook/static/5573.bundle.js +1 -1
- notebook/static/5601.bundle.js +1 -1
- notebook/static/5678.bundle.js +1 -1
- notebook/static/5733.bundle.js +1 -1
- notebook/static/5765.bundle.js +1 -1
- notebook/static/5777.bundle.js +1 -1
- notebook/static/5828.bundle.js +1 -1
- notebook/static/5912.bundle.js +1 -1
- notebook/static/5921.bundle.js +1 -1
- notebook/static/6017.bundle.js +1 -1
- notebook/static/6027.bundle.js +1 -1
- notebook/static/6139.bundle.js +1 -1
- notebook/static/62.bundle.js +1 -1
- notebook/static/6256.bundle.js +1 -1
- notebook/static/6271.bundle.js +1 -1
- notebook/static/6345.bundle.js +1 -1
- notebook/static/6604.bundle.js +1 -1
- notebook/static/6621.bundle.js +1 -1
- notebook/static/6627.bundle.js +1 -1
- notebook/static/6774.bundle.js +1 -0
- notebook/static/6815.bundle.js +1 -1
- notebook/static/6853.bundle.js +1 -1
- notebook/static/6893.bundle.js +1 -1
- notebook/static/690.bundle.js +1 -0
- notebook/static/6919.bundle.js +3 -3
- notebook/static/6962.bundle.js +1 -1
- notebook/static/6999.bundle.js +1 -1
- notebook/static/7226.bundle.js +1 -1
- notebook/static/7252.bundle.js +1 -0
- notebook/static/7302.bundle.js +1 -1
- notebook/static/7369.bundle.js +1 -1
- notebook/static/7386.bundle.js +1 -1
- notebook/static/7391.bundle.js +1 -1
- notebook/static/7394.bundle.js +1 -1
- notebook/static/7427.bundle.js +1 -0
- notebook/static/7439.bundle.js +1 -1
- notebook/static/7450.bundle.js +1 -1
- notebook/static/7603.bundle.js +1 -1
- notebook/static/7639.bundle.js +1 -1
- notebook/static/7679.bundle.js +1 -0
- notebook/static/7684.bundle.js +1 -1
- notebook/static/7819.bundle.js +1 -1
- notebook/static/7900.bundle.js +1 -0
- notebook/static/7906.bundle.js +1 -1
- notebook/static/7957.bundle.js +1 -1
- notebook/static/7997.bundle.js +1 -1
- notebook/static/8010.bundle.js +1 -1
- notebook/static/8136.bundle.js +1 -1
- notebook/static/8578.bundle.js +1 -1
- notebook/static/8579.bundle.js +1 -1
- notebook/static/8633.bundle.js +1 -1
- notebook/static/8771.bundle.js +1 -1
- notebook/static/880.bundle.js +1 -1
- notebook/static/8845.bundle.js +1 -1
- notebook/static/8845.bundle.js.LICENSE.txt +2 -2
- notebook/static/8875.bundle.js +1 -1
- notebook/static/8907.bundle.js +1 -1
- notebook/static/8914.bundle.js +1 -1
- notebook/static/8928.bundle.js +1 -0
- notebook/static/893.bundle.js +1 -1
- notebook/static/901.bundle.js +1 -1
- notebook/static/9068.bundle.js +1 -1
- notebook/static/9086.bundle.js +1 -1
- notebook/static/9151.bundle.js +1 -1
- notebook/static/9268.bundle.js +1 -1
- notebook/static/9335.bundle.js +1 -1
- notebook/static/9341.bundle.js +1 -1
- notebook/static/9380.bundle.js +1 -1
- notebook/static/9605.bundle.js +1 -1
- notebook/static/9609.bundle.js +1 -1
- notebook/static/9638.bundle.js +1 -1
- notebook/static/9680.bundle.js +1 -0
- notebook/static/9685.bundle.js +1 -0
- notebook/static/9752.bundle.js +1 -1
- notebook/static/9799.bundle.js +1 -1
- notebook/static/9852.bundle.js +1 -1
- notebook/static/9854.bundle.js +2 -0
- notebook/static/bundle.js +1 -1
- notebook/static/third-party-licenses.json +151 -127
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +14 -14
- notebook-7.0.0rc0.data/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +34 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +4 -4
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +9 -9
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +15 -15
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +11 -11
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +10 -10
- notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.a7e9e50b675118021681.js → notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.1b31bd587bea2c1816b1.js +1 -1
- notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/7.d4d2f899a93808dccf3d.js +1 -0
- notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.2aa8888b3e6b5670842f.js → notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.a832439d17633285a072.js +1 -1
- notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.b00379f3c5b2b5eb657f.js +1 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +2 -2
- {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/METADATA +2 -2
- notebook-7.0.0rc0.dist-info/RECORD +389 -0
- {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/WHEEL +1 -1
- notebook/static/2274.bundle.js +0 -1
- notebook/static/3063.bundle.js +0 -2
- notebook/static/3344.bundle.js +0 -1
- notebook/static/4190.bundle.js +0 -1
- notebook/static/435.bundle.js +0 -1
- notebook/static/4964.bundle.js +0 -1
- notebook/static/5282.bundle.js +0 -1
- notebook/static/5975.bundle.js +0 -1
- notebook/static/6695.bundle.js +0 -1
- notebook/static/771.bundle.js +0 -1
- notebook/static/7827.bundle.js +0 -2
- notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/7.9bd87123f72aaa959984.js +0 -1
- notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.ed19884b54327368a389.js +0 -1
- notebook-7.0.0b4.dist-info/RECORD +0 -381
- /notebook/static/{3063.bundle.js.LICENSE.txt → 5125.bundle.js.LICENSE.txt} +0 -0
- /notebook/static/{7827.bundle.js.LICENSE.txt → 9854.bundle.js.LICENSE.txt} +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/applications/jupyter-notebook.desktop +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/776.c7baadfaddfd4518c935.js +0 -0
- {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
- {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/entry_points.txt +0 -0
- {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/licenses/LICENSE +0 -0
notebook/static/7639.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7639,3680],{53680:(e,t,s)=>{s.r(t),s.d(t,{GroupItem:()=>n,IStatusBar:()=>f,Popup:()=>h,ProgressBar:()=>l,ProgressCircle:()=>m,StatusBar:()=>v,TextItem:()=>u,showPopup:()=>d});var i=s(78156),a=s.n(i);function n(e){const{spacing:t,children:s,className:a,...n}=e,r=i.Children.count(s);return i.createElement("div",{className:`jp-StatusBar-GroupItem ${a||""}`,...n},i.Children.map(s,((e,s)=>0===s?i.createElement("div",{style:{marginRight:`${t}px`}},e):s===r-1?i.createElement("div",{style:{marginLeft:`${t}px`}},e):i.createElement("div",{style:{margin:`0px ${t}px`}},e))))}var r=s(
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7639,3680],{53680:(e,t,s)=>{s.r(t),s.d(t,{GroupItem:()=>n,IStatusBar:()=>f,Popup:()=>h,ProgressBar:()=>l,ProgressCircle:()=>m,StatusBar:()=>v,TextItem:()=>u,showPopup:()=>d});var i=s(78156),a=s.n(i);function n(e){const{spacing:t,children:s,className:a,...n}=e,r=i.Children.count(s);return i.createElement("div",{className:`jp-StatusBar-GroupItem ${a||""}`,...n},i.Children.map(s,((e,s)=>0===s?i.createElement("div",{style:{marginRight:`${t}px`}},e):s===r-1?i.createElement("div",{style:{marginLeft:`${t}px`}},e):i.createElement("div",{style:{margin:`0px ${t}px`}},e))))}var r=s(5020),o=s(46947);function d(e){const t=new h(e);return e.startHidden||t.launch(),t}class h extends o.Widget{constructor(e){super(),this._body=e.body,this._body.addClass("jp-StatusBar-HoverItem"),this._anchor=e.anchor,this._align=e.align,e.hasDynamicSize&&(this._observer=new ResizeObserver((()=>{this.update()}))),(this.layout=new o.PanelLayout).addWidget(e.body),this._body.node.addEventListener("resize",(()=>{this.update()}))}launch(){this._setGeometry(),o.Widget.attach(this,document.body),this.update(),this._anchor.addClass("jp-mod-clicked"),this._anchor.removeClass("jp-mod-highlight")}onUpdateRequest(e){this._setGeometry(),super.onUpdateRequest(e)}onAfterAttach(e){var t;document.addEventListener("click",this,!1),this.node.addEventListener("keydown",this,!1),window.addEventListener("resize",this,!1),null===(t=this._observer)||void 0===t||t.observe(this._body.node)}onBeforeDetach(e){var t;null===(t=this._observer)||void 0===t||t.disconnect(),document.removeEventListener("click",this,!1),this.node.removeEventListener("keydown",this,!1),window.removeEventListener("resize",this,!1)}onResize(){this.update()}dispose(){var e;null===(e=this._observer)||void 0===e||e.disconnect(),super.dispose(),this._anchor.removeClass("jp-mod-clicked"),this._anchor.addClass("jp-mod-highlight")}handleEvent(e){switch(e.type){case"keydown":this._evtKeydown(e);break;case"click":this._evtClick(e);break;case"resize":this.onResize()}}_evtClick(e){!e.target||this._body.node.contains(e.target)||this._anchor.node.contains(e.target)||this.dispose()}_evtKeydown(e){27===e.keyCode&&(e.stopPropagation(),e.preventDefault(),this.dispose())}_setGeometry(){let e=0;const t=this._anchor.node.getBoundingClientRect(),s=this._body.node.getBoundingClientRect();"right"===this._align&&(e=-(s.width-t.width));const i=window.getComputedStyle(this._body.node);r.HoverBox.setGeometry({anchor:t,host:document.body,maxHeight:500,minHeight:20,node:this._body.node,offset:{horizontal:e},privilege:"forceAbove",style:i})}}function l(e){const{width:t,percentage:s,...a}=e;return i.createElement("div",{className:"jp-Statusbar-ProgressBar-progress-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s},i.createElement(c,{...{percentage:s,...a},contentWidth:t}))}function c(e){return i.createElement("div",{style:{width:`${e.percentage}%`}},i.createElement("p",null,e.content))}function u(e){const{title:t,source:s,className:a,...n}=e;return i.createElement("span",{className:`jp-StatusBar-TextItem ${a}`,title:t,...n},s)}function m(e){return a().createElement("div",{className:"jp-Statusbar-ProgressCircle",role:"progressbar","aria-label":e.label||"Unlabelled progress circle","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e.progress},a().createElement("svg",{viewBox:"0 0 250 250"},a().createElement("circle",{cx:"125",cy:"125",r:"104",stroke:"var(--jp-inverse-layout-color3)",strokeWidth:"20",fill:"none"}),a().createElement("path",{transform:"translate(125,125) scale(.9)",d:(e=>{const t=Math.max(3.6*e,.1),s=t*Math.PI/180,i=104*Math.sin(s),a=-104*Math.cos(s);return"M 0 0 v -104 A 104 104 1 "+(t<180?1:0)+" 0 "+i.toFixed(4)+" "+a.toFixed(4)+" z"})(e.progress),fill:"var(--jp-inverse-layout-color3)"})))}var p,g=s(20882),_=s(73701);class v extends o.Widget{constructor(){super(),this._leftRankItems=[],this._rightRankItems=[],this._statusItems={},this._disposables=new _.DisposableSet,this.addClass("jp-StatusBar-Widget");const e=this.layout=new o.PanelLayout,t=this._leftSide=new o.Panel,s=this._middlePanel=new o.Panel,i=this._rightSide=new o.Panel;t.addClass("jp-StatusBar-Left"),s.addClass("jp-StatusBar-Middle"),i.addClass("jp-StatusBar-Right"),e.addWidget(t),e.addWidget(s),e.addWidget(i)}registerStatusItem(e,t){if(e in this._statusItems)throw new Error(`Status item ${e} already registered.`);const s={...p.statusItemDefaults,...t},{align:i,item:a,rank:n}=s,r=()=>{this._refreshItem(e)};s.activeStateChanged&&s.activeStateChanged.connect(r);const o={id:e,rank:n};if(s.item.addClass("jp-StatusBar-Item"),this._statusItems[e]=s,"left"===i){const e=this._findInsertIndex(this._leftRankItems,o);-1===e?(this._leftSide.addWidget(a),this._leftRankItems.push(o)):(g.ArrayExt.insert(this._leftRankItems,e,o),this._leftSide.insertWidget(e,a))}else if("right"===i){const e=this._findInsertIndex(this._rightRankItems,o);-1===e?(this._rightSide.addWidget(a),this._rightRankItems.push(o)):(g.ArrayExt.insert(this._rightRankItems,e,o),this._rightSide.insertWidget(e,a))}else this._middlePanel.addWidget(a);this._refreshItem(e);const d=new _.DisposableDelegate((()=>{delete this._statusItems[e],s.activeStateChanged&&s.activeStateChanged.disconnect(r),a.parent=null,a.dispose()}));return this._disposables.add(d),d}dispose(){this._leftRankItems.length=0,this._rightRankItems.length=0,this._disposables.dispose(),super.dispose()}onUpdateRequest(e){this._refreshAll(),super.onUpdateRequest(e)}_findInsertIndex(e,t){return g.ArrayExt.findFirstIndex(e,(e=>e.rank>t.rank))}_refreshItem(e){const t=this._statusItems[e];t.isActive()?(t.item.show(),t.item.update()):t.item.hide()}_refreshAll(){Object.keys(this._statusItems).forEach((e=>{this._refreshItem(e)}))}}!function(e){e.statusItemDefaults={align:"left",rank:0,isActive:()=>!0,activeStateChanged:void 0}}(p||(p={}));const f=new(s(49501).Token)("@jupyterlab/statusbar:IStatusBar","A service for the status bar on the application. Use this if you want to add new status bar items.")}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7679],{66139:(e,t,n)=>{function $(e){return new RegExp("^(("+e.join(")|(")+"))\\b","i")}n.r(t),n.d(t,{mumps:()=>l});var a=new RegExp("^[\\+\\-\\*/&#!_?\\\\<>=\\'\\[\\]]"),o=new RegExp("^(('=)|(<=)|(>=)|('>)|('<)|([[)|(]])|(^$))"),r=new RegExp("^[\\.,:]"),c=new RegExp("[()]"),m=new RegExp("^[%A-Za-z][A-Za-z0-9]*"),s=$(["\\$ascii","\\$char","\\$data","\\$ecode","\\$estack","\\$etrap","\\$extract","\\$find","\\$fnumber","\\$get","\\$horolog","\\$io","\\$increment","\\$job","\\$justify","\\$length","\\$name","\\$next","\\$order","\\$piece","\\$qlength","\\$qsubscript","\\$query","\\$quit","\\$random","\\$reverse","\\$select","\\$stack","\\$test","\\$text","\\$translate","\\$view","\\$x","\\$y","\\$a","\\$c","\\$d","\\$e","\\$ec","\\$es","\\$et","\\$f","\\$fn","\\$g","\\$h","\\$i","\\$j","\\$l","\\$n","\\$na","\\$o","\\$p","\\$q","\\$ql","\\$qs","\\$r","\\$re","\\$s","\\$st","\\$t","\\$tr","\\$v","\\$z"]),i=$(["break","close","do","else","for","goto","halt","hang","if","job","kill","lock","merge","new","open","quit","read","set","tcommit","trollback","tstart","use","view","write","xecute","b","c","d","e","f","g","h","i","j","k","l","m","n","o","q","r","s","tc","tro","ts","u","v","w","x"]);const l={name:"mumps",startState:function(){return{label:!1,commandMode:0}},token:function(e,t){var n=function(e,t){e.sol()&&(t.label=!0,t.commandMode=0);var n=e.peek();return" "==n||"\t"==n?(t.label=!1,0==t.commandMode?t.commandMode=1:(t.commandMode<0||2==t.commandMode)&&(t.commandMode=0)):"."!=n&&t.commandMode>0&&(t.commandMode=":"==n?-1:2),"("!==n&&"\t"!==n||(t.label=!1),";"===n?(e.skipToEnd(),"comment"):e.match(/^[-+]?\d+(\.\d+)?([eE][-+]?\d+)?/)?"number":'"'==n?e.skipTo('"')?(e.next(),"string"):(e.skipToEnd(),"error"):e.match(o)||e.match(a)?"operator":e.match(r)?null:c.test(n)?(e.next(),"bracket"):t.commandMode>0&&e.match(i)?"controlKeyword":e.match(s)?"builtin":e.match(m)?"variable":"$"===n||"^"===n?(e.next(),"builtin"):"@"===n?(e.next(),"string.special"):/[\w%]/.test(n)?(e.eatWhile(/[\w%]/),"variable"):(e.next(),"error")}(e,t);return t.label?"tag":n}}}}]);
|
notebook/static/7684.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7684,6893],{56893:(t,e,o)=>{o.r(e),o.d(e,{CommandIDs:()=>n,default:()=>i});var n,a=o(
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7684,6893],{56893:(t,e,o)=>{o.r(e),o.d(e,{CommandIDs:()=>n,default:()=>i});var n,a=o(5452),r=o(25314),u=o(8630),s=o(6614);!function(t){t.controlPanel="hub:control-panel",t.logout="hub:logout",t.restart="hub:restart"}(n||(n={}));const i=[{activate:function(t,e,o,a){const r=o.load("jupyterlab"),s=e.urls.hubHost||"",i=e.urls.hubPrefix||"",l=e.urls.hubUser||"",c=e.urls.hubServerName||"",d=e.urls.base;if(!i)return;console.debug("hub-extension: Found configuration ",{hubHost:s,hubPrefix:i});const b=c?s+u.URLExt.join(i,"spawn",l,c):s+u.URLExt.join(i,"spawn"),{commands:h}=t;if(h.addCommand(n.restart,{label:r.__("Restart Server"),caption:r.__("Request that the Hub restart this server"),execute:()=>{window.open(b,"_blank")}}),h.addCommand(n.controlPanel,{label:r.__("Hub Control Panel"),caption:r.__("Open the Hub control panel in a new browser tab"),execute:()=>{window.open(s+u.URLExt.join(i,"home"),"_blank")}}),h.addCommand(n.logout,{label:r.__("Log Out"),caption:r.__("Log out of the Hub"),execute:()=>{window.location.href=s+u.URLExt.join(d,"logout")}}),a){const t=r.__("Hub");a.addItem({category:t,command:n.controlPanel}),a.addItem({category:t,command:n.logout})}},id:"@jupyterlab/hub-extension:plugin",description:"Registers commands related to the hub server",requires:[a.JupyterFrontEnd.IPaths,s.ITranslator],optional:[r.ICommandPalette],autoStart:!0},{activate:()=>{},id:"@jupyterlab/hub-extension:menu",description:"Adds hub related commands to the menu.",autoStart:!0},{id:"@jupyterlab/hub-extension:connectionlost",description:"Provides a service to be notified when the connection to the hub server is lost.",requires:[a.JupyterFrontEnd.IPaths,s.ITranslator],optional:[a.JupyterLab.IInfo],activate:(t,e,o,u)=>{const s=o.load("jupyterlab"),i=e.urls.hubPrefix||"",l=e.urls.base;if(!i)return a.ConnectionLost;let c=!1;return async(e,o)=>{if(c)return;c=!0,u&&(u.isConnected=!1);const a=await(0,r.showDialog)({title:s.__("Server unavailable or unreachable"),body:s.__("Your server at %1 is not running.\nWould you like to restart it?",l),buttons:[r.Dialog.okButton({label:s.__("Restart")}),r.Dialog.cancelButton({label:s.__("Dismiss")})]});u&&(u.isConnected=!0),c=!1,a.button.accept&&await t.commands.execute(n.restart)}},autoStart:!0,provides:a.IConnectionLost}]}}]);
|
notebook/static/7819.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7819],{57819:(t,e,r)=>{function n(t){return t.replace("-","_")}r.r(e),r.d(e,{Gettext:()=>s,ITranslator:()=>p,ITranslatorConnector:()=>_,TranslationManager:()=>d,TranslatorConnector:()=>g,nullTranslator:()=>a,requestTranslationsAPI:()=>h});class s{constructor(t){t=t||{},this._defaults={domain:"messages",locale:document.documentElement.getAttribute("lang")||"en",pluralFunc:function(t){return{nplurals:2,plural:1!=t?1:0}},contextDelimiter:String.fromCharCode(4),stringsPrefix:""},this._locale=(t.locale||this._defaults.locale).replace("_","-"),this._domain=n(t.domain||this._defaults.domain),this._contextDelimiter=t.contextDelimiter||this._defaults.contextDelimiter,this._stringsPrefix=t.stringsPrefix||this._defaults.stringsPrefix,this._pluralFuncs={},this._dictionary={},this._pluralForms={},t.messages&&(this._dictionary[this._domain]={},this._dictionary[this._domain][this._locale]=t.messages),t.pluralForms&&(this._pluralForms[this._locale]=t.pluralForms)}setContextDelimiter(t){this._contextDelimiter=t}getContextDelimiter(){return this._contextDelimiter}setLocale(t){this._locale=t.replace("_","-")}getLocale(){return this._locale}setDomain(t){this._domain=n(t)}getDomain(){return this._domain}setStringsPrefix(t){this._stringsPrefix=t}getStringsPrefix(){return this._stringsPrefix}static strfmt(t,...e){return t.replace(/%%/g,"%% ").replace(/%(\d+)/g,(function(t,r){return e[r-1]})).replace(/%% /g,"%")}loadJSON(t,e){if(!t[""]||!t[""].language||!t[""].pluralForms)throw new Error(`Wrong jsonData, it must have an empty key ("") with "language" and "pluralForms" information: ${t}`);e=n(e);let r=t[""],s=JSON.parse(JSON.stringify(t));delete s[""],this.setMessages(e||this._defaults.domain,r.language,s,r.pluralForms)}__(t,...e){return this.gettext(t,...e)}_n(t,e,r,...n){return this.ngettext(t,e,r,...n)}_p(t,e,...r){return this.pgettext(t,e,...r)}_np(t,e,r,n,...s){return this.npgettext(t,e,r,n,...s)}gettext(t,...e){return this.dcnpgettext("","",t,"",0,...e)}ngettext(t,e,r,...n){return this.dcnpgettext("","",t,e,r,...n)}pgettext(t,e,...r){return this.dcnpgettext("",t,e,"",0,...r)}npgettext(t,e,r,n,...s){return this.dcnpgettext("",t,e,r,n,...s)}dcnpgettext(t,e,r,s,a,...i){let l;t=n(t)||this._domain;let o=e?e+this._contextDelimiter+r:r,u={pluralForm:!1},c=!1,h=this._locale,_=this.expandLocale(this._locale);for(let e in _)if(h=_[e],c=this._dictionary[t]&&this._dictionary[t][h]&&this._dictionary[t][h][o],c=s?c&&this._dictionary[t][h][o].length>1:c&&1==this._dictionary[t][h][o].length,c){u.locale=h;break}if(c?l=this._dictionary[t][h][o]:(l=[r],u.pluralFunc=this._defaults.pluralFunc),!s)return this.t(l,a,u,...i);u.pluralForm=!0;let g=c?l:[r,s];return this.t(g,a,u,...i)}expandLocale(t){let e=[t],r=t.lastIndexOf("-");for(;r>0;)t=t.slice(0,r),e.push(t),r=t.lastIndexOf("-");return e}getPluralFunc(t){if(!new RegExp("^\\s*nplurals\\s*=\\s*[0-9]+\\s*;\\s*plural\\s*=\\s*(?:\\s|[-\\?\\|&=!<>+*/%:;n0-9_()])+").test(t))throw new Error(s.strfmt('The plural form "%1" is not valid',t));return new Function("n","let plural, nplurals; "+t+" return { nplurals: nplurals, plural: (plural === true ? 1 : (plural ? plural : 0)) };")}removeContext(t){return-1!==t.indexOf(this._contextDelimiter)?t.split(this._contextDelimiter)[1]:t}t(t,e,r,...n){if(!r.pluralForm)return this._stringsPrefix+s.strfmt(this.removeContext(t[0]),...n);let a;return r.pluralFunc?a=r.pluralFunc(e):(this._pluralFuncs[r.locale||""]||(this._pluralFuncs[r.locale||""]=this.getPluralFunc(this._pluralForms[r.locale||""])),a=this._pluralFuncs[r.locale||""](e)),(void 0===!a.plural||a.plural>a.nplurals||t.length<=a.plural)&&(a.plural=0),this._stringsPrefix+s.strfmt(this.removeContext(t[a.plural]),...[e].concat(n))}setMessages(t,e,r,s){t=n(t),s&&(this._pluralForms[e]=s),this._dictionary[t]||(this._dictionary[t]={}),this._dictionary[t][e]=r}}const a=new class{constructor(t){this.languageCode="en",this._languageBundle=t}load(t){return this._languageBundle}}(new class{__(t,...e){return this.gettext(t,...e)}_n(t,e,r,...n){return this.ngettext(t,e,r,...n)}_p(t,e,...r){return this.pgettext(t,e,...r)}_np(t,e,r,n,...s){return this.npgettext(t,e,r,n,...s)}gettext(t,...e){return s.strfmt(t,...e)}ngettext(t,e,r,...n){return s.strfmt(1==r?t:e,...[r].concat(n))}pgettext(t,e,...r){return s.strfmt(e,...r)}npgettext(t,e,r,n,...s){return this.ngettext(e,r,n,...s)}dcnpgettext(t,e,r,n,s,...a){return this.ngettext(r,n,s,...a)}});var i=r(
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7819],{57819:(t,e,r)=>{function n(t){return t.replace("-","_")}r.r(e),r.d(e,{Gettext:()=>s,ITranslator:()=>p,ITranslatorConnector:()=>_,TranslationManager:()=>d,TranslatorConnector:()=>g,nullTranslator:()=>a,requestTranslationsAPI:()=>h});class s{constructor(t){t=t||{},this._defaults={domain:"messages",locale:document.documentElement.getAttribute("lang")||"en",pluralFunc:function(t){return{nplurals:2,plural:1!=t?1:0}},contextDelimiter:String.fromCharCode(4),stringsPrefix:""},this._locale=(t.locale||this._defaults.locale).replace("_","-"),this._domain=n(t.domain||this._defaults.domain),this._contextDelimiter=t.contextDelimiter||this._defaults.contextDelimiter,this._stringsPrefix=t.stringsPrefix||this._defaults.stringsPrefix,this._pluralFuncs={},this._dictionary={},this._pluralForms={},t.messages&&(this._dictionary[this._domain]={},this._dictionary[this._domain][this._locale]=t.messages),t.pluralForms&&(this._pluralForms[this._locale]=t.pluralForms)}setContextDelimiter(t){this._contextDelimiter=t}getContextDelimiter(){return this._contextDelimiter}setLocale(t){this._locale=t.replace("_","-")}getLocale(){return this._locale}setDomain(t){this._domain=n(t)}getDomain(){return this._domain}setStringsPrefix(t){this._stringsPrefix=t}getStringsPrefix(){return this._stringsPrefix}static strfmt(t,...e){return t.replace(/%%/g,"%% ").replace(/%(\d+)/g,(function(t,r){return e[r-1]})).replace(/%% /g,"%")}loadJSON(t,e){if(!t[""]||!t[""].language||!t[""].pluralForms)throw new Error(`Wrong jsonData, it must have an empty key ("") with "language" and "pluralForms" information: ${t}`);e=n(e);let r=t[""],s=JSON.parse(JSON.stringify(t));delete s[""],this.setMessages(e||this._defaults.domain,r.language,s,r.pluralForms)}__(t,...e){return this.gettext(t,...e)}_n(t,e,r,...n){return this.ngettext(t,e,r,...n)}_p(t,e,...r){return this.pgettext(t,e,...r)}_np(t,e,r,n,...s){return this.npgettext(t,e,r,n,...s)}gettext(t,...e){return this.dcnpgettext("","",t,"",0,...e)}ngettext(t,e,r,...n){return this.dcnpgettext("","",t,e,r,...n)}pgettext(t,e,...r){return this.dcnpgettext("",t,e,"",0,...r)}npgettext(t,e,r,n,...s){return this.dcnpgettext("",t,e,r,n,...s)}dcnpgettext(t,e,r,s,a,...i){let l;t=n(t)||this._domain;let o=e?e+this._contextDelimiter+r:r,u={pluralForm:!1},c=!1,h=this._locale,_=this.expandLocale(this._locale);for(let e in _)if(h=_[e],c=this._dictionary[t]&&this._dictionary[t][h]&&this._dictionary[t][h][o],c=s?c&&this._dictionary[t][h][o].length>1:c&&1==this._dictionary[t][h][o].length,c){u.locale=h;break}if(c?l=this._dictionary[t][h][o]:(l=[r],u.pluralFunc=this._defaults.pluralFunc),!s)return this.t(l,a,u,...i);u.pluralForm=!0;let g=c?l:[r,s];return this.t(g,a,u,...i)}expandLocale(t){let e=[t],r=t.lastIndexOf("-");for(;r>0;)t=t.slice(0,r),e.push(t),r=t.lastIndexOf("-");return e}getPluralFunc(t){if(!new RegExp("^\\s*nplurals\\s*=\\s*[0-9]+\\s*;\\s*plural\\s*=\\s*(?:\\s|[-\\?\\|&=!<>+*/%:;n0-9_()])+").test(t))throw new Error(s.strfmt('The plural form "%1" is not valid',t));return new Function("n","let plural, nplurals; "+t+" return { nplurals: nplurals, plural: (plural === true ? 1 : (plural ? plural : 0)) };")}removeContext(t){return-1!==t.indexOf(this._contextDelimiter)?t.split(this._contextDelimiter)[1]:t}t(t,e,r,...n){if(!r.pluralForm)return this._stringsPrefix+s.strfmt(this.removeContext(t[0]),...n);let a;return r.pluralFunc?a=r.pluralFunc(e):(this._pluralFuncs[r.locale||""]||(this._pluralFuncs[r.locale||""]=this.getPluralFunc(this._pluralForms[r.locale||""])),a=this._pluralFuncs[r.locale||""](e)),(void 0===!a.plural||a.plural>a.nplurals||t.length<=a.plural)&&(a.plural=0),this._stringsPrefix+s.strfmt(this.removeContext(t[a.plural]),...[e].concat(n))}setMessages(t,e,r,s){t=n(t),s&&(this._pluralForms[e]=s),this._dictionary[t]||(this._dictionary[t]={}),this._dictionary[t][e]=r}}const a=new class{constructor(t){this.languageCode="en",this._languageBundle=t}load(t){return this._languageBundle}}(new class{__(t,...e){return this.gettext(t,...e)}_n(t,e,r,...n){return this.ngettext(t,e,r,...n)}_p(t,e,...r){return this.pgettext(t,e,...r)}_np(t,e,r,n,...s){return this.npgettext(t,e,r,n,...s)}gettext(t,...e){return s.strfmt(t,...e)}ngettext(t,e,r,...n){return s.strfmt(1==r?t:e,...[r].concat(n))}pgettext(t,e,...r){return s.strfmt(e,...r)}npgettext(t,e,r,n,...s){return this.ngettext(e,r,n,...s)}dcnpgettext(t,e,r,n,s,...a){return this.ngettext(r,n,s,...a)}});var i=r(22731),l=r(49501),o=r(8630),u=r(92881);const c="api/translations";async function h(t="",e="",r={},n=void 0){const s=null!=n?n:u.ServerConnection.makeSettings();t=t||`${s.appUrl}/${c}`;const a=o.URLExt.join(s.baseUrl,t,e);let i;try{i=await u.ServerConnection.makeRequest(a,r,s)}catch(t){throw new u.ServerConnection.NetworkError(t)}let l=await i.text();if(l.length>0)try{l=JSON.parse(l)}catch(t){console.error("Not a JSON response body.",i)}if(!i.ok)throw new u.ServerConnection.ResponseError(i,l.message||l);return l}const _=new l.Token("@jupyterlab/translation:ITranslatorConnector","A service to connect to the server translation endpoint.");class g extends i.DataConnector{constructor(t="",e){super(),this._translationsUrl=t,this._serverSettings=e}async fetch(t){return h(this._translationsUrl,t.language,{},this._serverSettings)}}const p=new l.Token("@jupyterlab/translation:ITranslator","A service to translate strings.");class d{constructor(t="",e,r){this._domainData={},this._translationBundles={},this._connector=new g(t,r),this._stringsPrefix=e||"",this._englishBundle=new s({stringsPrefix:this._stringsPrefix})}get languageCode(){return this._currentLocale}async fetch(t){var e,r,n,s;if(this._languageData=await this._connector.fetch({language:t}),this._languageData&&"default"===t)try{for(const t of Object.values(null!==(e=this._languageData.data)&&void 0!==e?e:{})){this._currentLocale=t[""].language.replace("_","-");break}}catch(t){this._currentLocale="en"}else this._currentLocale=t;this._domainData=null!==(n=null===(r=this._languageData)||void 0===r?void 0:r.data)&&void 0!==n?n:{};const a=null===(s=this._languageData)||void 0===s?void 0:s.message;a&&"en"!==t&&console.warn(a)}load(t){if(this._domainData){if("en"==this._currentLocale)return this._englishBundle;if(!((t=n(t))in this._translationBundles)){let e=new s({domain:t,locale:this._currentLocale,stringsPrefix:this._stringsPrefix});if(t in this._domainData){let r=this._domainData[t][""];"plural_forms"in r&&(r.pluralForms=r.plural_forms,delete r.plural_forms,this._domainData[t][""]=r),e.loadJSON(this._domainData[t],t)}this._translationBundles[t]=e}return this._translationBundles[t]}return this._englishBundle}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7900,8928],{67900:(t,e,i)=>{i.r(e),i.d(e,{IImageTracker:()=>r,ImageViewer:()=>l,ImageViewerFactory:()=>d});var s=i(49501);const r=new s.Token("@jupyterlab/imageviewer:IImageTracker","A widget tracker for images.\n Use this if you want to be able to iterate over and interact with images\n viewed by the application.");var a,o=i(8630),n=i(25314),c=i(64846),h=i(46947);class l extends h.Widget{constructor(t){super(),this._scale=1,this._matrix=[1,0,0,1],this._colorinversion=0,this._ready=new s.PromiseDelegate,this.context=t,this.node.tabIndex=0,this.addClass("jp-ImageViewer"),this._img=document.createElement("img"),this.node.appendChild(this._img),this._onTitleChanged(),t.pathChanged.connect(this._onTitleChanged,this),t.ready.then((()=>{if(this.isDisposed)return;const e=t.contentsModel;this._mimeType=e.mimetype,this._render(),t.model.contentChanged.connect(this.update,this),t.fileChanged.connect(this.update,this),this._ready.resolve(void 0)}))}[n.Printing.symbol](){return()=>n.Printing.printWidget(this)}get ready(){return this._ready.promise}get scale(){return this._scale}set scale(t){t!==this._scale&&(this._scale=t,this._updateStyle())}get colorinversion(){return this._colorinversion}set colorinversion(t){t!==this._colorinversion&&(this._colorinversion=t,this._updateStyle())}dispose(){this._img.src&&URL.revokeObjectURL(this._img.src||""),super.dispose()}resetRotationFlip(){this._matrix=[1,0,0,1],this._updateStyle()}rotateCounterclockwise(){this._matrix=a.prod(this._matrix,a.rotateCounterclockwiseMatrix),this._updateStyle()}rotateClockwise(){this._matrix=a.prod(this._matrix,a.rotateClockwiseMatrix),this._updateStyle()}flipHorizontal(){this._matrix=a.prod(this._matrix,a.flipHMatrix),this._updateStyle()}flipVertical(){this._matrix=a.prod(this._matrix,a.flipVMatrix),this._updateStyle()}onUpdateRequest(t){!this.isDisposed&&this.context.isReady&&this._render()}onActivateRequest(t){this.node.focus()}_onTitleChanged(){this.title.label=o.PathExt.basename(this.context.localPath)}_render(){const t=this.context,e=t.contentsModel;if(!e)return;const i=this._img.src||"";let s=t.model.toString();if("base64"===e.format)this._img.src=`data:${this._mimeType};base64,${s}`;else{const t=new Blob([s],{type:this._mimeType});this._img.src=URL.createObjectURL(t)}URL.revokeObjectURL(i)}_updateStyle(){const[t,e,i,s]=this._matrix,[r,o]=a.prodVec(this._matrix,[1,1]),n=`matrix(${t}, ${e}, ${i}, ${s}, 0, 0) translate(${r<0?-100:0}%, ${o<0?-100:0}%) `;this._img.style.transform=`scale(${this._scale}) ${n}`,this._img.style.filter=`invert(${this._colorinversion})`}}class d extends c.ABCWidgetFactory{createNewWidget(t){const e=new l(t);return new c.DocumentWidget({content:e,context:t})}}!function(t){t.prod=function([t,e,i,s],[r,a,o,n]){return[t*r+e*o,t*a+e*n,i*r+s*o,i*a+s*n]},t.prodVec=function([t,e,i,s],[r,a]){return[t*r+e*a,i*r+s*a]},t.rotateClockwiseMatrix=[0,1,-1,0],t.rotateCounterclockwiseMatrix=[0,-1,1,0],t.flipHMatrix=[-1,0,0,1],t.flipVMatrix=[1,0,0,-1]}(a||(a={}))}}]);
|
notebook/static/7906.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7906,4382],{54382:(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var n=r(
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7906,4382],{54382:(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var n=r(22459),o=r(72231);const c="jp-mod-searchable",a=[{id:"@jupyter-notebook/documentsearch-extension:notebookShellWidgetListener",requires:[o.INotebookShell,n.ISearchProviderRegistry],autoStart:!0,activate:(e,t,r)=>{const n=e=>{e&&(r.hasProvider(e)?e.addClass(c):e.removeClass(c))};r.changed.connect((()=>n(t.currentWidget))),t.currentChanged.connect(((e,r)=>{t.currentWidget&&n(t.currentWidget)}))}}]}}]);
|
notebook/static/7957.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7957],{79504:(t,e,n)=>{"use strict";n.d(e,{Dp:()=>i,G:()=>o,JJ:()=>c,Z$:()=>r,kJ:()=>l,s7:()=>s});const r=t=>t[t.length-1],s=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},i=Array.from,o=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},c=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},l=Array.isArray},38828:(t,e,n)=>{"use strict";n.d(e,{Hi:()=>o,PP:()=>s,gB:()=>c,id:()=>i});var r=n(36498);const s=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&s(t,e,n+1)}},i=t=>t,o=(t,e)=>{if(null==t||null==e)return((t,e)=>t===e)(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break;case Set:if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break;case Map:if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!o(t.get(n),e.get(n)))return!1;break;case Object:if(r.kE(t)!==r.kE(e))return!1;for(const n in t)if(!r.l$(t,n)||!o(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!o(t[n],e[n]))return!1;break;default:return!1}return!0},c=(t,e)=>e.includes(t)},22592:(t,e,n)=>{"use strict";n.d(e,{JG:()=>s,UI:()=>o,Ue:()=>r,Yj:()=>c,Yu:()=>i});const r=()=>new Map,s=t=>{const e=r();return t.forEach(((t,n)=>{e.set(n,t)})),e},i=(t,e,n)=>{let r=t.get(e);return void 0===r&&t.set(e,r=n()),r},o=(t,e)=>{const n=[];for(const[r,s]of t)n.push(e(s,r));return n},c=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1}},11182:(t,e,n)=>{"use strict";n.d(e,{Fp:()=>o,GR:()=>c,GW:()=>r,VV:()=>i,Wn:()=>s});const r=Math.floor,s=(Math.ceil,Math.abs),i=(Math.imul,Math.round,Math.log10,Math.log2,Math.log,Math.sqrt,(t,e)=>t<e?t:e),o=(t,e)=>t>e?t:e,c=(Number.isNaN,Math.pow,Math.sign,t=>0!==t?t<0:1/t<0)},36498:(t,e,n)=>{"use strict";n.d(e,{$m:()=>h,Ed:()=>i,f0:()=>r,kE:()=>o,l$:()=>l,xb:()=>c});const r=Object.assign,s=Object.keys,i=(t,e)=>{for(const n in t)e(t[n],n)},o=t=>s(t).length,c=t=>{for(const e in t)return!1;return!0},l=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),h=(t,e)=>t===e||o(t)===o(e)&&((t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0})(t,((t,n)=>(void 0!==t||l(e,n))&&e[n]===t))},12330:(t,e,n)=>{"use strict";n.d(e,{y:()=>o});var r=n(22592),s=n(79287),i=n(79504);class o{constructor(){this._observers=r.Ue()}on(t,e){r.Yu(this._observers,t,s.Ue).add(e)}once(t,e){const n=(...r)=>{this.off(t,n),e(...r)};this.on(t,n)}off(t,e){const n=this._observers.get(t);void 0!==n&&(n.delete(e),0===n.size&&this._observers.delete(t))}emit(t,e){return i.Dp((this._observers.get(t)||r.Ue()).values()).forEach((t=>t(...e)))}destroy(){this._observers=r.Ue()}}},79287:(t,e,n)=>{"use strict";n.d(e,{Ue:()=>r});const r=()=>new Set},2431:(t,e,n)=>{"use strict";n.d(e,{ZG:()=>r});const r=Date.now},27061:t=>{var e,n,r=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(t){if(e===setTimeout)return setTimeout(t,0);if((e===s||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:s}catch(t){e=s}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(t){n=i}}();var c,l=[],h=!1,a=-1;function d(){h&&c&&(h=!1,c.length?l=c.concat(l):a=-1,l.length&&u())}function u(){if(!h){var t=o(d);h=!0;for(var e=l.length;e;){for(c=l,l=[];++a<e;)c&&c[a].run();a=-1,e=l.length}c=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{return n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function f(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];l.push(new g(t,e)),1!==l.length||h||o(u)},g.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=f,r.addListener=f,r.once=f,r.off=f,r.removeListener=f,r.removeAllListeners=f,r.emit=f,r.prependListener=f,r.prependOnceListener=f,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},67957:(t,e,n)=>{"use strict";n.r(e),n.d(e,{AbsolutePosition:()=>je,AbstractConnector:()=>$t,AbstractStruct:()=>ts,AbstractType:()=>ar,Array:()=>Mr,ContentAny:()=>hs,ContentBinary:()=>ns,ContentDeleted:()=>rs,ContentEmbed:()=>os,ContentFormat:()=>cs,ContentJSON:()=>ls,ContentString:()=>as,ContentType:()=>ys,Doc:()=>ie,GC:()=>es,ID:()=>Me,Item:()=>Ds,Map:()=>Or,PermanentUserData:()=>Ve,RelativePosition:()=>Je,Snapshot:()=>Ke,Text:()=>Br,Transaction:()=>kn,UndoManager:()=>Mn,UpdateEncoderV1:()=>de,XmlElement:()=>Xr,XmlFragment:()=>Kr,XmlHook:()=>qr,XmlText:()=>Qr,YArrayEvent:()=>Tr,YEvent:()=>er,YMapEvent:()=>xr,YTextEvent:()=>zr,YXmlEvent:()=>Zr,applyUpdate:()=>ke,applyUpdateV2:()=>me,cleanupYTextFormatting:()=>Yr,compareIDs:()=>xe,compareRelativePositions:()=>He,convertUpdateFormatV1ToV2:()=>Qn,convertUpdateFormatV2ToV1:()=>tr,createAbsolutePositionFromRelativePosition:()=>Be,createDeleteSet:()=>Qt,createDeleteSetFromStructStore:()=>te,createDocFromSnapshot:()=>cn,createID:()=>Oe,createRelativePositionFromJSON:()=>We,createRelativePositionFromTypeIndex:()=>Ye,createSnapshot:()=>en,decodeRelativePosition:()=>ze,decodeSnapshot:()=>tn,decodeSnapshotV2:()=>Qe,decodeStateVector:()=>Se,decodeUpdate:()=>Nn,decodeUpdateV2:()=>Ln,diffUpdate:()=>$n,diffUpdateV2:()=>Yn,emptySnapshot:()=>nn,encodeRelativePosition:()=>$e,encodeSnapshot:()=>qe,encodeSnapshotV2:()=>Ze,encodeStateAsUpdate:()=>be,encodeStateAsUpdateV2:()=>ye,encodeStateVector:()=>Ce,encodeStateVectorFromUpdate:()=>Jn,encodeStateVectorFromUpdateV2:()=>Vn,equalSnapshots:()=>Xe,findIndexSS:()=>un,findRootTypeKey:()=>Le,getItem:()=>gn,getState:()=>an,getTypeChildren:()=>lr,isDeleted:()=>Kt,isParentOf:()=>Re,iterateDeletedStructs:()=>Ht,logType:()=>Pe,logUpdate:()=>On,logUpdateV2:()=>In,mergeUpdates:()=>Pn,mergeUpdatesV2:()=>Gn,obfuscateUpdate:()=>Zn,obfuscateUpdateV2:()=>qn,parseUpdateMeta:()=>Wn,parseUpdateMetaV2:()=>Fn,readUpdate:()=>we,readUpdateV2:()=>pe,relativePositionToJSON:()=>Fe,snapshot:()=>rn,transact:()=>vn,tryGc:()=>Cn,typeListToArraySnapshot:()=>gr,typeMapGetSnapshot:()=>Ar});var r=n(12330),s=n(79504),i=n(11182),o=n(22592);String.fromCharCode,String.fromCodePoint;const c=/^\s*/g,l=/([A-Z])/g,h=(t,e)=>(t=>t.replace(c,""))(t.replace(l,(t=>`${e}${(t=>t.toLowerCase())(t)}`))),a="undefined"!=typeof TextEncoder?new TextEncoder:null,d=a?t=>a.encode(t):t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let t=0;t<n;t++)r[t]=e.codePointAt(t);return r};let u="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});u&&1===u.decode(new Uint8Array).length&&(u=null);let g=new class{constructor(){this.map=new Map}setItem(t,e){this.map.set(t,e)}getItem(t){return this.map.get(t)}},f=!0;try{"undefined"!=typeof localStorage&&(g=localStorage,f=!1)}catch(t){}const p=g;var w=n(38828),m=n(27061);const k=void 0!==m&&m.release&&/node|io\.js/.test(m.release.name);let y;"undefined"!=typeof navigator&&/Mac/.test(navigator.platform);const b=[],_=t=>(()=>{if(void 0===y)if(k){y=o.Ue();const t=m.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];"-"===r[0]?(null!==e&&y.set(e,""),e=r):null!==e?(y.set(e,r),e=null):b.push(r)}null!==e&&y.set(e,"")}else"object"==typeof location?(y=o.Ue(),(location.search||"?").slice(1).split("&").forEach((t=>{if(0!==t.length){const[e,n]=t.split("=");y.set(`--${h(e,"-")}`,n),y.set(`-${h(e,"-")}`,n)}}))):y=o.Ue();return y})().has(t),S=t=>{return void 0===(e=k?m.env[t.toUpperCase()]:p.getItem(t))?null:e;var e};_("--"+"production")||S("production");const E=k&&w.gB(m.env.FORCE_COLOR,["true","1","2"]),C=!_("no-colors")&&(!k||m.stdout.isTTY||E)&&(!k||_("color")||E||null!==S("COLORTERM")||(S("TERM")||"").includes("color")),D=(t,e,n)=>new Uint8Array(t,e,n),v=64,A=128,U=127,T=Number.MAX_SAFE_INTEGER,M=(Number.MIN_SAFE_INTEGER,Number.isInteger||(t=>"number"==typeof t&&isFinite(t)&&i.GW(t)===t));Number.isNaN,Number.parseInt;class x{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const O=()=>new x,I=t=>{const e=new Uint8Array((t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e})(t));let n=0;for(let r=0;r<t.bufs.length;r++){const s=t.bufs[r];e.set(s,n),n+=s.length}return e.set(D(t.cbuf.buffer,0,t.cpos),n),e},N=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(2*n),t.cpos=0),t.cbuf[t.cpos++]=e},L=N,R=(t,e)=>{for(;e>U;)N(t,A|U&e),e=i.GW(e/128);N(t,U&e)},P=(t,e)=>{const n=i.GR(e);for(n&&(e=-e),N(t,(e>63?A:0)|(n?v:0)|63&e),e=i.GW(e/64);e>0;)N(t,(e>U?A:0)|U&e),e=i.GW(e/128)},V=new Uint8Array(3e4),J=V.length/3,F=a&&a.encodeInto?(t,e)=>{if(e.length<J){const n=a.encodeInto(e,V).written||0;R(t,n);for(let e=0;e<n;e++)N(t,V[e])}else j(t,d(e))}:(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;R(t,r);for(let e=0;e<r;e++)N(t,n.codePointAt(e))},W=(t,e)=>{const n=t.cbuf.length,r=t.cpos,s=i.VV(n-r,e.length),o=e.length-s;t.cbuf.set(e.subarray(0,s),r),t.cpos+=s,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(i.Fp(2*n,o)),t.cbuf.set(e.subarray(s)),t.cpos=o)},j=(t,e)=>{R(t,e.byteLength),W(t,e)},G=(t,e)=>{((t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(D(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(2*i.Fp(n,e)),t.cpos=0)})(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},Y=new DataView(new ArrayBuffer(4)),$=(t,e)=>{switch(typeof e){case"string":N(t,119),F(t,e);break;case"number":M(e)&&i.Wn(e)<=2147483647?(N(t,125),P(t,e)):(n=e,Y.setFloat32(0,n),Y.getFloat32(0)===n?(N(t,124),((t,e)=>{G(t,4).setFloat32(0,e,!1)})(t,e)):(N(t,123),((t,e)=>{G(t,8).setFloat64(0,e,!1)})(t,e)));break;case"bigint":N(t,122),((t,e)=>{G(t,8).setBigInt64(0,e,!1)})(t,e);break;case"object":if(null===e)N(t,126);else if(s.kJ(e)){N(t,117),R(t,e.length);for(let n=0;n<e.length;n++)$(t,e[n])}else if(e instanceof Uint8Array)N(t,116),j(t,e);else{N(t,118);const n=Object.keys(e);R(t,n.length);for(let r=0;r<n.length;r++){const s=n[r];F(t,s),$(t,e[s])}}break;case"boolean":N(t,e?120:121);break;default:N(t,127)}var n};class z extends x{constructor(t){super(),this.w=t,this.s=null,this.count=0}write(t){this.s===t?this.count++:(this.count>0&&R(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}}const B=t=>{t.count>0&&(P(t.encoder,1===t.count?t.s:-t.s),t.count>1&&R(t.encoder,t.count-2))};class H{constructor(){this.encoder=new x,this.s=0,this.count=0}write(t){this.s===t?this.count++:(B(this),this.count=1,this.s=t)}toUint8Array(){return B(this),I(this.encoder)}}const K=t=>{if(t.count>0){const e=2*t.diff+(1===t.count?0:1);P(t.encoder,e),t.count>1&&R(t.encoder,t.count-2)}};class X{constructor(){this.encoder=new x,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(K(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return K(this),I(this.encoder)}}class Z{constructor(){this.sarr=[],this.s="",this.lensE=new H}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){const t=new x;return this.sarr.push(this.s),this.s="",F(t,this.sarr.join("")),W(t,this.lensE.toUint8Array()),I(t)}}const q=t=>new Error(t),Q=()=>{throw q("Method unimplemented")},tt=()=>{throw q("Unexpected case")},et=q("Unexpected end of array"),nt=q("Integer out of Range");class rt{constructor(t){this.arr=t,this.pos=0}}const st=t=>new rt(t),it=t=>t.pos!==t.arr.length,ot=t=>((t,e)=>{const n=D(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n})(t,lt(t)),ct=t=>t.arr[t.pos++],lt=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const r=t.arr[t.pos++];if(e+=(r&U)*n,n*=128,r<A)return e;if(e>T)throw nt}throw et},ht=t=>{let e=t.arr[t.pos++],n=63&e,r=64;const s=(e&v)>0?-1:1;if(0==(e&A))return s*n;const i=t.arr.length;for(;t.pos<i;){if(e=t.arr[t.pos++],n+=(e&U)*r,r*=128,e<A)return s*n;if(n>T)throw nt}throw et},at=u?t=>u.decode(ot(t)):t=>{let e=lt(t);if(0===e)return"";{let n=String.fromCodePoint(ct(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(ct(t));else for(;e>0;){const r=e<1e4?e:1e4,s=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,s),e-=r}return decodeURIComponent(escape(n))}},dt=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},ut=[t=>{},t=>null,ht,t=>dt(t,4).getFloat32(0,!1),t=>dt(t,8).getFloat64(0,!1),t=>dt(t,8).getBigInt64(0,!1),t=>!1,t=>!0,at,t=>{const e=lt(t),n={};for(let r=0;r<e;r++)n[at(t)]=gt(t);return n},t=>{const e=lt(t),n=[];for(let r=0;r<e;r++)n.push(gt(t));return n},ot],gt=t=>ut[127-ct(t)](t);class ft extends rt{constructor(t,e){super(t),this.reader=e,this.s=null,this.count=0}read(){return 0===this.count&&(this.s=this.reader(this),it(this)?this.count=lt(this)+1:this.count=-1),this.count--,this.s}}class pt extends rt{constructor(t){super(t),this.s=0,this.count=0}read(){if(0===this.count){this.s=ht(this);const t=i.GR(this.s);this.count=1,t&&(this.s=-this.s,this.count=lt(this)+2)}return this.count--,this.s}}class wt extends rt{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(0===this.count){const t=ht(this),e=1&t;this.diff=i.GW(t/2),this.count=1,e&&(this.count=lt(this)+2)}return this.s+=this.diff,this.count--,this.s}}class mt{constructor(t){this.decoder=new pt(t),this.str=at(this.decoder),this.spos=0}read(){const t=this.spos+this.decoder.read(),e=this.str.slice(this.spos,t);return this.spos=t,e}}crypto.subtle;const kt=crypto.getRandomValues.bind(crypto),yt=(Math.random,()=>kt(new Uint32Array(1))[0]),bt=[1e7]+-1e3+-4e3+-8e3+-1e11,_t=()=>bt.replace(/[018]/g,(t=>(t^yt()&15>>t/4).toString(16))),St=t=>new Promise(t);var Et=n(79287);class Ct{constructor(t,e){this.left=t,this.right=e}}const Dt=(t,e)=>new Ct(t,e),vt="undefined"!=typeof document?document:{},At=("undefined"!=typeof DOMParser&&new DOMParser,vt.ELEMENT_NODE,vt.TEXT_NODE,vt.CDATA_SECTION_NODE,vt.COMMENT_NODE,vt.DOCUMENT_NODE,vt.DOCUMENT_TYPE_NODE,vt.DOCUMENT_FRAGMENT_NODE,Symbol);var Ut=n(2431);const Tt=At(),Mt=At(),xt=At(),Ot=At(),It=At(),Nt=At(),Lt=At(),Rt=At(),Pt=At();Ut.ZG();const Vt={[Tt]:Dt("font-weight","bold"),[Mt]:Dt("font-weight","normal"),[xt]:Dt("color","blue"),[It]:Dt("color","green"),[Ot]:Dt("color","grey"),[Nt]:Dt("color","red"),[Lt]:Dt("color","purple"),[Rt]:Dt("color","orange"),[Pt]:Dt("color","black")},Jt=C?t=>{const e=[],n=[],r=o.Ue();let s=[],i=0;for(;i<t.length;i++){const s=t[i],l=Vt[s];if(void 0!==l)r.set(l.left,l.right);else{if(s.constructor!==String&&s.constructor!==Number)break;{const t=(c=r,o.UI(c,((t,e)=>`${e}:${t};`)).join(""));i>0||t.length>0?(e.push("%c"+s),n.push(t)):e.push(s)}}}var c;for(i>0&&(s=n,s.unshift(e.join("")));i<t.length;i++){const e=t[i];e instanceof Symbol||s.push(e)}return s}:t=>{const e=[],n=[];let r=0;for(;r<t.length;r++){const s=t[r];s.constructor===String||s.constructor===Number?e.push(s):s.constructor===Object&&n.push(JSON.stringify(s))}return n},Ft=(...t)=>{console.log(...Jt(t)),Wt.forEach((e=>e.print(t)))},Wt=Et.Ue(),jt=t=>({[Symbol.iterator](){return this},next:t}),Gt=(t,e)=>jt((()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}}));var Yt=n(36498);class $t extends r.y{constructor(t,e){super(),this.doc=t,this.awareness=e}}class zt{constructor(t,e){this.clock=t,this.len=e}}class Bt{constructor(){this.clients=new Map}}const Ht=(t,e,n)=>e.clients.forEach(((e,r)=>{const s=t.doc.store.clients.get(r);for(let r=0;r<e.length;r++){const i=e[r];mn(t,s,i.clock,i.len,n)}})),Kt=(t,e)=>{const n=t.clients.get(e.client);return void 0!==n&&null!==((t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const s=i.GW((n+r)/2),o=t[s],c=o.clock;if(c<=e){if(e<c+o.len)return s;n=s+1}else r=s-1}return null})(n,e.clock)},Xt=t=>{t.clients.forEach((t=>{let e,n;for(t.sort(((t,e)=>t.clock-e.clock)),e=1,n=1;e<t.length;e++){const r=t[n-1],s=t[e];r.clock+r.len>=s.clock?r.len=i.Fp(r.len,s.clock+s.len-r.clock):(n<e&&(t[n]=s),n++)}t.length=n}))},Zt=t=>{const e=new Bt;for(let n=0;n<t.length;n++)t[n].clients.forEach(((r,i)=>{if(!e.clients.has(i)){const o=r.slice();for(let e=n+1;e<t.length;e++)s.s7(o,t[e].clients.get(i)||[]);e.clients.set(i,o)}}));return Xt(e),e},qt=(t,e,n,r)=>{o.Yu(t.clients,e,(()=>[])).push(new zt(n,r))},Qt=()=>new Bt,te=t=>{const e=Qt();return t.clients.forEach(((t,n)=>{const r=[];for(let e=0;e<t.length;e++){const n=t[e];if(n.deleted){const s=n.id.clock;let i=n.length;if(e+1<t.length)for(let n=t[e+1];e+1<t.length&&n.deleted;n=t[1+ ++e])i+=n.length;r.push(new zt(s,i))}}r.length>0&&e.clients.set(n,r)})),e},ee=(t,e)=>{R(t.restEncoder,e.clients.size),s.Dp(e.clients.entries()).sort(((t,e)=>e[0]-t[0])).forEach((([e,n])=>{t.resetDsCurVal(),R(t.restEncoder,e);const r=n.length;R(t.restEncoder,r);for(let e=0;e<r;e++){const r=n[e];t.writeDsClock(r.clock),t.writeDsLen(r.len)}}))},ne=t=>{const e=new Bt,n=lt(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const n=lt(t.restDecoder),r=lt(t.restDecoder);if(r>0){const s=o.Yu(e.clients,n,(()=>[]));for(let e=0;e<r;e++)s.push(new zt(t.readDsClock(),t.readDsLen()))}}return e},re=(t,e,n)=>{const r=new Bt,s=lt(t.restDecoder);for(let i=0;i<s;i++){t.resetDsCurVal();const s=lt(t.restDecoder),i=lt(t.restDecoder),o=n.clients.get(s)||[],c=an(n,s);for(let n=0;n<i;n++){const n=t.readDsClock(),i=n+t.readDsLen();if(n<c){c<i&&qt(r,s,c,i-c);let t=un(o,n),l=o[t];for(!l.deleted&&l.id.clock<n&&(o.splice(t+1,0,Ss(e,l,n-l.id.clock)),t++);t<o.length&&(l=o[t++],l.id.clock<i);)l.deleted||(i<l.id.clock+l.length&&o.splice(t,0,Ss(e,l,i-l.id.clock)),l.delete(e))}else qt(r,s,n,i-n)}}if(r.clients.size>0){const t=new ge;return R(t.restEncoder,0),ee(t,r),t.toUint8Array()}return null},se=yt;class ie extends r.y{constructor({guid:t=_t(),collectionid:e=null,gc:n=!0,gcFilter:r=(()=>!0),meta:s=null,autoLoad:i=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=se(),this.guid=t,this.collectionid=e,this.share=new Map,this.store=new ln,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=i,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=St((t=>{this.on("load",(()=>{this.isLoaded=!0,t(this)}))}));const c=()=>St((t=>{const e=n=>{void 0!==n&&!0!==n||(this.off("sync",e),t())};this.on("sync",e)}));this.on("sync",(t=>{!1===t&&this.isSynced&&(this.whenSynced=c()),this.isSynced=void 0===t||!0===t,this.isLoaded||this.emit("load",[])})),this.whenSynced=c()}load(){const t=this._item;null===t||this.shouldLoad||vn(t.parent.doc,(t=>{t.subdocsLoaded.add(this)}),null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(s.Dp(this.subdocs).map((t=>t.guid)))}transact(t,e=null){return vn(this,t,e)}get(t,e=ar){const n=o.Yu(this.share,t,(()=>{const t=new e;return t._integrate(this,null),t})),r=n.constructor;if(e!==ar&&r!==e){if(r===ar){const r=new e;r._map=n._map,n._map.forEach((t=>{for(;null!==t;t=t.left)t.parent=r})),r._start=n._start;for(let t=r._start;null!==t;t=t.right)t.parent=r;return r._length=n._length,this.share.set(t,r),r._integrate(this,null),r}throw new Error(`Type with the name ${t} has already been defined with a different constructor`)}return n}getArray(t=""){return this.get(t,Mr)}getText(t=""){return this.get(t,Br)}getMap(t=""){return this.get(t,Or)}getXmlFragment(t=""){return this.get(t,Kr)}toJSON(){const t={};return this.share.forEach(((e,n)=>{t[n]=e.toJSON()})),t}destroy(){s.Dp(this.subdocs).forEach((t=>t.destroy()));const t=this._item;if(null!==t){this._item=null;const e=t.content;e.doc=new ie({guid:this.guid,...e.opts,shouldLoad:!1}),e.doc._item=t,vn(t.parent.doc,(n=>{const r=e.doc;t.deleted||n.subdocsAdded.add(r),n.subdocsRemoved.add(this)}),null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}on(t,e){super.on(t,e)}off(t,e){super.off(t,e)}}class oe{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return lt(this.restDecoder)}readDsLen(){return lt(this.restDecoder)}}class ce extends oe{readLeftID(){return Oe(lt(this.restDecoder),lt(this.restDecoder))}readRightID(){return Oe(lt(this.restDecoder),lt(this.restDecoder))}readClient(){return lt(this.restDecoder)}readInfo(){return ct(this.restDecoder)}readString(){return at(this.restDecoder)}readParentInfo(){return 1===lt(this.restDecoder)}readTypeRef(){return lt(this.restDecoder)}readLen(){return lt(this.restDecoder)}readAny(){return gt(this.restDecoder)}readBuf(){return(t=>{const e=(n=t.byteLength,new Uint8Array(n));var n;return e.set(t),e})(ot(this.restDecoder))}readJSON(){return JSON.parse(at(this.restDecoder))}readKey(){return at(this.restDecoder)}}class le{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=lt(this.restDecoder),this.dsCurrVal}readDsLen(){const t=lt(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class he extends le{constructor(t){super(t),this.keys=[],lt(t),this.keyClockDecoder=new wt(ot(t)),this.clientDecoder=new pt(ot(t)),this.leftClockDecoder=new wt(ot(t)),this.rightClockDecoder=new wt(ot(t)),this.infoDecoder=new ft(ot(t),ct),this.stringDecoder=new mt(ot(t)),this.parentInfoDecoder=new ft(ot(t),ct),this.typeRefDecoder=new pt(ot(t)),this.lenDecoder=new pt(ot(t))}readLeftID(){return new Me(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Me(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return 1===this.parentInfoDecoder.read()}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return gt(this.restDecoder)}readBuf(){return ot(this.restDecoder)}readJSON(){return gt(this.restDecoder)}readKey(){const t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];{const t=this.stringDecoder.read();return this.keys.push(t),t}}}class ae{constructor(){this.restEncoder=O()}toUint8Array(){return I(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){R(this.restEncoder,t)}writeDsLen(t){R(this.restEncoder,t)}}class de extends ae{writeLeftID(t){R(this.restEncoder,t.client),R(this.restEncoder,t.clock)}writeRightID(t){R(this.restEncoder,t.client),R(this.restEncoder,t.clock)}writeClient(t){R(this.restEncoder,t)}writeInfo(t){L(this.restEncoder,t)}writeString(t){F(this.restEncoder,t)}writeParentInfo(t){R(this.restEncoder,t?1:0)}writeTypeRef(t){R(this.restEncoder,t)}writeLen(t){R(this.restEncoder,t)}writeAny(t){$(this.restEncoder,t)}writeBuf(t){j(this.restEncoder,t)}writeJSON(t){F(this.restEncoder,JSON.stringify(t))}writeKey(t){F(this.restEncoder,t)}}class ue{constructor(){this.restEncoder=O(),this.dsCurrVal=0}toUint8Array(){return I(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){const e=t-this.dsCurrVal;this.dsCurrVal=t,R(this.restEncoder,e)}writeDsLen(t){0===t&&tt(),R(this.restEncoder,t-1),this.dsCurrVal+=t}}class ge extends ue{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new X,this.clientEncoder=new H,this.leftClockEncoder=new X,this.rightClockEncoder=new X,this.infoEncoder=new z(L),this.stringEncoder=new Z,this.parentInfoEncoder=new z(L),this.typeRefEncoder=new H,this.lenEncoder=new H}toUint8Array(){const t=O();return R(t,0),j(t,this.keyClockEncoder.toUint8Array()),j(t,this.clientEncoder.toUint8Array()),j(t,this.leftClockEncoder.toUint8Array()),j(t,this.rightClockEncoder.toUint8Array()),j(t,I(this.infoEncoder)),j(t,this.stringEncoder.toUint8Array()),j(t,I(this.parentInfoEncoder)),j(t,this.typeRefEncoder.toUint8Array()),j(t,this.lenEncoder.toUint8Array()),W(t,I(this.restEncoder)),I(t)}writeLeftID(t){this.clientEncoder.write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(t?1:0)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){$(this.restEncoder,t)}writeBuf(t){j(this.restEncoder,t)}writeJSON(t){$(this.restEncoder,t)}writeKey(t){const e=this.keyMap.get(t);void 0===e?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(t)):this.keyClockEncoder.write(e)}}const fe=(t,e,n)=>{const r=new Map;n.forEach(((t,n)=>{an(e,n)>t&&r.set(n,t)})),hn(e).forEach(((t,e)=>{n.has(e)||r.set(e,0)})),R(t.restEncoder,r.size),s.Dp(r.entries()).sort(((t,e)=>e[0]-t[0])).forEach((([n,r])=>{((t,e,n,r)=>{r=i.Fp(r,e[0].id.clock);const s=un(e,r);R(t.restEncoder,e.length-s),t.writeClient(n),R(t.restEncoder,r);const o=e[s];o.write(t,r-o.id.clock);for(let n=s+1;n<e.length;n++)e[n].write(t,0)})(t,e.clients.get(n),n,r)}))},pe=(t,e,n,r=new he(t))=>vn(e,(t=>{t.local=!1;let e=!1;const n=t.doc,i=n.store,c=((t,e)=>{const n=o.Ue(),r=lt(t.restDecoder);for(let s=0;s<r;s++){const r=lt(t.restDecoder),s=new Array(r),i=t.readClient();let o=lt(t.restDecoder);n.set(i,{i:0,refs:s});for(let n=0;n<r;n++){const r=t.readInfo();switch(31&r){case 0:{const e=t.readLen();s[n]=new es(Oe(i,o),e),o+=e;break}case 10:{const e=lt(t.restDecoder);s[n]=new Us(Oe(i,o),e),o+=e;break}default:{const c=0==(192&r),l=new Ds(Oe(i,o),null,(r&A)===A?t.readLeftID():null,null,(r&v)===v?t.readRightID():null,c?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,c&&32==(32&r)?t.readString():null,vs(t,r));s[n]=l,o+=l.length}}}}return n})(r,n),l=((t,e,n)=>{const r=[];let i=s.Dp(n.keys()).sort(((t,e)=>t-e));if(0===i.length)return null;const c=()=>{if(0===i.length)return null;let t=n.get(i[i.length-1]);for(;t.refs.length===t.i;){if(i.pop(),!(i.length>0))return null;t=n.get(i[i.length-1])}return t};let l=c();if(null===l&&0===r.length)return null;const h=new ln,a=new Map,d=(t,e)=>{const n=a.get(t);(null==n||n>e)&&a.set(t,e)};let u=l.refs[l.i++];const g=new Map,f=()=>{for(const t of r){const e=t.id.client,r=n.get(e);r?(r.i--,h.clients.set(e,r.refs.slice(r.i)),n.delete(e),r.i=0,r.refs=[]):h.clients.set(e,[t]),i=i.filter((t=>t!==e))}r.length=0};for(;;){if(u.constructor!==Us){const s=o.Yu(g,u.id.client,(()=>an(e,u.id.client)))-u.id.clock;if(s<0)r.push(u),d(u.id.client,u.id.clock-1),f();else{const i=u.getMissing(t,e);if(null!==i){r.push(u);const t=n.get(i)||{refs:[],i:0};if(t.refs.length!==t.i){u=t.refs[t.i++];continue}d(i,an(e,i)),f()}else(0===s||s<u.length)&&(u.integrate(t,s),g.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(null!==l&&l.i<l.refs.length)u=l.refs[l.i++];else{if(l=c(),null===l)break;u=l.refs[l.i++]}}if(h.clients.size>0){const t=new ge;return fe(t,h,new Map),R(t.restEncoder,0),{missing:a,update:t.toUint8Array()}}return null})(t,i,c),h=i.pendingStructs;if(h){for(const[t,n]of h.missing)if(n<an(i,t)){e=!0;break}if(l){for(const[t,e]of l.missing){const n=h.missing.get(t);(null==n||n>e)&&h.missing.set(t,e)}h.update=Gn([h.update,l.update])}}else i.pendingStructs=l;const a=re(r,t,i);if(i.pendingDs){const e=new he(st(i.pendingDs));lt(e.restDecoder);const n=re(e,t,i);i.pendingDs=a&&n?Gn([a,n]):a||n}else i.pendingDs=a;if(e){const e=i.pendingStructs.update;i.pendingStructs=null,me(t.doc,e)}}),n,!1),we=(t,e,n)=>pe(t,e,n,new ce(t)),me=(t,e,n,r=he)=>{const s=st(e);pe(s,t,n,new r(s))},ke=(t,e,n)=>me(t,e,n,ce),ye=(t,e=new Uint8Array([0]),n=new ge)=>{((t,e,n=new Map)=>{fe(t,e.store,n),ee(t,te(e.store))})(n,t,Se(e));const r=[n.toUint8Array()];if(t.store.pendingDs&&r.push(t.store.pendingDs),t.store.pendingStructs&&r.push(Yn(t.store.pendingStructs.update,e)),r.length>1){if(n.constructor===de)return Pn(r.map(((t,e)=>0===e?t:tr(t))));if(n.constructor===ge)return Gn(r)}return r[0]},be=(t,e)=>ye(t,e,new de),_e=t=>{const e=new Map,n=lt(t.restDecoder);for(let r=0;r<n;r++){const n=lt(t.restDecoder),r=lt(t.restDecoder);e.set(n,r)}return e},Se=t=>_e(new oe(st(t))),Ee=(t,e)=>(R(t.restEncoder,e.size),s.Dp(e.entries()).sort(((t,e)=>e[0]-t[0])).forEach((([e,n])=>{R(t.restEncoder,e),R(t.restEncoder,n)})),t),Ce=t=>((t,e=new ue)=>(t instanceof Map?Ee(e,t):((t,e)=>{Ee(t,hn(e.store))})(e,t),e.toUint8Array()))(t,new ae);class De{constructor(){this.l=[]}}const ve=()=>new De,Ae=(t,e)=>t.l.push(e),Ue=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter((t=>e!==t)),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Te=(t,e,n)=>w.PP(t.l,[e,n]);class Me{constructor(t,e){this.client=t,this.clock=e}}const xe=(t,e)=>t===e||null!==t&&null!==e&&t.client===e.client&&t.clock===e.clock,Oe=(t,e)=>new Me(t,e),Ie=(t,e)=>{R(t,e.client),R(t,e.clock)},Ne=t=>Oe(lt(t),lt(t)),Le=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw tt()},Re=(t,e)=>{for(;null!==e;){if(e.parent===t)return!0;e=e.parent._item}return!1},Pe=t=>{const e=[];let n=t._start;for(;n;)e.push(n),n=n.right;console.log("Children: ",e),console.log("Children content: ",e.filter((t=>!t.deleted)).map((t=>t.content)))};class Ve{constructor(t,e=t.getMap("users")){const n=new Map;this.yusers=e,this.doc=t,this.clients=new Map,this.dss=n;const r=(t,e)=>{const n=t.get("ds"),r=t.get("ids"),s=t=>this.clients.set(t,e);n.observe((t=>{t.changes.added.forEach((t=>{t.content.getContent().forEach((t=>{t instanceof Uint8Array&&this.dss.set(e,Zt([this.dss.get(e)||Qt(),ne(new oe(st(t)))]))}))}))})),this.dss.set(e,Zt(n.map((t=>ne(new oe(st(t))))))),r.observe((t=>t.changes.added.forEach((t=>t.content.getContent().forEach(s))))),r.forEach(s)};e.observe((t=>{t.keysChanged.forEach((t=>r(e.get(t),t)))})),e.forEach(r)}setUserMapping(t,e,n,{filter:r=(()=>!0)}={}){const s=this.yusers;let i=s.get(n);i||(i=new Or,i.set("ids",new Mr),i.set("ds",new Mr),s.set(n,i)),i.get("ids").push([e]),s.observe((t=>{setTimeout((()=>{const t=s.get(n);if(t!==i){i=t,this.clients.forEach(((t,e)=>{n===t&&i.get("ids").push([e])}));const e=new ae,r=this.dss.get(n);r&&(ee(e,r),i.get("ds").push([e.toUint8Array()]))}}),0)})),t.on("afterTransaction",(t=>{setTimeout((()=>{const e=i.get("ds"),n=t.deleteSet;if(t.local&&n.clients.size>0&&r(t,n)){const t=new ae;ee(t,n),e.push([t.toUint8Array()])}}))}))}getUserByClientId(t){return this.clients.get(t)||null}getUserByDeletedId(t){for(const[e,n]of this.dss.entries())if(Kt(n,t))return e;return null}}class Je{constructor(t,e,n,r=0){this.type=t,this.tname=e,this.item=n,this.assoc=r}}const Fe=t=>{const e={};return t.type&&(e.type=t.type),t.tname&&(e.tname=t.tname),t.item&&(e.item=t.item),null!=t.assoc&&(e.assoc=t.assoc),e},We=t=>new Je(null==t.type?null:Oe(t.type.client,t.type.clock),t.tname||null,null==t.item?null:Oe(t.item.client,t.item.clock),null==t.assoc?0:t.assoc);class je{constructor(t,e,n=0){this.type=t,this.index=e,this.assoc=n}}const Ge=(t,e,n)=>{let r=null,s=null;return null===t._item?s=Le(t):r=Oe(t._item.id.client,t._item.id.clock),new Je(r,s,e,n)},Ye=(t,e,n=0)=>{let r=t._start;if(n<0){if(0===e)return Ge(t,null,n);e--}for(;null!==r;){if(!r.deleted&&r.countable){if(r.length>e)return Ge(t,Oe(r.id.client,r.id.clock+e),n);e-=r.length}if(null===r.right&&n<0)return Ge(t,r.lastId,n);r=r.right}return Ge(t,null,n)},$e=t=>{const e=O();return((t,e)=>{const{type:n,tname:r,item:s,assoc:i}=e;if(null!==s)R(t,0),Ie(t,s);else if(null!==r)L(t,1),F(t,r);else{if(null===n)throw tt();L(t,2),Ie(t,n)}P(t,i)})(e,t),I(e)},ze=t=>(t=>{let e=null,n=null,r=null;switch(lt(t)){case 0:r=Ne(t);break;case 1:n=at(t);break;case 2:e=Ne(t)}const s=it(t)?ht(t):0;return new Je(e,n,r,s)})(st(t)),Be=(t,e)=>{const n=e.store,r=t.item,s=t.type,i=t.tname,o=t.assoc;let c=null,l=0;if(null!==r){if(an(n,r.client)<=r.clock)return null;const t=bs(n,r),e=t.item;if(!(e instanceof Ds))return null;if(c=e.parent,null===c._item||!c._item.deleted){l=e.deleted||!e.countable?0:t.diff+(o>=0?0:1);let n=e.left;for(;null!==n;)!n.deleted&&n.countable&&(l+=n.length),n=n.left}}else{if(null!==i)c=e.get(i);else{if(null===s)throw tt();{if(an(n,s.client)<=s.clock)return null;const{item:t}=bs(n,s);if(!(t instanceof Ds&&t.content instanceof ys))return null;c=t.content.type}}l=o>=0?c._length:0}return((t,e,n=0)=>new je(t,e,n))(c,l,t.assoc)},He=(t,e)=>t===e||null!==t&&null!==e&&t.tname===e.tname&&xe(t.item,e.item)&&xe(t.type,e.type)&&t.assoc===e.assoc;class Ke{constructor(t,e){this.ds=t,this.sv=e}}const Xe=(t,e)=>{const n=t.ds.clients,r=e.ds.clients,s=t.sv,i=e.sv;if(s.size!==i.size||n.size!==r.size)return!1;for(const[t,e]of s.entries())if(i.get(t)!==e)return!1;for(const[t,e]of n.entries()){const n=r.get(t)||[];if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++){const r=e[t],s=n[t];if(r.clock!==s.clock||r.len!==s.len)return!1}}return!0},Ze=(t,e=new ue)=>(ee(e,t.ds),Ee(e,t.sv),e.toUint8Array()),qe=t=>Ze(t,new ae),Qe=(t,e=new le(st(t)))=>new Ke(ne(e),_e(e)),tn=t=>Qe(t,new oe(st(t))),en=(t,e)=>new Ke(t,e),nn=en(Qt(),new Map),rn=t=>en(te(t.store),hn(t.store)),sn=(t,e)=>void 0===e?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Kt(e.ds,t.id),on=(t,e)=>{const n=o.Yu(t.meta,on,Et.Ue),r=t.doc.store;n.has(e)||(e.sv.forEach(((e,n)=>{e<an(r,n)&&pn(t,Oe(n,e))})),Ht(t,e.ds,(t=>{})),n.add(e))},cn=(t,e,n=new ie)=>{if(t.gc)throw new Error("Garbage-collection must be disabled in `originDoc`!");const{sv:r,ds:s}=e,i=new ge;return t.transact((e=>{let n=0;r.forEach((t=>{t>0&&n++})),R(i.restEncoder,n);for(const[n,s]of r){if(0===s)continue;s<an(t.store,n)&&pn(e,Oe(n,s));const r=t.store.clients.get(n)||[],o=un(r,s-1);R(i.restEncoder,o+1),i.writeClient(n),R(i.restEncoder,0);for(let t=0;t<=o;t++)r[t].write(i,0)}ee(i,s)})),me(n,i.toUint8Array(),"snapshot"),n};class ln{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const hn=t=>{const e=new Map;return t.clients.forEach(((t,n)=>{const r=t[t.length-1];e.set(n,r.id.clock+r.length)})),e},an=(t,e)=>{const n=t.clients.get(e);if(void 0===n)return 0;const r=n[n.length-1];return r.id.clock+r.length},dn=(t,e)=>{let n=t.clients.get(e.id.client);if(void 0===n)n=[],t.clients.set(e.id.client,n);else{const t=n[n.length-1];if(t.id.clock+t.length!==e.id.clock)throw tt()}n.push(e)},un=(t,e)=>{let n=0,r=t.length-1,s=t[r],o=s.id.clock;if(o===e)return r;let c=i.GW(e/(o+s.length-1)*r);for(;n<=r;){if(s=t[c],o=s.id.clock,o<=e){if(e<o+s.length)return c;n=c+1}else r=c-1;c=i.GW((n+r)/2)}throw tt()},gn=(t,e)=>{const n=t.clients.get(e.client);return n[un(n,e.clock)]},fn=(t,e,n)=>{const r=un(e,n),s=e[r];return s.id.clock<n&&s instanceof Ds?(e.splice(r+1,0,Ss(t,s,n-s.id.clock)),r+1):r},pn=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[fn(t,n,e.clock)]},wn=(t,e,n)=>{const r=e.clients.get(n.client),s=un(r,n.clock),i=r[s];return n.clock!==i.id.clock+i.length-1&&i.constructor!==es&&r.splice(s+1,0,Ss(t,i,n.clock-i.id.clock+1)),i},mn=(t,e,n,r,s)=>{if(0===r)return;const i=n+r;let o,c=fn(t,e,n);do{o=e[c++],i<o.id.clock+o.length&&fn(t,e,i),s(o)}while(c<e.length&&e[c].id.clock<i)};class kn{constructor(t,e,n){this.doc=t,this.deleteSet=new Bt,this.beforeState=hn(t.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=e,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set}}const yn=(t,e)=>!(0===e.deleteSet.clients.size&&!o.Yj(e.afterState,((t,n)=>e.beforeState.get(n)!==t))||(Xt(e.deleteSet),((t,e)=>{fe(t,e.doc.store,e.beforeState)})(t,e),ee(t,e.deleteSet),0)),bn=(t,e,n)=>{const r=e._item;(null===r||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&o.Yu(t.changed,e,Et.Ue).add(n)},_n=(t,e)=>{const n=t[e-1],r=t[e];n.deleted===r.deleted&&n.constructor===r.constructor&&n.mergeWith(r)&&(t.splice(e,1),r instanceof Ds&&null!==r.parentSub&&r.parent._map.get(r.parentSub)===r&&r.parent._map.set(r.parentSub,n))},Sn=(t,e,n)=>{for(const[r,s]of t.clients.entries()){const t=e.clients.get(r);for(let r=s.length-1;r>=0;r--){const i=s[r],o=i.clock+i.len;for(let r=un(t,i.clock),s=t[r];r<t.length&&s.id.clock<o;s=t[++r]){const s=t[r];if(i.clock+i.len<=s.id.clock)break;s instanceof Ds&&s.deleted&&!s.keep&&n(s)&&s.gc(e,!1)}}}},En=(t,e)=>{t.clients.forEach(((t,n)=>{const r=e.clients.get(n);for(let e=t.length-1;e>=0;e--){const n=t[e];for(let t=i.VV(r.length-1,1+un(r,n.clock+n.len-1)),e=r[t];t>0&&e.id.clock>=n.clock;e=r[--t])_n(r,t)}}))},Cn=(t,e,n)=>{Sn(t,e,n),En(t,e)},Dn=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,s=r.store,o=n.deleteSet,c=n._mergeStructs;try{Xt(o),n.afterState=hn(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const t=[];n.changed.forEach(((e,r)=>t.push((()=>{null!==r._item&&r._item.deleted||r._callObserver(n,e)})))),t.push((()=>{n.changedParentTypes.forEach(((e,r)=>t.push((()=>{null!==r._item&&r._item.deleted||((e=e.filter((t=>null===t.target._item||!t.target._item.deleted))).forEach((t=>{t.currentTarget=r})),e.sort(((t,e)=>t.path.length-e.path.length)),Te(r._dEH,e,n))})))),t.push((()=>r.emit("afterTransaction",[n,r])))})),(0,w.PP)(t,[])}finally{r.gc&&Sn(o,s,r.gcFilter),En(o,s),n.afterState.forEach(((t,e)=>{const r=n.beforeState.get(e)||0;if(r!==t){const t=s.clients.get(e),n=i.Fp(un(t,r),1);for(let e=t.length-1;e>=n;e--)_n(t,e)}}));for(let t=0;t<c.length;t++){const{client:e,clock:n}=c[t].id,r=s.clients.get(e),i=un(r,n);i+1<r.length&&_n(r,i+1),i>0&&_n(r,i)}if(n.local||n.afterState.get(r.clientID)===n.beforeState.get(r.clientID)||(Ft(Rt,Tt,"[yjs] ",Mt,Nt,"Changed the client-id because another client seems to be using it."),r.clientID=se()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const t=new de;yn(t,n)&&r.emit("update",[t.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const t=new ge;yn(t,n)&&r.emit("updateV2",[t.toUint8Array(),n.origin,r,n])}const{subdocsAdded:l,subdocsLoaded:h,subdocsRemoved:a}=n;(l.size>0||a.size>0||h.size>0)&&(l.forEach((t=>{t.clientID=r.clientID,null==t.collectionid&&(t.collectionid=r.collectionid),r.subdocs.add(t)})),a.forEach((t=>r.subdocs.delete(t))),r.emit("subdocs",[{loaded:h,added:l,removed:a},r,n]),a.forEach((t=>t.destroy()))),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):Dn(t,e+1)}}},vn=(t,e,n=null,r=!0)=>{const s=t._transactionCleanups;let i=!1,o=null;null===t._transaction&&(i=!0,t._transaction=new kn(t,n,r),s.push(t._transaction),1===s.length&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{o=e(t._transaction)}finally{if(i){const e=t._transaction===s[0];t._transaction=null,e&&Dn(s,0)}}return o};class An{constructor(t,e){this.insertions=e,this.deletions=t,this.meta=new Map}}const Un=(t,e,n)=>{Ht(t,n.deletions,(t=>{t instanceof Ds&&e.scope.some((e=>Re(e,t)))&&_s(t,!1)}))},Tn=(t,e,n)=>{let r=null,s=null;const i=t.doc,o=t.scope;if(vn(i,(n=>{for(;e.length>0&&null===r;){const s=i.store,c=e.pop(),l=new Set,h=[];let a=!1;Ht(n,c.insertions,(t=>{if(t instanceof Ds){if(null!==t.redone){let{item:e,diff:r}=bs(s,t.id);r>0&&(e=pn(n,Oe(e.id.client,e.id.clock+r))),t=e}!t.deleted&&o.some((e=>Re(e,t)))&&h.push(t)}})),Ht(n,c.deletions,(t=>{t instanceof Ds&&o.some((e=>Re(e,t)))&&!Kt(c.insertions,t.id)&&l.add(t)})),l.forEach((e=>{a=null!==Cs(n,e,l,c.insertions,t.ignoreRemoteMapChanges,t)||a}));for(let e=h.length-1;e>=0;e--){const r=h[e];t.deleteFilter(r)&&(r.delete(n),a=!0)}r=a?c:null}n.changed.forEach(((t,e)=>{t.has(null)&&e._searchMarker&&(e._searchMarker.length=0)})),s=n}),t),null!=r){const e=s.changedParentTypes;t.emit("stack-item-popped",[{stackItem:r,type:n,changedParentTypes:e},t])}return r};class Mn extends r.y{constructor(t,{captureTimeout:e=500,captureTransaction:n=(t=>!0),deleteFilter:r=(()=>!0),trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:c=(s.kJ(t)?t[0].doc:t.doc)}={}){super(),this.scope=[],this.addToScope(t),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.doc=c,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=e,this.afterTransactionHandler=t=>{if(!(this.captureTransaction(t)&&this.scope.some((e=>t.changedParentTypes.has(e)))&&(this.trackedOrigins.has(t.origin)||t.origin&&this.trackedOrigins.has(t.origin.constructor))))return;const e=this.undoing,n=this.redoing,r=e?this.redoStack:this.undoStack;e?this.stopCapturing():n||this.clear(!1,!0);const s=new Bt;t.afterState.forEach(((e,n)=>{const r=t.beforeState.get(n)||0,i=e-r;i>0&&qt(s,n,r,i)}));const i=Ut.ZG();let o=!1;if(this.lastChange>0&&i-this.lastChange<this.captureTimeout&&r.length>0&&!e&&!n){const e=r[r.length-1];e.deletions=Zt([e.deletions,t.deleteSet]),e.insertions=Zt([e.insertions,s])}else r.push(new An(t.deleteSet,s)),o=!0;e||n||(this.lastChange=i),Ht(t,t.deleteSet,(t=>{t instanceof Ds&&this.scope.some((e=>Re(e,t)))&&_s(t,!0)}));const c=[{stackItem:r[r.length-1],origin:t.origin,type:e?"redo":"undo",changedParentTypes:t.changedParentTypes},this];o?this.emit("stack-item-added",c):this.emit("stack-item-updated",c)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",(()=>{this.destroy()}))}addToScope(t){(t=s.kJ(t)?t:[t]).forEach((t=>{this.scope.every((e=>e!==t))&&this.scope.push(t)}))}addTrackedOrigin(t){this.trackedOrigins.add(t)}removeTrackedOrigin(t){this.trackedOrigins.delete(t)}clear(t=!0,e=!0){(t&&this.canUndo()||e&&this.canRedo())&&this.doc.transact((n=>{t&&(this.undoStack.forEach((t=>Un(n,this,t))),this.undoStack=[]),e&&(this.redoStack.forEach((t=>Un(n,this,t))),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:t,redoStackCleared:e}])}))}stopCapturing(){this.lastChange=0}undo(){let t;this.undoing=!0;try{t=Tn(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){let t;this.redoing=!0;try{t=Tn(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}class xn{constructor(t,e){this.gen=function*(t){const e=lt(t.restDecoder);for(let n=0;n<e;n++){const e=lt(t.restDecoder),n=t.readClient();let r=lt(t.restDecoder);for(let s=0;s<e;s++){const e=t.readInfo();if(10===e){const e=lt(t.restDecoder);yield new Us(Oe(n,r),e),r+=e}else if(0!=(31&e)){const s=0==(192&e),i=new Ds(Oe(n,r),null,(e&A)===A?t.readLeftID():null,null,(e&v)===v?t.readRightID():null,s?t.readParentInfo()?t.readString():t.readLeftID():null,s&&32==(32&e)?t.readString():null,vs(t,e));yield i,r+=i.length}else{const e=t.readLen();yield new es(Oe(n,r),e),r+=e}}}}(t),this.curr=null,this.done=!1,this.filterSkips=e,this.next()}next(){do{this.curr=this.gen.next().value||null}while(this.filterSkips&&null!==this.curr&&this.curr.constructor===Us);return this.curr}}const On=t=>In(t,ce),In=(t,e=he)=>{const n=[],r=new e(st(t)),s=new xn(r,!1);for(let t=s.curr;null!==t;t=s.next())n.push(t);Ft("Structs: ",n);const i=ne(r);Ft("DeleteSet: ",i)},Nn=t=>Ln(t,ce),Ln=(t,e=he)=>{const n=[],r=new e(st(t)),s=new xn(r,!1);for(let t=s.curr;null!==t;t=s.next())n.push(t);return{structs:n,ds:ne(r)}};class Rn{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}const Pn=t=>Gn(t,ce,de),Vn=(t,e=ue,n=he)=>{const r=new e,s=new xn(new n(st(t)),!1);let i=s.curr;if(null!==i){let t=0,e=i.id.client,n=0!==i.id.clock,o=n?0:i.id.clock+i.length;for(;null!==i;i=s.next())e!==i.id.client&&(0!==o&&(t++,R(r.restEncoder,e),R(r.restEncoder,o)),e=i.id.client,o=0,n=0!==i.id.clock),i.constructor===Us&&(n=!0),n||(o=i.id.clock+i.length);0!==o&&(t++,R(r.restEncoder,e),R(r.restEncoder,o));const c=O();return R(c,t),((t,e)=>{W(t,I(e))})(c,r.restEncoder),r.restEncoder=c,r.toUint8Array()}return R(r.restEncoder,0),r.toUint8Array()},Jn=t=>Vn(t,ae,ce),Fn=(t,e=he)=>{const n=new Map,r=new Map,s=new xn(new e(st(t)),!1);let i=s.curr;if(null!==i){let t=i.id.client,e=i.id.clock;for(n.set(t,e);null!==i;i=s.next())t!==i.id.client&&(r.set(t,e),n.set(i.id.client,i.id.clock),t=i.id.client),e=i.id.clock+i.length;r.set(t,e)}return{from:n,to:r}},Wn=t=>Fn(t,ce),jn=(t,e)=>{if(t.constructor===es){const{client:n,clock:r}=t.id;return new es(Oe(n,r+e),t.length-e)}if(t.constructor===Us){const{client:n,clock:r}=t.id;return new Us(Oe(n,r+e),t.length-e)}{const n=t,{client:r,clock:s}=n.id;return new Ds(Oe(r,s+e),null,Oe(r,s+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},Gn=(t,e=he,n=ge)=>{if(1===t.length)return t[0];const r=t.map((t=>new e(st(t))));let s=r.map((t=>new xn(t,!0))),i=null;const o=new n,c=new Rn(o);for(;s=s.filter((t=>null!==t.curr)),s.sort(((t,e)=>{if(t.curr.id.client===e.curr.id.client){const n=t.curr.id.clock-e.curr.id.clock;return 0===n?t.curr.constructor===e.curr.constructor?0:t.curr.constructor===Us?1:-1:n}return e.curr.id.client-t.curr.id.client})),0!==s.length;){const t=s[0],e=t.curr.id.client;if(null!==i){let n=t.curr,r=!1;for(;null!==n&&n.id.clock+n.length<=i.struct.id.clock+i.struct.length&&n.id.client>=i.struct.id.client;)n=t.next(),r=!0;if(null===n||n.id.client!==e||r&&n.id.clock>i.struct.id.clock+i.struct.length)continue;if(e!==i.struct.id.client)Bn(c,i.struct,i.offset),i={struct:n,offset:0},t.next();else if(i.struct.id.clock+i.struct.length<n.id.clock)if(i.struct.constructor===Us)i.struct.length=n.id.clock+n.length-i.struct.id.clock;else{Bn(c,i.struct,i.offset);const t=n.id.clock-i.struct.id.clock-i.struct.length;i={struct:new Us(Oe(e,i.struct.id.clock+i.struct.length),t),offset:0}}else{const e=i.struct.id.clock+i.struct.length-n.id.clock;e>0&&(i.struct.constructor===Us?i.struct.length-=e:n=jn(n,e)),i.struct.mergeWith(n)||(Bn(c,i.struct,i.offset),i={struct:n,offset:0},t.next())}}else i={struct:t.curr,offset:0},t.next();for(let n=t.curr;null!==n&&n.id.client===e&&n.id.clock===i.struct.id.clock+i.struct.length&&n.constructor!==Us;n=t.next())Bn(c,i.struct,i.offset),i={struct:n,offset:0}}null!==i&&(Bn(c,i.struct,i.offset),i=null),Hn(c);const l=r.map((t=>ne(t))),h=Zt(l);return ee(o,h),o.toUint8Array()},Yn=(t,e,n=he,r=ge)=>{const s=Se(e),o=new r,c=new Rn(o),l=new n(st(t)),h=new xn(l,!1);for(;h.curr;){const t=h.curr,e=t.id.client,n=s.get(e)||0;if(h.curr.constructor!==Us)if(t.id.clock+t.length>n)for(Bn(c,t,i.Fp(n-t.id.clock,0)),h.next();h.curr&&h.curr.id.client===e;)Bn(c,h.curr,0),h.next();else for(;h.curr&&h.curr.id.client===e&&h.curr.id.clock+h.curr.length<=n;)h.next();else h.next()}Hn(c);const a=ne(l);return ee(o,a),o.toUint8Array()},$n=(t,e)=>Yn(t,e,ce,de),zn=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:I(t.encoder.restEncoder)}),t.encoder.restEncoder=O(),t.written=0)},Bn=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&zn(t),0===t.written&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),R(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},Hn=t=>{zn(t);const e=t.encoder.restEncoder;R(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];R(e,r.written),W(e,r.restEncoder)}},Kn=(t,e,n,r)=>{const s=new n(st(t)),i=new xn(s,!1),o=new r,c=new Rn(o);for(let t=i.curr;null!==t;t=i.next())Bn(c,e(t),0);Hn(c);const l=ne(s);return ee(o,l),o.toUint8Array()},Xn=({formatting:t=!0,subdocs:e=!0,yxml:n=!0}={})=>{let r=0;const i=o.Ue(),c=o.Ue(),l=o.Ue(),h=o.Ue();return h.set(null,null),a=>{switch(a.constructor){case es:case Us:return a;case Ds:{const g=a,f=g.content;switch(f.constructor){case rs:break;case ys:if(n){const t=f.type;t instanceof Xr&&(t.nodeName=o.Yu(c,t.nodeName,(()=>"node-"+r))),t instanceof qr&&(t.hookName=o.Yu(c,t.hookName,(()=>"hook-"+r)))}break;case hs:{const t=f;t.arr=t.arr.map((()=>r));break}case ns:f.content=new Uint8Array([r]);break;case is:{const t=f;e&&(t.opts={},t.doc.guid=r+"");break}case os:f.embed={};break;case cs:{const e=f;t&&(e.key=o.Yu(l,e.key,(()=>r+"")),e.value=o.Yu(h,e.value,(()=>({i:r}))));break}case ls:{const t=f;t.arr=t.arr.map((()=>r));break}case as:{const t=f;t.str=(d=r%10+"",u=t.str.length,s.JJ(u,(()=>d)).join(""));break}default:tt()}return g.parentSub&&(g.parentSub=o.Yu(i,g.parentSub,(()=>r+""))),r++,a}default:tt()}var d,u}},Zn=(t,e)=>Kn(t,Xn(e),ce,de),qn=(t,e)=>Kn(t,Xn(e),he,ge),Qn=t=>Kn(t,w.id,ce,ge),tr=t=>Kn(t,w.id,he,de);class er{constructor(t,e){this.target=t,this.currentTarget=t,this.transaction=e,this._changes=null,this._keys=null,this._delta=null}get path(){return nr(this.currentTarget,this.target)}deletes(t){return Kt(this.transaction.deleteSet,t.id)}get keys(){if(null===this._keys){const t=new Map,e=this.target;this.transaction.changed.get(e).forEach((n=>{if(null!==n){const r=e._map.get(n);let i,o;if(this.adds(r)){let t=r.left;for(;null!==t&&this.adds(t);)t=t.left;if(this.deletes(r)){if(null===t||!this.deletes(t))return;i="delete",o=s.Z$(t.content.getContent())}else null!==t&&this.deletes(t)?(i="update",o=s.Z$(t.content.getContent())):(i="add",o=void 0)}else{if(!this.deletes(r))return;i="delete",o=s.Z$(r.content.getContent())}t.set(n,{action:i,oldValue:o})}})),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(null===t){const e=this.target,n=Et.Ue(),r=Et.Ue(),s=[];if(t={added:n,deleted:r,delta:s,keys:this.keys},this.transaction.changed.get(e).has(null)){let t=null;const i=()=>{t&&s.push(t)};for(let s=e._start;null!==s;s=s.right)s.deleted?this.deletes(s)&&!this.adds(s)&&(null!==t&&void 0!==t.delete||(i(),t={delete:0}),t.delete+=s.length,r.add(s)):this.adds(s)?(null!==t&&void 0!==t.insert||(i(),t={insert:[]}),t.insert=t.insert.concat(s.content.getContent()),n.add(s)):(null!==t&&void 0!==t.retain||(i(),t={retain:0}),t.retain+=s.length);null!==t&&void 0===t.retain&&i()}this._changes=t}return t}}const nr=(t,e)=>{const n=[];for(;null!==e._item&&e!==t;){if(null!==e._item.parentSub)n.unshift(e._item.parentSub);else{let t=0,r=e._item.parent._start;for(;r!==e._item&&null!==r;)r.deleted||t++,r=r.right;n.unshift(t)}e=e._item.parent}return n};let rr=0;class sr{constructor(t,e){t.marker=!0,this.p=t,this.index=e,this.timestamp=rr++}}const ir=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=rr++},or=(t,e)=>{if(null===t._start||0===e||null===t._searchMarker)return null;const n=0===t._searchMarker.length?null:t._searchMarker.reduce(((t,n)=>i.Wn(e-t.index)<i.Wn(e-n.index)?t:n));let r=t._start,s=0;for(null!==n&&(r=n.p,s=n.index,(t=>{t.timestamp=rr++})(n));null!==r.right&&s<e;){if(!r.deleted&&r.countable){if(e<s+r.length)break;s+=r.length}r=r.right}for(;null!==r.left&&s>e;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);for(;null!==r.left&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);return null!==n&&i.Wn(n.index-s)<r.parent.length/80?(ir(n,r,s),n):((t,e,n)=>{if(t.length>=80){const r=t.reduce(((t,e)=>t.timestamp<e.timestamp?t:e));return ir(r,e,n),r}{const r=new sr(e,n);return t.push(r),r}})(t._searchMarker,r,s)},cr=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const s=t[r];if(n>0){let e=s.p;for(e.marker=!1;e&&(e.deleted||!e.countable);)e=e.left,e&&!e.deleted&&e.countable&&(s.index-=e.length);if(null===e||!0===e.marker){t.splice(r,1);continue}s.p=e,e.marker=!0}(e<s.index||n>0&&e===s.index)&&(s.index=i.Fp(e,s.index+n))}},lr=t=>{let e=t._start;const n=[];for(;e;)n.push(e),e=e.right;return n},hr=(t,e,n)=>{const r=t,s=e.changedParentTypes;for(;o.Yu(s,t,(()=>[])).push(n),null!==t._item;)t=t._item.parent;Te(r._eH,n,e)};class ar{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=ve(),this._dEH=ve(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,e){this.doc=t,this._item=e}_copy(){throw Q()}clone(){throw Q()}_write(t){}get _first(){let t=this._start;for(;null!==t&&t.deleted;)t=t.right;return t}_callObserver(t,e){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){Ae(this._eH,t)}observeDeep(t){Ae(this._dEH,t)}unobserve(t){Ue(this._eH,t)}unobserveDeep(t){Ue(this._dEH,t)}toJSON(){}}const dr=(t,e,n)=>{e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const s=[];let i=t._start;for(;null!==i&&r>0;){if(i.countable&&!i.deleted){const t=i.content.getContent();if(t.length<=e)e-=t.length;else{for(let n=e;n<t.length&&r>0;n++)s.push(t[n]),r--;e=0}}i=i.right}return s},ur=t=>{const e=[];let n=t._start;for(;null!==n;){if(n.countable&&!n.deleted){const t=n.content.getContent();for(let n=0;n<t.length;n++)e.push(t[n])}n=n.right}return e},gr=(t,e)=>{const n=[];let r=t._start;for(;null!==r;){if(r.countable&&sn(r,e)){const t=r.content.getContent();for(let e=0;e<t.length;e++)n.push(t[e])}r=r.right}return n},fr=(t,e)=>{let n=0,r=t._start;for(;null!==r;){if(r.countable&&!r.deleted){const s=r.content.getContent();for(let r=0;r<s.length;r++)e(s[r],n++,t)}r=r.right}},pr=(t,e)=>{const n=[];return fr(t,((r,s)=>{n.push(e(r,s,t))})),n},wr=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(null===n){for(;null!==e&&e.deleted;)e=e.right;if(null===e)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const t=n[r++];return n.length<=r&&(n=null),{done:!1,value:t}}}},mr=(t,e)=>{const n=or(t,e);let r=t._start;for(null!==n&&(r=n.p,e-=n.index);null!==r;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},kr=(t,e,n,r)=>{let s=n;const i=t.doc,o=i.clientID,c=i.store,l=null===n?e._start:n.right;let h=[];const a=()=>{h.length>0&&(s=new Ds(Oe(o,an(c,o)),s,s&&s.lastId,l,l&&l.id,e,null,new hs(h)),s.integrate(t,0),h=[])};r.forEach((n=>{if(null===n)h.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:h.push(n);break;default:switch(a(),n.constructor){case Uint8Array:case ArrayBuffer:s=new Ds(Oe(o,an(c,o)),s,s&&s.lastId,l,l&&l.id,e,null,new ns(new Uint8Array(n))),s.integrate(t,0);break;case ie:s=new Ds(Oe(o,an(c,o)),s,s&&s.lastId,l,l&&l.id,e,null,new is(n)),s.integrate(t,0);break;default:if(!(n instanceof ar))throw new Error("Unexpected content type in insert operation");s=new Ds(Oe(o,an(c,o)),s,s&&s.lastId,l,l&&l.id,e,null,new ys(n)),s.integrate(t,0)}}})),a()},yr=q("Length exceeded!"),br=(t,e,n,r)=>{if(n>e._length)throw yr;if(0===n)return e._searchMarker&&cr(e._searchMarker,n,r.length),kr(t,e,null,r);const s=n,i=or(e,n);let o=e._start;for(null!==i&&(o=i.p,0==(n-=i.index)&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));null!==o;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&pn(t,Oe(o.id.client,o.id.clock+n));break}n-=o.length}return e._searchMarker&&cr(e._searchMarker,s,r.length),kr(t,e,o,r)},_r=(t,e,n,r)=>{if(0===r)return;const s=n,i=r,o=or(e,n);let c=e._start;for(null!==o&&(c=o.p,n-=o.index);null!==c&&n>0;c=c.right)!c.deleted&&c.countable&&(n<c.length&&pn(t,Oe(c.id.client,c.id.clock+n)),n-=c.length);for(;r>0&&null!==c;)c.deleted||(r<c.length&&pn(t,Oe(c.id.client,c.id.clock+r)),c.delete(t),r-=c.length),c=c.right;if(r>0)throw yr;e._searchMarker&&cr(e._searchMarker,s,-i+r)},Sr=(t,e,n)=>{const r=e._map.get(n);void 0!==r&&r.delete(t)},Er=(t,e,n,r)=>{const s=e._map.get(n)||null,i=t.doc,o=i.clientID;let c;if(null==r)c=new hs([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:c=new hs([r]);break;case Uint8Array:c=new ns(r);break;case ie:c=new is(r);break;default:if(!(r instanceof ar))throw new Error("Unexpected content type");c=new ys(r)}new Ds(Oe(o,an(i.store,o)),s,s&&s.lastId,null,null,e,n,c).integrate(t,0)},Cr=(t,e)=>{const n=t._map.get(e);return void 0===n||n.deleted?void 0:n.content.getContent()[n.length-1]},Dr=t=>{const e={};return t._map.forEach(((t,n)=>{t.deleted||(e[n]=t.content.getContent()[t.length-1])})),e},vr=(t,e)=>{const n=t._map.get(e);return void 0!==n&&!n.deleted},Ar=(t,e,n)=>{let r=t._map.get(e)||null;for(;null!==r&&(!n.sv.has(r.id.client)||r.id.clock>=(n.sv.get(r.id.client)||0));)r=r.left;return null!==r&&sn(r,n)?r.content.getContent()[r.length-1]:void 0},Ur=t=>{return e=t.entries(),n=t=>!t[1].deleted,jt((()=>{let t;do{t=e.next()}while(!t.done&&!n(t.value));return t}));var e,n};class Tr extends er{constructor(t,e){super(t,e),this._transaction=e}}class Mr extends ar{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const e=new Mr;return e.push(t),e}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Mr}clone(){const t=new Mr;return t.insert(0,this.toArray().map((t=>t instanceof ar?t.clone():t))),t}get length(){return null===this._prelimContent?this._length:this._prelimContent.length}_callObserver(t,e){super._callObserver(t,e),hr(this,t,new Tr(this,t))}insert(t,e){null!==this.doc?vn(this.doc,(n=>{br(n,this,t,e)})):this._prelimContent.splice(t,0,...e)}push(t){null!==this.doc?vn(this.doc,(e=>{((t,e,n)=>{let r=(e._searchMarker||[]).reduce(((t,e)=>e.index>t.index?e:t),{index:0,p:e._start}).p;if(r)for(;r.right;)r=r.right;kr(t,e,r,n)})(e,this,t)})):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,e=1){null!==this.doc?vn(this.doc,(n=>{_r(n,this,t,e)})):this._prelimContent.splice(t,e)}get(t){return mr(this,t)}toArray(){return ur(this)}slice(t=0,e=this.length){return dr(this,t,e)}toJSON(){return this.map((t=>t instanceof ar?t.toJSON():t))}map(t){return pr(this,t)}forEach(t){fr(this,t)}[Symbol.iterator](){return wr(this)}_write(t){t.writeTypeRef(us)}}class xr extends er{constructor(t,e,n){super(t,e),this.keysChanged=n}}class Or extends ar{constructor(t){super(),this._prelimContent=null,this._prelimContent=void 0===t?new Map:new Map(t)}_integrate(t,e){super._integrate(t,e),this._prelimContent.forEach(((t,e)=>{this.set(e,t)})),this._prelimContent=null}_copy(){return new Or}clone(){const t=new Or;return this.forEach(((e,n)=>{t.set(n,e instanceof ar?e.clone():e)})),t}_callObserver(t,e){hr(this,t,new xr(this,t,e))}toJSON(){const t={};return this._map.forEach(((e,n)=>{if(!e.deleted){const r=e.content.getContent()[e.length-1];t[n]=r instanceof ar?r.toJSON():r}})),t}get size(){return[...Ur(this._map)].length}keys(){return Gt(Ur(this._map),(t=>t[0]))}values(){return Gt(Ur(this._map),(t=>t[1].content.getContent()[t[1].length-1]))}entries(){return Gt(Ur(this._map),(t=>[t[0],t[1].content.getContent()[t[1].length-1]]))}forEach(t){this._map.forEach(((e,n)=>{e.deleted||t(e.content.getContent()[e.length-1],n,this)}))}[Symbol.iterator](){return this.entries()}delete(t){null!==this.doc?vn(this.doc,(e=>{Sr(e,this,t)})):this._prelimContent.delete(t)}set(t,e){return null!==this.doc?vn(this.doc,(n=>{Er(n,this,t,e)})):this._prelimContent.set(t,e),e}get(t){return Cr(this,t)}has(t){return vr(this,t)}clear(){null!==this.doc?vn(this.doc,(t=>{this.forEach((function(e,n,r){Sr(t,r,n)}))})):this._prelimContent.clear()}_write(t){t.writeTypeRef(gs)}}const Ir=(t,e)=>t===e||"object"==typeof t&&"object"==typeof e&&t&&e&&Yt.$m(t,e);class Nr{constructor(t,e,n,r){this.left=t,this.right=e,this.index=n,this.currentAttributes=r}forward(){null===this.right&&tt(),this.right.content.constructor===cs?this.right.deleted||Vr(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const Lr=(t,e,n)=>{for(;null!==e.right&&n>0;)e.right.content.constructor===cs?e.right.deleted||Vr(e.currentAttributes,e.right.content):e.right.deleted||(n<e.right.length&&pn(t,Oe(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length),e.left=e.right,e.right=e.right.right;return e},Rr=(t,e,n)=>{const r=new Map,s=or(e,n);if(s){const e=new Nr(s.p.left,s.p,s.index,r);return Lr(t,e,n-s.index)}{const s=new Nr(null,e._start,0,r);return Lr(t,s,n)}},Pr=(t,e,n,r)=>{for(;null!==n.right&&(!0===n.right.deleted||n.right.content.constructor===cs&&Ir(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const s=t.doc,i=s.clientID;r.forEach(((r,o)=>{const c=n.left,l=n.right,h=new Ds(Oe(i,an(s.store,i)),c,c&&c.lastId,l,l&&l.id,e,null,new cs(o,r));h.integrate(t,0),n.right=h,n.forward()}))},Vr=(t,e)=>{const{key:n,value:r}=e;null===r?t.delete(n):t.set(n,r)},Jr=(t,e)=>{for(;null!==t.right&&(t.right.deleted||t.right.content.constructor===cs&&Ir(e[t.right.content.key]||null,t.right.content.value));)t.forward()},Fr=(t,e,n,r)=>{const s=t.doc,i=s.clientID,o=new Map;for(const c in r){const l=r[c],h=n.currentAttributes.get(c)||null;if(!Ir(h,l)){o.set(c,h);const{left:r,right:a}=n;n.right=new Ds(Oe(i,an(s.store,i)),r,r&&r.lastId,a,a&&a.id,e,null,new cs(c,l)),n.right.integrate(t,0),n.forward()}}return o},Wr=(t,e,n,r,s)=>{n.currentAttributes.forEach(((t,e)=>{void 0===s[e]&&(s[e]=null)}));const i=t.doc,o=i.clientID;Jr(n,s);const c=Fr(t,e,n,s),l=r.constructor===String?new as(r):r instanceof ar?new ys(r):new os(r);let{left:h,right:a,index:d}=n;e._searchMarker&&cr(e._searchMarker,n.index,l.getLength()),a=new Ds(Oe(o,an(i.store,o)),h,h&&h.lastId,a,a&&a.id,e,null,l),a.integrate(t,0),n.right=a,n.index=d,n.forward(),Pr(t,e,n,c)},jr=(t,e,n,r,s)=>{const i=t.doc,o=i.clientID;Jr(n,s);const c=Fr(t,e,n,s);t:for(;null!==n.right&&(r>0||c.size>0&&(n.right.deleted||n.right.content.constructor===cs));){if(!n.right.deleted)switch(n.right.content.constructor){case cs:{const{key:e,value:i}=n.right.content,o=s[e];if(void 0!==o){if(Ir(o,i))c.delete(e);else{if(0===r)break t;c.set(e,i)}n.right.delete(t)}else n.currentAttributes.set(e,i);break}default:r<n.right.length&&pn(t,Oe(n.right.id.client,n.right.id.clock+r)),r-=n.right.length}n.forward()}if(r>0){let s="";for(;r>0;r--)s+="\n";n.right=new Ds(Oe(o,an(i.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new as(s)),n.right.integrate(t,0),n.forward()}Pr(t,e,n,c)},Gr=(t,e,n,r,s)=>{let i=e;const c=o.Ue();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===cs){const t=i.content;c.set(t.key,t)}i=i.right}let l=0,h=!1;for(;e!==i;){if(n===e&&(h=!0),!e.deleted){const n=e.content;switch(n.constructor){case cs:{const{key:i,value:o}=n,a=r.get(i)||null;c.get(i)===n&&a!==o||(e.delete(t),l++,h||(s.get(i)||null)!==o||a===o||(null===a?s.delete(i):s.set(i,a))),h||e.deleted||Vr(s,n);break}}}e=e.right}return l},Yr=t=>{let e=0;return vn(t.doc,(n=>{let r=t._start,s=t._start,i=o.Ue();const c=o.JG(i);for(;s;)!1===s.deleted&&(s.content.constructor===cs?Vr(c,s.content):(e+=Gr(n,r,s,i,c),i=o.JG(c),r=s)),s=s.right})),e},$r=(t,e,n)=>{const r=n,s=o.JG(e.currentAttributes),i=e.right;for(;n>0&&null!==e.right;){if(!1===e.right.deleted)switch(e.right.content.constructor){case ys:case os:case as:n<e.right.length&&pn(t,Oe(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t)}e.forward()}i&&Gr(t,i,e.right,s,e.currentAttributes);const c=(e.left||e.right).parent;return c._searchMarker&&cr(c._searchMarker,e.index,-r+n),e};class zr extends er{constructor(t,e,n){super(t,e),this.childListChanged=!1,this.keysChanged=new Set,n.forEach((t=>{null===t?this.childListChanged=!0:this.keysChanged.add(t)}))}get changes(){if(null===this._changes){const t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(null===this._delta){const t=this.target.doc,e=[];vn(t,(t=>{const n=new Map,r=new Map;let s=this.target._start,i=null;const o={};let c="",l=0,h=0;const a=()=>{if(null!==i){let t=null;switch(i){case"delete":h>0&&(t={delete:h}),h=0;break;case"insert":("object"==typeof c||c.length>0)&&(t={insert:c},n.size>0&&(t.attributes={},n.forEach(((e,n)=>{null!==e&&(t.attributes[n]=e)})))),c="";break;case"retain":l>0&&(t={retain:l},Yt.xb(o)||(t.attributes=Yt.f0({},o))),l=0}t&&e.push(t),i=null}};for(;null!==s;){switch(s.content.constructor){case ys:case os:this.adds(s)?this.deletes(s)||(a(),i="insert",c=s.content.getContent()[0],a()):this.deletes(s)?("delete"!==i&&(a(),i="delete"),h+=1):s.deleted||("retain"!==i&&(a(),i="retain"),l+=1);break;case as:this.adds(s)?this.deletes(s)||("insert"!==i&&(a(),i="insert"),c+=s.content.str):this.deletes(s)?("delete"!==i&&(a(),i="delete"),h+=s.length):s.deleted||("retain"!==i&&(a(),i="retain"),l+=s.length);break;case cs:{const{key:e,value:c}=s.content;if(this.adds(s)){if(!this.deletes(s)){const l=n.get(e)||null;Ir(l,c)?null!==c&&s.delete(t):("retain"===i&&a(),Ir(c,r.get(e)||null)?delete o[e]:o[e]=c)}}else if(this.deletes(s)){r.set(e,c);const t=n.get(e)||null;Ir(t,c)||("retain"===i&&a(),o[e]=t)}else if(!s.deleted){r.set(e,c);const n=o[e];void 0!==n&&(Ir(n,c)?null!==n&&s.delete(t):("retain"===i&&a(),null===c?delete o[e]:o[e]=c))}s.deleted||("insert"===i&&a(),Vr(n,s.content));break}}s=s.right}for(a();e.length>0;){const t=e[e.length-1];if(void 0===t.retain||void 0!==t.attributes)break;e.pop()}})),this._delta=e}return this._delta}}class Br extends ar{constructor(t){super(),this._pending=void 0!==t?[()=>this.insert(0,t)]:[],this._searchMarker=[]}get length(){return this._length}_integrate(t,e){super._integrate(t,e);try{this._pending.forEach((t=>t()))}catch(t){console.error(t)}this._pending=null}_copy(){return new Br}clone(){const t=new Br;return t.applyDelta(this.toDelta()),t}_callObserver(t,e){super._callObserver(t,e);const n=new zr(this,t,e),r=t.doc;if(hr(this,t,n),!t.local){let e=!1;for(const[n,s]of t.afterState.entries()){const i=t.beforeState.get(n)||0;if(s!==i&&(mn(t,r.store.clients.get(n),i,s,(t=>{t.deleted||t.content.constructor!==cs||(e=!0)})),e))break}e||Ht(t,t.deleteSet,(t=>{t instanceof es||e||t.parent===this&&t.content.constructor===cs&&(e=!0)})),vn(r,(t=>{e?Yr(this):Ht(t,t.deleteSet,(e=>{e instanceof es||e.parent===this&&((t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===cs){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}})(t,e)}))}))}}toString(){let t="",e=this._start;for(;null!==e;)!e.deleted&&e.countable&&e.content.constructor===as&&(t+=e.content.str),e=e.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:e=!0}={}){null!==this.doc?vn(this.doc,(n=>{const r=new Nr(null,this._start,0,new Map);for(let s=0;s<t.length;s++){const i=t[s];if(void 0!==i.insert){const o=e||"string"!=typeof i.insert||s!==t.length-1||null!==r.right||"\n"!==i.insert.slice(-1)?i.insert:i.insert.slice(0,-1);("string"!=typeof o||o.length>0)&&Wr(n,this,r,o,i.attributes||{})}else void 0!==i.retain?jr(n,this,r,i.retain,i.attributes||{}):void 0!==i.delete&&$r(n,r,i.delete)}})):this._pending.push((()=>this.applyDelta(t)))}toDelta(t,e,n){const r=[],s=new Map,i=this.doc;let o="",c=this._start;function l(){if(o.length>0){const t={};let e=!1;s.forEach(((n,r)=>{e=!0,t[r]=n}));const n={insert:o};e&&(n.attributes=t),r.push(n),o=""}}const h=()=>{for(;null!==c;){if(sn(c,t)||void 0!==e&&sn(c,e))switch(c.content.constructor){case as:{const r=s.get("ychange");void 0===t||sn(c,t)?void 0===e||sn(c,e)?void 0!==r&&(l(),s.delete("ychange")):void 0!==r&&r.user===c.id.client&&"added"===r.type||(l(),s.set("ychange",n?n("added",c.id):{type:"added"})):void 0!==r&&r.user===c.id.client&&"removed"===r.type||(l(),s.set("ychange",n?n("removed",c.id):{type:"removed"})),o+=c.content.str;break}case ys:case os:{l();const t={insert:c.content.getContent()[0]};if(s.size>0){const e={};t.attributes=e,s.forEach(((t,n)=>{e[n]=t}))}r.push(t);break}case cs:sn(c,t)&&(l(),Vr(s,c.content))}c=c.right}l()};return t||e?vn(i,(n=>{t&&on(n,t),e&&on(n,e),h()}),"cleanup"):h(),r}insert(t,e,n){if(e.length<=0)return;const r=this.doc;null!==r?vn(r,(r=>{const s=Rr(r,this,t);n||(n={},s.currentAttributes.forEach(((t,e)=>{n[e]=t}))),Wr(r,this,s,e,n)})):this._pending.push((()=>this.insert(t,e,n)))}insertEmbed(t,e,n={}){const r=this.doc;null!==r?vn(r,(r=>{const s=Rr(r,this,t);Wr(r,this,s,e,n)})):this._pending.push((()=>this.insertEmbed(t,e,n)))}delete(t,e){if(0===e)return;const n=this.doc;null!==n?vn(n,(n=>{$r(n,Rr(n,this,t),e)})):this._pending.push((()=>this.delete(t,e)))}format(t,e,n){if(0===e)return;const r=this.doc;null!==r?vn(r,(r=>{const s=Rr(r,this,t);null!==s.right&&jr(r,this,s,e,n)})):this._pending.push((()=>this.format(t,e,n)))}removeAttribute(t){null!==this.doc?vn(this.doc,(e=>{Sr(e,this,t)})):this._pending.push((()=>this.removeAttribute(t)))}setAttribute(t,e){null!==this.doc?vn(this.doc,(n=>{Er(n,this,t,e)})):this._pending.push((()=>this.setAttribute(t,e)))}getAttribute(t){return Cr(this,t)}getAttributes(){return Dr(this)}_write(t){t.writeTypeRef(fs)}}class Hr{constructor(t,e=(()=>!0)){this._filter=e,this._root=t,this._currentNode=t._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let t=this._currentNode,e=t&&t.content&&t.content.type;if(null!==t&&(!this._firstCall||t.deleted||!this._filter(e)))do{if(e=t.content.type,t.deleted||e.constructor!==Xr&&e.constructor!==Kr||null===e._start)for(;null!==t;){if(null!==t.right){t=t.right;break}t=t.parent===this._root?null:t.parent._item}else t=e._start}while(null!==t&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,null===t?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}}class Kr extends ar{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Kr}clone(){const t=new Kr;return t.insert(0,this.toArray().map((t=>t instanceof ar?t.clone():t))),t}get length(){return null===this._prelimContent?this._length:this._prelimContent.length}createTreeWalker(t){return new Hr(this,t)}querySelector(t){t=t.toUpperCase();const e=new Hr(this,(e=>e.nodeName&&e.nodeName.toUpperCase()===t)).next();return e.done?null:e.value}querySelectorAll(t){return t=t.toUpperCase(),s.Dp(new Hr(this,(e=>e.nodeName&&e.nodeName.toUpperCase()===t)))}_callObserver(t,e){hr(this,t,new Zr(this,e,t))}toString(){return pr(this,(t=>t.toString())).join("")}toJSON(){return this.toString()}toDOM(t=document,e={},n){const r=t.createDocumentFragment();return void 0!==n&&n._createAssociation(r,this),fr(this,(s=>{r.insertBefore(s.toDOM(t,e,n),null)})),r}insert(t,e){null!==this.doc?vn(this.doc,(n=>{br(n,this,t,e)})):this._prelimContent.splice(t,0,...e)}insertAfter(t,e){if(null!==this.doc)vn(this.doc,(n=>{const r=t&&t instanceof ar?t._item:t;kr(n,this,r,e)}));else{const n=this._prelimContent,r=null===t?0:n.findIndex((e=>e===t))+1;if(0===r&&null!==t)throw q("Reference item not found");n.splice(r,0,...e)}}delete(t,e=1){null!==this.doc?vn(this.doc,(n=>{_r(n,this,t,e)})):this._prelimContent.splice(t,e)}toArray(){return ur(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return mr(this,t)}slice(t=0,e=this.length){return dr(this,t,e)}forEach(t){fr(this,t)}_write(t){t.writeTypeRef(ws)}}class Xr extends Kr{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,e){super._integrate(t,e),this._prelimAttrs.forEach(((t,e)=>{this.setAttribute(e,t)})),this._prelimAttrs=null}_copy(){return new Xr(this.nodeName)}clone(){const t=new Xr(this.nodeName),e=this.getAttributes();return Yt.Ed(e,((e,n)=>{"string"==typeof e&&t.setAttribute(n,e)})),t.insert(0,this.toArray().map((t=>t instanceof ar?t.clone():t))),t}toString(){const t=this.getAttributes(),e=[],n=[];for(const e in t)n.push(e);n.sort();const r=n.length;for(let s=0;s<r;s++){const r=n[s];e.push(r+'="'+t[r]+'"')}const s=this.nodeName.toLocaleLowerCase();return`<${s}${e.length>0?" "+e.join(" "):""}>${super.toString()}</${s}>`}removeAttribute(t){null!==this.doc?vn(this.doc,(e=>{Sr(e,this,t)})):this._prelimAttrs.delete(t)}setAttribute(t,e){null!==this.doc?vn(this.doc,(n=>{Er(n,this,t,e)})):this._prelimAttrs.set(t,e)}getAttribute(t){return Cr(this,t)}hasAttribute(t){return vr(this,t)}getAttributes(){return Dr(this)}toDOM(t=document,e={},n){const r=t.createElement(this.nodeName),s=this.getAttributes();for(const t in s){const e=s[t];"string"==typeof e&&r.setAttribute(t,e)}return fr(this,(s=>{r.appendChild(s.toDOM(t,e,n))})),void 0!==n&&n._createAssociation(r,this),r}_write(t){t.writeTypeRef(ps),t.writeKey(this.nodeName)}}class Zr extends er{constructor(t,e,n){super(t,n),this.childListChanged=!1,this.attributesChanged=new Set,e.forEach((t=>{null===t?this.childListChanged=!0:this.attributesChanged.add(t)}))}}class qr extends Or{constructor(t){super(),this.hookName=t}_copy(){return new qr(this.hookName)}clone(){const t=new qr(this.hookName);return this.forEach(((e,n)=>{t.set(n,e)})),t}toDOM(t=document,e={},n){const r=e[this.hookName];let s;return s=void 0!==r?r.createDom(this):document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),void 0!==n&&n._createAssociation(s,this),s}_write(t){t.writeTypeRef(ms),t.writeKey(this.hookName)}}class Qr extends Br{get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new Qr}clone(){const t=new Qr;return t.applyDelta(this.toDelta()),t}toDOM(t=document,e,n){const r=t.createTextNode(this.toString());return void 0!==n&&n._createAssociation(r,this),r}toString(){return this.toDelta().map((t=>{const e=[];for(const n in t.attributes){const r=[];for(const e in t.attributes[n])r.push({key:e,value:t.attributes[n][e]});r.sort(((t,e)=>t.key<e.key?-1:1)),e.push({nodeName:n,attrs:r})}e.sort(((t,e)=>t.nodeName<e.nodeName?-1:1));let n="";for(let t=0;t<e.length;t++){const r=e[t];n+=`<${r.nodeName}`;for(let t=0;t<r.attrs.length;t++){const e=r.attrs[t];n+=` ${e.key}="${e.value}"`}n+=">"}n+=t.insert;for(let t=e.length-1;t>=0;t--)n+=`</${e[t].nodeName}>`;return n})).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(ks)}}class ts{constructor(t,e){this.id=t,this.length=e}get deleted(){throw Q()}mergeWith(t){return!1}write(t,e,n){throw Q()}integrate(t,e){throw Q()}}class es extends ts{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor===t.constructor&&(this.length+=t.length,!0)}integrate(t,e){e>0&&(this.id.clock+=e,this.length-=e),dn(t.doc.store,this)}write(t,e){t.writeInfo(0),t.writeLen(this.length-e)}getMissing(t,e){return null}}class ns{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new ns(this.content)}splice(t){throw Q()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeBuf(this.content)}getRef(){return 3}}class rs{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new rs(this.len)}splice(t){const e=new rs(this.len-t);return this.len=t,e}mergeWith(t){return this.len+=t.len,!0}integrate(t,e){qt(t.deleteSet,e.id.client,e.id.clock,this.len),e.markDeleted()}delete(t){}gc(t){}write(t,e){t.writeLen(this.len-e)}getRef(){return 1}}const ss=(t,e)=>new ie({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class is{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;const e={};this.opts=e,t.gc||(e.gc=!1),t.autoLoad&&(e.autoLoad=!0),null!==t.meta&&(e.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new is(ss(this.doc.guid,this.opts))}splice(t){throw Q()}mergeWith(t){return!1}integrate(t,e){this.doc._item=e,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,e){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}}class os{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new os(this.embed)}splice(t){throw Q()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeJSON(this.embed)}getRef(){return 5}}class cs{constructor(t,e){this.key=t,this.value=e}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new cs(this.key,this.value)}splice(t){throw Q()}mergeWith(t){return!1}integrate(t,e){e.parent._searchMarker=null}delete(t){}gc(t){}write(t,e){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}}class ls{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ls(this.arr)}splice(t){const e=new ls(this.arr.slice(t));return this.arr=this.arr.slice(0,t),e}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){const n=this.arr.length;t.writeLen(n-e);for(let r=e;r<n;r++){const e=this.arr[r];t.writeString(void 0===e?"undefined":JSON.stringify(e))}}getRef(){return 2}}class hs{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new hs(this.arr)}splice(t){const e=new hs(this.arr.slice(t));return this.arr=this.arr.slice(0,t),e}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){const n=this.arr.length;t.writeLen(n-e);for(let r=e;r<n;r++){const e=this.arr[r];t.writeAny(e)}}getRef(){return 8}}class as{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new as(this.str)}splice(t){const e=new as(this.str.slice(t));this.str=this.str.slice(0,t);const n=this.str.charCodeAt(t-1);return n>=55296&&n<=56319&&(this.str=this.str.slice(0,t-1)+"�",e.str="�"+e.str.slice(1)),e}mergeWith(t){return this.str+=t.str,!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeString(0===e?this.str:this.str.slice(e))}getRef(){return 4}}const ds=[t=>new Mr,t=>new Or,t=>new Br,t=>new Xr(t.readKey()),t=>new Kr,t=>new qr(t.readKey()),t=>new Qr],us=0,gs=1,fs=2,ps=3,ws=4,ms=5,ks=6;class ys{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new ys(this.type._copy())}splice(t){throw Q()}mergeWith(t){return!1}integrate(t,e){this.type._integrate(t.doc,e)}delete(t){let e=this.type._start;for(;null!==e;)e.deleted?t._mergeStructs.push(e):e.delete(t),e=e.right;this.type._map.forEach((e=>{e.deleted?t._mergeStructs.push(e):e.delete(t)})),t.changed.delete(this.type)}gc(t){let e=this.type._start;for(;null!==e;)e.gc(t,!0),e=e.right;this.type._start=null,this.type._map.forEach((e=>{for(;null!==e;)e.gc(t,!0),e=e.left})),this.type._map=new Map}write(t,e){this.type._write(t)}getRef(){return 7}}const bs=(t,e)=>{let n,r=e,s=0;do{s>0&&(r=Oe(r.client,r.clock+s)),n=gn(t,r),s=r.clock-n.id.clock,r=n.redone}while(null!==r&&n instanceof Ds);return{item:n,diff:s}},_s=(t,e)=>{for(;null!==t&&t.keep!==e;)t.keep=e,t=t.parent._item},Ss=(t,e,n)=>{const{client:r,clock:s}=e.id,i=new Ds(Oe(r,s+n),e,Oe(r,s+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&i.markDeleted(),e.keep&&(i.keep=!0),null!==e.redone&&(i.redone=Oe(e.redone.client,e.redone.clock+n)),e.right=i,null!==i.right&&(i.right.left=i),t._mergeStructs.push(i),null!==i.parentSub&&null===i.right&&i.parent._map.set(i.parentSub,i),e.length=n,i},Es=(t,e)=>s.G(t,(t=>Kt(t.deletions,e))),Cs=(t,e,n,r,s,i)=>{const o=t.doc,c=o.store,l=o.clientID,h=e.redone;if(null!==h)return pn(t,h);let a,d=e.parent._item,u=null;if(null!==d&&!0===d.deleted){if(null===d.redone&&(!n.has(d)||null===Cs(t,d,n,r,s,i)))return null;for(;null!==d.redone;)d=pn(t,d.redone)}const g=null===d?e.parent:d.content.type;if(null===e.parentSub){for(u=e.left,a=e;null!==u;){let e=u;for(;null!==e&&e.parent._item!==d;)e=null===e.redone?null:pn(t,e.redone);if(null!==e&&e.parent._item===d){u=e;break}u=u.left}for(;null!==a;){let e=a;for(;null!==e&&e.parent._item!==d;)e=null===e.redone?null:pn(t,e.redone);if(null!==e&&e.parent._item===d){a=e;break}a=a.right}}else if(a=null,e.right&&!s){for(u=e;null!==u&&null!==u.right&&(u.right.redone||Kt(r,u.right.id)||Es(i.undoStack,u.right.id)||Es(i.redoStack,u.right.id));)for(u=u.right;u.redone;)u=pn(t,u.redone);if(u&&null!==u.right)return null}else u=g._map.get(e.parentSub)||null;const f=an(c,l),p=Oe(l,f),w=new Ds(p,u,u&&u.lastId,a,a&&a.id,g,e.parentSub,e.content.copy());return e.redone=p,_s(w,!0),w.integrate(t,0),w};class Ds extends ts{constructor(t,e,n,r,s,i,o,c){super(t,c.getLength()),this.origin=n,this.left=e,this.right=r,this.rightOrigin=s,this.parent=i,this.parentSub=o,this.redone=null,this.content=c,this.info=this.content.isCountable()?2:0}set marker(t){(8&this.info)>0!==t&&(this.info^=8)}get marker(){return(8&this.info)>0}get keep(){return(1&this.info)>0}set keep(t){this.keep!==t&&(this.info^=1)}get countable(){return(2&this.info)>0}get deleted(){return(4&this.info)>0}set deleted(t){this.deleted!==t&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,e){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=an(e,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=an(e,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Me&&this.id.client!==this.parent.client&&this.parent.clock>=an(e,this.parent.client))return this.parent.client;if(this.origin&&(this.left=wn(t,e,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=pn(t,this.rightOrigin),this.rightOrigin=this.right.id),(this.left&&this.left.constructor===es||this.right&&this.right.constructor===es)&&(this.parent=null),this.parent){if(this.parent.constructor===Me){const t=gn(e,this.parent);t.constructor===es?this.parent=null:this.parent=t.content.type}}else this.left&&this.left.constructor===Ds&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===Ds&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);return null}integrate(t,e){if(e>0&&(this.id.clock+=e,this.left=wn(t,t.doc.store,Oe(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(e),this.length-=e),this.parent){if(!this.left&&(!this.right||null!==this.right.left)||this.left&&this.left.right!==this.right){let e,n=this.left;if(null!==n)e=n.right;else if(null!==this.parentSub)for(e=this.parent._map.get(this.parentSub)||null;null!==e&&null!==e.left;)e=e.left;else e=this.parent._start;const r=new Set,s=new Set;for(;null!==e&&e!==this.right;){if(s.add(e),r.add(e),xe(this.origin,e.origin)){if(e.id.client<this.id.client)n=e,r.clear();else if(xe(this.rightOrigin,e.rightOrigin))break}else{if(null===e.origin||!s.has(gn(t.doc.store,e.origin)))break;r.has(gn(t.doc.store,e.origin))||(n=e,r.clear())}e=e.right}this.left=n}if(null!==this.left){const t=this.left.right;this.right=t,this.left.right=this}else{let t;if(null!==this.parentSub)for(t=this.parent._map.get(this.parentSub)||null;null!==t&&null!==t.left;)t=t.left;else t=this.parent._start,this.parent._start=this;this.right=t}null!==this.right?this.right.left=this:null!==this.parentSub&&(this.parent._map.set(this.parentSub,this),null!==this.left&&this.left.delete(t)),null===this.parentSub&&this.countable&&!this.deleted&&(this.parent._length+=this.length),dn(t.doc.store,this),this.content.integrate(t,this),bn(t,this.parent,this.parentSub),(null!==this.parent._item&&this.parent._item.deleted||null!==this.parentSub&&null!==this.right)&&this.delete(t)}else new es(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;null!==t&&t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;null!==t&&t.deleted;)t=t.left;return t}get lastId(){return 1===this.length?this.id:Oe(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&xe(t.origin,this.lastId)&&this.right===t&&xe(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&null===this.redone&&null===t.redone&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){const e=this.parent._searchMarker;return e&&e.forEach((e=>{e.p===t&&(e.p=this,!this.deleted&&this.countable&&(e.index-=this.length))})),t.keep&&(this.keep=!0),this.right=t.right,null!==this.right&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){const e=this.parent;this.countable&&null===this.parentSub&&(e._length-=this.length),this.markDeleted(),qt(t.deleteSet,this.id.client,this.id.clock,this.length),bn(t,e,this.parentSub),this.content.delete(t)}}gc(t,e){if(!this.deleted)throw tt();this.content.gc(t),e?((t,e,n)=>{const r=t.clients.get(e.id.client);r[un(r,e.id.clock)]=n})(t,this,new es(this.id,this.length)):this.content=new rs(this.length)}write(t,e){const n=e>0?Oe(this.id.client,this.id.clock+e-1):this.origin,r=this.rightOrigin,s=this.parentSub,i=31&this.content.getRef()|(null===n?0:A)|(null===r?0:v)|(null===s?0:32);if(t.writeInfo(i),null!==n&&t.writeLeftID(n),null!==r&&t.writeRightID(r),null===n&&null===r){const e=this.parent;if(void 0!==e._item){const n=e._item;if(null===n){const n=Le(e);t.writeParentInfo(!0),t.writeString(n)}else t.writeParentInfo(!1),t.writeLeftID(n.id)}else e.constructor===String?(t.writeParentInfo(!0),t.writeString(e)):e.constructor===Me?(t.writeParentInfo(!1),t.writeLeftID(e)):tt();null!==s&&t.writeString(s)}this.content.write(t,e)}}const vs=(t,e)=>As[31&e](t),As=[()=>{tt()},t=>new rs(t.readLen()),t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const e=t.readString();"undefined"===e?n.push(void 0):n.push(JSON.parse(e))}return new ls(n)},t=>new ns(t.readBuf()),t=>new as(t.readString()),t=>new os(t.readJSON()),t=>new cs(t.readKey(),t.readJSON()),t=>new ys(ds[t.readTypeRef()](t)),t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new hs(n)},t=>new is(ss(t.readString(),t.readAny())),()=>{tt()}];class Us extends ts{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor===t.constructor&&(this.length+=t.length,!0)}integrate(t,e){tt()}write(t,e){t.writeInfo(10),R(t.restEncoder,this.length-e)}getMissing(t,e){return null}}const Ts="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},Ms="__ $YJS$ __";!0===Ts[Ms]&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),Ts[Ms]=!0}}]);
|
|
1
|
+
(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7957],{79504:(t,e,n)=>{"use strict";n.d(e,{Dp:()=>i,G:()=>o,JJ:()=>c,Z$:()=>r,kJ:()=>l,s7:()=>s});const r=t=>t[t.length-1],s=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},i=Array.from,o=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},c=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},l=Array.isArray},38828:(t,e,n)=>{"use strict";n.d(e,{Hi:()=>c,PP:()=>i,gB:()=>l,id:()=>o});var r=n(79504),s=n(36498);const i=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&i(t,e,n+1)}},o=t=>t,c=(t,e)=>{if(null==t||null==e)return((t,e)=>t===e)(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break;case Set:if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break;case Map:if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!c(t.get(n),e.get(n)))return!1;break;case Object:if(s.kE(t)!==s.kE(e))return!1;for(const n in t)if(!s.l$(t,n)||!c(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!c(t[n],e[n]))return!1;break;default:return!1}return!0},l=(t,e)=>e.includes(t);r.kJ},22592:(t,e,n)=>{"use strict";n.d(e,{JG:()=>s,UI:()=>o,Ue:()=>r,Yj:()=>c,Yu:()=>i});const r=()=>new Map,s=t=>{const e=r();return t.forEach(((t,n)=>{e.set(n,t)})),e},i=(t,e,n)=>{let r=t.get(e);return void 0===r&&t.set(e,r=n()),r},o=(t,e)=>{const n=[];for(const[r,s]of t)n.push(e(s,r));return n},c=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1}},11182:(t,e,n)=>{"use strict";n.d(e,{Fp:()=>o,GR:()=>c,GW:()=>r,VV:()=>i,Wn:()=>s});const r=Math.floor,s=(Math.ceil,Math.abs),i=(Math.imul,Math.round,Math.log10,Math.log2,Math.log,Math.sqrt,(t,e)=>t<e?t:e),o=(t,e)=>t>e?t:e,c=(Number.isNaN,Math.pow,Math.sign,t=>0!==t?t<0:1/t<0)},36498:(t,e,n)=>{"use strict";n.d(e,{$m:()=>h,Ed:()=>i,f0:()=>r,kE:()=>o,l$:()=>l,xb:()=>c});const r=Object.assign,s=Object.keys,i=(t,e)=>{for(const n in t)e(t[n],n)},o=t=>s(t).length,c=t=>{for(const e in t)return!1;return!0},l=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),h=(t,e)=>t===e||o(t)===o(e)&&((t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0})(t,((t,n)=>(void 0!==t||l(e,n))&&e[n]===t))},12330:(t,e,n)=>{"use strict";n.d(e,{y:()=>o});var r=n(22592),s=n(79287),i=n(79504);class o{constructor(){this._observers=r.Ue()}on(t,e){r.Yu(this._observers,t,s.Ue).add(e)}once(t,e){const n=(...r)=>{this.off(t,n),e(...r)};this.on(t,n)}off(t,e){const n=this._observers.get(t);void 0!==n&&(n.delete(e),0===n.size&&this._observers.delete(t))}emit(t,e){return i.Dp((this._observers.get(t)||r.Ue()).values()).forEach((t=>t(...e)))}destroy(){this._observers=r.Ue()}}},79287:(t,e,n)=>{"use strict";n.d(e,{Ue:()=>r});const r=()=>new Set},2431:(t,e,n)=>{"use strict";n.d(e,{ZG:()=>r});const r=Date.now},27061:t=>{var e,n,r=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(t){if(e===setTimeout)return setTimeout(t,0);if((e===s||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:s}catch(t){e=s}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(t){n=i}}();var c,l=[],h=!1,a=-1;function d(){h&&c&&(h=!1,c.length?l=c.concat(l):a=-1,l.length&&u())}function u(){if(!h){var t=o(d);h=!0;for(var e=l.length;e;){for(c=l,l=[];++a<e;)c&&c[a].run();a=-1,e=l.length}c=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{return n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function f(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];l.push(new g(t,e)),1!==l.length||h||o(u)},g.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=f,r.addListener=f,r.once=f,r.off=f,r.removeListener=f,r.removeAllListeners=f,r.emit=f,r.prependListener=f,r.prependOnceListener=f,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},67957:(t,e,n)=>{"use strict";n.r(e),n.d(e,{AbsolutePosition:()=>Ye,AbstractConnector:()=>$t,AbstractStruct:()=>rs,AbstractType:()=>gr,Array:()=>Ir,ContentAny:()=>us,ContentBinary:()=>is,ContentDeleted:()=>os,ContentEmbed:()=>hs,ContentFormat:()=>as,ContentJSON:()=>ds,ContentString:()=>gs,ContentType:()=>Ss,Doc:()=>ce,GC:()=>ss,ID:()=>Oe,Item:()=>Us,Map:()=>Lr,PermanentUserData:()=>Fe,RelativePosition:()=>We,Snapshot:()=>Ze,Text:()=>Xr,Transaction:()=>_n,UndoManager:()=>In,UpdateEncoderV1:()=>ge,XmlElement:()=>Qr,XmlFragment:()=>qr,XmlHook:()=>es,XmlText:()=>ns,YArrayEvent:()=>Or,YEvent:()=>sr,YMapEvent:()=>Nr,YTextEvent:()=>Kr,YXmlEvent:()=>ts,applyUpdate:()=>be,applyUpdateV2:()=>ye,cleanupYTextFormatting:()=>Br,compareIDs:()=>Ie,compareRelativePositions:()=>Xe,convertUpdateFormatV1ToV2:()=>nr,convertUpdateFormatV2ToV1:()=>rr,createAbsolutePositionFromRelativePosition:()=>Ke,createDeleteSet:()=>te,createDeleteSetFromStructStore:()=>ee,createDocFromSnapshot:()=>hn,createID:()=>Ne,createRelativePositionFromJSON:()=>Ge,createRelativePositionFromTypeIndex:()=>$e,createSnapshot:()=>rn,decodeRelativePosition:()=>He,decodeSnapshot:()=>nn,decodeSnapshotV2:()=>en,decodeStateVector:()=>Ce,decodeUpdate:()=>Pn,decodeUpdateV2:()=>Vn,diffUpdate:()=>Hn,diffUpdateV2:()=>Bn,emptySnapshot:()=>sn,encodeRelativePosition:()=>Be,encodeSnapshot:()=>tn,encodeSnapshotV2:()=>Qe,encodeStateAsUpdate:()=>Se,encodeStateAsUpdateV2:()=>_e,encodeStateVector:()=>ve,encodeStateVectorFromUpdate:()=>jn,encodeStateVectorFromUpdateV2:()=>Wn,equalDeleteSets:()=>ie,equalSnapshots:()=>qe,findIndexSS:()=>pn,findRootTypeKey:()=>Pe,getItem:()=>wn,getState:()=>gn,getTypeChildren:()=>dr,isDeleted:()=>Xt,isParentOf:()=>Ve,iterateDeletedStructs:()=>Kt,logType:()=>Je,logUpdate:()=>Ln,logUpdateV2:()=>Rn,mergeUpdates:()=>Fn,mergeUpdatesV2:()=>$n,obfuscateUpdate:()=>tr,obfuscateUpdateV2:()=>er,parseUpdateMeta:()=>Yn,parseUpdateMetaV2:()=>Gn,readUpdate:()=>ke,readUpdateV2:()=>me,relativePositionToJSON:()=>je,snapshot:()=>on,snapshotContainsUpdate:()=>an,transact:()=>Tn,tryGc:()=>An,typeListToArraySnapshot:()=>wr,typeMapGetSnapshot:()=>Mr});var r=n(12330),s=n(79504),i=n(11182),o=n(22592);const c=String.fromCharCode,l=(String.fromCodePoint,c(65535),/^\s*/g),h=/([A-Z])/g,a=(t,e)=>(t=>t.replace(l,""))(t.replace(h,(t=>`${e}${(t=>t.toLowerCase())(t)}`))),d="undefined"!=typeof TextEncoder?new TextEncoder:null,u=d?t=>d.encode(t):t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let t=0;t<n;t++)r[t]=e.codePointAt(t);return r};let g="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});g&&1===g.decode(new Uint8Array).length&&(g=null);let f=new class{constructor(){this.map=new Map}setItem(t,e){this.map.set(t,e)}getItem(t){return this.map.get(t)}},p=!0;try{"undefined"!=typeof localStorage&&(f=localStorage,p=!1)}catch(t){}const w=f;var m=n(38828),k=n(27061);const y=void 0!==k&&k.release&&/node|io\.js/.test(k.release.name);let b;"undefined"!=typeof navigator&&/Mac/.test(navigator.platform);const _=[],S=t=>(()=>{if(void 0===b)if(y){b=o.Ue();const t=k.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];"-"===r[0]?(null!==e&&b.set(e,""),e=r):null!==e?(b.set(e,r),e=null):_.push(r)}null!==e&&b.set(e,"")}else"object"==typeof location?(b=o.Ue(),(location.search||"?").slice(1).split("&").forEach((t=>{if(0!==t.length){const[e,n]=t.split("=");b.set(`--${a(e,"-")}`,n),b.set(`-${a(e,"-")}`,n)}}))):b=o.Ue();return b})().has(t),E=t=>{return void 0===(e=y?k.env[t.toUpperCase()]:w.getItem(t))?null:e;var e};S("--"+"production")||E("production");const C=y&&m.gB(k.env.FORCE_COLOR,["true","1","2"]),D=!S("no-colors")&&(!y||k.stdout.isTTY||C)&&(!y||S("color")||C||null!==E("COLORTERM")||(E("TERM")||"").includes("color")),v=(t,e,n)=>new Uint8Array(t,e,n),A=64,U=128,T=127,M=Number.MAX_SAFE_INTEGER,x=(Number.MIN_SAFE_INTEGER,Number.isInteger||(t=>"number"==typeof t&&isFinite(t)&&i.GW(t)===t));Number.isNaN,Number.parseInt;class O{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const I=()=>new O,N=t=>{const e=new Uint8Array((t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e})(t));let n=0;for(let r=0;r<t.bufs.length;r++){const s=t.bufs[r];e.set(s,n),n+=s.length}return e.set(v(t.cbuf.buffer,0,t.cpos),n),e},L=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(2*n),t.cpos=0),t.cbuf[t.cpos++]=e},R=L,P=(t,e)=>{for(;e>T;)L(t,U|T&e),e=i.GW(e/128);L(t,T&e)},V=(t,e)=>{const n=i.GR(e);for(n&&(e=-e),L(t,(e>63?U:0)|(n?A:0)|63&e),e=i.GW(e/64);e>0;)L(t,(e>T?U:0)|T&e),e=i.GW(e/128)},J=new Uint8Array(3e4),F=J.length/3,W=d&&d.encodeInto?(t,e)=>{if(e.length<F){const n=d.encodeInto(e,J).written||0;P(t,n);for(let e=0;e<n;e++)L(t,J[e])}else G(t,u(e))}:(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;P(t,r);for(let e=0;e<r;e++)L(t,n.codePointAt(e))},j=(t,e)=>{const n=t.cbuf.length,r=t.cpos,s=i.VV(n-r,e.length),o=e.length-s;t.cbuf.set(e.subarray(0,s),r),t.cpos+=s,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(i.Fp(2*n,o)),t.cbuf.set(e.subarray(s)),t.cpos=o)},G=(t,e)=>{P(t,e.byteLength),j(t,e)},Y=(t,e)=>{((t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(v(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(2*i.Fp(n,e)),t.cpos=0)})(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},z=new DataView(new ArrayBuffer(4)),$=(t,e)=>{switch(typeof e){case"string":L(t,119),W(t,e);break;case"number":x(e)&&i.Wn(e)<=2147483647?(L(t,125),V(t,e)):(n=e,z.setFloat32(0,n),z.getFloat32(0)===n?(L(t,124),((t,e)=>{Y(t,4).setFloat32(0,e,!1)})(t,e)):(L(t,123),((t,e)=>{Y(t,8).setFloat64(0,e,!1)})(t,e)));break;case"bigint":L(t,122),((t,e)=>{Y(t,8).setBigInt64(0,e,!1)})(t,e);break;case"object":if(null===e)L(t,126);else if(s.kJ(e)){L(t,117),P(t,e.length);for(let n=0;n<e.length;n++)$(t,e[n])}else if(e instanceof Uint8Array)L(t,116),G(t,e);else{L(t,118);const n=Object.keys(e);P(t,n.length);for(let r=0;r<n.length;r++){const s=n[r];W(t,s),$(t,e[s])}}break;case"boolean":L(t,e?120:121);break;default:L(t,127)}var n};class B extends O{constructor(t){super(),this.w=t,this.s=null,this.count=0}write(t){this.s===t?this.count++:(this.count>0&&P(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}}const H=t=>{t.count>0&&(V(t.encoder,1===t.count?t.s:-t.s),t.count>1&&P(t.encoder,t.count-2))};class K{constructor(){this.encoder=new O,this.s=0,this.count=0}write(t){this.s===t?this.count++:(H(this),this.count=1,this.s=t)}toUint8Array(){return H(this),N(this.encoder)}}const X=t=>{if(t.count>0){const e=2*t.diff+(1===t.count?0:1);V(t.encoder,e),t.count>1&&P(t.encoder,t.count-2)}};class Z{constructor(){this.encoder=new O,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(X(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return X(this),N(this.encoder)}}class q{constructor(){this.sarr=[],this.s="",this.lensE=new K}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){const t=new O;return this.sarr.push(this.s),this.s="",W(t,this.sarr.join("")),j(t,this.lensE.toUint8Array()),N(t)}}const Q=t=>new Error(t),tt=()=>{throw Q("Method unimplemented")},et=()=>{throw Q("Unexpected case")},nt=Q("Unexpected end of array"),rt=Q("Integer out of Range");class st{constructor(t){this.arr=t,this.pos=0}}const it=t=>new st(t),ot=t=>t.pos!==t.arr.length,ct=t=>((t,e)=>{const n=v(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n})(t,ht(t)),lt=t=>t.arr[t.pos++],ht=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const r=t.arr[t.pos++];if(e+=(r&T)*n,n*=128,r<U)return e;if(e>M)throw rt}throw nt},at=t=>{let e=t.arr[t.pos++],n=63&e,r=64;const s=(e&A)>0?-1:1;if(0==(e&U))return s*n;const i=t.arr.length;for(;t.pos<i;){if(e=t.arr[t.pos++],n+=(e&T)*r,r*=128,e<U)return s*n;if(n>M)throw rt}throw nt},dt=g?t=>g.decode(ct(t)):t=>{let e=ht(t);if(0===e)return"";{let n=String.fromCodePoint(lt(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(lt(t));else for(;e>0;){const r=e<1e4?e:1e4,s=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,s),e-=r}return decodeURIComponent(escape(n))}},ut=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},gt=[t=>{},t=>null,at,t=>ut(t,4).getFloat32(0,!1),t=>ut(t,8).getFloat64(0,!1),t=>ut(t,8).getBigInt64(0,!1),t=>!1,t=>!0,dt,t=>{const e=ht(t),n={};for(let r=0;r<e;r++)n[dt(t)]=ft(t);return n},t=>{const e=ht(t),n=[];for(let r=0;r<e;r++)n.push(ft(t));return n},ct],ft=t=>gt[127-lt(t)](t);class pt extends st{constructor(t,e){super(t),this.reader=e,this.s=null,this.count=0}read(){return 0===this.count&&(this.s=this.reader(this),ot(this)?this.count=ht(this)+1:this.count=-1),this.count--,this.s}}class wt extends st{constructor(t){super(t),this.s=0,this.count=0}read(){if(0===this.count){this.s=at(this);const t=i.GR(this.s);this.count=1,t&&(this.s=-this.s,this.count=ht(this)+2)}return this.count--,this.s}}class mt extends st{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(0===this.count){const t=at(this),e=1&t;this.diff=i.GW(t/2),this.count=1,e&&(this.count=ht(this)+2)}return this.s+=this.diff,this.count--,this.s}}class kt{constructor(t){this.decoder=new wt(t),this.str=dt(this.decoder),this.spos=0}read(){const t=this.spos+this.decoder.read(),e=this.str.slice(this.spos,t);return this.spos=t,e}}crypto.subtle;const yt=crypto.getRandomValues.bind(crypto),bt=(Math.random,()=>yt(new Uint32Array(1))[0]),_t=[1e7]+-1e3+-4e3+-8e3+-1e11,St=()=>_t.replace(/[018]/g,(t=>(t^bt()&15>>t/4).toString(16))),Et=t=>new Promise(t);Promise.all.bind(Promise);var Ct=n(79287);class Dt{constructor(t,e){this.left=t,this.right=e}}const vt=(t,e)=>new Dt(t,e),At="undefined"!=typeof document?document:{},Ut=("undefined"!=typeof DOMParser&&new DOMParser,At.ELEMENT_NODE,At.TEXT_NODE,At.CDATA_SECTION_NODE,At.COMMENT_NODE,At.DOCUMENT_NODE,At.DOCUMENT_TYPE_NODE,At.DOCUMENT_FRAGMENT_NODE,Symbol);var Tt=n(2431);const Mt=Ut(),xt=Ut(),Ot=Ut(),It=Ut(),Nt=Ut(),Lt=Ut(),Rt=Ut(),Pt=Ut(),Vt=Ut();Tt.ZG();const Jt={[Mt]:vt("font-weight","bold"),[xt]:vt("font-weight","normal"),[Ot]:vt("color","blue"),[Nt]:vt("color","green"),[It]:vt("color","grey"),[Lt]:vt("color","red"),[Rt]:vt("color","purple"),[Pt]:vt("color","orange"),[Vt]:vt("color","black")},Ft=D?t=>{const e=[],n=[],r=o.Ue();let s=[],i=0;for(;i<t.length;i++){const s=t[i],l=Jt[s];if(void 0!==l)r.set(l.left,l.right);else{if(s.constructor!==String&&s.constructor!==Number)break;{const t=(c=r,o.UI(c,((t,e)=>`${e}:${t};`)).join(""));i>0||t.length>0?(e.push("%c"+s),n.push(t)):e.push(s)}}}var c;for(i>0&&(s=n,s.unshift(e.join("")));i<t.length;i++){const e=t[i];e instanceof Symbol||s.push(e)}return s}:t=>{const e=[],n=[];let r=0;for(;r<t.length;r++){const s=t[r];s.constructor===String||s.constructor===Number?e.push(s):s.constructor===Object&&n.push(JSON.stringify(s))}return n},Wt=(...t)=>{console.log(...Ft(t)),jt.forEach((e=>e.print(t)))},jt=Ct.Ue(),Gt=t=>({[Symbol.iterator](){return this},next:t}),Yt=(t,e)=>Gt((()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}}));var zt=n(36498);class $t extends r.y{constructor(t,e){super(),this.doc=t,this.awareness=e}}class Bt{constructor(t,e){this.clock=t,this.len=e}}class Ht{constructor(){this.clients=new Map}}const Kt=(t,e,n)=>e.clients.forEach(((e,r)=>{const s=t.doc.store.clients.get(r);for(let r=0;r<e.length;r++){const i=e[r];bn(t,s,i.clock,i.len,n)}})),Xt=(t,e)=>{const n=t.clients.get(e.client);return void 0!==n&&null!==((t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const s=i.GW((n+r)/2),o=t[s],c=o.clock;if(c<=e){if(e<c+o.len)return s;n=s+1}else r=s-1}return null})(n,e.clock)},Zt=t=>{t.clients.forEach((t=>{let e,n;for(t.sort(((t,e)=>t.clock-e.clock)),e=1,n=1;e<t.length;e++){const r=t[n-1],s=t[e];r.clock+r.len>=s.clock?r.len=i.Fp(r.len,s.clock+s.len-r.clock):(n<e&&(t[n]=s),n++)}t.length=n}))},qt=t=>{const e=new Ht;for(let n=0;n<t.length;n++)t[n].clients.forEach(((r,i)=>{if(!e.clients.has(i)){const o=r.slice();for(let e=n+1;e<t.length;e++)s.s7(o,t[e].clients.get(i)||[]);e.clients.set(i,o)}}));return Zt(e),e},Qt=(t,e,n,r)=>{o.Yu(t.clients,e,(()=>[])).push(new Bt(n,r))},te=()=>new Ht,ee=t=>{const e=te();return t.clients.forEach(((t,n)=>{const r=[];for(let e=0;e<t.length;e++){const n=t[e];if(n.deleted){const s=n.id.clock;let i=n.length;if(e+1<t.length)for(let n=t[e+1];e+1<t.length&&n.deleted;n=t[1+ ++e])i+=n.length;r.push(new Bt(s,i))}}r.length>0&&e.clients.set(n,r)})),e},ne=(t,e)=>{P(t.restEncoder,e.clients.size),s.Dp(e.clients.entries()).sort(((t,e)=>e[0]-t[0])).forEach((([e,n])=>{t.resetDsCurVal(),P(t.restEncoder,e);const r=n.length;P(t.restEncoder,r);for(let e=0;e<r;e++){const r=n[e];t.writeDsClock(r.clock),t.writeDsLen(r.len)}}))},re=t=>{const e=new Ht,n=ht(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const n=ht(t.restDecoder),r=ht(t.restDecoder);if(r>0){const s=o.Yu(e.clients,n,(()=>[]));for(let e=0;e<r;e++)s.push(new Bt(t.readDsClock(),t.readDsLen()))}}return e},se=(t,e,n)=>{const r=new Ht,s=ht(t.restDecoder);for(let i=0;i<s;i++){t.resetDsCurVal();const s=ht(t.restDecoder),i=ht(t.restDecoder),o=n.clients.get(s)||[],c=gn(n,s);for(let n=0;n<i;n++){const n=t.readDsClock(),i=n+t.readDsLen();if(n<c){c<i&&Qt(r,s,c,i-c);let t=pn(o,n),l=o[t];for(!l.deleted&&l.id.clock<n&&(o.splice(t+1,0,Ds(e,l,n-l.id.clock)),t++);t<o.length&&(l=o[t++],l.id.clock<i);)l.deleted||(i<l.id.clock+l.length&&o.splice(t,0,Ds(e,l,i-l.id.clock)),l.delete(e))}else Qt(r,s,n,i-n)}}if(r.clients.size>0){const t=new pe;return P(t.restEncoder,0),ne(t,r),t.toUint8Array()}return null},ie=(t,e)=>t.clients.size===e.clients.size&&(t.clients.forEach(((t,n)=>{const r=e.clients.get(n);if(void 0===r||t.length!==r.length)return!1;for(let e=0;e<t.length;e++){const n=t[e],s=r[e];if(n.clock!==s.clock||n.len!==s.len)return!1}})),!0),oe=bt;class ce extends r.y{constructor({guid:t=St(),collectionid:e=null,gc:n=!0,gcFilter:r=(()=>!0),meta:s=null,autoLoad:i=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=oe(),this.guid=t,this.collectionid=e,this.share=new Map,this.store=new dn,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=i,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=Et((t=>{this.on("load",(()=>{this.isLoaded=!0,t(this)}))}));const c=()=>Et((t=>{const e=n=>{void 0!==n&&!0!==n||(this.off("sync",e),t())};this.on("sync",e)}));this.on("sync",(t=>{!1===t&&this.isSynced&&(this.whenSynced=c()),this.isSynced=void 0===t||!0===t,this.isLoaded||this.emit("load",[])})),this.whenSynced=c()}load(){const t=this._item;null===t||this.shouldLoad||Tn(t.parent.doc,(t=>{t.subdocsLoaded.add(this)}),null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(s.Dp(this.subdocs).map((t=>t.guid)))}transact(t,e=null){return Tn(this,t,e)}get(t,e=gr){const n=o.Yu(this.share,t,(()=>{const t=new e;return t._integrate(this,null),t})),r=n.constructor;if(e!==gr&&r!==e){if(r===gr){const r=new e;r._map=n._map,n._map.forEach((t=>{for(;null!==t;t=t.left)t.parent=r})),r._start=n._start;for(let t=r._start;null!==t;t=t.right)t.parent=r;return r._length=n._length,this.share.set(t,r),r._integrate(this,null),r}throw new Error(`Type with the name ${t} has already been defined with a different constructor`)}return n}getArray(t=""){return this.get(t,Ir)}getText(t=""){return this.get(t,Xr)}getMap(t=""){return this.get(t,Lr)}getXmlFragment(t=""){return this.get(t,qr)}toJSON(){const t={};return this.share.forEach(((e,n)=>{t[n]=e.toJSON()})),t}destroy(){s.Dp(this.subdocs).forEach((t=>t.destroy()));const t=this._item;if(null!==t){this._item=null;const e=t.content;e.doc=new ce({guid:this.guid,...e.opts,shouldLoad:!1}),e.doc._item=t,Tn(t.parent.doc,(n=>{const r=e.doc;t.deleted||n.subdocsAdded.add(r),n.subdocsRemoved.add(this)}),null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}on(t,e){super.on(t,e)}off(t,e){super.off(t,e)}}class le{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return ht(this.restDecoder)}readDsLen(){return ht(this.restDecoder)}}class he extends le{readLeftID(){return Ne(ht(this.restDecoder),ht(this.restDecoder))}readRightID(){return Ne(ht(this.restDecoder),ht(this.restDecoder))}readClient(){return ht(this.restDecoder)}readInfo(){return lt(this.restDecoder)}readString(){return dt(this.restDecoder)}readParentInfo(){return 1===ht(this.restDecoder)}readTypeRef(){return ht(this.restDecoder)}readLen(){return ht(this.restDecoder)}readAny(){return ft(this.restDecoder)}readBuf(){return(t=>{const e=(n=t.byteLength,new Uint8Array(n));var n;return e.set(t),e})(ct(this.restDecoder))}readJSON(){return JSON.parse(dt(this.restDecoder))}readKey(){return dt(this.restDecoder)}}class ae{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=ht(this.restDecoder),this.dsCurrVal}readDsLen(){const t=ht(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class de extends ae{constructor(t){super(t),this.keys=[],ht(t),this.keyClockDecoder=new mt(ct(t)),this.clientDecoder=new wt(ct(t)),this.leftClockDecoder=new mt(ct(t)),this.rightClockDecoder=new mt(ct(t)),this.infoDecoder=new pt(ct(t),lt),this.stringDecoder=new kt(ct(t)),this.parentInfoDecoder=new pt(ct(t),lt),this.typeRefDecoder=new wt(ct(t)),this.lenDecoder=new wt(ct(t))}readLeftID(){return new Oe(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Oe(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return 1===this.parentInfoDecoder.read()}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return ft(this.restDecoder)}readBuf(){return ct(this.restDecoder)}readJSON(){return ft(this.restDecoder)}readKey(){const t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];{const t=this.stringDecoder.read();return this.keys.push(t),t}}}class ue{constructor(){this.restEncoder=I()}toUint8Array(){return N(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){P(this.restEncoder,t)}writeDsLen(t){P(this.restEncoder,t)}}class ge extends ue{writeLeftID(t){P(this.restEncoder,t.client),P(this.restEncoder,t.clock)}writeRightID(t){P(this.restEncoder,t.client),P(this.restEncoder,t.clock)}writeClient(t){P(this.restEncoder,t)}writeInfo(t){R(this.restEncoder,t)}writeString(t){W(this.restEncoder,t)}writeParentInfo(t){P(this.restEncoder,t?1:0)}writeTypeRef(t){P(this.restEncoder,t)}writeLen(t){P(this.restEncoder,t)}writeAny(t){$(this.restEncoder,t)}writeBuf(t){G(this.restEncoder,t)}writeJSON(t){W(this.restEncoder,JSON.stringify(t))}writeKey(t){W(this.restEncoder,t)}}class fe{constructor(){this.restEncoder=I(),this.dsCurrVal=0}toUint8Array(){return N(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){const e=t-this.dsCurrVal;this.dsCurrVal=t,P(this.restEncoder,e)}writeDsLen(t){0===t&&et(),P(this.restEncoder,t-1),this.dsCurrVal+=t}}class pe extends fe{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Z,this.clientEncoder=new K,this.leftClockEncoder=new Z,this.rightClockEncoder=new Z,this.infoEncoder=new B(R),this.stringEncoder=new q,this.parentInfoEncoder=new B(R),this.typeRefEncoder=new K,this.lenEncoder=new K}toUint8Array(){const t=I();return P(t,0),G(t,this.keyClockEncoder.toUint8Array()),G(t,this.clientEncoder.toUint8Array()),G(t,this.leftClockEncoder.toUint8Array()),G(t,this.rightClockEncoder.toUint8Array()),G(t,N(this.infoEncoder)),G(t,this.stringEncoder.toUint8Array()),G(t,N(this.parentInfoEncoder)),G(t,this.typeRefEncoder.toUint8Array()),G(t,this.lenEncoder.toUint8Array()),j(t,N(this.restEncoder)),N(t)}writeLeftID(t){this.clientEncoder.write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(t?1:0)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){$(this.restEncoder,t)}writeBuf(t){G(this.restEncoder,t)}writeJSON(t){$(this.restEncoder,t)}writeKey(t){const e=this.keyMap.get(t);void 0===e?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(t)):this.keyClockEncoder.write(e)}}const we=(t,e,n)=>{const r=new Map;n.forEach(((t,n)=>{gn(e,n)>t&&r.set(n,t)})),un(e).forEach(((t,e)=>{n.has(e)||r.set(e,0)})),P(t.restEncoder,r.size),s.Dp(r.entries()).sort(((t,e)=>e[0]-t[0])).forEach((([n,r])=>{((t,e,n,r)=>{r=i.Fp(r,e[0].id.clock);const s=pn(e,r);P(t.restEncoder,e.length-s),t.writeClient(n),P(t.restEncoder,r);const o=e[s];o.write(t,r-o.id.clock);for(let n=s+1;n<e.length;n++)e[n].write(t,0)})(t,e.clients.get(n),n,r)}))},me=(t,e,n,r=new de(t))=>Tn(e,(t=>{t.local=!1;let e=!1;const n=t.doc,i=n.store,c=((t,e)=>{const n=o.Ue(),r=ht(t.restDecoder);for(let s=0;s<r;s++){const r=ht(t.restDecoder),s=new Array(r),i=t.readClient();let o=ht(t.restDecoder);n.set(i,{i:0,refs:s});for(let n=0;n<r;n++){const r=t.readInfo();switch(31&r){case 0:{const e=t.readLen();s[n]=new ss(Ne(i,o),e),o+=e;break}case 10:{const e=ht(t.restDecoder);s[n]=new xs(Ne(i,o),e),o+=e;break}default:{const c=0==(192&r),l=new Us(Ne(i,o),null,(r&U)===U?t.readLeftID():null,null,(r&A)===A?t.readRightID():null,c?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,c&&32==(32&r)?t.readString():null,Ts(t,r));s[n]=l,o+=l.length}}}}return n})(r,n),l=((t,e,n)=>{const r=[];let i=s.Dp(n.keys()).sort(((t,e)=>t-e));if(0===i.length)return null;const c=()=>{if(0===i.length)return null;let t=n.get(i[i.length-1]);for(;t.refs.length===t.i;){if(i.pop(),!(i.length>0))return null;t=n.get(i[i.length-1])}return t};let l=c();if(null===l&&0===r.length)return null;const h=new dn,a=new Map,d=(t,e)=>{const n=a.get(t);(null==n||n>e)&&a.set(t,e)};let u=l.refs[l.i++];const g=new Map,f=()=>{for(const t of r){const e=t.id.client,r=n.get(e);r?(r.i--,h.clients.set(e,r.refs.slice(r.i)),n.delete(e),r.i=0,r.refs=[]):h.clients.set(e,[t]),i=i.filter((t=>t!==e))}r.length=0};for(;;){if(u.constructor!==xs){const s=o.Yu(g,u.id.client,(()=>gn(e,u.id.client)))-u.id.clock;if(s<0)r.push(u),d(u.id.client,u.id.clock-1),f();else{const i=u.getMissing(t,e);if(null!==i){r.push(u);const t=n.get(i)||{refs:[],i:0};if(t.refs.length!==t.i){u=t.refs[t.i++];continue}d(i,gn(e,i)),f()}else(0===s||s<u.length)&&(u.integrate(t,s),g.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(null!==l&&l.i<l.refs.length)u=l.refs[l.i++];else{if(l=c(),null===l)break;u=l.refs[l.i++]}}if(h.clients.size>0){const t=new pe;return we(t,h,new Map),P(t.restEncoder,0),{missing:a,update:t.toUint8Array()}}return null})(t,i,c),h=i.pendingStructs;if(h){for(const[t,n]of h.missing)if(n<gn(i,t)){e=!0;break}if(l){for(const[t,e]of l.missing){const n=h.missing.get(t);(null==n||n>e)&&h.missing.set(t,e)}h.update=$n([h.update,l.update])}}else i.pendingStructs=l;const a=se(r,t,i);if(i.pendingDs){const e=new de(it(i.pendingDs));ht(e.restDecoder);const n=se(e,t,i);i.pendingDs=a&&n?$n([a,n]):a||n}else i.pendingDs=a;if(e){const e=i.pendingStructs.update;i.pendingStructs=null,ye(t.doc,e)}}),n,!1),ke=(t,e,n)=>me(t,e,n,new he(t)),ye=(t,e,n,r=de)=>{const s=it(e);me(s,t,n,new r(s))},be=(t,e,n)=>ye(t,e,n,he),_e=(t,e=new Uint8Array([0]),n=new pe)=>{((t,e,n=new Map)=>{we(t,e.store,n),ne(t,ee(e.store))})(n,t,Ce(e));const r=[n.toUint8Array()];if(t.store.pendingDs&&r.push(t.store.pendingDs),t.store.pendingStructs&&r.push(Bn(t.store.pendingStructs.update,e)),r.length>1){if(n.constructor===ge)return Fn(r.map(((t,e)=>0===e?t:rr(t))));if(n.constructor===pe)return $n(r)}return r[0]},Se=(t,e)=>_e(t,e,new ge),Ee=t=>{const e=new Map,n=ht(t.restDecoder);for(let r=0;r<n;r++){const n=ht(t.restDecoder),r=ht(t.restDecoder);e.set(n,r)}return e},Ce=t=>Ee(new le(it(t))),De=(t,e)=>(P(t.restEncoder,e.size),s.Dp(e.entries()).sort(((t,e)=>e[0]-t[0])).forEach((([e,n])=>{P(t.restEncoder,e),P(t.restEncoder,n)})),t),ve=t=>((t,e=new fe)=>(t instanceof Map?De(e,t):((t,e)=>{De(t,un(e.store))})(e,t),e.toUint8Array()))(t,new ue);class Ae{constructor(){this.l=[]}}const Ue=()=>new Ae,Te=(t,e)=>t.l.push(e),Me=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter((t=>e!==t)),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},xe=(t,e,n)=>m.PP(t.l,[e,n]);class Oe{constructor(t,e){this.client=t,this.clock=e}}const Ie=(t,e)=>t===e||null!==t&&null!==e&&t.client===e.client&&t.clock===e.clock,Ne=(t,e)=>new Oe(t,e),Le=(t,e)=>{P(t,e.client),P(t,e.clock)},Re=t=>Ne(ht(t),ht(t)),Pe=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw et()},Ve=(t,e)=>{for(;null!==e;){if(e.parent===t)return!0;e=e.parent._item}return!1},Je=t=>{const e=[];let n=t._start;for(;n;)e.push(n),n=n.right;console.log("Children: ",e),console.log("Children content: ",e.filter((t=>!t.deleted)).map((t=>t.content)))};class Fe{constructor(t,e=t.getMap("users")){const n=new Map;this.yusers=e,this.doc=t,this.clients=new Map,this.dss=n;const r=(t,e)=>{const n=t.get("ds"),r=t.get("ids"),s=t=>this.clients.set(t,e);n.observe((t=>{t.changes.added.forEach((t=>{t.content.getContent().forEach((t=>{t instanceof Uint8Array&&this.dss.set(e,qt([this.dss.get(e)||te(),re(new le(it(t)))]))}))}))})),this.dss.set(e,qt(n.map((t=>re(new le(it(t))))))),r.observe((t=>t.changes.added.forEach((t=>t.content.getContent().forEach(s))))),r.forEach(s)};e.observe((t=>{t.keysChanged.forEach((t=>r(e.get(t),t)))})),e.forEach(r)}setUserMapping(t,e,n,{filter:r=(()=>!0)}={}){const s=this.yusers;let i=s.get(n);i||(i=new Lr,i.set("ids",new Ir),i.set("ds",new Ir),s.set(n,i)),i.get("ids").push([e]),s.observe((t=>{setTimeout((()=>{const t=s.get(n);if(t!==i){i=t,this.clients.forEach(((t,e)=>{n===t&&i.get("ids").push([e])}));const e=new ue,r=this.dss.get(n);r&&(ne(e,r),i.get("ds").push([e.toUint8Array()]))}}),0)})),t.on("afterTransaction",(t=>{setTimeout((()=>{const e=i.get("ds"),n=t.deleteSet;if(t.local&&n.clients.size>0&&r(t,n)){const t=new ue;ne(t,n),e.push([t.toUint8Array()])}}))}))}getUserByClientId(t){return this.clients.get(t)||null}getUserByDeletedId(t){for(const[e,n]of this.dss.entries())if(Xt(n,t))return e;return null}}class We{constructor(t,e,n,r=0){this.type=t,this.tname=e,this.item=n,this.assoc=r}}const je=t=>{const e={};return t.type&&(e.type=t.type),t.tname&&(e.tname=t.tname),t.item&&(e.item=t.item),null!=t.assoc&&(e.assoc=t.assoc),e},Ge=t=>new We(null==t.type?null:Ne(t.type.client,t.type.clock),t.tname||null,null==t.item?null:Ne(t.item.client,t.item.clock),null==t.assoc?0:t.assoc);class Ye{constructor(t,e,n=0){this.type=t,this.index=e,this.assoc=n}}const ze=(t,e,n)=>{let r=null,s=null;return null===t._item?s=Pe(t):r=Ne(t._item.id.client,t._item.id.clock),new We(r,s,e,n)},$e=(t,e,n=0)=>{let r=t._start;if(n<0){if(0===e)return ze(t,null,n);e--}for(;null!==r;){if(!r.deleted&&r.countable){if(r.length>e)return ze(t,Ne(r.id.client,r.id.clock+e),n);e-=r.length}if(null===r.right&&n<0)return ze(t,r.lastId,n);r=r.right}return ze(t,null,n)},Be=t=>{const e=I();return((t,e)=>{const{type:n,tname:r,item:s,assoc:i}=e;if(null!==s)P(t,0),Le(t,s);else if(null!==r)R(t,1),W(t,r);else{if(null===n)throw et();R(t,2),Le(t,n)}V(t,i)})(e,t),N(e)},He=t=>(t=>{let e=null,n=null,r=null;switch(ht(t)){case 0:r=Re(t);break;case 1:n=dt(t);break;case 2:e=Re(t)}const s=ot(t)?at(t):0;return new We(e,n,r,s)})(it(t)),Ke=(t,e)=>{const n=e.store,r=t.item,s=t.type,i=t.tname,o=t.assoc;let c=null,l=0;if(null!==r){if(gn(n,r.client)<=r.clock)return null;const t=Es(n,r),e=t.item;if(!(e instanceof Us))return null;if(c=e.parent,null===c._item||!c._item.deleted){l=e.deleted||!e.countable?0:t.diff+(o>=0?0:1);let n=e.left;for(;null!==n;)!n.deleted&&n.countable&&(l+=n.length),n=n.left}}else{if(null!==i)c=e.get(i);else{if(null===s)throw et();{if(gn(n,s.client)<=s.clock)return null;const{item:t}=Es(n,s);if(!(t instanceof Us&&t.content instanceof Ss))return null;c=t.content.type}}l=o>=0?c._length:0}return((t,e,n=0)=>new Ye(t,e,n))(c,l,t.assoc)},Xe=(t,e)=>t===e||null!==t&&null!==e&&t.tname===e.tname&&Ie(t.item,e.item)&&Ie(t.type,e.type)&&t.assoc===e.assoc;class Ze{constructor(t,e){this.ds=t,this.sv=e}}const qe=(t,e)=>{const n=t.ds.clients,r=e.ds.clients,s=t.sv,i=e.sv;if(s.size!==i.size||n.size!==r.size)return!1;for(const[t,e]of s.entries())if(i.get(t)!==e)return!1;for(const[t,e]of n.entries()){const n=r.get(t)||[];if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++){const r=e[t],s=n[t];if(r.clock!==s.clock||r.len!==s.len)return!1}}return!0},Qe=(t,e=new fe)=>(ne(e,t.ds),De(e,t.sv),e.toUint8Array()),tn=t=>Qe(t,new ue),en=(t,e=new ae(it(t)))=>new Ze(re(e),Ee(e)),nn=t=>en(t,new le(it(t))),rn=(t,e)=>new Ze(t,e),sn=rn(te(),new Map),on=t=>rn(ee(t.store),un(t.store)),cn=(t,e)=>void 0===e?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Xt(e.ds,t.id),ln=(t,e)=>{const n=o.Yu(t.meta,ln,Ct.Ue),r=t.doc.store;n.has(e)||(e.sv.forEach(((e,n)=>{e<gn(r,n)&&kn(t,Ne(n,e))})),Kt(t,e.ds,(t=>{})),n.add(e))},hn=(t,e,n=new ce)=>{if(t.gc)throw new Error("Garbage-collection must be disabled in `originDoc`!");const{sv:r,ds:s}=e,i=new pe;return t.transact((e=>{let n=0;r.forEach((t=>{t>0&&n++})),P(i.restEncoder,n);for(const[n,s]of r){if(0===s)continue;s<gn(t.store,n)&&kn(e,Ne(n,s));const r=t.store.clients.get(n)||[],o=pn(r,s-1);P(i.restEncoder,o+1),i.writeClient(n),P(i.restEncoder,0);for(let t=0;t<=o;t++)r[t].write(i,0)}ne(i,s)})),ye(n,i.toUint8Array(),"snapshot"),n},an=(t,e)=>((t,e,n=de)=>{const r=new n(it(e)),s=new Nn(r,!1);for(let e=s.curr;null!==e;e=s.next())if((t.sv.get(e.id.client)||0)<e.id.clock+e.length)return!1;const i=qt([t.ds,re(r)]);return ie(t.ds,i)})(t,e,he);class dn{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const un=t=>{const e=new Map;return t.clients.forEach(((t,n)=>{const r=t[t.length-1];e.set(n,r.id.clock+r.length)})),e},gn=(t,e)=>{const n=t.clients.get(e);if(void 0===n)return 0;const r=n[n.length-1];return r.id.clock+r.length},fn=(t,e)=>{let n=t.clients.get(e.id.client);if(void 0===n)n=[],t.clients.set(e.id.client,n);else{const t=n[n.length-1];if(t.id.clock+t.length!==e.id.clock)throw et()}n.push(e)},pn=(t,e)=>{let n=0,r=t.length-1,s=t[r],o=s.id.clock;if(o===e)return r;let c=i.GW(e/(o+s.length-1)*r);for(;n<=r;){if(s=t[c],o=s.id.clock,o<=e){if(e<o+s.length)return c;n=c+1}else r=c-1;c=i.GW((n+r)/2)}throw et()},wn=(t,e)=>{const n=t.clients.get(e.client);return n[pn(n,e.clock)]},mn=(t,e,n)=>{const r=pn(e,n),s=e[r];return s.id.clock<n&&s instanceof Us?(e.splice(r+1,0,Ds(t,s,n-s.id.clock)),r+1):r},kn=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[mn(t,n,e.clock)]},yn=(t,e,n)=>{const r=e.clients.get(n.client),s=pn(r,n.clock),i=r[s];return n.clock!==i.id.clock+i.length-1&&i.constructor!==ss&&r.splice(s+1,0,Ds(t,i,n.clock-i.id.clock+1)),i},bn=(t,e,n,r,s)=>{if(0===r)return;const i=n+r;let o,c=mn(t,e,n);do{o=e[c++],i<o.id.clock+o.length&&mn(t,e,i),s(o)}while(c<e.length&&e[c].id.clock<i)};class _n{constructor(t,e,n){this.doc=t,this.deleteSet=new Ht,this.beforeState=un(t.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=e,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set}}const Sn=(t,e)=>!(0===e.deleteSet.clients.size&&!o.Yj(e.afterState,((t,n)=>e.beforeState.get(n)!==t))||(Zt(e.deleteSet),((t,e)=>{we(t,e.doc.store,e.beforeState)})(t,e),ne(t,e.deleteSet),0)),En=(t,e,n)=>{const r=e._item;(null===r||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&o.Yu(t.changed,e,Ct.Ue).add(n)},Cn=(t,e)=>{const n=t[e-1],r=t[e];n.deleted===r.deleted&&n.constructor===r.constructor&&n.mergeWith(r)&&(t.splice(e,1),r instanceof Us&&null!==r.parentSub&&r.parent._map.get(r.parentSub)===r&&r.parent._map.set(r.parentSub,n))},Dn=(t,e,n)=>{for(const[r,s]of t.clients.entries()){const t=e.clients.get(r);for(let r=s.length-1;r>=0;r--){const i=s[r],o=i.clock+i.len;for(let r=pn(t,i.clock),s=t[r];r<t.length&&s.id.clock<o;s=t[++r]){const s=t[r];if(i.clock+i.len<=s.id.clock)break;s instanceof Us&&s.deleted&&!s.keep&&n(s)&&s.gc(e,!1)}}}},vn=(t,e)=>{t.clients.forEach(((t,n)=>{const r=e.clients.get(n);for(let e=t.length-1;e>=0;e--){const n=t[e];for(let t=i.VV(r.length-1,1+pn(r,n.clock+n.len-1)),e=r[t];t>0&&e.id.clock>=n.clock;e=r[--t])Cn(r,t)}}))},An=(t,e,n)=>{Dn(t,e,n),vn(t,e)},Un=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,s=r.store,o=n.deleteSet,c=n._mergeStructs;try{Zt(o),n.afterState=un(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const t=[];n.changed.forEach(((e,r)=>t.push((()=>{null!==r._item&&r._item.deleted||r._callObserver(n,e)})))),t.push((()=>{n.changedParentTypes.forEach(((e,r)=>t.push((()=>{null!==r._item&&r._item.deleted||((e=e.filter((t=>null===t.target._item||!t.target._item.deleted))).forEach((t=>{t.currentTarget=r})),e.sort(((t,e)=>t.path.length-e.path.length)),xe(r._dEH,e,n))})))),t.push((()=>r.emit("afterTransaction",[n,r])))})),(0,m.PP)(t,[])}finally{r.gc&&Dn(o,s,r.gcFilter),vn(o,s),n.afterState.forEach(((t,e)=>{const r=n.beforeState.get(e)||0;if(r!==t){const t=s.clients.get(e),n=i.Fp(pn(t,r),1);for(let e=t.length-1;e>=n;e--)Cn(t,e)}}));for(let t=0;t<c.length;t++){const{client:e,clock:n}=c[t].id,r=s.clients.get(e),i=pn(r,n);i+1<r.length&&Cn(r,i+1),i>0&&Cn(r,i)}if(n.local||n.afterState.get(r.clientID)===n.beforeState.get(r.clientID)||(Wt(Pt,Mt,"[yjs] ",xt,Lt,"Changed the client-id because another client seems to be using it."),r.clientID=oe()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const t=new ge;Sn(t,n)&&r.emit("update",[t.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const t=new pe;Sn(t,n)&&r.emit("updateV2",[t.toUint8Array(),n.origin,r,n])}const{subdocsAdded:l,subdocsLoaded:h,subdocsRemoved:a}=n;(l.size>0||a.size>0||h.size>0)&&(l.forEach((t=>{t.clientID=r.clientID,null==t.collectionid&&(t.collectionid=r.collectionid),r.subdocs.add(t)})),a.forEach((t=>r.subdocs.delete(t))),r.emit("subdocs",[{loaded:h,added:l,removed:a},r,n]),a.forEach((t=>t.destroy()))),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):Un(t,e+1)}}},Tn=(t,e,n=null,r=!0)=>{const s=t._transactionCleanups;let i=!1,o=null;null===t._transaction&&(i=!0,t._transaction=new _n(t,n,r),s.push(t._transaction),1===s.length&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{o=e(t._transaction)}finally{if(i){const e=t._transaction===s[0];t._transaction=null,e&&Un(s,0)}}return o};class Mn{constructor(t,e){this.insertions=e,this.deletions=t,this.meta=new Map}}const xn=(t,e,n)=>{Kt(t,n.deletions,(t=>{t instanceof Us&&e.scope.some((e=>Ve(e,t)))&&Cs(t,!1)}))},On=(t,e,n)=>{let r=null,s=null;const i=t.doc,o=t.scope;if(Tn(i,(n=>{for(;e.length>0&&null===r;){const s=i.store,c=e.pop(),l=new Set,h=[];let a=!1;Kt(n,c.insertions,(t=>{if(t instanceof Us){if(null!==t.redone){let{item:e,diff:r}=Es(s,t.id);r>0&&(e=kn(n,Ne(e.id.client,e.id.clock+r))),t=e}!t.deleted&&o.some((e=>Ve(e,t)))&&h.push(t)}})),Kt(n,c.deletions,(t=>{t instanceof Us&&o.some((e=>Ve(e,t)))&&!Xt(c.insertions,t.id)&&l.add(t)})),l.forEach((e=>{a=null!==As(n,e,l,c.insertions,t.ignoreRemoteMapChanges,t)||a}));for(let e=h.length-1;e>=0;e--){const r=h[e];t.deleteFilter(r)&&(r.delete(n),a=!0)}r=a?c:null}n.changed.forEach(((t,e)=>{t.has(null)&&e._searchMarker&&(e._searchMarker.length=0)})),s=n}),t),null!=r){const e=s.changedParentTypes;t.emit("stack-item-popped",[{stackItem:r,type:n,changedParentTypes:e},t])}return r};class In extends r.y{constructor(t,{captureTimeout:e=500,captureTransaction:n=(t=>!0),deleteFilter:r=(()=>!0),trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:c=(s.kJ(t)?t[0].doc:t.doc)}={}){super(),this.scope=[],this.addToScope(t),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.doc=c,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=e,this.afterTransactionHandler=t=>{if(!(this.captureTransaction(t)&&this.scope.some((e=>t.changedParentTypes.has(e)))&&(this.trackedOrigins.has(t.origin)||t.origin&&this.trackedOrigins.has(t.origin.constructor))))return;const e=this.undoing,n=this.redoing,r=e?this.redoStack:this.undoStack;e?this.stopCapturing():n||this.clear(!1,!0);const s=new Ht;t.afterState.forEach(((e,n)=>{const r=t.beforeState.get(n)||0,i=e-r;i>0&&Qt(s,n,r,i)}));const i=Tt.ZG();let o=!1;if(this.lastChange>0&&i-this.lastChange<this.captureTimeout&&r.length>0&&!e&&!n){const e=r[r.length-1];e.deletions=qt([e.deletions,t.deleteSet]),e.insertions=qt([e.insertions,s])}else r.push(new Mn(t.deleteSet,s)),o=!0;e||n||(this.lastChange=i),Kt(t,t.deleteSet,(t=>{t instanceof Us&&this.scope.some((e=>Ve(e,t)))&&Cs(t,!0)}));const c=[{stackItem:r[r.length-1],origin:t.origin,type:e?"redo":"undo",changedParentTypes:t.changedParentTypes},this];o?this.emit("stack-item-added",c):this.emit("stack-item-updated",c)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",(()=>{this.destroy()}))}addToScope(t){(t=s.kJ(t)?t:[t]).forEach((t=>{this.scope.every((e=>e!==t))&&this.scope.push(t)}))}addTrackedOrigin(t){this.trackedOrigins.add(t)}removeTrackedOrigin(t){this.trackedOrigins.delete(t)}clear(t=!0,e=!0){(t&&this.canUndo()||e&&this.canRedo())&&this.doc.transact((n=>{t&&(this.undoStack.forEach((t=>xn(n,this,t))),this.undoStack=[]),e&&(this.redoStack.forEach((t=>xn(n,this,t))),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:t,redoStackCleared:e}])}))}stopCapturing(){this.lastChange=0}undo(){let t;this.undoing=!0;try{t=On(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){let t;this.redoing=!0;try{t=On(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}class Nn{constructor(t,e){this.gen=function*(t){const e=ht(t.restDecoder);for(let n=0;n<e;n++){const e=ht(t.restDecoder),n=t.readClient();let r=ht(t.restDecoder);for(let s=0;s<e;s++){const e=t.readInfo();if(10===e){const e=ht(t.restDecoder);yield new xs(Ne(n,r),e),r+=e}else if(0!=(31&e)){const s=0==(192&e),i=new Us(Ne(n,r),null,(e&U)===U?t.readLeftID():null,null,(e&A)===A?t.readRightID():null,s?t.readParentInfo()?t.readString():t.readLeftID():null,s&&32==(32&e)?t.readString():null,Ts(t,e));yield i,r+=i.length}else{const e=t.readLen();yield new ss(Ne(n,r),e),r+=e}}}}(t),this.curr=null,this.done=!1,this.filterSkips=e,this.next()}next(){do{this.curr=this.gen.next().value||null}while(this.filterSkips&&null!==this.curr&&this.curr.constructor===xs);return this.curr}}const Ln=t=>Rn(t,he),Rn=(t,e=de)=>{const n=[],r=new e(it(t)),s=new Nn(r,!1);for(let t=s.curr;null!==t;t=s.next())n.push(t);Wt("Structs: ",n);const i=re(r);Wt("DeleteSet: ",i)},Pn=t=>Vn(t,he),Vn=(t,e=de)=>{const n=[],r=new e(it(t)),s=new Nn(r,!1);for(let t=s.curr;null!==t;t=s.next())n.push(t);return{structs:n,ds:re(r)}};class Jn{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}const Fn=t=>$n(t,he,ge),Wn=(t,e=fe,n=de)=>{const r=new e,s=new Nn(new n(it(t)),!1);let i=s.curr;if(null!==i){let t=0,e=i.id.client,n=0!==i.id.clock,o=n?0:i.id.clock+i.length;for(;null!==i;i=s.next())e!==i.id.client&&(0!==o&&(t++,P(r.restEncoder,e),P(r.restEncoder,o)),e=i.id.client,o=0,n=0!==i.id.clock),i.constructor===xs&&(n=!0),n||(o=i.id.clock+i.length);0!==o&&(t++,P(r.restEncoder,e),P(r.restEncoder,o));const c=I();return P(c,t),((t,e)=>{j(t,N(e))})(c,r.restEncoder),r.restEncoder=c,r.toUint8Array()}return P(r.restEncoder,0),r.toUint8Array()},jn=t=>Wn(t,ue,he),Gn=(t,e=de)=>{const n=new Map,r=new Map,s=new Nn(new e(it(t)),!1);let i=s.curr;if(null!==i){let t=i.id.client,e=i.id.clock;for(n.set(t,e);null!==i;i=s.next())t!==i.id.client&&(r.set(t,e),n.set(i.id.client,i.id.clock),t=i.id.client),e=i.id.clock+i.length;r.set(t,e)}return{from:n,to:r}},Yn=t=>Gn(t,he),zn=(t,e)=>{if(t.constructor===ss){const{client:n,clock:r}=t.id;return new ss(Ne(n,r+e),t.length-e)}if(t.constructor===xs){const{client:n,clock:r}=t.id;return new xs(Ne(n,r+e),t.length-e)}{const n=t,{client:r,clock:s}=n.id;return new Us(Ne(r,s+e),null,Ne(r,s+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},$n=(t,e=de,n=pe)=>{if(1===t.length)return t[0];const r=t.map((t=>new e(it(t))));let s=r.map((t=>new Nn(t,!0))),i=null;const o=new n,c=new Jn(o);for(;s=s.filter((t=>null!==t.curr)),s.sort(((t,e)=>{if(t.curr.id.client===e.curr.id.client){const n=t.curr.id.clock-e.curr.id.clock;return 0===n?t.curr.constructor===e.curr.constructor?0:t.curr.constructor===xs?1:-1:n}return e.curr.id.client-t.curr.id.client})),0!==s.length;){const t=s[0],e=t.curr.id.client;if(null!==i){let n=t.curr,r=!1;for(;null!==n&&n.id.clock+n.length<=i.struct.id.clock+i.struct.length&&n.id.client>=i.struct.id.client;)n=t.next(),r=!0;if(null===n||n.id.client!==e||r&&n.id.clock>i.struct.id.clock+i.struct.length)continue;if(e!==i.struct.id.client)Xn(c,i.struct,i.offset),i={struct:n,offset:0},t.next();else if(i.struct.id.clock+i.struct.length<n.id.clock)if(i.struct.constructor===xs)i.struct.length=n.id.clock+n.length-i.struct.id.clock;else{Xn(c,i.struct,i.offset);const t=n.id.clock-i.struct.id.clock-i.struct.length;i={struct:new xs(Ne(e,i.struct.id.clock+i.struct.length),t),offset:0}}else{const e=i.struct.id.clock+i.struct.length-n.id.clock;e>0&&(i.struct.constructor===xs?i.struct.length-=e:n=zn(n,e)),i.struct.mergeWith(n)||(Xn(c,i.struct,i.offset),i={struct:n,offset:0},t.next())}}else i={struct:t.curr,offset:0},t.next();for(let n=t.curr;null!==n&&n.id.client===e&&n.id.clock===i.struct.id.clock+i.struct.length&&n.constructor!==xs;n=t.next())Xn(c,i.struct,i.offset),i={struct:n,offset:0}}null!==i&&(Xn(c,i.struct,i.offset),i=null),Zn(c);const l=r.map((t=>re(t))),h=qt(l);return ne(o,h),o.toUint8Array()},Bn=(t,e,n=de,r=pe)=>{const s=Ce(e),o=new r,c=new Jn(o),l=new n(it(t)),h=new Nn(l,!1);for(;h.curr;){const t=h.curr,e=t.id.client,n=s.get(e)||0;if(h.curr.constructor!==xs)if(t.id.clock+t.length>n)for(Xn(c,t,i.Fp(n-t.id.clock,0)),h.next();h.curr&&h.curr.id.client===e;)Xn(c,h.curr,0),h.next();else for(;h.curr&&h.curr.id.client===e&&h.curr.id.clock+h.curr.length<=n;)h.next();else h.next()}Zn(c);const a=re(l);return ne(o,a),o.toUint8Array()},Hn=(t,e)=>Bn(t,e,he,ge),Kn=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:N(t.encoder.restEncoder)}),t.encoder.restEncoder=I(),t.written=0)},Xn=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&Kn(t),0===t.written&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),P(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},Zn=t=>{Kn(t);const e=t.encoder.restEncoder;P(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];P(e,r.written),j(e,r.restEncoder)}},qn=(t,e,n,r)=>{const s=new n(it(t)),i=new Nn(s,!1),o=new r,c=new Jn(o);for(let t=i.curr;null!==t;t=i.next())Xn(c,e(t),0);Zn(c);const l=re(s);return ne(o,l),o.toUint8Array()},Qn=({formatting:t=!0,subdocs:e=!0,yxml:n=!0}={})=>{let r=0;const i=o.Ue(),c=o.Ue(),l=o.Ue(),h=o.Ue();return h.set(null,null),a=>{switch(a.constructor){case ss:case xs:return a;case Us:{const g=a,f=g.content;switch(f.constructor){case os:break;case Ss:if(n){const t=f.type;t instanceof Qr&&(t.nodeName=o.Yu(c,t.nodeName,(()=>"node-"+r))),t instanceof es&&(t.hookName=o.Yu(c,t.hookName,(()=>"hook-"+r)))}break;case us:{const t=f;t.arr=t.arr.map((()=>r));break}case is:f.content=new Uint8Array([r]);break;case ls:{const t=f;e&&(t.opts={},t.doc.guid=r+"");break}case hs:f.embed={};break;case as:{const e=f;t&&(e.key=o.Yu(l,e.key,(()=>r+"")),e.value=o.Yu(h,e.value,(()=>({i:r}))));break}case ds:{const t=f;t.arr=t.arr.map((()=>r));break}case gs:{const t=f;t.str=(d=r%10+"",u=t.str.length,s.JJ(u,(()=>d)).join(""));break}default:et()}return g.parentSub&&(g.parentSub=o.Yu(i,g.parentSub,(()=>r+""))),r++,a}default:et()}var d,u}},tr=(t,e)=>qn(t,Qn(e),he,ge),er=(t,e)=>qn(t,Qn(e),de,pe),nr=t=>qn(t,m.id,he,pe),rr=t=>qn(t,m.id,de,ge);class sr{constructor(t,e){this.target=t,this.currentTarget=t,this.transaction=e,this._changes=null,this._keys=null,this._delta=null}get path(){return ir(this.currentTarget,this.target)}deletes(t){return Xt(this.transaction.deleteSet,t.id)}get keys(){if(null===this._keys){const t=new Map,e=this.target;this.transaction.changed.get(e).forEach((n=>{if(null!==n){const r=e._map.get(n);let i,o;if(this.adds(r)){let t=r.left;for(;null!==t&&this.adds(t);)t=t.left;if(this.deletes(r)){if(null===t||!this.deletes(t))return;i="delete",o=s.Z$(t.content.getContent())}else null!==t&&this.deletes(t)?(i="update",o=s.Z$(t.content.getContent())):(i="add",o=void 0)}else{if(!this.deletes(r))return;i="delete",o=s.Z$(r.content.getContent())}t.set(n,{action:i,oldValue:o})}})),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(null===t){const e=this.target,n=Ct.Ue(),r=Ct.Ue(),s=[];if(t={added:n,deleted:r,delta:s,keys:this.keys},this.transaction.changed.get(e).has(null)){let t=null;const i=()=>{t&&s.push(t)};for(let s=e._start;null!==s;s=s.right)s.deleted?this.deletes(s)&&!this.adds(s)&&(null!==t&&void 0!==t.delete||(i(),t={delete:0}),t.delete+=s.length,r.add(s)):this.adds(s)?(null!==t&&void 0!==t.insert||(i(),t={insert:[]}),t.insert=t.insert.concat(s.content.getContent()),n.add(s)):(null!==t&&void 0!==t.retain||(i(),t={retain:0}),t.retain+=s.length);null!==t&&void 0===t.retain&&i()}this._changes=t}return t}}const ir=(t,e)=>{const n=[];for(;null!==e._item&&e!==t;){if(null!==e._item.parentSub)n.unshift(e._item.parentSub);else{let t=0,r=e._item.parent._start;for(;r!==e._item&&null!==r;)r.deleted||t++,r=r.right;n.unshift(t)}e=e._item.parent}return n};let or=0;class cr{constructor(t,e){t.marker=!0,this.p=t,this.index=e,this.timestamp=or++}}const lr=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=or++},hr=(t,e)=>{if(null===t._start||0===e||null===t._searchMarker)return null;const n=0===t._searchMarker.length?null:t._searchMarker.reduce(((t,n)=>i.Wn(e-t.index)<i.Wn(e-n.index)?t:n));let r=t._start,s=0;for(null!==n&&(r=n.p,s=n.index,(t=>{t.timestamp=or++})(n));null!==r.right&&s<e;){if(!r.deleted&&r.countable){if(e<s+r.length)break;s+=r.length}r=r.right}for(;null!==r.left&&s>e;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);for(;null!==r.left&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);return null!==n&&i.Wn(n.index-s)<r.parent.length/80?(lr(n,r,s),n):((t,e,n)=>{if(t.length>=80){const r=t.reduce(((t,e)=>t.timestamp<e.timestamp?t:e));return lr(r,e,n),r}{const r=new cr(e,n);return t.push(r),r}})(t._searchMarker,r,s)},ar=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const s=t[r];if(n>0){let e=s.p;for(e.marker=!1;e&&(e.deleted||!e.countable);)e=e.left,e&&!e.deleted&&e.countable&&(s.index-=e.length);if(null===e||!0===e.marker){t.splice(r,1);continue}s.p=e,e.marker=!0}(e<s.index||n>0&&e===s.index)&&(s.index=i.Fp(e,s.index+n))}},dr=t=>{let e=t._start;const n=[];for(;e;)n.push(e),e=e.right;return n},ur=(t,e,n)=>{const r=t,s=e.changedParentTypes;for(;o.Yu(s,t,(()=>[])).push(n),null!==t._item;)t=t._item.parent;xe(r._eH,n,e)};class gr{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Ue(),this._dEH=Ue(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,e){this.doc=t,this._item=e}_copy(){throw tt()}clone(){throw tt()}_write(t){}get _first(){let t=this._start;for(;null!==t&&t.deleted;)t=t.right;return t}_callObserver(t,e){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){Te(this._eH,t)}observeDeep(t){Te(this._dEH,t)}unobserve(t){Me(this._eH,t)}unobserveDeep(t){Me(this._dEH,t)}toJSON(){}}const fr=(t,e,n)=>{e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const s=[];let i=t._start;for(;null!==i&&r>0;){if(i.countable&&!i.deleted){const t=i.content.getContent();if(t.length<=e)e-=t.length;else{for(let n=e;n<t.length&&r>0;n++)s.push(t[n]),r--;e=0}}i=i.right}return s},pr=t=>{const e=[];let n=t._start;for(;null!==n;){if(n.countable&&!n.deleted){const t=n.content.getContent();for(let n=0;n<t.length;n++)e.push(t[n])}n=n.right}return e},wr=(t,e)=>{const n=[];let r=t._start;for(;null!==r;){if(r.countable&&cn(r,e)){const t=r.content.getContent();for(let e=0;e<t.length;e++)n.push(t[e])}r=r.right}return n},mr=(t,e)=>{let n=0,r=t._start;for(;null!==r;){if(r.countable&&!r.deleted){const s=r.content.getContent();for(let r=0;r<s.length;r++)e(s[r],n++,t)}r=r.right}},kr=(t,e)=>{const n=[];return mr(t,((r,s)=>{n.push(e(r,s,t))})),n},yr=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(null===n){for(;null!==e&&e.deleted;)e=e.right;if(null===e)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const t=n[r++];return n.length<=r&&(n=null),{done:!1,value:t}}}},br=(t,e)=>{const n=hr(t,e);let r=t._start;for(null!==n&&(r=n.p,e-=n.index);null!==r;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},_r=(t,e,n,r)=>{let s=n;const i=t.doc,o=i.clientID,c=i.store,l=null===n?e._start:n.right;let h=[];const a=()=>{h.length>0&&(s=new Us(Ne(o,gn(c,o)),s,s&&s.lastId,l,l&&l.id,e,null,new us(h)),s.integrate(t,0),h=[])};r.forEach((n=>{if(null===n)h.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:h.push(n);break;default:switch(a(),n.constructor){case Uint8Array:case ArrayBuffer:s=new Us(Ne(o,gn(c,o)),s,s&&s.lastId,l,l&&l.id,e,null,new is(new Uint8Array(n))),s.integrate(t,0);break;case ce:s=new Us(Ne(o,gn(c,o)),s,s&&s.lastId,l,l&&l.id,e,null,new ls(n)),s.integrate(t,0);break;default:if(!(n instanceof gr))throw new Error("Unexpected content type in insert operation");s=new Us(Ne(o,gn(c,o)),s,s&&s.lastId,l,l&&l.id,e,null,new Ss(n)),s.integrate(t,0)}}})),a()},Sr=Q("Length exceeded!"),Er=(t,e,n,r)=>{if(n>e._length)throw Sr;if(0===n)return e._searchMarker&&ar(e._searchMarker,n,r.length),_r(t,e,null,r);const s=n,i=hr(e,n);let o=e._start;for(null!==i&&(o=i.p,0==(n-=i.index)&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));null!==o;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&kn(t,Ne(o.id.client,o.id.clock+n));break}n-=o.length}return e._searchMarker&&ar(e._searchMarker,s,r.length),_r(t,e,o,r)},Cr=(t,e,n,r)=>{if(0===r)return;const s=n,i=r,o=hr(e,n);let c=e._start;for(null!==o&&(c=o.p,n-=o.index);null!==c&&n>0;c=c.right)!c.deleted&&c.countable&&(n<c.length&&kn(t,Ne(c.id.client,c.id.clock+n)),n-=c.length);for(;r>0&&null!==c;)c.deleted||(r<c.length&&kn(t,Ne(c.id.client,c.id.clock+r)),c.delete(t),r-=c.length),c=c.right;if(r>0)throw Sr;e._searchMarker&&ar(e._searchMarker,s,-i+r)},Dr=(t,e,n)=>{const r=e._map.get(n);void 0!==r&&r.delete(t)},vr=(t,e,n,r)=>{const s=e._map.get(n)||null,i=t.doc,o=i.clientID;let c;if(null==r)c=new us([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:c=new us([r]);break;case Uint8Array:c=new is(r);break;case ce:c=new ls(r);break;default:if(!(r instanceof gr))throw new Error("Unexpected content type");c=new Ss(r)}new Us(Ne(o,gn(i.store,o)),s,s&&s.lastId,null,null,e,n,c).integrate(t,0)},Ar=(t,e)=>{const n=t._map.get(e);return void 0===n||n.deleted?void 0:n.content.getContent()[n.length-1]},Ur=t=>{const e={};return t._map.forEach(((t,n)=>{t.deleted||(e[n]=t.content.getContent()[t.length-1])})),e},Tr=(t,e)=>{const n=t._map.get(e);return void 0!==n&&!n.deleted},Mr=(t,e,n)=>{let r=t._map.get(e)||null;for(;null!==r&&(!n.sv.has(r.id.client)||r.id.clock>=(n.sv.get(r.id.client)||0));)r=r.left;return null!==r&&cn(r,n)?r.content.getContent()[r.length-1]:void 0},xr=t=>{return e=t.entries(),n=t=>!t[1].deleted,Gt((()=>{let t;do{t=e.next()}while(!t.done&&!n(t.value));return t}));var e,n};class Or extends sr{constructor(t,e){super(t,e),this._transaction=e}}class Ir extends gr{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const e=new Ir;return e.push(t),e}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Ir}clone(){const t=new Ir;return t.insert(0,this.toArray().map((t=>t instanceof gr?t.clone():t))),t}get length(){return null===this._prelimContent?this._length:this._prelimContent.length}_callObserver(t,e){super._callObserver(t,e),ur(this,t,new Or(this,t))}insert(t,e){null!==this.doc?Tn(this.doc,(n=>{Er(n,this,t,e)})):this._prelimContent.splice(t,0,...e)}push(t){null!==this.doc?Tn(this.doc,(e=>{((t,e,n)=>{let r=(e._searchMarker||[]).reduce(((t,e)=>e.index>t.index?e:t),{index:0,p:e._start}).p;if(r)for(;r.right;)r=r.right;_r(t,e,r,n)})(e,this,t)})):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,e=1){null!==this.doc?Tn(this.doc,(n=>{Cr(n,this,t,e)})):this._prelimContent.splice(t,e)}get(t){return br(this,t)}toArray(){return pr(this)}slice(t=0,e=this.length){return fr(this,t,e)}toJSON(){return this.map((t=>t instanceof gr?t.toJSON():t))}map(t){return kr(this,t)}forEach(t){mr(this,t)}[Symbol.iterator](){return yr(this)}_write(t){t.writeTypeRef(ps)}}class Nr extends sr{constructor(t,e,n){super(t,e),this.keysChanged=n}}class Lr extends gr{constructor(t){super(),this._prelimContent=null,this._prelimContent=void 0===t?new Map:new Map(t)}_integrate(t,e){super._integrate(t,e),this._prelimContent.forEach(((t,e)=>{this.set(e,t)})),this._prelimContent=null}_copy(){return new Lr}clone(){const t=new Lr;return this.forEach(((e,n)=>{t.set(n,e instanceof gr?e.clone():e)})),t}_callObserver(t,e){ur(this,t,new Nr(this,t,e))}toJSON(){const t={};return this._map.forEach(((e,n)=>{if(!e.deleted){const r=e.content.getContent()[e.length-1];t[n]=r instanceof gr?r.toJSON():r}})),t}get size(){return[...xr(this._map)].length}keys(){return Yt(xr(this._map),(t=>t[0]))}values(){return Yt(xr(this._map),(t=>t[1].content.getContent()[t[1].length-1]))}entries(){return Yt(xr(this._map),(t=>[t[0],t[1].content.getContent()[t[1].length-1]]))}forEach(t){this._map.forEach(((e,n)=>{e.deleted||t(e.content.getContent()[e.length-1],n,this)}))}[Symbol.iterator](){return this.entries()}delete(t){null!==this.doc?Tn(this.doc,(e=>{Dr(e,this,t)})):this._prelimContent.delete(t)}set(t,e){return null!==this.doc?Tn(this.doc,(n=>{vr(n,this,t,e)})):this._prelimContent.set(t,e),e}get(t){return Ar(this,t)}has(t){return Tr(this,t)}clear(){null!==this.doc?Tn(this.doc,(t=>{this.forEach((function(e,n,r){Dr(t,r,n)}))})):this._prelimContent.clear()}_write(t){t.writeTypeRef(ws)}}const Rr=(t,e)=>t===e||"object"==typeof t&&"object"==typeof e&&t&&e&&zt.$m(t,e);class Pr{constructor(t,e,n,r){this.left=t,this.right=e,this.index=n,this.currentAttributes=r}forward(){null===this.right&&et(),this.right.content.constructor===as?this.right.deleted||Wr(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const Vr=(t,e,n)=>{for(;null!==e.right&&n>0;)e.right.content.constructor===as?e.right.deleted||Wr(e.currentAttributes,e.right.content):e.right.deleted||(n<e.right.length&&kn(t,Ne(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length),e.left=e.right,e.right=e.right.right;return e},Jr=(t,e,n)=>{const r=new Map,s=hr(e,n);if(s){const e=new Pr(s.p.left,s.p,s.index,r);return Vr(t,e,n-s.index)}{const s=new Pr(null,e._start,0,r);return Vr(t,s,n)}},Fr=(t,e,n,r)=>{for(;null!==n.right&&(!0===n.right.deleted||n.right.content.constructor===as&&Rr(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const s=t.doc,i=s.clientID;r.forEach(((r,o)=>{const c=n.left,l=n.right,h=new Us(Ne(i,gn(s.store,i)),c,c&&c.lastId,l,l&&l.id,e,null,new as(o,r));h.integrate(t,0),n.right=h,n.forward()}))},Wr=(t,e)=>{const{key:n,value:r}=e;null===r?t.delete(n):t.set(n,r)},jr=(t,e)=>{for(;null!==t.right&&(t.right.deleted||t.right.content.constructor===as&&Rr(e[t.right.content.key]||null,t.right.content.value));)t.forward()},Gr=(t,e,n,r)=>{const s=t.doc,i=s.clientID,o=new Map;for(const c in r){const l=r[c],h=n.currentAttributes.get(c)||null;if(!Rr(h,l)){o.set(c,h);const{left:r,right:a}=n;n.right=new Us(Ne(i,gn(s.store,i)),r,r&&r.lastId,a,a&&a.id,e,null,new as(c,l)),n.right.integrate(t,0),n.forward()}}return o},Yr=(t,e,n,r,s)=>{n.currentAttributes.forEach(((t,e)=>{void 0===s[e]&&(s[e]=null)}));const i=t.doc,o=i.clientID;jr(n,s);const c=Gr(t,e,n,s),l=r.constructor===String?new gs(r):r instanceof gr?new Ss(r):new hs(r);let{left:h,right:a,index:d}=n;e._searchMarker&&ar(e._searchMarker,n.index,l.getLength()),a=new Us(Ne(o,gn(i.store,o)),h,h&&h.lastId,a,a&&a.id,e,null,l),a.integrate(t,0),n.right=a,n.index=d,n.forward(),Fr(t,e,n,c)},zr=(t,e,n,r,s)=>{const i=t.doc,o=i.clientID;jr(n,s);const c=Gr(t,e,n,s);t:for(;null!==n.right&&(r>0||c.size>0&&(n.right.deleted||n.right.content.constructor===as));){if(!n.right.deleted)switch(n.right.content.constructor){case as:{const{key:e,value:i}=n.right.content,o=s[e];if(void 0!==o){if(Rr(o,i))c.delete(e);else{if(0===r)break t;c.set(e,i)}n.right.delete(t)}else n.currentAttributes.set(e,i);break}default:r<n.right.length&&kn(t,Ne(n.right.id.client,n.right.id.clock+r)),r-=n.right.length}n.forward()}if(r>0){let s="";for(;r>0;r--)s+="\n";n.right=new Us(Ne(o,gn(i.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new gs(s)),n.right.integrate(t,0),n.forward()}Fr(t,e,n,c)},$r=(t,e,n,r,s)=>{let i=e;const c=o.Ue();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===as){const t=i.content;c.set(t.key,t)}i=i.right}let l=0,h=!1;for(;e!==i;){if(n===e&&(h=!0),!e.deleted){const n=e.content;switch(n.constructor){case as:{const{key:i,value:o}=n,a=r.get(i)||null;c.get(i)===n&&a!==o||(e.delete(t),l++,h||(s.get(i)||null)!==o||a===o||(null===a?s.delete(i):s.set(i,a))),h||e.deleted||Wr(s,n);break}}}e=e.right}return l},Br=t=>{let e=0;return Tn(t.doc,(n=>{let r=t._start,s=t._start,i=o.Ue();const c=o.JG(i);for(;s;)!1===s.deleted&&(s.content.constructor===as?Wr(c,s.content):(e+=$r(n,r,s,i,c),i=o.JG(c),r=s)),s=s.right})),e},Hr=(t,e,n)=>{const r=n,s=o.JG(e.currentAttributes),i=e.right;for(;n>0&&null!==e.right;){if(!1===e.right.deleted)switch(e.right.content.constructor){case Ss:case hs:case gs:n<e.right.length&&kn(t,Ne(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t)}e.forward()}i&&$r(t,i,e.right,s,e.currentAttributes);const c=(e.left||e.right).parent;return c._searchMarker&&ar(c._searchMarker,e.index,-r+n),e};class Kr extends sr{constructor(t,e,n){super(t,e),this.childListChanged=!1,this.keysChanged=new Set,n.forEach((t=>{null===t?this.childListChanged=!0:this.keysChanged.add(t)}))}get changes(){if(null===this._changes){const t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(null===this._delta){const t=this.target.doc,e=[];Tn(t,(t=>{const n=new Map,r=new Map;let s=this.target._start,i=null;const o={};let c="",l=0,h=0;const a=()=>{if(null!==i){let t=null;switch(i){case"delete":h>0&&(t={delete:h}),h=0;break;case"insert":("object"==typeof c||c.length>0)&&(t={insert:c},n.size>0&&(t.attributes={},n.forEach(((e,n)=>{null!==e&&(t.attributes[n]=e)})))),c="";break;case"retain":l>0&&(t={retain:l},zt.xb(o)||(t.attributes=zt.f0({},o))),l=0}t&&e.push(t),i=null}};for(;null!==s;){switch(s.content.constructor){case Ss:case hs:this.adds(s)?this.deletes(s)||(a(),i="insert",c=s.content.getContent()[0],a()):this.deletes(s)?("delete"!==i&&(a(),i="delete"),h+=1):s.deleted||("retain"!==i&&(a(),i="retain"),l+=1);break;case gs:this.adds(s)?this.deletes(s)||("insert"!==i&&(a(),i="insert"),c+=s.content.str):this.deletes(s)?("delete"!==i&&(a(),i="delete"),h+=s.length):s.deleted||("retain"!==i&&(a(),i="retain"),l+=s.length);break;case as:{const{key:e,value:c}=s.content;if(this.adds(s)){if(!this.deletes(s)){const l=n.get(e)||null;Rr(l,c)?null!==c&&s.delete(t):("retain"===i&&a(),Rr(c,r.get(e)||null)?delete o[e]:o[e]=c)}}else if(this.deletes(s)){r.set(e,c);const t=n.get(e)||null;Rr(t,c)||("retain"===i&&a(),o[e]=t)}else if(!s.deleted){r.set(e,c);const n=o[e];void 0!==n&&(Rr(n,c)?null!==n&&s.delete(t):("retain"===i&&a(),null===c?delete o[e]:o[e]=c))}s.deleted||("insert"===i&&a(),Wr(n,s.content));break}}s=s.right}for(a();e.length>0;){const t=e[e.length-1];if(void 0===t.retain||void 0!==t.attributes)break;e.pop()}})),this._delta=e}return this._delta}}class Xr extends gr{constructor(t){super(),this._pending=void 0!==t?[()=>this.insert(0,t)]:[],this._searchMarker=[]}get length(){return this._length}_integrate(t,e){super._integrate(t,e);try{this._pending.forEach((t=>t()))}catch(t){console.error(t)}this._pending=null}_copy(){return new Xr}clone(){const t=new Xr;return t.applyDelta(this.toDelta()),t}_callObserver(t,e){super._callObserver(t,e);const n=new Kr(this,t,e),r=t.doc;if(ur(this,t,n),!t.local){let e=!1;for(const[n,s]of t.afterState.entries()){const i=t.beforeState.get(n)||0;if(s!==i&&(bn(t,r.store.clients.get(n),i,s,(t=>{t.deleted||t.content.constructor!==as||(e=!0)})),e))break}e||Kt(t,t.deleteSet,(t=>{t instanceof ss||e||t.parent===this&&t.content.constructor===as&&(e=!0)})),Tn(r,(t=>{e?Br(this):Kt(t,t.deleteSet,(e=>{e instanceof ss||e.parent===this&&((t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===as){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}})(t,e)}))}))}}toString(){let t="",e=this._start;for(;null!==e;)!e.deleted&&e.countable&&e.content.constructor===gs&&(t+=e.content.str),e=e.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:e=!0}={}){null!==this.doc?Tn(this.doc,(n=>{const r=new Pr(null,this._start,0,new Map);for(let s=0;s<t.length;s++){const i=t[s];if(void 0!==i.insert){const o=e||"string"!=typeof i.insert||s!==t.length-1||null!==r.right||"\n"!==i.insert.slice(-1)?i.insert:i.insert.slice(0,-1);("string"!=typeof o||o.length>0)&&Yr(n,this,r,o,i.attributes||{})}else void 0!==i.retain?zr(n,this,r,i.retain,i.attributes||{}):void 0!==i.delete&&Hr(n,r,i.delete)}})):this._pending.push((()=>this.applyDelta(t)))}toDelta(t,e,n){const r=[],s=new Map,i=this.doc;let o="",c=this._start;function l(){if(o.length>0){const t={};let e=!1;s.forEach(((n,r)=>{e=!0,t[r]=n}));const n={insert:o};e&&(n.attributes=t),r.push(n),o=""}}const h=()=>{for(;null!==c;){if(cn(c,t)||void 0!==e&&cn(c,e))switch(c.content.constructor){case gs:{const r=s.get("ychange");void 0===t||cn(c,t)?void 0===e||cn(c,e)?void 0!==r&&(l(),s.delete("ychange")):void 0!==r&&r.user===c.id.client&&"added"===r.type||(l(),s.set("ychange",n?n("added",c.id):{type:"added"})):void 0!==r&&r.user===c.id.client&&"removed"===r.type||(l(),s.set("ychange",n?n("removed",c.id):{type:"removed"})),o+=c.content.str;break}case Ss:case hs:{l();const t={insert:c.content.getContent()[0]};if(s.size>0){const e={};t.attributes=e,s.forEach(((t,n)=>{e[n]=t}))}r.push(t);break}case as:cn(c,t)&&(l(),Wr(s,c.content))}c=c.right}l()};return t||e?Tn(i,(n=>{t&&ln(n,t),e&&ln(n,e),h()}),"cleanup"):h(),r}insert(t,e,n){if(e.length<=0)return;const r=this.doc;null!==r?Tn(r,(r=>{const s=Jr(r,this,t);n||(n={},s.currentAttributes.forEach(((t,e)=>{n[e]=t}))),Yr(r,this,s,e,n)})):this._pending.push((()=>this.insert(t,e,n)))}insertEmbed(t,e,n={}){const r=this.doc;null!==r?Tn(r,(r=>{const s=Jr(r,this,t);Yr(r,this,s,e,n)})):this._pending.push((()=>this.insertEmbed(t,e,n)))}delete(t,e){if(0===e)return;const n=this.doc;null!==n?Tn(n,(n=>{Hr(n,Jr(n,this,t),e)})):this._pending.push((()=>this.delete(t,e)))}format(t,e,n){if(0===e)return;const r=this.doc;null!==r?Tn(r,(r=>{const s=Jr(r,this,t);null!==s.right&&zr(r,this,s,e,n)})):this._pending.push((()=>this.format(t,e,n)))}removeAttribute(t){null!==this.doc?Tn(this.doc,(e=>{Dr(e,this,t)})):this._pending.push((()=>this.removeAttribute(t)))}setAttribute(t,e){null!==this.doc?Tn(this.doc,(n=>{vr(n,this,t,e)})):this._pending.push((()=>this.setAttribute(t,e)))}getAttribute(t){return Ar(this,t)}getAttributes(){return Ur(this)}_write(t){t.writeTypeRef(ms)}}class Zr{constructor(t,e=(()=>!0)){this._filter=e,this._root=t,this._currentNode=t._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let t=this._currentNode,e=t&&t.content&&t.content.type;if(null!==t&&(!this._firstCall||t.deleted||!this._filter(e)))do{if(e=t.content.type,t.deleted||e.constructor!==Qr&&e.constructor!==qr||null===e._start)for(;null!==t;){if(null!==t.right){t=t.right;break}t=t.parent===this._root?null:t.parent._item}else t=e._start}while(null!==t&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,null===t?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}}class qr extends gr{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new qr}clone(){const t=new qr;return t.insert(0,this.toArray().map((t=>t instanceof gr?t.clone():t))),t}get length(){return null===this._prelimContent?this._length:this._prelimContent.length}createTreeWalker(t){return new Zr(this,t)}querySelector(t){t=t.toUpperCase();const e=new Zr(this,(e=>e.nodeName&&e.nodeName.toUpperCase()===t)).next();return e.done?null:e.value}querySelectorAll(t){return t=t.toUpperCase(),s.Dp(new Zr(this,(e=>e.nodeName&&e.nodeName.toUpperCase()===t)))}_callObserver(t,e){ur(this,t,new ts(this,e,t))}toString(){return kr(this,(t=>t.toString())).join("")}toJSON(){return this.toString()}toDOM(t=document,e={},n){const r=t.createDocumentFragment();return void 0!==n&&n._createAssociation(r,this),mr(this,(s=>{r.insertBefore(s.toDOM(t,e,n),null)})),r}insert(t,e){null!==this.doc?Tn(this.doc,(n=>{Er(n,this,t,e)})):this._prelimContent.splice(t,0,...e)}insertAfter(t,e){if(null!==this.doc)Tn(this.doc,(n=>{const r=t&&t instanceof gr?t._item:t;_r(n,this,r,e)}));else{const n=this._prelimContent,r=null===t?0:n.findIndex((e=>e===t))+1;if(0===r&&null!==t)throw Q("Reference item not found");n.splice(r,0,...e)}}delete(t,e=1){null!==this.doc?Tn(this.doc,(n=>{Cr(n,this,t,e)})):this._prelimContent.splice(t,e)}toArray(){return pr(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return br(this,t)}slice(t=0,e=this.length){return fr(this,t,e)}forEach(t){mr(this,t)}_write(t){t.writeTypeRef(ys)}}class Qr extends qr{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,e){super._integrate(t,e),this._prelimAttrs.forEach(((t,e)=>{this.setAttribute(e,t)})),this._prelimAttrs=null}_copy(){return new Qr(this.nodeName)}clone(){const t=new Qr(this.nodeName),e=this.getAttributes();return zt.Ed(e,((e,n)=>{"string"==typeof e&&t.setAttribute(n,e)})),t.insert(0,this.toArray().map((t=>t instanceof gr?t.clone():t))),t}toString(){const t=this.getAttributes(),e=[],n=[];for(const e in t)n.push(e);n.sort();const r=n.length;for(let s=0;s<r;s++){const r=n[s];e.push(r+'="'+t[r]+'"')}const s=this.nodeName.toLocaleLowerCase();return`<${s}${e.length>0?" "+e.join(" "):""}>${super.toString()}</${s}>`}removeAttribute(t){null!==this.doc?Tn(this.doc,(e=>{Dr(e,this,t)})):this._prelimAttrs.delete(t)}setAttribute(t,e){null!==this.doc?Tn(this.doc,(n=>{vr(n,this,t,e)})):this._prelimAttrs.set(t,e)}getAttribute(t){return Ar(this,t)}hasAttribute(t){return Tr(this,t)}getAttributes(){return Ur(this)}toDOM(t=document,e={},n){const r=t.createElement(this.nodeName),s=this.getAttributes();for(const t in s){const e=s[t];"string"==typeof e&&r.setAttribute(t,e)}return mr(this,(s=>{r.appendChild(s.toDOM(t,e,n))})),void 0!==n&&n._createAssociation(r,this),r}_write(t){t.writeTypeRef(ks),t.writeKey(this.nodeName)}}class ts extends sr{constructor(t,e,n){super(t,n),this.childListChanged=!1,this.attributesChanged=new Set,e.forEach((t=>{null===t?this.childListChanged=!0:this.attributesChanged.add(t)}))}}class es extends Lr{constructor(t){super(),this.hookName=t}_copy(){return new es(this.hookName)}clone(){const t=new es(this.hookName);return this.forEach(((e,n)=>{t.set(n,e)})),t}toDOM(t=document,e={},n){const r=e[this.hookName];let s;return s=void 0!==r?r.createDom(this):document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),void 0!==n&&n._createAssociation(s,this),s}_write(t){t.writeTypeRef(bs),t.writeKey(this.hookName)}}class ns extends Xr{get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new ns}clone(){const t=new ns;return t.applyDelta(this.toDelta()),t}toDOM(t=document,e,n){const r=t.createTextNode(this.toString());return void 0!==n&&n._createAssociation(r,this),r}toString(){return this.toDelta().map((t=>{const e=[];for(const n in t.attributes){const r=[];for(const e in t.attributes[n])r.push({key:e,value:t.attributes[n][e]});r.sort(((t,e)=>t.key<e.key?-1:1)),e.push({nodeName:n,attrs:r})}e.sort(((t,e)=>t.nodeName<e.nodeName?-1:1));let n="";for(let t=0;t<e.length;t++){const r=e[t];n+=`<${r.nodeName}`;for(let t=0;t<r.attrs.length;t++){const e=r.attrs[t];n+=` ${e.key}="${e.value}"`}n+=">"}n+=t.insert;for(let t=e.length-1;t>=0;t--)n+=`</${e[t].nodeName}>`;return n})).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(_s)}}class rs{constructor(t,e){this.id=t,this.length=e}get deleted(){throw tt()}mergeWith(t){return!1}write(t,e,n){throw tt()}integrate(t,e){throw tt()}}class ss extends rs{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor===t.constructor&&(this.length+=t.length,!0)}integrate(t,e){e>0&&(this.id.clock+=e,this.length-=e),fn(t.doc.store,this)}write(t,e){t.writeInfo(0),t.writeLen(this.length-e)}getMissing(t,e){return null}}class is{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new is(this.content)}splice(t){throw tt()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeBuf(this.content)}getRef(){return 3}}class os{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new os(this.len)}splice(t){const e=new os(this.len-t);return this.len=t,e}mergeWith(t){return this.len+=t.len,!0}integrate(t,e){Qt(t.deleteSet,e.id.client,e.id.clock,this.len),e.markDeleted()}delete(t){}gc(t){}write(t,e){t.writeLen(this.len-e)}getRef(){return 1}}const cs=(t,e)=>new ce({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class ls{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;const e={};this.opts=e,t.gc||(e.gc=!1),t.autoLoad&&(e.autoLoad=!0),null!==t.meta&&(e.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new ls(cs(this.doc.guid,this.opts))}splice(t){throw tt()}mergeWith(t){return!1}integrate(t,e){this.doc._item=e,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,e){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}}class hs{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new hs(this.embed)}splice(t){throw tt()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeJSON(this.embed)}getRef(){return 5}}class as{constructor(t,e){this.key=t,this.value=e}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new as(this.key,this.value)}splice(t){throw tt()}mergeWith(t){return!1}integrate(t,e){e.parent._searchMarker=null}delete(t){}gc(t){}write(t,e){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}}class ds{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ds(this.arr)}splice(t){const e=new ds(this.arr.slice(t));return this.arr=this.arr.slice(0,t),e}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){const n=this.arr.length;t.writeLen(n-e);for(let r=e;r<n;r++){const e=this.arr[r];t.writeString(void 0===e?"undefined":JSON.stringify(e))}}getRef(){return 2}}class us{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new us(this.arr)}splice(t){const e=new us(this.arr.slice(t));return this.arr=this.arr.slice(0,t),e}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){const n=this.arr.length;t.writeLen(n-e);for(let r=e;r<n;r++){const e=this.arr[r];t.writeAny(e)}}getRef(){return 8}}class gs{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new gs(this.str)}splice(t){const e=new gs(this.str.slice(t));this.str=this.str.slice(0,t);const n=this.str.charCodeAt(t-1);return n>=55296&&n<=56319&&(this.str=this.str.slice(0,t-1)+"�",e.str="�"+e.str.slice(1)),e}mergeWith(t){return this.str+=t.str,!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeString(0===e?this.str:this.str.slice(e))}getRef(){return 4}}const fs=[t=>new Ir,t=>new Lr,t=>new Xr,t=>new Qr(t.readKey()),t=>new qr,t=>new es(t.readKey()),t=>new ns],ps=0,ws=1,ms=2,ks=3,ys=4,bs=5,_s=6;class Ss{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Ss(this.type._copy())}splice(t){throw tt()}mergeWith(t){return!1}integrate(t,e){this.type._integrate(t.doc,e)}delete(t){let e=this.type._start;for(;null!==e;)e.deleted?t._mergeStructs.push(e):e.delete(t),e=e.right;this.type._map.forEach((e=>{e.deleted?t._mergeStructs.push(e):e.delete(t)})),t.changed.delete(this.type)}gc(t){let e=this.type._start;for(;null!==e;)e.gc(t,!0),e=e.right;this.type._start=null,this.type._map.forEach((e=>{for(;null!==e;)e.gc(t,!0),e=e.left})),this.type._map=new Map}write(t,e){this.type._write(t)}getRef(){return 7}}const Es=(t,e)=>{let n,r=e,s=0;do{s>0&&(r=Ne(r.client,r.clock+s)),n=wn(t,r),s=r.clock-n.id.clock,r=n.redone}while(null!==r&&n instanceof Us);return{item:n,diff:s}},Cs=(t,e)=>{for(;null!==t&&t.keep!==e;)t.keep=e,t=t.parent._item},Ds=(t,e,n)=>{const{client:r,clock:s}=e.id,i=new Us(Ne(r,s+n),e,Ne(r,s+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&i.markDeleted(),e.keep&&(i.keep=!0),null!==e.redone&&(i.redone=Ne(e.redone.client,e.redone.clock+n)),e.right=i,null!==i.right&&(i.right.left=i),t._mergeStructs.push(i),null!==i.parentSub&&null===i.right&&i.parent._map.set(i.parentSub,i),e.length=n,i},vs=(t,e)=>s.G(t,(t=>Xt(t.deletions,e))),As=(t,e,n,r,s,i)=>{const o=t.doc,c=o.store,l=o.clientID,h=e.redone;if(null!==h)return kn(t,h);let a,d=e.parent._item,u=null;if(null!==d&&!0===d.deleted){if(null===d.redone&&(!n.has(d)||null===As(t,d,n,r,s,i)))return null;for(;null!==d.redone;)d=kn(t,d.redone)}const g=null===d?e.parent:d.content.type;if(null===e.parentSub){for(u=e.left,a=e;null!==u;){let e=u;for(;null!==e&&e.parent._item!==d;)e=null===e.redone?null:kn(t,e.redone);if(null!==e&&e.parent._item===d){u=e;break}u=u.left}for(;null!==a;){let e=a;for(;null!==e&&e.parent._item!==d;)e=null===e.redone?null:kn(t,e.redone);if(null!==e&&e.parent._item===d){a=e;break}a=a.right}}else if(a=null,e.right&&!s){for(u=e;null!==u&&null!==u.right&&(u.right.redone||Xt(r,u.right.id)||vs(i.undoStack,u.right.id)||vs(i.redoStack,u.right.id));)for(u=u.right;u.redone;)u=kn(t,u.redone);if(u&&null!==u.right)return null}else u=g._map.get(e.parentSub)||null;const f=gn(c,l),p=Ne(l,f),w=new Us(p,u,u&&u.lastId,a,a&&a.id,g,e.parentSub,e.content.copy());return e.redone=p,Cs(w,!0),w.integrate(t,0),w};class Us extends rs{constructor(t,e,n,r,s,i,o,c){super(t,c.getLength()),this.origin=n,this.left=e,this.right=r,this.rightOrigin=s,this.parent=i,this.parentSub=o,this.redone=null,this.content=c,this.info=this.content.isCountable()?2:0}set marker(t){(8&this.info)>0!==t&&(this.info^=8)}get marker(){return(8&this.info)>0}get keep(){return(1&this.info)>0}set keep(t){this.keep!==t&&(this.info^=1)}get countable(){return(2&this.info)>0}get deleted(){return(4&this.info)>0}set deleted(t){this.deleted!==t&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,e){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=gn(e,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=gn(e,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Oe&&this.id.client!==this.parent.client&&this.parent.clock>=gn(e,this.parent.client))return this.parent.client;if(this.origin&&(this.left=yn(t,e,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=kn(t,this.rightOrigin),this.rightOrigin=this.right.id),(this.left&&this.left.constructor===ss||this.right&&this.right.constructor===ss)&&(this.parent=null),this.parent){if(this.parent.constructor===Oe){const t=wn(e,this.parent);t.constructor===ss?this.parent=null:this.parent=t.content.type}}else this.left&&this.left.constructor===Us&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===Us&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);return null}integrate(t,e){if(e>0&&(this.id.clock+=e,this.left=yn(t,t.doc.store,Ne(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(e),this.length-=e),this.parent){if(!this.left&&(!this.right||null!==this.right.left)||this.left&&this.left.right!==this.right){let e,n=this.left;if(null!==n)e=n.right;else if(null!==this.parentSub)for(e=this.parent._map.get(this.parentSub)||null;null!==e&&null!==e.left;)e=e.left;else e=this.parent._start;const r=new Set,s=new Set;for(;null!==e&&e!==this.right;){if(s.add(e),r.add(e),Ie(this.origin,e.origin)){if(e.id.client<this.id.client)n=e,r.clear();else if(Ie(this.rightOrigin,e.rightOrigin))break}else{if(null===e.origin||!s.has(wn(t.doc.store,e.origin)))break;r.has(wn(t.doc.store,e.origin))||(n=e,r.clear())}e=e.right}this.left=n}if(null!==this.left){const t=this.left.right;this.right=t,this.left.right=this}else{let t;if(null!==this.parentSub)for(t=this.parent._map.get(this.parentSub)||null;null!==t&&null!==t.left;)t=t.left;else t=this.parent._start,this.parent._start=this;this.right=t}null!==this.right?this.right.left=this:null!==this.parentSub&&(this.parent._map.set(this.parentSub,this),null!==this.left&&this.left.delete(t)),null===this.parentSub&&this.countable&&!this.deleted&&(this.parent._length+=this.length),fn(t.doc.store,this),this.content.integrate(t,this),En(t,this.parent,this.parentSub),(null!==this.parent._item&&this.parent._item.deleted||null!==this.parentSub&&null!==this.right)&&this.delete(t)}else new ss(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;null!==t&&t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;null!==t&&t.deleted;)t=t.left;return t}get lastId(){return 1===this.length?this.id:Ne(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&Ie(t.origin,this.lastId)&&this.right===t&&Ie(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&null===this.redone&&null===t.redone&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){const e=this.parent._searchMarker;return e&&e.forEach((e=>{e.p===t&&(e.p=this,!this.deleted&&this.countable&&(e.index-=this.length))})),t.keep&&(this.keep=!0),this.right=t.right,null!==this.right&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){const e=this.parent;this.countable&&null===this.parentSub&&(e._length-=this.length),this.markDeleted(),Qt(t.deleteSet,this.id.client,this.id.clock,this.length),En(t,e,this.parentSub),this.content.delete(t)}}gc(t,e){if(!this.deleted)throw et();this.content.gc(t),e?((t,e,n)=>{const r=t.clients.get(e.id.client);r[pn(r,e.id.clock)]=n})(t,this,new ss(this.id,this.length)):this.content=new os(this.length)}write(t,e){const n=e>0?Ne(this.id.client,this.id.clock+e-1):this.origin,r=this.rightOrigin,s=this.parentSub,i=31&this.content.getRef()|(null===n?0:U)|(null===r?0:A)|(null===s?0:32);if(t.writeInfo(i),null!==n&&t.writeLeftID(n),null!==r&&t.writeRightID(r),null===n&&null===r){const e=this.parent;if(void 0!==e._item){const n=e._item;if(null===n){const n=Pe(e);t.writeParentInfo(!0),t.writeString(n)}else t.writeParentInfo(!1),t.writeLeftID(n.id)}else e.constructor===String?(t.writeParentInfo(!0),t.writeString(e)):e.constructor===Oe?(t.writeParentInfo(!1),t.writeLeftID(e)):et();null!==s&&t.writeString(s)}this.content.write(t,e)}}const Ts=(t,e)=>Ms[31&e](t),Ms=[()=>{et()},t=>new os(t.readLen()),t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const e=t.readString();"undefined"===e?n.push(void 0):n.push(JSON.parse(e))}return new ds(n)},t=>new is(t.readBuf()),t=>new gs(t.readString()),t=>new hs(t.readJSON()),t=>new as(t.readKey(),t.readJSON()),t=>new Ss(fs[t.readTypeRef()](t)),t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new us(n)},t=>new ls(cs(t.readString(),t.readAny())),()=>{et()}];class xs extends rs{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor===t.constructor&&(this.length+=t.length,!0)}integrate(t,e){et()}write(t,e){t.writeInfo(10),P(t.restEncoder,this.length-e)}getMissing(t,e){return null}}const Os="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},Is="__ $YJS$ __";!0===Os[Is]&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),Os[Is]=!0}}]);
|