!function(){try{var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};t.SENTRY_RELEASE={id:"substack@538433c"};var e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="da91fae6-7746-4644-a51d-88aa76273ba9",t._sentryDebugIdIdentifier="sentry-dbid-da91fae6-7746-4644-a51d-88aa76273ba9")}catch(t){}}();"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["19971"],{97070:function(t,e,r){r.d(e,{$L:()=>F,Ln:()=>m,N0:()=>R,Um:()=>N,Wg:()=>g,X9:()=>o,dL:()=>$,jP:()=>w,n9:()=>J,oM:()=>v,zy:()=>C});var n=r(579);class i{constructor(t,e,r){this.pos=t,this.delInfo=e,this.recover=r}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class s{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&s.empty)return s.empty}recover(t){let e=0,r=65535&t;if(!this.inverted)for(let t=0;tt)break;let p=this.ranges[l+s],h=this.ranges[l+o],c=a+p;if(t<=c){let s=p?t==a?-1:t==c?1:e:e,o=a+n+(s<0?0:h);if(r)return o;let f=t==(e<0?a:c)?null:l/3+(t-a)*65536,d=t==a?2:t==c?1:4;return(e<0?t!=a:t!=c)&&(d|=8),new i(o,d,f)}n+=h-p}return r?t+n:new i(t+n,0,null)}touches(t,e){let r=0,n=65535&e,i=this.inverted?2:1,s=this.inverted?1:2;for(let e=0;et)break;let l=this.ranges[e+i];if(t<=o+l&&e==3*n)return!0;r+=this.ranges[e+s]-l}return!1}forEach(t){let e=this.inverted?2:1,r=this.inverted?1:2;for(let n=0,i=0;n=0;e--){let n=t.getMirror(e);this.appendMap(t._maps[e].invert(),null!=n&&n>e?r-n-1:void 0)}}invert(){let t=new o;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let r=this.from;rr&&et.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t,i),e.openStart,e.openEnd);return p.fromReplace(t,this.from,this.to,s)}invert(){return new f(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new c(e.pos,r.pos,this.mark)}merge(t){return t instanceof c&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new c(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new c(e.from,e.to,t.markFromJSON(e.mark))}}a.jsonID("addMark",c);class f extends a{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=new n.Ji(h(e.content,t=>t.mark(this.mark.removeFromSet(t.marks)),t),e.openStart,e.openEnd);return p.fromReplace(t,this.from,this.to,r)}invert(){return new c(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new f(e.pos,r.pos,this.mark)}merge(t){return t instanceof f&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new f(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new f(e.from,e.to,t.markFromJSON(e.mark))}}a.jsonID("removeMark",f);class d extends a{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return p.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return p.fromReplace(t,this.pos,this.pos+1,new n.Ji(n.FK.from(r),0,+!e.isLeaf))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let r=0;rr.pos?null:new g(e.pos,r.pos,n,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to||"number"!=typeof e.gapFrom||"number"!=typeof e.gapTo||"number"!=typeof e.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new g(e.from,e.to,e.gapFrom,e.gapTo,n.Ji.fromJSON(t,e.slice),e.insert,!!e.structure)}}function y(t,e,r){let n=t.resolve(e),i=r-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let t=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!t||t.isLeaf)return!0;t=t.firstChild,i--}}return!1}function k(t,e,r,i=r.contentMatch,s=!0){let o=t.doc.nodeAt(e),l=[],a=e+1;for(let e=0;e=0;e--)t.step(l[e])}function w(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let n=t.$from.node(r),i=t.$from.index(r),s=t.$to.indexAfter(r);if(r{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let i=t.mapping.slice(n).map(r+1+s+o.index);t.replaceWith(i,i+1,e.type.schema.linebreakReplacement.create())}}})}function M(t,e,r,n){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let i=t.mapping.slice(n).map(r+1+s);t.replaceWith(i,i+1,e.type.schema.text("\n"))}})}function C(t,e,r=1,n){let i=t.resolve(e),s=i.depth-r,o=n&&n[n.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let t=i.depth-1,e=r-2;t>s;t--,e--){let r=i.node(t),s=i.index(t);if(r.type.spec.isolating)return!1;let o=r.content.cutByIndex(s,r.childCount),l=n&&n[e+1];l&&(o=o.replaceChild(0,l.type.create(l.attrs)));let a=n&&n[e]||r;if(!r.canReplace(s+1,r.childCount)||!a.type.validContent(o))return!1}let l=i.indexAfter(s),a=n&&n[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function J(t,e){let r=t.resolve(e),n=r.index();return x(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function x(t,e){return!!(t&&e&&!t.isLeaf&&function(t,e){e.content.size||t.type.compatibleContent(e.type);let r=t.contentMatchAt(t.childCount),{linebreakReplacement:n}=t.type.schema;for(let i=0;i0?(i=n.node(t+1),o++,s=n.node(t).maybeChild(o)):(i=n.node(t).maybeChild(o-1),s=n.node(t+1)),i&&!i.isTextblock&&x(i,s)&&n.node(t).canReplace(o,o+1))return e;if(0==t)break;e=r<0?n.before(t):n.after(t)}}function N(t,e,r){let n=t.resolve(e);if(!r.content.size)return e;let i=r.content;for(let t=0;t=0;e--){let r=e==n.depth?0:n.pos<=(n.start(e+1)+n.end(e+1))/2?-1:1,s=n.index(e)+ +(r>0),o=n.node(e),l=!1;if(1==t)l=o.canReplace(s,s,i);else{let t=o.contentMatchAt(s).findWrapping(i.firstChild.type);l=t&&o.canReplaceWith(s,s,t[0])}if(l)return 0==r?n.pos:r<0?n.before(e+1):n.after(e+1)}return null}function F(t,e,r=e,i=n.Ji.empty){if(e==r&&!i.size)return null;let s=t.resolve(e),o=t.resolve(r);return I(s,o,i)?new m(e,r,i):new T(s,o,i).fit()}function I(t,e,r){return!r.openStart&&!r.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),r.content)}a.jsonID("replaceAround",g);class T{constructor(t,e,r){this.$from=t,this.$to=e,this.unplaced=r,this.frontier=[],this.placed=n.FK.empty;for(let e=0;e<=t.depth;e++){let r=t.node(e);this.frontier.push({type:r.type,match:r.contentMatchAt(t.indexAfter(e))})}for(let e=t.depth;e>0;e--)this.placed=n.FK.from(t.node(e).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&1==s.childCount;)s=s.firstChild.content,o--,l--;let a=new n.Ji(s,o,l);return t>-1?new g(r.pos,t,this.$to.pos,this.$to.end(),a,e):a.size||r.pos!=this.$to.pos?new m(r.pos,i.pos,a):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,r=0,n=this.unplaced.openEnd;r1&&(n=0),i.type.spec.isolating&&n<=r){t=r;break}e=i.content}for(let e=1;e<=2;e++)for(let r=1==e?t:this.unplaced.openStart;r>=0;r--){let t=null,i=(r?(t=O(this.unplaced.content,r-1).firstChild).content:this.unplaced.content).firstChild;for(let s=this.depth;s>=0;s--){let{type:o,match:l}=this.frontier[s],a,p=null;if(1==e&&(i?l.matchType(i.type)||(p=l.fillBefore(n.FK.from(i),!1)):t&&o.compatibleContent(t.type)))return{sliceDepth:r,frontierDepth:s,parent:t,inject:p};if(2==e&&i&&(a=l.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:s,parent:t,wrap:a};if(t&&l.matchType(t.type))break}}}openMore(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=O(t,e);return!!i.childCount&&!i.firstChild.isLeaf&&(this.unplaced=new n.Ji(t,e+1,Math.max(r,i.size+e>=t.size-r?e+1:0)),!0)}dropNode(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=O(t,e);if(i.childCount<=1&&e>0){let s=t.size-e<=e+i.size;this.unplaced=new n.Ji(A(t,e-1,1),e-1,s?e-1:r)}else this.unplaced=new n.Ji(A(t,e,1),e,r)}placeNodes({sliceDepth:t,frontierDepth:e,parent:r,inject:i,wrap:s}){for(;this.depth>e;)this.closeFrontierNode();if(s)for(let t=0;t1||0==a||t.content.size)&&(c=e,h.push(function t(e,r,i){if(r<=0)return e;let s=e.content;return r>1&&(s=s.replaceChild(0,t(s.firstChild,r-1,1==s.childCount?i-1:0))),r>0&&(s=e.type.contentMatch.fillBefore(s).append(s),i<=0&&(s=s.append(e.type.contentMatch.matchFragment(s).fillBefore(n.FK.empty,!0)))),e.copy(s)}(t.mark(f.allowedMarks(t.marks)),1==p?a:0,p==l.childCount?d:-1)))}let u=p==l.childCount;u||(d=-1),this.placed=E(this.placed,e,n.FK.from(h)),this.frontier[e].match=c,u&&d<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let t=0,e=l;t1&&n==this.$to.end(--r);)++n;return n}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:r,type:n}=this.frontier[e],i=e=0;r--){let{match:e,type:n}=this.frontier[r],i=z(t,r,n,e,!0);if(!i||i.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=E(this.placed,e.depth,e.fit)),t=e.move;for(let r=e.depth+1;r<=t.depth;r++){let e=t.node(r),n=e.type.contentMatch.fillBefore(e.content,!0,t.index(r));this.openFrontierNode(e.type,e.attrs,n)}return t}openFrontierNode(t,e=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=E(this.placed,this.depth,n.FK.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(n.FK.empty,!0);t.childCount&&(this.placed=E(this.placed,this.frontier.length,t))}}function A(t,e,r){return 0==e?t.cutByIndex(r,t.childCount):t.replaceChild(0,t.firstChild.copy(A(t.firstChild.content,e-1,r)))}function E(t,e,r){return 0==e?t.append(r):t.replaceChild(t.childCount-1,t.lastChild.copy(E(t.lastChild.content,e-1,r)))}function O(t,e){for(let r=0;r=0;i--){let n=t.start(i);if(ne.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(n==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==n-1)&&r.push(i)}return r}class K extends a{constructor(t,e,r){super(),this.pos=t,this.attr=e,this.value=r}apply(t){let e=t.nodeAt(this.pos);if(!e)return p.fail("No node at attribute step's position");let r=Object.create(null);for(let t in e.attrs)r[t]=e.attrs[t];r[this.attr]=this.value;let i=e.type.create(r,null,e.marks);return p.fromReplace(t,this.pos,this.pos+1,new n.Ji(n.FK.from(i),0,+!e.isLeaf))}getMap(){return s.empty}invert(t){return new K(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new K(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if("number"!=typeof e.pos||"string"!=typeof e.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new K(e.pos,e.attr,e.value)}}a.jsonID("attr",K);class B extends a{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let r in t.attrs)e[r]=t.attrs[r];e[this.attr]=this.value;let r=t.type.create(e,t.content,t.marks);return p.ok(r)}getMap(){return s.empty}invert(t){return new B(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if("string"!=typeof e.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new B(e.attr,e.value)}}a.jsonID("docAttr",B);let D=class extends Error{};(D=function t(e){let r=Error.call(this,e);return r.__proto__=t.prototype,r}).prototype=Object.create(Error.prototype),D.prototype.constructor=D,D.prototype.name="TransformError";class ${constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new o}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new D(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,r=n.Ji.empty){let i=F(this.doc,t,e,r);return i&&this.step(i),this}replaceWith(t,e,r){return this.replace(t,e,new n.Ji(n.FK.from(r),0,0))}delete(t,e){return this.replace(t,e,n.Ji.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,r){return!function(t,e,r,i){if(!i.size)return t.deleteRange(e,r);let s=t.doc.resolve(e),o=t.doc.resolve(r);if(I(s,o,i))return t.step(new m(e,r,i));let l=_(s,t.doc.resolve(r));0==l[l.length-1]&&l.pop();let a=-(s.depth+1);l.unshift(a);for(let t=s.depth,e=s.pos-1;t>0;t--,e--){let r=s.node(t).type.spec;if(r.defining||r.definingAsContext||r.isolating)break;l.indexOf(t)>-1?a=t:s.before(t)==e&&l.splice(1,0,-t)}let p=l.indexOf(a),h=[],c=i.openStart;for(let t=i.content,e=0;;e++){let r=t.firstChild;if(h.push(r),e==i.openStart)break;t=r.content}for(let t=c-1;t>=0;t--){var f;let e=h[t],r=(f=e.type).spec.defining||f.spec.definingForContent;if(r&&!e.sameMarkup(s.node(Math.abs(a)-1)))c=t;else if(r||!e.type.isTextblock)break}for(let e=i.openStart;e>=0;e--){let a=(e+c+1)%(i.openStart+1),f=h[a];if(f)for(let e=0;es){let t=o.contentMatchAt(0),r=t.fillBefore(e).append(e);e=r.append(t.matchFragment(r).fillBefore(n.FK.empty,!0))}return e}(i.content,0,i.openStart,a),a,i.openEnd))}}let d=t.steps.length;for(let n=l.length-1;n>=0&&(t.replace(e,r,i),!(t.steps.length>d));n--){let t=l[n];t<0||(e=s.before(t),r=o.after(t))}}(this,t,e,r),this}replaceRangeWith(t,e,r){var i=t,s=e;if(!r.isInline&&i==s&&this.doc.resolve(i).parent.content.size){let t=function(t,e,r){let n=t.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),r))return e;if(0==n.parentOffset)for(let t=n.depth-1;t>=0;t--){let e=n.index(t);if(n.node(t).canReplaceWith(e,e,r))return n.before(t+1);if(e>0)return null}if(n.parentOffset==n.parent.content.size)for(let t=n.depth-1;t>=0;t--){let e=n.indexAfter(t);if(n.node(t).canReplaceWith(e,e,r))return n.after(t+1);if(e0&&(o||n.node(r-1).canReplace(n.index(r-1),i.indexAfter(r-1))))return t.delete(n.before(r),i.after(r))}for(let s=1;s<=n.depth&&s<=i.depth;s++)if(e-n.start(s)==n.depth-s&&r>n.end(s)&&i.end(s)-r!=i.depth-s&&n.start(s-1)==i.start(s-1)&&n.node(s-1).canReplace(n.index(s-1),i.index(s-1)))return t.delete(n.before(s),r);t.delete(e,r)}(this,t,e),this}lift(t,e){return!function(t,e,r){let{$from:i,$to:s,depth:o}=e,l=i.before(o+1),a=s.after(o+1),p=l,h=a,c=n.FK.empty,f=0;for(let t=o,e=!1;t>r;t--)e||i.index(t)>0?(e=!0,c=n.FK.from(i.node(t).copy(c)),f++):p--;let d=n.FK.empty,u=0;for(let t=o,e=!1;t>r;t--)e||s.after(t+1)=0;t--){if(i.size){let e=r[t].type.contentMatch.matchFragment(i);if(!e||!e.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=n.FK.from(r[t].type.create(r[t].attrs,i))}let s=e.start,o=e.end;t.step(new g(s,o,s,o,new n.Ji(i,0,0),r.length,!0))}(this,t,e),this}setBlockType(t,e=t,r,i=null){var s=this;if(!r.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let o=s.steps.length;return s.doc.nodesBetween(t,e,(t,e)=>{var l,a,p;let h,c,f="function"==typeof i?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,f)&&(l=s.doc,a=s.mapping.slice(o).map(e),p=r,c=(h=l.resolve(a)).index(),h.parent.canReplaceWith(c,c+1,p))){let i=null;if(r.schema.linebreakReplacement){let t="pre"==r.whitespace,e=!!r.contentMatch.matchType(r.schema.linebreakReplacement);t&&!e?i=!1:!t&&e&&(i=!0)}!1===i&&M(s,t,e,o),k(s,s.mapping.slice(o).map(e,1),r,void 0,null===i);let l=s.mapping.slice(o),a=l.map(e,1),p=l.map(e+t.nodeSize,1);return s.step(new g(a,p,a+1,p-1,new n.Ji(n.FK.from(r.create(f,null,t.marks)),0,0),1,!0)),!0===i&&b(s,t,e,o),!1}}),this}setNodeMarkup(t,e,r=null,i){return!function(t,e,r,i,s){let o=t.doc.nodeAt(e);if(!o)throw RangeError("No node at given position");r||(r=o.type);let l=r.create(i,null,s||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,l);if(!r.validContent(o.content))throw RangeError("Invalid content for node type "+r.name);t.step(new g(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new n.Ji(n.FK.from(l),0,0),1,!0))}(this,t,e,r,i),this}setNodeAttribute(t,e,r){return this.step(new K(t,e,r)),this}setDocAttribute(t,e){return this.step(new B(t,e)),this}addNodeMark(t,e){return this.step(new d(t,e)),this}removeNodeMark(t,e){let r=this.doc.nodeAt(t);if(!r)throw RangeError("No node at position "+t);if(e instanceof n.CU)e.isInSet(r.marks)&&this.step(new u(t,e));else{let n=r.marks,i,s=[];for(;i=e.isInSet(n);)s.push(new u(t,i)),n=i.removeFromSet(n);for(let t=s.length-1;t>=0;t--)this.step(s[t])}return this}split(t,e=1,r){return!function(t,e,r=1,i){let s=t.doc.resolve(e),o=n.FK.empty,l=n.FK.empty;for(let t=s.depth,e=s.depth-r,a=r-1;t>e;t--,a--){o=n.FK.from(s.node(t).copy(o));let e=i&&i[a];l=n.FK.from(e?e.type.create(e.attrs,l):s.node(t).copy(l))}t.step(new m(e,e,new n.Ji(o.append(l),r,r),!0))}(this,t,e,r),this}addMark(t,e,r){var n;let i,s,o,l;return n=this,o=[],l=[],n.doc.nodesBetween(t,e,(n,a,p)=>{if(!n.isInline)return;let h=n.marks;if(!r.isInSet(h)&&p.type.allowsMarkType(r.type)){let p=Math.max(a,t),d=Math.min(a+n.nodeSize,e),u=r.addToSet(h);for(let t=0;tn.step(t)),l.forEach(t=>n.step(t)),this}removeMark(t,e,r){var i;let s,o;return i=this,s=[],o=0,i.doc.nodesBetween(t,e,(i,l)=>{if(!i.isInline)return;o++;let a=null;if(r instanceof n.sX){let t=i.marks,e;for(;e=r.isInSet(t);)(a||(a=[])).push(e),t=e.removeFromSet(t)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let r=Math.min(l+i.nodeSize,e);for(let e=0;ei.step(new f(t.from,t.to,t.style))),this}clearIncompatible(t,e,r){return k(this,t,e,r),this}}}}]);