PageSourceSearch

https://static.cognitoforms.com/app/npm.prosemirror-transform1.10.4.aa40a19adb67d3c6.js

js cognitoforms.com collected 2026-09-24 07:20:48 UTC 30,371 bytes, 2 lines download raw bytes

1"use strict";(self.rspackChunkcognito_spa=self.rspackChunkcognito_spa||[]).push([[968],{11474(t,e,r){var n=r(58460);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;t<r;t++)e+=this.ranges[3*t+2]-this.ranges[3*t+1];return this.ranges[3*r]+e+(t-(65535&t))/65536}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,r){let n=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?n:0);if(a>t)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;e<this.ranges.length;e+=3){let o=this.ranges[e]-(this.inverted?r:0);if(o>t)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<this.ranges.length;n+=3){let s=this.ranges[n],o=s-(this.inverted?i:0),l=s+(this.inverted?0:i),a=this.ranges[n+e],p=this.ranges[n+r];t(o,o+a,l,l+p),i+=p-a}}invert(){return new s(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?s.empty:new s(t<0?[0,-t,0]:[0,0,t])}}s.empty=new s([]);class o{constructor(t,e,r=0,n=t?t.length:0){this.mirror=e,this.from=r,this.to=n,this._maps=t||[],this.ownData=!(t||e)}get maps(){return this._maps}slice(t=0,e=this.maps.length){return new o(this._maps,this.mirror,t,e)}appendMap(t,e){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),null!=e&&this.setMirror(this._maps.length-1,e)}appendMapping(t){for(let e=0,r=this._maps.length;e<t._maps.length;e++){let n=t.getMirror(e);this.appendMap(t._maps[e],null!=n&&n<e?r+n:void 0)}}getMirror(t){if(this.mirror){for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,r=this._maps.length+t._maps.length;e>=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;r<this.to;r++)t=this._maps[r].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,r){let n=0;for(let r=this.from;r<this.to;r++){let i=this._maps[r].mapResult(t,e);if(null!=i.recover){let e=this.getMirror(r);if(null!=e&&e>r&&e<this.to){r=e,t=this._maps[e].recover(i.recover);continue}}n|=i.delInfo,t=i.pos}return r?t:new i(t,n,null)}}let l=Object.create(null);class a{getMap(){return s.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw RangeError("Invalid input for Step.fromJSON");let r=l[e.stepType];if(!r)throw RangeError(`No step type ${e.stepType} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in l)throw RangeError("Duplicate use of step JSON ID "+t);return l[t]=e,e.prototype.jsonID=t,e}}class p{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new p(t,null)}static fail(t){return new p(null,t)}static fromReplace(t,e,r,i){try{return p.ok(t.replace(e,r,i))}catch(t){if(t instanceof n.vI)return p.fail(t.message);throw t}}}function h(t,e,r){let i=[];for(let n=0;n<t.childCount;n++){let s=t.child(n);s.content.size&&(s=s.copy(h(s.content,e,s))),s.isInline&&(s=e(s,r,n)),i.push(s)}return n.FK.fromArray(i)}class c 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=t.resolve(this.from),i=r.no
1de(r.sharedDepth(this.to)),s=new n.Ji(h(e.content,(t,e)=>t.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;r<e.marks.length;r++)if(!e.marks[r].isInSet(t))return new d(this.pos,e.marks[r]);return new d(this.pos,this.mark)}}return new u(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new d(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new d(e.pos,t.markFromJSON(e.mark))}}a.jsonID("addNodeMark",d);class u 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.removeFromSet(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);return e&&this.mark.isInSet(e.marks)?new d(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new u(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new u(e.pos,t.markFromJSON(e.mark))}}a.jsonID("removeNodeMark",u);class m extends a{constructor(t,e,r,n=!1){super(),this.from=t,this.to=e,this.slice=r,this.structure=n}apply(t){return this.structure&&y(t,this.from,this.to)?p.fail("Structure replace would overwrite content"):p.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new s([this.from,this.to-this.from,this.slice.size])}invert(t){return new m(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deletedAcross&&r.deletedAcross?null:new m(e.pos,Math.max(e.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof m)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart)if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;else{let e=this.slice.size+t.slice.size==0?n.Ji.empty:new n.Ji(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new m(t.from,this.to,e,this.structure)}{let e=this.slice.size+t.slice.size==0?n.Ji.empty:new n.Ji(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new m(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};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)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new m(e.from,e.to,n.Ji.fromJSON(t,e.slice),!!e.structure)}}a.jsonID("replace",m);class g extends a{constructor(t,e,r,n,i,s,o=!1){super(),this.from=t,this.to=e,this.gapFrom=r,this.gapTo=n,this.slice=i,this.insert=s,this.structure=o}apply(t){if(this.structure&&(y(t,this.from,this.gapFrom)||y(t,this.gapTo,this.to)))return p.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return p.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);
1return r?p.fromReplace(t,this.from,this.to,r):p.fail("Content does not fit in gap")}getMap(){return new s([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new g(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),n=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return e.deletedAcross&&r.deletedAcross||n<e.pos||i>r.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<o.childCount;e++){let p=o.child(e),h=a+p.nodeSize,c=i.matchType(p.type);if(c){i=c;for(let e=0;e<p.marks.length;e++)r.allowsMarkType(p.marks[e].type)||t.step(new f(a,h,p.marks[e]));if(s&&p.isText&&"pre"!=r.whitespace){let t,e=/\r?\n|\r/g,i;for(;t=e.exec(p.text);)i||(i=new n.Ji(n.FK.from(r.schema.text(" ",r.allowedMarks(p.marks))),0,0)),l.push(new m(a+t.index,a+t.index+t[0].length,i))}}else l.push(new m(a,h,n.Ji.empty));a=h}if(!i.validEnd){let e=i.fillBefore(n.FK.empty,!0);t.replace(a,a,new n.Ji(e,0,0))}for(let e=l.length-1;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<t.depth&&n.canReplace(i,s,e))return r;if(0==r||n.type.spec.isolating||!((0==i||n.canReplace(i,n.childCount))&&(s==n.childCount||n.canReplace(0,s))))break}return null}function v(t,e,r=null,n=t){let i=function(t,e){let{parent:r,startIndex:n,endIndex:i}=t,s=r.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return r.canReplaceWith(n,i,o)?s:null}(t,e),s=i&&function(t,e){let{parent:r,startIndex:n,endIndex:i}=t,s=r.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let t=n;l&&t<i;t++)l=l.matchType(r.child(t).type);return l&&l.validEnd?o:null}(n,e);return s?i.map(S).concat({type:e,attrs:r}).concat(s.map(S)):null}function S(t){return{type:t,attrs:null}}function M(t,e,r,n){e.forEach((i,s)=>{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 C(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 J(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 x(t,e){let r=t.resolve(e),n=r.index();
1return R(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function R(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;i<e.childCount;i++){let s=e.child(i),o=s.type==n?t.type.schema.nodes.text:s.type;if(!(r=r.matchType(o))||!t.type.allowsMarks(s.marks))return!1}return r.validEnd}(t,e))}function b(t,e,r=-1){let n=t.resolve(e);for(let t=n.depth;;t--){let i,s,o=n.index(t);if(t==n.depth?(i=n.nodeBefore,s=n.nodeAfter):r>0?(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&&R(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<r.openStart;t++)i=i.firstChild.content;for(let t=1;t<=(0==r.openStart&&r.size?2:1);t++)for(let e=n.depth;e>=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 T(s,o,i)?new m(e,r,i):new I(s,o,i).fit()}function T(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 I{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;r<t;r++){let i=e.firstChild;if(e.childCount>1&&(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=E(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=E(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=E(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;t<s.length;t++)this.openFrontierNode(s[t]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-t,p=0,h=[],{match:c,type:f}=this.frontier[e];if(i){for(let t=0;t<i.childCount;t++)h.push(i.child(t));c=c.matchFragment(i)}let d=l.size+t-(o.content.size-o.openEnd);for(;p<l.childCount;){let t=l.child(p),e=c.matchType(t.type);if(!e)break;(++p>1||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;
vendor: 4,143 bytes, line 1
1u||(d=-1),this.placed=O(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;t<d;t++){let t=e.lastChild;this.frontier.push({type:t.type,match:t.contentMatchAt(t.childCount)}),e=t.content}this.unplaced=u?0==t?n.Ji.empty:new n.Ji(A(o.content,t-1,1),t-1,d<0?o.openEnd:t-1):new n.Ji(A(o.content,t,p),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let t=this.frontier[this.depth],e;if(!t.type.isTextblock||!z(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return -1;let{depth:r}=this.$to,n=this.$to.after(r);for(;r>1&&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<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=z(t,e,n,r,i);if(s){for(let r=e-1;r>=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=O(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=O(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=O(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 O(t,e,r){return 0==e?t.append(r):t.replaceChild(t.childCount-1,t.lastChild.copy(O(t.lastChild.content,e-1,r)))}function E(t,e){for(let r=0;r<e;r++)t=t.firstChild.content;return t}function z(t,e,r,n,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!r.compatibleContent(s.type))return null;let l=n.fillBefore(s.content,!0,o);return l&&!function(t,e,r){for(let n=r;n<e.childCount;n++)if(!t.allowsMarks(e.child(n).marks))return!0;return!1}(r,s.content,o)?l:null}function K(t,e){let r=[],n=Math.min(t.depth,e.depth);for(let i=n;i>=0;i--){let n=t.start(i);if(n<t.pos-(t.depth-i)||e.end(i)>e.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 _ 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 _(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 _(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 _(e.pos,e.attr,e.value)}}a.jsonID("attr",_);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);
1let $=class extends Error{};($=function t(e){let r=Error.call(this,e);return r.__proto__=t.prototype,r}).prototype=Object.create(Error.prototype),$.prototype.constructor=$,$.prototype.name="TransformError";class W{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 $(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(T(s,o,i))return t.step(new m(e,r,i));let l=K(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;e<l.length;e++){let h=l[(e+p)%l.length],c=!0;h<0&&(c=!1,h=-h);let d=s.node(h-1),u=s.index(h-1);if(d.canReplaceWith(u,u,f.type,f.marks))return t.replace(s.before(h),c?o.after(h):r,new n.Ji(function t(e,r,i,s,o){if(r<i){let n=e.firstChild;e=e.replaceChild(0,n.copy(t(n.content,r+1,i,s,n)))}if(r>s){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(e<n.node(t).childCount)break}return null}(this.doc,i,r.type);null!=t&&(i=s=t)}return this.replaceRange(i,s,new n.Ji(n.FK.from(r),0,0)),this}deleteRange(t,e){return!function(t,e,r){let n=t.doc.resolve(e),i=t.doc.resolve(r),s=K(n,i);for(let e=0;e<s.length;e++){let r=s[e],o=e==s.length-1;if(o&&0==r||n.node(r).type.contentMatch.validEnd)return t.delete(n.start(r),i.end(r));if(r>0&&(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)<s.end(t)?(e=!0,d=n.FK.from(s.node(t).copy(d)),u++):h++;t.step(new g(p,h,l,a,new n.Ji(c.append(d),f,u),c.size-f,!0))}(this,t,e),this}join(t,e=1){return!function(t,e,r){let i=null,{linebreakReplacement:s}=t.doc.type.schema,o=t.doc.resolve(e-r),l=o.node().type;if(s&&l.inlineContent){let t="pre"==l.whitespace,e=!!l.contentMatch.matchType(s);t&&!e?i=!1:!t&&e&&(i=!0)}let a=t.steps.length;if(!1===i){let n=t.doc.resolve(e+r);C(t,n.node(),n.before(),a)}l.inlineContent&&k(t,e+r-1,l,o.node().contentMatchAt(o.index()),null==i);let p=t.mapping.slice(a),h=p.map(e-r);if(t.step(new m(h,p.map(e+r,-1),n.Ji.empty,!0)),!0===i){let e=t.doc.resolve(h);M(t,e.node(),e.before(),t.steps.length)}}(this,t,e),this}wrap(t,e){return!function(t,e,r){let i=n.FK.empty;for(let t=r.length-1;t>=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))
1){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&&C(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&&M(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 _(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;t<h.length;t++)h[t].isInSet(u)||(i&&i.to==p&&i.mark.eq(h[t])?i.to=d:o.push(i=new f(p,d,h[t])));s&&s.to==p?s.to=d:l.push(s=new c(p,d,r))}}),o.forEach(t=>n.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;e<a.length;e++){let n=a[e],i;for(let t=0;t<s.length;t++){let e=s[t];e.step==o-1&&n.eq(s[t].style)&&(i=e)}i?(i.to=r,i.step=o):s.push({style:n,from:Math.max(l,t),to:r,step:o})}}}),s.forEach(t=>i.step(new f(t.from,t.to,t.style))),this}clearIncompatible(t,e,r){return k(this,t,e,r),this}}r.d(e,{$L:()=>F,Ln:()=>m,N0:()=>b,Um:()=>N,Wg:()=>g,X9:()=>o,dL:()=>W,jP:()=>w,n9:()=>x,oM:()=>v,zy:()=>J})}}]);
2//# sourceMappingURL=npm.prosemirror-transform1.10.4.aa40a19adb67d3c6.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.