vendor: 5,717 bytes, line 1
1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`release-202609241050`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`d0fbf6a5-fc8c-462a-a4ea-18f1131e7f35`,e._sentryDebugIdIdentifier=`sentry-dbid-d0fbf6a5-fc8c-462a-a4ea-18f1131e7f35`)}catch{}})();import{t as e}from"./rolldown-runtime-BI-OUt3b.js";import{i as t,n,r,t as i}from"./vendor-prosemirror-core-kywG8WWu.js";import{o as a}from"./vendor-prosemirror-ext-DPWceSfN.js";var o=e(((e,o)=>{var s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.prototype.hasOwnProperty,d=(e,t)=>{for(var n in t)s(e,n,{get:t[n],enumerable:!0})},f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of l(t))!u.call(e,i)&&i!==n&&s(e,i,{get:()=>t[i],enumerable:!(r=c(t,i))||r.enumerable});return e},p=e=>f(s({},`__esModule`,{value:!0}),e),m={};d(m,{CellBookmark:()=>me,CellSelection:()=>M,ResizeState:()=>ct,TableMap:()=>x,TableView:()=>ot,__clipCells:()=>Ye,__insertCells:()=>G,__pastedCells:()=>qe,addColSpan:()=>j,addColumn:()=>F,addColumnAfter:()=>Oe,addColumnBefore:()=>De,addRow:()=>I,addRowAfter:()=>Ne,addRowBefore:()=>Me,cellAround:()=>w,cellNear:()=>le,colCount:()=>fe,columnIsHeader:()=>pe,columnResizing:()=>st,columnResizingPluginKey:()=>Q,deleteCellSelection:()=>H,deleteColumn:()=>Ae,deleteRow:()=>Pe,deleteTable:()=>Ge,findCell:()=>de,fixTables:()=>xe,fixTablesKey:()=>ye,goToNextCell:()=>We,handlePaste:()=>tt,inSameTable:()=>O,isInTable:()=>T,mergeCells:()=>Ie,moveCellForward:()=>ue,nextCell:()=>k,pointsAtCell:()=>D,removeColSpan:()=>A,removeColumn:()=>ke,removeRow:()=>L,rowIsHeader:()=>je,selectedRect:()=>P,selectionCell:()=>E,setCellAttr:()=>Re,splitCell:()=>Le,splitCellWithType:()=>z,tableEditing:()=>bt,tableEditingKey:()=>C,tableNodeTypes:()=>S,tableNodes:()=>se,toggleHeader:()=>V,toggleHeaderCell:()=>He,toggleHeaderColumn:()=>Ve,toggleHeaderRow:()=>Be,updateColumnsOnResize:()=>Z}),o.exports=p(m);var h=n(),g=t(),_=n(),v=i(),y,b;if(typeof WeakMap<`u`){let e=new WeakMap;y=t=>e.get(t),b=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;y=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},b=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var x=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return y(e)||b(e,ee(e))}};function ee(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=te(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}let s=new x(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&ne(s,o,e),s}function te(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function ne(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=re(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function re(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}var ie=n();function ae(e,t){if(typeof e==`string`)return{};let n=e.getAttribute(`data-colwidth`),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(`,`).map(e=>Number(e)):null,i=Number(e.getAttribute(`colspan`)||1),a={colspan:i,rowspan:Number(e.getAttribute(`rows
1pan`)||1),colwidth:r&&r.length==i?r:null};for(let n in t){let r=t[n].getFromDOM,i=r&&r(e);i!=null&&(a[n]=i)}return a}function oe(e,t){let n={};e.attrs.colspan!=1&&(n.colspan=e.attrs.colspan),e.attrs.rowspan!=1&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n[`data-colwidth`]=e.attrs.colwidth.join(`,`));for(let r in t){let i=t[r].setDOMAttr;i&&i(e.attrs[r],n)}return n}function se(e){let t=e.cellAttributes||{},n={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(let e in t)n[e]={default:t[e].default};return{table:{content:`table_row+`,tableRole:`table`,isolating:!0,group:e.tableGroup,parseDOM:[{tag:`table`}],toDOM(){return[`table`,[`tbody`,0]]}},table_row:{content:`(table_cell | table_header)*`,tableRole:`row`,parseDOM:[{tag:`tr`}],toDOM(){return[`tr`,0]}},table_cell:{content:e.cellContent,attrs:n,tableRole:`cell`,isolating:!0,parseDOM:[{tag:`td`,getAttrs:e=>ae(e,t)}],toDOM(e){return[`td`,oe(e,t),0]}},table_header:{content:e.cellContent,attrs:n,tableRole:`header_cell`,isolating:!0,parseDOM:[{tag:`th`,getAttrs:e=>ae(e,t)}],toDOM(e){return[`th`,oe(e,t),0]}}}}function S(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var C=new ie.PluginKey(`selectingCells`);function w(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function ce(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function T(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function E(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=w(t.$head)||le(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function le(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function D(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function ue(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function O(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function de(e){return x.get(e.node(-1)).findCell(e.pos-e.start(-1))}function fe(e){return x.get(e.node(-1)).colCount(e.pos-e.start(-1))}function k(e,t,n){let r=e.node(-1),i=x.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function A(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function j(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function pe(e,t,n){let r=S(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var M=class e extends _.Selection{constructor(e,t=e){let n=e.node(-1),r=x.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new _.SelectionRange(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(D(r)&&D(i)&&O(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return _.TextSelection.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=x.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=A(e,0,l)),u>0&&(e=A(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(g.Fragment.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new g.Slice(g.Fragment.from(o),1,1)}replace(e,t=g.Slice.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?g.Slice.empty:t)}let i=_.Selection.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new g.Slice(g.Fragment.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=x.get(t),r=this.$anchorCell.start(-1),i=n.cells
vendor: 8,655 bytes, line 1
1InRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=x.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=x.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=x.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new me(this.$anchorCell.pos,this.$headCell.pos)}};M.prototype.visible=!1,_.Selection.jsonID(`cell`,M);var me=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&O(t,n)?new M(t,n):_.Selection.near(n,1)}};function he(e){if(!(e.selection instanceof M))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(v.Decoration.node(n,n+e.nodeSize,{class:`selectedCell`}))}),v.DecorationSet.create(e.doc,t)}function ge({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function _e({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function ve(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof _.NodeSelection&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=M.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=M.rowSelection(e,e)}else if(!n){let e=x.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=M.create(i,t+1,n)}}else r instanceof _.TextSelection&&ge(r)?a=_.TextSelection.create(i,r.from):r instanceof _.TextSelection&&_e(r)&&(a=_.TextSelection.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var ye=new(n()).PluginKey(`fix-tables`);function be(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?be(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function xe(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=Se(e,t,r,n))};return t?t.doc!=e.doc&&be(t.doc,e.doc,0,r):e.doc.descendants(r),n}function Se(e,t,n,r){let i=x.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,A(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=S(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(ye,{fixTables:!0})}var Ce=a(),we=t(),N=n(),Te=t(),Ee=n();function P(e){let t=e.selection,n=E(e),r=n.node(-1),i=n.start(-1),a=x.get(r);return{...t instanceof M?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function F(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;pe(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,j(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?S(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function De(e,t){if(!T(e))return!1;if(t){let n=P(e);t(F(e.tr,n,n.left))}return!0}function Oe(e,t){if(!T(e))return!1;if(t){let n=P(e);t(F(e.tr,n,n.right))}return!0}function ke(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,A(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function Ae(e,t){if(!T(e))return!1;if(t){let n=P(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;ke(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=x.get(e)}t(r)}return!0}function je(e,t,n){let r=S(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function I(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;je(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?S(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,S(r.type.schema).row.create(null,o)),e}function Me(e,t){if(!T(e))return!1;if(t){let n=P(e);t(I(e.tr,n,n.top))}return!0}function Ne(e,t){if(!T(e))return!1;if(t){let n=P(e);t(I(e.tr,n,n.bottom))}return!0}function L(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function Pe(e,t){if(!T(e))return!1;if(t){let n=P(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;L(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=x.get(n.table)}t(r)}return!0}function R(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function Fe({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;
vendor: 11,140 bytes, line 1
1t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function Ie(e,t){let n=e.selection;if(!(n instanceof M)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=P(e),{map:i}=r;if(Fe(i,r))return!1;if(t){let n=e.tr,a={},o=Te.Fragment.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!(a[l]||!u))if(a[l]=!0,s==null)s=l,c=u;else{R(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...j(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size){let e=s+1+c.content.size,t=R(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new M(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function Le(e,t){let n=S(e.schema);return z(({node:e})=>n[e.type.spec.tableRole])(e,t)}function z(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof M){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=ce(r.$from),!i)return!1;a=w(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=P(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)r==l.left&&t==l.top||u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof M&&u.setSelection(new M(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function Re(e,t){return function(n,r){if(!T(n))return!1;let i=E(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof M?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function ze(e){return function(t,n){if(!T(t))return!1;if(n){let r=S(t.schema),i=P(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length==0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function B(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function V(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?ze(e):function(t,n){if(!T(t))return!1;if(n){let r=S(t.schema),i=P(t),a=t.tr,o=B(`row`,i,r),s=B(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}var Be=V(`row`,{useDeprecatedLogic:!0}),Ve=V(`column`,{useDeprecatedLogic:!0}),He=V(`cell`,{useDeprecatedLogic:!0});function Ue(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function We(e){return function(t,n){if(!T(t))return!1;let r=Ue(E(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(Ee.TextSelection.between(e,ue(e))).scrollIntoView())}return!0}}function Ge(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function H(e,t){let n=e.selection;if(!(n instanceof M))return!1;if(t){let r=e.tr,i=S(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new Te.Slice(i,0,0))}),r.docChanged&&t(r)}return!0}var U=t(),Ke=r();function qe(e){if(!e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=W(S(o).row,new U.Slice(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?W(S(o).row,new U.Slice(t,n,r)).content:t);else return null;return Je(o,s)}function Je(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(U.Fragment.empty),n[i]<r){let a=S(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(U.Fragment.from(o))}return{height:t.length,width:r,rows:t}}function W(e,t){let n=e.createAndFill();return new Ke.Transform(n).replace(0,n.content.size,t).doc}function Ye({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(A(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(U.Fragment.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(U.Fragment.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function Xe(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=S(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,U.Fragment.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function Ze(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function Qe(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,A(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(A(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function G(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=x.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=x.get(a),f=d.mapping.maps.length}Xe(d,o,a,n,l,u,f)&&p(),Ze(d,o,a,n,c,l,s,f)&&p(),Ze(d,o,a,n,c,l,u,f)&&p(),Qe(d,o,a,n,s,u,c,f)&&p(),Qe(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new U.Slice(i.rows[e-s],0,0))}p(),d.setSelection(new M(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var $e=(0,Ce.keydownHandler)({ArrowLeft:q(`horiz`,-1),ArrowRight:q(`horiz`,1),ArrowUp:q(`vert`,-1),ArrowDown:q(`vert`,1),"Shift-ArrowLeft":J(`horiz`,-1),"Shift-ArrowRight":J(`horiz`,1),"Shift-ArrowUp":J(`vert`,-1),"Shift-ArrowDown":J(`vert`,1),Backspace:H,"Mod-Backspace":H,Delete:H,"Mod-Delete":H});function K(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function q(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof M)return K(n,r,N.Selection.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=rt(i,e,t);if(o==null)return!1;if(e==`horiz`)return K(n,r,N.Selection.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=k(i,e,t),s;return s=a?N.Selection.near(a,1):t<0?N.Selection.near(n.doc.resolve(i.before(-1)),-1):N.Selection.near(n.doc.resolve(i.after(-1)),1),K(n,r,s)}}}function J(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof M)o=a;else{let r=rt(i,e,t);if(r==null)return!1;o=new M(n.doc.resolve(r))}let s=k(o.$headCell,e,t);return s?K(n,r,new M(o.$anchorCell,s)):!1}}function et(e,t){let n=e.state.doc,r=w(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new M(r))),!0):!1}function tt(e,t,n){if(!T(e.state))return!1;let r=qe(n),i=e.state.selection;if(i instanceof M){r||={width:1,height:1,rows:[we.Fragment.from(W(S(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=x.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=Ye(r,o.right-o.left,o.bottom-o.top),G(e.state,e.dispatch,a,o,r),!0}else if(r){let t=E(e.state),n=t.start(-1);return G(e.state,e.dispatch,n,x.get(t.node(-1)).findCell(t.pos-n),r),!0}else return!1}function nt(e,t){if(t.ctrlKey||t.metaKey)return;let n=it(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof M)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=w(e.state.selection.$anchor))!=null&&Y(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=Y(e,n),i=C.getState(e.state)==null;if(!r||!O(t,r))if(i)r=t;else return;let a=new M(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(C,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),C.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(C,-1))}function o(r){let o=r,s=C.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);
vendor: 5,066 bytes, line 1
1else if(it(e,o.target)!=n&&(c=Y(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function rt(e,t,n){if(!(e.state.selection instanceof N.TextSelection))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function it(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function Y(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?w(e.state.doc.resolve(n.pos)):null}var at=n(),X=i(),ot=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),Z(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,Z(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function Z(e,t,n,r,i,a){var o;let s=0,c=!0,l=t.firstChild,u=e.firstChild;if(u){for(let e=0,n=0;e<u.childCount;e++){let{colspan:o,colwidth:d}=u.child(e).attrs;for(let e=0;e<o;e++,n++){let o=i==n?a:d&&d[e],u=o?o+`px`:``;if(s+=o||r,o||(c=!1),l)l.style.width!=u&&(l.style.width=u),l=l.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;l;){let e=l.nextSibling;(o=l.parentNode)==null||o.removeChild(l),l=e}c?(n.style.width=s+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=s+`px`)}}var Q=new at.PluginKey(`tableColumnResizing`);function st({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=ot,lastColumnResizable:i=!0}={}){let a=new at.Plugin({key:Q,state:{init(e,t){let i=a.spec?.props?.nodeViews,o=S(t.schema).table.name;return r&&i&&(i[o]=(e,t)=>new r(e,n,t)),new ct(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=Q.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{lt(t,n,e,i)},mouseleave:e=>{ut(e)},mousedown:(e,r)=>{dt(e,r,t,n)}},decorations:e=>{let t=Q.getState(e);if(t&&t.activeHandle>-1)return yt(e,t.activeHandle)},nodeViews:{}}});return a}var ct=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(Q);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return D(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function lt(e,t,n,r){let i=Q.getState(e.state);if(i&&!i.dragging){let a=pt(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=mt(e,t,`left`,n):i-t.clientX<=n&&(o=mt(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=x.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}ht(e,o)}}}function ut(e){let t=Q.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&ht(e,-1)}function dt(e,t,n,r){let i=e.dom.ownerDocument.defaultView??window,a=Q.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=ft(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(Q,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=Q.getState(e.state);r?.dragging&&(gt(e,r.activeHandle,$(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(Q,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=Q.getState(e.state);if(i&&i.dragging){let a=$(i.dragging,t,n);_t(e,i.activeHandle,a,r)}}return _t(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function ft(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function pt(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function mt(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=w(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=x.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function $(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function ht(e,t){e.dispatch(e.state.tr.setMeta(Q,{setHandle:t}))}
1function gt(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=x.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():vt(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function _t(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=x.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&Z(a,c.firstChild,c,r,s,n)}function vt(e){return Array(e).fill(0)}function yt(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return X.DecorationSet.empty;let a=x.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,Q.getState(e)?.dragging&&n.push(X.Decoration.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(X.Decoration.widget(s,c))}}return X.DecorationSet.create(e.doc,n)}function bt({allowTableNodeSelection:e=!1}={}){return new h.Plugin({key:C,state:{init(){return null},apply(e,t){let n=e.getMeta(C);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:he,handleDOMEvents:{mousedown:nt},createSelectionBetween(e){return C.getState(e.state)==null?null:e.state.selection},handleTripleClick:et,handleKeyDown:$e,handlePaste:tt},appendTransaction(t,n,r){return ve(r,xe(r,n),e)}})}})),s=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var r=n(),i=t();o();var a=function(e,t){return function(n){Array.isArray(e)||(e=[e]);for(var r=0,i=e.length;r<i;r++){var a=te(e[r])(n.selection);if(a){var o=g(a.pos,t)(n);if(o!==n)return o}}return n}},s=function(e){return function(t){if(p(t.selection)){var n=t.selection,a=n.$from,o=n.$to;if(e instanceof i.Fragment&&a.parent.canReplace(a.index(),a.indexAfter(),e)||a.parent.canReplaceWith(a.index(),a.indexAfter(),e.type))return h(t.replaceWith(a.pos,o.pos,e).setSelection(new r.NodeSelection(t.doc.resolve(a.pos))))}return t}},c=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return function(n){var i=r.Selection.findFrom(n.doc.resolve(e),t,!0);return i?n.setSelection(i):n}},l=function(e){return e.type&&e.type.spec.selectable},u=function(e){return l(e)&&e.type.isLeaf},d=function(e,t,n){return u(e)?n.setSelection(new r.NodeSelection(n.doc.resolve(t))):c(t)(n)},f=function(e,t,n){return function(r){var i=typeof t==`number`,o=r.selection.$from,c=i?r.doc.resolve(t):p(r.selection)?r.doc.resolve(o.pos+1):o,u=c.parent;if(p(r.selection)&&n){var f=r;if(r=s(e)(r),f!==r)return r}if(y(u)){var m=r;if(r=a(u.type,e)(r),m!==r)return d(e,l(e)?c.before(c.depth):c.pos,r)}if(v(c,e))return r.insert(c.pos,e),h(d(e,i?c.pos:l(e)?r.selection.$anchor.pos-1:r.selection.$anchor.pos,r));for(var g=c.depth;g>0;g--){var _=c.after(g);if(v(r.doc.resolve(_),e))return r.insert(_,e),h(d(e,_,r))}return r}},p=function(e){return e instanceof r.NodeSelection},m=function(e,t){return Array.isArray(e)&&e.indexOf(t.type)>-1||t.type===e},h=function(e){return Object.assign(Object.create(e),e).setTime(Date.now())},g=function(e,t){return function(n){var r=n.doc.nodeAt(e);if(_(n.doc.resolve(e),t)){n=n.replaceWith(e,e+r.nodeSize,t);var i=n.selection.$from.pos-1;return n=c(Math.max(i,0),-1)(n),n=c(n.selection.$from.start())(n),h(n)}return n}},_=function(e,t){var n=e.node(e.depth);return n&&n.type.validContent(t instanceof i.Fragment?t:i.Fragment.from(t))},v=function(e,t){var n=e.index();return t instanceof i.Fragment?e.parent.canReplace(n,n,t):t instanceof i.Node?e.parent.canReplaceWith(n,n,t.type):!1},y=function(e){return!e||e.type.name===`paragraph`&&e.nodeSize===2},b=function(e){return function(t){var n=t.$from;return x(n,e)}},x=function(e,t){for(var n=e.depth;n>0;n--){var r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}},ee=function(e){return function(t){return!!b(e)(t)}},te=function(e){return function(t){return b(function(t){return m(e,t)})(t)}};e.hasParentNodeOfType=function(e){return function(t){return ee(function(t){return m(e,t)})(t)}},e.safeInsert=f}));export{s as t}; 2//# sourceMappingURL=vendor-prosemirror-schema-NOnBQyYH.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.