quill-table-up 2.3.1 → 2.4.1
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.
- package/README.md +1 -0
- package/dist/index.d.ts +35 -12
- package/dist/index.js +26 -25
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +35 -31
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/e2e/table-blots.test.ts +22 -0
- package/src/__tests__/e2e/table-keyboard-handler.test.ts +218 -0
- package/src/__tests__/e2e/table-selection.test.ts +137 -131
- package/src/__tests__/unit/table-cell-merge.test.ts +261 -1
- package/src/__tests__/unit/table-clipboard.test.ts +62 -44
- package/src/__tests__/unit/table-insert.test.ts +39 -2
- package/src/__tests__/unit/table-redo-undo.test.ts +69 -0
- package/src/__tests__/unit/table-remove.test.ts +4 -2
- package/src/__tests__/unit/utils.ts +22 -4
- package/src/__tests__/unit/vitest.d.ts +4 -1
- package/src/formats/index.ts +6 -0
- package/src/formats/overrides/block-embed.ts +54 -0
- package/src/formats/overrides/block.ts +23 -4
- package/src/formats/overrides/index.ts +1 -0
- package/src/formats/table-cell-format.ts +39 -6
- package/src/formats/table-cell-inner-format.ts +70 -21
- package/src/formats/table-main-format.ts +92 -1
- package/src/formats/table-row-format.ts +13 -2
- package/src/modules/table-clipboard.ts +30 -35
- package/src/modules/table-resize/table-resize-box.ts +2 -2
- package/src/modules/table-resize/table-resize-common.ts +3 -5
- package/src/modules/table-resize/table-resize-line.ts +1 -1
- package/src/modules/table-resize/table-resize-scale.ts +1 -1
- package/src/modules/table-scrollbar.ts +9 -10
- package/src/modules/table-selection.ts +52 -31
- package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/src/table-up.ts +57 -23
- package/src/utils/blot-helper.ts +7 -4
- package/src/utils/index.ts +1 -1
- package/src/utils/{scroll-event-handle.ts → scroll-event-helper.ts} +7 -0
- package/src/utils/types.ts +2 -0
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`quill`)):typeof define==`function`&&define.amd?define([`exports`,`quill`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.TableUp={},e.Quill))})(this,function(exports,t){Object.defineProperty(exports,`__esModule`,{value:!0});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},l=(e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e));t=l(t);let u={container:`table-up-container`,tableCaption:`table-up-caption`,tableWrapper:`table-up`,tableMain:`table-up-main`,tableColgroup:`table-up-colgroup`,tableCol:`table-up-col`,tableBody:`table-up-body`,tableRow:`table-up-row`,tableCell:`table-up-cell`,tableCellInner:`table-up-cell-inner`},d={colMinWidthPre:5,colMinWidthPx:40,colDefaultWidth:100,rowMinHeightPx:36},f={AFTER_TABLE_RESIZE:`after-table-resize`},p={moduleName:`table-up`},m=[[`rgb(255, 255, 255)`,`rgb(0, 0, 0)`,`rgb(72, 83, 104)`,`rgb(41, 114, 244)`,`rgb(0, 163, 245)`,`rgb(49, 155, 98)`,`rgb(222, 60, 54)`,`rgb(248, 136, 37)`,`rgb(245, 196, 0)`,`rgb(153, 56, 215)`],[`rgb(242, 242, 242)`,`rgb(127, 127, 127)`,`rgb(243, 245, 247)`,`rgb(229, 239, 255)`,`rgb(229, 246, 255)`,`rgb(234, 250, 241)`,`rgb(254, 233, 232)`,`rgb(254, 243, 235)`,`rgb(254, 249, 227)`,`rgb(253, 235, 255)`],[`rgb(216, 216, 216)`,`rgb(89, 89, 89)`,`rgb(197, 202, 211)`,`rgb(199, 220, 255)`,`rgb(199, 236, 255)`,`rgb(195, 234, 213)`,`rgb(255, 201, 199)`,`rgb(255, 220, 196)`,`rgb(255, 238, 173)`,`rgb(242, 199, 255)`],[`rgb(191, 191, 191)`,`rgb(63, 63, 63)`,`rgb(128, 139, 158)`,`rgb(153, 190, 255)`,`rgb(153, 221, 255)`,`rgb(152, 215, 182)`,`rgb(255, 156, 153)`,`rgb(255, 186, 132)`,`rgb(255, 226, 112)`,`rgb(213, 142, 255)`],[`rgb(165, 165, 165)`,`rgb(38, 38, 38)`,`rgb(53, 59, 69)`,`rgb(20, 80, 184)`,`rgb(18, 116, 165)`,`rgb(39, 124, 79)`,`rgb(158, 30, 26)`,`rgb(184, 96, 20)`,`rgb(163, 130, 0)`,`rgb(94, 34, 129)`],[`rgb(147, 147, 147)`,`rgb(13, 13, 13)`,`rgb(36, 39, 46)`,`rgb(12, 48, 110)`,`rgb(10, 65, 92)`,`rgb(24, 78, 50)`,`rgb(88, 17, 14)`,`rgb(92, 48, 10)`,`rgb(102, 82, 0)`,`rgb(59, 21, 81)`]],h=`table-up`,g=new Set([u.tableCellInner]),_=e=>g.has(e.statics.blotName);function v(e){return e&&e.parent?_(e.parent)?!0:v(e.parent):!1}function y(e,t=h){let n=t?`${t}-`:``;return{b:()=>`${n}${e}`,be:t=>t?`${n}${e}__${t}`:``,bm:t=>t?`${n}${e}--${t}`:``,bem:(t,r)=>t&&r?`${n}${e}__${t}--${r}`:``,ns:e=>e?`${n}${e}`:``,bs:t=>t?`${n}${e}-${t}`:``,cv:e=>e?`--${n}${e}`:``,is:e=>`is-${e}`}}function b(e,t){let n=e.parent;for(;n&&n.statics.blotName!==t&&n!==e.scroll;)n=n.parent;if(n===e.scroll)throw Error(`${e.statics.blotName} must be a child of ${t}`);return n}function x(e,t){let n=Array(t.length),r=new Map(t.map((e,t)=>[e,t])),i=e.parent;for(;i&&i!==e.scroll&&r.size!==0;){if(r.has(i.statics.blotName)){let e=r.get(i.statics.blotName);n[e]=i,r.delete(i.statics.blotName)}i=i.parent}if(r.size>0)throw Error(`${e.statics.blotName} must be a child of ${Array.from(r.keys()).join(`, `)}`);return n}function S(e){let t=new Map,n=e;for(;n&&n.statics.blotName!==`scroll`;)t.set(n.statics.blotName,n),n=n.parent;return t}function C(e,t){let n=[],r=e.children.iterator(),i=null;for(;i=r();)i instanceof t&&n.push(i);return n}function ee(e,t){for(let n of Object.getOwnPropertyNames(t)){if(/^constructor$/.test(n))continue;Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}return e}function te(e,t){let n=class extends e{constructor(...e){super(...e)}};for(let e of t)ee(n.prototype,e.prototype);return n}function w(e,t){return e=Math.min(t,Math.max(0,Number.parseFloat(`${e}`))),Math.abs(e-t)<1e-6?1:e%t/Number.parseFloat(t)}function T(e){return{h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b)),a:Math.min(1,Math.max(0,e.a))}}function ne(e){e=e.startsWith(`#`)?e.slice(1):e;let t=Number.parseInt(e.slice(0,2),16),n=Number.parseInt(e.slice(2,4),16),r=Number.parseInt(e.slice(4,6),16),i=Number((Number.parseInt(e.slice(6,8)||`ff`,16)/255).toFixed(2));return{r:t,g:n,b:r,a:i}}function re(e){let{r:t,g:n,b:r,a:i}=e;t=w(t,255),n=w(n,255),r=w(r,255);let a=Math.max(t,n,r),o=Math.min(t,n,r),s,c=a,l=a-o,u=a===0?0:l/a;if(a===o)s=0;else{switch(a){case t:s=(n-r)/l+(n<r?6:0);break;case n:s=(r-t)/l+2;break;case r:s=(t-n)/l+4;break}s/=6}return{h:s*360,s:u*100,b:c*100,a:i}}function ie(e){let{h:t,s:n,b:r,a:i}=e;t=w(t,360)*6,n=w(n,100),r=w(r,100);let a=Math.floor(t),o=t-a,s=r*(1-n),c=r*(1-o*n),l=r*(1-(1-o)*n),u=a%6,d=[r,c,s,s,l,r][u],f=[l,r,r,c,s,s][u],p=[s,s,l,r,r,c][u];return{r:Math.round(d*255),g:Math.round(f*255),b:Math.round(p*255),a:i}}function ae(e){let t=[e.r.toString(16),e.g.toString(16),e.b.toString(16),Math.round(e.a*255).toString(16)];for(let e in t)t[e].length===1&&(t[e]=`0${t[e]}`);return t.join(``)}let oe=e=>ae(ie(e)),se=e=>typeof e==`function`,ce=Array.isArray,le=e=>typeof e==`string`,ue=e=>typeof e==`number`,de=e=>typeof e==`object`&&!!e,fe=e=>!Number.isNaN(e)&&Number(e)>0;function pe(e){let{type:t=`default`,content:n}=e||{},r=y(`button`),i=document.createElement(`button`);return i.classList.add(r.b(),t),n&&(le(n)?i.textContent=n:i.appendChild(n)),i}function me(e={}){let t=230,n=150,r=10,i=re(ne(e.color||`#ff0000`)),a=y(`color-picker`),o=document.createElement(`div`);o.classList.add(a.b());let s=document.createElement(`div`);s.classList.add(a.be(`content`));let c=document.createElement(`div`);c.classList.add(a.be(`selector`));let l=document.createElement(`div`);l.classList.add(a.be(`background`)),c.appendChild(l);let u=document.createElement(`div`);u.classList.add(a.be(`background-handle`)),l.appendChild(u);let d=document.createElement(`div`);d.classList.add(a.be(`alpha`));let f=document.createElement(`div`);f.classList.add(a.be(`alpha-bg`));let p=document.createElement(`div`);p.classList.add(a.be(`alpha-handle`)),d.appendChild(f),d.appendChild(p);let m=document.createElement(`div`);m.classList.add(a.be(`hue`));let h=document.createElement(`div`);h.classList.add(a.be(`hue-handle`)),m.appendChild(h);let g=document.createElement(`div`);g.classList.add(a.be(`action`));let[_,v,b,x]=[`r`,`g`,`b`,`a`].map(e=>{let t=document.createElement(`div`);t.classList.add(a.be(`action-item`),e);let n=document.createElement(`label`);n.textContent=e.toUpperCase();let r=document.createElement(`input`);return r.classList.add(a.be(`input`)),r.addEventListener(`input`,()=>{r.value=r.value.replaceAll(/[^0-9]/g,``)}),r.addEventListener(`change`,()=>{let t=Math.round(Number(r.value));e===`a`&&(t/=100);let n=T(re(Object.assign({},ie(i),{[e]:t})));fe(n),de()}),t.appendChild(n),t.appendChild(r),g.appendChild(t),r});s.appendChild(m),s.appendChild(c),s.appendChild(d),o.appendChild(s),o.appendChild(g);let S=!1,C=!1,ee=!1;function te(){let e=oe(i);for(let[t,n]of[_,v,b].entries())n.value=String(Number.parseInt(e[t*2]+e[t*2+1],16));x.value=String((i.a*100).toFixed(0))}function w(){Object.assign(u.style,{left:`${Math.floor(t*i.s/100)}px`,top:`${Math.floor(n*(100-i.b)/100)}px`})}function se(){c.style.backgroundColor=`#${ae(ie({h:i.h,s:100,b:100,a:1}))}`}function ce(){h.style.top=`${Math.floor(n-n*i.h/360)}px`}function le(){p.style.left=`${i.a*100}%`}function ue(){let{r:e,g:t,b:n}=ie(i);f.style.background=`linear-gradient(to right, rgba(${e}, ${t}, ${n}, 0) 0%, rgba(${e}, ${t}, ${n}, 1) 100%)`}function de(){w(),se(),ce(),le(),ue(),te()}function fe(t){i=T(Object.assign({},i,t)),te(),e.onChange&&e.onChange(`#${oe(i)}`)}function pe(e){let r=c.getBoundingClientRect(),i=r.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),a=r.left+document.body.scrollLeft,o=Math.floor(100*Math.max(0,Math.min(t,e.pageX-a))/t),s=Math.floor(100*(n-Math.max(0,Math.min(n,e.pageY-i)))/n);fe({s:o,b:s}),de()}function me(e){let t=m.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);fe({h:Math.floor(360*(n-Math.max(0,Math.min(n,e.pageY-t)))/n)}),de()}function he(e){let{pageX:t}=e,n=d.getBoundingClientRect(),i=t-n.left;i=Math.max(r/2,i),i=Math.min(i,n.width-r/2),fe({a:Math.round((i-10/2)/(n.width-10)*100)/100}),de()}function E(e){S&&(e.preventDefault(),pe(e)),C&&(e.preventDefault(),me(e)),ee&&(e.preventDefault(),he(e))}function ge(){document.removeEventListener(`mousemove`,E),document.removeEventListener(`mouseup`,ge),S=!1}function _e(e){document.addEventListener(`mousemove`,E),document.addEventListener(`mouseup`,ge),S=!0,pe(e)}c.addEventListener(`mousedown`,_e);function D(){document.removeEventListener(`mousemove`,E),document.removeEventListener(`mouseup`,D),C=!1}function ve(e){document.addEventListener(`mousemove`,E),document.addEventListener(`mouseup`,D),C=!0,me(e)}m.addEventListener(`mousedown`,ve);function ye(){document.removeEventListener(`mousemove`,E),document.removeEventListener(`mouseup`,ye),ee=!1}function be(e){document.addEventListener(`mousemove`,E),document.addEventListener(`mouseup`,ye),ee=!0,he(e)}return d.addEventListener(`mousedown`,be),de(),o}let he=8e3;function E({child:e,target:t=document.body,beforeClose:n=()=>{}}={}){let r=y(`dialog`),i=t,a=document.createElement(`div`);a.classList.add(r.b()),a.style.zIndex=String(he);let o=document.createElement(`div`);if(o.classList.add(r.be(`overlay`)),a.appendChild(o),e){let t=document.createElement(`div`);t.classList.add(r.be(`content`)),t.appendChild(e),o.appendChild(t),t.addEventListener(`click`,e=>{e.stopPropagation()})}let s=getComputedStyle(i).overflow;i.style.overflow=`hidden`,i.appendChild(a);let c=()=>{n(),a.remove(),i.style.overflow=s};return a.addEventListener(`click`,c),he+=1,{dialog:a,close:c}}function ge(e,t){let n=y(`input`);t.type||(t.type=`text`),t.value||(t.value=``);let r=document.createElement(`div`);if(r.classList.add(n.be(`item`)),e){let t=document.createElement(`span`);t.classList.add(n.be(`label`)),t.textContent=e,r.appendChild(t)}let i=document.createElement(`div`);i.classList.add(n.be(`input`));let a=document.createElement(`input`);for(let e in t)a.setAttribute(e,t[e]);(t.max||t.min)&&a.addEventListener(`blur`,()=>{t.max&&t.max<=Number(a.value)&&(a.value=String(t.max)),t.min&&t.min>=Number(a.value)&&(a.value=String(t.min))}),i.appendChild(a),r.appendChild(i),a.addEventListener(`focus`,()=>{i.classList.add(`focus`)}),a.addEventListener(`blur`,()=>{i.classList.remove(`focus`)});let o=e=>{let t;i.classList.contains(`error`)?t=i.querySelector(`.${n.be(`error-tip`)}`):(t=document.createElement(`span`),t.classList.add(n.be(`error-tip`)),i.appendChild(t)),t.textContent=e,i.classList.add(`error`);let r=()=>{i.classList.remove(`error`),t.remove()};return{removeError:r}};return{item:r,input:a,errorTip:o}}function _e(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function D(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){_e(a,r,i,o,s,`next`,e)}function s(e){_e(a,r,i,o,s,`throw`,e)}o(void 0)})}}function ve(){return ye.apply(this,arguments)}function ye(){return ye=D(function*(e={}){let t=y(`creator`),n=document.createElement(`div`);n.classList.add(t.b());let r=document.createElement(`div`);r.classList.add(t.be(`input`));let{item:i,input:a,errorTip:o}=ge(e.rowText||`Row`,{type:`number`,value:String(e.row||``),max:99}),{item:s,input:c,errorTip:l}=ge(e.colText||`Column`,{type:`number`,value:String(e.col||``),max:99});r.appendChild(i),r.appendChild(s),n.appendChild(r);let u=document.createElement(`div`);u.classList.add(t.be(`control`));let d=pe({type:`confirm`,content:e.confirmText||`Confirm`}),f=pe({type:`default`,content:e.cancelText||`Cancel`});u.appendChild(d),u.appendChild(f),n.appendChild(u);let p=(t=Number(a.value),n=Number(c.value))=>{if(Number.isNaN(t)||t<=0){o(e.notPositiveNumberError||`Please enter a positive integer`);return}if(Number.isNaN(n)||n<=0){l(e.notPositiveNumberError||`Please enter a positive integer`);return}return{row:t,col:n}},m=e=>{e.key===`Escape`&&(close(),document.removeEventListener(`keydown`,m))};return new Promise((e,t)=>{let{close:r}=E({child:n,beforeClose:t});a.focus();for(let t of[a,c])t.addEventListener(`keydown`,t=>{if(t.key===`Enter`){let t=p();t&&(e(t),r())}});d.addEventListener(`click`,D(function*(){let t=p();t&&(e(t),r())})),document.addEventListener(`keydown`,m),f.addEventListener(`click`,r)})}),ye.apply(this,arguments)}function be(e={}){let t=y(`select-box`),n=document.createElement(`div`);n.classList.add(t.b());let r=document.createElement(`div`);r.classList.add(t.be(`block`));for(let n=0;n<(e.row||8);n++)for(let i=0;i<(e.col||8);i++){let e=document.createElement(`div`);e.classList.add(t.be(`item`)),e.dataset.row=String(n+1),e.dataset.col=String(i+1),r.appendChild(e)}let i=()=>{let{row:e,col:t}=n.dataset;for(let e of Array.from(r.querySelectorAll(`.active`)))e.classList.remove(`active`);if(!e||!t)return;let i=Array.from(r.children);for(let n=0;n<i.length;n++){let{row:r,col:a}=i[n].dataset;if(r>e&&a>t)return;r<=e&&a<=t?i[n].classList.add(`active`):i[n].classList.remove(`active`)}};if(r.addEventListener(`mousemove`,e=>{if(!e.target)return;let{row:t,col:r}=e.target.dataset;!t||!r||(n.dataset.row=t,n.dataset.col=r,i())}),r.addEventListener(`mouseleave`,()=>{n.removeAttribute(`data-row`),n.removeAttribute(`data-col`),i()}),r.addEventListener(`click`,()=>{let{row:t,col:r}=n.dataset;!t||!r||e.onSelect&&e.onSelect(Number(t),Number(r))}),n.appendChild(r),e.customBtn){let r=e.texts||{},i=document.createElement(`div`);i.classList.add(t.be(`custom`)),i.textContent=r.customBtnText||`Custom`,i.addEventListener(`click`,D(function*(){let t=yield ve(r);t&&e.onSelect&&e.onSelect(t.row,t.col)})),n.appendChild(i)}return n}function xe(e){"@babel/helpers - typeof";return xe=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},xe(e)}function Se(e,t){if(xe(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(xe(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ce(e){var t=Se(e,`string`);return xe(t)==`symbol`?t:t+``}function O(e,t,n){return(t=Ce(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?we(Object(n),!0).forEach(function(t){O(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let Te=Math.min,Ee=Math.max,De=Math.round,Oe=Math.floor,A=e=>({x:e,y:e}),ke={left:`right`,right:`left`,bottom:`top`,top:`bottom`},Ae={start:`end`,end:`start`};function je(e,t,n){return Ee(e,Te(t,n))}function Me(e,t){return typeof e==`function`?e(t):e}function j(e){return e.split(`-`)[0]}function Ne(e){return e.split(`-`)[1]}function Pe(e){return e===`x`?`y`:`x`}function Fe(e){return e===`y`?`height`:`width`}function M(e){return[`top`,`bottom`].includes(j(e))?`y`:`x`}function Ie(e){return Pe(M(e))}function Le(e,t,n){n===void 0&&(n=!1);let r=Ne(e),i=Ie(e),a=Fe(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=He(o)),[o,He(o)]}function Re(e){let t=He(e);return[ze(e),t,ze(t)]}function ze(e){return e.replace(/start|end/g,e=>Ae[e])}function Be(e,t,n){let r=[`left`,`right`],i=[`right`,`left`],a=[`top`,`bottom`],o=[`bottom`,`top`];switch(e){case`top`:case`bottom`:return n?t?i:r:t?r:i;case`left`:case`right`:return t?a:o;default:return[]}}function Ve(e,t,n,r){let i=Ne(e),a=Be(j(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ze)))),a}function He(e){return e.replace(/left|right|bottom|top/g,e=>ke[e])}function Ue(e){return k({top:0,right:0,bottom:0,left:0},e)}function We(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ue(e)}function Ge(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ke(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function N(e,t){if(e==null)return{};var n,r,i=Ke(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}let qe=[`crossAxis`,`alignment`,`allowedPlacements`,`autoAlignment`],Je=[`mainAxis`,`crossAxis`,`fallbackPlacements`,`fallbackStrategy`,`fallbackAxisSideDirection`,`flipAlignment`],Ye=[`strategy`],Xe=[`mainAxis`,`crossAxis`,`limiter`],Ze=[`apply`];function Qe(e,t,n){let{reference:r,floating:i}=e,a=M(t),o=Ie(t),s=Fe(o),c=j(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Ne(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}let $e=function(){var e=D(function*(e,t,n){let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=yield o.isRTL==null?void 0:o.isRTL(t),l=yield o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Qe(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=yield h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g==null?u:g,d=_==null?d:_,p=k(k({},p),{},{[a]:k(k({},p[a]),v)}),y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?yield o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Qe(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}});return function(t,n,r){return e.apply(this,arguments)}}();function et(e,t){return tt.apply(this,arguments)}function tt(){return tt=D(function*(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=Me(t,e),m=We(p),h=d===`floating`?`reference`:`floating`,g=s[f?h:d],_=Ge(yield a.getClippingRect({element:(n=yield a.isElement==null?void 0:a.isElement(g))==null||n?g:g.contextElement||(yield a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),v=d===`floating`?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,y=yield a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating),b=(yield a.isElement==null?void 0:a.isElement(y))&&(yield a.getScale==null?void 0:a.getScale(y))||{x:1,y:1},x=Ge(a.convertOffsetParentRelativeRectToViewportRelativeRect?yield a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:c}):v);return{top:(_.top-x.top+m.top)/b.y,bottom:(x.bottom-_.bottom+m.bottom)/b.y,left:(_.left-x.left+m.left)/b.x,right:(x.right-_.right+m.right)/b.x}}),tt.apply(this,arguments)}let nt=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,fn(t){return D(function*(){var n,r;let{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=t,u=Me(e,t),{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m=`bestFit`,fallbackAxisSideDirection:h=`none`,flipAlignment:g=!0}=u,_=N(u,Je);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let v=j(i),y=M(s),b=j(s)===s,x=yield c.isRTL==null?void 0:c.isRTL(l.floating),S=p||(b||!g?[He(s)]:Re(s)),C=h!==`none`;!p&&C&&S.push(...Ve(s,g,h,x));let ee=[s,...S],te=yield et(t,_),w=[],T=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&w.push(te[v]),f){let e=Le(i,o,x);w.push(te[e[0]],te[e[1]])}if(T=[...T,{placement:i,overflows:w}],!w.every(e=>e<=0)){var ne,re;let e=(((ne=a.flip)==null?void 0:ne.index)||0)+1,t=ee[e];if(t){let n=f===`alignment`?y!==M(t):!1;if(!n||T.every(e=>e.overflows[0]>0&&M(e.placement)===y))return{data:{index:e,overflows:T},reset:{placement:t}}}let n=(re=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])==null?void 0:re.placement;if(!n)switch(m){case`bestFit`:{var ie;let e=(ie=T.filter(e=>{if(C){let t=M(e.placement);return t===y||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])==null?void 0:ie[0];e&&(n=e);break}case`initialPlacement`:n=s;break}if(i!==n)return{reset:{placement:n}}}return{}})()}}};function rt(e,t){return it.apply(this,arguments)}function it(){return it=D(function*(e,t){let{placement:n,platform:r,elements:i}=e,a=yield r.isRTL==null?void 0:r.isRTL(i.floating),o=j(n),s=Ne(n),c=M(n)===`y`,l=[`left`,`top`].includes(o)?-1:1,u=a&&c?-1:1,d=Me(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}),it.apply(this,arguments)}let at=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,fn(t){return D(function*(){var n,r;let{x:i,y:a,placement:o,middlewareData:s}=t,c=yield rt(t,e);return o===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:k(k({},c),{},{placement:o})}})()}}},ot=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,fn(t){return D(function*(){let{x:n,y:r,placement:i}=t,a=Me(e,t),{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}}}=a,l=N(a,Xe),u={x:n,y:r},d=yield et(t,l),f=M(j(i)),p=Pe(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=je(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=je(n,h,r)}let g=c.fn(k(k({},t),{},{[p]:m,[f]:h}));return k(k({},g),{},{data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}})})()}}},st=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Me(e,t),u={x:n,y:r},d=M(i),f=Pe(d),p=u[f],m=u[d],h=Me(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:k({mainAxis:0,crossAxis:0},h);if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){var _,v;let e=f===`y`?`width`:`height`,t=[`top`,`left`].includes(j(i)),n=a.reference[d]-a.floating[e]+(t&&((_=o.offset)==null?void 0:_[d])||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:((v=o.offset)==null?void 0:v[d])||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}};function ct(){return typeof window<`u`}function lt(e){return ut(e)?(e.nodeName||``).toLowerCase():`#document`}function P(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function F(e){var t;return(t=(ut(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ut(e){return ct()?e instanceof Node||e instanceof P(e).Node:!1}function I(e){return ct()?e instanceof Element||e instanceof P(e).Element:!1}function L(e){return ct()?e instanceof HTMLElement||e instanceof P(e).HTMLElement:!1}function dt(e){return!ct()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof P(e).ShadowRoot}function ft(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=R(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&![`inline`,`contents`].includes(i)}function pt(e){return[`table`,`td`,`th`].includes(lt(e))}function mt(e){return[`:popover-open`,`:modal`].some(t=>{try{return e.matches(t)}catch(e){return!1}})}function ht(e){let t=_t(),n=I(e)?R(e):e;return[`transform`,`translate`,`scale`,`rotate`,`perspective`].some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`].some(e=>(n.willChange||``).includes(e))||[`paint`,`layout`,`strict`,`content`].some(e=>(n.contain||``).includes(e))}function gt(e){let t=z(e);for(;L(t)&&!vt(t);){if(ht(t))return t;if(mt(t))return null;t=z(t)}return null}function _t(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}function vt(e){return[`html`,`body`,`#document`].includes(lt(e))}function R(e){return P(e).getComputedStyle(e)}function yt(e){return I(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function z(e){if(lt(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||dt(e)&&e.host||F(e);return dt(t)?t.host:t}function bt(e){let t=z(e);return vt(t)?e.ownerDocument?e.ownerDocument.body:e.body:L(t)&&ft(t)?t:bt(t)}function xt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let i=bt(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=P(i);if(a){let e=St(o);return t.concat(o,o.visualViewport||[],ft(i)?i:[],e&&n?xt(e):[])}return t.concat(i,xt(i,[],n))}function St(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ct(e){let t=R(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=L(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=De(n)!==a||De(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function wt(e){return I(e)?e:e.contextElement}function Tt(e){let t=wt(e);if(!L(t))return A(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ct(t),o=(a?De(n.width):n.width)/r,s=(a?De(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let Et=A(0);function Dt(e){let t=P(e);return!_t()||!t.visualViewport?Et:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ot(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==P(e)?!1:t}function kt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=wt(e),o=A(1);t&&(r?I(r)&&(o=Tt(r)):o=Tt(e));let s=Ot(a,n,r)?Dt(a):A(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=P(a),t=r&&I(r)?P(r):r,n=e,i=St(n);for(;i&&r&&t!==n;){let e=Tt(i),t=i.getBoundingClientRect(),r=R(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=P(i),i=St(n)}}return Ge({width:u,height:d,x:c,y:l})}function At(e,t){let n=yt(e).scrollLeft;return t?t.left+n:kt(F(e)).left+n}function jt(e,t,n){n===void 0&&(n=!1);let r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-(n?0:At(e,r)),a=r.top+t.scrollTop;return{x:i,y:a}}function Mt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=F(r),s=t?mt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=A(1),u=A(0),d=L(r);if((d||!d&&!a)&&((lt(r)!==`body`||ft(o))&&(c=yt(r)),L(r))){let e=kt(r);l=Tt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?jt(o,c,!0):A(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Nt(e){return Array.from(e.getClientRects())}function Pt(e){let t=F(e),n=yt(e),r=e.ownerDocument.body,i=Ee(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Ee(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+At(e),s=-n.scrollTop;return R(r).direction===`rtl`&&(o+=Ee(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function Ft(e,t){let n=P(e),r=F(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=_t();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s,y:c}}function It(e,t){let n=kt(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=L(e)?Tt(e):A(1),o=e.clientWidth*a.x,s=e.clientHeight*a.y,c=i*a.x,l=r*a.y;return{width:o,height:s,x:c,y:l}}function Lt(e,t,n){let r;if(t===`viewport`)r=Ft(e,n);else if(t===`document`)r=Pt(F(e));else if(I(t))r=It(t,n);else{let n=Dt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ge(r)}function Rt(e,t){let n=z(e);return n===t||!I(n)||vt(n)?!1:R(n).position===`fixed`||Rt(n,t)}function zt(e,t){let n=t.get(e);if(n)return n;let r=xt(e,[],!1).filter(e=>I(e)&<(e)!==`body`),i=null,a=R(e).position===`fixed`,o=a?z(e):e;for(;I(o)&&!vt(o);){let t=R(o),n=ht(o);!n&&t.position===`fixed`&&(i=null);let s=a?!n&&!i:!n&&t.position===`static`&&!!i&&[`absolute`,`fixed`].includes(i.position)||ft(o)&&!n&&Rt(e,o);s?r=r.filter(e=>e!==o):i=t,o=z(o)}return t.set(e,r),r}function Bt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=n===`clippingAncestors`?mt(t)?[]:zt(t,this._c):[].concat(n),o=[...a,r],s=o[0],c=o.reduce((e,n)=>{let r=Lt(t,n,i);return e.top=Ee(r.top,e.top),e.right=Te(r.right,e.right),e.bottom=Te(r.bottom,e.bottom),e.left=Ee(r.left,e.left),e},Lt(t,s,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Vt(e){let{width:t,height:n}=Ct(e);return{width:t,height:n}}function Ht(e,t,n){let r=L(t),i=F(t),a=n===`fixed`,o=kt(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=A(0);function l(){c.x=At(i)}if(r||!r&&!a)if((lt(t)!==`body`||ft(i))&&(s=yt(t)),r){let e=kt(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?jt(i,s):A(0),d=o.left+s.scrollLeft-c.x-u.x,f=o.top+s.scrollTop-c.y-u.y;return{x:d,y:f,width:o.width,height:o.height}}function Ut(e){return R(e).position===`static`}function Wt(e,t){if(!L(e)||R(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return F(e)===n&&(n=n.ownerDocument.body),n}function Gt(e,t){let n=P(e);if(mt(e))return n;if(!L(e)){let t=z(e);for(;t&&!vt(t);){if(I(t)&&!Ut(t))return t;t=z(t)}return n}let r=Wt(e,t);for(;r&&pt(r)&&Ut(r);)r=Wt(r,t);return r&&vt(r)&&Ut(r)&&!ht(r)?n:r||gt(e)||n}let Kt=function(){var e=D(function*(e){let t=this.getOffsetParent||Gt,n=this.getDimensions,r=yield n(e.floating);return{reference:Ht(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}});return function(t){return e.apply(this,arguments)}}();function qt(e){return R(e).direction===`rtl`}let Jt={convertOffsetParentRelativeRectToViewportRelativeRect:Mt,getDocumentElement:F,getClippingRect:Bt,getOffsetParent:Gt,getElementRects:Kt,getClientRects:Nt,getDimensions:Vt,getScale:Tt,isElement:I,isRTL:qt};function Yt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xt(e,t){let n=null,r,i=F(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Oe(d),h=Oe(i.clientWidth-(u+f)),g=Oe(i.clientHeight-(d+p)),_=Oe(u),v=-m+`px `+-h+`px `+-g+`px `+-_+`px`,y={rootMargin:v,threshold:Ee(0,Te(1,c))||1},b=!0;function x(t){let n=t[0].intersectionRatio;if(n!==c){if(!b)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Yt(l,e.getBoundingClientRect())&&o(),b=!1}try{n=new IntersectionObserver(x,k(k({},y),{},{root:i.ownerDocument}))}catch(e){n=new IntersectionObserver(x,y)}n.observe(e)}return o(!0),a}function Zt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=wt(e),u=i||a?[...l?xt(l):[],...xt(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Xt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?kt(e):null;c&&g();function g(){let t=kt(e);h&&!Yt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Qt=at,$t=ot,en=nt,tn=st,nn=(e,t,n)=>{let r=new Map,i=k({platform:Jt},n),a=k(k({},i.platform),{},{_c:r});return $e(e,t,k(k({},i),{},{platform:a}))};function rn(e,t,n,r,i){return i&&clearTimeout(i),e.addEventListener(`transitionend`,n,r),setTimeout(()=>{n()},t)}let an=4,on;function sn(e,t={}){let{msg:n=``,delay:r=150,content:i,direction:a=`bottom`,type:o=`hover`,container:s,onOpen:c,onClose:l,closed:u,onDestroy:d}=t,f=y(`tooltip`);if(n||i){on||(on=document.createElement(`div`),document.body.appendChild(on));let t=s||on,p=document.createElement(`div`);p.classList.add(f.b(),`hidden`,`transparent`),i?p.appendChild(i):n&&(p.textContent=n);let m,h,g,_=()=>{g&&g(),nn(e,p,{placement:a,middleware:[en(),$t({limiter:tn()}),Qt(an)]}).then(({x:e,y:t})=>{Object.assign(p.style,{left:`${e}px`,top:`${t}px`})})},v=()=>{p.classList.add(`hidden`),t.contains(p)&&t.removeChild(p),g&&g(),u&&u()},y=(n=!1)=>{h&&clearTimeout(h),m=setTimeout(()=>{if(c){let e=c(n);if(!n&&e)return}t.appendChild(p),p.removeEventListener(`transitionend`,v),p.classList.remove(`hidden`),g=Zt(e,p,_),p.classList.remove(`transparent`)},r)},b=(e=!1)=>{m&&clearTimeout(m),h=setTimeout(()=>{if(l){let t=l(e);if(!e&&t)return}rn(p,150,v,{once:!0}),p.classList.add(`transparent`)},r)},x=()=>{let t=[e,p],n=b.bind(void 0,!1),r=y.bind(void 0,!1),i=()=>{for(let e of t)e.addEventListener(`mouseenter`,r),e.addEventListener(`mouseleave`,n)};return{prepare:i,show:y,hide:b,destroy:()=>{for(let e of t)e.removeEventListener(`mouseenter`,r),e.removeEventListener(`mouseleave`,n)}}},S=()=>{let t=e=>{e.stopPropagation(),b(!1)},n=e=>{e.stopPropagation(),y(),document.removeEventListener(`click`,t),document.addEventListener(`click`,t,{once:!0})};return{prepare:()=>{p.addEventListener(`click`,e=>e.stopPropagation()),e.addEventListener(`click`,n)},show:y,hide:(e=!1)=>{b(e),document.removeEventListener(`click`,t)},destroy:()=>{e.removeEventListener(`click`,n),document.removeEventListener(`click`,t)}}},C={hover:x,click:S},{prepare:ee,show:te,hide:w,destroy:T}=C[o]();ee();let ne=()=>{w(!0),d&&d(),T(),g&&g(),p.remove()};return{show:te,hide:w,destroy:ne}}return null}function cn(e,t,n=0,r=!0){let{x:i,y:a,x1:o,y1:s}=e,{x:c,y:l,x1:u,y1:d}=t,f,p;return r?(f=o<c+n||i-n>u,p=s<l+n||a-n>d):(f=o<=c+n||i-n>=u,p=s<=l+n||a-n>=d),!(f||p)}function ln(e,t){let n=t.getBoundingClientRect();return{x:e.x-n.x-t.scrollLeft,y:e.y-n.y-t.scrollTop,x1:e.x-n.x-t.scrollLeft+e.width,y1:e.y-n.y-t.scrollTop+e.height,width:e.width,height:e.height}}let un=8;function dn(e){let{left:t,top:n,width:r,height:i}=e,{clientWidth:a,clientHeight:o}=document.documentElement,s=!1,c=!1;return t+r>a?(t=a-r-un,s=!0):t<0&&(t=un,s=!0),n+i>o?(n=o-i-un,c=!0):n<0&&(n=un,c=!0),{left:t,top:n,leftLimited:s,topLimited:c}}function fn(e,t={}){let n=Symbol(`ignoreFirstBind`),r=new Set,i=new ResizeObserver(r=>{t.ignoreFirstBind&&r.some(e=>{let t=e.target,r=t[n];return t[n]=!0,!r})||e(r)}),a=i.observe;i.observe=(e,t)=>{r.add(e),a.call(i,e,t)};let o=i.unobserve;i.unobserve=e=>{r.has(e)&&(r.delete(e),e[n]=void 0),o.call(i,e)};let s=i.disconnect;return i.disconnect=()=>{for(let e of r.values())e[n]=void 0;s.call(i)},i}function B(e,t){e.addEventListener(`scroll`,t),this.scrollHandler.push([e,t])}function pn(){for(let e=0;e<this.scrollHandler.length;e++){let[t,n]=this.scrollHandler[e];t.removeEventListener(`scroll`,n)}this.scrollHandler=[]}function mn(e){let t={},n=e.trim().split(`;`);for(let e=0;e<n.length;e++){let r=n[e].trim();if(!r)continue;let i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,Math.max(0,i)).trim(),o=r.slice(Math.max(0,i+1)).trim();t[_n(a)]=o}return t}function hn(e){return Object.entries(e).map(([e,t])=>`${gn(e)}: ${t};`).join(` `)}function gn(e){let t=e.replaceAll(RegExp(`([A-Z])`,`g`),` $1`).trim();return t.split(` `).join(`-`).toLowerCase()}function _n(e){return e.replaceAll(RegExp(`-(\\w)`,`g`),(e,t)=>t.toUpperCase())}let V=()=>Math.random().toString(36).slice(2);function vn(e,t){let n;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,r)},t)}}let yn=t.default.import(`parchment`),bn=t.default.import(`blots/container`),xn=t.default.import(`blots/block`),Sn=t.default.import(`blots/block/embed`);var H=class e extends bn{static create(e){let t=document.createElement(this.tagName);return this.className&&t.classList.add(this.className),t}optimize(e){if(this.children.length===0)if(this.statics.defaultChild!=null){let e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}else this.remove();this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}enforceAllowedChildren(){this.children.forEach(t=>{let n=this.statics.allowedChildren.some(e=>t instanceof e);n||(t.statics.scope===yn.Scope.BLOCK_BLOT?(t.parent instanceof e?(t.next!=null&&t.parent.splitAfter(t),t.prev!=null&&t.parent.splitAfter(t.prev)):(t.next!=null&&this.splitAfter(t),t.prev!=null&&this.splitAfter(t.prev)),t.parent.unwrap()):t instanceof yn.ParentBlot?t.unwrap():t.remove())})}};O(H,`tagName`,void 0),O(H,`blotName`,u.container),O(H,`scope`,yn.Scope.BLOCK_BLOT),O(H,`allowedChildren`,[xn,Sn,bn]),O(H,`requiredContainer`,void 0),O(H,`defaultChild`,void 0);let Cn=e=>fe(e)?e:1,wn=t.default.import(`blots/block`),Tn=t.default.import(`blots/block/embed`);var U=class extends H{static isAllowStyle(e){for(let t of this.allowStyle)if(e.startsWith(t))return!0;return!1}static create(e){let{tableId:t,rowId:n,colId:r,rowspan:i,colspan:a,style:o}=e,s=super.create();return s.dataset.tableId=t,s.dataset.rowId=n,s.dataset.colId=r,s.dataset.rowspan=String(Cn(i)),s.dataset.colspan=String(Cn(a)),o&&(s.dataset.style=o),s}static formats(e){let{tableId:t,rowId:n,colId:r,rowspan:i,colspan:a,style:o}=e.dataset,s={tableId:String(t),rowId:String(n),colId:String(r),rowspan:Number(Cn(i)),colspan:Number(Cn(a))};return o&&(s.style=o),s}constructor(e,t,n){super(e,t),t.setAttribute(`contenteditable`,String(e.isEnabled()))}setFormatValue(e,t,n=!1){if(n){if(!this.statics.isAllowStyle(e))return;this.parent&&this.parent.statics.blotName===u.tableCell&&this.parent.setFormatValue(e,t)}else{if(!this.statics.allowDataAttrs.has(e))return;let n=`data-${e}`;t?this.domNode.setAttribute(n,t):this.domNode.removeAttribute(n),this.parent&&this.parent.statics.blotName===u.tableCell&&this.parent.setFormatValue(e,t)}let r=this.descendants(wn,0);for(let e of r)e.cache={}}get tableId(){return this.domNode.dataset.tableId}get rowId(){return this.domNode.dataset.rowId}set rowId(e){this.setFormatValue(`row-id`,e)}get colId(){return this.domNode.dataset.colId}set colId(e){this.setFormatValue(`col-id`,e)}get rowspan(){return Number(this.domNode.dataset.rowspan)}set rowspan(e){this.setFormatValue(`rowspan`,e)}get colspan(){return Number(this.domNode.dataset.colspan)}set colspan(e){this.setFormatValue(`colspan`,e)}getColumnIndex(){let e=b(this,u.tableMain);return e.getColIds().indexOf(this.colId)}formatAt(e,t,n,r){if(this.children.length===0&&(this.appendChild(this.scroll.create(this.statics.defaultChild.blotName)),t+=1),super.formatAt(e,t,n,r),r&&r.style){let e=mn(r.style);for(let[t,n]of Object.entries(e))this.setFormatValue(t,n,!0)}}insertAt(e,t,n){let[r]=this.children.find(e);if(!r&&this.statics.defaultChild){let e=this.scroll.create(this.statics.defaultChild.blotName||`block`);this.appendChild(e)}super.insertAt(e,t,n)}formats(){let e=this.statics.formats(this.domNode);return{[this.statics.blotName]:e}}checkMerge(){let{colId:e,rowId:t,colspan:n,rowspan:r}=this,i=this.next;return i!==null&&i.statics.blotName===this.statics.blotName&&i.rowId===t&&i.colId===e&&i.colspan===n&&i.rowspan===r}optimize(){let e=this.parent,t=this.statics.formats(this.domNode);if(this.prev&&this.prev instanceof Tn){let e=this.scroll.create(`block`);this.appendChild(this.prev),this.appendChild(e)}if(e!==null&&e.statics.blotName!==u.tableCell&&(this.wrap(u.tableCell,t),this.children.length===0)){let e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove()),this.uiNode!=null&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),this.children.length===0&&this.remove()}insertBefore(e,t){if(e.statics.blotName===this.statics.blotName){let n=e,r=this.statics.formats(n.domNode),i=this.statics.formats(this.domNode),a=Object.entries(i).every(([e,t])=>t===r[e]);if(a)return this.parent.insertBefore(n,this.next);{let[e,a]=x(this,[u.tableRow,u.tableCell]);if(t){let n=t.offset(),r=this.length();if(n+1<r){let t=this.scroll.create(u.tableCellInner,i);this.children.forEachAt(n+1,this.length(),e=>{t.appendChild(e)}),e.insertBefore(t.wrap(u.tableCell,i),a.next),this.children.length===0&&(this.remove(),this.parent.children.length===0&&this.parent.remove())}}if(this.rowId!==n.rowId){if(t){let n=t.offset(e);e.split(n)}else if(a.next){let t=a.next.offset(e);e.split(t)}let i=this.scroll.create(u.tableRow,r),o=this.scroll.create(u.tableCell,r);return o.appendChild(n),i.appendChild(o),e.parent.insertBefore(i,e.next)}return e.insertBefore(n.wrap(u.tableCell,r),t?a:a.next)}}else if(e.statics.blotName===u.tableCol){try{let t=b(this,u.tableBody),n=this.offset(t),r=t.split(n);t.parent.insertBefore(e,r),e.optimize({})}catch(e){console.warn(`TableCellInner not in TableBody`)}return}super.insertBefore(e,t)}};O(U,`blotName`,u.tableCellInner),O(U,`tagName`,`div`),O(U,`className`,`ql-table-cell-inner`),O(U,`allowDataAttrs`,new Set([`table-id`,`row-id`,`col-id`,`rowspan`,`colspan`])),O(U,`defaultChild`,wn),O(U,`allowStyle`,new Set([`background-color`,`border`,`height`]));var W=class extends H{static create(e){let t=super.create();return t.dataset.tableId=e.tableId,t.dataset.rowId=e.rowId,t}get rowId(){return this.domNode.dataset.rowId}get tableId(){return this.domNode.dataset.tableId}setHeight(e){this.foreachCellInner(t=>{t.setFormatValue(`height`,e,!0)})}getCellByColId(e,t){let n=b(this,u.tableMain),r=n.getColIds(),i=r.indexOf(e),a=this.children.iterator(),o=null;for(;o=a();){if(o.colId===e)return o;let t=r.indexOf(o.colId);if(t<i&&t+o.colspan>i)return o}return this[t]&&this[t].statics.blotName===u.tableRow?this[t].getCellByColId(e,t):null}insertCell(e,t){let n=[],r=this.children.iterator(),i=0,a;for(;(a=r())&&(i+=a.colspan,!(i>e));)if(a.rowspan!==1)for(let e=0;e<a.rowspan-1;e++)n[e]=(n[e]||0)+a.colspan;if(a&&i-a.colspan<e){let e=a.getCellInner();e.colspan+=1,a.rowspan!==1&&(n.skipRowNum=a.rowspan-1)}else{let e=this.scroll.create(u.tableCell,t),n=this.scroll.create(u.tableCellInner,t),r=this.scroll.create(`block`);r.appendChild(this.scroll.create(`break`)),n.appendChild(r),e.appendChild(n),this.insertBefore(e,a)}return n}getCellByColumIndex(e){let t=[],n=null,r=0;if(e<0)return[n,r,t];let i=this.children.iterator();for(;n=i();){if(r+=n.colspan,n.rowspan!==1)for(let e=0;e<n.rowspan-1;e++)t[e]=(t[e]||0)+n.colspan;if(r>e)break}return[n,r,t]}removeCell(e){if(e<0)return[];let t=this.getCellByColumIndex(e),[n,r]=t,i=t[2];if(!n)return i;if(r-n.colspan<e||n.colspan>1){let[t]=n.descendants(U);if(n.colspan!==1&&e===r-n.colspan){let e=b(this,u.tableMain),n=e.getColIds();t.colId=n[n.indexOf(t.colId)+1]}n.rowspan!==1&&(i.skipRowNum=n.rowspan-1),--t.colspan}else n.remove();return i}foreachCellInner(e){let t=this.children.iterator(),n=0,r;for(;r=t();){let[t]=r.descendants(U);if(e(t,n++))break}}checkMerge(){let e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.rowId===this.rowId}optimize(e){let t=this.parent,{tableId:n}=this;t!==null&&t.statics.blotName!==u.tableBody&&this.wrap(u.tableBody,n),super.optimize(e)}};O(W,`blotName`,u.tableRow),O(W,`tagName`,`tr`),O(W,`className`,`ql-table-row`);var G=class extends H{static create(e){let t=super.create();return t.dataset.tableId=e,t}get tableId(){return this.domNode.dataset.tableId}insertRow(e){let t=b(this,u.tableMain);if(!t)return;let n=t.getColIds(),r=this.descendants(W),i=new Set(n),a=0;for(let t of r){if(a===e)break;t.foreachCellInner(t=>{if(a+t.rowspan>e&&(t.rowspan+=1,i.delete(t.colId),t.colspan!==1)){let e=n.indexOf(t.colId);for(let r=0;r<t.colspan-1;r++)i.delete(n[e+r+1])}}),a+=1}let o=t.tableId,s=V(),c=this.scroll.create(u.tableRow,{tableId:o,rowId:s});for(let e of i){let t=this.scroll.create(`break`),n=t.wrap(`block`),r=n.wrap(u.tableCellInner,{tableId:o,rowId:s,colId:e,rowspan:1,colspan:1}),i=r.wrap(u.tableCell,{tableId:o,rowId:s,colId:e,rowspan:1,colspan:1});c.appendChild(i)}this.insertBefore(c,r[e]||null)}checkMerge(){let e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}optimize(e){let t=this.parent;if(t!==null&&t.statics.blotName!==u.tableMain){let{tableId:e}=this;this.wrap(u.tableMain,{tableId:e})}super.optimize(e)}};O(G,`blotName`,u.tableBody),O(G,`tagName`,`tbody`);let En=t.default.import(`parchment`),Dn=t.default.import(`blots/block`);var On=class extends Dn{replaceWith(e,t){let n=typeof e==`string`?this.scroll.create(e,t):e;if(n instanceof En.ParentBlot)if(n.statics.blotName===u.tableCellInner){let e=this.parent;if(e.statics.blotName===u.tableCellInner){if(e!=null&&e.insertBefore(n,this.prev?null:this.next),e.statics.blotName===u.tableCellInner){let e=this;for(;e;){let t=e.next;n.appendChild(e),e=t}}else n.appendChild(this);if(e&&e.length()===0){e.remove(),e.parent.statics.blotName===u.tableCell&&e.parent.length()===0&&e.parent.remove();let t=e.parent.parent;t.statics.blotName===u.tableRow&&t.children.length===0&&t.remove()}}else e!=null&&e.insertBefore(n,this.next),n.appendChild(this);return n}else this.moveChildren(n);return this.parent!=null&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),this.attributes.copy(n),n}format(e,t){if(e===u.tableCellInner&&this.parent.statics.blotName===e&&!t)try{let e=b(this,u.tableCellInner);e.unwrap()}catch(e){console.error(`unwrap TableCellInner error`)}else super.format(e,t)}};let kn=t.default.import(`parchment`),An=t.default.import(`blots/scroll`);var jn=class extends An{enable(e=!0){let n=t.default.import(`formats/${u.tableCellInner}`),r=this.domNode.querySelectorAll(`.${n.className}`);for(let t of Array.from(r))t.setAttribute(`contenteditable`,String(!!e));let i=t.default.import(`formats/${u.tableCaption}`),a=this.domNode.querySelectorAll(`.${i.className}`);for(let t of Array.from(a))t.setAttribute(`contenteditable`,String(!!e));super.enable(e)}createBlock(e,t){let n,r={};if(e[u.tableCellInner])n=u.tableCellInner;else for(let[t,i]of Object.entries(e)){let e=this.query(t,kn.Scope.BLOCK&kn.Scope.BLOT)!=null;e?n=t:r[t]=i}n===u.tableCellInner&&(r=k({},e),delete r[n]);let i=this.create(n||this.statics.defaultChild.blotName,n?e[n]:void 0);this.insertBefore(i,t||void 0);let a=i.length();i instanceof U&&a===0&&(a+=1);for(let[e,t]of Object.entries(r))i.formatAt(0,a,e,t);return i}},Mn=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">\r
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`quill`)):typeof define==`function`&&define.amd?define([`exports`,`quill`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.TableUp={},e.Quill))})(this,function(exports,t){Object.defineProperty(exports,`__esModule`,{value:!0});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},l=(e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e));t=l(t);function u(e,t){this.v=e,this.k=t}function d(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e){if(Array.isArray(e))return e}function p(e){if(Array.isArray(e))return d(e)}function m(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function h(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function g(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){h(a,r,i,o,s,`next`,e)}function s(e){h(a,r,i,o,s,`throw`,e)}o(void 0)})}}function _(e,t,n){return t=w(t),te(e,E()?Reflect.construct(t,n||[],w(e).constructor):t.apply(e,n))}function v(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,R(r.key),r)}}function b(e,t,n){return t&&y(e.prototype,t),n&&y(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function x(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=oe(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function S(e,t,n){return(t=R(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function C(){return C=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=re(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},C.apply(null,arguments)}function w(e){return w=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},w(e)}function T(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&ne(e,t)}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(E=function(){return!!e})()}function D(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function O(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function k(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function M(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?j(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function N(e,t){if(e==null)return{};var n,r,i=ee(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ee(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function te(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return m(e)}function P(){"use strict";P=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=typeof Symbol==`function`?Symbol:{},a=i.iterator||`@@iterator`,o=i.asyncIterator||`@@asyncIterator`,s=i.toStringTag||`@@toStringTag`;function c(e,t,n,r){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r})}try{c({},``)}catch(e){c=function(e,t,n){return e[t]=n}}function l(t,n,r,i){var a=n&&n.prototype instanceof f?n:f,o=Object.create(a.prototype);return c(o,`_invoke`,function(t,n,r){var i=1;return function(a,o){if(i===3)throw Error(`Generator is already running`);if(i===4){if(a===`throw`)throw o;return{value:e,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var c=x(s,r);if(c){if(c===d)continue;return c}}if(r.method===`next`)r.sent=r._sent=r.arg;else if(r.method===`throw`){if(i===1)throw i=4,r.arg;r.dispatchException(r.arg)}else r.method===`return`&&r.abrupt(`return`,r.arg);i=3;var l=u(t,n,r);if(l.type===`normal`){if(i=r.done?4:2,l.arg===d)continue;return{value:l.arg,done:r.done}}l.type===`throw`&&(i=4,r.method=`throw`,r.arg=l.arg)}}}(t,r,new w(i||[])),!0),o}function u(e,t,n){try{return{type:`normal`,arg:e.call(t,n)}}catch(e){return{type:`throw`,arg:e}}}t.wrap=l;var d={};function f(){}function p(){}function m(){}var h={};c(h,a,function(){return this});var g=Object.getPrototypeOf,_=g&&g(g(T([])));_&&_!==n&&r.call(_,a)&&(h=_);var v=m.prototype=f.prototype=Object.create(h);function y(e){[`next`,`throw`,`return`].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function b(e,t){function n(i,a,o,s){var c=u(e[i],e,a);if(c.type!==`throw`){var l=c.arg,d=l.value;return d&&typeof d==`object`&&r.call(d,`__await`)?t.resolve(d.__await).then(function(e){n(`next`,e,o,s)},function(e){n(`throw`,e,o,s)}):t.resolve(d).then(function(e){l.value=e,o(l)},function(e){return n(`throw`,e,o,s)})}s(c.arg)}var i;c(this,`_invoke`,function(e,r){function a(){return new t(function(t,i){n(e,r,t,i)})}return i=i?i.then(a,a):a()},!0)}function x(t,n){var r=n.method,i=t.i[r];if(i===e)return n.delegate=null,r===`throw`&&t.i.return&&(n.method=`return`,n.arg=e,x(t,n),n.method===`throw`)||r!==`return`&&(n.method=`throw`,n.arg=TypeError(`The iterator does not provide a '`+r+`' method`)),d;var a=u(i,t.i,n.arg);if(a.type===`throw`)return n.method=`throw`,n.arg=a.arg,n.delegate=null,d;var o=a.arg;return o?o.done?(n[t.r]=o.value,n.next=t.n,n.method!==`return`&&(n.method=`next`,n.arg=e),n.delegate=null,d):o:(n.method=`throw`,n.arg=TypeError(`iterator result is not an object`),n.delegate=null,d)}function S(e){this.tryEntries.push(e)}function C(t){var n=t[4]||{};n.type=`normal`,n.arg=e,t[4]=n}function w(e){this.tryEntries=[[-1]],e.forEach(S,this),this.reset(!0)}function T(t){if(t!=null){var n=t[a];if(n)return n.call(t);if(typeof t.next==`function`)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw TypeError(typeof t+` is not iterable`)}return p.prototype=m,c(v,`constructor`,m),c(m,`constructor`,p),p.displayName=c(m,s,`GeneratorFunction`),t.isGeneratorFunction=function(e){var t=typeof e==`function`&&e.constructor;return!!t&&(t===p||(t.displayName||t.name)===`GeneratorFunction`)},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,s,`GeneratorFunction`)),e.prototype=Object.create(v),e},t.awrap=function(e){return{__await:e}},y(b.prototype),c(b.prototype,o,function(){return this}),t.AsyncIterator=b,t.async=function(e,n,r,i,a){a===void 0&&(a=Promise);var o=new b(l(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},y(v),c(v,s,`Generator`),c(v,a,function(){return this}),c(v,`toString`,function(){return`[object Generator]`}),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},t.values=T,w.prototype={constructor:w,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method=`next`,this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)n.charAt(0)===`t`&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if(e.type===`throw`)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(e){o.type=`throw`,o.arg=t,n.next=e}for(var i=n.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a[4],s=this.prev,c=a[1],l=a[2];if(a[0]===-1)return r(`end`),!1;if(!c&&!l)throw Error(`try statement without catch or finally`);if(a[0]!=null&&a[0]<=s){if(s<c)return this.method=`next`,this.arg=e,r(c),!0;if(s<l)return r(l),!1}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r[0]>-1&&r[0]<=this.prev&&this.prev<r[2]){var i=r;break}}i&&(e===`break`||e===`continue`)&&i[0]<=t&&t<=i[2]&&(i=null);var a=i?i[4]:{};return a.type=e,a.arg=t,i?(this.method=`next`,this.next=i[2],d):this.complete(a)},complete:function(e,t){if(e.type===`throw`)throw e.arg;return e.type===`break`||e.type===`continue`?this.next=e.arg:e.type===`return`?(this.rval=this.arg=e.arg,this.method=`return`,this.next=`end`):e.type===`normal`&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[2]===e)return this.complete(n[4],n[3]),C(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]===e){var r=n[4];if(r.type===`throw`){var i=r.arg;C(n)}return i}}throw Error(`illegal catch attempt`)},delegateYield:function(t,n,r){return this.delegate={i:T(t),r:n,n:r},this.method===`next`&&(this.arg=e),d}},t}function ne(e,t){return ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ne(e,t)}function F(e,t){return f(e)||O(e,t)||oe(e,t)||k()}function re(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=w(e))!==null;);return e}function I(e,t,n,r){var i=C(w(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}function L(e){return p(e)||D(e)||oe(e)||A()}function ie(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function R(e){var t=ie(e,`string`);return typeof t==`symbol`?t:t+``}function ae(e){"@babel/helpers - typeof";return ae=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ae(e)}function oe(e,t){if(e){if(typeof e==`string`)return d(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function se(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof u;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`?`return`:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(a.done?`return`:`normal`,n)},function(e){r(`throw`,e)})}catch(e){i(`throw`,e)}}function i(e,i){switch(e){case`return`:t.resolve({value:i,done:!0});break;case`throw`:t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}se.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},se.prototype.next=function(e){return this._invoke(`next`,e)},se.prototype.throw=function(e){return this._invoke(`throw`,e)},se.prototype.return=function(e){return this._invoke(`return`,e)};var z={container:`table-up-container`,tableCaption:`table-up-caption`,tableWrapper:`table-up`,tableMain:`table-up-main`,tableColgroup:`table-up-colgroup`,tableCol:`table-up-col`,tableBody:`table-up-body`,tableRow:`table-up-row`,tableCell:`table-up-cell`,tableCellInner:`table-up-cell-inner`},B={colMinWidthPre:5,colMinWidthPx:40,colDefaultWidth:100,rowMinHeightPx:36},ce={AFTER_TABLE_RESIZE:`after-table-resize`},le={moduleName:`table-up`},ue=[[`rgb(255, 255, 255)`,`rgb(0, 0, 0)`,`rgb(72, 83, 104)`,`rgb(41, 114, 244)`,`rgb(0, 163, 245)`,`rgb(49, 155, 98)`,`rgb(222, 60, 54)`,`rgb(248, 136, 37)`,`rgb(245, 196, 0)`,`rgb(153, 56, 215)`],[`rgb(242, 242, 242)`,`rgb(127, 127, 127)`,`rgb(243, 245, 247)`,`rgb(229, 239, 255)`,`rgb(229, 246, 255)`,`rgb(234, 250, 241)`,`rgb(254, 233, 232)`,`rgb(254, 243, 235)`,`rgb(254, 249, 227)`,`rgb(253, 235, 255)`],[`rgb(216, 216, 216)`,`rgb(89, 89, 89)`,`rgb(197, 202, 211)`,`rgb(199, 220, 255)`,`rgb(199, 236, 255)`,`rgb(195, 234, 213)`,`rgb(255, 201, 199)`,`rgb(255, 220, 196)`,`rgb(255, 238, 173)`,`rgb(242, 199, 255)`],[`rgb(191, 191, 191)`,`rgb(63, 63, 63)`,`rgb(128, 139, 158)`,`rgb(153, 190, 255)`,`rgb(153, 221, 255)`,`rgb(152, 215, 182)`,`rgb(255, 156, 153)`,`rgb(255, 186, 132)`,`rgb(255, 226, 112)`,`rgb(213, 142, 255)`],[`rgb(165, 165, 165)`,`rgb(38, 38, 38)`,`rgb(53, 59, 69)`,`rgb(20, 80, 184)`,`rgb(18, 116, 165)`,`rgb(39, 124, 79)`,`rgb(158, 30, 26)`,`rgb(184, 96, 20)`,`rgb(163, 130, 0)`,`rgb(94, 34, 129)`],[`rgb(147, 147, 147)`,`rgb(13, 13, 13)`,`rgb(36, 39, 46)`,`rgb(12, 48, 110)`,`rgb(10, 65, 92)`,`rgb(24, 78, 50)`,`rgb(88, 17, 14)`,`rgb(92, 48, 10)`,`rgb(102, 82, 0)`,`rgb(59, 21, 81)`]],de=`table-up`,fe=new Set([z.tableCellInner]),pe=function(e){return fe.has(e.statics.blotName)};function me(e){return e&&e.parent?pe(e.parent)?!0:me(e.parent):!1}function V(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:de,n=t?`${t}-`:``;return{b:function(){return`${n}${e}`},be:function(t){return t?`${n}${e}__${t}`:``},bm:function(t){return t?`${n}${e}--${t}`:``},bem:function(t,r){return t&&r?`${n}${e}__${t}--${r}`:``},ns:function(e){return e?`${n}${e}`:``},bs:function(t){return t?`${n}${e}-${t}`:``},cv:function(e){return e?`--${n}${e}`:``},is:function(e){return`is-${e}`}}}function H(e,t){for(var n=e.parent;n&&n.statics.blotName!==t&&n!==e.scroll;)n=n.parent;if(n===e.scroll)throw Error(`${e.statics.blotName} must be a child of ${t}`);return n}function he(e,t){for(var n=Array(t.length),r=new Map(t.map(function(e,t){return[e,t]})),i=e.parent;i&&i!==e.scroll&&r.size!==0;){if(r.has(i.statics.blotName)){var a=r.get(i.statics.blotName);n[a]=i,r.delete(i.statics.blotName)}i=i.parent}if(r.size>0)throw Error(`${e.statics.blotName} must be a child of ${Array.from(r.keys()).join(`, `)}`);return n}function ge(e){for(var t=new Map,n=e;n&&n.statics.blotName!==`scroll`;)t.set(n.statics.blotName,n),n=n.parent;return t}function _e(e,t){for(var n=[],r=e.children.iterator(),i=null;i=r();)i instanceof t&&n.push(i);return n}function ve(e,t,n){var r=x(Object.getOwnPropertyNames(t)),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;n&&n.test(a)||Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}}catch(e){r.e(e)}finally{r.f()}return e}function ye(e,t){var n=function(e){function t(){v(this,t);for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return _(this,t,[].concat(n))}return T(t,e),b(t)}(e),r=x(t),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;ve(n.prototype,a.prototype,/^constructor$/)}}catch(e){r.e(e)}finally{r.f()}return n}function be(e,t){return e.prototype instanceof t}function xe(e,t){return e=Math.min(t,Math.max(0,Number.parseFloat(`${e}`))),Math.abs(e-t)<1e-6?1:e%t/Number.parseFloat(t)}function Se(e){return{h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b)),a:Math.min(1,Math.max(0,e.a))}}function Ce(e){e=e.startsWith(`#`)?e.slice(1):e;var t=Number.parseInt(e.slice(0,2),16),n=Number.parseInt(e.slice(2,4),16),r=Number.parseInt(e.slice(4,6),16),i=Number((Number.parseInt(e.slice(6,8)||`ff`,16)/255).toFixed(2));return{r:t,g:n,b:r,a:i}}function we(e){var t=e.r,n=e.g,r=e.b,i=e.a;t=xe(t,255),n=xe(n,255),r=xe(r,255);var a=Math.max(t,n,r),o=Math.min(t,n,r),s,c=a,l=a-o,u=a===0?0:l/a;if(a===o)s=0;else{switch(a){case t:s=(n-r)/l+(n<r?6:0);break;case n:s=(r-t)/l+2;break;case r:s=(t-n)/l+4;break}s/=6}return{h:s*360,s:u*100,b:c*100,a:i}}function Te(e){var t=e.h,n=e.s,r=e.b,i=e.a;t=xe(t,360)*6,n=xe(n,100),r=xe(r,100);var a=Math.floor(t),o=t-a,s=r*(1-n),c=r*(1-o*n),l=r*(1-(1-o)*n),u=a%6,d=[r,c,s,s,l,r][u],f=[l,r,r,c,s,s][u],p=[s,s,l,r,r,c][u];return{r:Math.round(d*255),g:Math.round(f*255),b:Math.round(p*255),a:i}}function Ee(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16),Math.round(e.a*255).toString(16)];for(var n in t)t[n].length===1&&(t[n]=`0${t[n]}`);return t.join(``)}var De=function(e){return Ee(Te(e))},Oe=function(e){return typeof e==`function`},ke=Array.isArray,Ae=function(e){return typeof e==`string`},je=function(e){return typeof e==`number`},Me=function(e){return e!==null&&ae(e)===`object`},Ne=function(e){return!Number.isNaN(e)&&Number(e)>0};function Pe(e){var t=e||{},n=t.type,r=n===void 0?`default`:n,i=t.content,a=V(`button`),o=document.createElement(`button`);return o.classList.add(a.b(),r),i&&(Ae(i)?o.textContent=i:o.appendChild(i)),o}function Fe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=230,n=150,r=10,i=we(Ce(e.color||`#ff0000`)),a=V(`color-picker`),o=document.createElement(`div`);o.classList.add(a.b());var s=document.createElement(`div`);s.classList.add(a.be(`content`));var c=document.createElement(`div`);c.classList.add(a.be(`selector`));var l=document.createElement(`div`);l.classList.add(a.be(`background`)),c.appendChild(l);var u=document.createElement(`div`);u.classList.add(a.be(`background-handle`)),l.appendChild(u);var d=document.createElement(`div`);d.classList.add(a.be(`alpha`));var f=document.createElement(`div`);f.classList.add(a.be(`alpha-bg`));var p=document.createElement(`div`);p.classList.add(a.be(`alpha-handle`)),d.appendChild(f),d.appendChild(p);var m=document.createElement(`div`);m.classList.add(a.be(`hue`));var h=document.createElement(`div`);h.classList.add(a.be(`hue-handle`)),m.appendChild(h);var g=document.createElement(`div`);g.classList.add(a.be(`action`));var _=[`r`,`g`,`b`,`a`].map(function(e){var t=document.createElement(`div`);t.classList.add(a.be(`action-item`),e);var n=document.createElement(`label`);n.textContent=e.toUpperCase();var r=document.createElement(`input`);return r.classList.add(a.be(`input`)),r.addEventListener(`input`,function(){r.value=r.value.replaceAll(/[^0-9]/g,``)}),r.addEventListener(`change`,function(){var t=Math.round(Number(r.value));e===`a`&&(t/=100);var n=Se(we(Object.assign({},Te(i),S({},e,t))));te(n),ee()}),t.appendChild(n),t.appendChild(r),g.appendChild(t),r}),v=F(_,4),y=v[0],b=v[1],C=v[2],w=v[3];s.appendChild(m),s.appendChild(c),s.appendChild(d),o.appendChild(s),o.appendChild(g);var T=!1,E=!1,D=!1;function O(){var e=De(i),t=x([y,b,C].entries()),n;try{for(t.s();!(n=t.n()).done;){var r=F(n.value,2),a=r[0],o=r[1];o.value=String(Number.parseInt(e[a*2]+e[a*2+1],16))}}catch(e){t.e(e)}finally{t.f()}w.value=String((i.a*100).toFixed(0))}function k(){Object.assign(u.style,{left:`${Math.floor(t*i.s/100)}px`,top:`${Math.floor(n*(100-i.b)/100)}px`})}function A(){c.style.backgroundColor=`#${Ee(Te({h:i.h,s:100,b:100,a:1}))}`}function j(){h.style.top=`${Math.floor(n-n*i.h/360)}px`}function M(){p.style.left=`${i.a*100}%`}function N(){var e=Te(i),t=e.r,n=e.g,r=e.b;f.style.background=`linear-gradient(to right, rgba(${t}, ${n}, ${r}, 0) 0%, rgba(${t}, ${n}, ${r}, 1) 100%)`}function ee(){k(),A(),j(),M(),N(),O()}function te(t){i=Se(Object.assign({},i,t)),O(),e.onChange&&e.onChange(`#${De(i)}`)}function P(e){var r=c.getBoundingClientRect(),i=r.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),a=r.left+document.body.scrollLeft,o=Math.floor(100*Math.max(0,Math.min(t,e.pageX-a))/t),s=Math.floor(100*(n-Math.max(0,Math.min(n,e.pageY-i)))/n);te({s:o,b:s}),ee()}function ne(e){var t=m.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);te({h:Math.floor(360*(n-Math.max(0,Math.min(n,e.pageY-t)))/n)}),ee()}function re(e){var t=e.pageX,n=d.getBoundingClientRect(),i=t-n.left;i=Math.max(r/2,i),i=Math.min(i,n.width-r/2),te({a:Math.round((i-10/2)/(n.width-10)*100)/100}),ee()}function I(e){T&&(e.preventDefault(),P(e)),E&&(e.preventDefault(),ne(e)),D&&(e.preventDefault(),re(e))}function L(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,L),T=!1}function ie(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,L),T=!0,P(e)}c.addEventListener(`mousedown`,ie);function R(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,R),E=!1}function ae(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,R),E=!0,ne(e)}m.addEventListener(`mousedown`,ae);function oe(){document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,oe),D=!1}function se(e){document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,oe),D=!0,re(e)}return d.addEventListener(`mousedown`,se),ee(),o}var Ie=8e3;function Le(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.child,n=e.target,r=n===void 0?document.body:n,i=e.beforeClose,a=i===void 0?function(){}:i,o=V(`dialog`),s=r,c=document.createElement(`div`);c.classList.add(o.b()),c.style.zIndex=String(Ie);var l=document.createElement(`div`);if(l.classList.add(o.be(`overlay`)),c.appendChild(l),t){var u=document.createElement(`div`);u.classList.add(o.be(`content`)),u.appendChild(t),l.appendChild(u),u.addEventListener(`click`,function(e){e.stopPropagation()})}var d=getComputedStyle(s).overflow;s.style.overflow=`hidden`,s.appendChild(c);var f=function(){a(),c.remove(),s.style.overflow=d};return c.addEventListener(`click`,f),Ie+=1,{dialog:c,close:f}}function Re(e,t){var n=V(`input`);t.type||(t.type=`text`),t.value||(t.value=``);var r=document.createElement(`div`);if(r.classList.add(n.be(`item`)),e){var i=document.createElement(`span`);i.classList.add(n.be(`label`)),i.textContent=e,r.appendChild(i)}var a=document.createElement(`div`);a.classList.add(n.be(`input`));var o=document.createElement(`input`);for(var s in t)o.setAttribute(s,t[s]);(t.max||t.min)&&o.addEventListener(`blur`,function(){t.max&&t.max<=Number(o.value)&&(o.value=String(t.max)),t.min&&t.min>=Number(o.value)&&(o.value=String(t.min))}),a.appendChild(o),r.appendChild(a),o.addEventListener(`focus`,function(){a.classList.add(`focus`)}),o.addEventListener(`blur`,function(){a.classList.remove(`focus`)});var c=function(e){var t;a.classList.contains(`error`)?t=a.querySelector(`.${n.be(`error-tip`)}`):(t=document.createElement(`span`),t.classList.add(n.be(`error-tip`)),a.appendChild(t)),t.textContent=e,a.classList.add(`error`);var r=function(){a.classList.remove(`error`),t.remove()};return{removeError:r}};return{item:r,input:o,errorTip:c}}function ze(){return Be.apply(this,arguments)}function Be(){return Be=g(P().mark(function e(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,_,v,y=arguments;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=y.length>0&&y[0]!==void 0?y[0]:{},n=V(`creator`),r=document.createElement(`div`),r.classList.add(n.b()),i=document.createElement(`div`),i.classList.add(n.be(`input`)),a=Re(t.rowText||`Row`,{type:`number`,value:String(t.row||``),max:99}),o=a.item,s=a.input,c=a.errorTip,l=Re(t.colText||`Column`,{type:`number`,value:String(t.col||``),max:99}),u=l.item,d=l.input,f=l.errorTip,i.appendChild(o),i.appendChild(u),r.appendChild(i),p=document.createElement(`div`),p.classList.add(n.be(`control`)),m=Pe({type:`confirm`,content:t.confirmText||`Confirm`}),h=Pe({type:`default`,content:t.cancelText||`Cancel`}),p.appendChild(m),p.appendChild(h),r.appendChild(p),_=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Number(s.value),n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number(d.value);if(Number.isNaN(e)||e<=0){c(t.notPositiveNumberError||`Please enter a positive integer`);return}if(Number.isNaN(n)||n<=0){f(t.notPositiveNumberError||`Please enter a positive integer`);return}return{row:e,col:n}},v=function(e){e.key===`Escape`&&(close(),document.removeEventListener(`keydown`,v))},e.abrupt(`return`,new Promise(function(e,t){var n=Le({child:r,beforeClose:t}),i=n.close;s.focus();for(var a=0,o=[s,d];a<o.length;a++){var c=o[a];c.addEventListener(`keydown`,function(t){if(t.key===`Enter`){var n=_();n&&(e(n),i())}})}m.addEventListener(`click`,g(P().mark(function t(){var n;return P().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=_(),n&&(e(n),i());case 2:case`end`:return t.stop()}},t)}))),document.addEventListener(`keydown`,v),h.addEventListener(`click`,i)}));case 21:case`end`:return e.stop()}},e)})),Be.apply(this,arguments)}function Ve(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=V(`select-box`),n=document.createElement(`div`);n.classList.add(t.b());var r=document.createElement(`div`);r.classList.add(t.be(`block`));for(var i=0;i<(e.row||8);i++)for(var a=0;a<(e.col||8);a++){var o=document.createElement(`div`);o.classList.add(t.be(`item`)),o.dataset.row=String(i+1),o.dataset.col=String(a+1),r.appendChild(o)}var s=function(){for(var e=n.dataset,t=e.row,i=e.col,a=0,o=Array.from(r.querySelectorAll(`.active`));a<o.length;a++){var s=o[a];s.classList.remove(`active`)}if(!(!t||!i))for(var c=Array.from(r.children),l=0;l<c.length;l++){var u=c[l].dataset,d=u.row,f=u.col;if(d>t&&f>i)return;d<=t&&f<=i?c[l].classList.add(`active`):c[l].classList.remove(`active`)}};if(r.addEventListener(`mousemove`,function(e){if(e.target){var t=e.target.dataset,r=t.row,i=t.col;!r||!i||(n.dataset.row=r,n.dataset.col=i,s())}}),r.addEventListener(`mouseleave`,function(){n.removeAttribute(`data-row`),n.removeAttribute(`data-col`),s()}),r.addEventListener(`click`,function(){var t=n.dataset,r=t.row,i=t.col;!r||!i||e.onSelect&&e.onSelect(Number(r),Number(i))}),n.appendChild(r),e.customBtn){var c=e.texts||{},l=document.createElement(`div`);l.classList.add(t.be(`custom`)),l.textContent=c.customBtnText||`Custom`,l.addEventListener(`click`,g(P().mark(function t(){var n;return P().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ze(c);case 2:n=t.sent,n&&e.onSelect&&e.onSelect(n.row,n.col);case 4:case`end`:return t.stop()}},t)}))),n.appendChild(l)}return n}function He(e){"@babel/helpers - typeof";return He=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},He(e)}function Ue(e,t){if(He(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(He(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function We(e){var t=Ue(e,`string`);return He(t)==`symbol`?t:t+``}function Ge(e,t,n){return(t=We(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ke(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ke(Object(n),!0).forEach(function(t){Ge(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let qe=Math.min,Je=Math.max,Ye=Math.round,Xe=Math.floor,Ze=e=>({x:e,y:e}),Qe={left:`right`,right:`left`,bottom:`top`,top:`bottom`},$e={start:`end`,end:`start`};function et(e,t,n){return Je(e,qe(t,n))}function tt(e,t){return typeof e==`function`?e(t):e}function nt(e){return e.split(`-`)[0]}function rt(e){return e.split(`-`)[1]}function it(e){return e===`x`?`y`:`x`}function at(e){return e===`y`?`height`:`width`}function ot(e){return[`top`,`bottom`].includes(nt(e))?`y`:`x`}function st(e){return it(ot(e))}function ct(e,t,n){n===void 0&&(n=!1);let r=rt(e),i=st(e),a=at(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=pt(o)),[o,pt(o)]}function lt(e){let t=pt(e);return[ut(e),t,ut(t)]}function ut(e){return e.replace(/start|end/g,e=>$e[e])}function dt(e,t,n){let r=[`left`,`right`],i=[`right`,`left`],a=[`top`,`bottom`],o=[`bottom`,`top`];switch(e){case`top`:case`bottom`:return n?t?i:r:t?r:i;case`left`:case`right`:return t?a:o;default:return[]}}function ft(e,t,n,r){let i=rt(e),a=dt(nt(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ut)))),a}function pt(e){return e.replace(/left|right|bottom|top/g,e=>Qe[e])}function mt(e){return U({top:0,right:0,bottom:0,left:0},e)}function ht(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:mt(e)}function gt(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function _t(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function vt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){_t(a,r,i,o,s,`next`,e)}function s(e){_t(a,r,i,o,s,`throw`,e)}o(void 0)})}}function yt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function bt(e,t){if(e==null)return{};var n,r,i=yt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}let xt=[`crossAxis`,`alignment`,`allowedPlacements`,`autoAlignment`],St=[`mainAxis`,`crossAxis`,`fallbackPlacements`,`fallbackStrategy`,`fallbackAxisSideDirection`,`flipAlignment`],Ct=[`strategy`],wt=[`mainAxis`,`crossAxis`,`limiter`],Tt=[`apply`];function Et(e,t,n){let{reference:r,floating:i}=e,a=ot(t),o=st(t),s=at(o),c=nt(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(rt(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}let Dt=function(){var e=vt(function*(e,t,n){let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=yield o.isRTL==null?void 0:o.isRTL(t),l=yield o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Et(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=yield h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g==null?u:g,d=_==null?d:_,p=U(U({},p),{},{[a]:U(U({},p[a]),v)}),y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?yield o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Et(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}});return function(t,n,r){return e.apply(this,arguments)}}();function Ot(e,t){return kt.apply(this,arguments)}function kt(){return kt=vt(function*(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=tt(t,e),m=ht(p),h=d===`floating`?`reference`:`floating`,g=s[f?h:d],_=gt(yield a.getClippingRect({element:(n=yield a.isElement==null?void 0:a.isElement(g))==null||n?g:g.contextElement||(yield a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),v=d===`floating`?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,y=yield a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating),b=(yield a.isElement==null?void 0:a.isElement(y))&&(yield a.getScale==null?void 0:a.getScale(y))||{x:1,y:1},x=gt(a.convertOffsetParentRelativeRectToViewportRelativeRect?yield a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:c}):v);return{top:(_.top-x.top+m.top)/b.y,bottom:(x.bottom-_.bottom+m.bottom)/b.y,left:(_.left-x.left+m.left)/b.x,right:(x.right-_.right+m.right)/b.x}}),kt.apply(this,arguments)}let At=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,fn(t){return vt(function*(){var n,r;let{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=t,u=tt(e,t),{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m=`bestFit`,fallbackAxisSideDirection:h=`none`,flipAlignment:g=!0}=u,_=bt(u,St);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let v=nt(i),y=ot(s),b=nt(s)===s,x=yield c.isRTL==null?void 0:c.isRTL(l.floating),S=p||(b||!g?[pt(s)]:lt(s)),C=h!==`none`;!p&&C&&S.push(...ft(s,g,h,x));let w=[s,...S],T=yield Ot(t,_),E=[],D=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&E.push(T[v]),f){let e=ct(i,o,x);E.push(T[e[0]],T[e[1]])}if(D=[...D,{placement:i,overflows:E}],!E.every(e=>e<=0)){var O,k;let e=(((O=a.flip)==null?void 0:O.index)||0)+1,t=w[e];if(t){let n=f===`alignment`?y!==ot(t):!1;if(!n||D.every(e=>e.overflows[0]>0&&ot(e.placement)===y))return{data:{index:e,overflows:D},reset:{placement:t}}}let n=(k=D.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])==null?void 0:k.placement;if(!n)switch(m){case`bestFit`:{var A;let e=(A=D.filter(e=>{if(C){let t=ot(e.placement);return t===y||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])==null?void 0:A[0];e&&(n=e);break}case`initialPlacement`:n=s;break}if(i!==n)return{reset:{placement:n}}}return{}})()}}};function jt(e,t){return Mt.apply(this,arguments)}function Mt(){return Mt=vt(function*(e,t){let{placement:n,platform:r,elements:i}=e,a=yield r.isRTL==null?void 0:r.isRTL(i.floating),o=nt(n),s=rt(n),c=ot(n)===`y`,l=[`left`,`top`].includes(o)?-1:1,u=a&&c?-1:1,d=tt(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}),Mt.apply(this,arguments)}let Nt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,fn(t){return vt(function*(){var n,r;let{x:i,y:a,placement:o,middlewareData:s}=t,c=yield jt(t,e);return o===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:U(U({},c),{},{placement:o})}})()}}},Pt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,fn(t){return vt(function*(){let{x:n,y:r,placement:i}=t,a=tt(e,t),{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}}}=a,l=bt(a,wt),u={x:n,y:r},d=yield Ot(t,l),f=ot(nt(i)),p=it(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=et(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=et(n,h,r)}let g=c.fn(U(U({},t),{},{[p]:m,[f]:h}));return U(U({},g),{},{data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}})})()}}},Ft=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=tt(e,t),u={x:n,y:r},d=ot(i),f=it(d),p=u[f],m=u[d],h=tt(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:U({mainAxis:0,crossAxis:0},h);if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){var _,v;let e=f===`y`?`width`:`height`,t=[`top`,`left`].includes(nt(i)),n=a.reference[d]-a.floating[e]+(t&&((_=o.offset)==null?void 0:_[d])||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:((v=o.offset)==null?void 0:v[d])||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}};function It(){return typeof window<`u`}function Lt(e){return zt(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rt(e){var t;return(t=(zt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zt(e){return It()?e instanceof Node||e instanceof W(e).Node:!1}function Bt(e){return It()?e instanceof Element||e instanceof W(e).Element:!1}function Vt(e){return It()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function Ht(e){return!It()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function Ut(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Xt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&![`inline`,`contents`].includes(i)}function Wt(e){return[`table`,`td`,`th`].includes(Lt(e))}function Gt(e){return[`:popover-open`,`:modal`].some(t=>{try{return e.matches(t)}catch(e){return!1}})}function Kt(e){let t=Jt(),n=Bt(e)?Xt(e):e;return[`transform`,`translate`,`scale`,`rotate`,`perspective`].some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`].some(e=>(n.willChange||``).includes(e))||[`paint`,`layout`,`strict`,`content`].some(e=>(n.contain||``).includes(e))}function qt(e){let t=Qt(e);for(;Vt(t)&&!Yt(t);){if(Kt(t))return t;if(Gt(t))return null;t=Qt(t)}return null}function Jt(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}function Yt(e){return[`html`,`body`,`#document`].includes(Lt(e))}function Xt(e){return W(e).getComputedStyle(e)}function Zt(e){return Bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qt(e){if(Lt(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ht(e)&&e.host||Rt(e);return Ht(t)?t.host:t}function $t(e){let t=Qt(e);return Yt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vt(t)&&Ut(t)?t:$t(t)}function en(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);let i=$t(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=W(i);if(a){let e=tn(o);return t.concat(o,o.visualViewport||[],Ut(i)?i:[],e&&n?en(e):[])}return t.concat(i,en(i,[],n))}function tn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function nn(e){let t=Xt(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Vt(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ye(n)!==a||Ye(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function rn(e){return Bt(e)?e:e.contextElement}function an(e){let t=rn(e);if(!Vt(t))return Ze(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=nn(t),o=(a?Ye(n.width):n.width)/r,s=(a?Ye(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let on=Ze(0);function sn(e){let t=W(e);return!Jt()||!t.visualViewport?on:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function ln(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=rn(e),o=Ze(1);t&&(r?Bt(r)&&(o=an(r)):o=an(e));let s=cn(a,n,r)?sn(a):Ze(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=W(a),t=r&&Bt(r)?W(r):r,n=e,i=tn(n);for(;i&&r&&t!==n;){let e=an(i),t=i.getBoundingClientRect(),r=Xt(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=W(i),i=tn(n)}}return gt({width:u,height:d,x:c,y:l})}function un(e,t){let n=Zt(e).scrollLeft;return t?t.left+n:ln(Rt(e)).left+n}function dn(e,t,n){n===void 0&&(n=!1);let r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-(n?0:un(e,r)),a=r.top+t.scrollTop;return{x:i,y:a}}function fn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Rt(r),s=t?Gt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ze(1),u=Ze(0),d=Vt(r);if((d||!d&&!a)&&((Lt(r)!==`body`||Ut(o))&&(c=Zt(r)),Vt(r))){let e=ln(r);l=an(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?dn(o,c,!0):Ze(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function pn(e){return Array.from(e.getClientRects())}function mn(e){let t=Rt(e),n=Zt(e),r=e.ownerDocument.body,i=Je(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Je(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+un(e),s=-n.scrollTop;return Xt(r).direction===`rtl`&&(o+=Je(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function hn(e,t){let n=W(e),r=Rt(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Jt();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s,y:c}}function gn(e,t){let n=ln(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Vt(e)?an(e):Ze(1),o=e.clientWidth*a.x,s=e.clientHeight*a.y,c=i*a.x,l=r*a.y;return{width:o,height:s,x:c,y:l}}function _n(e,t,n){let r;if(t===`viewport`)r=hn(e,n);else if(t===`document`)r=mn(Rt(e));else if(Bt(t))r=gn(t,n);else{let n=sn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return gt(r)}function vn(e,t){let n=Qt(e);return n===t||!Bt(n)||Yt(n)?!1:Xt(n).position===`fixed`||vn(n,t)}function yn(e,t){let n=t.get(e);if(n)return n;let r=en(e,[],!1).filter(e=>Bt(e)&&Lt(e)!==`body`),i=null,a=Xt(e).position===`fixed`,o=a?Qt(e):e;for(;Bt(o)&&!Yt(o);){let t=Xt(o),n=Kt(o);!n&&t.position===`fixed`&&(i=null);let s=a?!n&&!i:!n&&t.position===`static`&&!!i&&[`absolute`,`fixed`].includes(i.position)||Ut(o)&&!n&&vn(e,o);s?r=r.filter(e=>e!==o):i=t,o=Qt(o)}return t.set(e,r),r}function bn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=n===`clippingAncestors`?Gt(t)?[]:yn(t,this._c):[].concat(n),o=[...a,r],s=o[0],c=o.reduce((e,n)=>{let r=_n(t,n,i);return e.top=Je(r.top,e.top),e.right=qe(r.right,e.right),e.bottom=qe(r.bottom,e.bottom),e.left=Je(r.left,e.left),e},_n(t,s,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function xn(e){let{width:t,height:n}=nn(e);return{width:t,height:n}}function Sn(e,t,n){let r=Vt(t),i=Rt(t),a=n===`fixed`,o=ln(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ze(0);function l(){c.x=un(i)}if(r||!r&&!a)if((Lt(t)!==`body`||Ut(i))&&(s=Zt(t)),r){let e=ln(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?dn(i,s):Ze(0),d=o.left+s.scrollLeft-c.x-u.x,f=o.top+s.scrollTop-c.y-u.y;return{x:d,y:f,width:o.width,height:o.height}}function Cn(e){return Xt(e).position===`static`}function wn(e,t){if(!Vt(e)||Xt(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Rt(e)===n&&(n=n.ownerDocument.body),n}function Tn(e,t){let n=W(e);if(Gt(e))return n;if(!Vt(e)){let t=Qt(e);for(;t&&!Yt(t);){if(Bt(t)&&!Cn(t))return t;t=Qt(t)}return n}let r=wn(e,t);for(;r&&Wt(r)&&Cn(r);)r=wn(r,t);return r&&Yt(r)&&Cn(r)&&!Kt(r)?n:r||qt(e)||n}let En=function(){var e=vt(function*(e){let t=this.getOffsetParent||Tn,n=this.getDimensions,r=yield n(e.floating);return{reference:Sn(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}});return function(t){return e.apply(this,arguments)}}();function Dn(e){return Xt(e).direction===`rtl`}let On={convertOffsetParentRelativeRectToViewportRelativeRect:fn,getDocumentElement:Rt,getClippingRect:bn,getOffsetParent:Tn,getElementRects:En,getClientRects:pn,getDimensions:xn,getScale:an,isElement:Bt,isRTL:Dn};function kn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function An(e,t){let n=null,r,i=Rt(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Xe(d),h=Xe(i.clientWidth-(u+f)),g=Xe(i.clientHeight-(d+p)),_=Xe(u),v=-m+`px `+-h+`px `+-g+`px `+-_+`px`,y={rootMargin:v,threshold:Je(0,qe(1,c))||1},b=!0;function x(t){let n=t[0].intersectionRatio;if(n!==c){if(!b)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!kn(l,e.getBoundingClientRect())&&o(),b=!1}try{n=new IntersectionObserver(x,U(U({},y),{},{root:i.ownerDocument}))}catch(e){n=new IntersectionObserver(x,y)}n.observe(e)}return o(!0),a}function jn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=rn(e),u=i||a?[...l?en(l):[],...en(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?An(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?ln(e):null;c&&g();function g(){let t=ln(e);h&&!kn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Mn=Nt,Nn=Pt,Pn=At,Fn=Ft,In=(e,t,n)=>{let r=new Map,i=U({platform:On},n),a=U(U({},i.platform),{},{_c:r});return Dt(e,t,U(U({},i),{},{platform:a}))};function Ln(e,t,n,r,i){return i&&clearTimeout(i),e.addEventListener(`transitionend`,n,r),setTimeout(function(){n()},t)}var Rn=4,zn;function Bn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.msg,r=n===void 0?``:n,i=t.delay,a=i===void 0?150:i,o=t.content,s=t.direction,c=s===void 0?`bottom`:s,l=t.type,u=l===void 0?`hover`:l,d=t.container,f=t.onOpen,p=t.onClose,m=t.closed,h=t.onDestroy,g=V(`tooltip`);if(r||o){zn||(zn=document.createElement(`div`),document.body.appendChild(zn));var _=d||zn,v=document.createElement(`div`);v.classList.add(g.b(),`hidden`,`transparent`),o?v.appendChild(o):r&&(v.textContent=r);var y,b,x,S=function(){x&&x(),In(e,v,{placement:c,middleware:[Pn(),Nn({limiter:Fn()}),Mn(Rn)]}).then(function(e){var t=e.x,n=e.y;Object.assign(v.style,{left:`${t}px`,top:`${n}px`})})},C=function(){v.classList.add(`hidden`),_.contains(v)&&_.removeChild(v),x&&x(),m&&m()},w=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;b&&clearTimeout(b),y=setTimeout(function(){if(f){var n=f(t);if(!t&&n)return}_.appendChild(v),v.removeEventListener(`transitionend`,C),v.classList.remove(`hidden`),x=jn(e,v,S),v.classList.remove(`transparent`)},a)},T=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;y&&clearTimeout(y),b=setTimeout(function(){if(p){var t=p(e);if(!e&&t)return}Ln(v,150,C,{once:!0}),v.classList.add(`transparent`)},a)},E=function(){var t=[e,v],n=T.bind(void 0,!1),r=w.bind(void 0,!1),i=function(){for(var e=0,i=t;e<i.length;e++){var a=i[e];a.addEventListener(`mouseenter`,r),a.addEventListener(`mouseleave`,n)}};return{prepare:i,show:w,hide:T,destroy:function(){for(var e=0,i=t;e<i.length;e++){var a=i[e];a.removeEventListener(`mouseenter`,r),a.removeEventListener(`mouseleave`,n)}}}},D=function(){var t=function(e){e.stopPropagation(),T(!1)},n=function(e){e.stopPropagation(),w(),document.removeEventListener(`click`,t),document.addEventListener(`click`,t,{once:!0})};return{prepare:function(){v.addEventListener(`click`,function(e){return e.stopPropagation()}),e.addEventListener(`click`,n)},show:w,hide:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;T(e),document.removeEventListener(`click`,t)},destroy:function(){e.removeEventListener(`click`,n),document.removeEventListener(`click`,t)}}},O={hover:E,click:D},k=O[u](),A=k.prepare,j=k.show,M=k.hide,N=k.destroy;A();var ee=function(){M(!0),h&&h(),N(),x&&x(),v.remove()};return{show:j,hide:M,destroy:ee}}return null}function Vn(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=e.x,a=e.y,o=e.x1,s=e.y1,c=t.x,l=t.y,u=t.x1,d=t.y1,f,p;return r?(f=o<c+n||i-n>u,p=s<l+n||a-n>d):(f=o<=c+n||i-n>=u,p=s<=l+n||a-n>=d),!(f||p)}function Hn(e,t){var n=t.getBoundingClientRect();return{x:e.x-n.x-t.scrollLeft,y:e.y-n.y-t.scrollTop,x1:e.x-n.x-t.scrollLeft+e.width,y1:e.y-n.y-t.scrollTop+e.height,width:e.width,height:e.height}}var Un=8;function Wn(e){var t=e.left,n=e.top,r=e.width,i=e.height,a=document.documentElement,o=a.clientWidth,s=a.clientHeight,c=!1,l=!1;return t+r>o?(t=o-r-Un,c=!0):t<0&&(t=Un,c=!0),n+i>s?(n=s-i-Un,l=!0):n<0&&(n=Un,l=!0),{left:t,top:n,leftLimited:c,topLimited:l}}function Gn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=Symbol(`ignoreFirstBind`),r=new Set,i=new ResizeObserver(function(r){t.ignoreFirstBind&&r.some(function(e){var t=e.target,r=t[n];return t[n]=!0,!r})||e(r)}),a=i.observe;i.observe=function(e,t){r.add(e),a.call(i,e,t)};var o=i.unobserve;i.unobserve=function(e){r.has(e)&&(r.delete(e),e[n]=void 0),o.call(i,e)};var s=i.disconnect;return i.disconnect=function(){var e=x(r.values()),t;try{for(e.s();!(t=e.n()).done;){var a=t.value;a[n]=void 0}}catch(t){e.e(t)}finally{e.f()}s.call(i)},i}function Kn(e,t){e.addEventListener(`scroll`,t),this.scrollHandler.push([e,t])}function qn(){for(var e=0;e<this.scrollHandler.length;e++){var t=F(this.scrollHandler[e],2),n=t[0],r=t[1];n.removeEventListener(`scroll`,r)}this.scrollHandler=[]}function Jn(e){return{y:e.scrollTop,x:e.scrollLeft}}function Yn(e){for(var t={},n=e.trim().split(`;`),r=0;r<n.length;r++){var i=n[r].trim();if(i){var a=i.indexOf(`:`);if(a!==-1){var o=i.slice(0,Math.max(0,a)).trim(),s=i.slice(Math.max(0,a+1)).trim();t[Qn(o)]=s}}}return t}function Xn(e){return Object.entries(e).map(function(e){var t=F(e,2),n=t[0],r=t[1];return`${Zn(n)}: ${r};`}).join(` `)}function Zn(e){var t=e.replaceAll(RegExp(`([A-Z])`,`g`),` $1`).trim();return t.split(` `).join(`-`).toLowerCase()}function Qn(e){return e.replaceAll(RegExp(`-(\\w)`,`g`),function(e,t){return t.toUpperCase()})}var G=function(){return Math.random().toString(36).slice(2)};function $n(e,t){var n;return function(){for(var r=this,i=arguments.length,a=Array(i),o=0;o<i;o++)a[o]=arguments[o];n&&clearTimeout(n),n=setTimeout(function(){e.apply(r,a)},t)}}var er=t.default.import(`parchment`),tr=t.default.import(`blots/container`),nr=t.default.import(`blots/block`),rr=t.default.import(`blots/block/embed`),K=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`optimize`,value:function(e){if(this.children.length===0)if(this.statics.defaultChild!=null){var t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t)}else this.remove();this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}},{key:`enforceAllowedChildren`,value:function(){var e=this;this.children.forEach(function(n){var r=e.statics.allowedChildren.some(function(e){return n instanceof e});r||(n.statics.scope===er.Scope.BLOCK_BLOT?(n.parent instanceof t?(n.next!=null&&n.parent.splitAfter(n),n.prev!=null&&n.parent.splitAfter(n.prev)):(n.next!=null&&e.splitAfter(n),n.prev!=null&&e.splitAfter(n.prev)),n.parent.unwrap()):n instanceof er.ParentBlot?n.unwrap():n.remove())})}}],[{key:`create`,value:function(e){var t=document.createElement(this.tagName);return this.className&&t.classList.add(this.className),t}}])}(tr);S(K,`tagName`,void 0),S(K,`blotName`,z.container),S(K,`scope`,er.Scope.BLOCK_BLOT),S(K,`allowedChildren`,[nr,rr,tr]),S(K,`requiredContainer`,void 0),S(K,`defaultChild`,void 0);var ir=function(e){return Ne(e)?e:1},ar=t.default.import(`blots/block`),or=t.default.import(`blots/block/embed`),q=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n]),n.setAttribute(`contenteditable`,String(e.isEnabled())),i}return T(t,e),b(t,[{key:`setFormatValue`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n){if(!this.statics.isAllowStyle(e))return;this.parent&&this.parent.statics.blotName===z.tableCell&&this.parent.setFormatValue(e,t)}else{if(!this.statics.allowDataAttrs.has(e))return;var r=`data-${e}`;t?this.domNode.setAttribute(r,t):this.domNode.removeAttribute(r),this.parent&&this.parent.statics.blotName===z.tableCell&&this.parent.setFormatValue(e,t)}var i=this.descendants(ar,0),a=x(i),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;s.cache={}}}catch(e){a.e(e)}finally{a.f()}}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`rowId`,get:function(){return this.domNode.dataset.rowId},set:function(e){this.setFormatValue(`row-id`,e)}},{key:`colId`,get:function(){return this.domNode.dataset.colId},set:function(e){this.setFormatValue(`col-id`,e)}},{key:`rowspan`,get:function(){return Number(this.domNode.dataset.rowspan)},set:function(e){this.setFormatValue(`rowspan`,e)}},{key:`colspan`,get:function(){return Number(this.domNode.dataset.colspan)},set:function(e){this.setFormatValue(`colspan`,e)}},{key:`emptyRow`,get:function(){try{return JSON.parse(this.domNode.dataset.emptyRow)}catch(e){return[]}},set:function(e){if(this.emptyRow.toString()!==e.toString())try{e.length>0?this.setFormatValue(`empty-row`,JSON.stringify(e),!1):this.setFormatValue(`empty-row`,null,!1)}catch(e){this.setFormatValue(`empty-row`,null,!1)}}},{key:`getColumnIndex`,value:function(){var e=H(this,z.tableMain);return e.getColIds().indexOf(this.colId)}},{key:`setStyleByString`,value:function(e){for(var t=Yn(e),n=0,r=Object.entries(t);n<r.length;n++){var i=F(r[n],2),a=i[0],o=i[1];this.setFormatValue(a,o,!0)}}},{key:`formatAt`,value:function(e,n,r,i){this.children.length===0&&(this.appendChild(this.scroll.create(this.statics.defaultChild.blotName)),n+=1),I(t,`formatAt`,this,3)([e,n,r,i]),i&&i.style&&this.setStyleByString(i.style)}},{key:`insertAt`,value:function(e,n,r){var i=this.children.find(e),a=F(i,1),o=a[0];if(!o&&this.statics.defaultChild){var s=this.scroll.create(this.statics.defaultChild.blotName||`block`);this.appendChild(s)}I(t,`insertAt`,this,3)([e,n,r])}},{key:`formats`,value:function(){var e=this.statics.formats(this.domNode);return S({},this.statics.blotName,e)}},{key:`checkMerge`,value:function(){var e=this.colId,t=this.rowId,n=this.colspan,r=this.rowspan,i=this.next;return i!==null&&i.statics.blotName===this.statics.blotName&&i.rowId===t&&i.colId===e&&i.colspan===n&&i.rowspan===r}},{key:`optimize`,value:function(){var e=this.parent,t=this.statics.formats(this.domNode);if(this.prev&&this.prev instanceof or){var n=this.prev;if(this.insertBefore(n,this.children.head),this.length()<=1){var r=this.scroll.create(`block`);this.insertBefore(r,n.next)}}var i=e!==null&&e.statics.blotName!==z.tableCell;if(i&&(this.wrap(z.tableCell,t),this.children.length===0)){var a=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(a)}this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove()),this.uiNode!=null&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),this.children.length===0?this.remove():this.domNode.dataset.style&&i&&e.domNode.style.cssText!==this.domNode.dataset.style&&this.setStyleByString(this.domNode.dataset.style)}},{key:`insertBefore`,value:function(e,n){if(e.statics.blotName===this.statics.blotName){var r=e,i=this.statics.formats(r.domNode),a=this.statics.formats(this.domNode),o=Object.entries(a).every(function(e){var t=F(e,2),n=t[0],r=t[1];return String(r)===String(i[n])});if(o){var s=this.split(n?n.offset():0);return this.parent.insertBefore(r,s)}else{var c=he(this,[z.tableRow,z.tableCell]),l=F(c,2),u=l[0],d=l[1];if(n){var f=n.offset(),p=this.length();if(f+1<p){var m=this.scroll.create(z.tableCellInner,a);this.children.forEachAt(f+1,this.length(),function(e){m.appendChild(e)}),u.insertBefore(m.wrap(z.tableCell,a),d.next)}}if(this.rowId!==r.rowId){if(n){var h=n.offset(u);u.split(h)}else if(d.next){var g=d.next.offset(u);u.split(g)}var _=this.scroll.create(z.tableRow,i),v=this.scroll.create(z.tableCell,i);return v.appendChild(r),_.appendChild(v),u.parent.insertBefore(_,u.next)}return u.insertBefore(r.wrap(z.tableCell,i),n?d:d.next)}}else if(e.statics.blotName===z.tableCol){try{var y=H(this,z.tableBody),b=this.offset(y),x=y.split(b);y.parent.insertBefore(e,x),e.optimize({})}catch(e){console.warn(`TableCellInner not in TableBody`)}return}I(t,`insertBefore`,this,3)([e,n])}}],[{key:`isAllowStyle`,value:function(e){var t=Qn(e),n=x(this.allowStyle),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(t.startsWith(Qn(i)))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:`create`,value:function(e){var n=e.tableId,r=e.rowId,i=e.colId,a=e.rowspan,o=e.colspan,s=e.style,c=e.emptyRow,l=I(t,`create`,this,2)([]);l.dataset.tableId=n,l.dataset.rowId=r,l.dataset.colId=i,l.dataset.rowspan=String(ir(a)),l.dataset.colspan=String(ir(o)),s&&(l.dataset.style=s);try{c&&(l.dataset.emptyRow=JSON.stringify(c))}catch(e){}return l}},{key:`formats`,value:function(e){var t=e.dataset,n=t.tableId,r=t.rowId,i=t.colId,a=t.rowspan,o=t.colspan,s=t.style,c=t.emptyRow,l={tableId:String(n),rowId:String(r),colId:String(i),rowspan:Number(ir(a)),colspan:Number(ir(o))};s&&(l.style=s);try{c&&(l.emptyRow=JSON.parse(c))}catch(e){}return l}}])}(K);S(q,`blotName`,z.tableCellInner),S(q,`tagName`,`div`),S(q,`className`,`ql-table-cell-inner`),S(q,`allowDataAttrs`,new Set([`table-id`,`row-id`,`col-id`,`rowspan`,`colspan`,`empty-row`])),S(q,`defaultChild`,ar),S(q,`allowStyle`,new Set([`background-color`,`border`,`height`]));var J=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`rowId`,get:function(){return this.domNode.dataset.rowId}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`setHeight`,value:function(e){this.foreachCellInner(function(t){t.setFormatValue(`height`,e,!0)})}},{key:`getCellByColId`,value:function(e,t){for(var n=H(this,z.tableMain),r=n.getColIds(),i=r.indexOf(e),a=this.children.iterator(),o=null;o=a();){if(o.colId===e)return o;var s=r.indexOf(o.colId);if(s<i&&s+o.colspan>i)return o}return this[t]&&this[t].statics.blotName===z.tableRow?this[t].getCellByColId(e,t):null}},{key:`insertCell`,value:function(e,t){for(var n=[],r=this.children.iterator(),i=0,a;(a=r())&&(i+=a.colspan,!(i>e));)if(a.rowspan!==1)for(var o=0;o<a.rowspan-1;o++)n[o]=(n[o]||0)+a.colspan;if(a&&i-a.colspan<e){var s=a.getCellInner();s.colspan+=1,a.rowspan!==1&&(n.skipRowNum=a.rowspan-1)}else{var c=this.scroll.create(z.tableCell,t),l=this.scroll.create(z.tableCellInner,t),u=this.scroll.create(`block`);u.appendChild(this.scroll.create(`break`)),l.appendChild(u),c.appendChild(l),this.insertBefore(c,a)}return n}},{key:`getCellByColumIndex`,value:function(e){var t=[],n=null,r=0;if(e<0)return[n,r,t];for(var i=this.children.iterator();n=i();){if(r+=n.colspan,n.rowspan!==1)for(var a=0;a<n.rowspan-1;a++)t[a]=(t[a]||0)+n.colspan;if(r>e)break}return[n,r,t]}},{key:`removeCell`,value:function(e){if(e<0)return[];var t=this.getCellByColumIndex(e),n=F(t,2),r=n[0],i=n[1],a=t[2];if(!r)return a;if(i-r.colspan<e||r.colspan>1){var o=r.descendants(q),s=F(o,1),c=s[0];if(r.colspan!==1&&e===i-r.colspan){var l=H(this,z.tableMain),u=l.getColIds();c.colId=u[u.indexOf(c.colId)+1]}r.rowspan!==1&&(a.skipRowNum=r.rowspan-1),--c.colspan}else r.remove();return a}},{key:`foreachCellInner`,value:function(e){for(var t=this.children.iterator(),n=0,r;r=t();){var i=r.descendants(q),a=F(i,1),o=a[0];if(e(o,n++))break}}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.rowId===this.rowId}},{key:`optimize`,value:function(e){var t=this.parent,n=this.tableId;t!==null&&t.statics.blotName!==z.tableBody&&this.wrap(z.tableBody,n),this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName),this.enforceAllowedChildren(),this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e.tableId,n.dataset.rowId=e.rowId,n}}])}(K);S(J,`blotName`,z.tableRow),S(J,`tagName`,`tr`),S(J,`className`,`ql-table-row`);var Y=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`insertRow`,value:function(e){var t=H(this,z.tableMain);if(t){var n=t.getColIds(),r=this.descendants(J),i=new Set(n),a=0,o=x(r),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;if(a===e)break;c.foreachCellInner(function(t){if(a+t.rowspan>e&&(t.rowspan+=1,i.delete(t.colId),t.colspan!==1))for(var r=n.indexOf(t.colId),o=0;o<t.colspan-1;o++)i.delete(n[r+o+1])}),a+=1}}catch(e){o.e(e)}finally{o.f()}var l=t.tableId,u=G(),d=this.scroll.create(z.tableRow,{tableId:l,rowId:u}),f=x(i),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,h=this.scroll.create(`break`),g=h.wrap(`block`),_=g.wrap(z.tableCellInner,{tableId:l,rowId:u,colId:m,rowspan:1,colspan:1}),v=_.wrap(z.tableCell,{tableId:l,rowId:u,colId:m,rowspan:1,colspan:1});d.appendChild(v)}}catch(e){f.e(e)}finally{f.f()}this.insertBefore(d,r[e]||null)}}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent;if(n!==null&&n.statics.blotName!==z.tableMain){var r=this.tableId;this.wrap(z.tableMain,{tableId:r})}I(t,`optimize`,this,3)([e])}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e,n}}])}(K);S(Y,`blotName`,z.tableBody),S(Y,`tagName`,`tbody`);var sr=t.default.import(`parchment`),cr=t.default.import(`blots/block`),lr=t.default.import(`blots/container`),ur=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`replaceWith`,value:function(e,t){var n=Ae(e)?this.scroll.create(e,t):e;if(n instanceof sr.ParentBlot)if(n.statics.blotName===z.tableCellInner){try{var r=H(this,z.tableCellInner),i=r.formats(),a=n.formats(),o=Object.keys(i);if(o.every(function(e){return JSON.stringify(i[e])===JSON.stringify(a[e])}))return r}catch(e){}var s=this.parent;if(s.statics.blotName===z.tableCellInner){if(s!=null&&s.insertBefore(n,this.prev?null:this.next),s.statics.blotName===z.tableCellInner)for(var c=this;c;){var l=c.next;n.appendChild(c),c=l}else n.appendChild(this);if(s&&s.length()===0){s.remove(),s.parent.statics.blotName===z.tableCell&&s.parent.length()===0&&s.parent.remove();var u=s.parent.parent;u.statics.blotName===z.tableRow&&u.children.length===0&&u.remove()}}else s instanceof lr?s.parent.insertBefore(n,s):s!=null&&s.insertBefore(n,this.next),n.appendChild(this);return n}else this.moveChildren(n);return this.parent!=null&&(this.parent.insertBefore(n,this.next),this.remove()),this.attributes.copy(n),n}},{key:`format`,value:function(e,n){if(e===z.tableCellInner&&this.parent.statics.blotName===e&&!n)try{var r=H(this,z.tableCellInner);r.unwrap()}catch(e){console.error(`unwrap TableCellInner error`)}else I(t,`format`,this,3)([e,n])}}])}(cr),dr=t.default.import(`blots/block/embed`),fr=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`delta`,value:function(){var e=I(t,`delta`,this,3)([]),n=pr(this);return n[z.tableCellInner]&&e.insert(`
|
|
5
|
+
`,S({},z.tableCellInner,n[z.tableCellInner])),e}},{key:`length`,value:function(){var e=pr(this);return e[z.tableCellInner]&&(!this.next||this.next.length()<=1)?I(t,`length`,this,3)([])+1:I(t,`length`,this,3)([])}}])}(dr);function pr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e==null||(`formats`in e&&typeof e.formats==`function`&&(t=M(M({},t),e.formats()),n&&delete t[`code-token`]),e.parent==null||e.parent.statics.blotName===`scroll`||e.parent.statics.scope!==e.statics.scope)?t:pr(e.parent,t,n)}var mr=t.default.import(`parchment`),hr=t.default.import(`blots/scroll`),gr=function(e){function n(){return v(this,n),_(this,n,arguments)}return T(n,e),b(n,[{key:`enable`,value:function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=t.default.import(`formats/${z.tableCellInner}`),i=this.domNode.querySelectorAll(`.${r.className}`),a=0,o=Array.from(i);a<o.length;a++){var s=o[a];s.setAttribute(`contenteditable`,String(!!e))}for(var c=t.default.import(`formats/${z.tableCaption}`),l=this.domNode.querySelectorAll(`.${c.className}`),u=0,d=Array.from(l);u<d.length;u++){var f=d[u];f.setAttribute(`contenteditable`,String(!!e))}I(n,`enable`,this,3)([e])}},{key:`createBlock`,value:function(e,t){var n,r={};if(e[z.tableCellInner])n=z.tableCellInner;else for(var i=0,a=Object.entries(e);i<a.length;i++){var o=F(a[i],2),s=o[0],c=o[1],l=this.query(s,mr.Scope.BLOCK&mr.Scope.BLOT)!=null;l?n=s:r[s]=c}n===z.tableCellInner&&(r=M({},e),delete r[n]);var u=this.create(n||this.statics.defaultChild.blotName,n?e[n]:void 0);this.insertBefore(u,t||void 0);var d=u.length();u instanceof q&&d===0&&(d+=1);for(var f=0,p=Object.entries(r);f<p.length;f++){var m=F(p[f],2),h=m[0],g=m[1];u.formatAt(0,d,h,g)}return u}}])}(hr),_r=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">\r
|
|
2
6
|
<!-- Icon from Tabler Icons by Paweł Kuna - https://github.com/tabler/tabler-icons/blob/master/LICENSE -->\r
|
|
3
7
|
<path\r
|
|
4
8
|
fill="none"\r
|
|
@@ -9,10 +13,10 @@
|
|
|
9
13
|
d="M7 3v18m3-15L7 3L4 6m16 12l-3 3l-3-3m3 3V3"\r
|
|
10
14
|
/>\r
|
|
11
15
|
</svg>\r
|
|
12
|
-
|
|
13
|
-
`),n=e.pop(),r=b(this,u.tableColgroup),i=r.next,a=this.scroll,o=r.split(this.offset(r));if(i){let e=i.descendants(U);if(e.length>0){let t=e[0],n=U.formats(t.domNode),i=this.scroll.create(u.tableCellInner,n),s=i.wrap(u.tableCell,n),c=s.wrap(u.tableRow,n),l=c.wrap(u.tableBody,n.tableId);r.parent.insertBefore(l,o),a=i}}for(let t of e){let e=this.scroll.create(`block`);e.insertAt(0,t),a.appendChild(e)}if(n){let e=this.scroll.create(`block`);e.appendChild(this.scroll.create(`text`,n)),a.appendChild(e)}}catch(e){console.warn(`TableCol not in TableColgroup`)}}};O(J,`blotName`,u.tableCol),O(J,`tagName`,`col`);var Y=class extends H{static create(e){let t=super.create(),{tableId:n,full:r,align:i}=e;return t.dataset.tableId=n,i===`right`||i===`center`?t.dataset.align=i:t.removeAttribute(`date-align`),r&&(t.dataset.full=String(r)),t.setAttribute(`cellpadding`,`0`),t.setAttribute(`cellspacing`,`0`),t}constructor(e,t,n){super(e,t),this.scroll=e,this.updateAlign()}colWidthFillTable(){if(this.full){Object.assign(this.domNode.style,{width:null});return}let e=this.getCols();if(!e)return;let t=e.reduce((e,t)=>t.width+e,0);if(!(t===0||Number.isNaN(t)))return this.domNode.style.width=`${t}px`,t}get tableId(){return this.domNode.dataset.tableId}get full(){return Object.hasOwn(this.domNode.dataset,`full`)}set full(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`),this.colWidthFillTable()}get align(){return this.domNode.dataset.align||``}set align(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`),this.updateAlign()}setFull(){if(this.full)return;let e=this.getCols();if(e.length===0)return;let t=Math.floor(this.domNode.getBoundingClientRect().width);for(let n of e){let e=n.width/t*100;n.full=!0,n.width=e}}cancelFull(){if(!this.full)return;let e=this.getCols();if(e.length===0)return;let t=Math.floor(this.domNode.getBoundingClientRect().width);for(let n of e)n.full=!1,n.width=Math.max(n.width/100*t,d.colMinWidthPx)}updateAlign(){let e=this.align,t={marginLeft:null,marginRight:null};switch(e){case`center`:t.marginLeft=`auto`,t.marginRight=`auto`;break;case``:case`left`:t.marginRight=`auto`;break;case`right`:t.marginLeft=`auto`;break;default:break}Object.assign(this.domNode.style,t)}getRows(){return this.descendants(W)}getRowIds(){return this.getRows().map(e=>e.rowId)}getCols(){return this.descendants(J)}getColIds(){return this.getCols().map(e=>e.colId)}checkMerge(){let e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.domNode.dataset.tableId===this.tableId}optimize(e){let t=this.parent;t!==null&&t.statics.blotName!==u.tableWrapper&&this.wrap(u.tableWrapper,this.tableId),super.optimize(e)}sortMergeChildren(){let e={[u.tableCaption]:[],[u.tableColgroup]:[],[u.tableBody]:[]};this.children.forEach(t=>{e[t.statics.blotName]&&e[t.statics.blotName].push(t)});for(let t of Object.values(e))for(let e=1;e<t.length;e++)t[e].moveChildren(t[0]);let t=e[u.tableCaption][0],n=e[u.tableColgroup][0],r=e[u.tableBody][0],i=t&&this.children.head!==t,a=n&&t&&t.next!==n,o=n&&!t&&this.children.head!==n,s=r&&this.children.tail!==r;if(i||a||o||s){let e=this.clone();t&&e.appendChild(t),n&&e.appendChild(n),r&&e.appendChild(r),this.children.forEach(e=>e.remove()),e.moveChildren(this)}}};O(Y,`blotName`,u.tableMain),O(Y,`tagName`,`table`),O(Y,`className`,`ql-table`);var X=class extends H{static create(e){let t=super.create();return t.dataset.tableId=e.tableId,e.full&&(t.dataset.full=String(e.full)),e.align&&e.align!==`left`&&(t.dataset.align=e.align),t.setAttribute(`contenteditable`,`false`),t}get tableId(){return this.domNode.dataset.tableId}get full(){return Object.hasOwn(this.domNode.dataset,`full`)}set full(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`),this.parent&&this.parent instanceof Y&&(this.parent.full=e)}get align(){return this.domNode.dataset.align||``}set align(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`)}findCol(e){let t=this.children.iterator(),n=0,r;for(;(r=t())&&n!==e;)n++;return r}insertColByIndex(e,t){let n=this.parent;if(!(n instanceof Y))throw TypeError(`TableColgroupFormat should be child of TableFormat`);let r=this.findCol(e),i=this.scroll.create(u.tableCol,t);if(n.full){let e=this.children.iterator(),t;for(;t=e();)if(t.width-i.width>=d.colMinWidthPre){t.width-=i.width;break}}this.insertBefore(i,r)}removeColByIndex(e){let t=this.parent;if(!(t instanceof Y))throw TypeError(`TableColgroupFormat should be child of TableMainFormat`);let n=this.findCol(e);n&&(t.full&&(n.next?n.next.width+=n.width:n.prev&&(n.prev.width+=n.width)),n.remove(),t.colWidthFillTable())}checkMerge(){let e=this.next,t=this.parent;return t instanceof Y&&!t.full&&t.colWidthFillTable(),e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}optimize(e){let t=this.parent,{tableId:n,full:r,align:i}=this;t!=null&&t.statics.blotName!==u.tableMain&&this.wrap(u.tableMain,{tableId:n,full:r,align:i});let a=b(this,u.tableMain);a.align=i,super.optimize(e)}};O(X,`blotName`,u.tableColgroup),O(X,`tagName`,`colgroup`);let Ln=t.default.import(`parchment`);var Z=class extends H{static create(e){let t=super.create();return t.dataset.tableId=e,t.addEventListener(`dragstart`,e=>{e.preventDefault(),e.stopPropagation()},!0),t.addEventListener(`drop`,e=>{e.preventDefault()}),t.addEventListener(`dragover`,e=>{e.preventDefault(),e.dataTransfer.dropEffect=`none`}),t.setAttribute(`contenteditable`,`false`),t}constructor(e,n,r){super(e,n),this.scroll=e,O(this,`insertLineAround`,()=>{(!this.prev||!this.isBlockLine(this.prev))&&this.parent.insertBefore(this.scroll.create(`block`),this),(!this.next||!this.isBlockLine(this.next))&&this.parent.insertBefore(this.scroll.create(`block`),this.next)}),this.scroll.emitter.on(t.default.events.TEXT_CHANGE,this.insertLineAround)}get tableId(){return this.domNode.dataset.tableId}checkMerge(){let e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}deleteAt(e,t){super.deleteAt(e,t);let n=this.descendants(G),r=this.descendants(X);(n.length===0||r.length===0)&&this.remove()}remove(){super.remove(),this.scroll.emitter.off(t.default.events.TEXT_CHANGE,this.insertLineAround)}isBlockLine(e){return e instanceof Ln.BlockBlot||new Set([`list-container`,`code-block-container`]).has(e.statics.blotName)}};O(Z,`blotName`,u.tableWrapper),O(Z,`tagName`,`div`),O(Z,`className`,`ql-table-wrapper`);function Rn(e){let[t]=C(e,G);return{body:t,rect:t.domNode.getBoundingClientRect()}}var zn=class{constructor(e,n,r){this.tableModule=e,this.table=n,this.quill=r,O(this,`tableBlot`,void 0),O(this,`tableWrapperBlot`,void 0),O(this,`alignBox`,void 0),O(this,`cleanup`,void 0),O(this,`bem`,y(`align`)),O(this,`resizeObserver`,fn(()=>this.update(),{ignoreFirstBind:!0})),O(this,`updateWhenTextChange`,()=>{this.update()}),this.tableBlot=t.default.find(n),this.tableWrapperBlot=this.tableBlot.parent,this.alignBox=this.buildTool(),this.resizeObserver.observe(this.table),this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.show()}buildTool(){let e=this.tableModule.addContainer(this.bem.b()),n=t.default.import(`ui/icons`),r={left:n.align[``],center:n.align.center,right:n.align.right};for(let[n,i]of Object.entries(r)){let r=document.createElement(`span`);r.dataset.align=n,r.classList.add(this.bem.be(`item`)),r.innerHTML=`<i class="icon">${i}</i>`,r.addEventListener(`click`,()=>{let e=r.dataset.align;e&&(this.setTableAlign(this.tableBlot,e),this.quill.once(t.default.events.SCROLL_OPTIMIZE,()=>{this.tableModule.tableSelection&&this.tableModule.tableSelection.hide(),this.tableModule.tableResize&&this.tableModule.tableResize.update(),this.tableModule.tableResizeScale&&this.tableModule.tableResizeScale.update(),this.tableModule.tableScrollbar&&this.tableModule.tableScrollbar.update()}))}),e.appendChild(r)}return this.cleanup||(this.cleanup=Zt(this.tableWrapperBlot.domNode,e,()=>this.update())),e}setTableAlign(e,t){let n=e.getCols();for(let e of n)e.align=t}show(){this.alignBox&&(this.alignBox.classList.add(this.bem.bm(`active`)),this.update())}hide(){this.alignBox&&(this.alignBox.classList.remove(this.bem.bm(`active`)),this.cleanup&&(this.cleanup(),this.cleanup=void 0))}update(){if(this.alignBox){if(this.tableBlot.full||this.tableBlot.domNode.offsetWidth>=this.quill.root.offsetWidth){this.hide();return}nn(this.tableWrapperBlot.domNode,this.alignBox,{placement:`top`,middleware:[en(),$t({limiter:tn()}),Qt(16)]}).then(({x:e,y:t})=>{Object.assign(this.alignBox.style,{left:`${e}px`,top:`${t}px`})})}}destroy(){this.hide(),this.resizeObserver.disconnect(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.alignBox&&(this.alignBox.remove(),this.alignBox=void 0)}};let Bn=[`style`],Vn=[`attributes`],Hn=[`attributes`],Un=[`background`],Wn=t.default.import(`delta`),Gn=t.default.import(`modules/clipboard`);function Kn(e){let t=Number.parseFloat(e.getAttribute(`width`)||String(d.colDefaultWidth));if(Number.isNaN(t)){let n=e.style.width;t=n?Number.parseFloat(n):e.offsetWidth}return t}function qn(e,t){let n=Array(t).fill(d.colDefaultWidth),r=Array.from(e.querySelectorAll(`tr`));for(let e of r){let r=Array.from(e.querySelectorAll(`td`));for(let[e,i]of r.entries())if(e<t){let t=Kn(i);n[e]=t||n[e]}else break}return n}var Jn=class extends Gn{constructor(e,t){super(e,t),this.quill=e,O(this,`tableId`,V()),O(this,`rowId`,V()),O(this,`rowIds`,[]),O(this,`colIds`,[]),O(this,`emptyRowCount`,[]),O(this,`rowspanCount`,[]),O(this,`cellCount`,0),O(this,`colCount`,0),this.addMatcher(`table`,this.matchTable.bind(this)),this.addMatcher(`tbody`,this.matchTbody.bind(this)),this.addMatcher(`colgroup`,this.matchColgroup.bind(this)),this.addMatcher(`col`,this.matchCol.bind(this)),this.addMatcher(`tr`,this.matchTr.bind(this)),this.addMatcher(`td`,this.matchTd.bind(this)),this.addMatcher(`th`,this.matchTd.bind(this)),this.addMatcher(`caption`,this.matchCaption.bind(this)),this.addMatcher(Node.ELEMENT_NODE,this.matchTdAttributor.bind(this))}matchTable(e,t){if(t.ops.length===0)return t;let n=this.emptyRowCount.reduce((e,t)=>{var n;return e.push(((n=e[e.length-1])==null?0:n)+t),e},[]),r=[],i=[],a=-1;for(let e=0;e<t.ops.length;e++){let{attributes:o,insert:s}=t.ops[e],c=o||{},l=u.tableCell,{table:d,[l]:f}=c,p=N(c,[`table`,l].map(Ce)),m=de(s)&&s[u.tableCol];if(m)i.push({insert:s});else if(p[u.tableCellInner]){let e=p[u.tableCellInner],t=this.rowIds.indexOf(e.rowId);if(t!==-1){let r=e.rowspan;e.rowspan-=n[t+r-1]-n[t]}r.push({attributes:k(k({},p),{},{[u.tableCellInner]:e}),insert:s})}else r.push({attributes:p,insert:s});!(p!=null&&p[u.tableCellInner])&&!(p!=null&&p[u.tableCaption])&&!m&&le(s)&&s.trim().length>0&&(a=e)}let o=qn(e,this.colIds.length),s=o.reduce((e,t,n)=>(i[n]?e.push(i[n]):e.push({insert:{[u.tableCol]:{tableId:this.tableId,colId:this.colIds[n],width:t,full:!1}}}),e),[]);return r.splice(a+1,0,...s),this.tableId=V(),this.rowIds=[],this.colIds=[],this.emptyRowCount=[],this.rowspanCount=[],this.cellCount=0,this.colCount=0,new Wn(r)}matchTbody(e,t){let n=e.style.backgroundColor;if(n)for(let e of t.ops){var r;if((r=e.attributes)!=null&&r[u.tableCellInner]){let t=e.attributes[u.tableCellInner],{style:r}=t,i=N(t,Bn),a=mn(r||``);a.backgroundColor||(a.backgroundColor=n,e.attributes[u.tableCellInner]=k(k({},i),{},{style:hn(a)}))}}return t}matchColgroup(e,t){let n=[];for(let e=0;e<t.ops.length;e++){let r=t.ops[e];r&&de(r.insert)&&r.insert[u.tableCol]&&n.push(r)}return new Wn(n)}matchCol(e,t){let n=Number(e.getAttribute(`span`)||1);Number.isNaN(n)&&(n=1);let r=new Wn;for(let t=0;t<n;t++)this.colIds[this.colCount]=V(),r.insert({[u.tableCol]:Object.assign(J.value(e),{tableId:this.tableId,colId:this.colIds[this.colCount]})}),this.colCount+=1;return r}matchTr(e,t){this.rowIds.push(this.rowId),this.rowId=V(),this.cellCount=0;for(let[e,t]of this.rowspanCount.entries())t.rowspan>0&&--t.rowspan,t.rowspan<=0&&(this.rowspanCount[e]={rowspan:0,colspan:0});let n=!0;for(let e of t.ops)if(e.attributes){let{background:t,[u.tableCellInner]:r}=e.attributes;if(r||(n=!1),r&&t){let{style:n=``}=r,i=mn(n);i.backgroundColor=t,e.attributes[u.tableCellInner].style=hn(i)}}else n=!1;let r=0;return n||(r=1,t=new Wn),this.emptyRowCount.push(r),t}matchTd(e,t){let n=e,r=q.formats(n);if(!this.colIds[this.cellCount]||!this.rowspanCount[this.cellCount])for(let e=this.cellCount;e>=0;e--)this.colIds[e]||(this.colIds[e]=V()),this.rowspanCount[e]||(this.rowspanCount[e]={rowspan:0,colspan:0});for(let e=this.cellCount;e<this.rowspanCount.length;e++){let{rowspan:t,colspan:n}=this.rowspanCount[e];if(t===0)break;this.cellCount+=n}r.rowspan>1&&(this.rowspanCount[this.cellCount]={rowspan:r.rowspan,colspan:r.colspan});let i=this.colIds[this.cellCount];this.cellCount+=r.colspan;let a=Object.assign(r,{tableId:this.tableId,rowId:this.rowId,colId:i});n.style.border===`none`&&(a.style=a.style.replaceAll(RegExp(`border-(top|right|bottom|left)-style:none;?`,`g`),``));let o=[];for(let e of t.ops){let{attributes:t={}}=e,n=N(e,Vn),r=u.tableCell,{[r]:i}=t,s=N(t,[r].map(Ce));o.push(k(k({},n),{},{attributes:k(k({},s),{},{[u.tableCellInner]:a})}))}return(o.length<=0||!le(o[o.length-1].insert)||!o[o.length-1].insert.endsWith(`
|
|
14
|
-
`))&&
|
|
15
|
-
`,attributes:{
|
|
16
|
+
`,vr=t.default.import(`parchment`),yr=t.default.import(`blots/inline`),br=t.default.import(`blots/text`),xr=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n]),n.setAttribute(`contenteditable`,String(e.isEnabled())),i.attachUI(i.createUI()),i.domNode.addEventListener(`mouseenter`,function(){i.scroll.isEnabled()&&(i.uiNode.style.display=`flex`)}),i.domNode.addEventListener(`mouseleave`,function(){i.scroll.isEnabled()&&(i.uiNode.style.display=`none`)}),i.uiNode.style.display=`none`,i}return T(t,e),b(t,[{key:`createUI`,value:function(){var e=this,t=document.createElement(`i`);return t.classList.add(`ql-table-caption--switch`),t.innerHTML=_r,t.addEventListener(`click`,function(){e.scroll.isEnabled()&&(e.side=e.side===`top`?`bottom`:`top`)}),t}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`side`,get:function(){return this.domNode.style.captionSide===`bottom`?`bottom`:`top`},set:function(e){this.domNode.style.captionSide=e===`bottom`?`bottom`:`top`}},{key:`format`,value:function(e,n){var r=this.scroll.query(e,vr.Scope.BLOCK_BLOT);(!r||e===this.statics.blotName)&&I(t,`format`,this,3)([e,n])}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent;if(n!==null&&n.statics.blotName!==z.tableMain){var r=this.tableId;this.wrap(z.tableMain,{tableId:r})}this.children.length===0?this.remove():(I(t,`optimize`,this,3)([e]),this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove()))}}],[{key:`create`,value:function(e){var n=e.tableId,r=I(t,`create`,this,2)([]);return r.dataset.tableId=n,e.side===`bottom`&&(r.style.captionSide=`bottom`),r}},{key:`formats`,value:function(e){var t=e.dataset.tableId,n={tableId:String(t),side:e.style.captionSide===`bottom`?`bottom`:`top`};return n}}])}(ur);S(xr,`blotName`,z.tableCaption),S(xr,`tagName`,`caption`),S(xr,`className`,`ql-table-caption`),S(xr,`allowedChildren`,[yr,br]);var X=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`setFormatValue`,value:function(e,t){if(this.statics.allowAttrs.has(e)||this.statics.allowDataAttrs.has(e)){var n=e;this.statics.allowDataAttrs.has(e)&&(n=`data-${e}`),t?this.domNode.setAttribute(n,t):this.domNode.removeAttribute(n)}else this.statics.isAllowStyle(e)&&(Object.assign(this.domNode.style,S({},e,t)),e.startsWith(`border`)&&this.setStyleBoder(e,t));var r=this.children.head;this.domNode.style.cssText&&r&&r.statics.blotName===z.tableCellInner&&this.domNode.style.cssText!==r.domNode.dataset.style&&(r.domNode.dataset.style=this.domNode.style.cssText)}},{key:`setStyleBoder`,value:function(e,t){var n=t||null,r=![`left`,`right`,`top`,`bottom`].some(function(t){return e.includes(t)})&&e.startsWith(`border-`);if(r){var i=this.getNearByCell(`left`).map(function(e){return e.descendant(q,0)[0]}).filter(Boolean),a=x(i),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;s.setFormatValue(e.replace(`border-`,`border-right-`),n,!0)}}catch(e){a.e(e)}finally{a.f()}var c=this.getNearByCell(`top`).map(function(e){return e.descendant(q,0)[0]}).filter(Boolean),l=x(c),u;try{for(l.s();!(u=l.n()).done;){var d=u.value;d.setFormatValue(e.replace(`border-`,`border-bottom-`),n,!0)}}catch(e){l.e(e)}finally{l.f()}}}},{key:`getNearByCell`,value:function(e){var t=[];try{var n=H(this,z.tableMain);t.push.apply(t,L(n.getColIds()))}catch(e){console.error(`Cell is not in table! ${e}`)}if(t.length===0)return[];if(e===`left`){for(var r=new Set,i=this.parent,a=0;a<this.rowspan&&i instanceof J;a++){for(var o=i.children.iterator(),s=null;s=o();){var c=t.indexOf(s.colId)+s.colspan;this.colId===t[c]&&r.add(s)}i=i.next}return Array.from(r)}else if(e===`top`){if(!(this.parent instanceof J)||!this.parent.prev)return[];for(var l=new Set,u=this.getColumnIndex(),d=u+this.colspan,f=new Set(t.filter(function(e,t){return t>=u&&t<d})),p=1,m=this.parent.prev;m;){for(var h=!1,g=m.children.iterator(),_=null,v=0;_=g();)f.has(_.colId)&&_.rowspan>=p&&(l.add(_),f.delete(_.colId)),v+=_.colspan,_.rowspan>=p&&(h=!0);if(!h&&v===t.length)break;m=m.prev,p+=1}return Array.from(l)}return[]}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`rowId`,get:function(){return this.domNode.dataset.rowId}},{key:`colId`,get:function(){return this.domNode.dataset.colId}},{key:`rowspan`,get:function(){return Number(this.domNode.getAttribute(`rowspan`))}},{key:`colspan`,get:function(){return Number(this.domNode.getAttribute(`colspan`))}},{key:`emptyRow`,get:function(){try{return JSON.parse(this.domNode.dataset.emptyRow)}catch(e){return[]}}},{key:`getColumnIndex`,value:function(){var e=H(this,z.tableMain);return e.getColIds().indexOf(this.colId)}},{key:`getCellInner`,value:function(){return this.children.head}},{key:`checkMerge`,value:function(){var e=this.colId,t=this.rowId,n=this.colspan,r=this.rowspan,i=this.next;return i!==null&&i.statics.blotName===this.statics.blotName&&i.rowId===t&&i.colId===e&&i.colspan===n&&i.rowspan===r}},{key:`optimize`,value:function(e){var n=this.parent,r=this.tableId,i=this.rowId;if(n!==null&&n.statics.blotName!==z.tableRow&&this.wrap(z.tableRow,{tableId:r,rowId:i}),this.emptyRow.length>0){var a=x(this.emptyRow),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;this.parent.parent.insertBefore(this.scroll.create(z.tableRow,{tableId:this.tableId,rowId:s}),this.parent.next)}}catch(e){a.e(e)}finally{a.f()}}I(t,`optimize`,this,3)([e])}}],[{key:`isAllowStyle`,value:function(e){var t=Qn(e),n=x(this.allowStyle),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(t.startsWith(Qn(i)))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:`create`,value:function(e){var n=e.tableId,r=e.rowId,i=e.colId,a=e.rowspan,o=e.colspan,s=e.style,c=e.emptyRow,l=I(t,`create`,this,2)([]);l.dataset.tableId=n,l.dataset.rowId=r,l.dataset.colId=i,l.setAttribute(`rowspan`,String(ir(a))),l.setAttribute(`colspan`,String(ir(o))),s&&(l.style.cssText=s);try{c&&(l.dataset.emptyRow=JSON.stringify(c))}catch(e){}return l}},{key:`formats`,value:function(e){for(var t=e.dataset,n=t.tableId,r=t.rowId,i=t.colId,a=t.emptyRow,o=Number(e.getAttribute(`rowspan`)),s=Number(e.getAttribute(`colspan`)),c={tableId:n,rowId:r,colId:i,rowspan:ir(o),colspan:ir(s)},l={},u=0;u<e.style.length;u++){var d=e.style[u],f=e.style[d];this.isAllowStyle(String(d))&&![`initial`,`inherit`].includes(f)&&(l[d]=f)}var p=Object.entries(l);p.length>0&&(c.style=p.map(function(e){var t=F(e,2),n=t[0],r=t[1];return`${n}: ${r}`}).join(`;`));try{a&&(c.emptyRow=JSON.parse(a))}catch(e){}return c}}])}(K);S(X,`blotName`,z.tableCell),S(X,`tagName`,`td`),S(X,`className`,`ql-table-cell`),S(X,`allowDataAttrs`,new Set([`table-id`,`row-id`,`col-id`,`empty-row`])),S(X,`allowAttrs`,new Set([`rowspan`,`colspan`])),S(X,`allowStyle`,new Set([`background-color`,`border`,`height`]));var Sr=t.default.import(`blots/block/embed`),Cr=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`width`,get:function(){var e=this.domNode.getAttribute(`width`);if(!e){if(e=this.domNode.getBoundingClientRect().width,this.full){var t=this.domNode.closest(`table`);return t?e/100*t.getBoundingClientRect().width:B[this.full?`colMinWidthPre`:`colMinWidthPx`]}return e}return Number.parseFloat(String(e))},set:function(e){var t=Number.parseFloat(String(e));Number.isNaN(t)&&(t=B[this.full?`colMinWidthPre`:`colMinWidthPx`]),this.domNode.setAttribute(`width`,this.statics.validWidth(t,!!this.full))}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`colId`,get:function(){return this.domNode.dataset.colId}},{key:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`)}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`)}},{key:`checkMerge`,value:function(){var e=this.next,t=this.tableId,n=this.colId;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===t&&e.colId===n}},{key:`optimize`,value:function(e){var n=this.parent;if(n!=null&&n.statics.blotName!==z.tableColgroup){var r=this.statics.value(this.domNode);this.wrap(z.tableColgroup,r)}var i=H(this,z.tableColgroup);i.align=this.align,this.next!=null&&this.checkMerge()&&this.next.remove(),I(t,`optimize`,this,3)([e]);try{var a=H(this,z.tableColgroup),o=!0;a.children.forEach(function(e){o&&(o=e.full)}),a.full=o}catch(e){}}},{key:`insertAt`,value:function(e,n,r){if(r!=null){I(t,`insertAt`,this,3)([e,n,r]);return}try{var i=n.split(`
|
|
17
|
+
`),a=i.pop(),o=H(this,z.tableColgroup),s=o.next,c=this.scroll,l=o.split(this.offset(o));if(s){var u=s.descendants(q);if(u.length>0){var d=u[0],f=q.formats(d.domNode),p=this.scroll.create(z.tableCellInner,f),m=p.wrap(z.tableCell,f),h=m.wrap(z.tableRow,f),g=h.wrap(z.tableBody,f.tableId);o.parent.insertBefore(g,l),c=p}}var _=x(i),v;try{for(_.s();!(v=_.n()).done;){var y=v.value,b=this.scroll.create(`block`);b.insertAt(0,y),c.appendChild(b)}}catch(e){_.e(e)}finally{_.f()}if(a){var S=this.scroll.create(`block`);S.appendChild(this.scroll.create(`text`,a)),c.appendChild(S)}}catch(e){console.warn(`TableCol not in TableColgroup`)}}}],[{key:`validWidth`,value:function(e,t){var n=Number.parseFloat(String(e));return Number.isNaN(n)&&(n=B[t?`colMinWidthPre`:`colMinWidthPx`]),`${n}${t?`%`:`px`}`}},{key:`create`,value:function(e){var n=e.width,r=e.tableId,i=e.colId,a=e.full,o=e.align,s=I(t,`create`,this,2)([]);return s.setAttribute(`width`,this.validWidth(n,!!a)),a&&(s.dataset.full=String(a)),o&&o!==`left`&&(s.dataset.align=o),s.dataset.tableId=r,s.dataset.colId=i,s}},{key:`value`,value:function(e){var t=e.dataset,n=t.tableId,r=t.colId,i=e.getAttribute(`width`)||String(B.colDefaultWidth),a=e.dataset.align,o=Object.hasOwn(e.dataset,`full`),s={tableId:String(n),colId:String(r),full:o,width:Number.parseFloat(i)};return a&&(s.align=a),s}}])}(Sr);S(Cr,`blotName`,z.tableCol),S(Cr,`tagName`,`col`);var Z=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n]),S(i,`scroll`,void 0),i.scroll=e,i.updateAlign(),i}return T(t,e),b(t,[{key:`colWidthFillTable`,value:function(){if(this.full){Object.assign(this.domNode.style,{width:null});return}var e=this.getCols();if(e){var t=e.reduce(function(e,t){return t.width+e},0);if(!(t===0||Number.isNaN(t)))return this.domNode.style.width=`${t}px`,t}}},{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`),this.colWidthFillTable()}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`),this.updateAlign()}},{key:`setFull`,value:function(){if(!this.full){var e=this.getCols();if(e.length!==0){var t=Math.floor(this.domNode.getBoundingClientRect().width),n=x(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.width/t*100;i.full=!0,i.width=a}}catch(e){n.e(e)}finally{n.f()}}}}},{key:`cancelFull`,value:function(){if(this.full){var e=this.getCols();if(e.length!==0){var t=Math.floor(this.domNode.getBoundingClientRect().width),n=x(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.full=!1,i.width=Math.max(i.width/100*t,B.colMinWidthPx)}}catch(e){n.e(e)}finally{n.f()}}}}},{key:`updateAlign`,value:function(){var e=this.align,t={marginLeft:null,marginRight:null};switch(e){case`center`:t.marginLeft=`auto`,t.marginRight=`auto`;break;case``:case`left`:t.marginRight=`auto`;break;case`right`:t.marginLeft=`auto`;break;default:break}Object.assign(this.domNode.style,t)}},{key:`getRows`,value:function(){var e=this;return Array.from(this.domNode.querySelectorAll(`${J.tagName}`)).map(function(t){return e.scroll.find(t)}).filter(Boolean)}},{key:`getRowIds`,value:function(){return this.getRows().map(function(e){return e.rowId})}},{key:`getCols`,value:function(){return this.descendants(Cr)}},{key:`getColIds`,value:function(){return this.getCols().map(function(e){return e.colId})}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.domNode.dataset.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent;n!==null&&n.statics.blotName!==z.tableWrapper&&this.wrap(z.tableWrapper,this.tableId),I(t,`optimize`,this,3)([e]),this.mergeRow()}},{key:`mergeRow`,value:function(){if(this.parent){var e=this.getRows(),t={},n=x(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;t[i.rowId]||(t[i.rowId]=[]),t[i.rowId].push(i)}}catch(e){n.e(e)}finally{n.f()}for(var a=0,o=Object.values(t);a<o.length;a++)for(var s=o[a],c=1;c<s.length;c++){var l=s[c];l.moveChildren(s[0]),l.remove()}}}},{key:`checkEmptyCol`,value:function(e){if(e){var t=this.getRows().length,n=this.getCols(),r=this.descendants(q),i=x(r),a;try{var o=function(){var e=a.value;if(e.colspan>1&&e.rowspan>=t){for(var r=n.findIndex(function(t){return t.colId===e.colId}),i=n[r],o=r+1;o<r+e.colspan;o++)n[o].remove(),i.width+=n[o].width;e.colspan=1}};for(i.s();!(a=i.n()).done;)o()}catch(e){i.e(e)}finally{i.f()}}}},{key:`checkEmptyRow`,value:function(e){for(var t=this,n=this.getRows(),r=new Set(n.map(function(e){return e.rowId})),i=function(){var i=n[a];if(e){if(i.children.length===0){for(var o=function(e){var t=n[c];t.foreachCellInner(function(t){if(t.rowspan>e){--t.rowspan;var n=new Set(t.emptyRow);n.delete(i.rowId),t.emptyRow=Array.from(n)}})},s=1,c=a-1;c>=0;c--,s++)o(s);i.remove()}}else{if(i.children.length===0&&i.prev){for(var l=i.prev;l&&l.children.length===0;)l=l.prev;l.foreachCellInner(function(e){var t=new Set(e.emptyRow);t.has(i.rowId)||(e.emptyRow=[i.rowId].concat(L(t)))})}i.foreachCellInner(function(e){var n=x(e.emptyRow),a;try{for(n.s();!(a=n.n()).done;){var o=a.value;r.has(o)||i.parent.insertBefore(t.scroll.create(z.tableRow,{tableId:t.tableId,rowId:o}),i.next)}}catch(e){n.e(e)}finally{n.f()}})}},a=n.length-1;a>=0;a--)i()}},{key:`sortMergeChildren`,value:function(){var e=S(S(S({},z.tableCaption,[]),z.tableColgroup,[]),z.tableBody,[]);this.children.forEach(function(t){e[t.statics.blotName]&&e[t.statics.blotName].push(t)});for(var t=0,n=Object.values(e);t<n.length;t++)for(var r=n[t],i=1;i<r.length;i++)r[i].moveChildren(r[0]);var a=e[z.tableCaption][0],o=e[z.tableColgroup][0],s=e[z.tableBody][0],c=a&&this.children.head!==a,l=o&&a&&a.next!==o,u=o&&!a&&this.children.head!==o,d=s&&this.children.tail!==s;if(c||l||u||d){var f=this.clone();a&&f.appendChild(a),o&&f.appendChild(o),s&&f.appendChild(s),this.children.forEach(function(e){return e.remove()}),f.moveChildren(this)}}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]),r=e.tableId,i=e.full,a=e.align;return n.dataset.tableId=r,a===`right`||a===`center`?n.dataset.align=a:n.removeAttribute(`date-align`),i&&(n.dataset.full=String(i)),n.setAttribute(`cellpadding`,`0`),n.setAttribute(`cellspacing`,`0`),n}}])}(K);S(Z,`blotName`,z.tableMain),S(Z,`tagName`,`table`),S(Z,`className`,`ql-table`);var wr=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,[{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`full`,get:function(){return Object.hasOwn(this.domNode.dataset,`full`)},set:function(e){e?this.domNode.dataset.full=`true`:this.domNode.removeAttribute(`data-full`),this.parent&&this.parent instanceof Z&&(this.parent.full=e)}},{key:`align`,get:function(){return this.domNode.dataset.align||``},set:function(e){e===`right`||e===`center`?this.domNode.dataset.align=e:this.domNode.removeAttribute(`data-align`)}},{key:`findCol`,value:function(e){for(var t=this.children.iterator(),n=0,r;(r=t())&&n!==e;)n++;return r}},{key:`insertColByIndex`,value:function(e,t){var n=this.parent;if(!(n instanceof Z))throw TypeError(`TableColgroupFormat should be child of TableFormat`);var r=this.findCol(e),i=this.scroll.create(z.tableCol,t);if(n.full){for(var a=this.children.iterator(),o;o=a();)if(o.width-i.width>=B.colMinWidthPre){o.width-=i.width;break}}this.insertBefore(i,r)}},{key:`removeColByIndex`,value:function(e){var t=this.parent;if(!(t instanceof Z))throw TypeError(`TableColgroupFormat should be child of TableMainFormat`);var n=this.findCol(e);n&&(t.full&&(n.next?n.next.width+=n.width:n.prev&&(n.prev.width+=n.width)),n.remove(),t.colWidthFillTable())}},{key:`checkMerge`,value:function(){var e=this.next,t=this.parent;return t instanceof Z&&!t.full&&t.colWidthFillTable(),e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`optimize`,value:function(e){var n=this.parent,r=this.tableId,i=this.full,a=this.align;n!=null&&n.statics.blotName!==z.tableMain&&this.wrap(z.tableMain,{tableId:r,full:i,align:a});var o=H(this,z.tableMain);o.align=a,I(t,`optimize`,this,3)([e])}}],[{key:`create`,value:function(e){var n=I(t,`create`,this,2)([]);return n.dataset.tableId=e.tableId,e.full&&(n.dataset.full=String(e.full)),e.align&&e.align!==`left`&&(n.dataset.align=e.align),n.setAttribute(`contenteditable`,`false`),n}}])}(K);S(wr,`blotName`,z.tableColgroup),S(wr,`tagName`,`colgroup`);var Tr=t.default.import(`parchment`),Er=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,r]),S(a,`scroll`,void 0),S(a,`insertLineAround`,function(){(!a.prev||!a.isBlockLine(a.prev))&&a.parent.insertBefore(a.scroll.create(`block`),a),(!a.next||!a.isBlockLine(a.next))&&a.parent.insertBefore(a.scroll.create(`block`),a.next)}),a.scroll=e,a.scroll.emitter.on(t.default.events.TEXT_CHANGE,a.insertLineAround),a}return T(n,e),b(n,[{key:`tableId`,get:function(){return this.domNode.dataset.tableId}},{key:`checkMerge`,value:function(){var e=this.next;return e!==null&&e.statics.blotName===this.statics.blotName&&e.tableId===this.tableId}},{key:`deleteAt`,value:function(e,t){I(n,`deleteAt`,this,3)([e,t]);var r=this.descendants(Y),i=this.descendants(wr);(r.length===0||i.length===0)&&this.remove()}},{key:`remove`,value:function(){I(n,`remove`,this,3)([]),this.scroll.emitter.off(t.default.events.TEXT_CHANGE,this.insertLineAround)}},{key:`isBlockLine`,value:function(e){return e instanceof Tr.BlockBlot||new Set([`list-container`,`code-block-container`]).has(e.statics.blotName)}}],[{key:`create`,value:function(e){var t=I(n,`create`,this,2)([]);return t.dataset.tableId=e,t.addEventListener(`dragstart`,function(e){e.preventDefault(),e.stopPropagation()},!0),t.addEventListener(`drop`,function(e){e.preventDefault()}),t.addEventListener(`dragover`,function(e){e.preventDefault(),e.dataTransfer.dropEffect=`none`}),t.setAttribute(`contenteditable`,`false`),t}}])}(K);S(Er,`blotName`,z.tableWrapper),S(Er,`tagName`,`div`),S(Er,`className`,`ql-table-wrapper`);function Dr(e){var t=_e(e,Y),n=F(t,1),r=n[0];return r?{body:r,rect:r.domNode.getBoundingClientRect()}:{body:null,rect:null}}var Or=function(){function e(n,r,i){var a=this;v(this,e),S(this,`tableModule`,void 0),S(this,`table`,void 0),S(this,`quill`,void 0),S(this,`tableBlot`,void 0),S(this,`tableWrapperBlot`,void 0),S(this,`alignBox`,void 0),S(this,`cleanup`,void 0),S(this,`bem`,V(`align`)),S(this,`resizeObserver`,Gn(function(){return a.update()},{ignoreFirstBind:!0})),S(this,`updateWhenTextChange`,function(){a.update()}),this.tableModule=n,this.table=r,this.quill=i,this.tableBlot=t.default.find(r),this.tableWrapperBlot=this.tableBlot.parent,this.alignBox=this.buildTool(),this.resizeObserver.observe(this.table),this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.show()}return b(e,[{key:`buildTool`,value:function(){for(var e=this,n=this.tableModule.addContainer(this.bem.b()),r=t.default.import(`ui/icons`),i={left:r.align[``],center:r.align.center,right:r.align.right},a=function(){var r=F(s[o],2),i=r[0],a=r[1],c=document.createElement(`span`);c.dataset.align=i,c.classList.add(e.bem.be(`item`)),c.innerHTML=`<i class="icon">${a}</i>`,c.addEventListener(`click`,function(){var n=c.dataset.align;n&&(e.setTableAlign(e.tableBlot,n),e.quill.once(t.default.events.SCROLL_OPTIMIZE,function(){e.tableModule.tableSelection&&e.tableModule.tableSelection.hide(),e.tableModule.tableResize&&e.tableModule.tableResize.update(),e.tableModule.tableResizeScale&&e.tableModule.tableResizeScale.update(),e.tableModule.tableScrollbar&&e.tableModule.tableScrollbar.update()}))}),n.appendChild(c)},o=0,s=Object.entries(i);o<s.length;o++)a();return this.cleanup||(this.cleanup=jn(this.tableWrapperBlot.domNode,n,function(){return e.update()})),n}},{key:`setTableAlign`,value:function(e,t){var n=e.getCols(),r=x(n),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;a.align=t}}catch(e){r.e(e)}finally{r.f()}}},{key:`show`,value:function(){this.alignBox&&(this.alignBox.classList.add(this.bem.bm(`active`)),this.update())}},{key:`hide`,value:function(){this.alignBox&&(this.alignBox.classList.remove(this.bem.bm(`active`)),this.cleanup&&(this.cleanup(),this.cleanup=void 0))}},{key:`update`,value:function(){var e=this;if(this.alignBox){if(this.tableBlot.full||this.tableBlot.domNode.offsetWidth>=this.quill.root.offsetWidth){this.hide();return}In(this.tableWrapperBlot.domNode,this.alignBox,{placement:`top`,middleware:[Pn(),Nn({limiter:Fn()}),Mn(16)]}).then(function(t){var n=t.x,r=t.y;Object.assign(e.alignBox.style,{left:`${n}px`,top:`${r}px`})})}}},{key:`destroy`,value:function(){this.hide(),this.resizeObserver.disconnect(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.alignBox&&(this.alignBox.remove(),this.alignBox=void 0)}}])}(),kr=[`style`],Ar=[`attributes`],jr=[`attributes`],Mr=[`background`],Nr=t.default.import(`delta`),Pr=t.default.import(`modules/clipboard`);function Fr(e){var t=Number.parseFloat(e.getAttribute(`width`)||String(B.colDefaultWidth));if(Number.isNaN(t)){var n=e.style.width;t=n?Number.parseFloat(n):e.offsetWidth}return t}function Ir(e,t){for(var n=Array(t).fill(B.colDefaultWidth),r=Array.from(e.querySelectorAll(`tr`)),i=0,a=r;i<a.length;i++){var o=a[i],s=Array.from(o.querySelectorAll(`td`)),c=x(s.entries()),l;try{for(c.s();!(l=c.n()).done;){var u=F(l.value,2),d=u[0],f=u[1];if(d<t){var p=Fr(f);n[d]=p||n[d]}else break}}catch(e){c.e(e)}finally{c.f()}}return n}var Lr=function(e){function t(e,n){var r;return v(this,t),r=_(this,t,[e,n]),S(r,`quill`,void 0),S(r,`tableId`,G()),S(r,`rowId`,G()),S(r,`colIds`,[]),S(r,`rowspanCount`,[]),S(r,`cellCount`,0),S(r,`colCount`,0),r.quill=e,r.addMatcher(`table`,r.matchTable.bind(r)),r.addMatcher(`tbody`,r.matchTbody.bind(r)),r.addMatcher(`colgroup`,r.matchColgroup.bind(r)),r.addMatcher(`col`,r.matchCol.bind(r)),r.addMatcher(`tr`,r.matchTr.bind(r)),r.addMatcher(`td`,r.matchTd.bind(r)),r.addMatcher(`th`,r.matchTd.bind(r)),r.addMatcher(`caption`,r.matchCaption.bind(r)),r.addMatcher(Node.ELEMENT_NODE,r.matchTdAttributor.bind(r)),r}return T(t,e),b(t,[{key:`matchTable`,value:function(e,t){var n=this;if(t.ops.length===0)return t;for(var r=[],i=[],a=-1,o=0;o<t.ops.length;o++){var s=t.ops[o],c=s.attributes,l=s.insert;if(!Me(l)&&c&&!c[z.tableCellInner]&&!c[z.tableCaption]){t.ops.splice(o,1),--o;continue}var u=c||{},d=z.tableCell,f=u.table,p=u[d],m=N(u,[`table`,d].map(R)),h=Me(l)&&l[z.tableCol];h?i.push({insert:l}):r.push({attributes:m,insert:l}),!(m!=null&&m[z.tableCellInner])&&!(m!=null&&m[z.tableCaption])&&!h&&Ae(l)&&l.trim().length>0&&(a=o)}var g=Ir(e,this.colIds.length),_=g.reduce(function(e,t,r){return i[r]?e.push(i[r]):e.push({insert:S({},z.tableCol,{tableId:n.tableId,colId:n.colIds[r],width:t,full:!1})}),e},[]);return r.splice.apply(r,[a+1,0].concat(L(_))),this.tableId=G(),this.colIds=[],this.rowspanCount=[],this.cellCount=0,this.colCount=0,new Nr(r)}},{key:`matchTbody`,value:function(e,t){var n=e.style.backgroundColor;if(n){var r=x(t.ops),i;try{for(r.s();!(i=r.n()).done;){var a,o=i.value;if((a=o.attributes)!=null&&a[z.tableCellInner]){var s=o.attributes[z.tableCellInner],c=s.style,l=N(s,kr),u=Yn(c||``);u.backgroundColor||(u.backgroundColor=n,o.attributes[z.tableCellInner]=M(M({},l),{},{style:Xn(u)}))}}}catch(e){r.e(e)}finally{r.f()}}for(var d=[],f=t.ops.length-1;f>=0;f--){var p=t.ops[f];if(p.attributes){if(!p.attributes[z.tableCellInner])d=[],d.push(G());else if(p.attributes[z.tableCellInner].rowspan===1)d=[];else if(d.length>0){var m;p.attributes[z.tableCellInner].emptyRow||(p.attributes[z.tableCellInner].emptyRow=[]),(m=p.attributes[z.tableCellInner].emptyRow).push.apply(m,L(d))}}}return t}},{key:`matchColgroup`,value:function(e,t){for(var n=[],r=0;r<t.ops.length;r++){var i=t.ops[r];i&&Me(i.insert)&&i.insert[z.tableCol]&&n.push(i)}return new Nr(n)}},{key:`matchCol`,value:function(e,t){var n=Number(e.getAttribute(`span`)||1);Number.isNaN(n)&&(n=1);for(var r=new Nr,i=0;i<n;i++)this.colIds[this.colCount]=G(),r.insert(S({},z.tableCol,Object.assign(Cr.value(e),{tableId:this.tableId,colId:this.colIds[this.colCount]}))),this.colCount+=1;return r}},{key:`matchTr`,value:function(e,t){this.rowId=G(),this.cellCount=0;var n=x(this.rowspanCount.entries()),r;try{for(n.s();!(r=n.n()).done;){var i=F(r.value,2),a=i[0],o=i[1];o.rowspan>0&&--o.rowspan,o.rowspan<=0&&(this.rowspanCount[a]={rowspan:0,colspan:0})}}catch(e){n.e(e)}finally{n.f()}var s=x(t.ops),c;try{for(s.s();!(c=s.n()).done;){var l=c.value;if(l.attributes){var u=l.attributes,d=u.background,f=u[z.tableCellInner];if(f&&d){var p=f.style,m=p===void 0?``:p,h=Yn(m);h.backgroundColor=d,l.attributes[z.tableCellInner].style=Xn(h)}}}}catch(e){s.e(e)}finally{s.f()}return t}},{key:`matchTd`,value:function(e,t){var n=e,r=X.formats(n);if(!this.colIds[this.cellCount]||!this.rowspanCount[this.cellCount])for(var i=this.cellCount;i>=0;i--)this.colIds[i]||(this.colIds[i]=G()),this.rowspanCount[i]||(this.rowspanCount[i]={rowspan:0,colspan:0});for(var a=this.cellCount;a<this.rowspanCount.length;a++){var o=this.rowspanCount[a],s=o.rowspan,c=o.colspan;if(s===0)break;this.cellCount+=c}r.rowspan>1&&(this.rowspanCount[this.cellCount]={rowspan:r.rowspan,colspan:r.colspan});var l=this.colIds[this.cellCount];this.cellCount+=r.colspan;var u=Object.assign(r,{tableId:this.tableId,rowId:this.rowId,colId:l});n.style.border===`none`&&(u.style=u.style.replaceAll(RegExp(`border-(top|right|bottom|left)-style:none;?`,`g`),``));var d=[],f=x(t.ops),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,h=m.attributes,g=h===void 0?{}:h,_=N(m,Ar),v=z.tableCell,y=g[v],b=N(g,[v].map(R));d.push(M(M({},_),{},{attributes:M(M({},b),{},S({},z.tableCellInner,u))}))}}catch(e){f.e(e)}finally{f.f()}return(d.length<=0||!Ae(d[d.length-1].insert)||!d[d.length-1].insert.endsWith(`
|
|
18
|
+
`))&&d.push({insert:`
|
|
19
|
+
`,attributes:S({},z.tableCellInner,u)}),new Nr(d)}},{key:`matchTdAttributor`,value:function(e,t){var n=e;if(n.tagName.toLocaleLowerCase()===`td`){var r=[],i=x(t.ops),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,s=o.attributes,c=N(o,jr),l=s==null?void 0:s[z.tableCellInner];if(s&&l&&l.style){var u=s.background,d=N(s,Mr),f=document.createElement(`div`);f.style.background=u;var p=document.createElement(`div`);if(p.style.cssText=l.style,f.style.background===p.style.backgroundColor){r.push(M(M({},c),{},{attributes:M({},d)}));continue}}r.push(o)}}catch(e){i.e(e)}finally{i.f()}return new Nr(r)}return t}},{key:`convert`,value:function(e){var n=e.html,r=e.text,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=I(t,`convert`,this,3)([{html:n,text:r},i]);if(i[z.tableCellInner]){var o=x(a.ops),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;if(Me(c.insert)&&c.insert[z.tableCol]){c.insert=``;continue}c.attributes||(c.attributes={}),c.attributes[z.tableCellInner]=i[z.tableCellInner]}}catch(e){o.e(e)}finally{o.f()}}return a}},{key:`matchCaption`,value:function(e,t){for(var n=0;n<t.ops.length;n++){var r=t.ops[n],i=r.attributes;i&&i[z.tableCaption]&&(i[z.tableCaption].tableId=this.tableId,r.attributes=i)}return t}}])}(Pr),Rr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
16
20
|
<!-- Icon from Tabler Icons by Paweł Kuna - https://github.com/tabler/tabler-icons/blob/master/LICENSE -->
|
|
17
21
|
<path
|
|
18
22
|
fill="none"
|
|
@@ -23,7 +27,7 @@
|
|
|
23
27
|
d="M4 12V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v6m-10 6H3m18 0h-7m-8-3l-3 3l3 3m12-6l3 3l-3 3"
|
|
24
28
|
/>
|
|
25
29
|
</svg>
|
|
26
|
-
`,
|
|
30
|
+
`,zr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
27
31
|
<path
|
|
28
32
|
fill="none"
|
|
29
33
|
stroke="currentColor"
|
|
@@ -33,7 +37,7 @@
|
|
|
33
37
|
d="m4 8l4-4m6 0L4 14m0 6L20 4m0 6L10 20m10-4l-4 4"
|
|
34
38
|
/>
|
|
35
39
|
</svg>
|
|
36
|
-
`,
|
|
40
|
+
`,Br=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
37
41
|
<path
|
|
38
42
|
fill="none"
|
|
39
43
|
stroke="currentColor"
|
|
@@ -43,7 +47,7 @@
|
|
|
43
47
|
d="m12.01 16l-.01.011M12.01 12l-.01.011M12.01 8l-.01.011M8.01 12l-.01.011M16.01 12l-.01.011M21 3.6v16.8a.6.6 0 0 1-.6.6H3.6a.6.6 0 0 1-.6-.6V3.6a.6.6 0 0 1 .6-.6h16.8a.6.6 0 0 1 .6.6"
|
|
44
48
|
/>
|
|
45
49
|
</svg>
|
|
46
|
-
`,
|
|
50
|
+
`,Vr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256">
|
|
47
51
|
<g fill="currentColor">
|
|
48
52
|
<path d="M216 40v128h-48V88H88V40Z" opacity=".2" />
|
|
49
53
|
<path
|
|
@@ -51,86 +55,86 @@
|
|
|
51
55
|
/>
|
|
52
56
|
</g>
|
|
53
57
|
</svg>
|
|
54
|
-
|
|
58
|
+
`,Hr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">
|
|
55
59
|
<path
|
|
56
60
|
fill="currentColor"
|
|
57
61
|
d="m19.05 13.733l-1-1.733l-10.122 5.846l-.997-.576a3 3 0 0 0 .667-.769A3 3 0 1 0 3.5 17.599L5.928 19L3.5 20.402a3.034 3.034 0 1 0 3.44.323l.988-.57L14.59 24l1-1.73L9.928 19zM4.034 15.26a1 1 0 1 1 .466.607a1 1 0 0 1-.466-.607M5 22a1 1 0 1 1-.865 1.5A1 1 0 0 1 5 22m12 4h4v2h-4zm-7 0h4v2h-4z"
|
|
58
62
|
/>
|
|
59
63
|
<path fill="currentColor" d="M28 28h-4v-2h4V4H7v4H5V4a2 2 0 0 1 2-2h21a2 2 0 0 1 2 2v22a2 2 0 0 1-2 2" />
|
|
60
64
|
</svg>
|
|
61
|
-
`,
|
|
65
|
+
`,Ur=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
62
66
|
<path
|
|
63
67
|
fill="currentColor"
|
|
64
68
|
d="M4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4zm11.94 5.5h2v-4h2v4h2l-3 3z"
|
|
65
69
|
/>
|
|
66
70
|
</svg>
|
|
67
|
-
`,
|
|
71
|
+
`,Wr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
68
72
|
<path
|
|
69
73
|
fill="currentColor"
|
|
70
74
|
d="M4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4zm14.44 2v2h4v2h-4v2l-3-3z"
|
|
71
75
|
/>
|
|
72
76
|
</svg>
|
|
73
|
-
`,
|
|
77
|
+
`,Gr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
74
78
|
<path
|
|
75
79
|
fill="currentColor"
|
|
76
80
|
d="M4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4zm15.44 8v-2h-4v-2h4v-2l3 3z"
|
|
77
81
|
/>
|
|
78
82
|
</svg>
|
|
79
|
-
`,
|
|
83
|
+
`,Kr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
80
84
|
<path
|
|
81
85
|
fill="currentColor"
|
|
82
86
|
d="M4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4zm17.94 4.5h-2v4h-2v-4h-2l3-3z"
|
|
83
87
|
/>
|
|
84
88
|
</svg>
|
|
85
|
-
`,
|
|
89
|
+
`,qr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
86
90
|
<path
|
|
87
91
|
fill="currentColor"
|
|
88
92
|
d="M5 10H3V4h8v2H5zm14 8h-6v2h8v-6h-2zM5 18v-4H3v6h8v-2zM21 4h-8v2h6v4h2zM8 13v2l3-3l-3-3v2H3v2zm8-2V9l-3 3l3 3v-2h5v-2z"
|
|
89
93
|
/>
|
|
90
94
|
</svg>
|
|
91
|
-
`,
|
|
95
|
+
`,Jr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
92
96
|
<path
|
|
93
97
|
fill="currentColor"
|
|
94
98
|
d="M4 2h7a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h7v-4zm0 6v4h7v-4zM4 4v4h7V4zm13.59 8L15 9.41L16.41 8L19 10.59L21.59 8L23 9.41L20.41 12L23 14.59L21.59 16L19 13.41L16.41 16L15 14.59z"
|
|
95
99
|
/>
|
|
96
100
|
</svg>
|
|
97
|
-
`,
|
|
101
|
+
`,Yr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
98
102
|
<path
|
|
99
103
|
fill="currentColor"
|
|
100
104
|
d="M9.41 13L12 15.59L14.59 13L16 14.41L13.41 17L16 19.59L14.59 21L12 18.41L9.41 21L8 19.59L10.59 17L8 14.41zM22 9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2zM4 9h4V6H4zm6 0h4V6h-4zm6 0h4V6h-4z"
|
|
101
105
|
/>
|
|
102
106
|
</svg>
|
|
103
|
-
`,
|
|
107
|
+
`,Xr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
104
108
|
<path
|
|
105
109
|
fill="currentColor"
|
|
106
110
|
d="m15.46 15.88l1.42-1.42L19 16.59l2.12-2.13l1.42 1.42L20.41 18l2.13 2.12l-1.42 1.42L19 19.41l-2.12 2.13l-1.42-1.42L17.59 18zM4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4z"
|
|
107
111
|
/>
|
|
108
112
|
</svg>
|
|
109
|
-
`,
|
|
113
|
+
`,Zr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
110
114
|
<path
|
|
111
115
|
fill="currentColor"
|
|
112
116
|
d="M19 14h2v6H3v-6h2v4h14zM3 4v6h2V6h14v4h2V4zm8 7v2H8v2l-3-3l3-3v2zm5 0V9l3 3l-3 3v-2h-3v-2z"
|
|
113
117
|
/>
|
|
114
118
|
</svg>
|
|
115
|
-
`,
|
|
119
|
+
`,Qr=`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
116
120
|
<!-- Icon from TDesign Icons by TDesign - https://github.com/Tencent/tdesign-icons/blob/main/LICENSE -->
|
|
117
121
|
<path fill="currentColor" d="M21 10v12h-2V12H5v10H3V10zm0-8v6H3V2zm-2 2H5v2h14z" />
|
|
118
122
|
</svg>
|
|
119
|
-
`;let ur=`color-selector`,Q={Break:{name:`break`},CopyCell:{name:`CopyCell`,tip:`Copy cell`,icon:Qn,handle:(e,t)=>{let n=e.getTextByCell(t),r=e.getHTMLByCell(t),i=new ClipboardItem({"text/plain":new Blob([n],{type:`text/plain`}),"text/html":new Blob([r],{type:`text/html`})});navigator.clipboard.write([i]),e.hideTableTools()}},CutCell:{name:`CutCell`,tip:`Cut cell`,icon:$n,handle:(e,t)=>{let n=e.getTextByCell(t),r=e.getHTMLByCell(t,!0),i=new ClipboardItem({"text/plain":new Blob([n],{type:`text/plain`}),"text/html":new Blob([r],{type:`text/html`})});navigator.clipboard.write([i]),e.hideTableTools()}},InsertTop:{name:`InsertTop`,icon:rr,tip:`Insert row above`,handle:(e,t)=>{e.appendRow(t,!1),e.hideTableTools()}},InsertRight:{name:`InsertRight`,icon:nr,tip:`Insert column right`,handle:(e,t)=>{e.appendCol(t,!0),e.hideTableTools()}},InsertBottom:{name:`InsertBottom`,icon:er,tip:`Insert row below`,handle:(e,t)=>{e.appendRow(t,!0),e.hideTableTools()}},InsertLeft:{name:`InsertLeft`,icon:tr,tip:`Insert column Left`,handle:(e,t)=>{e.appendCol(t,!1),e.hideTableTools()}},MergeCell:{name:`MergeCell`,icon:ir,tip:`Merge Cell`,handle:(e,t)=>{e.mergeCells(t),e.hideTableTools()}},SplitCell:{name:`SplitCell`,icon:cr,tip:`Split Cell`,handle:(e,t)=>{e.splitCell(t),e.hideTableTools()}},DeleteRow:{name:`DeleteRow`,icon:or,tip:`Delete Row`,handle:(e,t)=>{e.removeRow(t),e.hideTableTools()}},DeleteColumn:{name:`DeleteColumn`,icon:ar,tip:`Delete Column`,handle:(e,t)=>{e.removeCol(t),e.hideTableTools()}},DeleteTable:{name:`DeleteTable`,icon:sr,tip:`Delete table`,handle:(e,t)=>{e.deleteTable(t)}},BackgroundColor:{name:`BackgroundColor`,icon:Xn,isColorChoose:!0,tip:`Set background color`,key:`background-color`,handle:(e,t,n)=>{e.setCellAttrs(t,`background-color`,n,!0)}},BorderColor:{name:`BorderColor`,icon:Zn,isColorChoose:!0,tip:`Set border color`,key:`border-color`,handle:(e,t,n)=>{e.setCellAttrs(t,`border-color`,n,!0)}},SwitchWidth:{name:`SwitchWidth`,icon:Yn,tip:`Switch table width`,handle:e=>{if(!e.table)return;let n=t.default.find(e.table);n&&(n.full?n.cancelFull():n.setFull())}},InsertCaption:{name:`InsertCaption`,icon:lr,tip:`Insert table caption`,handle(e){if(!e.table)return;let n=t.default.find(e.table);if(!n)return;let r=e.quill.scroll.create(`text`,`Table Caption`).wrap(u.tableCaption,{tableId:n.tableId});n.insertBefore(r,n.children.head)}}},dr=10,fr=y(`color-map`),$={selectWrapper:fr.b(),used:fr.bm(`used`),item:fr.be(`item`),btn:fr.be(`btn`),map:fr.be(`content`),mapRow:fr.be(`content-row`)};var pr=class{constructor(e,n,r){this.tableModule=e,this.quill=n,O(this,`usedColors`,new Set),O(this,`options`,void 0),O(this,`menu`,null),O(this,`isMenuDisplay`,!1),O(this,`isColorPicking`,!1),O(this,`updateUsedColor`,void 0),O(this,`tooltipItem`,[]),O(this,`activeTooltip`,null),O(this,`bem`,y(`menu`)),O(this,`colorItemClass`,`color-${V()}`),O(this,`colorChooseTooltipOption`,{direction:`top`}),O(this,`updateWhenTextChange`,()=>{this.isMenuDisplay&&this.update()}),this.options=this.resolveOptions(r);try{let e=localStorage.getItem(this.options.localstorageKey)||`[]`,t=JSON.parse(e);ce(t)||(t=[]),t.slice(-1*dr).map(e=>this.usedColors.add(e))}catch(e){}this.updateUsedColor=vn(e=>{if(!e)return;if(this.usedColors.add(e),this.usedColors.size>dr){let e=Array.from(this.usedColors).slice(-1*dr);this.usedColors.clear(),e.map(e=>this.usedColors.add(e))}localStorage.setItem(this.options.localstorageKey,JSON.stringify(Array.from(this.usedColors)));let t=Array.from(document.querySelectorAll(`.${this.colorItemClass}.${$.used}`));for(let n of t){let t=document.createElement(`div`);t.classList.add($.item),t.style.backgroundColor=String(e);let r=Array.from(n.querySelectorAll(`.${$.item}[style*="background-color: ${t.style.backgroundColor}"]`));r.length<=0&&n.appendChild(t);let i=Array.from(n.querySelectorAll(`.${$.item}`)).slice(0,-1*dr);for(let e of i)e.remove()}},1e3),this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}resolveOptions(e){let t=Object.assign({tipText:!0,tools:[Q.InsertTop,Q.InsertRight,Q.InsertBottom,Q.InsertLeft,Q.Break,Q.MergeCell,Q.SplitCell,Q.Break,Q.DeleteRow,Q.DeleteColumn,Q.DeleteTable,Q.Break,Q.BackgroundColor,Q.BorderColor],localstorageKey:`__table-bg-used-color`,defaultColorMap:m},e);return t}buildTools(){let e=document.createElement(`div`);e.classList.add(this.bem.b()),Object.assign(e.style,{display:`flex`});for(let t of this.options.tools){let{name:n,icon:r,handle:i,isColorChoose:a,key:o,tip:s=``}=t,c=document.createElement(`span`);if(c.classList.add(this.bem.be(`item`)),n===`break`)c.classList.add(this.bem.is(`break`));else{let e=document.createElement(`i`);if(e.classList.add(`icon`),se(r)?e.appendChild(r(this.tableModule)):e.innerHTML=r,c.appendChild(e),a&&o){let e=this.createColorChoose(c,{name:n,icon:r,handle:i,isColorChoose:a,key:o,tip:s});this.tooltipItem.push(e),c.classList.add(ur)}else se(i)&&c.addEventListener(`click`,e=>{this.quill.focus(),i(this.tableModule,this.getSelectedTds(),e)},!1);let t=this.tableModule.options.texts[n]||s;this.options.tipText&&t&&s&&this.createTipText(c,t)}e.appendChild(c)}return e}createColorChoose(e,{handle:t,key:n}){let r=document.createElement(`div`);if(r.classList.add($.selectWrapper),this.options.defaultColorMap.length>0){let e=document.createElement(`div`);e.classList.add($.map);for(let t of this.options.defaultColorMap){let n=document.createElement(`div`);n.classList.add($.mapRow);for(let e of t){let t=document.createElement(`div`);t.classList.add($.item),t.style.backgroundColor=e,n.appendChild(t)}e.appendChild(n)}r.appendChild(e)}let i=document.createElement(`div`);i.classList.add($.mapRow),Object.assign(i.style,{marginTop:`4px`});let a=document.createElement(`div`);a.classList.add($.btn,`transparent`),a.textContent=this.tableModule.options.texts.transparent,a.addEventListener(`click`,()=>{t(this.tableModule,this.getSelectedTds(),`transparent`)});let o=document.createElement(`div`);o.classList.add($.btn,`clear`),o.textContent=this.tableModule.options.texts.clear,o.addEventListener(`click`,()=>{t(this.tableModule,this.getSelectedTds(),null)});let s=document.createElement(`div`);s.classList.add($.btn,`custom`),s.textContent=this.tableModule.options.texts.custom;let c=me({onChange:e=>{t(this.tableModule,this.getSelectedTds(),e),this.updateUsedColor(e)}}),{hide:l,destroy:u}=sn(s,{direction:`right`,type:`click`,content:c,container:s});i.appendChild(a),i.appendChild(o),i.appendChild(s),r.appendChild(i);let d=document.createElement(`div`);d.classList.add($.used,this.colorItemClass);for(let e of this.usedColors){let t=document.createElement(`div`);t.classList.add($.item),t.style.backgroundColor=e,d.appendChild(t)}r.appendChild(d),r.addEventListener(`click`,e=>{e.stopPropagation(),l();let t=e.target,r=t.style.backgroundColor,i=this.getSelectedTds();if(t&&r&&i.length>0){if(this.tableModule.setCellAttrs(i,n,r,!0),!t.closest(`.${$.item}`))return;this.updateUsedColor(r)}});let f=sn(e,k({type:`click`,content:r,onOpen:()=>(this.isMenuDisplay&&this.tableModule.tableSelection&&this.tableModule.tableSelection.hideDisplay(),this.setActiveTooltip(f),!1),onClose:()=>{this.isMenuDisplay&&this.tableModule.tableSelection&&(this.tableModule.tableSelection.updateWithSelectedTds(),this.tableModule.tableSelection.showDisplay());let e=r.contains(c);return e&&l(),this.activeTooltip===f&&(this.activeTooltip=null),!1},onDestroy:()=>{u(),this.activeTooltip===f&&(this.activeTooltip=null)}},this.colorChooseTooltipOption));return f.isColorPick=!0,f}setActiveTooltip(e){this.activeTooltip&&this.activeTooltip!==e&&this.activeTooltip.hide(!0),this.activeTooltip=e}getSelectedTds(){var e;return((e=this.tableModule.tableSelection)==null?void 0:e.selectedTds)||[]}createTipText(e,t){let n=sn(e,{msg:t});n&&this.tooltipItem.push(n)}show(){!this.menu||!this.tableModule.tableSelection||!this.tableModule.tableSelection.boundary||(Object.assign(this.menu.style,{display:`flex`}),this.isMenuDisplay=!0,this.update())}update(){}hide(){this.menu&&Object.assign(this.menu.style,{display:`none`});for(let e of this.tooltipItem)e.hide(!0);this.isMenuDisplay=!1}destroy(){this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.activeTooltip=null;for(let e of this.tooltipItem)e.destroy();this.menu&&(this.hide(),this.menu.remove(),this.menu=null)}},mr=class extends pr{constructor(e,t,n){super(e,t,n),this.tableModule=e,this.quill=t,O(this,`colorChooseTooltipOption`,{direction:`right`}),O(this,`listenContextmenu`,e=>{var t;e.preventDefault();let n=e.composedPath();if(!n||n.length<=0)return;let r=n.find(e=>e.tagName&&e.tagName.toUpperCase()===`TABLE`&&e.classList.contains(`ql-table`));r&&!((t=this.tableModule.tableSelection)==null||(t=t.selectedTds)==null)&&t.length?(this.menu||(this.menu=this.buildTools()),Object.assign(this.menu.style,{display:`flex`}),this.isMenuDisplay=!0,this.update({x:e.clientX,y:e.clientY}),document.addEventListener(`click`,()=>{this.hide()},{once:!0})):this.hide()}),this.quill.root.addEventListener(`contextmenu`,this.listenContextmenu)}buildTools(){let e=super.buildTools();e.classList.add(this.bem.is(`contextmenu`));let t=e.getElementsByClassName(ur);for(let e of Array.from(t))e.addEventListener(`click`,e=>e.stopPropagation());return document.body.appendChild(e),e}createTipText(e,t){let n=document.createElement(`span`);n.textContent=t,e.appendChild(n)}show(){}update(e){if(!this.isMenuDisplay||!this.menu||!this.tableModule.tableSelection||!this.tableModule.tableSelection.isDisplaySelection||!e)return;super.update();let t={display:`flex`,left:0,top:0},{x:n,y:r}=e;t.left=n,t.top=r,Object.assign(this.menu.style,k(k({},t),{},{left:`${t.left+window.scrollX}px`,top:`${t.top+window.scrollY}px`}));let i=this.menu.getBoundingClientRect(),{left:a,top:o}=dn(i);Object.assign(this.menu.style,{left:`${a+window.scrollX}px`,top:`${o+window.scrollY}px`})}destroy(){this.quill.root.removeEventListener(`contextmenu`,this.listenContextmenu),super.destroy()}},hr=class extends pr{constructor(e,t,n){super(e,t,n),this.tableModule=e,this.quill=t,this.menu=this.buildTools(),this.tableModule.addContainer(this.menu),this.show(),this.update()}update(){!this.isMenuDisplay||!this.menu||!this.tableModule.tableSelection||!this.tableModule.tableSelection.isDisplaySelection||(super.update(),nn(this.tableModule.tableSelection.cellSelect,this.menu,{placement:`bottom`,middleware:[en(),$t({limiter:tn()}),Qt(20)]}).then(({x:e,y:t})=>{Object.assign(this.menu.style,{left:`${e}px`,top:`${t}px`})}))}};let gr=e=>!e.full&&e.align===`right`;var _r=class{constructor(e,t){this.tableModule=e,this.quill=t,O(this,`colIndex`,-1),O(this,`tableMain`,void 0),O(this,`dragging`,!1),O(this,`dragColBreak`,null),O(this,`handleColMouseUpFunc`,this.handleColMouseUp.bind(this)),O(this,`handleColMouseMoveFunc`,this.handleColMouseMove.bind(this)),O(this,`handleColMouseDownFunc`,this.handleColMouseDown.bind(this)),O(this,`rowIndex`,-1),O(this,`dragRowBreak`,null),O(this,`handleRowMouseUpFunc`,this.handleRowMouseUp.bind(this)),O(this,`handleRowMouseMoveFunc`,this.handleRowMouseMove.bind(this)),O(this,`handleRowMouseDownFunc`,this.handleRowMouseDown.bind(this)),O(this,`dragBEM`,y(`drag-line`))}findCurrentColIndex(e){return-1}colWidthChange(e,t,n){}createConfirmDialog({message:e,confirm:t,cancel:n}){return D(function*(){return new Promise(r=>{let i=document.createElement(`div`);Object.assign(i.style,{padding:`8px 12px`,fontSize:`14px`,lineHeight:`1.5`});let a=document.createElement(`p`);a.textContent=e;let o=document.createElement(`div`);Object.assign(o.style,{display:`flex`,justifyContent:`flex-end`,gap:`6px`});let s=pe({content:n}),c=pe({type:`confirm`,content:t});o.appendChild(s),o.appendChild(c),i.appendChild(a),i.appendChild(o);let{close:l}=E({child:i});s.addEventListener(`click`,()=>{r(!1),l()}),c.addEventListener(`click`,()=>{r(!0),l()})})})()}handleColMouseUp(){var e=this;return D(function*(){if(!e.dragColBreak||!e.tableMain||e.colIndex===-1)return;let t=e.tableMain.getCols(),n=Number.parseInt(e.dragColBreak.dataset.w||`0`),r=e.tableMain.full,i=!1,a=[];if(r){let r=e.tableMain.domNode.getBoundingClientRect().width,o=n/r*100,s=t[e.colIndex].width;if(o<s){if(o=Math.max(d.colMinWidthPre,o),t[e.colIndex+1]||t[e.colIndex-1]){let n=t[e.colIndex+1]?e.colIndex+1:e.colIndex-1;a.push({index:n,width:t[n].width+s-o})}else o=100;i=!0,a.push({index:e.colIndex,width:o})}else if(t[e.colIndex+1]){let n=s+t[e.colIndex+1].width;o=Math.min(n-d.colMinWidthPre,o),i=!0,a.push({index:e.colIndex,width:o},{index:e.colIndex+1,width:n-o})}}else e.tableMain.domNode.style.width=`${Number.parseFloat(e.tableMain.domNode.style.width)-t[e.colIndex].domNode.getBoundingClientRect().width+n}px`,i=!0,a.push({index:e.colIndex,width:n});if(document.body.removeChild(e.dragColBreak),e.dragColBreak=null,document.removeEventListener(`mouseup`,e.handleColMouseUpFunc),document.removeEventListener(`mousemove`,e.handleColMouseMoveFunc),e.dragging=!1,i){let n=e.tableMain.domNode.getBoundingClientRect().width;if(r){let i=0,o=new Set(a.map(({index:e,width:t})=>(i+=t,e)));for(let[e,n]of t.entries()){if(o.has(e))continue;i+=n.width}if(i>100){if(!(yield e.createConfirmDialog({message:e.tableModule.options.texts.perWidthInsufficient,confirm:e.tableModule.options.texts.confirmText,cancel:e.tableModule.options.texts.cancelText})))return;e.tableMain.cancelFull(),r=!1;for(let[e,t]of a.entries()){let{width:r,index:i}=t;a[e]={index:i,width:r/100*n}}}}for(let{index:i,width:o}of a)t[i].width=`${Math.round(o)}${r?`%`:`px`}`,e.colWidthChange(i,{px:Math.round(o/100*n),pre:Math.round(o)},r)}e.quill.emitter.emit(f.AFTER_TABLE_RESIZE)})()}getColumnRect(e){if(!this.tableMain)return null;let t=this.tableMain.getCols();if(e>=t.length)return null;let n=t[0].domNode.getBoundingClientRect().left;for(let r=0;r<e;r++){let e=t[r].domNode.getBoundingClientRect();n+=e.width}let r=t[e],i=r.domNode.getBoundingClientRect().width;return{left:n,right:n+i,width:i}}handleColMouseMove(e){if(e.preventDefault(),!this.dragColBreak||!this.tableMain||this.colIndex===-1)return;let t=this.tableMain.getCols(),n=this.getColumnRect(this.colIndex),r=this.tableMain.domNode.getBoundingClientRect(),i=e.clientX;if(this.tableMain.full){let e=d.colMinWidthPre/100*r.width,a=r.right;i>n.right&&t[this.colIndex+1]&&(a=Math.max(this.getColumnRect(this.colIndex+1).right-e,n.left+e));let o=n.left+e;i=Math.min(Math.max(i,o),a)}else gr(this.tableMain)?n.right-i<d.colMinWidthPx&&(i=n.right-d.colMinWidthPx):i-n.left<d.colMinWidthPx&&(i=n.left+d.colMinWidthPx);let a=i-n.left;return gr(this.tableMain)&&(a=n.right-i),this.dragColBreak.style.left=`${i}px`,this.dragColBreak.dataset.w=String(a),{left:i,width:a}}handleColMouseDown(e){if(e.button!==0||(e.preventDefault(),!this.tableMain))return;let{rect:t,body:n}=Rn(this.tableMain);if(!n)return;let r=this.tableMain.getCols();if(this.colIndex=this.findCurrentColIndex(e),this.colIndex===-1)return;let i=r[this.colIndex].width,a=this.tableMain.full?i/100*t.width:i;document.addEventListener(`mouseup`,this.handleColMouseUpFunc),document.addEventListener(`mousemove`,this.handleColMouseMoveFunc),this.dragging=!0;let o=document.createElement(`div`);o.classList.add(this.dragBEM.b()),o.classList.add(this.dragBEM.is(`col`)),o.dataset.w=String(a);let s={top:t.y,left:e.clientX,height:t.height};Object.assign(o.style,{top:`${s.top}px`,left:`${s.left}px`,height:`${s.height}px`});let c=document.body;return c.appendChild(o),this.dragColBreak&&c.removeChild(this.dragColBreak),this.dragColBreak=o,s}findCurrentRowIndex(e){return-1}rowHeightChange(e,t){}handleRowMouseUp(){if(!this.tableMain||!this.dragRowBreak||this.rowIndex===-1)return;let e=Number.parseInt(this.dragRowBreak.dataset.h||`0`),t=this.tableMain.getRows();t[this.rowIndex].setHeight(`${e}px`),this.rowHeightChange(this.rowIndex,e),document.body.removeChild(this.dragRowBreak),this.dragRowBreak=null,document.removeEventListener(`mouseup`,this.handleRowMouseUpFunc),document.removeEventListener(`mousemove`,this.handleRowMouseMoveFunc),this.dragging=!1,this.quill.emitter.emit(f.AFTER_TABLE_RESIZE)}handleRowMouseMove(e){if(!this.tableMain||!this.dragRowBreak||this.rowIndex===-1)return;e.preventDefault();let t=this.tableMain.getRows(),n=t[this.rowIndex].domNode.getBoundingClientRect(),r=e.clientY;return r-n.y<d.rowMinHeightPx&&(r=n.y+d.rowMinHeightPx),this.dragRowBreak.style.top=`${r}px`,this.dragRowBreak.dataset.h=String(r-n.y),{top:r,height:r-n.y}}handleRowMouseDown(e){if(e.button!==0||(e.preventDefault(),!this.tableMain)||(this.rowIndex=this.findCurrentRowIndex(e),this.rowIndex===-1))return;this.dragging=!0,document.addEventListener(`mouseup`,this.handleRowMouseUpFunc),document.addEventListener(`mousemove`,this.handleRowMouseMoveFunc);let t=this.tableMain.getRows(),n=t[this.rowIndex].domNode.getBoundingClientRect().height,r=this.tableMain.domNode.getBoundingClientRect(),i=document.createElement(`div`);i.classList.add(this.dragBEM.b()),i.classList.add(this.dragBEM.is(`row`)),i.dataset.h=String(n);let a={top:e.clientY,left:r.x,width:r.width};Object.assign(i.style,{top:`${a.top}px`,left:`${a.left}px`,width:`${a.width}px`});let o=document.body;return o.appendChild(i),this.dragRowBreak&&o.removeChild(this.dragRowBreak),this.dragRowBreak=i,a}update(){}destroy(){}},vr=class extends _r{constructor(e,n,r){super(e,r),this.tableModule=e,this.table=n,O(this,`root`,void 0),O(this,`tableMain`,void 0),O(this,`tableWrapper`,void 0),O(this,`resizeObserver`,void 0),O(this,`tableCols`,[]),O(this,`tableRows`,[]),O(this,`rowHeadWrapper`,null),O(this,`colHeadWrapper`,null),O(this,`corner`,null),O(this,`scrollHandler`,[]),O(this,`lastHeaderSelect`,null),O(this,`size`,12),O(this,`bem`,y(`resize-box`)),O(this,`updateWhenTextChange`,()=>{this.update()}),O(this,`handleColMouseDownFunc`,function(e){let t=this.handleColMouseDown(e);if(t&&this.dragColBreak){let[e]=C(this.tableMain,K),n=e&&e.side===`top`?0:this.size;Object.assign(this.dragColBreak.style,{top:`${t.top-n}px`,left:`${t.left}px`,height:`${t.height+this.size}px`})}return t}.bind(this)),O(this,`handleRowMouseDownFunc`,function(e){let t=this.handleRowMouseDown(e);return t&&this.dragRowBreak&&Object.assign(this.dragRowBreak.style,{top:`${t.top}px`,left:`${t.left-this.size}px`,width:`${t.width+this.size}px`}),t}.bind(this)),this.tableMain=t.default.find(this.table),this.tableMain&&(this.tableWrapper=this.tableMain.parent,this.tableWrapper&&(this.root=this.tableModule.addContainer(this.bem.b()),this.resizeObserver=new ResizeObserver(()=>{this.show()}),this.resizeObserver.observe(this.table),this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)))}handleResizerHeader(e,t,n){let{clientX:r,clientY:i}=n,a=this.table.getBoundingClientRect();if(this.tableModule.tableSelection){let o=this.tableModule.tableSelection;n.shiftKey||(this.lastHeaderSelect=null);let s=[{x:e?a.left:r,y:e?i:a.top},{x:e?a.right:r,y:e?i:a.bottom}];if(this.lastHeaderSelect){let t,n;if(this.lastHeaderSelect.isX){let e=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`))),r=e[this.lastHeaderSelect.index].getBoundingClientRect();t=Math.min(r.left,a.left),n=r.top+r.height/2}else{let e=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`))),r=e[this.lastHeaderSelect.index].getBoundingClientRect();t=r.left+r.width/2,n=Math.min(r.top,a.top)}this.lastHeaderSelect.isX===e?e?(s[0].y=Math.min(s[0].y,n),s[1].y=Math.max(s[1].y,n)):(s[0].x=Math.min(s[0].x,t),s[1].x=Math.max(s[1].x,t)):(s[1]={x:Math.max(s[0].x,t),y:Math.max(s[0].y,n)},s[0]={x:Math.min(s[0].x,t),y:Math.min(s[0].y,n)})}else this.lastHeaderSelect={isX:e,index:t};o.table=this.table,o.selectedTds=o.computeSelectedTds(...s),o.show()}}findCurrentColIndex(e){return Array.from(this.root.getElementsByClassName(this.bem.be(`col-separator`))).indexOf(e.target)}colWidthChange(e,t,n){let r=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`)));r[e].style.width=n?`${t.pre}%`:`${t.px}px`}bindColEvents(){let e=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`))),t=Array.from(this.root.getElementsByClassName(this.bem.be(`col-separator`)));B.call(this,this.tableWrapper.domNode,()=>{this.colHeadWrapper.scrollLeft=this.tableWrapper.domNode.scrollLeft});for(let[t,n]of e.entries())n.addEventListener(`click`,this.handleResizerHeader.bind(this,!1,t));for(let e of t)e.addEventListener(`mousedown`,this.handleColMouseDownFunc),e.addEventListener(`dragstart`,e=>e.preventDefault())}findCurrentRowIndex(e){return Array.from(this.root.getElementsByClassName(this.bem.be(`row-separator`))).indexOf(e.target)}rowHeightChange(e,t){let n=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`)));n[e].style.height=`${t}px`}bindRowEvents(){let e=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`))),t=Array.from(this.root.getElementsByClassName(this.bem.be(`row-separator`)));B.call(this,this.tableWrapper.domNode,()=>{this.rowHeadWrapper.scrollTop=this.tableWrapper.domNode.scrollTop});for(let[t,n]of e.entries())n.addEventListener(`click`,this.handleResizerHeader.bind(this,!0,t));for(let e of t)e.addEventListener(`mousedown`,this.handleRowMouseDownFunc),e.addEventListener(`dragstart`,e=>e.preventDefault())}update(){let{rect:e,body:t}=Rn(this.tableMain);if(!t)return;let n=this.tableWrapper.domNode.getBoundingClientRect(),r=this.quill.root.getBoundingClientRect();Object.assign(this.root.style,{top:`${Math.max(e.y,n.y)-r.y}px`,left:`${Math.max(e.x,n.x)-r.x}px`});let i=-1*this.size,a=-1*this.size;gr(this.tableMain)?(this.root.classList.add(this.bem.is(`align-right`)),i=Math.min(n.width,e.width),a=Math.min(n.width,e.width)):this.root.classList.remove(this.bem.is(`align-right`));let[o]=C(this.tableMain,K),s=!o||!(o&&o.side===`top`);s?this.root.classList.remove(this.bem.is(`caption-bottom`)):this.root.classList.add(this.bem.is(`caption-bottom`)),this.corner&&Object.assign(this.corner.style,{transform:`translateY(${-1*this.size}px) translateX(${i}px)`,top:`${s?0:e.height+this.size}px`}),this.rowHeadWrapper&&Object.assign(this.rowHeadWrapper.style,{transform:`translateX(${a}px)`}),this.colHeadWrapper&&Object.assign(this.colHeadWrapper.style,{top:`${s?0:e.height+this.size}px`})}show(){this.tableCols=this.tableMain.getCols(),this.tableRows=this.tableMain.getRows(),this.root.innerHTML=``;let{rect:e,body:t}=Rn(this.tableMain);if(!t)return;let n=this.tableWrapper.domNode.getBoundingClientRect();if(this.tableCols.length>0&&this.tableRows.length>0&&(this.corner=document.createElement(`div`),this.corner.classList.add(this.bem.be(`corner`)),Object.assign(this.corner.style,{width:`${this.size}px`,height:`${this.size}px`}),this.corner.addEventListener(`click`,()=>{if(this.tableModule.tableSelection){let e=this.tableMain.descendants(U),t=this.tableModule.tableSelection;t.selectedTds=e,t.show(),t.updateWithSelectedTds()}}),this.root.appendChild(this.corner)),this.tableCols.length>0){let t=``;for(let[,n]of this.tableCols.entries()){let r=n.domNode.getBoundingClientRect().width;t+=`<div class="${this.bem.be(`col-header`)}" style="width: ${r}px">
|
|
120
|
-
<div class="${this.bem.be(`col-separator`)}" style="height: ${
|
|
121
|
-
</div>`}
|
|
122
|
-
<div class="${this.bem.be(`row-separator`)}" style="width: ${
|
|
123
|
-
</div>`}let r=document.createElement(`div`);r.classList.add(this.bem.be(`row`));let i=document.createElement(`div`);i.classList.add(this.bem.be(`row-wrapper`)),Object.assign(r.style,{transform:`translateX(-${this.size}px)`,width:`${this.size}px`,maxHeight:`${n.height}px`}),Object.assign(i.style,{height:`${e.height}px`}),i.innerHTML=t,r.appendChild(i),this.root.appendChild(r),r.scrollTop=this.tableWrapper.domNode.scrollTop,this.rowHeadWrapper=r,this.bindRowEvents()}this.update(),B.call(this,this.quill.root,()=>{this.update()})}hide(){this.root.classList.add(this.bem.is(`hidden`))}destroy(){this.hide(),pn.call(this),this.resizeObserver.disconnect(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange);for(let[e,t]of this.scrollHandler)e.removeEventListener(`scroll`,t);this.root.remove()}},yr=class extends _r{constructor(e,n,r){super(e,r),this.tableModule=e,this.table=n,O(this,`colResizer`,void 0),O(this,`rowResizer`,void 0),O(this,`currentTableCell`,void 0),O(this,`dragging`,!1),O(this,`curColIndex`,-1),O(this,`curRowIndex`,-1),O(this,`tableCellBlot`,void 0),O(this,`bem`,y(`resize-line`)),O(this,`mousemoveHandler`,e=>{if(this.dragging||this.tableModule.tableSelection&&this.tableModule.tableSelection.dragging)return;let n=this.findTableCell(e);if(!n)return this.hide();let r=t.default.find(n);r&&this.currentTableCell!==n&&(this.show(),this.currentTableCell=n,this.tableCellBlot=r,this.tableMain=b(r,u.tableMain),this.tableMain.getCols().length>0&&this.updateColResizer(),this.updateRowResizer())}),O(this,`hideWhenTextChange`,()=>{this.hide()}),O(this,`handleColMouseUpFunc`,D(function*(){yield this.handleColMouseUp(),this.updateColResizer()}).bind(this)),O(this,`handleRowMouseUpFunc`,function(){this.handleRowMouseUp(),this.updateRowResizer()}.bind(this)),this.colResizer=this.tableModule.addContainer(this.bem.be(`col`)),this.rowResizer=this.tableModule.addContainer(this.bem.be(`row`)),this.table.addEventListener(`mousemove`,this.mousemoveHandler),this.quill.on(t.default.events.TEXT_CHANGE,this.hideWhenTextChange)}findTableCell(e){for(let t of e.composedPath()){if(t instanceof HTMLElement&&t.tagName===`TD`)return t;if(t===document.body)return null}return null}findCurrentColIndex(){return this.curColIndex}updateColResizer(){if(!this.tableMain||!this.tableCellBlot)return;let e=this.tableCellBlot;this.tableModule.toolBox.removeChild(this.colResizer),this.colResizer=this.tableModule.addContainer(this.bem.be(`col`));let[t]=x(e,[u.tableBody]),n=t.domNode.getBoundingClientRect(),r=e.domNode.getBoundingClientRect(),i=this.quill.root.getBoundingClientRect(),a=r.right-i.x;gr(this.tableMain)&&(a=r.left-i.x),Object.assign(this.colResizer.style,{top:`${n.y-i.y}px`,left:`${a}px`,height:`${n.height}px`});let o=this.tableMain.getCols();this.curColIndex=o.findIndex(t=>t.colId===e.colId),this.colResizer.addEventListener(`mousedown`,this.handleColMouseDownFunc),this.colResizer.addEventListener(`dragstart`,e=>{e.preventDefault()})}findCurrentRowIndex(){return this.curRowIndex}updateRowResizer(){if(!this.tableMain||!this.tableCellBlot)return;let e=this.tableCellBlot;this.tableModule.toolBox.removeChild(this.rowResizer),this.rowResizer=this.tableModule.addContainer(this.bem.be(`row`));let t=e.parent;if(!(t instanceof W))return;let[n]=x(e,[u.tableBody]),r=n.domNode.getBoundingClientRect(),i=e.domNode.getBoundingClientRect(),a=this.quill.root.getBoundingClientRect();Object.assign(this.rowResizer.style,{top:`${i.bottom-a.y}px`,left:`${r.x-a.x}px`,width:`${r.width}px`});let o=this.tableMain.getRows();this.curRowIndex=o.indexOf(t),this.rowResizer.addEventListener(`mousedown`,this.handleRowMouseDownFunc),this.rowResizer.addEventListener(`dragstart`,e=>{e.preventDefault()})}show(){this.rowResizer.classList.remove(this.bem.is(`hidden`)),this.colResizer.classList.remove(this.bem.is(`hidden`))}hide(){this.currentTableCell=void 0,this.rowResizer.classList.add(this.bem.is(`hidden`)),this.colResizer.classList.add(this.bem.is(`hidden`))}update(){this.updateColResizer(),this.updateRowResizer()}destroy(){this.colResizer.remove(),this.rowResizer.remove(),this.table.removeEventListener(`mousemove`,this.mousemoveHandler),this.quill.off(t.default.events.TEXT_CHANGE,this.hideWhenTextChange)}},br=class{constructor(e,n,r,i){this.tableModule=e,this.table=n,this.quill=r,O(this,`scrollHandler`,[]),O(this,`tableMainBlot`,null),O(this,`tableWrapperBlot`,null),O(this,`bem`,y(`scale`)),O(this,`startX`,0),O(this,`startY`,0),O(this,`offset`,6),O(this,`options`,void 0),O(this,`root`,void 0),O(this,`block`,void 0),O(this,`resizeobserver`,new ResizeObserver(()=>this.update())),O(this,`updateWhenTextChange`,()=>{this.update()}),this.options=this.resolveOptions(i),this.tableMainBlot=t.default.find(n),this.tableMainBlot&&!this.tableMainBlot.full&&(this.tableWrapperBlot=this.tableMainBlot.parent,this.buildResizer(),this.show()),this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}resolveOptions(e){return Object.assign({blockSize:12},e)}buildResizer(){if(!this.tableMainBlot||!this.tableWrapperBlot)return;this.root=this.tableModule.addContainer(this.bem.b()),this.root.classList.add(this.bem.is(`hidden`)),this.block=document.createElement(`div`),this.block.classList.add(this.bem.be(`block`)),Object.assign(this.block.style,{width:`${this.options.blockSize}px`,height:`${this.options.blockSize}px`}),this.root.appendChild(this.block);let e=[],t=[],n=n=>{if(!this.tableMainBlot)return;let r=gr(this.tableMainBlot)?-1:1,i=(n.clientX-this.startX)*r,a=n.clientY-this.startY,o=Math.floor(i/e.length),s=Math.floor(a/t.length);for(let{blot:t,width:n}of e)t.width=Math.max(n+o,d.colMinWidthPx);for(let{blot:e,height:n}of t)e.setHeight(`${Math.max(n+s,d.rowMinHeightPx)}px`)},r=()=>{e=[],t=[],document.removeEventListener(`mousemove`,n),document.removeEventListener(`mouseup`,r)};this.block.addEventListener(`mousedown`,i=>{!this.tableMainBlot||this.isTableOutofEditor()||(this.startX=i.clientX,this.startY=i.clientY,e=this.tableMainBlot.getCols().map(e=>({blot:e,width:Math.floor(e.width)})),t=this.tableMainBlot.getRows().map(e=>({blot:e,height:Math.floor(e.domNode.getBoundingClientRect().height)})),document.addEventListener(`mousemove`,n),document.addEventListener(`mouseup`,r))}),this.block.addEventListener(`dragstart`,e=>e.preventDefault()),this.resizeobserver.observe(this.tableMainBlot.domNode),B.call(this,this.quill.root,()=>this.update()),B.call(this,this.tableWrapperBlot.domNode,()=>this.update())}isTableOutofEditor(){if(!this.tableMainBlot||!this.tableWrapperBlot||this.tableMainBlot.full)return!1;let e=this.tableMainBlot.domNode.getBoundingClientRect(),t=this.tableWrapperBlot.domNode.getBoundingClientRect();if(e.width>t.width){for(let n of this.tableMainBlot.getCols())n.width=Math.floor(n.width/e.width*t.width);return this.tableMainBlot.colWidthFillTable(),!0}return!1}update(){if(!this.block||!this.root||!this.tableMainBlot||!this.tableWrapperBlot)return;if(this.tableMainBlot.full){this.hide();return}let{rect:e,body:t}=Rn(this.tableMainBlot);if(!t)return;let n=this.tableWrapperBlot.domNode.getBoundingClientRect(),r=this.quill.root.getBoundingClientRect(),{scrollTop:i,scrollLeft:a}=this.tableWrapperBlot.domNode,o=this.options.blockSize*2+this.offset,s=Math.min(e.width,n.width)+o,c=Math.min(e.height,n.height)+o;Object.assign(this.root.style,{width:`${s}px`,height:`${c}px`,left:`${Math.max(e.x,n.x)-r.x-this.options.blockSize}px`,top:`${Math.max(e.y,n.y)-r.y-this.options.blockSize}px`});let l={left:`${e.width+o-a}px`,top:`${c-i}px`};gr(this.tableMainBlot)?(this.root.classList.add(this.bem.is(`align-right`)),l.left=`${this.options.blockSize+-1*a}px`):this.root.classList.remove(this.bem.is(`align-right`)),Object.assign(this.block.style,l)}show(){this.root&&(this.root.classList.remove(this.bem.is(`hidden`)),this.update())}hide(){this.root&&this.root.classList.add(this.bem.is(`hidden`))}destroy(){this.hide(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.resizeobserver.disconnect(),this.root&&this.root.remove(),pn.call(this)}},xr=class{constructor(e,n,r,i){this.quill=e,this.isVertical=n,this.table=r,this.scrollbarContainer=i,O(this,`minSize`,20),O(this,`gap`,4),O(this,`move`,0),O(this,`cursorDown`,!1),O(this,`cursorLeave`,!1),O(this,`ratioY`,1),O(this,`ratioX`,1),O(this,`sizeWidth`,``),O(this,`sizeHeight`,``),O(this,`size`,``),O(this,`thumbState`,{X:0,Y:0}),O(this,`ob`,void 0),O(this,`container`,void 0),O(this,`scrollbar`,void 0),O(this,`thumb`,document.createElement(`div`)),O(this,`scrollHandler`,[]),O(this,`propertyMap`,void 0),O(this,`bem`,y(`scrollbar`)),O(this,`tableMainBlot`,void 0),O(this,`showScrollbar`,vn(()=>{this.cursorLeave=!1,this.scrollbar.removeEventListener(`transitionend`,this.hideScrollbarTransitionend),this.scrollbar.style.display=this.size?`block`:`none`,requestAnimationFrame(()=>{this.scrollbar.classList.remove(this.bem.is(`transparent`))})},200)),O(this,`hideScrollbar`,vn(()=>{this.cursorLeave=!0,!this.cursorDown&&(this.scrollbar.removeEventListener(`transitionend`,this.hideScrollbarTransitionend),this.scrollbar.addEventListener(`transitionend`,this.hideScrollbarTransitionend,{once:!0}),this.scrollbar.classList.add(this.bem.is(`transparent`)))},200)),O(this,`hideScrollbarTransitionend`,()=>{this.scrollbar.style.display=this.cursorDown&&this.size?`block`:`none`}),this.tableMainBlot=t.default.find(this.table),this.container=r.parentElement,this.propertyMap=this.isVertical?{size:`height`,offset:`offsetHeight`,scrollDirection:`scrollTop`,scrollSize:`scrollHeight`,axis:`Y`,direction:`top`,client:`clientY`}:{size:`width`,offset:`offsetWidth`,scrollDirection:`scrollLeft`,scrollSize:`scrollWidth`,axis:`X`,direction:`left`,client:`clientX`},this.calculateSize(),this.ob=new ResizeObserver(()=>{this.update()}),this.ob.observe(r),this.scrollbar=this.createScrollbar(),this.setScrollbarPosition(),B.call(this,this.quill.root,()=>this.setScrollbarPosition()),this.showScrollbar()}update(){this.calculateSize(),this.setScrollbarPosition()}setScrollbarPosition(){let{rect:{width:e,height:t},body:n}=Rn(this.tableMainBlot);if(!n)return;let{scrollLeft:r,scrollTop:i,offsetLeft:a,offsetTop:o}=this.quill.root,{offsetLeft:s,offsetTop:c}=this.container,{offsetLeft:l,offsetTop:u}=n.domNode,{width:d,height:f}=this.container.getBoundingClientRect(),p=s+l-a,m=c+u-o;this.isVertical?p+=Math.min(d,e):m+=Math.min(f,t),this.tableMainBlot&&this.tableMainBlot.align!==`left`&&(p+=this.table.offsetLeft-s),Object.assign(this.scrollbar.style,{[this.propertyMap.size]:`${this.isVertical?Math.min(f,t):d}px`,transform:`translate(${p-r}px, ${m-i}px)`}),this.containerScrollHandler(this.container)}calculateSize(){let e=this.container.offsetHeight-this.gap,t=this.container.offsetWidth-this.gap,n=Math.pow(e,2)/this.container.scrollHeight,r=Math.pow(t,2)/this.container.scrollWidth,i=Math.max(n,this.minSize),a=Math.max(r,this.minSize);this.ratioY=n/(e-n)/(i/(e-i)),this.ratioX=r/(t-r)/(a/(t-a)),this.sizeWidth=a+this.gap<t?`${a}px`:``,this.sizeHeight=i+this.gap<e?`${i}px`:``,this.size=this.isVertical?this.sizeHeight:this.sizeWidth}createScrollbar(){let e=document.createElement(`div`);e.classList.add(this.bem.b()),e.classList.add(this.isVertical?this.bem.is(`vertical`):this.bem.is(`horizontal`),this.bem.is(`transparent`)),Object.assign(e.style,{display:`none`}),this.thumb.classList.add(this.bem.be(`thumb`));let t=null,n=e=>{if(this.cursorDown===!1)return;let t=this.thumbState[this.propertyMap.axis];if(!t)return;let n=Math.pow(this.scrollbar[this.propertyMap.offset],2)/this.container[this.propertyMap.scrollSize]/(this.isVertical?this.ratioY:this.ratioX)/this.thumb[this.propertyMap.offset],r=(this.scrollbar.getBoundingClientRect()[this.propertyMap.direction]-e[this.propertyMap.client])*-1,i=this.thumb[this.propertyMap.offset]-t,a=(r-i)*100*n/this.scrollbar[this.propertyMap.offset];this.container[this.propertyMap.scrollDirection]=a*this.container[this.propertyMap.scrollSize]/100},r=()=>{this.thumbState[this.propertyMap.axis]=0,this.cursorDown=!1,document.removeEventListener(`mousemove`,n),document.removeEventListener(`mouseup`,r),this.cursorLeave&&this.hideScrollbar(),document.onselectstart=t},i=e=>{e.stopImmediatePropagation(),this.cursorDown=!0,document.addEventListener(`mousemove`,n),document.addEventListener(`mouseup`,r),t=document.onselectstart,document.onselectstart=()=>!1};this.thumb.addEventListener(`mousedown`,e=>{var t;if(e.stopPropagation(),e.ctrlKey||[1,2].includes(e.button))return;(t=window.getSelection())==null||t.removeAllRanges(),i(e);let n=e.currentTarget;n&&(this.thumbState[this.propertyMap.axis]=n[this.propertyMap.offset]-(e[this.propertyMap.client]-n.getBoundingClientRect()[this.propertyMap.direction]))});let a=[this.table,e];for(let e of a)e.addEventListener(`mouseenter`,this.showScrollbar),e.addEventListener(`mouseleave`,this.hideScrollbar);return B.call(this,this.container,()=>{this.containerScrollHandler(this.container)}),e.appendChild(this.thumb),e}containerScrollHandler(e){let t=e[this.propertyMap.offset]-this.gap;this.move=e[this.propertyMap.scrollDirection]*100/t*(this.isVertical?this.ratioY:this.ratioX),Object.assign(this.thumb.style,{[this.propertyMap.size]:this.size,transform:`translate${this.propertyMap.axis}(${this.move}%)`})}destroy(){this.ob.disconnect(),pn.call(this),this.table.removeEventListener(`mouseenter`,this.showScrollbar),this.table.removeEventListener(`mouseleave`,this.hideScrollbar)}},Sr=class{constructor(e,n,r){this.tableModule=e,this.table=n,this.quill=r,O(this,`scrollbarContainer`,void 0),O(this,`scrollbar`,void 0),O(this,`bem`,y(`scrollbar`)),O(this,`updateWhenTextChange`,()=>{this.update()}),this.scrollbarContainer=this.tableModule.addContainer(this.bem.be(`container`)),this.scrollbar=[new xr(r,!0,n,this.scrollbarContainer),new xr(r,!1,n,this.scrollbarContainer)];for(let e of this.scrollbar)this.scrollbarContainer.appendChild(e.scrollbar);this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}hide(){for(let e of this.scrollbar)e.hideScrollbar()}show(){for(let e of this.scrollbar)e.showScrollbar()}update(){for(let e of this.scrollbar)e.calculateSize(),e.setScrollbarPosition()}destroy(){this.scrollbarContainer.remove(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange);for(let e of this.scrollbar)e.destroy()}};let Cr=0;var wr=class{constructor(e,n,r={}){this.tableModule=e,this.quill=n,O(this,`options`,void 0),O(this,`boundary`,null),O(this,`startScrollX`,0),O(this,`startScrollY`,0),O(this,`selectedTableScrollX`,0),O(this,`selectedTableScrollY`,0),O(this,`selectedEditorScrollX`,0),O(this,`selectedEditorScrollY`,0),O(this,`selectedTds`,[]),O(this,`cellSelectWrap`,void 0),O(this,`cellSelect`,void 0),O(this,`dragging`,!1),O(this,`scrollHandler`,[]),O(this,`tableMenu`,void 0),O(this,`resizeObserver`,void 0),O(this,`table`,void 0),O(this,`isDisplaySelection`,!1),O(this,`bem`,y(`selection`)),O(this,`lastSelection`,{anchorNode:null,anchorOffset:0,focusNode:null,focusOffset:0}),O(this,`updateAfterEvent`,()=>{this.updateWithSelectedTds()}),O(this,`quillSelectionChangeHandler`,(e,n,r)=>{if(r!==t.default.sources.API&&e&&!this.quill.composition.isComposing&&this.selectedTds.length>0){let t=this.quill.getFormat(e),[n]=this.quill.getLine(e.index),r=!!t[u.tableCellInner]&&!!n,i=this.selectedTds.some(e=>e.children.contains(n));if(r&&!i)try{let e=b(n,u.tableCellInner);this.selectedTds=[e],this.updateWithSelectedTds()}catch(e){}else r&&i||this.hide()}}),O(this,`selectionChangeHandler`,()=>{let e=window.getSelection();if(!e)return;let{anchorNode:n,focusNode:r,anchorOffset:i,focusOffset:a}=e;if(!n||!r)return;let o=t.default.find(n),s=t.default.find(r);if(!o||!s||o.scroll!==this.quill.scroll||s.scroll!==this.quill.scroll)return;let c=S(o),l=S(s),d=c.has(u.tableColgroup),f=l.has(u.tableColgroup);if(d||f){let t=n,o=i,s=r,p=a;if(d){let e=c.get(u.tableWrapper),n=e.descendants(U);n.length>0&&(t=n[0].domNode,o=0)}if(f){let e=l.get(u.tableWrapper),t=e.descendants(U);t.length>0&&(s=t[0].domNode,p=0)}this.setSelectionData(e,{anchorNode:t,anchorOffset:o,focusNode:s,focusOffset:p});return}let p=c.has(u.tableCellInner),m=l.has(u.tableCellInner),h=p&&m;if(h){let e=c.get(u.tableCellInner),t=l.get(u.tableCellInner);h&&(h=e!==t)}if(p&&m&&h||!p&&m||!m&&p){this.setSelectionData(e,this.lastSelection),this.selectedTds.length>0&&this.hide();return}this.lastSelection={anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:a}}),O(this,`mouseDownHandler`,e=>{let{button:t,target:n,clientX:r,clientY:i}=e,a=n.closest(`.ql-table`),o=n.closest(`tbody`);if(t!==0||!a||!o)return;this.setSelectionTable(a);let s=a.dataset.tableId,c={x:r,y:i};this.selectedTds=this.computeSelectedTds(c,c),this.dragging=!0,this.show();let l=e=>{this.tableMenu&&this.tableMenu.hide(),this.tableModule.tableResize&&this.tableModule.tableResize.hide();let{button:t,target:n,clientX:r,clientY:i}=e,a=n.closest(`tbody`);if(t!==0||!a||a.dataset.tableId!==s)return;let o={x:r,y:i};this.selectedTds=this.computeSelectedTds(c,o),this.selectedTds.length>1&&this.quill.blur(),this.update()},u=()=>{document.body.removeEventListener(`mousemove`,l,!1),document.body.removeEventListener(`mouseup`,u,!1),this.dragging=!1,this.tableMenu&&this.selectedTds.length>0&&this.tableMenu.show()};document.body.addEventListener(`mousemove`,l,!1),document.body.addEventListener(`mouseup`,u,!1)}),O(this,`removeCell`,e=>{let n=this.quill.getSelection();if(!(n||e.key!==`Backspace`&&e.key!==`Delete`)){for(let e of this.selectedTds)e.deleteAt(0,e.length()-1);if(this.table){let e=t.default.find(this.table),n=e.descendants(U);this.selectedTds.length===n.length&&e.remove()}}}),this.options=this.resolveOptions(r),this.cellSelectWrap=e.addContainer(this.bem.b()),this.cellSelect=this.helpLinesInitial(),this.resizeObserver=fn(()=>this.updateAfterEvent(),{ignoreFirstBind:!0}),this.resizeObserver.observe(this.quill.root),this.quill.root.addEventListener(`mousedown`,this.mouseDownHandler,{passive:!1}),document.addEventListener(`selectionchange`,this.selectionChangeHandler,{passive:!1}),this.quill.on(f.AFTER_TABLE_RESIZE,this.updateAfterEvent),this.quill.on(t.default.events.SELECTION_CHANGE,this.quillSelectionChangeHandler),this.quill.on(t.default.events.TEXT_CHANGE,this.updateAfterEvent),this.options.tableMenu&&(this.tableMenu=new this.options.tableMenu(e,n,this.options.tableMenuOptions)),this.hide()}getFirstTextNode(e){for(let t of Array.from(e.childNodes))if(t.nodeType===Node.TEXT_NODE)return t;return e}getLastTextNode(e){for(let t=e.childNodes.length-1;t>=0;t--){let n=e.childNodes[t];if(n.nodeType===Node.TEXT_NODE)return n}return e}getNodeTailOffset(e){let t=document.createRange();return t.selectNodeContents(e),t.collapse(!1),t.startOffset}setSelectionData(e,t){let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}=t;if(!n||!i)return;let o=document.createRange(),s=this.selectionDirectionUp(t);s?(o.setStart(n,r),o.setEnd(n,r)):(o.setStart(n,r),o.setEnd(i,a)),e.removeAllRanges(),e.addRange(o),s&&e.extend(i,a)}selectionDirectionUp(e){let{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:i}=e;if(!t||!r)return!1;if(t===r)return n>i;let a=t.compareDocumentPosition(r);return a&Node.DOCUMENT_POSITION_CONTAINS||a&Node.DOCUMENT_POSITION_CONTAINED_BY?(a&Node.DOCUMENT_POSITION_FOLLOWING)!==0:(a&Node.DOCUMENT_POSITION_PRECEDING)!==0}findWrapSelection(e){let t=null,n=0,r=null,i=0;for(let{node:a,offset:o}of e)a&&((!t||this.selectionDirectionUp({anchorNode:t,anchorOffset:n,focusNode:a,focusOffset:o}))&&(t=a,n=o),(!r||this.selectionDirectionUp({anchorNode:a,anchorOffset:o,focusNode:r,focusOffset:i}))&&(r=a,i=o));return{startNode:t,startOffset:n,endNode:r,endOffset:i}}resolveOptions(e){return Object.assign({selectColor:`#0589f340`,tableMenuOptions:{}},e)}helpLinesInitial(){this.cellSelectWrap.style.setProperty(`--select-color`,this.options.selectColor);let e=document.createElement(`div`);return e.classList.add(this.bem.be(`line`)),this.cellSelectWrap.appendChild(e),e}computeSelectedTds(e,n){if(!this.table)return[];let r=t.default.find(this.table);if(!r)return[];let i=r.descendants(G)[0];if(!i)return[];let a=new Set(i.descendants(q).map((e,t)=>(e.index=t,e))),{x:o,y:s}=this.getTableViewScroll(),{x:c,y:l}=this.getQuillViewScroll();this.selectedTableScrollX=o,this.selectedTableScrollY=s,this.selectedEditorScrollX=c,this.selectedEditorScrollY=l;let{rect:u}=Rn(r),d=e.x-o+this.startScrollX,f=e.y-s+this.startScrollY,p={x:Math.max(u.left,Math.min(n.x,d)),y:Math.max(u.top,Math.min(n.y,f)),x1:Math.min(u.right,Math.max(n.x,d)),y1:Math.min(u.bottom,Math.max(n.y,f))},m=new Set,h=!0;for(;h;){h=!1;for(let e of a){e.__rect||(e.__rect=e.domNode.getBoundingClientRect());let{x:t,y:n,right:r,bottom:i}=e.__rect;if(cn({x:Math.floor(p.x),y:Math.floor(p.y),x1:Math.floor(p.x1),y1:Math.floor(p.y1)},{x:Math.floor(t),y:Math.floor(n),x1:Math.floor(r),y1:Math.floor(i)},Cr,m.size===0)){m.add(e),a.delete(e),p={x:Math.min(p.x,t),y:Math.min(p.y,n),x1:Math.max(p.x1,r),y1:Math.max(p.y1,i)},h=!0;break}}}for(let e of[...m,...a])delete e.__rect;return this.boundary=ln(k(k({},p),{},{width:p.x1-p.x,height:p.y1-p.y}),this.quill.root),Array.from(m).sort((e,t)=>e.index-t.index).map(e=>(delete e.index,e.getCellInner()))}updateWithSelectedTds(){if(this.selectedTds.length<=0)return;let e={x:1/0,y:1/0},t={x:-1/0,y:-1/0};for(let n of this.selectedTds){let r=n.domNode.getBoundingClientRect();e.x=Math.min(e.x,r.left),e.y=Math.min(e.y,r.top),t.x=Math.max(t.x,r.right),t.y=Math.max(t.y,r.bottom)}this.selectedTds=this.computeSelectedTds(e,t),this.selectedTds.length>0?this.update():this.hide()}update(){if(this.selectedTds.length===0||!this.boundary||!this.table)return;let{x:e,y:t}=this.getQuillViewScroll(),{x:n,y:r}=this.getTableViewScroll(),i=this.table.parentElement.getBoundingClientRect(),a=this.quill.root.getBoundingClientRect(),o=i.x-a.x,s=i.y-a.y;this.startScrollX=n,this.startScrollY=r,Object.assign(this.cellSelect.style,{left:`${this.selectedEditorScrollX*2-e+this.boundary.x+this.selectedTableScrollX-n-o}px`,top:`${this.selectedEditorScrollY*2-t+this.boundary.y+this.selectedTableScrollY-r-s}px`,width:`${this.boundary.width}px`,height:`${this.boundary.height}px`}),Object.assign(this.cellSelectWrap.style,{left:`${o}px`,top:`${s}px`,width:`${i.width}px`,height:`${i.height}px`}),!this.dragging&&this.tableMenu&&this.tableMenu.update()}getQuillViewScroll(){return{x:this.quill.root.scrollLeft,y:this.quill.root.scrollTop}}getTableViewScroll(){return this.table?{x:this.table.parentElement.scrollLeft,y:this.table.parentElement.scrollTop}:{x:0,y:0}}setSelectionTable(e){this.table!==e&&(this.table=e)}showDisplay(){Object.assign(this.cellSelectWrap.style,{display:`block`}),this.isDisplaySelection=!0,this.table&&this.resizeObserver.observe(this.table)}show(){this.table&&(pn.call(this),this.update(),this.showDisplay(),document.addEventListener(`keydown`,this.removeCell),B.call(this,this.quill.root,()=>{this.update()}),B.call(this,this.table.parentElement,()=>{this.update()}))}hideDisplay(){Object.assign(this.cellSelectWrap.style,{display:`none`}),this.isDisplaySelection=!1,this.table&&this.resizeObserver.unobserve(this.table)}hide(){pn.call(this),document.removeEventListener(`keydown`,this.removeCell),this.hideDisplay(),this.boundary=null,this.selectedTds=[],this.setSelectionTable(void 0),this.tableMenu&&this.tableMenu.hide()}destroy(){this.resizeObserver.disconnect(),this.hide(),this.cellSelectWrap.remove(),this.tableMenu&&this.tableMenu.destroy(),pn.call(this),this.quill.root.removeEventListener(`mousedown`,this.mouseDownHandler),document.removeEventListener(`selectionchange`,this.selectionChangeHandler),this.quill.off(t.default.events.SELECTION_CHANGE,this.quillSelectionChangeHandler),this.quill.off(t.default.events.TEXT_CHANGE,this.updateAfterEvent),this.quill.on(f.AFTER_TABLE_RESIZE,this.updateAfterEvent)}};let Tr=[`attributes`],Er=[`style`],Dr=t.default.import(`parchment`),Or=t.default.import(`delta`),kr=t.default.import(`blots/break`),Ar=t.default.import(`ui/icons`);function jr(e,{tableId:t,rowId:n,colId:r}){let i={tableId:t,rowId:n,colId:r,colspan:1,rowspan:1},a=e.create(u.tableCell,i),o=e.create(u.tableCellInner,i),s=e.create(`block`);return s.appendChild(e.create(`break`)),o.appendChild(s),a.appendChild(o),a}function Mr(e){g.delete(u.tableCellInner),Object.assign(u,e.blotName||{}),Object.assign(d,e.tableUpSize||{}),Object.assign(f,e.tableUpEvent||{}),Object.assign(p,e.tableUpInternal||{}),Fr.moduleName=p.moduleName,Fr.toolName=u.tableWrapper,H.blotName=u.container,Z.blotName=u.tableWrapper,Y.blotName=u.tableMain,X.blotName=u.tableColgroup,J.blotName=u.tableCol,G.blotName=u.tableBody,W.blotName=u.tableRow,q.blotName=u.tableCell,U.blotName=u.tableCellInner,g.add(u.tableCellInner)}function Nr(e,t){return be({onSelect:(n,r)=>{e.insertTable(n,r),t&&t.close()},customBtn:e.options.customBtn,texts:e.options.texts})}function Pr(e){return{bindInHead:!1,key:e?`ArrowUp`:`ArrowDown`,collapsed:!0,format:[u.tableCellInner],handler(n,r){let i,a,o,s;try{[i,a,o,s]=x(r.line,[u.tableWrapper,u.tableMain,u.tableRow,u.tableCell])}catch(e){return!0}let c=a.getColIds(),l=e?`prev`:`next`,d=e?`tail`:`head`,f=i.descendants(K,0)[0],p;if(f){let e=window.getComputedStyle(f.domNode);p=l===`next`&&e.captionSide===`bottom`?f:l===`next`?i.next:f}else p=i[l];if(r.line[l]||!p)return!0;let m=o[l];if(m){let e=c.indexOf(s.colId),n=m.getCellByColId(c[e],l);if(!n)return!0;let i=n.children[d];i.children&&(i=i.children[d]);let a=i.offset(this.quill.scroll)+Math.min(r.offset,i.length()-1);this.quill.setSelection(a,0,t.default.sources.USER)}else{let n=p.offset(this.quill.scroll)+(e?p.length()-1:0);this.quill.setSelection(n,0,t.default.sources.USER)}return!1}}}var Fr=class e{static register(){Z.allowedChildren=[Y],Y.allowedChildren=[G,X,K],Y.requiredContainer=Z,K.requiredContainer=Y,X.allowedChildren=[J],X.requiredContainer=Y,G.allowedChildren=[W],G.requiredContainer=Y,W.allowedChildren=[q],q.requiredContainer=G,q.allowedChildren=[U,kr],q.requiredContainer=W,U.requiredContainer=q;let e=[`header`,`list`,`blockquote`,`code-block`].reduce((e,n)=>{let r=`formats/${n}`,i=t.default.import(r);return e[r]=class extends te(i,[On]){static register(){}},e},{});t.default.register(k(k({"blots/scroll":jn,"blots/block":On},e),{},{[`blots/${u.container}`]:H,[`formats/${u.tableCell}`]:q,[`formats/${u.tableCellInner}`]:U,[`formats/${u.tableRow}`]:W,[`formats/${u.tableBody}`]:G,[`formats/${u.tableCol}`]:J,[`formats/${u.tableColgroup}`]:X,[`formats/${u.tableCaption}`]:K,[`formats/${u.tableMain}`]:Y,[`formats/${u.tableWrapper}`]:Z,"modules/clipboard":Jn}),!0)}get statics(){return this.constructor}constructor(n,r){if(O(this,`quill`,void 0),O(this,`options`,void 0),O(this,`toolBox`,void 0),O(this,`fixTableByLisenter`,vn(this.balanceTables,100)),O(this,`selector`,void 0),O(this,`table`,void 0),O(this,`tableSelection`,void 0),O(this,`tableResize`,void 0),O(this,`tableScrollbar`,void 0),O(this,`tableAlign`,void 0),O(this,`tableResizeScale`,void 0),O(this,`resizeOb`,void 0),this.quill=n,this.options=this.resolveOptions(r||{}),this.toolBox=this.initialContainer(),!this.options.scrollbar){let e=y(`scrollbar`);this.quill.container.classList.add(e.bm(`origin`))}this.options.selection&&(this.tableSelection=new this.options.selection(this,this.quill,this.options.selectionOptions));let i=this.quill.getModule(`toolbar`);if(i&&this.quill.theme.pickers){let[,e]=(i.controls||[]).find(([e])=>e===this.statics.toolName)||[];if(e&&e.tagName.toLocaleLowerCase()===`select`){let t=this.quill.theme.pickers.find(t=>t.select===e);t&&(t.label.innerHTML=this.options.icon,this.buildCustomSelect(this.options.customSelect,t),t.label.addEventListener(`mousedown`,()=>{if(!this.selector||!t)return;let e=this.selector.getBoundingClientRect(),{leftLimited:n}=dn(e);if(n){let e=t.label.getBoundingClientRect();Object.assign(t.options.style,{transform:`translateX(calc(-100% + ${e.width}px))`})}else Object.assign(t.options.style,{transform:void 0})}))}}let a=this.quill.getModule(`keyboard`);for(let t of Object.values(e.keyboradHandler))t.bindInHead?a.bindings[t.key].unshift(t):a.addBinding(t.key,t);this.quill.root.addEventListener(`click`,e=>{let t=e.composedPath();if(!t||t.length<=0)return;let n=t.find(e=>e.tagName&&e.tagName.toUpperCase()===`TABLE`&&e.classList.contains(`ql-table`));if(n){if(this.table===n){this.tableSelection&&this.tableSelection.show(),this.tableAlign&&this.tableAlign.update(),this.tableResize&&this.tableResize.update(),this.tableScrollbar&&this.tableScrollbar.update();return}this.table&&this.hideTableTools(),this.showTableTools(n)}else this.table&&this.hideTableTools()},!1),this.quill.on(t.default.events.EDITOR_CHANGE,e=>{e===t.default.events.TEXT_CHANGE&&(!this.table||!this.quill.root.contains(this.table))&&this.hideTableTools()}),this.quillHack(),this.listenBalanceCells()}initialContainer(){let e=y(`toolbox`),t=this.quill.addContainer(e.b()),n=()=>{let e=this.quill.root.getBoundingClientRect(),{offsetLeft:n,offsetTop:r}=this.quill.root;Object.assign(t.style,{top:`${r}px`,left:`${n}px`,width:`${e.width}px`,height:`${e.height}px`})};return this.resizeOb=new ResizeObserver(n),this.resizeOb.observe(this.quill.root),t}addContainer(e){if(le(e)){let t=document.createElement(`div`);for(let n of e.split(` `))t.classList.add(n);return this.toolBox.appendChild(t),t}else return this.toolBox.appendChild(e),e}resolveOptions(e){return Object.assign({customBtn:!1,texts:this.resolveTexts(e.texts||{}),full:!1,fullSwitch:!0,icon:Ar.table,selectionOptions:{},alignOptions:{},scrollbarOptions:{},resizeOptions:{},resizeScaleOptions:{}},e)}resolveTexts(e){return Object.assign({fullCheckboxText:`Insert full width table`,customBtnText:`Custom`,confirmText:`Confirm`,cancelText:`Cancel`,rowText:`Row`,colText:`Column`,notPositiveNumberError:`Please enter a positive integer`,custom:`Custom`,clear:`Clear`,transparent:`Transparent`,perWidthInsufficient:`The percentage width is insufficient. To complete the operation, the table needs to be converted to a fixed width. Do you want to continue?`,CopyCell:`Copy cell`,CutCell:`Cut cell`,InsertTop:`Insert row above`,InsertRight:`Insert column right`,InsertBottom:`Insert row below`,InsertLeft:`Insert column Left`,MergeCell:`Merge Cell`,SplitCell:`Split Cell`,DeleteRow:`Delete Row`,DeleteColumn:`Delete Column`,DeleteTable:`Delete table`,BackgroundColor:`Set background color`,BorderColor:`Set border color`},e)}quillHack(){let e=this.quill.getSemanticHTML;this.quill.getSemanticHTML=(n=0,r)=>{let i=e.call(this.quill,n,r),a=t.default.import(`formats/${u.tableWrapper}`),o=new DOMParser,s=o.parseFromString(i,`text/html`);for(let e of Array.from(s.querySelectorAll(`.${a.className} caption[contenteditable], .${a.className} td > [contenteditable]`)))e.removeAttribute(`contenteditable`);return s.body.innerHTML};let n=this.quill.format;this.quill.format=function(e,r,i=t.default.sources.API){let a=this.scroll.query(e);if(!(a.prototype instanceof Dr.EmbedBlot)){let t=this.getModule(p.moduleName),a=this.getSelection(!0),o=this.getFormat(a);if(!o[u.tableCellInner]||a.length>0||t&&t.tableSelection&&t.tableSelection.selectedTds.length<=1)return n.call(this,e,r,i);if(t&&t.tableSelection&&t.tableSelection.selectedTds.length>0){let n=t.tableSelection.selectedTds,a=!1,o=[];for(let t of n){let n=t.offset(this.scroll),i=t.length();o.push({index:n,length:i});let s=this.getFormat(n,i);s[e]!==r&&(a=!0)}let s=a?r:!1,c=new Or;for(let[t,{index:n,length:r}]of o.entries()){let i=t===0?0:o[t-1].index+o[t-1].length;c.retain(n-i).retain(r,{[e]:s})}let l=this.updateContents(c,i);return this.blur(),l}}return n.call(this,e,r,i)};let r=this.quill.theme.modules.toolbar;if(r){var i;let e=(i=r.handlers)==null?void 0:i.clean;if(e){let n=(e,t,n=()=>``)=>{let r=this.quill.getText(e,t),[i,a]=this.quill.getLine(e+t),o=0,s=new Or;i!=null&&(o=i.length()-a,s=i.delta().slice(a,a+o-1).insert(`
|
|
124
|
-
`));
|
|
125
|
-
`&&
|
|
126
|
-
`});for(
|
|
127
|
-
`,attributes:{
|
|
128
|
-
<table class="${
|
|
123
|
+
`,$r=`color-selector`,Q={Break:{name:`break`},CopyCell:{name:`CopyCell`,tip:`Copy cell`,icon:Vr,handle:function(e,t){var n=e.getTextByCell(t),r=e.getHTMLByCell(t),i=new ClipboardItem({"text/plain":new Blob([n],{type:`text/plain`}),"text/html":new Blob([r],{type:`text/html`})});navigator.clipboard.write([i]),e.hideTableTools()}},CutCell:{name:`CutCell`,tip:`Cut cell`,icon:Hr,handle:function(e,t){var n=e.getTextByCell(t),r=e.getHTMLByCell(t,!0),i=new ClipboardItem({"text/plain":new Blob([n],{type:`text/plain`}),"text/html":new Blob([r],{type:`text/html`})});navigator.clipboard.write([i]),e.hideTableTools()}},InsertTop:{name:`InsertTop`,icon:Kr,tip:`Insert row above`,handle:function(e,t){e.appendRow(t,!1),e.hideTableTools()}},InsertRight:{name:`InsertRight`,icon:Gr,tip:`Insert column right`,handle:function(e,t){e.appendCol(t,!0),e.hideTableTools()}},InsertBottom:{name:`InsertBottom`,icon:Ur,tip:`Insert row below`,handle:function(e,t){e.appendRow(t,!0),e.hideTableTools()}},InsertLeft:{name:`InsertLeft`,icon:Wr,tip:`Insert column Left`,handle:function(e,t){e.appendCol(t,!1),e.hideTableTools()}},MergeCell:{name:`MergeCell`,icon:qr,tip:`Merge Cell`,handle:function(e,t){e.mergeCells(t),e.hideTableTools()}},SplitCell:{name:`SplitCell`,icon:Zr,tip:`Split Cell`,handle:function(e,t){e.splitCell(t),e.hideTableTools()}},DeleteRow:{name:`DeleteRow`,icon:Yr,tip:`Delete Row`,handle:function(e,t){e.removeRow(t),e.hideTableTools()}},DeleteColumn:{name:`DeleteColumn`,icon:Jr,tip:`Delete Column`,handle:function(e,t){e.removeCol(t),e.hideTableTools()}},DeleteTable:{name:`DeleteTable`,icon:Xr,tip:`Delete table`,handle:function(e,t){e.deleteTable(t)}},BackgroundColor:{name:`BackgroundColor`,icon:zr,isColorChoose:!0,tip:`Set background color`,key:`background-color`,handle:function(e,t,n){e.setCellAttrs(t,`background-color`,n,!0)}},BorderColor:{name:`BorderColor`,icon:Br,isColorChoose:!0,tip:`Set border color`,key:`border-color`,handle:function(e,t,n){e.setCellAttrs(t,`border-color`,n,!0)}},SwitchWidth:{name:`SwitchWidth`,icon:Rr,tip:`Switch table width`,handle:function(e){if(e.table){var n=t.default.find(e.table);n&&(n.full?n.cancelFull():n.setFull())}}},InsertCaption:{name:`InsertCaption`,icon:Qr,tip:`Insert table caption`,handle:function(e){if(e.table){var n=t.default.find(e.table);if(n){var r=e.quill.scroll.create(`text`,`Table Caption`).wrap(z.tableCaption,{tableId:n.tableId});n.insertBefore(r,n.children.head)}}}}},ei=10,ti=V(`color-map`),$={selectWrapper:ti.b(),used:ti.bm(`used`),item:ti.be(`item`),btn:ti.be(`btn`),map:ti.be(`content`),mapRow:ti.be(`content-row`)},ni=function(){function e(n,r,i){var a=this;v(this,e),S(this,`tableModule`,void 0),S(this,`quill`,void 0),S(this,`usedColors`,new Set),S(this,`options`,void 0),S(this,`menu`,null),S(this,`isMenuDisplay`,!1),S(this,`isColorPicking`,!1),S(this,`updateUsedColor`,void 0),S(this,`tooltipItem`,[]),S(this,`activeTooltip`,null),S(this,`bem`,V(`menu`)),S(this,`colorItemClass`,`color-${G()}`),S(this,`colorChooseTooltipOption`,{direction:`top`}),S(this,`updateWhenTextChange`,function(){a.isMenuDisplay&&a.update()}),this.tableModule=n,this.quill=r,this.options=this.resolveOptions(i);try{var o=localStorage.getItem(this.options.localstorageKey)||`[]`,s=JSON.parse(o);ke(s)||(s=[]),s.slice(-1*ei).map(function(e){return a.usedColors.add(e)})}catch(e){}this.updateUsedColor=$n(function(e){if(e){if(a.usedColors.add(e),a.usedColors.size>ei){var t=Array.from(a.usedColors).slice(-1*ei);a.usedColors.clear(),t.map(function(e){return a.usedColors.add(e)})}localStorage.setItem(a.options.localstorageKey,JSON.stringify(Array.from(a.usedColors)));for(var n=Array.from(document.querySelectorAll(`.${a.colorItemClass}.${$.used}`)),r=0,i=n;r<i.length;r++){var o=i[r],s=document.createElement(`div`);s.classList.add($.item),s.style.backgroundColor=String(e);var c=Array.from(o.querySelectorAll(`.${$.item}[style*="background-color: ${s.style.backgroundColor}"]`));c.length<=0&&o.appendChild(s);var l=Array.from(o.querySelectorAll(`.${$.item}`)).slice(0,-1*ei),u=x(l),d;try{for(u.s();!(d=u.n()).done;){var f=d.value;f.remove()}}catch(e){u.e(e)}finally{u.f()}}}},1e3),this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}return b(e,[{key:`resolveOptions`,value:function(e){var t=Object.assign({tipText:!0,tools:[Q.InsertTop,Q.InsertRight,Q.InsertBottom,Q.InsertLeft,Q.Break,Q.MergeCell,Q.SplitCell,Q.Break,Q.DeleteRow,Q.DeleteColumn,Q.DeleteTable,Q.Break,Q.BackgroundColor,Q.BorderColor],localstorageKey:`__table-bg-used-color`,defaultColorMap:ue},e);return t}},{key:`buildTools`,value:function(){var e=this,t=document.createElement(`div`);t.classList.add(this.bem.b()),Object.assign(t.style,{display:`flex`});var n=x(this.options.tools),r;try{var i=function(){var n=r.value,i=n.name,a=n.icon,o=n.handle,s=n.isColorChoose,c=n.key,l=n.tip,u=l===void 0?``:l,d=document.createElement(`span`);if(d.classList.add(e.bem.be(`item`)),i===`break`)d.classList.add(e.bem.is(`break`));else{var f=document.createElement(`i`);if(f.classList.add(`icon`),Oe(a)?f.appendChild(a(e.tableModule)):f.innerHTML=a,d.appendChild(f),s&&c){var p=e.createColorChoose(d,{name:i,icon:a,handle:o,isColorChoose:s,key:c,tip:u});e.tooltipItem.push(p),d.classList.add($r)}else Oe(o)&&d.addEventListener(`click`,function(t){e.quill.focus(),o(e.tableModule,e.getSelectedTds(),t)},!1);var m=e.tableModule.options.texts[i]||u;e.options.tipText&&m&&u&&e.createTipText(d,m)}t.appendChild(d)};for(n.s();!(r=n.n()).done;)i()}catch(e){n.e(e)}finally{n.f()}return t}},{key:`createColorChoose`,value:function(e,t){var n=this,r=t.handle,i=t.key,a=document.createElement(`div`);if(a.classList.add($.selectWrapper),this.options.defaultColorMap.length>0){var o=document.createElement(`div`);o.classList.add($.map);var s=x(this.options.defaultColorMap),c;try{for(s.s();!(c=s.n()).done;){var l=c.value,u=document.createElement(`div`);u.classList.add($.mapRow);var d=x(l),f;try{for(d.s();!(f=d.n()).done;){var p=f.value,m=document.createElement(`div`);m.classList.add($.item),m.style.backgroundColor=p,u.appendChild(m)}}catch(e){d.e(e)}finally{d.f()}o.appendChild(u)}}catch(e){s.e(e)}finally{s.f()}a.appendChild(o)}var h=document.createElement(`div`);h.classList.add($.mapRow),Object.assign(h.style,{marginTop:`4px`});var g=document.createElement(`div`);g.classList.add($.btn,`transparent`),g.textContent=this.tableModule.options.texts.transparent,g.addEventListener(`click`,function(){r(n.tableModule,n.getSelectedTds(),`transparent`)});var _=document.createElement(`div`);_.classList.add($.btn,`clear`),_.textContent=this.tableModule.options.texts.clear,_.addEventListener(`click`,function(){r(n.tableModule,n.getSelectedTds(),null)});var v=document.createElement(`div`);v.classList.add($.btn,`custom`),v.textContent=this.tableModule.options.texts.custom;var y=Fe({onChange:function(e){r(n.tableModule,n.getSelectedTds(),e),n.updateUsedColor(e)}}),b=Bn(v,{direction:`right`,type:`click`,content:y,container:v}),S=b.hide,C=b.destroy;h.appendChild(g),h.appendChild(_),h.appendChild(v),a.appendChild(h);var w=document.createElement(`div`);w.classList.add($.used,this.colorItemClass);var T=x(this.usedColors),E;try{for(T.s();!(E=T.n()).done;){var D=E.value,O=document.createElement(`div`);O.classList.add($.item),O.style.backgroundColor=D,w.appendChild(O)}}catch(e){T.e(e)}finally{T.f()}a.appendChild(w),a.addEventListener(`click`,function(e){e.stopPropagation(),S();var t=e.target,r=t.style.backgroundColor,a=n.getSelectedTds();if(t&&r&&a.length>0){if(n.tableModule.setCellAttrs(a,i,r,!0),!t.closest(`.${$.item}`))return;n.updateUsedColor(r)}});var k=Bn(e,M({type:`click`,content:a,onOpen:function(){return n.isMenuDisplay&&n.tableModule.tableSelection&&n.tableModule.tableSelection.hideDisplay(),n.setActiveTooltip(k),!1},onClose:function(){n.isMenuDisplay&&n.tableModule.tableSelection&&(n.tableModule.tableSelection.updateWithSelectedTds(),n.tableModule.tableSelection.showDisplay());var e=a.contains(y);return e&&S(),n.activeTooltip===k&&(n.activeTooltip=null),!1},onDestroy:function(){C(),n.activeTooltip===k&&(n.activeTooltip=null)}},this.colorChooseTooltipOption));return k.isColorPick=!0,k}},{key:`setActiveTooltip`,value:function(e){this.activeTooltip&&this.activeTooltip!==e&&this.activeTooltip.hide(!0),this.activeTooltip=e}},{key:`getSelectedTds`,value:function(){var e;return((e=this.tableModule.tableSelection)==null?void 0:e.selectedTds)||[]}},{key:`createTipText`,value:function(e,t){var n=Bn(e,{msg:t});n&&this.tooltipItem.push(n)}},{key:`show`,value:function(){!this.menu||!this.tableModule.tableSelection||!this.tableModule.tableSelection.boundary||(Object.assign(this.menu.style,{display:`flex`}),this.isMenuDisplay=!0,this.update())}},{key:`update`,value:function(){}},{key:`hide`,value:function(){this.menu&&Object.assign(this.menu.style,{display:`none`});var e=x(this.tooltipItem),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.hide(!0)}}catch(t){e.e(t)}finally{e.f()}this.isMenuDisplay=!1}},{key:`destroy`,value:function(){this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.activeTooltip=null;var e=x(this.tooltipItem),n;try{for(e.s();!(n=e.n()).done;){var r=n.value;r.destroy()}}catch(t){e.e(t)}finally{e.f()}this.menu&&(this.hide(),this.menu.remove(),this.menu=null)}}])}(),ri=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n,r]),S(i,`tableModule`,void 0),S(i,`quill`,void 0),S(i,`colorChooseTooltipOption`,{direction:`right`}),S(i,`listenContextmenu`,function(e){var t;e.preventDefault();var n=e.composedPath();if(!(!n||n.length<=0)){var r=n.find(function(e){return e.tagName&&e.tagName.toUpperCase()===`TABLE`&&e.classList.contains(`ql-table`)});r&&(t=i.tableModule.tableSelection)!=null&&(t=t.selectedTds)!=null&&t.length?(i.menu||(i.menu=i.buildTools()),Object.assign(i.menu.style,{display:`flex`}),i.isMenuDisplay=!0,i.update({x:e.clientX,y:e.clientY}),document.addEventListener(`click`,function(){i.hide()},{once:!0})):i.hide()}}),i.tableModule=e,i.quill=n,i.quill.root.addEventListener(`contextmenu`,i.listenContextmenu),i}return T(t,e),b(t,[{key:`buildTools`,value:function(){var e=I(t,`buildTools`,this,3)([]);e.classList.add(this.bem.is(`contextmenu`));for(var n=e.getElementsByClassName($r),r=0,i=Array.from(n);r<i.length;r++){var a=i[r];a.addEventListener(`click`,function(e){return e.stopPropagation()})}return document.body.appendChild(e),e}},{key:`createTipText`,value:function(e,t){var n=document.createElement(`span`);n.textContent=t,e.appendChild(n)}},{key:`show`,value:function(){}},{key:`update`,value:function(e){if(!(!this.isMenuDisplay||!this.menu||!this.tableModule.tableSelection||!this.tableModule.tableSelection.isDisplaySelection)&&e){I(t,`update`,this,3)([]);var n={display:`flex`,left:0,top:0},r=e.x,i=e.y;n.left=r,n.top=i,Object.assign(this.menu.style,M(M({},n),{},{left:`${n.left+window.scrollX}px`,top:`${n.top+window.scrollY}px`}));var a=this.menu.getBoundingClientRect(),o=Wn(a),s=o.left,c=o.top;Object.assign(this.menu.style,{left:`${s+window.scrollX}px`,top:`${c+window.scrollY}px`})}}},{key:`destroy`,value:function(){this.quill.root.removeEventListener(`contextmenu`,this.listenContextmenu),I(t,`destroy`,this,3)([])}}])}(ni),ii=function(e){function t(e,n,r){var i;return v(this,t),i=_(this,t,[e,n,r]),S(i,`tableModule`,void 0),S(i,`quill`,void 0),i.tableModule=e,i.quill=n,i.menu=i.buildTools(),i.tableModule.addContainer(i.menu),i.show(),i.update(),i}return T(t,e),b(t,[{key:`update`,value:function(){var e=this;!this.isMenuDisplay||!this.menu||!this.tableModule.tableSelection||!this.tableModule.tableSelection.isDisplaySelection||(I(t,`update`,this,3)([]),In(this.tableModule.tableSelection.cellSelect,this.menu,{placement:`bottom`,middleware:[Pn(),Nn({limiter:Fn()}),Mn(20)]}).then(function(t){var n=t.x,r=t.y;Object.assign(e.menu.style,{left:`${n}px`,top:`${r}px`})}))}}])}(ni),ai=function(e){return!e.full&&e.align===`right`},oi=function(){function e(t,n){v(this,e),S(this,`tableModule`,void 0),S(this,`quill`,void 0),S(this,`colIndex`,-1),S(this,`tableMain`,void 0),S(this,`dragging`,!1),S(this,`dragColBreak`,null),S(this,`handleColMouseUpFunc`,this.handleColMouseUp.bind(this)),S(this,`handleColMouseMoveFunc`,this.handleColMouseMove.bind(this)),S(this,`handleColMouseDownFunc`,this.handleColMouseDown.bind(this)),S(this,`rowIndex`,-1),S(this,`dragRowBreak`,null),S(this,`handleRowMouseUpFunc`,this.handleRowMouseUp.bind(this)),S(this,`handleRowMouseMoveFunc`,this.handleRowMouseMove.bind(this)),S(this,`handleRowMouseDownFunc`,this.handleRowMouseDown.bind(this)),S(this,`dragBEM`,V(`drag-line`)),this.tableModule=t,this.quill=n}return b(e,[{key:`findCurrentColIndex`,value:function(e){return-1}},{key:`colWidthChange`,value:function(e,t,n){}},{key:`createConfirmDialog`,value:function(){var e=g(P().mark(function e(t){var n,r,i;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.message,r=t.confirm,i=t.cancel,e.abrupt(`return`,new Promise(function(e){var t=document.createElement(`div`);Object.assign(t.style,{padding:`8px 12px`,fontSize:`14px`,lineHeight:`1.5`});var a=document.createElement(`p`);a.textContent=n;var o=document.createElement(`div`);Object.assign(o.style,{display:`flex`,justifyContent:`flex-end`,gap:`6px`});var s=Pe({content:i}),c=Pe({type:`confirm`,content:r});o.appendChild(s),o.appendChild(c),t.appendChild(a),t.appendChild(o);var l=Le({child:t}),u=l.close;s.addEventListener(`click`,function(){e(!1),u()}),c.addEventListener(`click`,function(){e(!0),u()})}));case 2:case`end`:return e.stop()}},e)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`handleColMouseUp`,value:function(){var e=g(P().mark(function e(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,S,C,w,T,E,D,O,k,A,j;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!this.dragColBreak||!this.tableMain||this.colIndex===-1)){e.next=2;break}return e.abrupt(`return`);case 2:if(t=this.tableMain.getCols(),n=Number.parseInt(this.dragColBreak.dataset.w||`0`),r=this.tableMain.full,i=!1,a=[],r?(o=this.tableMain.domNode.getBoundingClientRect().width,s=n/o*100,c=t[this.colIndex].width,s<c?(s=Math.max(B.colMinWidthPre,s),t[this.colIndex+1]||t[this.colIndex-1]?(l=t[this.colIndex+1]?this.colIndex+1:this.colIndex-1,a.push({index:l,width:t[l].width+c-s})):s=100,i=!0,a.push({index:this.colIndex,width:s})):t[this.colIndex+1]&&(u=c+t[this.colIndex+1].width,s=Math.min(u-B.colMinWidthPre,s),i=!0,a.push({index:this.colIndex,width:s},{index:this.colIndex+1,width:u-s}))):(this.tableMain.domNode.style.width=`${Number.parseFloat(this.tableMain.domNode.style.width)-t[this.colIndex].domNode.getBoundingClientRect().width+n}px`,i=!0,a.push({index:this.colIndex,width:n})),document.body.removeChild(this.dragColBreak),this.dragColBreak=null,document.removeEventListener(`mouseup`,this.handleColMouseUpFunc),document.removeEventListener(`mousemove`,this.handleColMouseMoveFunc),this.dragging=!1,!i){e.next=47;break}if(d=this.tableMain.domNode.getBoundingClientRect().width,!r){e.next=45;break}f=0,p=new Set(a.map(function(e){var t=e.index,n=e.width;return f+=n,t})),m=x(t.entries()),e.prev=19,m.s();case 21:if((h=m.n()).done){e.next=28;break}if(g=F(h.value,2),_=g[0],v=g[1],!p.has(_)){e.next=25;break}return e.abrupt(`continue`,26);case 25:f+=v.width;case 26:e.next=21;break;case 28:e.next=33;break;case 30:e.prev=30,e.t0=e.catch(19),m.e(e.t0);case 33:return e.prev=33,m.f(),e.finish(33);case 36:if(!(f>100)){e.next=45;break}return e.next=39,this.createConfirmDialog({message:this.tableModule.options.texts.perWidthInsufficient,confirm:this.tableModule.options.texts.confirmText,cancel:this.tableModule.options.texts.cancelText});case 39:if(e.sent){e.next=41;break}return e.abrupt(`return`);case 41:this.tableMain.cancelFull(),r=!1,y=x(a.entries());try{for(y.s();!(b=y.n()).done;)S=F(b.value,2),C=S[0],w=S[1],T=w.width,E=w.index,a[C]={index:E,width:T/100*d}}catch(e){y.e(e)}finally{y.f()}case 45:D=x(a);try{for(D.s();!(O=D.n()).done;)k=O.value,A=k.index,j=k.width,t[A].width=`${Math.round(j)}${r?`%`:`px`}`,this.colWidthChange(A,{px:Math.round(j/100*d),pre:Math.round(j)},r)}catch(e){D.e(e)}finally{D.f()}case 47:this.quill.emitter.emit(ce.AFTER_TABLE_RESIZE);case 48:case`end`:return e.stop()}},e,this,[[19,30,33,36]])}));function t(){return e.apply(this,arguments)}return t}()},{key:`getColumnRect`,value:function(e){if(!this.tableMain)return null;var t=this.tableMain.getCols();if(e>=t.length)return null;for(var n=t[0].domNode.getBoundingClientRect().left,r=0;r<e;r++){var i=t[r].domNode.getBoundingClientRect();n+=i.width}var a=t[e],o=a.domNode.getBoundingClientRect().width;return{left:n,right:n+o,width:o}}},{key:`handleColMouseMove`,value:function(e){if(e.preventDefault(),!(!this.dragColBreak||!this.tableMain||this.colIndex===-1)){var t=this.tableMain.getCols(),n=this.getColumnRect(this.colIndex),r=this.tableMain.domNode.getBoundingClientRect(),i=e.clientX;if(this.tableMain.full){var a=B.colMinWidthPre/100*r.width,o=r.right;i>n.right&&t[this.colIndex+1]&&(o=Math.max(this.getColumnRect(this.colIndex+1).right-a,n.left+a));var s=n.left+a;i=Math.min(Math.max(i,s),o)}else ai(this.tableMain)?n.right-i<B.colMinWidthPx&&(i=n.right-B.colMinWidthPx):i-n.left<B.colMinWidthPx&&(i=n.left+B.colMinWidthPx);var c=i-n.left;return ai(this.tableMain)&&(c=n.right-i),this.dragColBreak.style.left=`${i}px`,this.dragColBreak.dataset.w=String(c),{left:i,width:c}}}},{key:`handleColMouseDown`,value:function(e){if(e.button===0&&(e.preventDefault(),this.tableMain)){var t=Dr(this.tableMain),n=t.rect,r=t.body;if(!(!r||!n)){var i=this.tableMain.getCols();if(this.colIndex=this.findCurrentColIndex(e),this.colIndex!==-1){var a=i[this.colIndex].width,o=this.tableMain.full?a/100*n.width:a;document.addEventListener(`mouseup`,this.handleColMouseUpFunc),document.addEventListener(`mousemove`,this.handleColMouseMoveFunc),this.dragging=!0;var s=document.createElement(`div`);s.classList.add(this.dragBEM.b(),this.dragBEM.is(`col`)),s.dataset.w=String(o);var c={top:n.y,left:e.clientX,height:n.height};Object.assign(s.style,{top:`${c.top}px`,left:`${c.left}px`,height:`${c.height}px`});var l=document.body;return l.appendChild(s),this.dragColBreak&&l.removeChild(this.dragColBreak),this.dragColBreak=s,c}}}}},{key:`findCurrentRowIndex`,value:function(e){return-1}},{key:`rowHeightChange`,value:function(e,t){}},{key:`handleRowMouseUp`,value:function(){if(!(!this.tableMain||!this.dragRowBreak||this.rowIndex===-1)){var e=Number.parseInt(this.dragRowBreak.dataset.h||`0`),t=this.tableMain.getRows();t[this.rowIndex].setHeight(`${e}px`),this.rowHeightChange(this.rowIndex,e),document.body.removeChild(this.dragRowBreak),this.dragRowBreak=null,document.removeEventListener(`mouseup`,this.handleRowMouseUpFunc),document.removeEventListener(`mousemove`,this.handleRowMouseMoveFunc),this.dragging=!1,this.quill.emitter.emit(ce.AFTER_TABLE_RESIZE)}}},{key:`handleRowMouseMove`,value:function(e){if(!(!this.tableMain||!this.dragRowBreak||this.rowIndex===-1)){e.preventDefault();var t=this.tableMain.getRows(),n=t[this.rowIndex].domNode.getBoundingClientRect(),r=e.clientY;return r-n.y<B.rowMinHeightPx&&(r=n.y+B.rowMinHeightPx),this.dragRowBreak.style.top=`${r}px`,this.dragRowBreak.dataset.h=String(r-n.y),{top:r,height:r-n.y}}}},{key:`handleRowMouseDown`,value:function(e){if(e.button===0&&(e.preventDefault(),this.tableMain&&(this.rowIndex=this.findCurrentRowIndex(e),this.rowIndex!==-1))){this.dragging=!0,document.addEventListener(`mouseup`,this.handleRowMouseUpFunc),document.addEventListener(`mousemove`,this.handleRowMouseMoveFunc);var t=this.tableMain.getRows(),n=t[this.rowIndex].domNode.getBoundingClientRect().height,r=this.tableMain.domNode.getBoundingClientRect(),i=document.createElement(`div`);i.classList.add(this.dragBEM.b(),this.dragBEM.is(`row`)),i.dataset.h=String(n);var a={top:e.clientY,left:r.x,width:r.width};Object.assign(i.style,{top:`${a.top}px`,left:`${a.left}px`,width:`${a.width}px`});var o=document.body;return o.appendChild(i),this.dragRowBreak&&o.removeChild(this.dragRowBreak),this.dragRowBreak=i,a}}},{key:`update`,value:function(){}},{key:`destroy`,value:function(){}}])}(),si=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,i]),S(a,`tableModule`,void 0),S(a,`table`,void 0),S(a,`root`,void 0),S(a,`tableMain`,void 0),S(a,`tableWrapper`,void 0),S(a,`resizeObserver`,void 0),S(a,`tableCols`,[]),S(a,`tableRows`,[]),S(a,`rowHeadWrapper`,null),S(a,`colHeadWrapper`,null),S(a,`corner`,null),S(a,`scrollHandler`,[]),S(a,`lastHeaderSelect`,null),S(a,`size`,12),S(a,`bem`,V(`resize-box`)),S(a,`updateWhenTextChange`,function(){a.update()}),S(a,`handleColMouseDownFunc`,function(e){var t=this.handleColMouseDown(e);if(t&&this.dragColBreak){var n=_e(this.tableMain,xr),r=F(n,1),i=r[0],a=i&&i.side===`top`?0:this.size;Object.assign(this.dragColBreak.style,{top:`${t.top-a}px`,left:`${t.left}px`,height:`${t.height+this.size}px`})}return t}.bind(a)),S(a,`handleRowMouseDownFunc`,function(e){var t=this.handleRowMouseDown(e);return t&&this.dragRowBreak&&Object.assign(this.dragRowBreak.style,{top:`${t.top}px`,left:`${t.left-this.size}px`,width:`${t.width+this.size}px`}),t}.bind(a)),a.tableModule=e,a.table=r,a.tableMain=t.default.find(a.table),!a.tableMain||(a.tableWrapper=a.tableMain.parent,!a.tableWrapper)?te(a):(a.root=a.tableModule.addContainer(a.bem.b()),a.resizeObserver=new ResizeObserver(function(){a.show()}),a.resizeObserver.observe(a.table),a.quill.on(t.default.events.TEXT_CHANGE,a.updateWhenTextChange),a)}return T(n,e),b(n,[{key:`handleResizerHeader`,value:function(e,t,n){var r=n.clientX,i=n.clientY,a=this.table.getBoundingClientRect();if(this.tableModule.tableSelection){var o=this.tableModule.tableSelection;n.shiftKey||(this.lastHeaderSelect=null);var s=[{x:e?a.left:r,y:e?i:a.top},{x:e?a.right:r,y:e?i:a.bottom}];if(this.lastHeaderSelect){var c,l;if(this.lastHeaderSelect.isX){var u=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`))),d=u[this.lastHeaderSelect.index].getBoundingClientRect();c=Math.min(d.left,a.left),l=d.top+d.height/2}else{var f=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`))),p=f[this.lastHeaderSelect.index].getBoundingClientRect();c=p.left+p.width/2,l=Math.min(p.top,a.top)}this.lastHeaderSelect.isX===e?e?(s[0].y=Math.min(s[0].y,l),s[1].y=Math.max(s[1].y,l)):(s[0].x=Math.min(s[0].x,c),s[1].x=Math.max(s[1].x,c)):(s[1]={x:Math.max(s[0].x,c),y:Math.max(s[0].y,l)},s[0]={x:Math.min(s[0].x,c),y:Math.min(s[0].y,l)})}else this.lastHeaderSelect={isX:e,index:t};o.table=this.table,o.selectedTds=o.computeSelectedTds.apply(o,s),o.show()}}},{key:`findCurrentColIndex`,value:function(e){return Array.from(this.root.getElementsByClassName(this.bem.be(`col-separator`))).indexOf(e.target)}},{key:`colWidthChange`,value:function(e,t,n){var r=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`)));r[e].style.width=n?`${t.pre}%`:`${t.px}px`}},{key:`bindColEvents`,value:function(){var e=this,t=Array.from(this.root.getElementsByClassName(this.bem.be(`col-header`))),n=Array.from(this.root.getElementsByClassName(this.bem.be(`col-separator`)));Kn.call(this,this.tableWrapper.domNode,function(){e.colHeadWrapper.scrollLeft=e.tableWrapper.domNode.scrollLeft});var r=x(t.entries()),i;try{for(r.s();!(i=r.n()).done;){var a=F(i.value,2),o=a[0],s=a[1];s.addEventListener(`click`,this.handleResizerHeader.bind(this,!1,o))}}catch(e){r.e(e)}finally{r.f()}for(var c=0,l=n;c<l.length;c++){var u=l[c];u.addEventListener(`mousedown`,this.handleColMouseDownFunc),u.addEventListener(`dragstart`,function(e){return e.preventDefault()})}}},{key:`findCurrentRowIndex`,value:function(e){return Array.from(this.root.getElementsByClassName(this.bem.be(`row-separator`))).indexOf(e.target)}},{key:`rowHeightChange`,value:function(e,t){var n=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`)));n[e].style.height=`${t}px`}},{key:`bindRowEvents`,value:function(){var e=this,t=Array.from(this.root.getElementsByClassName(this.bem.be(`row-header`))),n=Array.from(this.root.getElementsByClassName(this.bem.be(`row-separator`)));Kn.call(this,this.tableWrapper.domNode,function(){e.rowHeadWrapper.scrollTop=e.tableWrapper.domNode.scrollTop});var r=x(t.entries()),i;try{for(r.s();!(i=r.n()).done;){var a=F(i.value,2),o=a[0],s=a[1];s.addEventListener(`click`,this.handleResizerHeader.bind(this,!0,o))}}catch(e){r.e(e)}finally{r.f()}for(var c=0,l=n;c<l.length;c++){var u=l[c];u.addEventListener(`mousedown`,this.handleRowMouseDownFunc),u.addEventListener(`dragstart`,function(e){return e.preventDefault()})}}},{key:`update`,value:function(){var e=Dr(this.tableMain),t=e.rect,n=e.body;if(!(!n||!t)){var r=this.tableWrapper.domNode.getBoundingClientRect(),i=this.quill.root.getBoundingClientRect();Object.assign(this.root.style,{top:`${Math.max(t.y,r.y)-i.y}px`,left:`${Math.max(t.x,r.x)-i.x}px`});var a=-1*this.size,o=-1*this.size;ai(this.tableMain)?(this.root.classList.add(this.bem.is(`align-right`)),a=Math.min(r.width,t.width),o=Math.min(r.width,t.width)):this.root.classList.remove(this.bem.is(`align-right`));var s=_e(this.tableMain,xr),c=F(s,1),l=c[0],u=!l||!(l&&l.side===`top`);u?this.root.classList.remove(this.bem.is(`caption-bottom`)):this.root.classList.add(this.bem.is(`caption-bottom`)),this.corner&&Object.assign(this.corner.style,{transform:`translateY(${-1*this.size}px) translateX(${a}px)`,top:`${u?0:t.height+this.size}px`}),this.rowHeadWrapper&&Object.assign(this.rowHeadWrapper.style,{transform:`translateX(${o}px)`}),this.colHeadWrapper&&Object.assign(this.colHeadWrapper.style,{top:`${u?0:t.height+this.size}px`})}}},{key:`show`,value:function(){var e=this;this.tableCols=this.tableMain.getCols(),this.tableRows=this.tableMain.getRows(),this.root.innerHTML=``;var t=Dr(this.tableMain),n=t.rect,r=t.body;if(!(!r||!n)){var i=this.tableWrapper.domNode.getBoundingClientRect();if(this.tableCols.length>0&&this.tableRows.length>0&&(this.corner=document.createElement(`div`),this.corner.classList.add(this.bem.be(`corner`)),Object.assign(this.corner.style,{width:`${this.size}px`,height:`${this.size}px`}),this.corner.addEventListener(`click`,function(){if(e.tableModule.tableSelection){var t=e.tableMain.descendants(q),n=e.tableModule.tableSelection;n.selectedTds=t,n.show(),n.updateWithSelectedTds()}}),this.root.appendChild(this.corner)),this.tableCols.length>0){var a=``,o=x(this.tableCols.entries()),s;try{for(o.s();!(s=o.n()).done;){var c=F(s.value,2),l=c[1],u=l.domNode.getBoundingClientRect().width;a+=`<div class="${this.bem.be(`col-header`)}" style="width: ${u}px">
|
|
124
|
+
<div class="${this.bem.be(`col-separator`)}" style="height: ${n.height+this.size-3}px"></div>
|
|
125
|
+
</div>`}}catch(e){o.e(e)}finally{o.f()}var d=document.createElement(`div`);d.classList.add(this.bem.be(`col`));var f=document.createElement(`div`);f.classList.add(this.bem.be(`col-wrapper`)),Object.assign(d.style,{transform:`translateY(-${this.size}px)`,maxWidth:`${i.width}px`,height:`${this.size}px`}),Object.assign(f.style,{width:`${n.width}px`}),f.innerHTML=a,d.appendChild(f),this.root.appendChild(d),d.scrollLeft=this.tableWrapper.domNode.scrollLeft,this.colHeadWrapper=d,this.bindColEvents()}if(this.tableRows.length>0){var p=``,m=x(this.tableRows.entries()),h;try{for(m.s();!(h=m.n()).done;){var g=F(h.value,2),_=g[1],v=`${_.domNode.getBoundingClientRect().height}px`;p+=`<div class="${this.bem.be(`row-header`)}" style="height: ${Number.parseFloat(v)}px">
|
|
126
|
+
<div class="${this.bem.be(`row-separator`)}" style="width: ${n.width+this.size-3}px"></div>
|
|
127
|
+
</div>`}}catch(e){m.e(e)}finally{m.f()}var y=document.createElement(`div`);y.classList.add(this.bem.be(`row`));var b=document.createElement(`div`);b.classList.add(this.bem.be(`row-wrapper`)),Object.assign(y.style,{transform:`translateX(-${this.size}px)`,width:`${this.size}px`,maxHeight:`${i.height}px`}),Object.assign(b.style,{height:`${n.height}px`}),b.innerHTML=p,y.appendChild(b),this.root.appendChild(y),y.scrollTop=this.tableWrapper.domNode.scrollTop,this.rowHeadWrapper=y,this.bindRowEvents()}this.update(),Kn.call(this,this.quill.root,function(){e.update()})}}},{key:`hide`,value:function(){this.root.classList.add(this.bem.is(`hidden`))}},{key:`destroy`,value:function(){this.hide(),qn.call(this),this.resizeObserver.disconnect(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange);var e=x(this.scrollHandler),n;try{for(e.s();!(n=e.n()).done;){var r=F(n.value,2),i=r[0],a=r[1];i.removeEventListener(`scroll`,a)}}catch(t){e.e(t)}finally{e.f()}this.root.remove()}}])}(oi),ci=function(e){function n(e,r,i){var a;return v(this,n),a=_(this,n,[e,i]),S(a,`tableModule`,void 0),S(a,`table`,void 0),S(a,`colResizer`,void 0),S(a,`rowResizer`,void 0),S(a,`currentTableCell`,void 0),S(a,`dragging`,!1),S(a,`curColIndex`,-1),S(a,`curRowIndex`,-1),S(a,`tableCellBlot`,void 0),S(a,`bem`,V(`resize-line`)),S(a,`mousemoveHandler`,function(e){if(!a.dragging&&!(a.tableModule.tableSelection&&a.tableModule.tableSelection.dragging)){var n=a.findTableCell(e);if(!n)return a.hide();var r=t.default.find(n);r&&a.currentTableCell!==n&&(a.show(),a.currentTableCell=n,a.tableCellBlot=r,a.tableMain=H(r,z.tableMain),a.tableMain.getCols().length>0&&a.updateColResizer(),a.updateRowResizer())}}),S(a,`hideWhenTextChange`,function(){a.hide()}),S(a,`handleColMouseUpFunc`,g(P().mark(function e(){return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.handleColMouseUp();case 2:this.updateColResizer();case 3:case`end`:return e.stop()}},e,this)})).bind(a)),S(a,`handleRowMouseUpFunc`,function(){this.handleRowMouseUp(),this.updateRowResizer()}.bind(a)),a.tableModule=e,a.table=r,a.colResizer=a.tableModule.addContainer(a.bem.be(`col`)),a.rowResizer=a.tableModule.addContainer(a.bem.be(`row`)),a.table.addEventListener(`mousemove`,a.mousemoveHandler),a.quill.on(t.default.events.TEXT_CHANGE,a.hideWhenTextChange),a}return T(n,e),b(n,[{key:`findTableCell`,value:function(e){var t=x(e.composedPath()),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;if(r instanceof HTMLElement&&r.tagName===`TD`)return r;if(r===document.body)return null}}catch(e){t.e(e)}finally{t.f()}return null}},{key:`findCurrentColIndex`,value:function(){var e;return this.curColIndex+(((e=this.tableCellBlot)==null?void 0:e.colspan)||1)-1}},{key:`updateColResizer`,value:function(){if(!(!this.tableMain||!this.tableCellBlot)){var e=this.tableCellBlot;this.tableModule.toolBox.removeChild(this.colResizer),this.colResizer=this.tableModule.addContainer(this.bem.be(`col`));var t=he(e,[z.tableBody]),n=F(t,1),r=n[0],i=r.domNode.getBoundingClientRect(),a=e.domNode.getBoundingClientRect(),o=this.quill.root.getBoundingClientRect(),s=a.right-o.x;ai(this.tableMain)&&(s=a.left-o.x),Object.assign(this.colResizer.style,{top:`${i.y-o.y}px`,left:`${s}px`,height:`${i.height}px`});var c=this.tableMain.getCols();this.curColIndex=c.findIndex(function(t){return t.colId===e.colId}),this.colResizer.addEventListener(`mousedown`,this.handleColMouseDownFunc),this.colResizer.addEventListener(`dragstart`,function(e){e.preventDefault()})}}},{key:`findCurrentRowIndex`,value:function(){return this.curRowIndex}},{key:`updateRowResizer`,value:function(){if(!(!this.tableMain||!this.tableCellBlot)){var e=this.tableCellBlot;this.tableModule.toolBox.removeChild(this.rowResizer),this.rowResizer=this.tableModule.addContainer(this.bem.be(`row`));var t=e.parent;if(t instanceof J){var n=he(e,[z.tableBody]),r=F(n,1),i=r[0],a=i.domNode.getBoundingClientRect(),o=e.domNode.getBoundingClientRect(),s=this.quill.root.getBoundingClientRect();Object.assign(this.rowResizer.style,{top:`${o.bottom-s.y}px`,left:`${a.x-s.x}px`,width:`${a.width}px`});var c=this.tableMain.getRows();this.curRowIndex=c.indexOf(t),this.rowResizer.addEventListener(`mousedown`,this.handleRowMouseDownFunc),this.rowResizer.addEventListener(`dragstart`,function(e){e.preventDefault()})}}}},{key:`show`,value:function(){this.rowResizer.classList.remove(this.bem.is(`hidden`)),this.colResizer.classList.remove(this.bem.is(`hidden`))}},{key:`hide`,value:function(){this.currentTableCell=void 0,this.rowResizer.classList.add(this.bem.is(`hidden`)),this.colResizer.classList.add(this.bem.is(`hidden`))}},{key:`update`,value:function(){this.updateColResizer(),this.updateRowResizer()}},{key:`destroy`,value:function(){this.colResizer.remove(),this.rowResizer.remove(),this.table.removeEventListener(`mousemove`,this.mousemoveHandler),this.quill.off(t.default.events.TEXT_CHANGE,this.hideWhenTextChange)}}])}(oi),li=function(){function e(n,r,i,a){var o=this;v(this,e),S(this,`tableModule`,void 0),S(this,`table`,void 0),S(this,`quill`,void 0),S(this,`scrollHandler`,[]),S(this,`tableMainBlot`,null),S(this,`tableWrapperBlot`,null),S(this,`bem`,V(`scale`)),S(this,`startX`,0),S(this,`startY`,0),S(this,`offset`,6),S(this,`options`,void 0),S(this,`root`,void 0),S(this,`block`,void 0),S(this,`resizeobserver`,new ResizeObserver(function(){return o.update()})),S(this,`updateWhenTextChange`,function(){o.update()}),this.tableModule=n,this.table=r,this.quill=i,this.options=this.resolveOptions(a),this.tableMainBlot=t.default.find(r),this.tableMainBlot&&!this.tableMainBlot.full&&(this.tableWrapperBlot=this.tableMainBlot.parent,this.buildResizer(),this.show()),this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}return b(e,[{key:`resolveOptions`,value:function(e){return Object.assign({blockSize:12},e)}},{key:`buildResizer`,value:function(){var e=this;if(!(!this.tableMainBlot||!this.tableWrapperBlot)){this.root=this.tableModule.addContainer(this.bem.b()),this.root.classList.add(this.bem.is(`hidden`)),this.block=document.createElement(`div`),this.block.classList.add(this.bem.be(`block`)),Object.assign(this.block.style,{width:`${this.options.blockSize}px`,height:`${this.options.blockSize}px`}),this.root.appendChild(this.block);var t=[],n=[],r=function(r){if(e.tableMainBlot){var i=ai(e.tableMainBlot)?-1:1,a=(r.clientX-e.startX)*i,o=r.clientY-e.startY,s=Math.floor(a/t.length),c=Math.floor(o/n.length),l=x(t),u;try{for(l.s();!(u=l.n()).done;){var d=u.value,f=d.blot,p=d.width;f.width=Math.max(p+s,B.colMinWidthPx)}}catch(e){l.e(e)}finally{l.f()}var m=x(n),h;try{for(m.s();!(h=m.n()).done;){var g=h.value,_=g.blot,v=g.height;_.setHeight(`${Math.max(v+c,B.rowMinHeightPx)}px`)}}catch(e){m.e(e)}finally{m.f()}}},i=function(){t=[],n=[],document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};this.block.addEventListener(`mousedown`,function(a){!e.tableMainBlot||e.isTableOutofEditor()||(e.startX=a.clientX,e.startY=a.clientY,t=e.tableMainBlot.getCols().map(function(e){return{blot:e,width:Math.floor(e.width)}}),n=e.tableMainBlot.getRows().map(function(e){return{blot:e,height:Math.floor(e.domNode.getBoundingClientRect().height)}}),document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i))}),this.block.addEventListener(`dragstart`,function(e){return e.preventDefault()}),this.resizeobserver.observe(this.tableMainBlot.domNode),Kn.call(this,this.quill.root,function(){return e.update()}),Kn.call(this,this.tableWrapperBlot.domNode,function(){return e.update()})}}},{key:`isTableOutofEditor`,value:function(){if(!this.tableMainBlot||!this.tableWrapperBlot||this.tableMainBlot.full)return!1;var e=this.tableMainBlot.domNode.getBoundingClientRect(),t=this.tableWrapperBlot.domNode.getBoundingClientRect();if(e.width>t.width){var n=x(this.tableMainBlot.getCols()),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.width=Math.floor(i.width/e.width*t.width)}}catch(e){n.e(e)}finally{n.f()}return this.tableMainBlot.colWidthFillTable(),!0}return!1}},{key:`update`,value:function(){if(!(!this.block||!this.root||!this.tableMainBlot||!this.tableWrapperBlot)){if(this.tableMainBlot.full){this.hide();return}var e=Dr(this.tableMainBlot),t=e.rect,n=e.body;if(!(!n||!t)){var r=this.tableWrapperBlot.domNode.getBoundingClientRect(),i=this.quill.root.getBoundingClientRect(),a=this.tableWrapperBlot.domNode,o=a.scrollTop,s=a.scrollLeft,c=this.options.blockSize*2+this.offset,l=Math.min(t.width,r.width)+c,u=Math.min(t.height,r.height)+c;Object.assign(this.root.style,{width:`${l}px`,height:`${u}px`,left:`${Math.max(t.x,r.x)-i.x-this.options.blockSize}px`,top:`${Math.max(t.y,r.y)-i.y-this.options.blockSize}px`});var d={left:`${t.width+c-s}px`,top:`${u-o}px`};ai(this.tableMainBlot)?(this.root.classList.add(this.bem.is(`align-right`)),d.left=`${this.options.blockSize+-1*s}px`):this.root.classList.remove(this.bem.is(`align-right`)),Object.assign(this.block.style,d)}}}},{key:`show`,value:function(){this.root&&(this.root.classList.remove(this.bem.is(`hidden`)),this.update())}},{key:`hide`,value:function(){this.root&&this.root.classList.add(this.bem.is(`hidden`))}},{key:`destroy`,value:function(){this.hide(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange),this.resizeobserver.disconnect(),this.root&&this.root.remove(),qn.call(this)}}])}(),ui=function(){function e(n,r,i,a){var o=this;v(this,e),S(this,`quill`,void 0),S(this,`isVertical`,void 0),S(this,`table`,void 0),S(this,`scrollbarContainer`,void 0),S(this,`minSize`,20),S(this,`gap`,4),S(this,`move`,0),S(this,`cursorDown`,!1),S(this,`cursorLeave`,!1),S(this,`ratioY`,1),S(this,`ratioX`,1),S(this,`sizeWidth`,``),S(this,`sizeHeight`,``),S(this,`size`,``),S(this,`thumbState`,{X:0,Y:0}),S(this,`ob`,void 0),S(this,`container`,void 0),S(this,`scrollbar`,void 0),S(this,`thumb`,document.createElement(`div`)),S(this,`scrollHandler`,[]),S(this,`propertyMap`,void 0),S(this,`bem`,V(`scrollbar`)),S(this,`tableMainBlot`,void 0),S(this,`showScrollbar`,$n(function(){o.cursorLeave=!1,o.scrollbar.removeEventListener(`transitionend`,o.hideScrollbarTransitionend),o.scrollbar.style.display=o.size?`block`:`none`,requestAnimationFrame(function(){o.scrollbar.classList.remove(o.bem.is(`transparent`))})},200)),S(this,`hideScrollbar`,$n(function(){o.cursorLeave=!0,!o.cursorDown&&(o.scrollbar.removeEventListener(`transitionend`,o.hideScrollbarTransitionend),o.scrollbar.addEventListener(`transitionend`,o.hideScrollbarTransitionend,{once:!0}),o.scrollbar.classList.add(o.bem.is(`transparent`)))},200)),S(this,`hideScrollbarTransitionend`,function(){o.scrollbar.style.display=o.cursorDown&&o.size?`block`:`none`}),this.quill=n,this.isVertical=r,this.table=i,this.scrollbarContainer=a,this.tableMainBlot=t.default.find(this.table),this.container=i.parentElement,this.propertyMap=this.isVertical?{size:`height`,offset:`offsetHeight`,scrollDirection:`scrollTop`,scrollSize:`scrollHeight`,axis:`Y`,direction:`top`,client:`clientY`}:{size:`width`,offset:`offsetWidth`,scrollDirection:`scrollLeft`,scrollSize:`scrollWidth`,axis:`X`,direction:`left`,client:`clientX`},this.calculateSize(),this.ob=new ResizeObserver(function(){o.update()}),this.ob.observe(i),this.scrollbar=this.createScrollbar(),this.setScrollbarPosition(),Kn.call(this,this.quill.root,function(){return o.setScrollbarPosition()}),this.showScrollbar()}return b(e,[{key:`update`,value:function(){this.calculateSize(),this.setScrollbarPosition()}},{key:`setScrollbarPosition`,value:function(){var e=Dr(this.tableMainBlot),t=e.rect,n=e.body;if(!(!n||!t)){var r=this.quill.root,i=r.scrollLeft,a=r.scrollTop,o=r.offsetLeft,s=r.offsetTop,c=this.container,l=c.offsetLeft,u=c.offsetTop,d=n.domNode,f=d.offsetLeft,p=d.offsetTop,m=this.container.getBoundingClientRect(),h=m.width,g=m.height,_=l+f-o,v=u+p-s;this.isVertical?_+=Math.min(h,t.width):v+=Math.min(g,t.height),this.tableMainBlot&&this.tableMainBlot.align!==`left`&&(_+=this.table.offsetLeft-l),Object.assign(this.scrollbar.style,S(S({},this.propertyMap.size,`${this.isVertical?Math.min(g,t.height):h}px`),`transform`,`translate(${_-i}px, ${v-a}px)`)),this.containerScrollHandler(this.container)}}},{key:`calculateSize`,value:function(){var e=this.container.offsetHeight-this.gap,t=this.container.offsetWidth-this.gap,n=Math.pow(e,2)/this.container.scrollHeight,r=Math.pow(t,2)/this.container.scrollWidth,i=Math.max(n,this.minSize),a=Math.max(r,this.minSize);this.ratioY=n/(e-n)/(i/(e-i)),this.ratioX=r/(t-r)/(a/(t-a)),this.sizeWidth=a+this.gap<t?`${a}px`:``,this.sizeHeight=i+this.gap<e?`${i}px`:``,this.size=this.isVertical?this.sizeHeight:this.sizeWidth}},{key:`createScrollbar`,value:function(){var e=this,t=document.createElement(`div`);t.classList.add(this.bem.b(),this.isVertical?this.bem.is(`vertical`):this.bem.is(`horizontal`),this.bem.is(`transparent`)),Object.assign(t.style,{display:`none`}),this.thumb.classList.add(this.bem.be(`thumb`));var n=null,r=function(t){if(e.cursorDown!==!1){var n=e.thumbState[e.propertyMap.axis];if(n){var r=Math.pow(e.scrollbar[e.propertyMap.offset],2)/e.container[e.propertyMap.scrollSize]/(e.isVertical?e.ratioY:e.ratioX)/e.thumb[e.propertyMap.offset],i=(e.scrollbar.getBoundingClientRect()[e.propertyMap.direction]-t[e.propertyMap.client])*-1,a=e.thumb[e.propertyMap.offset]-n,o=(i-a)*100*r/e.scrollbar[e.propertyMap.offset];e.container[e.propertyMap.scrollDirection]=o*e.container[e.propertyMap.scrollSize]/100}}},i=function(){e.thumbState[e.propertyMap.axis]=0,e.cursorDown=!1,document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),e.cursorLeave&&e.hideScrollbar(),document.onselectstart=n},a=function(t){t.stopImmediatePropagation(),e.cursorDown=!0,document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i),n=document.onselectstart,document.onselectstart=function(){return!1}};this.thumb.addEventListener(`mousedown`,function(t){var n;if(t.stopPropagation(),!(t.ctrlKey||[1,2].includes(t.button))){(n=window.getSelection())==null||n.removeAllRanges(),a(t);var r=t.currentTarget;r&&(e.thumbState[e.propertyMap.axis]=r[e.propertyMap.offset]-(t[e.propertyMap.client]-r.getBoundingClientRect()[e.propertyMap.direction]))}});for(var o=[this.table,t],s=0,c=o;s<c.length;s++){var l=c[s];l.addEventListener(`mouseenter`,this.showScrollbar),l.addEventListener(`mouseleave`,this.hideScrollbar)}return Kn.call(this,this.container,function(){e.containerScrollHandler(e.container)}),t.appendChild(this.thumb),t}},{key:`containerScrollHandler`,value:function(e){var t=e[this.propertyMap.offset]-this.gap;this.move=e[this.propertyMap.scrollDirection]*100/t*(this.isVertical?this.ratioY:this.ratioX),Object.assign(this.thumb.style,S(S({},this.propertyMap.size,this.size),`transform`,`translate${this.propertyMap.axis}(${this.move}%)`))}},{key:`destroy`,value:function(){this.ob.disconnect(),qn.call(this),this.table.removeEventListener(`mouseenter`,this.showScrollbar),this.table.removeEventListener(`mouseleave`,this.hideScrollbar)}}])}(),di=function(){function e(n,r,i){var a=this;v(this,e),S(this,`tableModule`,void 0),S(this,`table`,void 0),S(this,`quill`,void 0),S(this,`scrollbarContainer`,void 0),S(this,`scrollbar`,void 0),S(this,`bem`,V(`scrollbar`)),S(this,`updateWhenTextChange`,function(){a.update()}),this.tableModule=n,this.table=r,this.quill=i,this.scrollbarContainer=this.tableModule.addContainer(this.bem.be(`container`)),this.scrollbar=[new ui(i,!0,r,this.scrollbarContainer),new ui(i,!1,r,this.scrollbarContainer)];var o=x(this.scrollbar),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;this.scrollbarContainer.appendChild(c.scrollbar)}}catch(e){o.e(e)}finally{o.f()}this.quill.on(t.default.events.TEXT_CHANGE,this.updateWhenTextChange)}return b(e,[{key:`hide`,value:function(){var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.hideScrollbar()}}catch(t){e.e(t)}finally{e.f()}}},{key:`show`,value:function(){var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.showScrollbar()}}catch(t){e.e(t)}finally{e.f()}}},{key:`update`,value:function(){var e=x(this.scrollbar),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.calculateSize(),n.setScrollbarPosition()}}catch(t){e.e(t)}finally{e.f()}}},{key:`destroy`,value:function(){this.scrollbarContainer.remove(),this.quill.off(t.default.events.TEXT_CHANGE,this.updateWhenTextChange);var e=x(this.scrollbar),n;try{for(e.s();!(n=e.n()).done;){var r=n.value;r.destroy()}}catch(t){e.e(t)}finally{e.f()}}}])}(),fi=0,pi=function(){function e(n,r){var i=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v(this,e),S(this,`tableModule`,void 0),S(this,`quill`,void 0),S(this,`options`,void 0),S(this,`boundary`,null),S(this,`scrollRecordEls`,[]),S(this,`startScrollRecordPosition`,[]),S(this,`selectedTableScrollX`,0),S(this,`selectedTableScrollY`,0),S(this,`selectedEditorScrollX`,0),S(this,`selectedEditorScrollY`,0),S(this,`selectedTds`,[]),S(this,`cellSelectWrap`,void 0),S(this,`cellSelect`,void 0),S(this,`dragging`,!1),S(this,`scrollHandler`,[]),S(this,`tableMenu`,void 0),S(this,`resizeObserver`,void 0),S(this,`table`,void 0),S(this,`isDisplaySelection`,!1),S(this,`bem`,V(`selection`)),S(this,`lastSelection`,{anchorNode:null,anchorOffset:0,focusNode:null,focusOffset:0}),S(this,`updateAfterEvent`,function(){i.updateWithSelectedTds()}),S(this,`quillSelectionChangeHandler`,function(e,n,r){if(r!==t.default.sources.API&&e&&!i.quill.composition.isComposing&&i.selectedTds.length>0){var a=i.quill.getFormat(e),o=i.quill.getLine(e.index),s=F(o,1),c=s[0],l=!!a[z.tableCellInner]&&!!c,u=i.selectedTds.some(function(e){return e.children.contains(c)});if(l&&!u)try{var d=H(c,z.tableCellInner);i.selectedTds=[d],i.updateWithSelectedTds()}catch(e){}else l&&u||i.hide()}}),S(this,`selectionChangeHandler`,function(){var e=window.getSelection();if(e){var n=e.anchorNode,r=e.focusNode,a=e.anchorOffset,o=e.focusOffset;if(!(!n||!r)){var s=t.default.find(n),c=t.default.find(r);if(!(!s||!c||s.scroll!==i.quill.scroll||c.scroll!==i.quill.scroll)){var l=ge(s),u=ge(c),d=l.has(z.tableColgroup),f=u.has(z.tableColgroup);if(d||f){var p=n,m=a,h=r,g=o;if(d){var _=l.get(z.tableWrapper),v=_.descendants(q);v.length>0&&(p=v[0].domNode,m=0)}if(f){var y=u.get(z.tableWrapper),b=y.descendants(q);b.length>0&&(h=b[0].domNode,g=0)}i.setSelectionData(e,{anchorNode:p,anchorOffset:m,focusNode:h,focusOffset:g});return}var x=l.has(z.tableCellInner),S=u.has(z.tableCellInner),C=x&&S;if(C){var w=l.get(z.tableCellInner),T=u.get(z.tableCellInner);C&&(C=w!==T)}if(x&&S&&C||!x&&S||!S&&x){i.setSelectionData(e,i.lastSelection),i.selectedTds.length>0&&i.hide();return}i.lastSelection={anchorNode:n,anchorOffset:a,focusNode:r,focusOffset:o}}}}}),S(this,`mouseDownHandler`,function(e){var t=e.button,n=e.target,r=e.clientX,a=e.clientY,o=n.closest(`.ql-table`),s=n.closest(`caption`);if(!(t!==0||!o||s)){i.setSelectionTable(o);var c=o.dataset.tableId,l={x:r,y:a};i.recordScrollPosition(),i.selectedTds=i.computeSelectedTds(l,l),i.dragging=!0,i.show();var u=function(e){i.tableMenu&&i.tableMenu.hide(),i.tableModule.tableResize&&i.tableModule.tableResize.hide();var t=e.button,n=e.target,r=e.clientX,a=e.clientY,o=n.closest(`.ql-table`),s=n.closest(`caption`);if(!(t!==0||s||!o||o.dataset.tableId!==c)){var u={x:r,y:a};i.selectedTds=i.computeSelectedTds(l,u),i.selectedTds.length>1&&i.quill.blur(),i.update()}},d=function(){document.body.removeEventListener(`mousemove`,u,!1),document.body.removeEventListener(`mouseup`,d,!1),i.dragging=!1,i.clearRecordScrollPosition(),i.tableMenu&&i.selectedTds.length>0&&i.tableMenu.show()};document.body.addEventListener(`mousemove`,u,!1),document.body.addEventListener(`mouseup`,d,!1)}}),S(this,`removeCell`,function(e){var n=i.quill.getSelection();if(!(n||e.key!==`Backspace`&&e.key!==`Delete`)){var r=x(i.selectedTds),a;try{for(r.s();!(a=r.n()).done;){var o=a.value;o.deleteAt(0,o.length()-1)}}catch(e){r.e(e)}finally{r.f()}if(i.table){var s=t.default.find(i.table),c=s.descendants(q);i.selectedTds.length===c.length&&s.remove()}}}),this.tableModule=n,this.quill=r,this.options=this.resolveOptions(a),this.scrollRecordEls=[this.quill.root,document.documentElement],this.cellSelectWrap=n.addContainer(this.bem.b()),this.cellSelect=this.helpLinesInitial(),this.resizeObserver=Gn(function(){return i.updateAfterEvent()},{ignoreFirstBind:!0}),this.resizeObserver.observe(this.quill.root),this.quill.root.addEventListener(`mousedown`,this.mouseDownHandler,{passive:!1}),document.addEventListener(`selectionchange`,this.selectionChangeHandler,{passive:!1}),this.quill.on(ce.AFTER_TABLE_RESIZE,this.updateAfterEvent),this.quill.on(t.default.events.SELECTION_CHANGE,this.quillSelectionChangeHandler),this.quill.on(t.default.events.TEXT_CHANGE,this.updateAfterEvent),this.options.tableMenu&&(this.tableMenu=new this.options.tableMenu(n,r,this.options.tableMenuOptions)),this.hide()}return b(e,[{key:`getFirstTextNode`,value:function(e){for(var t=0,n=Array.from(e.childNodes);t<n.length;t++){var r=n[t];if(r.nodeType===Node.TEXT_NODE)return r}return e}},{key:`getLastTextNode`,value:function(e){for(var t=e.childNodes.length-1;t>=0;t--){var n=e.childNodes[t];if(n.nodeType===Node.TEXT_NODE)return n}return e}},{key:`getNodeTailOffset`,value:function(e){var t=document.createRange();return t.selectNodeContents(e),t.collapse(!1),t.startOffset}},{key:`setSelectionData`,value:function(e,t){var n=t.anchorNode,r=t.anchorOffset,i=t.focusNode,a=t.focusOffset;if(!(!n||!i)){var o=document.createRange(),s=this.selectionDirectionUp(t);s?(o.setStart(n,r),o.setEnd(n,r)):(o.setStart(n,r),o.setEnd(i,a)),e.removeAllRanges(),e.addRange(o),s&&e.extend(i,a)}}},{key:`selectionDirectionUp`,value:function(e){var t=e.anchorNode,n=e.anchorOffset,r=e.focusNode,i=e.focusOffset;if(!t||!r)return!1;if(t===r)return n>i;var a=t.compareDocumentPosition(r);return a&Node.DOCUMENT_POSITION_CONTAINS||a&Node.DOCUMENT_POSITION_CONTAINED_BY?(a&Node.DOCUMENT_POSITION_FOLLOWING)!==0:(a&Node.DOCUMENT_POSITION_PRECEDING)!==0}},{key:`findWrapSelection`,value:function(e){var t=null,n=0,r=null,i=0,a=x(e),o;try{for(a.s();!(o=a.n()).done;){var s=o.value,c=s.node,l=s.offset;c&&((!t||this.selectionDirectionUp({anchorNode:t,anchorOffset:n,focusNode:c,focusOffset:l}))&&(t=c,n=l),(!r||this.selectionDirectionUp({anchorNode:c,anchorOffset:l,focusNode:r,focusOffset:i}))&&(r=c,i=l))}}catch(e){a.e(e)}finally{a.f()}return{startNode:t,startOffset:n,endNode:r,endOffset:i}}},{key:`resolveOptions`,value:function(e){return Object.assign({selectColor:`#0589f340`,tableMenuOptions:{}},e)}},{key:`helpLinesInitial`,value:function(){this.cellSelectWrap.style.setProperty(`--select-color`,this.options.selectColor);var e=document.createElement(`div`);return e.classList.add(this.bem.be(`line`)),this.cellSelectWrap.appendChild(e),e}},{key:`computeSelectedTds`,value:function(e,n){if(!this.table)return[];var r=t.default.find(this.table);if(!r)return[];var i=r.descendants(Y)[0];if(!i)return[];var a=new Set(i.descendants(X).map(function(e,t){return e.index=t,e})),o=this.getScrollPositionDiff(),s=Dr(r),c=s.rect;if(!c)return[];for(var l=e.x+o.x,u=e.y+o.y,d={x:Math.max(c.left,Math.min(n.x,l)),y:Math.max(c.top,Math.min(n.y,u)),x1:Math.min(c.right,Math.max(n.x,l)),y1:Math.min(c.bottom,Math.max(n.y,u))},f=new Set,p=!0;p;){p=!1;var m=x(a),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;g.__rect||(g.__rect=g.domNode.getBoundingClientRect());var _=g.__rect,v=_.x,y=_.y,b=_.right,S=_.bottom;if(Vn({x:Math.floor(d.x),y:Math.floor(d.y),x1:Math.floor(d.x1),y1:Math.floor(d.y1)},{x:Math.floor(v),y:Math.floor(y),x1:Math.floor(b),y1:Math.floor(S)},fi,f.size===0)){f.add(g),a.delete(g),d={x:Math.min(d.x,v),y:Math.min(d.y,y),x1:Math.max(d.x1,b),y1:Math.max(d.y1,S)},p=!0;break}}}catch(e){m.e(e)}finally{m.f()}}for(var C=0,w=[].concat(L(f),L(a));C<w.length;C++){var T=w[C];delete T.__rect}return this.boundary=Hn(M(M({},d),{},{width:d.x1-d.x,height:d.y1-d.y}),this.quill.root),Array.from(f).sort(function(e,t){return e.index-t.index}).map(function(e){return delete e.index,e.getCellInner()})}},{key:`getScrollPositionDiff`,value:function(){var e=this,t=this.getTableViewScroll(),n=t.x,r=t.y,i=Jn(this.quill.root),a=i.x,o=i.y;return this.selectedTableScrollX=n,this.selectedTableScrollY=r,this.selectedEditorScrollX=a,this.selectedEditorScrollY=o,this.startScrollRecordPosition.reduce(function(t,n,r){var i=n.x,a=n.y,o=Jn(e.scrollRecordEls[r]),s=o.x,c=o.y;return t.x+=i-s,t.y+=a-c,t},{x:0,y:0})}},{key:`recordScrollPosition`,value:function(){this.clearRecordScrollPosition();var e=x(this.scrollRecordEls),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;this.startScrollRecordPosition.push(Jn(n))}}catch(t){e.e(t)}finally{e.f()}}},{key:`clearRecordScrollPosition`,value:function(){this.startScrollRecordPosition=[]}},{key:`updateWithSelectedTds`,value:function(){if(!(this.selectedTds.length<=0)){var e={x:1/0,y:1/0},t={x:-1/0,y:-1/0},n=x(this.selectedTds),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.domNode.getBoundingClientRect();e.x=Math.min(e.x,a.left),e.y=Math.min(e.y,a.top),t.x=Math.max(t.x,a.right),t.y=Math.max(t.y,a.bottom)}}catch(e){n.e(e)}finally{n.f()}this.selectedTds=this.computeSelectedTds(e,t),this.selectedTds.length>0?this.update():this.hide()}}},{key:`update`,value:function(){if(!(this.selectedTds.length===0||!this.boundary||!this.table)){var e=Jn(this.quill.root),t=e.x,n=e.y,r=this.getTableViewScroll(),i=r.x,a=r.y,o=this.table.parentElement.getBoundingClientRect(),s=this.quill.root.getBoundingClientRect(),c=o.x-s.x,l=o.y-s.y;Object.assign(this.cellSelect.style,{left:`${this.selectedEditorScrollX*2-t+this.boundary.x+this.selectedTableScrollX-i-c}px`,top:`${this.selectedEditorScrollY*2-n+this.boundary.y+this.selectedTableScrollY-a-l}px`,width:`${this.boundary.width}px`,height:`${this.boundary.height}px`}),Object.assign(this.cellSelectWrap.style,{left:`${c}px`,top:`${l}px`,width:`${o.width}px`,height:`${o.height}px`}),!this.dragging&&this.tableMenu&&this.tableMenu.update()}}},{key:`getTableViewScroll`,value:function(){return this.table?Jn(this.table.parentElement):{x:0,y:0}}},{key:`setSelectionTable`,value:function(e){this.table!==e&&(this.table=e,this.table?this.scrollRecordEls.push(this.table.parentElement):this.scrollRecordEls.pop())}},{key:`showDisplay`,value:function(){Object.assign(this.cellSelectWrap.style,{display:`block`}),this.isDisplaySelection=!0,this.table&&this.resizeObserver.observe(this.table)}},{key:`show`,value:function(){var e=this;this.table&&(qn.call(this),this.update(),this.showDisplay(),document.addEventListener(`keydown`,this.removeCell),Kn.call(this,this.quill.root,function(){e.update()}),Kn.call(this,this.table.parentElement,function(){e.update()}))}},{key:`hideDisplay`,value:function(){Object.assign(this.cellSelectWrap.style,{display:`none`}),this.isDisplaySelection=!1,this.table&&this.resizeObserver.unobserve(this.table)}},{key:`hide`,value:function(){qn.call(this),document.removeEventListener(`keydown`,this.removeCell),this.hideDisplay(),this.boundary=null,this.selectedTds=[],this.setSelectionTable(void 0),this.tableMenu&&this.tableMenu.hide()}},{key:`destroy`,value:function(){this.resizeObserver.disconnect(),this.hide(),this.cellSelectWrap.remove(),this.tableMenu&&this.tableMenu.destroy(),qn.call(this),this.quill.root.removeEventListener(`mousedown`,this.mouseDownHandler),document.removeEventListener(`selectionchange`,this.selectionChangeHandler),this.quill.off(t.default.events.SELECTION_CHANGE,this.quillSelectionChangeHandler),this.quill.off(t.default.events.TEXT_CHANGE,this.updateAfterEvent),this.quill.on(ce.AFTER_TABLE_RESIZE,this.updateAfterEvent)}}])}(),mi=[`attributes`],hi=[`style`],gi=t.default.import(`parchment`),_i=t.default.import(`delta`),vi=t.default.import(`ui/icons`),yi=t.default.import(`blots/break`),bi=t.default.import(`blots/block`),xi=t.default.import(`blots/block/embed`);function Si(e,t){var n=t.tableId,r=t.rowId,i=t.colId,a={tableId:n,rowId:r,colId:i,colspan:1,rowspan:1},o=e.create(z.tableCell,a),s=e.create(z.tableCellInner,a),c=e.create(`block`);return c.appendChild(e.create(`break`)),s.appendChild(c),o.appendChild(s),o}function Ci(e){fe.delete(z.tableCellInner),Object.assign(z,e.blotName||{}),Object.assign(B,e.tableUpSize||{}),Object.assign(ce,e.tableUpEvent||{}),Object.assign(le,e.tableUpInternal||{}),Ei.moduleName=le.moduleName,Ei.toolName=z.tableWrapper,K.blotName=z.container,Er.blotName=z.tableWrapper,Z.blotName=z.tableMain,wr.blotName=z.tableColgroup,Cr.blotName=z.tableCol,Y.blotName=z.tableBody,J.blotName=z.tableRow,X.blotName=z.tableCell,q.blotName=z.tableCellInner,fe.add(z.tableCellInner)}function wi(e,t){return Ve({onSelect:function(n,r){e.insertTable(n,r),t&&t.close()},customBtn:e.options.customBtn,texts:e.options.texts})}function Ti(e){return{bindInHead:!1,key:e?`ArrowUp`:`ArrowDown`,collapsed:!0,format:[z.tableCellInner],handler:function(n,r){var i=e?`prev`:`next`,a=e?`tail`:`head`;if(r.line[i])return!0;var o=this.quill.selection.getBounds(n.index),s=r.line.domNode.getBoundingClientRect();if(!o||!s)return!0;if(e){if(o.top-s.top>3)return!0}else if(s.bottom-o.bottom>3)return!0;var c,l,u,d;try{var f=he(r.line,[z.tableWrapper,z.tableMain,z.tableRow,z.tableCell]),p=F(f,4);c=p[0],l=p[1],u=p[2],d=p[3]}catch(e){return!0}var m=l.getColIds(),h=c.descendants(xr,0)[0],g;if(h){var _=window.getComputedStyle(h.domNode);g=i===`next`&&_.captionSide===`bottom`?h:i===`next`?c.next:h}else g=c[i];if(r.line[i]||!g)return!0;var v=u[i];if(v){var y=m.indexOf(d.colId),b=v.getCellByColId(m[y],i);if(!b)return!0;var x=b.children[a];x.children&&(x=x.children[a]);var S=x.offset(this.quill.scroll)+Math.min(r.offset,x.length()-1);this.quill.setSelection(S,0,t.default.sources.USER)}else{var C=g.offset(this.quill.scroll)+(e?g.length()-1:0);this.quill.setSelection(C,0,t.default.sources.USER)}return!1}}}var Ei=function(){function e(n,r){var i=this;if(v(this,e),S(this,`quill`,void 0),S(this,`options`,void 0),S(this,`toolBox`,void 0),S(this,`fixTableByLisenter`,$n(this.balanceTables,100)),S(this,`selector`,void 0),S(this,`table`,void 0),S(this,`tableSelection`,void 0),S(this,`tableResize`,void 0),S(this,`tableScrollbar`,void 0),S(this,`tableAlign`,void 0),S(this,`tableResizeScale`,void 0),S(this,`resizeOb`,void 0),this.quill=n,this.options=this.resolveOptions(r||{}),this.toolBox=this.initialContainer(),!this.options.scrollbar){var a=V(`scrollbar`);this.quill.container.classList.add(a.bm(`origin`))}this.options.selection&&(this.tableSelection=new this.options.selection(this,this.quill,this.options.selectionOptions));var o=this.quill.getModule(`toolbar`);if(o&&this.quill.theme.pickers){var s=(o.controls||[]).find(function(e){var t=F(e,1),n=t[0];return n===i.statics.toolName})||[],c=F(s,2),l=c[1];if(l&&l.tagName.toLocaleLowerCase()===`select`){var u=this.quill.theme.pickers.find(function(e){return e.select===l});u&&(u.label.innerHTML=this.options.icon,this.buildCustomSelect(this.options.customSelect,u),u.label.addEventListener(`mousedown`,function(){if(!(!i.selector||!u)){var e=i.selector.getBoundingClientRect(),t=Wn(e),n=t.leftLimited;if(n){var r=u.label.getBoundingClientRect();Object.assign(u.options.style,{transform:`translateX(calc(-100% + ${r.width}px))`})}else Object.assign(u.options.style,{transform:void 0})}}))}}for(var d=this.quill.getModule(`keyboard`),f=0,p=Object.values(e.keyboradHandler);f<p.length;f++){var m=p[f];m.bindInHead?d.bindings[m.key].unshift(m):d.addBinding(m.key,m)}this.quill.root.addEventListener(`click`,function(e){var t=e.composedPath();if(!(!t||t.length<=0)){var n=t.find(function(e){return e.tagName&&e.tagName.toUpperCase()===`TABLE`&&e.classList.contains(`ql-table`)});if(n){if(i.table===n){i.tableSelection&&i.tableSelection.show(),i.tableAlign&&i.tableAlign.update(),i.tableResize&&i.tableResize.update(),i.tableScrollbar&&i.tableScrollbar.update();return}i.table&&i.hideTableTools(),i.showTableTools(n)}else i.table&&i.hideTableTools()}},!1),this.quill.on(t.default.events.EDITOR_CHANGE,function(e){e===t.default.events.TEXT_CHANGE&&(!i.table||!i.quill.root.contains(i.table))&&i.hideTableTools()}),this.quillHack(),this.listenBalanceCells()}return b(e,[{key:`statics`,get:function(){return this.constructor}},{key:`initialContainer`,value:function(){var e=this,t=V(`toolbox`),n=this.quill.addContainer(t.b()),r=function(){var t=e.quill.root.getBoundingClientRect(),r=e.quill.root,i=r.offsetLeft,a=r.offsetTop;Object.assign(n.style,{top:`${a}px`,left:`${i}px`,width:`${t.width}px`,height:`${t.height}px`})};return this.resizeOb=new ResizeObserver(r),this.resizeOb.observe(this.quill.root),n}},{key:`addContainer`,value:function(e){if(Ae(e)){var t=document.createElement(`div`),n=x(e.split(` `)),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;t.classList.add(i)}}catch(e){n.e(e)}finally{n.f()}return this.toolBox.appendChild(t),t}else return this.toolBox.appendChild(e),e}},{key:`resolveOptions`,value:function(e){return Object.assign({customBtn:!1,texts:this.resolveTexts(e.texts||{}),full:!1,fullSwitch:!0,icon:vi.table,selectionOptions:{},alignOptions:{},scrollbarOptions:{},resizeOptions:{},resizeScaleOptions:{},autoMergeCell:!0},e)}},{key:`resolveTexts`,value:function(e){return Object.assign({fullCheckboxText:`Insert full width table`,customBtnText:`Custom`,confirmText:`Confirm`,cancelText:`Cancel`,rowText:`Row`,colText:`Column`,notPositiveNumberError:`Please enter a positive integer`,custom:`Custom`,clear:`Clear`,transparent:`Transparent`,perWidthInsufficient:`The percentage width is insufficient. To complete the operation, the table needs to be converted to a fixed width. Do you want to continue?`,CopyCell:`Copy cell`,CutCell:`Cut cell`,InsertTop:`Insert row above`,InsertRight:`Insert column right`,InsertBottom:`Insert row below`,InsertLeft:`Insert column Left`,MergeCell:`Merge Cell`,SplitCell:`Split Cell`,DeleteRow:`Delete Row`,DeleteColumn:`Delete Column`,DeleteTable:`Delete table`,BackgroundColor:`Set background color`,BorderColor:`Set border color`},e)}},{key:`quillHack`,value:function(){var e=this,n=this.quill.getSemanticHTML;this.quill.getSemanticHTML=function(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,i=arguments.length>1?arguments[1]:void 0,a=n.call(e.quill,r,i),o=t.default.import(`formats/${z.tableWrapper}`),s=new DOMParser,c=s.parseFromString(a,`text/html`),l=0,u=Array.from(c.querySelectorAll(`.${o.className} caption[contenteditable], .${o.className} td > [contenteditable]`));l<u.length;l++){var d=u[l];d.removeAttribute(`contenteditable`)}return c.body.innerHTML};var r=this.quill.format;this.quill.format=function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.default.sources.API,a=this.scroll.query(e);if(!(a.prototype instanceof gi.EmbedBlot)){var o=this.getModule(le.moduleName),s=this.getSelection(!0),c=this.getFormat(s);if(!c[z.tableCellInner]||s.length>0||o&&o.tableSelection&&o.tableSelection.selectedTds.length<=1)return r.call(this,e,n,i);if(o&&o.tableSelection&&o.tableSelection.selectedTds.length>0){var l=o.tableSelection.selectedTds,u=!1,d=[],f=x(l),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,h=m.offset(this.scroll),g=m.length();d.push({index:h,length:g});var _=this.getFormat(h,g);_[e]!==n&&(u=!0)}}catch(e){f.e(e)}finally{f.f()}var v=u?n:!1,y=new _i,b=x(d.entries()),C;try{for(b.s();!(C=b.n()).done;){var w=F(C.value,2),T=w[0],E=w[1],D=E.index,O=E.length,k=T===0?0:d[T-1].index+d[T-1].length;y.retain(D-k).retain(O,S({},e,v))}}catch(e){b.e(e)}finally{b.f()}var A=this.updateContents(y,i);return this.blur(),A}}return r.call(this,e,n,i)};var i=this.quill.theme.modules.toolbar;if(i){var a,o=(a=i.handlers)==null?void 0:a.clean;if(o){var s=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return``},i=e.quill.getText(t,n),a=e.quill.getLine(t+n),o=F(a,2),s=o[0],c=o[1],l=0,u=new _i;s!=null&&(l=s.length()-c,u=s.delta().slice(c,c+l-1).insert(`
|
|
128
|
+
`));var d=e.quill.getContents(t,n+l),f=d.diff(new _i().insert(i).concat(u)),p=0,m=f.ops.map(function(e){var t=e.attributes,n=N(e,mi);if(e.insert?p-=Ae(e.insert)?e.insert.length:1:e.retain?p+=je(e.retain)?e.retain:1:e.delete&&(p+=e.delete),t){var i=z.tableCellInner,a=t[i],o=N(t,[i].map(R));if(r){var s=d.slice(p-1,p).ops[0];if(s&&s.attributes&&s.attributes[z.tableCellInner]){var c=s.attributes[z.tableCellInner],l=c.style,u=N(c,hi),f=r(l);return f?M(M({},n),{},{attributes:M(M({},o),{},S({},z.tableCellInner,M({style:f},u)))}):M(M({},n),{},{attributes:M(M({},o),{},S({},z.tableCellInner,u))})}}return M(M({},n),{},{attributes:M({},o)})}return e});return new _i(m)};i.handlers.clean=function(e){var n=this,r=this.quill.getModule(le.moduleName),i=this.quill.getSelection();if(i&&i.length>0){var a=this.quill.getFormat(i);if(a[z.tableCellInner]){var c=s(i.index,i.length,!1),l=new _i().retain(i.index).concat(c);this.quill.updateContents(l,t.default.sources.USER);return}}if(r&&r.tableSelection&&r.tableSelection.selectedTds.length>0&&r.tableSelection.table){var u=t.default.find(r.tableSelection.table);if(!u){console.warn(`TableMainFormat not found`);return}var d=r.tableSelection.selectedTds,f=new Set,p=[],m=x(d),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;if(g.parent instanceof X){var _=x(g.parent.getNearByCell(`top`)),v;try{for(_.s();!(v=_.n()).done;){var y=v.value;f.has(y)||(f.add(y),p.push({td:y,cleanBorder:`bottom`}))}}catch(e){_.e(e)}finally{_.f()}var b=x(g.parent.getNearByCell(`left`)),S;try{for(b.s();!(S=b.n()).done;){var C=S.value;f.has(C)||(f.add(C),p.push({td:C,cleanBorder:`right`}))}}catch(e){b.e(e)}finally{b.f()}f.add(g.parent),p.push({td:g.parent,cleanBorder:!0})}}}catch(e){m.e(e)}finally{m.f()}var w=u.descendants(X),T=new Map(w.map(function(e,t){return[e,t]}));p.sort(function(e,t){return T.get(e.td)-T.get(t.td)});for(var E=new _i,D=0,O=function(){var e=A[k],t=e.td,r=e.cleanBorder,i=t.getCellInner().offset(n.quill.scroll),a=t.getCellInner().length(),o=s(i,a-1,function(e){if(!e||r===!0)return``;var t=Yn(e),n=Object.keys(t).filter(function(e){return!e.startsWith(Qn(`border-${r}`))}).reduce(function(e,n){return e[n]=t[n],e},{});return Xn(n)}),c=new _i().retain(i-D).concat(o);E=E.concat(c),D=i+a},k=0,A=p;k<A.length;k++)O();this.quill.updateContents(E,t.default.sources.USER),d.length>1&&this.quill.blur();return}return o.call(this,e)}}}}},{key:`showTableTools`,value:function(e){if(e){var t;this.table=e,(t=this.tableSelection)==null||t.show(),this.options.align&&(this.tableAlign=new this.options.align(this,e,this.quill,this.options.alignOptions)),this.options.scrollbar&&(this.tableScrollbar=new this.options.scrollbar(this,e,this.quill,this.options.scrollbarOptions)),this.options.resize&&(this.tableResize=new this.options.resize(this,e,this.quill,this.options.resizeOptions)),this.options.resizeScale&&(this.tableResizeScale=new this.options.resizeScale(this,e,this.quill,this.options.resizeScaleOptions))}}},{key:`hideTableTools`,value:function(){var e;(e=this.tableSelection)==null||e.hide(),this.tableScrollbar&&(this.tableScrollbar.destroy(),this.tableScrollbar=void 0),this.tableAlign&&(this.tableAlign.destroy(),this.tableAlign=void 0),this.tableResize&&(this.tableResize.destroy(),this.tableResize=void 0),this.tableResizeScale&&this.tableResizeScale.destroy(),this.table=void 0}},{key:`buildCustomSelect`,value:function(){var e=g(P().mark(function e(t,n){var r=this,i,a,o,s,c;return P().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t||!Oe(t))){e.next=2;break}return e.abrupt(`return`);case 2:return i=document.createElement(`div`),i.classList.add(`ql-custom-select`),e.next=6,t(this,n);case 6:this.selector=e.sent,i.appendChild(this.selector),this.options.fullSwitch&&(a=V(`creator`),o=document.createElement(`label`),o.classList.add(a.be(`checkbox`)),s=document.createElement(`input`),s.type=`checkbox`,s.checked=this.options.full,s.addEventListener(`change`,function(){r.options.full=s.checked}),c=document.createElement(`span`),c.textContent=this.options.texts.fullCheckboxText,o.appendChild(s),o.appendChild(c),i.appendChild(o)),n.options.innerHTML=``,n.options.appendChild(i);case 11:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`setCellAttrs`,value:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.length!==0){var i=x(e),a;try{for(i.s();!(a=i.n()).done;){var o=a.value;o.setFormatValue(t,n,r)}}catch(e){i.e(e)}finally{i.f()}}}},{key:`getTextByCell`,value:function(e){var t=``,n=x(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value,a=i.offset(this.quill.scroll),o=i.length(),s=x(this.quill.getContents(a,o).ops),c;try{for(s.s();!(c=s.n()).done;){var l=c.value;Ae(l.insert)&&(t+=l.insert)}}catch(e){s.e(e)}finally{s.f()}}}catch(e){n.e(e)}finally{n.f()}return t}},{key:`getHTMLByCell`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e.length===0)return``;var n=null;try{var r=x(e),i;try{for(r.s();!(i=r.n()).done;){var a=i.value,o=H(a,z.tableMain);if(n||(n=o),o!==n)return console.error(`tableMain is not same`),``}}catch(e){r.e(e)}finally{r.f()}}catch(e){return console.error(`tds must be in same tableMain`),``}if(!n)return``;var s=this.quill.getIndex(n),c=n.length(),l=this.quill.getSemanticHTML(s,c),u=new DOMParser,d=u.parseFromString(l,`text/html`),f=[],p=new Set,m=new Set,h=x(e),g;try{for(h.s();!(g=h.n()).done;){var _=g.value;p.add(_.colId),m.add(`${_.rowId}-${_.colId}`)}}catch(e){h.e(e)}finally{h.f()}for(var v=0,y=Array.from(d.querySelectorAll(`col`));v<y.length;v++){var b=y[v];p.has(b.dataset.colId)?f.push(b.getAttribute(`width`)):b.remove()}for(var S=0,C=null,w=0,T=Array.from(d.querySelectorAll(`td`));w<T.length;w++){var E=T[w];if(m.has(`${E.dataset.rowId}-${E.dataset.colId}`))C!==E.dataset.rowId&&(S+=1,C=E.dataset.rowId);else{var D=E.parentElement;E.remove(),D&&D.children.length<=0&&D.remove()}}var O=Array.from(d.querySelectorAll(`col`)),k=O.map(function(e){return Cr.value(e)});if(n.full){var A=k.reduce(function(e,t){return t.width+e},0),j=x(k.entries()),M;try{for(j.s();!(M=j.n()).done;){var N=F(M.value,2),ee=N[0],te=N[1];te.width=Math.round(te.width/A*100),O[ee].setAttribute(`width`,`${te.width}%`)}}catch(e){j.e(e)}finally{j.f()}}else{var P=0,ne=x(k),re;try{for(ne.s();!(re=ne.n()).done;){var I=re.value;P+=I.width}}catch(e){ne.e(e)}finally{ne.f()}var L=d.querySelector(`table`);L.style.width=`${P}px`}if(t){var ie=n.getRows();if(S===ie.length)this.removeCol(e);else{var R=x(e),ae;try{for(R.s();!(ae=R.n()).done;){var oe=ae.value;oe.domNode.innerHTML=`<p><br></p>`}}catch(e){R.e(e)}finally{R.f()}}}return d.body.innerHTML}},{key:`insertTable`,value:function(e,n){if(e>=30||n>=30)throw Error(`Both rows and columns must be less than 30.`);this.quill.focus();var r=this.quill.getSelection();if(r!=null){var i=this.quill.getLeaf(r.index),a=F(i,1),o=a[0];if(o){if(me(o))throw Error(`Not supported ${o.statics.blotName} insert into table.`);var s=this.calculateTableCellBorderWidth(),c=getComputedStyle(this.quill.root),l=Number.parseInt(c.paddingLeft),u=Number.parseInt(c.paddingRight),d=Number.parseInt(c.width)-l-u-s,f=G(),p=Array(n).fill(0).map(function(){return G()}),m=this.options.full?`${Math.max(1/n*100,B.colMinWidthPre)}%`:`${Math.max(Math.floor(d/n),B.colMinWidthPx)}px`,h=[{retain:r.index}],g=this.quill.getContents(r.index,1),_=this.quill.getLine(r.index),v=F(_,2),y=v[1];g.ops[0].insert!==`
|
|
129
|
+
`&&y!==0&&h.push({insert:`
|
|
130
|
+
`});for(var b=0;b<n;b++)h.push({insert:S({},z.tableCol,{width:m,tableId:f,colId:p[b],full:this.options.full})});for(var x=0;x<e;x++)for(var C=G(),w=0;w<n;w++)h.push({insert:`
|
|
131
|
+
`,attributes:S({},z.tableCellInner,{tableId:f,rowId:C,colId:p[w],rowspan:1,colspan:1})});this.quill.updateContents(new _i(h),t.default.sources.USER),this.quill.setSelection(r.index+n,t.default.sources.SILENT),this.quill.focus()}}}},{key:`calculateTableCellBorderWidth`,value:function(){var e=`
|
|
132
|
+
<table class="${Z.className}">
|
|
129
133
|
<tbody>
|
|
130
134
|
<tr>
|
|
131
|
-
<td class="${
|
|
135
|
+
<td class="${X.className}"></td>
|
|
132
136
|
</tr>
|
|
133
137
|
</tbody>
|
|
134
138
|
</table>
|
|
135
|
-
`,t=document.createElement(`div`);t.className=
|
|
139
|
+
`,t=document.createElement(`div`);t.className=Er.className,t.innerHTML=e,t.style.position=`absolute`,t.style.left=`-9999px`,t.style.top=`-9999px`,t.style.visibility=`hidden`,this.quill.root.appendChild(t);var n=window.getComputedStyle(t.querySelector(`td`)),r=Number.parseFloat(n.borderWidth)||0;return this.quill.root.removeChild(t),r}},{key:`fixUnusuaDeletelTable`,value:function(e){var t=e.getRows(),n=e.getColIds();if(t.length===0)return e.remove();if(n.length!==0){var r=Array(t.length).fill(0).map(function(){return Array(n.length).fill(!1)}),i=e.tableId,a=x(t.entries()),o;try{for(a.s();!(o=a.n()).done;){for(var s=F(o.value,2),c=s[0],l=s[1],u=0,d=0,f=r[c],p=l.descendants(X);d<n.length;){if(f[d]){d+=1;continue}var m=p[u];if(!m||m.colId!==n[d])l.insertBefore(Si(this.quill.scroll,{tableId:i,colId:n[d],rowId:l.rowId}),m);else{c+m.rowspan-1>=t.length&&(m.getCellInner().rowspan=t.length-c);var h=m.colspan,g=m.rowspan;if(h>1)for(var _=1;_<h;_++)f[d+_]=!0;if(g>1)for(var v=c+1;v<c+g;v++)for(var y=0;y<h;y++)r[v][d+y]=!0;u+=1}d+=1}if(u<p.length)for(var b=u;b<p.length;b++)p[b].remove()}}catch(e){a.e(e)}finally{a.f()}}}},{key:`balanceTables`,value:function(){var e=x(this.quill.scroll.descendants(Z)),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.checkEmptyCol(this.options.autoMergeCell),n.checkEmptyRow(this.options.autoMergeCell),this.fixUnusuaDeletelTable(n)}}catch(t){e.e(t)}finally{e.f()}}},{key:`listenBalanceCells`,value:function(){var e=this;this.quill.on(t.default.events.SCROLL_OPTIMIZE,function(n){n.some(function(t){return[`TD`,`TR`,`TBODY`,`TABLE`].includes(t.target.tagName)?(e.fixTableByLisenter(),!0):!1});var r=x(n),i;try{for(r.s();!(i=r.n()).done;){var a=i.value,o=a.target;if(o.tagName===`TABLE`){var s=t.default.find(o);if(s){s.sortMergeChildren();break}}}}catch(e){r.e(e)}finally{r.f()}})}},{key:`deleteTable`,value:function(e){if(e.length!==0){var t=H(e[0],z.tableMain);t&&t.remove(),this.hideTableTools()}}},{key:`appendRow`,value:function(e,t){if(!(e.length<=0)){var n=e[t?e.length-1:0],r=he(n,[z.tableMain,z.tableBody,z.tableRow]),i=F(r,3),a=i[0],o=i[1],s=i[2],c=a.getRows(),l=c.indexOf(s),u=l+(t?n.rowspan:0);o.insertRow(u)}}},{key:`appendCol`,value:function(e,t){if(!(e.length<=0)){var n=e.reduce(function(e,n){var r=n.getColumnIndex();return(!t&&r<=e[1]||t&&r>=e[1])&&(e=[n,r]),e},[e[0],e[0].getColumnIndex()]),r=F(n,1),i=r[0],a=i.getColumnIndex()+(t?i.colspan:0),o=H(i,z.tableMain),s=o.tableId,c=G(),l=o.descendants(wr),u=F(l,1),d=u[0];d&&d.insertColByIndex(a,{tableId:s,colId:c,width:o.full?6:160,full:o.full});for(var f=o.getRows(),p=[],m=0,h=0,g=Object.values(f);h<g.length;h++){var _=g[h],v=p.shift()||0;if(m>0){--m;continue}var y=_.insertCell(a-v,{tableId:s,rowId:_.rowId,colId:c,rowspan:1,colspan:1});y.skipRowNum&&(m+=y.skipRowNum);var b=x(y.entries()),S;try{for(b.s();!(S=b.n()).done;){var C=F(S.value,2),w=C[0],T=C[1];p[w]=(p[w]||0)+T}}catch(e){b.e(e)}finally{b.f()}}}}},{key:`fixTableByRemove`,value:function(e){if(this.options.autoMergeCell){var t=e.getRows(),n=e.getCols(),r=n.reduce(function(e,t){return e[t.colId]=0,e},{}),i=L(t).reverse(),a=[],o=x(i.entries()),s;try{var c=function(){var e=F(s.value,2),n=e[0],i=e[1],o=t.length-n-1;i.children.length<=0?a.push(o):i.foreachCellInner(function(e){var t=a.reduce(function(t,n){return e.rowspan+o>n?t+1:t},0);e.rowspan-=t,r[e.colId]+=1})};for(o.s();!(s=o.n()).done;)c()}catch(e){o.e(e)}finally{o.f()}for(var l=0,u=0,d=Object.values(r);u<d.length;u++){var f=d[u];if(f===0)for(var p=[],m=0,h=0,g=Object.values(t);h<g.length;h++){var _=g[h],v=p.shift()||0,y=[];m>0?(y=_.getCellByColumIndex(l-v)[2],--m):(y=_.removeCell(l-v),y.skipRowNum&&(m+=y.skipRowNum));var b=x(y.entries()),S;try{for(b.s();!(S=b.n()).done;){var C=F(S.value,2),w=C[0],T=C[1];p[w]=(p[w]||0)+T}}catch(e){b.e(e)}finally{b.f()}}else l+=1}var E=x(n),D;try{for(E.s();!(D=E.n()).done;){var O=D.value;r[O.colId]===0&&(O.prev?O.prev.width+=O.width:O.next&&(O.next.width+=O.width),O.remove())}}catch(e){E.e(e)}finally{E.f()}}}},{key:`removeRow`,value:function(e){if(!(e.length<=0)){var t=e[0],n=H(t,z.tableMain),r=n.getRows(),i=r.length,a=-1,o=x(e),s;try{for(o.s();!(s=o.n()).done;){var c=s.value,l=H(c,z.tableRow),u=r.indexOf(l);u<i&&(i=u),u+c.rowspan>a&&(a=u+c.rowspan)}}catch(e){o.e(e)}finally{o.f()}for(var d={},f=function(e){var t=r[e];t.foreachCellInner(function(t){t.rowspan+e>a&&(d[t.colId]={rowspan:t.rowspan+e-a,colspan:t.colspan,colIndex:t.getColumnIndex()}),t.parent.remove()}),t.length()===0&&t.remove()},p=i;p<Math.min(r.length,a);p++)f(p);if(r[a])for(var m=r[a],h=n.tableId,g=0,_=Object.entries(d);g<_.length;g++){var v=F(_[g],2),y=v[0],b=v[1],S=b.colIndex,C=b.colspan,w=b.rowspan;m.insertCell(S,{tableId:h,rowId:m.rowId,colId:y,colspan:C,rowspan:w})}this.fixTableByRemove(n)}}},{key:`removeCol`,value:function(e){if(!(e.length<=0)){var t=e[0],n=H(t,z.tableMain),r={},i=x(e),a;try{for(i.s();!(a=i.n()).done;){var o=a.value;r[o.rowId]||(r[o.rowId]=0),r[o.rowId]+=o.colspan}}catch(e){i.e(e)}finally{i.f()}for(var s=Math.max.apply(Math,L(Object.values(r))),c=t.getColumnIndex(),l=n.descendants(J),u=0;u<s;u++)for(var d=[],f=0,p=0,m=Object.values(l);p<m.length;p++){var h=m[p],g=d.shift()||0;if(f>0){--f;continue}var _=h.removeCell(c-g);_.skipRowNum&&(f+=_.skipRowNum);var v=x(_.entries()),y;try{for(v.s();!(y=v.n()).done;){var b=F(y.value,2),S=b[0],C=b[1];d[S]=(d[S]||0)+C}}catch(e){v.e(e)}finally{v.f()}}var w=n.descendants(wr),T=F(w,1),E=T[0];if(E)for(var D=0;D<s;D++)E.removeColByIndex(c);this.fixTableByRemove(n)}}},{key:`mergeCells`,value:function(e){if(!(e.length<=1)){var t=e.reduce(function(e,t,n){var r=t.colId;e[0][r]||(e[0][r]=0),e[0][r]+=t.rowspan;var i=t.rowId;return e[1][i]||(e[1][i]=0),e[1][i]+=t.colspan,n!==0&&(t.moveChildren(e[2]),t.parent.remove()),e},[{},{},e[0]]),n=Math.max.apply(Math,L(Object.values(t[0]))),r=Math.max.apply(Math,L(Object.values(t[1]))),i=t[2];i.colspan=r,i.rowspan=n;var a=H(i,z.tableMain);this.fixTableByRemove(a)}}},{key:`splitCell`,value:function(e){if(e.length===1){var t=e[0];if(!(t.colspan===1&&t.rowspan===1)){var n=he(t,[z.tableMain,z.tableRow]),r=F(n,2),i=r[0],a=r[1],o=i.tableId,s=t.getColumnIndex(),c=i.getColIds().slice(s,s+t.colspan).reverse(),l=t.formats()[z.tableCellInner].style,u=a,d=t.rowspan;for(t.colspan=1,t.rowspan=1;u&&d>0;){var f=x(c),p;try{for(f.s();!(p=f.n()).done;){var m=p.value;if(!(u===a&&m===t.colId)){var h={tableId:o,rowId:u.rowId,colId:m,rowspan:1,colspan:1};l&&(h.style=l),u.insertCell(s+(u===a?1:0),h)}}}catch(e){f.e(e)}finally{f.f()}--d,u=u.next}}}}}],[{key:`register`,value:function(){var e;Er.allowedChildren=[Z],Z.allowedChildren=[Y,wr,xr],Z.requiredContainer=Er,xr.requiredContainer=Z,wr.allowedChildren=[Cr],wr.requiredContainer=Z,Y.allowedChildren=[J],Y.requiredContainer=Z,J.allowedChildren=[X],X.requiredContainer=Y,X.allowedChildren=[q,yi],X.requiredContainer=J,q.requiredContainer=X;var n=new Set([`table`]),r=Object.entries(t.default.imports).filter(function(e){var t=F(e,2),r=t[0],i=t[1],a=r.split(`formats/`)[1];return r.startsWith(`formats/`)&&!n.has(a)&&!be(i,gi.Attributor)&&(be(i,bi)||be(i,xi))}),i=r.reduce(function(e,t){var n=F(t,2),r=n[0],i=n[1],a=be(i,xi)?fr:ur;return e[r]=function(e){function t(){return v(this,t),_(this,t,arguments)}return T(t,e),b(t,null,[{key:`register`,value:function(){}}])}(ye(i,[a])),e},{});t.default.register(M(M({"blots/scroll":gr,"blots/block":ur,"blots/block/embed":fr},i),{},(e={},S(S(S(S(S(S(S(S(S(S(e,`blots/${z.container}`,K),`formats/${z.tableCell}`,X),`formats/${z.tableCellInner}`,q),`formats/${z.tableRow}`,J),`formats/${z.tableBody}`,Y),`formats/${z.tableCol}`,Cr),`formats/${z.tableColgroup}`,wr),`formats/${z.tableCaption}`,xr),`formats/${z.tableMain}`,Z),`formats/${z.tableWrapper}`,Er),S(e,`modules/clipboard`,Lr))),!0)}}])}();S(Ei,`moduleName`,le.moduleName),S(Ei,`toolName`,z.tableWrapper),S(Ei,`keyboradHandler`,{"forbid remove table by backspace":{bindInHead:!0,key:`Backspace`,collapsed:!0,offset:0,handler:function(e,t){var n=this.quill.getLine(e.index),r=n[0];if(r.prev instanceof Er)return r.prev.remove(),!1;if(t.format[z.tableCellInner]){var i=r.offset(H(r,z.tableCellInner));if(i===0)return!1}return!0}},"forbid remove table by delete":{bindInHead:!0,key:`Delete`,collapsed:!0,handler:function(e,t){var n=this.quill.getLine(e.index),r=n[0],i=n[1];if((r.next instanceof Er||r.next instanceof Cr)&&i===r.length()-1)return!1;if(t.format[z.tableCellInner]){var a=H(r,z.tableCellInner);if(r===a.children.tail&&i===r.length()-1)return!1}return!0}},"table up":Ti(!0),"table down":Ti(!1),"table caption break":{bindInHead:!0,key:`Enter`,shiftKey:null,format:[z.tableCaption],handler:function(e,t){return!1}}});var Di=Ei;exports.BlockEmbedOverride=fr,exports.BlockOverride=ur,exports.ContainerFormat=K,exports.ScrollOverride=gr,exports.Scrollbar=ui,exports.TableAlign=Or,exports.TableBodyFormat=Y,exports.TableCaptionFormat=xr,exports.TableCellFormat=X,exports.TableCellInnerFormat=q,exports.TableClipboard=Lr,exports.TableColFormat=Cr,exports.TableColgroupFormat=wr,exports.TableMainFormat=Z,exports.TableMenuCommon=ni,exports.TableMenuContextmenu=ri,exports.TableMenuSelect=ii,exports.TableResizeBox=si,exports.TableResizeCommon=oi,exports.TableResizeLine=ci,exports.TableResizeScale=li,exports.TableRowFormat=J,exports.TableSelection=pi,exports.TableUp=Ei,exports.TableVirtualScrollbar=di,exports.TableWrapperFormat=Er,exports.blotName=z,exports.createColorPicker=Fe,exports.createSelectBox=Ve,exports.createTooltip=Bn,exports.default=Di,exports.defaultCustomSelect=wi,exports.findParentBlot=H,exports.findParentBlots=he,exports.getTableMainRect=Dr,exports.isTableAlignRight=ai,exports.randomId=G,exports.tableMenuTools=Q,exports.tableUpEvent=ce,exports.tableUpInternal=le,exports.tableUpSize=B,exports.updateTableConstants=Ci});
|
|
136
140
|
//# sourceMappingURL=index.umd.js.map
|