@yoopta/table 4.8.5-rc.6 → 4.8.5-rc.7
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/dist/index.js +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{generateId as e,Blocks as t,Elements as n,UI as r,useYooptaEditor as o,useBlockData as i,deserializeTextNodes as a,serializeTextNodes as s,serializeTextNodesIntoMarkdown as l,YooptaPlugin as c}from"@yoopta/editor";import{jsxs as u,jsx as d,Fragment as f}from"react/jsx-runtime";import*as p from"react";import{forwardRef as h,createElement as m,useRef as y,useEffect as b,useLayoutEffect as g,useState as v,useMemo as w}from"react";import*as x from"react-dom";function
|
|
1
|
+
import{generateId as e,Blocks as t,Elements as n,UI as r,useYooptaEditor as o,useBlockData as i,deserializeTextNodes as a,serializeTextNodes as s,serializeTextNodesIntoMarkdown as l,YooptaPlugin as c}from"@yoopta/editor";import{jsxs as u,jsx as d,Fragment as f}from"react/jsx-runtime";import*as p from"react";import{forwardRef as h,createElement as m,useRef as y,useEffect as b,useLayoutEffect as g,useState as v,useMemo as w}from"react";import*as x from"react-dom";function k(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".yoo-table-mr-2{margin-right:.5rem}.yoo-table-block{display:block}.yoo-table-flex{display:flex}.yoo-table-h-4{height:1rem}.yoo-table-h-\\[14px\\]{height:14px}.yoo-table-w-4{width:1rem}.yoo-table-w-\\[14px\\]{width:14px}.yoo-table-flex-shrink-0{flex-shrink:0}.yoo-table-rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.yoo-table-justify-between{justify-content:space-between}.yoopta-table-block{overflow-x:auto;overflow-y:hidden;padding-bottom:.5rem;padding-top:.5rem;position:relative;width:100%}.yoopta-table-block .yoopta-table-options{opacity:0;top:12px;transition:opacity .15s ease-in-out}.yoopta-table-block:hover .yoopta-table-options{opacity:1}.yoopta-table{--tw-border-spacing-x:0px;--tw-border-spacing-y:0px;border-collapse:collapse;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);caption-side:bottom;font-size:.875rem;line-height:1.25rem;table-layout:fixed;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto}.yoopta-table-selecting ::-moz-selection{background:none}.yoopta-table-selecting ::selection{background:none}.yoopta-table tbody{-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-table-row{position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yoopta-table-row-selected{border-color:#73b6db;border-width:2px}.yoopta-table-data-cell{fill:currentColor;border-width:1px;border:1px solid #e9e9e7;color:inherit;min-height:32px;position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);vertical-align:top}.yoopta-table-data-cell[data-cell-selected=true]{background-color:#37352f14}.yoopta-table-data-cell-head{background-color:#f7f6f3}.yoopta-table-data-cell:hover .yoopta-table-column-button,.yoopta-table-data-cell:hover .yoopta-table-row-button{opacity:1}.yoopta-table-data-cell-content{background-color:transparent;caret-color:#37352f;font-size:14px;line-height:20px;max-width:100%;overflow-wrap:break-word;padding:7px 9px;white-space:pre-wrap;width:100%}.yoopta-table-column-button{height:16px;left:calc(50% - 13px);padding:2px 4px;top:-8px;width:26px}.yoopta-table-column-button,.yoopta-table-row-button{--tw-bg-opacity:1;composes:yoopta-button;fill:rgba(55,53,47,.35);align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-radius:4px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),hsla(0,0%,6%,.1) 0 0 0 1px,hsla(0,0%,6%,.1) 0 2px 4px;cursor:pointer;display:flex;justify-content:center;opacity:0;position:absolute;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:4}.yoopta-table-row-button{height:26px;left:-8px;padding:4px 2px;top:calc(50% - 13px);width:16px}.yoopta-table-icons{height:1rem;margin-right:.5rem;width:1rem}.yoopta-table-resize-handle{flex-grow:0;height:100%;position:absolute;right:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:0;z-index:1}.yoopta-table-resize-handle-inner{background-color:#2383e200;cursor:col-resize;height:calc(100% + 2px);margin-left:-1px;margin-top:-1px;position:absolute;transition-delay:50ms;transition-duration:.15s;transition-property:background;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none;width:3px}.yoopta-table-resize-handle-inner:hover{background-color:#74b6db}"),"function"==typeof SuppressedError&&SuppressedError;
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide-react v0.436.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
6
6
|
* See the LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const O=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&n.indexOf(e)===t)).join(" ")
|
|
9
9
|
/**
|
|
10
10
|
* @license lucide-react v0.436.0 - ISC
|
|
11
11
|
*
|
|
@@ -17,7 +17,7 @@ const k=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&n.indexOf(e)===t)).join(" ")
|
|
|
17
17
|
*
|
|
18
18
|
* This source code is licensed under the ISC license.
|
|
19
19
|
* See the LICENSE file in the root directory of this source tree.
|
|
20
|
-
*/const _=h((({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...s},l)=>m("svg",{ref:l,...E,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:
|
|
20
|
+
*/const _=h((({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...s},l)=>m("svg",{ref:l,...E,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:O("lucide",o),...s},[...a.map((([e,t])=>m(e,t))),...Array.isArray(i)?i:[i]]))),P=(e,t)=>{const n=h((({className:n,...r},o)=>{return m(_,{ref:o,iconNode:t,className:O(`lucide-${i=e,i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,n),...r});var i}));return n.displayName=`${e}`,n},j=P("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),N=P("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),S=P("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),C=P("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),R=P("CornerUpRight",[["polyline",{points:"15 14 20 9 15 4",key:"1tbx3s"}],["path",{d:"M4 20v-7a4 4 0 0 1 4-4h12",key:"1lu4f8"}]]),T=P("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]),A=P("MoveLeft",[["path",{d:"M6 8L2 12L6 16",key:"kyvwex"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),M=P("MoveRight",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),z=P("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]),D=P("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]),L=P("TableProperties",[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),B=P("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);
|
|
21
21
|
/**
|
|
22
22
|
* @license lucide-react v0.436.0 - ISC
|
|
23
23
|
*
|
|
@@ -30,4 +30,4 @@ const k=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&n.indexOf(e)===t)).join(" ")
|
|
|
30
30
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
31
31
|
* Released under the MIT License.
|
|
32
32
|
*/
|
|
33
|
-
function H(e){return"[object Object]"===Object.prototype.toString.call(e)}function I(e){var t,n;return!1!==H(e)&&(void 0===(t=e.constructor)||!1!==H(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var q=Symbol.for("immer-nothing"),F=Symbol.for("immer-draftable"),W=Symbol.for("immer-state");function $(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var V=Object.getPrototypeOf;function K(e){return!!e&&!!e[W]}function Z(e){return!!e&&(U(e)||Array.isArray(e)||!!e[F]||!!e.constructor?.[F]||ee(e)||te(e))}var X=Object.prototype.constructor.toString();function U(e){if(!e||"object"!=typeof e)return!1;const t=V(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===X}function J(e,t){0===Y(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Y(e){const t=e[W];return t?t.type_:Array.isArray(e)?1:ee(e)?2:te(e)?3:0}function G(e,t){return 2===Y(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Q(e,t,n){const r=Y(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ee(e){return e instanceof Map}function te(e){return e instanceof Set}function ne(e){return e.copy_||e.base_}function re(e,t){if(ee(e))return new Map(e);if(te(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&U(e)){if(!V(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[W];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],i=n[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(V(e),n)}function oe(e,t=!1){return ae(e)||K(e)||!Z(e)||(Y(e)>1&&(e.set=e.add=e.clear=e.delete=ie),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>oe(t,!0)))),e}function ie(){$(2)}function ae(e){return Object.isFrozen(e)}var se,le={};function ce(e){const t=le[e];return t||$(0),t}function ue(){return se}function de(e,t){t&&(ce("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fe(e){pe(e),e.drafts_.forEach(me),e.drafts_=null}function pe(e){e===se&&(se=e.parent_)}function he(e){return se={drafts_:[],parent_:se,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function me(e){const t=e[W];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ye(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[W].modified_&&(fe(t),$(4)),Z(e)&&(e=be(t,e),t.parent_||ve(t,e)),t.patches_&&ce("Patches").generateReplacementPatches_(n[W].base_,e,t.patches_,t.inversePatches_)):e=be(t,n,[]),fe(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==q?e:void 0}function be(e,t,n){if(ae(t))return t;const r=t[W];if(!r)return J(t,((o,i)=>ge(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return ve(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,i=!1;3===r.type_&&(o=new Set(t),t.clear(),i=!0),J(o,((o,a)=>ge(e,r,t,o,a,n,i))),ve(e,t,!1),n&&e.patches_&&ce("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function ge(e,t,n,r,o,i,a){if(K(o)){const a=be(e,o,i&&t&&3!==t.type_&&!G(t.assigned_,r)?i.concat(r):void 0);if(Q(n,r,a),!K(a))return;e.canAutoFreeze_=!1}else a&&n.add(o);if(Z(o)&&!ae(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;be(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||ve(e,o)}}function ve(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&oe(t,n)}var we={get(e,t){if(t===W)return e;const n=ne(e);if(!G(n,t))return function(e,t,n){const r=ke(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Z(r)?r:r===Oe(e.base_,t)?(_e(e),e.copy_[t]=Pe(r,e)):r},has:(e,t)=>t in ne(e),ownKeys:e=>Reflect.ownKeys(ne(e)),set(e,t,n){const r=ke(ne(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Oe(ne(e),t),a=r?.[W];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||G(e.base_,t)))return!0;_e(e),Ee(e)}var o,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Oe(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,_e(e),Ee(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ne(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){$(11)},getPrototypeOf:e=>V(e.base_),setPrototypeOf(){$(12)}},xe={};function Oe(e,t){const n=e[W];return(n?ne(n):e)[t]}function ke(e,t){if(!(t in e))return;let n=V(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=V(n)}}function Ee(e){e.modified_||(e.modified_=!0,e.parent_&&Ee(e.parent_))}function _e(e){e.copy_||(e.copy_=re(e.base_,e.scope_.immer_.useStrictShallowCopy_))}J(we,((e,t)=>{xe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),xe.deleteProperty=function(e,t){return xe.set.call(this,e,t,void 0)},xe.set=function(e,t,n){return we.set.call(this,e[0],t,n,e[0])};function Pe(e,t){const n=ee(e)?ce("MapSet").proxyMap_(e,t):te(e)?ce("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ue(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=we;n&&(o=[r],i=xe);const{revoke:a,proxy:s}=Proxy.revocable(o,i);return r.draft_=s,r.revoke_=a,s}(e,t);return(t?t.scope_:ue()).drafts_.push(n),n}function je(e){if(!Z(e)||ae(e))return e;const t=e[W];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=re(e,t.scope_.immer_.useStrictShallowCopy_)}else n=re(e,!0);return J(n,((e,t)=>{Q(n,e,je(t))})),t&&(t.finalized_=!1),n}var Ne=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&$(6),void 0!==n&&"function"!=typeof n&&$(7),Z(e)){const o=he(this),i=Pe(e,void 0);let a=!0;try{r=t(i),a=!1}finally{a?fe(o):pe(o)}return de(o,n),ye(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===q&&(r=void 0),this.autoFreeze_&&oe(r,!0),n){const t=[],o=[];ce("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}$(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Z(e)||$(8),K(e)&&(e=function(e){K(e)||$(10);return je(e)}(e));const t=he(this),n=Pe(e,void 0);return n[W].isManual_=!0,pe(t),n}finishDraft(e,t){const n=e&&e[W];n&&n.isManual_||$(9);const{scope_:r}=n;return de(r,t),ye(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=ce("Patches").applyPatches_;return K(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},Se=Ne.produce;Ne.produceWithPatches.bind(Ne),Ne.setAutoFreeze.bind(Ne),Ne.setUseStrictShallowCopy.bind(Ne),Ne.applyPatches.bind(Ne);var Ce=Ne.createDraft.bind(Ne),Re=Ne.finishDraft.bind(Ne),Te={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=Te.levels(e,t);return r=n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return Te.equals(r,o)&&i>a},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return Te.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return Te.equals(r,o)&&i<a},equals:(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===Te.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===Te.compare(e,t),isBefore:(e,t)=>-1===Te.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===Te.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===Te.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===Te.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===Te.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&Te.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!Te.isAncestor(t,e)&&!Te.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:i}=t;(Te.equals(i,r)||Te.endsBefore(i,r)||Te.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(Te.equals(a,r)||Te.isAncestor(a,r))return null;Te.endsBefore(a,r)&&(r[a.length-1]-=1);break;case"merge_node":var{path:s,position:l}=t;Te.equals(s,r)||Te.endsBefore(s,r)?r[s.length-1]-=1:Te.isAncestor(s,r)&&(r[s.length-1]-=1,r[s.length]+=l);break;case"split_node":var{path:c,position:u}=t;if(Te.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else Te.endsBefore(c,r)?r[c.length-1]+=1:Te.isAncestor(c,r)&&e[c.length]>=u&&(r[c.length-1]+=1,r[c.length]-=u);break;case"move_node":var{path:d,newPath:f}=t;if(Te.equals(d,f))return r;if(Te.isAncestor(d,r)||Te.equals(d,r)){var p=f.slice();return Te.endsBefore(d,f)&&d.length<f.length&&(p[d.length-1]-=1),p.concat(r.slice(d.length))}Te.isSibling(d,f)&&(Te.isAncestor(f,r)||Te.equals(f,r))?Te.endsBefore(d,r)?r[d.length-1]-=1:r[d.length-1]+=1:Te.endsBefore(f,r)||Te.equals(f,r)||Te.isAncestor(f,r)?(Te.endsBefore(d,r)&&(r[d.length-1]-=1),r[f.length-1]+=1):Te.endsBefore(d,r)&&(Te.equals(f,r)&&(r[f.length-1]+=1),r[d.length-1]-=1)}return r}};function Ae(e){return Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ae(e)}function Me(e){var t=function(e,t){if("object"!==Ae(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ae(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ae(t)?t:String(t)}function ze(e,t,n){return(t=Me(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function De(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 Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Be={transform(e,t){e.children=Ce(e.children);var n=e.selection&&Ce(e.selection);try{n=((e,t,n)=>{switch(n.type){case"insert_node":var{path:r,node:o}=n,i=Ye.parent(e,r),a=r[r.length-1];if(a>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(a,0,o),t)for(var[s,l]of Ve.points(t))t[l]=it.transform(s,n);break;case"insert_text":var{path:c,offset:u,text:d}=n;if(0===d.length)break;var f=Ye.leaf(e,c),p=f.text.slice(0,u),h=f.text.slice(u);if(f.text=p+d+h,t)for(var[m,y]of Ve.points(t))t[y]=it.transform(m,n);break;case"merge_node":var{path:b}=n,g=Ye.get(e,b),v=Te.previous(b),w=Ye.get(e,v),x=Ye.parent(e,b),O=b[b.length-1];if(pt.isText(g)&&pt.isText(w))w.text+=g.text;else{if(pt.isText(g)||pt.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(b,"] to nodes of different interfaces: ").concat(st.stringify(g)," ").concat(st.stringify(w)));w.children.push(...g.children)}if(x.children.splice(O,1),t)for(var[k,E]of Ve.points(t))t[E]=it.transform(k,n);break;case"move_node":var{path:_,newPath:P}=n;if(Te.isAncestor(_,P))throw new Error("Cannot move a path [".concat(_,"] to new path [").concat(P,"] because the destination is inside itself."));var j=Ye.get(e,_),N=Ye.parent(e,_),S=_[_.length-1];N.children.splice(S,1);var C=Te.transform(_,n),R=Ye.get(e,Te.parent(C)),T=C[C.length-1];if(R.children.splice(T,0,j),t)for(var[A,M]of Ve.points(t))t[M]=it.transform(A,n);break;case"remove_node":var{path:z}=n,D=z[z.length-1];if(Ye.parent(e,z).children.splice(D,1),t)for(var[L,B]of Ve.points(t)){var H=it.transform(L,n);if(null!=t&&null!=H)t[B]=H;else{var I=void 0,q=void 0;for(var[F,W]of Ye.texts(e)){if(-1!==Te.compare(W,z)){q=[F,W];break}I=[F,W]}var $=!1;I&&q&&($=Te.equals(q[1],z)?!Te.hasPrevious(q[1]):Te.common(I[1],z).length<Te.common(q[1],z).length),I&&!$?(L.path=I[1],L.offset=I[0].text.length):q?(L.path=q[1],L.offset=0):t=null}}break;case"remove_text":var{path:V,offset:K,text:Z}=n;if(0===Z.length)break;var X=Ye.leaf(e,V),U=X.text.slice(0,K),J=X.text.slice(K+Z.length);if(X.text=U+J,t)for(var[Y,G]of Ve.points(t))t[G]=it.transform(Y,n);break;case"set_node":var{path:Q,properties:ee,newProperties:te}=n;if(0===Q.length)throw new Error("Cannot set properties on the root node!");var ne=Ye.get(e,Q);for(var re in te){if("children"===re||"text"===re)throw new Error('Cannot set the "'.concat(re,'" property of nodes!'));var oe=te[re];null==oe?delete ne[re]:ne[re]=oe}for(var ie in ee)te.hasOwnProperty(ie)||delete ne[ie];break;case"set_selection":var{newProperties:ae}=n;if(null==ae)t=ae;else{if(null==t){if(!Ve.isRange(ae))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(st.stringify(ae)," when there is no current selection."));t=Le({},ae)}for(var se in ae){var le=ae[se];if(null==le){if("anchor"===se||"focus"===se)throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=le}}break;case"split_node":var{path:ce,position:ue,properties:de}=n;if(0===ce.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ce,"] because the root node cannot be split."));var fe,pe=Ye.get(e,ce),he=Ye.parent(e,ce),me=ce[ce.length-1];if(pt.isText(pe)){var ye=pe.text.slice(0,ue),be=pe.text.slice(ue);pe.text=ye,fe=Le(Le({},de),{},{text:be})}else{var ge=pe.children.slice(0,ue),ve=pe.children.slice(ue);pe.children=ge,fe=Le(Le({},de),{},{children:ve})}if(he.children.splice(me+1,0,fe),t)for(var[we,xe]of Ve.points(t))t[xe]=it.transform(we,n)}return t})(e,n,t)}finally{e.children=Re(e.children),e.selection=n?K(n)?Re(n):n:null}}},He={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},Ie={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},qe=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(I(r)&&I(o)){if(!qe(r,o))return!1}else if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==o[i])return!1}else if(r!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0};function Fe(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var We=["anchor","focus"];function $e(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}var Ve={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return Ve.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=Ve.edges(e);return t},equals:(e,t)=>it.equals(e.anchor,t.anchor)&&it.equals(e.focus,t.focus),includes(e,t){if(Ve.isRange(t)){if(Ve.includes(e,t.anchor)||Ve.includes(e,t.focus))return!0;var[n,r]=Ve.edges(e),[o,i]=Ve.edges(t);return it.isBefore(n,o)&&it.isAfter(r,i)}var[a,s]=Ve.edges(e),l=!1,c=!1;return it.isPoint(t)?(l=it.compare(t,a)>=0,c=it.compare(t,s)<=0):(l=Te.compare(t,a.path)>=0,c=Te.compare(t,s.path)<=0),l&&c},intersection(e,t){var n=Fe(e,We),[r,o]=Ve.edges(e),[i,a]=Ve.edges(t),s=it.isBefore(r,i)?i:r,l=it.isBefore(o,a)?o:a;return it.isBefore(l,s)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$e(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({anchor:s,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return it.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return it.equals(t,n)},isExpanded:e=>!Ve.isCollapsed(e),isForward:e=>!Ve.isBackward(e),isRange:e=>I(e)&&it.isPoint(e.anchor)&&it.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Ve.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Se(e,(e=>{if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var a=Ve.isCollapsed(e);Ve.isForward(e)?(r="forward",o=a?r:"backward"):(r="backward",o=a?r:"forward")}else"outward"===i?Ve.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var s=it.transform(e.anchor,t,{affinity:r}),l=it.transform(e.focus,t,{affinity:o});if(!s||!l)return null;e.anchor=s,e.focus=l}))}},Ke=e=>I(e)&&Ye.isNodeList(e.children)&&!nt.isEditor(e),Ze={isAncestor:e=>I(e)&&Ye.isNodeList(e.children),isElement:Ke,isElementList:e=>Array.isArray(e)&&e.every((e=>Ze.isElement(e))),isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return Ke(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},Xe=["children"],Ue=["text"],Je=new WeakMap,Ye={ancestor(e,t){var n=Ye.get(e,t);if(pt.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(st.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of Te.ancestors(t,n)){var o=[Ye.ancestor(e,r),r];yield o}}()},child(e,t){if(pt.isText(e))throw new Error("Cannot get the child of a text node: ".concat(st.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(st.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=Ye.ancestor(e,t),{children:i}=o,a=r?i.length-1:0;r?a>=0:a<i.length;){var s=Ye.child(o,a),l=t.concat(a);yield[s,l],a=r?a-1:a+1}}()},common(e,t,n){var r=Te.common(t,n);return[Ye.get(e,r),r]},descendant(e,t){var n=Ye.get(e,t);if(nt.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(st.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))Ze.isElement(n)&&(yield[n,r])}()},extractProps:e=>Ze.isAncestor(e)?Fe(e,Xe):Fe(e,Ue),first(e,t){for(var n=t.slice(),r=Ye.get(e,n);r&&!pt.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(pt.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(st.stringify(e)));var n=Se({children:e.children},(e=>{var[n,r]=Ve.edges(t),o=Ye.nodes(e,{reverse:!0,pass:e=>{var[,n]=e;return!Ve.includes(t,n)}});for(var[,i]of o){if(!Ve.includes(t,i)){var a=Ye.parent(e,i),s=i[i.length-1];a.children.splice(s,1)}if(Te.equals(i,r.path)){var l=Ye.leaf(e,i);l.text=l.text.slice(0,r.offset)}if(Te.equals(i,n.path)){var c=Ye.leaf(e,i);c.text=c.text.slice(n.offset)}}nt.isEditor(e)&&(e.selection=null)}));return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(pt.isText(n)||!n.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(st.stringify(e)));n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(pt.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode:e=>pt.isText(e)||Ze.isElement(e)||nt.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=Je.get(e);if(void 0!==t)return t;var n=e.every((e=>Ye.isNode(e)));return Je.set(e,n),n},last(e,t){for(var n=t.slice(),r=Ye.get(e,n);r&&!pt.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=Ye.get(e,t);if(!pt.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(st.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of Te.levels(t,n)){var o=Ye.get(e,r);yield[o,r]}}()},matches:(e,t)=>Ze.isElement(e)&&Ze.isElementProps(t)&&Ze.matches(e,t)||pt.isText(e)&&pt.isTextProps(t)&&pt.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:i}=t,a=new Set,s=[],l=e;!i||!(r?Te.isBefore(s,i):Te.isAfter(s,i));)if(a.has(l)||(yield[l,s]),a.has(l)||pt.isText(l)||0===l.children.length||null!=n&&!1!==n([l,s])){if(0===s.length)break;if(!r){var c=Te.next(s);if(Ye.has(e,c)){s=c,l=Ye.get(e,s);continue}}if(r&&0!==s[s.length-1])s=Te.previous(s),l=Ye.get(e,s);else s=Te.parent(s),l=Ye.get(e,s),a.add(l)}else{a.add(l);var u=r?l.children.length-1:0;Te.isAncestor(s,o)&&(u=o[s.length]),s=s.concat(u),l=Ye.get(e,s)}}()},parent(e,t){var n=Te.parent(t),r=Ye.get(e,n);if(pt.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>pt.isText(e)?e.text:e.children.map(Ye.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))pt.isText(n)&&(yield[n,r])}()}};function Ge(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 Qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var et={isNodeOperation:e=>et.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!I(e))return!1;switch(e.type){case"insert_node":case"remove_node":return Te.isPath(e.path)&&Ye.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&Te.isPath(e.path);case"merge_node":return"number"==typeof e.position&&Te.isPath(e.path)&&I(e.properties);case"move_node":return Te.isPath(e.path)&&Te.isPath(e.newPath);case"set_node":return Te.isPath(e.path)&&I(e.properties)&&I(e.newProperties);case"set_selection":return null===e.properties&&Ve.isRange(e.newProperties)||null===e.newProperties&&Ve.isRange(e.properties)||I(e.properties)&&I(e.newProperties);case"split_node":return Te.isPath(e.path)&&"number"==typeof e.position&&I(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>et.isOperation(e))),isSelectionOperation:e=>et.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>et.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return Qe(Qe({},e),{},{type:"remove_node"});case"insert_text":return Qe(Qe({},e),{},{type:"remove_text"});case"merge_node":return Qe(Qe({},e),{},{type:"split_node",path:Te.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(Te.equals(t,n))return e;if(Te.isSibling(n,t))return Qe(Qe({},e),{},{path:t,newPath:n});var r=Te.transform(n,e),o=Te.transform(Te.next(n),e);return Qe(Qe({},e),{},{path:r,newPath:o});case"remove_node":return Qe(Qe({},e),{},{type:"insert_node"});case"remove_text":return Qe(Qe({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return Qe(Qe({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:s,newProperties:l}=e;return Qe(Qe({},e),{},null==s?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:s}:{properties:l,newProperties:s});case"split_node":return Qe(Qe({},e),{},{type:"merge_node",path:Te.next(e.path)})}}},tt=new WeakMap,nt={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,n)=>e.isEdge(t,n),isEditor:e=>(e=>{var t=tt.get(e);if(void 0!==t)return t;if(!I(e))return!1;var n="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||I(e.marks))&&(null===e.selection||Ve.isRange(e.selection))&&Ye.isNodeList(e.children)&&et.isOperationList(e.operations);return tt.set(e,n),n})(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)}};function rt(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 ot(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rt(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var it={compare(e,t){var n=Te.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===it.compare(e,t),isBefore:(e,t)=>-1===it.compare(e,t),equals:(e,t)=>e.offset===t.offset&&Te.equals(e.path,t.path),isPoint:e=>I(e)&&"number"==typeof e.offset&&Te.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Se(e,(e=>{if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=Te.transform(o,t,n);break;case"insert_text":Te.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(e.offset+=t.text.length);break;case"merge_node":Te.equals(t.path,o)&&(e.offset+=t.position),e.path=Te.transform(o,t,n);break;case"remove_text":Te.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(Te.equals(t.path,o)||Te.isAncestor(t.path,o))return null;e.path=Te.transform(o,t,n);break;case"split_node":if(Te.equals(t.path,o)){if(t.position===i&&null==r)return null;(t.position<i||t.position===i&&"forward"===r)&&(e.offset-=t.position,e.path=Te.transform(o,t,ot(ot({},n),{},{affinity:"forward"})))}else e.path=Te.transform(o,t,n)}}))}},at=void 0,st={setScrubber(e){at=e},stringify:e=>JSON.stringify(e,at)},lt=["text"],ct=["anchor","focus"];function ut(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 dt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ft,pt={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return Fe(e,lt)}return qe(r?o(e):e,r?o(t):t)},isText:e=>I(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>pt.isText(e))),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[dt({},e)];for(var r of t){var o=Fe(r,ct),[i,a]=Ve.edges(r),s=[],l=0,c=i.offset,u=a.offset;for(var d of n){var{length:f}=d.text,p=l;if(l+=f,c<=p&&l<=u)Object.assign(d,o),s.push(d);else if(c!==u&&(c===l||u===p)||c>l||u<p||u===p&&0!==p)s.push(d);else{var h=d,m=void 0,y=void 0;if(u<l){var b=u-p;y=dt(dt({},h),{},{text:h.text.slice(b)}),h=dt(dt({},h),{},{text:h.text.slice(0,b)})}if(c>p){var g=c-p;m=dt(dt({},h),{},{text:h.text.slice(0,g)}),h=dt(dt({},h),{},{text:h.text.slice(g)})}Object.assign(h,o),m&&s.push(m),s.push(h),y&&s.push(y)}}n=s}return n}},ht=e=>e.selection?e.selection:e.children.length>0?nt.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(ft||(ft={})),ft.L,ft.L,ft.V,ft.LV,ft.LVT,ft.LV,ft.V,ft.V,ft.T,ft.LVT,ft.T,ft.T,ft.Any,ft.Extend,ft.ZWJ,ft.Any,ft.SpacingMark,ft.Prepend,ft.Any,ft.ZWJ,ft.ExtPict,ft.RI,ft.RI;var mt={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};nt.withoutNormalizing(e,(()=>{var{voids:r=!1}=n,{at:o=ht(e)}=n;if(Te.isPath(o)&&(o=nt.range(e,o)),Ve.isRange(o))if(Ve.isCollapsed(o))o=o.anchor;else{var i=Ve.end(o);if(!r&&nt.void(e,{at:i}))return;var a=Ve.start(o),s=nt.pointRef(e,a),l=nt.pointRef(e,i);gt.delete(e,{at:o,voids:r});var c=s.unref(),u=l.unref();o=c||u,gt.setSelection(e,{anchor:o,focus:o})}if(!(!r&&nt.void(e,{at:o})||nt.elementReadOnly(e,{at:o}))){var{path:d,offset:f}=o;t.length>0&&e.apply({type:"insert_text",path:d,offset:f,text:t})}}))}};function yt(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 bt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var gt=bt(bt(bt(bt({},Be),He),Ie),mt);const vt={buildTableElements:(t,n)=>{const{rows:r=3,columns:o=3,columnWidth:i=200,headerColumn:a=!1,headerRow:s=!1}=n||{},l={id:e(),type:"table",children:[],props:{headerColumn:a,headerRow:s}};for(let t=0;t<r;t++){const n={id:e(),type:"table-row",children:[]};for(let r=0;r<o;r++){const r={id:e(),type:"table-data-cell",children:[{text:""}],props:{width:i||200,asHeader:0===t&&!!s}};n.children.push(r)}l.children.push(n)}return l},insertTable:(e,n)=>{const r=vt.buildTableElements(e,n),o=t.buildBlockData({value:[r],type:"Table"});t.insertBlock(e,o.type,Object.assign(Object.assign({},n),{blockData:o}))},deleteTable:(e,t)=>{e.deleteBlock({blockId:t})},insertTableRow:(r,o,i)=>{const a=t.getSlate(r,{id:o});a&&nt.withoutNormalizing(a,(()=>{const{insertMode:t="after",path:s=a.selection,select:l=!0}=i||{},c=n.getElementEntry(r,o,{path:s,type:"table-row"});if(!c)return;const[u,d]=c,f="before"===t?d:Te.next(d),p={id:e(),type:"table-row",children:u.children.map((t=>({id:e(),type:"table-data-cell",children:[{text:""}]}))),props:{nodeType:"block"}};gt.insertNodes(a,p,{at:f}),l&>.select(a,[...f,0])}))},deleteTableRow:(e,r,o)=>{const i=t.getSlate(e,{id:r});i&&nt.withoutNormalizing(i,(()=>{const{path:t=i.selection}=o||{},a=n.getElementEntry(e,r,{path:t,type:"table-row"});if(!a)return;const[s,l]=a,c=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"highest"});1!==Array.from(c).length&>.removeNodes(i,{at:l,match:e=>Ze.isElement(e)&&"table-row"===e.type})}))},moveTableRow:(e,n,{from:r,to:o})=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{gt.moveNodes(i,{at:r,to:o,match:e=>Ze.isElement(e)&&"table-row"===e.type})}))},moveTableColumn:(e,n,{from:r,to:o})=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const e=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"});Array.from(e).forEach((([e,t])=>{gt.moveNodes(i,{at:t.concat(r[r.length-1]),to:[...t,o[o.length-1]],match:e=>Ze.isElement(e)})}))}))},insertTableColumn:(r,o,i)=>{const a=t.getSlate(r,{id:o});a&&nt.withoutNormalizing(a,(()=>{const{insertMode:t="after",path:s=a.selection,select:l=!0}=i||{},c=n.getElementEntry(r,o,{path:s,type:"table-data-cell"});if(!c)return;const[u,d]=c,f=d[d.length-1],p="before"===t?f:Te.next(d)[d.length-1],h=nt.nodes(a,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"lowest"});for(const[,t]of h){const n={id:e(),type:"table-data-cell",children:[{text:""}]};gt.insertNodes(a,n,{at:[...t,p]})}l&>.select(a,[0,0,p,0])}))},deleteTableColumn:(e,r,o)=>{const i=t.getSlate(e,{id:r});i&&nt.withoutNormalizing(i,(()=>{const{path:t=i.selection}=o||{},a=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"}),s=Array.from(a);if(s[0][0].children.length<=1)return;const l=n.getElementEntry(e,r,{path:t,type:"table-data-cell"});if(!l)return;const[c,u]=l,d=u[u.length-1],f=s.map((([e,t])=>e.children[d]?[...t,d]:null));f.forEach((e=>{e&>.removeNodes(i,{at:e})}))}))},updateColumnWidth:(e,n,r,o)=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const e=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,mode:"all"});Array.from(e).forEach((([e,t])=>{t[t.length-1]===r&>.setNodes(i,{props:Object.assign(Object.assign({},e.props),{width:o})},{at:t,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})}))}))},toggleHeaderRow:(e,r)=>{const o=t.getSlate(e,{id:r});o&&nt.withoutNormalizing(o,(()=>{var t;const i=n.getElement(e,r,{type:"table",path:[0]}),a=(null===(t=null==i?void 0:i.props)||void 0===t?void 0:t.headerRow)||!1,s=nt.nodes(o,{at:[0,0],match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,mode:"all"});Array.from(s).forEach((([e,t])=>{var n;gt.setNodes(o,{props:Object.assign(Object.assign({},e.props),{asHeader:!(null===(n=e.props)||void 0===n?void 0:n.asHeader)})},{at:t,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})})),gt.setNodes(o,{props:Object.assign(Object.assign({},null==i?void 0:i.props),{headerRow:!a})},{at:[0],match:e=>Ze.isElement(e)&&"table"===e.type})}))},toggleHeaderColumn:(e,r)=>{const o=t.getSlate(e,{id:r});o&&nt.withoutNormalizing(o,(()=>{var t;const i=n.getElement(e,r,{type:"table",path:[0]}),a=(null===(t=null==i?void 0:i.props)||void 0===t?void 0:t.headerColumn)||!1,s=nt.nodes(o,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"});Array.from(s).forEach((([e,t])=>{var n;const r=e.children[0];gt.setNodes(o,{props:Object.assign(Object.assign({},r.props),{asHeader:!(null===(n=r.props)||void 0===n?void 0:n.asHeader)})},{at:t.concat(0),match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})})),gt.setNodes(o,{props:Object.assign(Object.assign({},null==i?void 0:i.props),{headerColumn:!a})},{at:[0],match:e=>Ze.isElement(e)&&"table"===e.type})}))}},{ExtendedBlockActions:wt,BlockOptionsMenuGroup:xt,BlockOptionsMenuItem:Ot,BlockOptionsSeparator:kt}=r,Et=({editor:e,block:t,table:n})=>{const r=n.props,o=null==r?void 0:r.headerRow,i=null==r?void 0:r.headerColumn;return u(wt,Object.assign({onClick:()=>e.setPath({current:t.meta.order}),className:"yoopta-table-options"},{children:[d(kt,{}),u(xt,{children:[d(Ot,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-table-justify-between",onClick:()=>{vt.toggleHeaderRow(e,t.id)}},{children:[u("span",Object.assign({className:"yoo-table-flex"},{children:[d(D,{width:16,height:16,className:"yoo-table-w-4 yoo-table-h-4 yoo-table-mr-2"}),"Header row"]})),o&&d(S,{width:16,height:16,className:"yoo-table-w-4 yoo-table-h-4"})]}))}),d(Ot,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-table-justify-between",onClick:()=>{vt.toggleHeaderColumn(e,t.id)}},{children:[u("span",Object.assign({className:"yoo-table-flex"},{children:[d(L,{width:16,height:16,className:"yoo-table-w-4 yoo-table-h-4 yoo-table-mr-2 yoo-table-rotate-180"}),"Header column"]})),i&&d(S,{width:16,height:16,className:"yoo-table-w-4 yoo-table-h-4"})]}))})]})]}))},_t=new WeakMap,Pt=new WeakMap,jt=({onResize:e,tdWidth:t,columnIndex:n})=>{const r=y(null),o=y(0),i=y(0);return b((()=>{const e=document.querySelector(".yoopta-table");if(!e)return;const t=null==e?void 0:e.offsetHeight;r.current&&(r.current.style.height=`${t}px`)}),[]),b((()=>{var n;const a=document.querySelector(".yoopta-table");if(!a)return;const s=n=>{const s=null==a?void 0:a.offsetHeight;if(!r.current)return;r.current.style.height=`${s}px`,i.current=n.clientX,o.current=t;const l=t=>{const n=t.clientX,r=o.current+(n-i.current);e(r)},c=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)};return null===(n=r.current)||void 0===n||n.addEventListener("mousedown",s),()=>{var e;null===(e=r.current)||void 0===e||e.removeEventListener("mousedown",s)}}),[n,t]),d("div",Object.assign({ref:r,className:"yoopta-table-resize-handle",contentEditable:!1},{children:d("div",{className:"yoopta-table-resize-handle-inner",contentEditable:!1})}))};function Nt(e){return Rt(e)?(e.nodeName||"").toLowerCase():"#document"}function St(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ct(e){var t;return null==(t=(Rt(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Rt(e){return e instanceof Node||e instanceof St(e).Node}function Tt(e){return e instanceof Element||e instanceof St(e).Element}function At(e){return e instanceof HTMLElement||e instanceof St(e).HTMLElement}function Mt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof St(e).ShadowRoot)}function zt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=It(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Dt(e){return["table","td","th"].includes(Nt(e))}function Lt(e){const t=Bt(),n=It(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function Bt(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Ht(e){return["html","body","#document"].includes(Nt(e))}function It(e){return St(e).getComputedStyle(e)}function qt(e){return Tt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ft(e){if("html"===Nt(e))return e;const t=e.assignedSlot||e.parentNode||Mt(e)&&e.host||Ct(e);return Mt(t)?t.host:t}function Wt(e){const t=Ft(e);return Ht(t)?e.ownerDocument?e.ownerDocument.body:e.body:At(t)&&zt(t)?t:Wt(t)}function $t(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Wt(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=St(o);return i?t.concat(a,a.visualViewport||[],zt(o)?o:[],a.frameElement&&n?$t(a.frameElement):[]):t.concat(o,$t(o,[],n))}const Vt=Math.min,Kt=Math.max,Zt=Math.round,Xt=Math.floor,Ut=e=>({x:e,y:e}),Jt={left:"right",right:"left",bottom:"top",top:"bottom"},Yt={start:"end",end:"start"};function Gt(e,t,n){return Kt(e,Vt(t,n))}function Qt(e,t){return"function"==typeof e?e(t):e}function en(e){return e.split("-")[0]}function tn(e){return e.split("-")[1]}function nn(e){return"x"===e?"y":"x"}function rn(e){return"y"===e?"height":"width"}function on(e){return["top","bottom"].includes(en(e))?"y":"x"}function an(e){return nn(on(e))}function sn(e){return e.replace(/start|end/g,(e=>Yt[e]))}function ln(e){return e.replace(/left|right|bottom|top/g,(e=>Jt[e]))}function cn(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function un(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function dn(e,t,n){let{reference:r,floating:o}=e;const i=on(t),a=an(t),s=rn(a),l=en(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[s]/2-o[s]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.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-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(tn(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function fn(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=Qt(t,e),h=cn(p),m=s[f?"floating"===d?"reference":"floating":d],y=un(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),b="floating"===d?{...a.floating,x:r,y:o}:a.reference,g=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),v=await(null==i.isElement?void 0:i.isElement(g))&&await(null==i.getScale?void 0:i.getScale(g))||{x:1,y:1},w=un(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:g,strategy:l}):b);return{top:(y.top-w.top+h.top)/v.y,bottom:(w.bottom-y.bottom+h.bottom)/v.y,left:(y.left-w.left+h.left)/v.x,right:(w.right-y.right+h.right)/v.x}}function pn(e){const t=Vt(...e.map((e=>e.left))),n=Vt(...e.map((e=>e.top)));return{x:t,y:n,width:Kt(...e.map((e=>e.right)))-t,height:Kt(...e.map((e=>e.bottom)))-n}}const hn=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=en(n),s=tn(n),l="y"===on(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=Qt(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof h&&(p="end"===s?-1*h:h),l?{x:p*u,y:f*c}:{x:f*c,y:p*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}};function mn(e){const t=It(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=At(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Zt(n)!==i||Zt(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function yn(e){return Tt(e)?e:e.contextElement}function bn(e){const t=yn(e);if(!At(t))return Ut(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=mn(t);let a=(i?Zt(n.width):n.width)/r,s=(i?Zt(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const gn=Ut(0);function vn(e){const t=St(e);return Bt()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:gn}function wn(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=yn(e);let a=Ut(1);t&&(r?Tt(r)&&(a=bn(r)):a=bn(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==St(e))&&t}(i,n,r)?vn(i):Ut(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=St(i),t=r&&Tt(r)?St(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=bn(o),t=o.getBoundingClientRect(),r=It(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,n=St(o),o=n.frameElement}}return un({width:u,height:d,x:l,y:c})}const xn=[":popover-open",":modal"];function On(e){return xn.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function kn(e){return wn(Ct(e)).left+qt(e).scrollLeft}function En(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=St(e),r=Ct(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=Bt();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=Ct(e),n=qt(e),r=e.ownerDocument.body,o=Kt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Kt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+kn(e);const s=-n.scrollTop;return"rtl"===It(r).direction&&(a+=Kt(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Ct(e));else if(Tt(t))r=function(e,t){const n=wn(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=At(e)?bn(e):Ut(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=vn(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return un(r)}function _n(e,t){const n=Ft(e);return!(n===t||!Tt(n)||Ht(n))&&("fixed"===It(n).position||_n(n,t))}function Pn(e,t,n){const r=At(t),o=Ct(t),i="fixed"===n,a=wn(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Ut(0);if(r||!r&&!i)if(("body"!==Nt(t)||zt(o))&&(s=qt(t)),r){const e=wn(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=kn(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function jn(e,t){return At(e)&&"fixed"!==It(e).position?t?t(e):e.offsetParent:null}function Nn(e,t){const n=St(e);if(!At(e)||On(e))return n;let r=jn(e,t);for(;r&&Dt(r)&&"static"===It(r).position;)r=jn(r,t);return r&&("html"===Nt(r)||"body"===Nt(r)&&"static"===It(r).position&&!Lt(r))?n:r||function(e){let t=Ft(e);for(;At(t)&&!Ht(t);){if(Lt(t))return t;t=Ft(t)}return null}(e)||n}const Sn={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Ct(r),s=!!t&&On(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Ut(1);const u=Ut(0),d=At(r);if((d||!d&&!i)&&(("body"!==Nt(r)||zt(a))&&(l=qt(r)),At(r))){const e=wn(r);c=bn(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}},getDocumentElement:Ct,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=$t(e,[],!1).filter((e=>Tt(e)&&"body"!==Nt(e))),o=null;const i="fixed"===It(e).position;let a=i?Ft(e):e;for(;Tt(a)&&!Ht(a);){const t=It(a),n=Lt(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||zt(a)&&!n&&_n(e,a))?r=r.filter((e=>e!==a)):o=t,a=Ft(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],s=i.reduce(((e,n)=>{const r=En(t,n,o);return e.top=Kt(r.top,e.top),e.right=Vt(r.right,e.right),e.bottom=Vt(r.bottom,e.bottom),e.left=Kt(r.left,e.left),e}),En(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Nn,getElementRects:async function(e){const t=this.getOffsetParent||Nn,n=this.getDimensions;return{reference:Pn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=mn(e);return{width:t,height:n}},getScale:bn,isElement:Tt,isRTL:function(e){return"rtl"===It(e).direction}};function Cn(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=yn(e),u=o||i?[...c?$t(c):[],...$t(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=c&&s?function(e,t){let n,r=null;const o=Ct(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const{left:c,top:u,width:d,height:f}=e.getBoundingClientRect();if(s||t(),!d||!f)return;const p={rootMargin:-Xt(u)+"px "+-Xt(o.clientWidth-(c+d))+"px "+-Xt(o.clientHeight-(u+f))+"px "+-Xt(c)+"px",threshold:Kt(0,Vt(1,l))||1};let h=!0;function m(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),100)}h=!1}try{r=new IntersectionObserver(m,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(m,p)}r.observe(e)}(!0),i}(c,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!l&&h.observe(c),h.observe(t));let m=l?wn(e):null;return l&&function t(){const r=wn(e);!m||r.x===m.x&&r.y===m.y&&r.width===m.width&&r.height===m.height||n();m=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const Rn=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Qt(e,t),c={x:n,y:r},u=await fn(t,l),d=on(en(o)),f=nn(d);let p=c[f],h=c[d];if(i){const e="y"===f?"bottom":"right";p=Gt(p+u["y"===f?"top":"left"],p,p-u[e])}if(a){const e="y"===d?"bottom":"right";h=Gt(h+u["y"===d?"top":"left"],h,h-u[e])}const m=s.fn({...t,[f]:p,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r}}}}},Tn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...y}=Qt(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const b=en(o),g=en(s)===s,v=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=f||(g||!m?[ln(s)]:function(e){const t=ln(e);return[sn(e),t,sn(t)]}(s));f||"none"===h||w.push(...function(e,t,n,r){const o=tn(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(en(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(sn)))),i}(s,m,h,v));const x=[s,...w],O=await fn(t,y),k=[];let E=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&k.push(O[b]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=tn(e),o=an(e),i=rn(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=ln(a)),[a,ln(a)]}(o,a,v);k.push(O[e[0]],O[e[1]])}if(E=[...E,{placement:o,overflows:k}],!k.every((e=>e<=0))){var _,P;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(P=E.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:P.placement;if(!n)switch(p){case"bestFit":{var j;const e=null==(j=E.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:j[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},An=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:s=2,x:l,y:c}=Qt(e,t),u=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),d=function(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),n=[];let r=null;for(let e=0;e<t.length;e++){const o=t[e];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map((e=>un(pn(e))))}(u),f=un(pn(u)),p=cn(s);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===d.length&&d[0].left>d[1].right&&null!=l&&null!=c)return d.find((e=>l>e.left-p.left&&l<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom))||f;if(d.length>=2){if("y"===on(n)){const e=d[0],t=d[d.length-1],r="top"===en(n),o=e.top,i=t.bottom,a=r?e.left:t.left,s=r?e.right:t.right;return{top:o,bottom:i,left:a,right:s,width:s-a,height:i-o,x:a,y:o}}const e="left"===en(n),t=Kt(...d.map((e=>e.right))),r=Vt(...d.map((e=>e.left))),o=d.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return f}},floating:r.floating,strategy:a});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Mn=(e,t,n)=>{const r=new Map,o={platform:Sn,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=dn(c,r,l),f=r,p={},h=0;for(let n=0;n<s.length;n++){const{name:i,fn:m}=s[n],{x:y,y:b,data:g,reset:v}=await m({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=y?y:u,d=null!=b?b:d,p={...p,[i]:{...p[i],...g}},v&&h<=50&&(h++,"object"==typeof v&&(v.placement&&(f=v.placement),v.rects&&(c=!0===v.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):v.rects),({x:u,y:d}=dn(c,f,l))),n=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var zn="undefined"!=typeof document?g:b;function Dn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Dn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Dn(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ln(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bn(e,t){const n=Ln(e);return Math.round(t*n)/n}function Hn(e){const t=p.useRef(e);return zn((()=>{t.current=e})),t}const In=p["useInsertionEffect".toString()]||(e=>e());var qn="undefined"!=typeof document?g:b;let Fn=!1,Wn=0;const $n=()=>"floating-ui-"+Wn++;const Vn=p["useId".toString()]||function(){const[e,t]=p.useState((()=>Fn?$n():void 0));return qn((()=>{null==e&&t($n())}),[]),p.useEffect((()=>{Fn||(Fn=!0)}),[]),e};const Kn=p.createContext(null),Zn=p.createContext(null);function Xn(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:o}=e,[i,a]=p.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||i,l=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[u,d]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=p.useState(r);Dn(f,r)||h(r);const[m,y]=p.useState(null),[b,g]=p.useState(null),v=p.useCallback((e=>{e!==E.current&&(E.current=e,y(e))}),[]),w=p.useCallback((e=>{e!==_.current&&(_.current=e,g(e))}),[]),O=i||m,k=a||b,E=p.useRef(null),_=p.useRef(null),P=p.useRef(u),j=null!=l,N=Hn(l),S=Hn(o),C=p.useCallback((()=>{if(!E.current||!_.current)return;const e={placement:t,strategy:n,middleware:f};S.current&&(e.platform=S.current),Mn(E.current,_.current,e).then((e=>{const t={...e,isPositioned:!0};R.current&&!Dn(P.current,t)&&(P.current=t,x.flushSync((()=>{d(t)})))}))}),[f,t,n,S]);zn((()=>{!1===c&&P.current.isPositioned&&(P.current.isPositioned=!1,d((e=>({...e,isPositioned:!1}))))}),[c]);const R=p.useRef(!1);zn((()=>(R.current=!0,()=>{R.current=!1})),[]),zn((()=>{if(O&&(E.current=O),k&&(_.current=k),O&&k){if(N.current)return N.current(O,k,C);C()}}),[O,k,C,N,j]);const T=p.useMemo((()=>({reference:E,floating:_,setReference:v,setFloating:w})),[v,w]),A=p.useMemo((()=>({reference:O,floating:k})),[O,k]),M=p.useMemo((()=>{const e={position:n,left:0,top:0};if(!A.floating)return e;const t=Bn(A.floating,u.x),r=Bn(A.floating,u.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...Ln(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,s,A.floating,u.x,u.y]);return p.useMemo((()=>({...u,update:C,refs:T,elements:A,floatingStyles:M})),[u,C,T,A,M])}(e),c=p.useContext(Zn),u=null!=((null==(d=p.useContext(Kn))?void 0:d.id)||null);var d;const f=function(e){const t=p.useRef((()=>{}));return In((()=>{t.current=e})),p.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}(((e,t,n)=>{e&&(m.current.openEvent=t),y.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==r||r(e,t,n)})),h=p.useRef(null),m=p.useRef({}),y=p.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],b=Vn(),g=p.useCallback((e=>{const t=Tt(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l.refs.setReference(t)}),[l.refs]),v=p.useCallback((e=>{(Tt(e)||null===e)&&(h.current=e,a(e)),(Tt(l.refs.reference.current)||null===l.refs.reference.current||null!==e&&!Tt(e))&&l.refs.setReference(e)}),[l.refs]),w=p.useMemo((()=>({...l.refs,setReference:v,setPositionReference:g,domReference:h})),[l.refs,v,g]),O=p.useMemo((()=>({...l.elements,domReference:s})),[l.elements,s]),k=p.useMemo((()=>({...l,refs:w,elements:O,dataRef:m,nodeId:o,floatingId:b,events:y,open:n,onOpenChange:f})),[l,o,b,y,n,f,w,O]);return qn((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===o));e&&(e.context=k)})),p.useMemo((()=>({...l,context:k,refs:w,elements:O})),[l,w,O,k])}var Un;function Jn(){return Jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jn.apply(this,arguments)}var Yn=function(e){return p.createElement("svg",Jn({viewBox:"0 0 10 10",style:{width:14,height:14,display:"block",flexShrink:0,transform:"rotate(90deg)"}},e),Un||(Un=p.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};const{BlockOptionsMenuGroup:Gn,BlockOptionsMenuItem:Qn,BlockOptions:er,BlockOptionsSeparator:tr}=r,nr=e=>{var{editor:t,blockId:r,element:o,onClose:i}=e,a=O(e,["editor","blockId","element","onClose"]);return d(er,Object.assign({},a,{onClose:i,actions:null},{children:u(Gn,{children:[d(Qn,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableColumn(t,r,{insertMode:"before"}),i()}},{children:[d(j,{className:"yoopta-table-icons"}),"Insert left"]}))}),d(Qn,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableColumn(t,r,{insertMode:"after"}),i()}},{children:[d(N,{className:"yoopta-table-icons"}),"Insert right"]}))}),d(tr,{}),d(Qn,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=t.blockEditorsMap[r],o=n.getElementEntry(t,r,{type:"table-data-cell",path:e.selection});if(o){const[,n]=o,i=nt.next(e,{at:n,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!i)return;const[,a]=i;vt.moveTableColumn(t,r,{from:n,to:a})}}},{children:[d(M,{className:"yoopta-table-icons"}),"Move right"]}))}),d(Qn,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=t.blockEditorsMap[r],o=n.getElementEntry(t,r,{type:"table-data-cell",path:e.selection});if(o){const[,n]=o,i=nt.previous(e,{at:n,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!i)return;const[,a]=i;vt.moveTableColumn(t,r,{from:n,to:a})}}},{children:[d(A,{className:"yoopta-table-icons"}),"Move left"]}))}),d(tr,{}),d(Qn,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{let e=n.getElementPath(t,r,o);e&&(vt.deleteTableColumn(t,r,{path:e}),i())}},{children:[d(B,{className:"yoopta-table-icons"}),"Delete"]}))})]})}))},rr=({editor:e,blockId:t,tdElement:r})=>{const[o,i]=v(!1),{refs:a,floatingStyles:s}=Xn({placement:"bottom-start",open:o,onOpenChange:i,middleware:[An(),Tn(),Rn(),hn(10)],whileElementsMounted:Cn});return u(f,{children:[d(nr,{refs:a,isOpen:o,onClose:()=>{i(!1)},style:s,editor:e,blockId:t,element:r}),d("button",Object.assign({type:"button",ref:a.setReference,onClick:()=>{if(e.readOnly)return;const o=e.blockEditorsMap[t],a=n.getElementPath(e,t,r);a&&(gt.select(o,{path:a.concat([0]),offset:0}),i(!0))},contentEditable:!1,style:o?{opacity:1}:void 0,className:"yoopta-table-column-button"},{children:d(Yn,{})}))]})},{BlockOptionsMenuGroup:or,BlockOptionsMenuItem:ir,BlockOptions:ar,BlockOptionsSeparator:sr}=r,lr=e=>{var{editor:t,blockId:r,onClose:o,tdElement:i}=e,a=O(e,["editor","blockId","onClose","tdElement"]);return d(ar,Object.assign({},a,{onClose:o,actions:null},{children:u(or,{children:[d(ir,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableRow(t,r,{insertMode:"before",select:!0}),o()}},{children:[d(R,{className:"yoopta-table-icons"}),"Insert above"]}))}),d(ir,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableRow(t,r,{insertMode:"after",select:!0}),o()}},{children:[d(C,{className:"yoopta-table-icons"}),"Insert below"]}))}),d(sr,{}),d(ir,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=n.getElementPath(t,r,i),a=n.getElement(t,r,{type:"table-row",path:e});if(!a)return;let s=n.getElementPath(t,r,a);const l=t.blockEditorsMap[r],c=nt.previous(l,{at:s,match:e=>Ze.isElement(e)&&"table-row"===e.type});if(!c)return o();vt.moveTableRow(t,r,{from:s,to:c[1]})}},{children:[d(z,{className:"yoopta-table-icons"}),"Move up"]}))}),d(ir,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=n.getElementPath(t,r,i),a=n.getElement(t,r,{type:"table-row",path:e});if(!a)return;let s=n.getElementPath(t,r,a);const l=t.blockEditorsMap[r],c=nt.next(l,{at:s,match:e=>Ze.isElement(e)&&"table-row"===e.type});if(!c)return o();vt.moveTableRow(t,r,{from:s,to:c[1]})}},{children:[d(T,{className:"yoopta-table-icons"}),"Move down"]}))}),d(sr,{}),d(ir,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=n.getElementPath(t,r,i),a=n.getElement(t,r,{type:"table-row",path:e});if(!a)return;let s=n.getElementPath(t,r,a);vt.deleteTableRow(t,r,{path:s}),o()}},{children:[d(B,{className:"yoopta-table-icons"}),"Delete row"]}))})]})}))},cr=({editor:e,blockId:t,tdElement:r})=>{const[o,i]=v(!1),{refs:a,floatingStyles:s}=Xn({placement:"right-start",open:o,onOpenChange:i,middleware:[An(),Tn(),Rn(),hn(10)],whileElementsMounted:Cn});return u(f,{children:[d(lr,{refs:a,isOpen:o,onClose:()=>{i(!1)},style:s,editor:e,blockId:t,tdElement:r}),d("button",Object.assign({ref:a.setReference,type:"button",onClick:()=>{if(e.readOnly)return;const o=e.blockEditorsMap[t],a=n.getElementPath(e,t,r);a&&(gt.select(o,{path:a.concat([0]),offset:0}),i(!0))},contentEditable:!1,className:"yoopta-table-row-button",style:o?{opacity:1}:void 0},{children:d(Yn,{className:"yoo-table-w-[14px] yoo-table-h-[14px] yoo-table-block yoo-table-flex-shrink-0",style:{transform:"rotate(0deg)"}})}))]})};const ur=new c({type:"Table",elements:{table:{render:({attributes:e,children:t,blockId:n,element:r,HTMLAttributes:a,extendRender:s})=>{const l=o(),c=l.blockEditorsMap[n],f=i(n),p=l.readOnly,h=Pt.get(c);if(s)return s({attributes:e,children:t,blockId:n,element:r,HTMLAttributes:a,isSelecting:h});const m=a||{},{className:y}=m,b=O(m,["className"]);return u("div",Object.assign({className:`yoopta-table-block ${y}`},{children:[d("table",Object.assign({},b,{className:"yoopta-table "+(h?" yoopta-table-selecting":"")},{children:d("tbody",Object.assign({},e,{children:t}))})),!p&&d(Et,{block:f,editor:l,table:r})]}))},asRoot:!0,children:["table-row"],props:{headerRow:!1,headerColumn:!1}},"table-row":{render:({attributes:e,children:t,element:n,blockId:r,HTMLAttributes:o,extendRender:i})=>{if(i)return i({attributes:e,children:t,blockId:r,element:n,HTMLAttributes:o});const a=o||{},{className:s}=a,l=O(a,["className"]);return d("tr",Object.assign({},l,{className:`yoopta-table-row ${s}`,"data-element-id":n.id},e,{children:t}))},children:["table-data-cell"]},"table-data-cell":{render:({attributes:e,children:t,element:r,blockId:i,HTMLAttributes:a,extendRender:s})=>{var l,c,f;const p=o(),h=p.blockEditorsMap[i],m=n.getElementPath(p,i,r),y=null===(l=Pt.get(h))||void 0===l?void 0:l.has(r),b=(null===(c=null==r?void 0:r.props)||void 0===c?void 0:c.asHeader)||!1,g=w((()=>{var e,t;const n=nt.above(h,{at:m,match:e=>Ze.isElement(e)&&"table"===e.type});if(!n)return null;const[r]=n,o=(null===(e=null==r?void 0:r.props)||void 0===e?void 0:e.headerRow)||!1;return{headerColumn:(null===(t=null==r?void 0:r.props)||void 0===t?void 0:t.headerColumn)||!1,headerRow:o}}),[b]),{headerRow:v,headerColumn:x}=g||{},k=(null==m?void 0:m[m.length-1])||0,E=(null===(f=null==r?void 0:r.props)||void 0===f?void 0:f.width)||200,_=0===(null==m?void 0:m[m.length-1]),P=0===(null==m?void 0:m[m.length-2]);let j=!1;P&&v&&(j=!0),_&&x&&(j=!0);const N=e=>{vt.updateColumnWidth(p,i,k,e)},S=j?"th":"td",C={maxWidth:E,minWidth:E},R=a||{},{className:T}=R,A=O(R,["className"]),M=j?`yoopta-table-data-cell yoopta-table-data-cell-head ${T}`:`yoopta-table-data-cell ${T}`;return s?s({attributes:e,children:t,blockId:i,element:r,HTMLAttributes:a,isDataCellAsHeader:j,onResize:N,width:E,height:E,selected:y}):u(S,Object.assign({scope:j?"col":void 0,"data-cell-selected":y,style:C,colSpan:1,rowSpan:1},A,{className:M},{children:[d("div",Object.assign({className:"yoopta-table-data-cell-content"},e,{children:t})),!p.readOnly&&P&&d(jt,{onResize:N,tdWidth:E,columnIndex:k}),!p.readOnly&&P&&d(rr,{editor:p,blockId:i,tdElement:r}),!p.readOnly&&_&&d(cr,{editor:p,blockId:i,tdElement:r})]}))},props:{asHeader:!1,width:200}}},events:{onKeyDown:function(e,t,{hotkeys:n,currentBlock:r}){return o=>{if(t.selection){if(n.isBackspace(o)){const e=Te.parent(t.selection.anchor.path),n=nt.isStart(t,t.selection.anchor,e),r=_t.get(t);if(r)return o.preventDefault(),void nt.withoutNormalizing(t,(()=>{for(const[,e]of r)for(const[n,r]of Ye.children(t,e))if(pt.isText(n)){const e=Ye.string(n).length;e>0&>.delete(t,{at:{anchor:{path:r,offset:0},focus:{path:r,offset:e}}})}gt.select(t,{path:r[0][1].concat(0),offset:0})}));if(n&&Ve.isCollapsed(t.selection))return void o.preventDefault()}if(n.isCmdShiftEnter(o))return o.preventDefault(),void vt.insertTableRow(e,r.id,{select:!0,insertMode:"before"});if(n.isShiftEnter(o))return o.preventDefault(),void vt.insertTableRow(e,r.id,{select:!0,insertMode:"after"});if(n.isCmdShiftRight(o))return o.preventDefault(),void vt.insertTableColumn(e,r.id,{select:!0,insertMode:"after"});if(n.isCmdShiftLeft(o))return o.preventDefault(),void vt.insertTableColumn(e,r.id,{select:!0,insertMode:"before"});if(n.isCmdShiftDelete(o))return o.preventDefault(),void vt.deleteTableRow(e,r.id);if(n.isCmdAltDelete(o))return o.preventDefault(),void vt.deleteTableColumn(e,r.id);if(n.isArrowUp(o)){o.preventDefault();const e=nt.above(t,{at:t.selection.anchor,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!e)return;const[n,r]=e;try{const e=r[r.length-1],n=Te.previous(r.slice(0,-1)).concat(e);nt.node(t,n),gt.select(t,n)}catch(e){}}else if(n.isArrowDown(o)){o.preventDefault();const e=nt.above(t,{at:t.selection.anchor,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!e)return;const[n,r]=e;try{const e=r[r.length-1],n=Te.next(r.slice(0,-1)).concat(e);nt.node(t,n),gt.select(t,n)}catch(e){}}else{if(n.isEnter(o)&&(o.preventDefault(),gt.insertText(t,"\n")),n.isSelect(o)){const n=nt.above(t,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(n){o.preventDefault();const[i,a]=n,s=nt.string(t,a);if(Ve.isExpanded(t.selection)||0===s.length)return e.blur(),void e.setPath({current:null,selected:[r.meta.order]});gt.select(t,a)}}(o.metaKey||o.ctrlKey)&&o.shiftKey&&"h"===o.key&&(o.preventDefault(),vt.toggleHeaderRow(e,r.id)),(o.metaKey||o.ctrlKey)&&o.shiftKey&&"v"===o.key&&(o.preventDefault(),vt.toggleHeaderColumn(e,r.id))}}}},onBlur:(e,t)=>()=>{Pt.delete(t)},onBeforeCreate:e=>vt.buildTableElements(e,{rows:3,columns:3})},parsers:{html:{deserialize:{nodeNames:["TABLE"],parse:function(t,n){const r=t.querySelector("tbody"),o=t.querySelector("thead"),i={id:e(),type:"table",children:[],props:{headerRow:"true"===t.getAttribute("data-header-row"),headerColumn:"true"===t.getAttribute("data-header-column")}};if(!r&&!o)return;const s=null==o?void 0:o.querySelector("tr");if(s&&(i.props.headerRow=!0),s){const t={id:e(),type:"table-row",children:[]};Array.from(s.childNodes).forEach((r=>{if("TH"===r.nodeName){const o={id:e(),type:"table-data-cell",children:[{text:""}],props:{asHeader:!0,width:200}};r instanceof HTMLElement&&(null==r?void 0:r.hasAttribute("data-width"))&&(o.props.width=parseInt(r.getAttribute("data-width")||"200",10));let i=a(n,r.childNodes);o.children=i,t.children.push(o)}})),i.children.push(t)}return null==r||r.childNodes.forEach((t=>{const r=Array.from(t.childNodes).filter((e=>"TD"===e.nodeName||"TH"===e.nodeName));if(r.length>0){const t={id:e(),type:"table-row",children:[]};r.forEach((r=>{const o={id:e(),type:"table-data-cell",children:[{text:""}],props:{asHeader:!1,width:200}};if("TH"===r.nodeName&&(o.props.asHeader=!0),"TD"===r.nodeName&&(o.props.asHeader=!1),"TD"===r.nodeName||"TH"===r.nodeName){r instanceof HTMLElement&&(null==r?void 0:r.hasAttribute("data-width"))&&(o.props.width=parseInt(r.getAttribute("data-width")||"200",10));let e=a(n,r.childNodes);o.children=e,t.children.push(o)}})),i.children.push(t)}})),i}},serialize:function(e,t,n){var r,o;const i=e.children[0].children,{align:a="left",depth:l=0}=n||{};return`<table style="margin-left: ${l}px; text-align: ${a}" data-meta-align="${a}" data-meta-depth="${l}" data-header-row="${null===(r=e.props)||void 0===r?void 0:r.headerRow}" data-header-column="${null===(o=e.props)||void 0===o?void 0:o.headerColumn}">\n <colgroup>\n ${i.map((e=>{var t,n;return`<col style="width: ${(null===(t=e.props)||void 0===t?void 0:t.width)?`${null===(n=e.props)||void 0===n?void 0:n.width}px`:"auto"}" />`})).join("")}\n </colgroup>\n <tbody>${e.children.map((e=>`<tr>${e.children.map((e=>{var t,n,r;const o=s(e.children);return(null===(t=e.props)||void 0===t?void 0:t.asHeader)?`<th data-width="${(null===(n=e.props)||void 0===n?void 0:n.width)||200}" rowspan="1" colspan="1">${o}</th>`:`<td data-width="${(null===(r=e.props)||void 0===r?void 0:r.width)||200}" rowspan="1" colspan="1">${o}</td>`})).join("")}</tr>`)).join("")}</tbody></table>`}},markdown:{serialize:function(e,t){let n="";return e.children.forEach(((e,t)=>{const r=e.children.map((e=>` ${l(e.children)} `)).join("|");if(n+=`|${r}|\n`,0===t){const t=e.children.map((()=>" --- ")).join("|");n+=`|${t}|\n`}})),n}}},extensions:function(t,n){return t=function(e){const{deleteBackward:t}=e;return e.deleteBackward=n=>{const{selection:r}=e;if(!r||Ve.isExpanded(r))return t(n);const[o]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:r}),i=nt.before(e,r,{unit:n}),[a]=i?nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:i}):[void 0];if(!o&&!a)return t(n);if(!o&&a&&i)return gt.select(e,i);const[,s]=o,l=nt.start(e,s);it.equals(r.anchor,l)||t(n)},e}(t=function(t,n){const{normalizeNode:r}=t;return t.normalizeNode=(n,o)=>{const[i,a]=n;if(Ze.isElement(i)&&"table-data-cell"===i.type)for(const[e,n]of Ye.children(t,a)){if(Ze.isElement(e)&&"table"===e.type)return void gt.unwrapNodes(t,{at:n});if(Ze.isElement(e)&&"table-row"===e.type)return void gt.unwrapNodes(t,{at:n});if(Ze.isElement(e)&&"table-data-cell"===e.type)return void gt.unwrapNodes(t,{at:n})}if(Ze.isElement(i)&&"table-row"===i.type)for(const[n,r]of Ye.children(t,a))if(!Ze.isElement(n)||"table-data-cell"!==n.type)return gt.wrapNodes(t,{id:e(),type:"table-data-cell",children:[n]},{at:r});r(n,o)},t}(t=function(e){const{apply:t}=e;return e.apply=n=>{if(!et.isSelectionOperation(n)||!n.newProperties)return Pt.delete(e),_t.delete(e),t(n);const r=Object.assign(Object.assign({},e.selection),n.newProperties);if(!Ve.isRange(r))return Pt.delete(e),_t.delete(e),t(n);const[o]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:Ve.start(r)}),[i]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:Ve.end(r)});if(!o||!i)return Pt.delete(e),_t.delete(e),t(n);const[,a]=o,[,s]=i;if(Te.equals(a,s))return Pt.delete(e),_t.delete(e),t(n);const l=new WeakSet,c=nt.range(e,a,s),u=Array.from(nt.nodes(e,{at:c,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})),d=[];for(const[e,t]of u)Ze.isElement(e)&&"table-data-cell"===e.type&&(l.add(e),d.push([e,t]));_t.set(e,d),Pt.set(e,l),t(n)},e}(t)))},options:{display:{title:"Table",description:"Add simple table"},shortcuts:["table","||","3x3"]},commands:vt});export{vt as TableCommands,ur as default};
|
|
33
|
+
function H(e){return"[object Object]"===Object.prototype.toString.call(e)}function I(e){var t,n;return!1!==H(e)&&(void 0===(t=e.constructor)||!1!==H(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var q=Symbol.for("immer-nothing"),F=Symbol.for("immer-draftable"),W=Symbol.for("immer-state");function $(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var V=Object.getPrototypeOf;function K(e){return!!e&&!!e[W]}function Z(e){return!!e&&(U(e)||Array.isArray(e)||!!e[F]||!!e.constructor?.[F]||ee(e)||te(e))}var X=Object.prototype.constructor.toString();function U(e){if(!e||"object"!=typeof e)return!1;const t=V(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===X}function J(e,t){0===Y(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Y(e){const t=e[W];return t?t.type_:Array.isArray(e)?1:ee(e)?2:te(e)?3:0}function G(e,t){return 2===Y(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Q(e,t,n){const r=Y(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ee(e){return e instanceof Map}function te(e){return e instanceof Set}function ne(e){return e.copy_||e.base_}function re(e,t){if(ee(e))return new Map(e);if(te(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&U(e)){if(!V(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[W];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],i=n[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(V(e),n)}function oe(e,t=!1){return ae(e)||K(e)||!Z(e)||(Y(e)>1&&(e.set=e.add=e.clear=e.delete=ie),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>oe(t,!0)))),e}function ie(){$(2)}function ae(e){return Object.isFrozen(e)}var se,le={};function ce(e){const t=le[e];return t||$(0),t}function ue(){return se}function de(e,t){t&&(ce("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fe(e){pe(e),e.drafts_.forEach(me),e.drafts_=null}function pe(e){e===se&&(se=e.parent_)}function he(e){return se={drafts_:[],parent_:se,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function me(e){const t=e[W];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ye(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[W].modified_&&(fe(t),$(4)),Z(e)&&(e=be(t,e),t.parent_||ve(t,e)),t.patches_&&ce("Patches").generateReplacementPatches_(n[W].base_,e,t.patches_,t.inversePatches_)):e=be(t,n,[]),fe(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==q?e:void 0}function be(e,t,n){if(ae(t))return t;const r=t[W];if(!r)return J(t,((o,i)=>ge(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return ve(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,i=!1;3===r.type_&&(o=new Set(t),t.clear(),i=!0),J(o,((o,a)=>ge(e,r,t,o,a,n,i))),ve(e,t,!1),n&&e.patches_&&ce("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function ge(e,t,n,r,o,i,a){if(K(o)){const a=be(e,o,i&&t&&3!==t.type_&&!G(t.assigned_,r)?i.concat(r):void 0);if(Q(n,r,a),!K(a))return;e.canAutoFreeze_=!1}else a&&n.add(o);if(Z(o)&&!ae(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;be(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||ve(e,o)}}function ve(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&oe(t,n)}var we={get(e,t){if(t===W)return e;const n=ne(e);if(!G(n,t))return function(e,t,n){const r=Oe(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Z(r)?r:r===ke(e.base_,t)?(_e(e),e.copy_[t]=Pe(r,e)):r},has:(e,t)=>t in ne(e),ownKeys:e=>Reflect.ownKeys(ne(e)),set(e,t,n){const r=Oe(ne(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ke(ne(e),t),a=r?.[W];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||G(e.base_,t)))return!0;_e(e),Ee(e)}var o,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==ke(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,_e(e),Ee(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ne(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){$(11)},getPrototypeOf:e=>V(e.base_),setPrototypeOf(){$(12)}},xe={};function ke(e,t){const n=e[W];return(n?ne(n):e)[t]}function Oe(e,t){if(!(t in e))return;let n=V(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=V(n)}}function Ee(e){e.modified_||(e.modified_=!0,e.parent_&&Ee(e.parent_))}function _e(e){e.copy_||(e.copy_=re(e.base_,e.scope_.immer_.useStrictShallowCopy_))}J(we,((e,t)=>{xe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),xe.deleteProperty=function(e,t){return xe.set.call(this,e,t,void 0)},xe.set=function(e,t,n){return we.set.call(this,e[0],t,n,e[0])};function Pe(e,t){const n=ee(e)?ce("MapSet").proxyMap_(e,t):te(e)?ce("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ue(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=we;n&&(o=[r],i=xe);const{revoke:a,proxy:s}=Proxy.revocable(o,i);return r.draft_=s,r.revoke_=a,s}(e,t);return(t?t.scope_:ue()).drafts_.push(n),n}function je(e){if(!Z(e)||ae(e))return e;const t=e[W];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=re(e,t.scope_.immer_.useStrictShallowCopy_)}else n=re(e,!0);return J(n,((e,t)=>{Q(n,e,je(t))})),t&&(t.finalized_=!1),n}var Ne=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&$(6),void 0!==n&&"function"!=typeof n&&$(7),Z(e)){const o=he(this),i=Pe(e,void 0);let a=!0;try{r=t(i),a=!1}finally{a?fe(o):pe(o)}return de(o,n),ye(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===q&&(r=void 0),this.autoFreeze_&&oe(r,!0),n){const t=[],o=[];ce("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}$(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Z(e)||$(8),K(e)&&(e=function(e){K(e)||$(10);return je(e)}(e));const t=he(this),n=Pe(e,void 0);return n[W].isManual_=!0,pe(t),n}finishDraft(e,t){const n=e&&e[W];n&&n.isManual_||$(9);const{scope_:r}=n;return de(r,t),ye(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=ce("Patches").applyPatches_;return K(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},Se=Ne.produce;Ne.produceWithPatches.bind(Ne),Ne.setAutoFreeze.bind(Ne),Ne.setUseStrictShallowCopy.bind(Ne),Ne.applyPatches.bind(Ne);var Ce=Ne.createDraft.bind(Ne),Re=Ne.finishDraft.bind(Ne),Te={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=Te.levels(e,t);return r=n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return Te.equals(r,o)&&i>a},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return Te.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return Te.equals(r,o)&&i<a},equals:(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===Te.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===Te.compare(e,t),isBefore:(e,t)=>-1===Te.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===Te.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===Te.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===Te.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===Te.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&Te.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!Te.isAncestor(t,e)&&!Te.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:i}=t;(Te.equals(i,r)||Te.endsBefore(i,r)||Te.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(Te.equals(a,r)||Te.isAncestor(a,r))return null;Te.endsBefore(a,r)&&(r[a.length-1]-=1);break;case"merge_node":var{path:s,position:l}=t;Te.equals(s,r)||Te.endsBefore(s,r)?r[s.length-1]-=1:Te.isAncestor(s,r)&&(r[s.length-1]-=1,r[s.length]+=l);break;case"split_node":var{path:c,position:u}=t;if(Te.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else Te.endsBefore(c,r)?r[c.length-1]+=1:Te.isAncestor(c,r)&&e[c.length]>=u&&(r[c.length-1]+=1,r[c.length]-=u);break;case"move_node":var{path:d,newPath:f}=t;if(Te.equals(d,f))return r;if(Te.isAncestor(d,r)||Te.equals(d,r)){var p=f.slice();return Te.endsBefore(d,f)&&d.length<f.length&&(p[d.length-1]-=1),p.concat(r.slice(d.length))}Te.isSibling(d,f)&&(Te.isAncestor(f,r)||Te.equals(f,r))?Te.endsBefore(d,r)?r[d.length-1]-=1:r[d.length-1]+=1:Te.endsBefore(f,r)||Te.equals(f,r)||Te.isAncestor(f,r)?(Te.endsBefore(d,r)&&(r[d.length-1]-=1),r[f.length-1]+=1):Te.endsBefore(d,r)&&(Te.equals(f,r)&&(r[f.length-1]+=1),r[d.length-1]-=1)}return r}};function Ae(e){return Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ae(e)}function Me(e){var t=function(e,t){if("object"!==Ae(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ae(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ae(t)?t:String(t)}function ze(e,t,n){return(t=Me(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function De(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 Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Be={transform(e,t){e.children=Ce(e.children);var n=e.selection&&Ce(e.selection);try{n=((e,t,n)=>{switch(n.type){case"insert_node":var{path:r,node:o}=n,i=Ye.parent(e,r),a=r[r.length-1];if(a>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(a,0,o),t)for(var[s,l]of Ve.points(t))t[l]=it.transform(s,n);break;case"insert_text":var{path:c,offset:u,text:d}=n;if(0===d.length)break;var f=Ye.leaf(e,c),p=f.text.slice(0,u),h=f.text.slice(u);if(f.text=p+d+h,t)for(var[m,y]of Ve.points(t))t[y]=it.transform(m,n);break;case"merge_node":var{path:b}=n,g=Ye.get(e,b),v=Te.previous(b),w=Ye.get(e,v),x=Ye.parent(e,b),k=b[b.length-1];if(pt.isText(g)&&pt.isText(w))w.text+=g.text;else{if(pt.isText(g)||pt.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(b,"] to nodes of different interfaces: ").concat(st.stringify(g)," ").concat(st.stringify(w)));w.children.push(...g.children)}if(x.children.splice(k,1),t)for(var[O,E]of Ve.points(t))t[E]=it.transform(O,n);break;case"move_node":var{path:_,newPath:P}=n;if(Te.isAncestor(_,P))throw new Error("Cannot move a path [".concat(_,"] to new path [").concat(P,"] because the destination is inside itself."));var j=Ye.get(e,_),N=Ye.parent(e,_),S=_[_.length-1];N.children.splice(S,1);var C=Te.transform(_,n),R=Ye.get(e,Te.parent(C)),T=C[C.length-1];if(R.children.splice(T,0,j),t)for(var[A,M]of Ve.points(t))t[M]=it.transform(A,n);break;case"remove_node":var{path:z}=n,D=z[z.length-1];if(Ye.parent(e,z).children.splice(D,1),t)for(var[L,B]of Ve.points(t)){var H=it.transform(L,n);if(null!=t&&null!=H)t[B]=H;else{var I=void 0,q=void 0;for(var[F,W]of Ye.texts(e)){if(-1!==Te.compare(W,z)){q=[F,W];break}I=[F,W]}var $=!1;I&&q&&($=Te.equals(q[1],z)?!Te.hasPrevious(q[1]):Te.common(I[1],z).length<Te.common(q[1],z).length),I&&!$?(L.path=I[1],L.offset=I[0].text.length):q?(L.path=q[1],L.offset=0):t=null}}break;case"remove_text":var{path:V,offset:K,text:Z}=n;if(0===Z.length)break;var X=Ye.leaf(e,V),U=X.text.slice(0,K),J=X.text.slice(K+Z.length);if(X.text=U+J,t)for(var[Y,G]of Ve.points(t))t[G]=it.transform(Y,n);break;case"set_node":var{path:Q,properties:ee,newProperties:te}=n;if(0===Q.length)throw new Error("Cannot set properties on the root node!");var ne=Ye.get(e,Q);for(var re in te){if("children"===re||"text"===re)throw new Error('Cannot set the "'.concat(re,'" property of nodes!'));var oe=te[re];null==oe?delete ne[re]:ne[re]=oe}for(var ie in ee)te.hasOwnProperty(ie)||delete ne[ie];break;case"set_selection":var{newProperties:ae}=n;if(null==ae)t=ae;else{if(null==t){if(!Ve.isRange(ae))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(st.stringify(ae)," when there is no current selection."));t=Le({},ae)}for(var se in ae){var le=ae[se];if(null==le){if("anchor"===se||"focus"===se)throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=le}}break;case"split_node":var{path:ce,position:ue,properties:de}=n;if(0===ce.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ce,"] because the root node cannot be split."));var fe,pe=Ye.get(e,ce),he=Ye.parent(e,ce),me=ce[ce.length-1];if(pt.isText(pe)){var ye=pe.text.slice(0,ue),be=pe.text.slice(ue);pe.text=ye,fe=Le(Le({},de),{},{text:be})}else{var ge=pe.children.slice(0,ue),ve=pe.children.slice(ue);pe.children=ge,fe=Le(Le({},de),{},{children:ve})}if(he.children.splice(me+1,0,fe),t)for(var[we,xe]of Ve.points(t))t[xe]=it.transform(we,n)}return t})(e,n,t)}finally{e.children=Re(e.children),e.selection=n?K(n)?Re(n):n:null}}},He={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},Ie={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},qe=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(I(r)&&I(o)){if(!qe(r,o))return!1}else if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==o[i])return!1}else if(r!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0};function Fe(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var We=["anchor","focus"];function $e(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}var Ve={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return Ve.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=Ve.edges(e);return t},equals:(e,t)=>it.equals(e.anchor,t.anchor)&&it.equals(e.focus,t.focus),includes(e,t){if(Ve.isRange(t)){if(Ve.includes(e,t.anchor)||Ve.includes(e,t.focus))return!0;var[n,r]=Ve.edges(e),[o,i]=Ve.edges(t);return it.isBefore(n,o)&&it.isAfter(r,i)}var[a,s]=Ve.edges(e),l=!1,c=!1;return it.isPoint(t)?(l=it.compare(t,a)>=0,c=it.compare(t,s)<=0):(l=Te.compare(t,a.path)>=0,c=Te.compare(t,s.path)<=0),l&&c},intersection(e,t){var n=Fe(e,We),[r,o]=Ve.edges(e),[i,a]=Ve.edges(t),s=it.isBefore(r,i)?i:r,l=it.isBefore(o,a)?o:a;return it.isBefore(l,s)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$e(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({anchor:s,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return it.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return it.equals(t,n)},isExpanded:e=>!Ve.isCollapsed(e),isForward:e=>!Ve.isBackward(e),isRange:e=>I(e)&&it.isPoint(e.anchor)&&it.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Ve.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Se(e,(e=>{if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var a=Ve.isCollapsed(e);Ve.isForward(e)?(r="forward",o=a?r:"backward"):(r="backward",o=a?r:"forward")}else"outward"===i?Ve.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var s=it.transform(e.anchor,t,{affinity:r}),l=it.transform(e.focus,t,{affinity:o});if(!s||!l)return null;e.anchor=s,e.focus=l}))}},Ke=e=>I(e)&&Ye.isNodeList(e.children)&&!nt.isEditor(e),Ze={isAncestor:e=>I(e)&&Ye.isNodeList(e.children),isElement:Ke,isElementList:e=>Array.isArray(e)&&e.every((e=>Ze.isElement(e))),isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return Ke(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},Xe=["children"],Ue=["text"],Je=new WeakMap,Ye={ancestor(e,t){var n=Ye.get(e,t);if(pt.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(st.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of Te.ancestors(t,n)){var o=[Ye.ancestor(e,r),r];yield o}}()},child(e,t){if(pt.isText(e))throw new Error("Cannot get the child of a text node: ".concat(st.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(st.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=Ye.ancestor(e,t),{children:i}=o,a=r?i.length-1:0;r?a>=0:a<i.length;){var s=Ye.child(o,a),l=t.concat(a);yield[s,l],a=r?a-1:a+1}}()},common(e,t,n){var r=Te.common(t,n);return[Ye.get(e,r),r]},descendant(e,t){var n=Ye.get(e,t);if(nt.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(st.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))Ze.isElement(n)&&(yield[n,r])}()},extractProps:e=>Ze.isAncestor(e)?Fe(e,Xe):Fe(e,Ue),first(e,t){for(var n=t.slice(),r=Ye.get(e,n);r&&!pt.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(pt.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(st.stringify(e)));var n=Se({children:e.children},(e=>{var[n,r]=Ve.edges(t),o=Ye.nodes(e,{reverse:!0,pass:e=>{var[,n]=e;return!Ve.includes(t,n)}});for(var[,i]of o){if(!Ve.includes(t,i)){var a=Ye.parent(e,i),s=i[i.length-1];a.children.splice(s,1)}if(Te.equals(i,r.path)){var l=Ye.leaf(e,i);l.text=l.text.slice(0,r.offset)}if(Te.equals(i,n.path)){var c=Ye.leaf(e,i);c.text=c.text.slice(n.offset)}}nt.isEditor(e)&&(e.selection=null)}));return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(pt.isText(n)||!n.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(st.stringify(e)));n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(pt.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode:e=>pt.isText(e)||Ze.isElement(e)||nt.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=Je.get(e);if(void 0!==t)return t;var n=e.every((e=>Ye.isNode(e)));return Je.set(e,n),n},last(e,t){for(var n=t.slice(),r=Ye.get(e,n);r&&!pt.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=Ye.get(e,t);if(!pt.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(st.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of Te.levels(t,n)){var o=Ye.get(e,r);yield[o,r]}}()},matches:(e,t)=>Ze.isElement(e)&&Ze.isElementProps(t)&&Ze.matches(e,t)||pt.isText(e)&&pt.isTextProps(t)&&pt.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:i}=t,a=new Set,s=[],l=e;!i||!(r?Te.isBefore(s,i):Te.isAfter(s,i));)if(a.has(l)||(yield[l,s]),a.has(l)||pt.isText(l)||0===l.children.length||null!=n&&!1!==n([l,s])){if(0===s.length)break;if(!r){var c=Te.next(s);if(Ye.has(e,c)){s=c,l=Ye.get(e,s);continue}}if(r&&0!==s[s.length-1])s=Te.previous(s),l=Ye.get(e,s);else s=Te.parent(s),l=Ye.get(e,s),a.add(l)}else{a.add(l);var u=r?l.children.length-1:0;Te.isAncestor(s,o)&&(u=o[s.length]),s=s.concat(u),l=Ye.get(e,s)}}()},parent(e,t){var n=Te.parent(t),r=Ye.get(e,n);if(pt.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>pt.isText(e)?e.text:e.children.map(Ye.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))pt.isText(n)&&(yield[n,r])}()}};function Ge(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 Qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var et={isNodeOperation:e=>et.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!I(e))return!1;switch(e.type){case"insert_node":case"remove_node":return Te.isPath(e.path)&&Ye.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&Te.isPath(e.path);case"merge_node":return"number"==typeof e.position&&Te.isPath(e.path)&&I(e.properties);case"move_node":return Te.isPath(e.path)&&Te.isPath(e.newPath);case"set_node":return Te.isPath(e.path)&&I(e.properties)&&I(e.newProperties);case"set_selection":return null===e.properties&&Ve.isRange(e.newProperties)||null===e.newProperties&&Ve.isRange(e.properties)||I(e.properties)&&I(e.newProperties);case"split_node":return Te.isPath(e.path)&&"number"==typeof e.position&&I(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>et.isOperation(e))),isSelectionOperation:e=>et.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>et.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return Qe(Qe({},e),{},{type:"remove_node"});case"insert_text":return Qe(Qe({},e),{},{type:"remove_text"});case"merge_node":return Qe(Qe({},e),{},{type:"split_node",path:Te.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(Te.equals(t,n))return e;if(Te.isSibling(n,t))return Qe(Qe({},e),{},{path:t,newPath:n});var r=Te.transform(n,e),o=Te.transform(Te.next(n),e);return Qe(Qe({},e),{},{path:r,newPath:o});case"remove_node":return Qe(Qe({},e),{},{type:"insert_node"});case"remove_text":return Qe(Qe({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return Qe(Qe({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:s,newProperties:l}=e;return Qe(Qe({},e),{},null==s?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:s}:{properties:l,newProperties:s});case"split_node":return Qe(Qe({},e),{},{type:"merge_node",path:Te.next(e.path)})}}},tt=new WeakMap,nt={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,n)=>e.isEdge(t,n),isEditor:e=>(e=>{var t=tt.get(e);if(void 0!==t)return t;if(!I(e))return!1;var n="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||I(e.marks))&&(null===e.selection||Ve.isRange(e.selection))&&Ye.isNodeList(e.children)&&et.isOperationList(e.operations);return tt.set(e,n),n})(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)}};function rt(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 ot(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rt(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var it={compare(e,t){var n=Te.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===it.compare(e,t),isBefore:(e,t)=>-1===it.compare(e,t),equals:(e,t)=>e.offset===t.offset&&Te.equals(e.path,t.path),isPoint:e=>I(e)&&"number"==typeof e.offset&&Te.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Se(e,(e=>{if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=Te.transform(o,t,n);break;case"insert_text":Te.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(e.offset+=t.text.length);break;case"merge_node":Te.equals(t.path,o)&&(e.offset+=t.position),e.path=Te.transform(o,t,n);break;case"remove_text":Te.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(Te.equals(t.path,o)||Te.isAncestor(t.path,o))return null;e.path=Te.transform(o,t,n);break;case"split_node":if(Te.equals(t.path,o)){if(t.position===i&&null==r)return null;(t.position<i||t.position===i&&"forward"===r)&&(e.offset-=t.position,e.path=Te.transform(o,t,ot(ot({},n),{},{affinity:"forward"})))}else e.path=Te.transform(o,t,n)}}))}},at=void 0,st={setScrubber(e){at=e},stringify:e=>JSON.stringify(e,at)},lt=["text"],ct=["anchor","focus"];function ut(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 dt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ft,pt={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return Fe(e,lt)}return qe(r?o(e):e,r?o(t):t)},isText:e=>I(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>pt.isText(e))),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[dt({},e)];for(var r of t){var o=Fe(r,ct),[i,a]=Ve.edges(r),s=[],l=0,c=i.offset,u=a.offset;for(var d of n){var{length:f}=d.text,p=l;if(l+=f,c<=p&&l<=u)Object.assign(d,o),s.push(d);else if(c!==u&&(c===l||u===p)||c>l||u<p||u===p&&0!==p)s.push(d);else{var h=d,m=void 0,y=void 0;if(u<l){var b=u-p;y=dt(dt({},h),{},{text:h.text.slice(b)}),h=dt(dt({},h),{},{text:h.text.slice(0,b)})}if(c>p){var g=c-p;m=dt(dt({},h),{},{text:h.text.slice(0,g)}),h=dt(dt({},h),{},{text:h.text.slice(g)})}Object.assign(h,o),m&&s.push(m),s.push(h),y&&s.push(y)}}n=s}return n}},ht=e=>e.selection?e.selection:e.children.length>0?nt.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(ft||(ft={})),ft.L,ft.L,ft.V,ft.LV,ft.LVT,ft.LV,ft.V,ft.V,ft.T,ft.LVT,ft.T,ft.T,ft.Any,ft.Extend,ft.ZWJ,ft.Any,ft.SpacingMark,ft.Prepend,ft.Any,ft.ZWJ,ft.ExtPict,ft.RI,ft.RI;var mt={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};nt.withoutNormalizing(e,(()=>{var{voids:r=!1}=n,{at:o=ht(e)}=n;if(Te.isPath(o)&&(o=nt.range(e,o)),Ve.isRange(o))if(Ve.isCollapsed(o))o=o.anchor;else{var i=Ve.end(o);if(!r&&nt.void(e,{at:i}))return;var a=Ve.start(o),s=nt.pointRef(e,a),l=nt.pointRef(e,i);gt.delete(e,{at:o,voids:r});var c=s.unref(),u=l.unref();o=c||u,gt.setSelection(e,{anchor:o,focus:o})}if(!(!r&&nt.void(e,{at:o})||nt.elementReadOnly(e,{at:o}))){var{path:d,offset:f}=o;t.length>0&&e.apply({type:"insert_text",path:d,offset:f,text:t})}}))}};function yt(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 bt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var gt=bt(bt(bt(bt({},Be),He),Ie),mt);const vt={buildTableElements:(t,n)=>{const{rows:r=3,columns:o=3,columnWidth:i=200,headerColumn:a=!1,headerRow:s=!1}=n||{},l={id:e(),type:"table",children:[],props:{headerColumn:a,headerRow:s}};for(let t=0;t<r;t++){const n={id:e(),type:"table-row",children:[]};for(let r=0;r<o;r++){const r={id:e(),type:"table-data-cell",children:[{text:""}],props:{width:i||200,asHeader:0===t&&!!s}};n.children.push(r)}l.children.push(n)}return l},insertTable:(e,n)=>{const r=vt.buildTableElements(e,n),o=t.buildBlockData({value:[r],type:"Table"});t.insertBlock(e,o.type,Object.assign(Object.assign({},n),{blockData:o}))},deleteTable:(e,t)=>{e.deleteBlock({blockId:t})},insertTableRow:(r,o,i)=>{const a=t.getBlockSlate(r,{id:o});a&&nt.withoutNormalizing(a,(()=>{const{insertMode:t="after",path:s=a.selection,select:l=!0}=i||{},c=n.getElementEntry(r,o,{path:s,type:"table-row"});if(!c)return;const[u,d]=c,f="before"===t?d:Te.next(d),p={id:e(),type:"table-row",children:u.children.map((t=>({id:e(),type:"table-data-cell",children:[{text:""}]}))),props:{nodeType:"block"}};gt.insertNodes(a,p,{at:f}),l&>.select(a,[...f,0])}))},deleteTableRow:(e,r,o)=>{const i=t.getBlockSlate(e,{id:r});i&&nt.withoutNormalizing(i,(()=>{const{path:t=i.selection}=o||{},a=n.getElementEntry(e,r,{path:t,type:"table-row"});if(!a)return;const[s,l]=a,c=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"highest"});1!==Array.from(c).length&>.removeNodes(i,{at:l,match:e=>Ze.isElement(e)&&"table-row"===e.type})}))},moveTableRow:(e,n,{from:r,to:o})=>{const i=t.getBlockSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{gt.moveNodes(i,{at:r,to:o,match:e=>Ze.isElement(e)&&"table-row"===e.type})}))},moveTableColumn:(e,n,{from:r,to:o})=>{const i=t.getBlockSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const e=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"});Array.from(e).forEach((([e,t])=>{gt.moveNodes(i,{at:t.concat(r[r.length-1]),to:[...t,o[o.length-1]],match:e=>Ze.isElement(e)})}))}))},insertTableColumn:(r,o,i)=>{const a=t.getBlockSlate(r,{id:o});a&&nt.withoutNormalizing(a,(()=>{const{insertMode:t="after",path:s=a.selection,select:l=!0}=i||{},c=n.getElementEntry(r,o,{path:s,type:"table-data-cell"});if(!c)return;const[u,d]=c,f=d[d.length-1],p="before"===t?f:Te.next(d)[d.length-1],h=nt.nodes(a,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"lowest"});for(const[,t]of h){const n={id:e(),type:"table-data-cell",children:[{text:""}]};gt.insertNodes(a,n,{at:[...t,p]})}l&>.select(a,[0,0,p,0])}))},deleteTableColumn:(e,r,o)=>{const i=t.getBlockSlate(e,{id:r});i&&nt.withoutNormalizing(i,(()=>{const{path:t=i.selection}=o||{},a=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"}),s=Array.from(a);if(s[0][0].children.length<=1)return;const l=n.getElementEntry(e,r,{path:t,type:"table-data-cell"});if(!l)return;const[c,u]=l,d=u[u.length-1],f=s.map((([e,t])=>e.children[d]?[...t,d]:null));f.forEach((e=>{e&>.removeNodes(i,{at:e})}))}))},updateColumnWidth:(e,n,r,o)=>{const i=t.getBlockSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const e=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,mode:"all"});Array.from(e).forEach((([e,t])=>{t[t.length-1]===r&>.setNodes(i,{props:Object.assign(Object.assign({},e.props),{width:o})},{at:t,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})}))}))},toggleHeaderRow:(e,r)=>{const o=t.getBlockSlate(e,{id:r});o&&nt.withoutNormalizing(o,(()=>{var t;const i=n.getElement(e,r,{type:"table",path:[0]}),a=(null===(t=null==i?void 0:i.props)||void 0===t?void 0:t.headerRow)||!1,s=nt.nodes(o,{at:[0,0],match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,mode:"all"});Array.from(s).forEach((([e,t])=>{var n;gt.setNodes(o,{props:Object.assign(Object.assign({},e.props),{asHeader:!(null===(n=e.props)||void 0===n?void 0:n.asHeader)})},{at:t,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})})),gt.setNodes(o,{props:Object.assign(Object.assign({},null==i?void 0:i.props),{headerRow:!a})},{at:[0],match:e=>Ze.isElement(e)&&"table"===e.type})}))},toggleHeaderColumn:(e,r)=>{const o=t.getBlockSlate(e,{id:r});o&&nt.withoutNormalizing(o,(()=>{var t;const i=n.getElement(e,r,{type:"table",path:[0]}),a=(null===(t=null==i?void 0:i.props)||void 0===t?void 0:t.headerColumn)||!1,s=nt.nodes(o,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"});Array.from(s).forEach((([e,t])=>{var n;const r=e.children[0];gt.setNodes(o,{props:Object.assign(Object.assign({},r.props),{asHeader:!(null===(n=r.props)||void 0===n?void 0:n.asHeader)})},{at:t.concat(0),match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})})),gt.setNodes(o,{props:Object.assign(Object.assign({},null==i?void 0:i.props),{headerColumn:!a})},{at:[0],match:e=>Ze.isElement(e)&&"table"===e.type})}))}},{ExtendedBlockActions:wt,BlockOptionsMenuGroup:xt,BlockOptionsMenuItem:kt,BlockOptionsSeparator:Ot}=r,Et=({editor:e,block:t,table:n})=>{const r=n.props,o=null==r?void 0:r.headerRow,i=null==r?void 0:r.headerColumn;return u(wt,Object.assign({onClick:()=>e.setPath({current:t.meta.order}),className:"yoopta-table-options"},{children:[d(Ot,{}),u(xt,{children:[d(kt,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-table-justify-between",onClick:()=>{vt.toggleHeaderRow(e,t.id)}},{children:[u("span",Object.assign({className:"yoo-table-flex"},{children:[d(D,{width:16,height:16,className:"yoo-table-w-4 yoo-table-h-4 yoo-table-mr-2"}),"Header row"]})),o&&d(S,{width:16,height:16,className:"yoo-table-w-4 yoo-table-h-4"})]}))}),d(kt,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-table-justify-between",onClick:()=>{vt.toggleHeaderColumn(e,t.id)}},{children:[u("span",Object.assign({className:"yoo-table-flex"},{children:[d(L,{width:16,height:16,className:"yoo-table-w-4 yoo-table-h-4 yoo-table-mr-2 yoo-table-rotate-180"}),"Header column"]})),i&&d(S,{width:16,height:16,className:"yoo-table-w-4 yoo-table-h-4"})]}))})]})]}))},_t=new WeakMap,Pt=new WeakMap,jt=({onResize:e,tdWidth:t,columnIndex:n})=>{const r=y(null),o=y(0),i=y(0);return b((()=>{const e=document.querySelector(".yoopta-table");if(!e)return;const t=null==e?void 0:e.offsetHeight;r.current&&(r.current.style.height=`${t}px`)}),[]),b((()=>{var n;const a=document.querySelector(".yoopta-table");if(!a)return;const s=n=>{const s=null==a?void 0:a.offsetHeight;if(!r.current)return;r.current.style.height=`${s}px`,i.current=n.clientX,o.current=t;const l=t=>{const n=t.clientX,r=o.current+(n-i.current);e(r)},c=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)};return null===(n=r.current)||void 0===n||n.addEventListener("mousedown",s),()=>{var e;null===(e=r.current)||void 0===e||e.removeEventListener("mousedown",s)}}),[n,t]),d("div",Object.assign({ref:r,className:"yoopta-table-resize-handle",contentEditable:!1},{children:d("div",{className:"yoopta-table-resize-handle-inner",contentEditable:!1})}))};function Nt(e){return Rt(e)?(e.nodeName||"").toLowerCase():"#document"}function St(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ct(e){var t;return null==(t=(Rt(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Rt(e){return e instanceof Node||e instanceof St(e).Node}function Tt(e){return e instanceof Element||e instanceof St(e).Element}function At(e){return e instanceof HTMLElement||e instanceof St(e).HTMLElement}function Mt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof St(e).ShadowRoot)}function zt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=It(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Dt(e){return["table","td","th"].includes(Nt(e))}function Lt(e){const t=Bt(),n=It(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function Bt(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Ht(e){return["html","body","#document"].includes(Nt(e))}function It(e){return St(e).getComputedStyle(e)}function qt(e){return Tt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ft(e){if("html"===Nt(e))return e;const t=e.assignedSlot||e.parentNode||Mt(e)&&e.host||Ct(e);return Mt(t)?t.host:t}function Wt(e){const t=Ft(e);return Ht(t)?e.ownerDocument?e.ownerDocument.body:e.body:At(t)&&zt(t)?t:Wt(t)}function $t(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Wt(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=St(o);return i?t.concat(a,a.visualViewport||[],zt(o)?o:[],a.frameElement&&n?$t(a.frameElement):[]):t.concat(o,$t(o,[],n))}const Vt=Math.min,Kt=Math.max,Zt=Math.round,Xt=Math.floor,Ut=e=>({x:e,y:e}),Jt={left:"right",right:"left",bottom:"top",top:"bottom"},Yt={start:"end",end:"start"};function Gt(e,t,n){return Kt(e,Vt(t,n))}function Qt(e,t){return"function"==typeof e?e(t):e}function en(e){return e.split("-")[0]}function tn(e){return e.split("-")[1]}function nn(e){return"x"===e?"y":"x"}function rn(e){return"y"===e?"height":"width"}function on(e){return["top","bottom"].includes(en(e))?"y":"x"}function an(e){return nn(on(e))}function sn(e){return e.replace(/start|end/g,(e=>Yt[e]))}function ln(e){return e.replace(/left|right|bottom|top/g,(e=>Jt[e]))}function cn(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function un(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function dn(e,t,n){let{reference:r,floating:o}=e;const i=on(t),a=an(t),s=rn(a),l=en(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[s]/2-o[s]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.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-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(tn(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function fn(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=Qt(t,e),h=cn(p),m=s[f?"floating"===d?"reference":"floating":d],y=un(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),b="floating"===d?{...a.floating,x:r,y:o}:a.reference,g=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),v=await(null==i.isElement?void 0:i.isElement(g))&&await(null==i.getScale?void 0:i.getScale(g))||{x:1,y:1},w=un(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:g,strategy:l}):b);return{top:(y.top-w.top+h.top)/v.y,bottom:(w.bottom-y.bottom+h.bottom)/v.y,left:(y.left-w.left+h.left)/v.x,right:(w.right-y.right+h.right)/v.x}}function pn(e){const t=Vt(...e.map((e=>e.left))),n=Vt(...e.map((e=>e.top)));return{x:t,y:n,width:Kt(...e.map((e=>e.right)))-t,height:Kt(...e.map((e=>e.bottom)))-n}}const hn=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=en(n),s=tn(n),l="y"===on(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=Qt(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof h&&(p="end"===s?-1*h:h),l?{x:p*u,y:f*c}:{x:f*c,y:p*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}};function mn(e){const t=It(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=At(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Zt(n)!==i||Zt(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function yn(e){return Tt(e)?e:e.contextElement}function bn(e){const t=yn(e);if(!At(t))return Ut(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=mn(t);let a=(i?Zt(n.width):n.width)/r,s=(i?Zt(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const gn=Ut(0);function vn(e){const t=St(e);return Bt()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:gn}function wn(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=yn(e);let a=Ut(1);t&&(r?Tt(r)&&(a=bn(r)):a=bn(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==St(e))&&t}(i,n,r)?vn(i):Ut(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=St(i),t=r&&Tt(r)?St(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=bn(o),t=o.getBoundingClientRect(),r=It(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,n=St(o),o=n.frameElement}}return un({width:u,height:d,x:l,y:c})}const xn=[":popover-open",":modal"];function kn(e){return xn.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function On(e){return wn(Ct(e)).left+qt(e).scrollLeft}function En(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=St(e),r=Ct(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=Bt();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=Ct(e),n=qt(e),r=e.ownerDocument.body,o=Kt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Kt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+On(e);const s=-n.scrollTop;return"rtl"===It(r).direction&&(a+=Kt(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Ct(e));else if(Tt(t))r=function(e,t){const n=wn(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=At(e)?bn(e):Ut(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=vn(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return un(r)}function _n(e,t){const n=Ft(e);return!(n===t||!Tt(n)||Ht(n))&&("fixed"===It(n).position||_n(n,t))}function Pn(e,t,n){const r=At(t),o=Ct(t),i="fixed"===n,a=wn(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Ut(0);if(r||!r&&!i)if(("body"!==Nt(t)||zt(o))&&(s=qt(t)),r){const e=wn(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=On(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function jn(e,t){return At(e)&&"fixed"!==It(e).position?t?t(e):e.offsetParent:null}function Nn(e,t){const n=St(e);if(!At(e)||kn(e))return n;let r=jn(e,t);for(;r&&Dt(r)&&"static"===It(r).position;)r=jn(r,t);return r&&("html"===Nt(r)||"body"===Nt(r)&&"static"===It(r).position&&!Lt(r))?n:r||function(e){let t=Ft(e);for(;At(t)&&!Ht(t);){if(Lt(t))return t;t=Ft(t)}return null}(e)||n}const Sn={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Ct(r),s=!!t&&kn(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Ut(1);const u=Ut(0),d=At(r);if((d||!d&&!i)&&(("body"!==Nt(r)||zt(a))&&(l=qt(r)),At(r))){const e=wn(r);c=bn(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}},getDocumentElement:Ct,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=$t(e,[],!1).filter((e=>Tt(e)&&"body"!==Nt(e))),o=null;const i="fixed"===It(e).position;let a=i?Ft(e):e;for(;Tt(a)&&!Ht(a);){const t=It(a),n=Lt(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||zt(a)&&!n&&_n(e,a))?r=r.filter((e=>e!==a)):o=t,a=Ft(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],s=i.reduce(((e,n)=>{const r=En(t,n,o);return e.top=Kt(r.top,e.top),e.right=Vt(r.right,e.right),e.bottom=Vt(r.bottom,e.bottom),e.left=Kt(r.left,e.left),e}),En(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Nn,getElementRects:async function(e){const t=this.getOffsetParent||Nn,n=this.getDimensions;return{reference:Pn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=mn(e);return{width:t,height:n}},getScale:bn,isElement:Tt,isRTL:function(e){return"rtl"===It(e).direction}};function Cn(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=yn(e),u=o||i?[...c?$t(c):[],...$t(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=c&&s?function(e,t){let n,r=null;const o=Ct(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const{left:c,top:u,width:d,height:f}=e.getBoundingClientRect();if(s||t(),!d||!f)return;const p={rootMargin:-Xt(u)+"px "+-Xt(o.clientWidth-(c+d))+"px "+-Xt(o.clientHeight-(u+f))+"px "+-Xt(c)+"px",threshold:Kt(0,Vt(1,l))||1};let h=!0;function m(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),100)}h=!1}try{r=new IntersectionObserver(m,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(m,p)}r.observe(e)}(!0),i}(c,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!l&&h.observe(c),h.observe(t));let m=l?wn(e):null;return l&&function t(){const r=wn(e);!m||r.x===m.x&&r.y===m.y&&r.width===m.width&&r.height===m.height||n();m=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const Rn=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Qt(e,t),c={x:n,y:r},u=await fn(t,l),d=on(en(o)),f=nn(d);let p=c[f],h=c[d];if(i){const e="y"===f?"bottom":"right";p=Gt(p+u["y"===f?"top":"left"],p,p-u[e])}if(a){const e="y"===d?"bottom":"right";h=Gt(h+u["y"===d?"top":"left"],h,h-u[e])}const m=s.fn({...t,[f]:p,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r}}}}},Tn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...y}=Qt(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const b=en(o),g=en(s)===s,v=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=f||(g||!m?[ln(s)]:function(e){const t=ln(e);return[sn(e),t,sn(t)]}(s));f||"none"===h||w.push(...function(e,t,n,r){const o=tn(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(en(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(sn)))),i}(s,m,h,v));const x=[s,...w],k=await fn(t,y),O=[];let E=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&O.push(k[b]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=tn(e),o=an(e),i=rn(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=ln(a)),[a,ln(a)]}(o,a,v);O.push(k[e[0]],k[e[1]])}if(E=[...E,{placement:o,overflows:O}],!O.every((e=>e<=0))){var _,P;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(P=E.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:P.placement;if(!n)switch(p){case"bestFit":{var j;const e=null==(j=E.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:j[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},An=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:s=2,x:l,y:c}=Qt(e,t),u=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),d=function(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),n=[];let r=null;for(let e=0;e<t.length;e++){const o=t[e];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map((e=>un(pn(e))))}(u),f=un(pn(u)),p=cn(s);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===d.length&&d[0].left>d[1].right&&null!=l&&null!=c)return d.find((e=>l>e.left-p.left&&l<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom))||f;if(d.length>=2){if("y"===on(n)){const e=d[0],t=d[d.length-1],r="top"===en(n),o=e.top,i=t.bottom,a=r?e.left:t.left,s=r?e.right:t.right;return{top:o,bottom:i,left:a,right:s,width:s-a,height:i-o,x:a,y:o}}const e="left"===en(n),t=Kt(...d.map((e=>e.right))),r=Vt(...d.map((e=>e.left))),o=d.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return f}},floating:r.floating,strategy:a});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Mn=(e,t,n)=>{const r=new Map,o={platform:Sn,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=dn(c,r,l),f=r,p={},h=0;for(let n=0;n<s.length;n++){const{name:i,fn:m}=s[n],{x:y,y:b,data:g,reset:v}=await m({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=y?y:u,d=null!=b?b:d,p={...p,[i]:{...p[i],...g}},v&&h<=50&&(h++,"object"==typeof v&&(v.placement&&(f=v.placement),v.rects&&(c=!0===v.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):v.rects),({x:u,y:d}=dn(c,f,l))),n=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var zn="undefined"!=typeof document?g:b;function Dn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Dn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Dn(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ln(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bn(e,t){const n=Ln(e);return Math.round(t*n)/n}function Hn(e){const t=p.useRef(e);return zn((()=>{t.current=e})),t}const In=p["useInsertionEffect".toString()]||(e=>e());var qn="undefined"!=typeof document?g:b;let Fn=!1,Wn=0;const $n=()=>"floating-ui-"+Wn++;const Vn=p["useId".toString()]||function(){const[e,t]=p.useState((()=>Fn?$n():void 0));return qn((()=>{null==e&&t($n())}),[]),p.useEffect((()=>{Fn||(Fn=!0)}),[]),e};const Kn=p.createContext(null),Zn=p.createContext(null);function Xn(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:o}=e,[i,a]=p.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||i,l=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[u,d]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=p.useState(r);Dn(f,r)||h(r);const[m,y]=p.useState(null),[b,g]=p.useState(null),v=p.useCallback((e=>{e!==E.current&&(E.current=e,y(e))}),[]),w=p.useCallback((e=>{e!==_.current&&(_.current=e,g(e))}),[]),k=i||m,O=a||b,E=p.useRef(null),_=p.useRef(null),P=p.useRef(u),j=null!=l,N=Hn(l),S=Hn(o),C=p.useCallback((()=>{if(!E.current||!_.current)return;const e={placement:t,strategy:n,middleware:f};S.current&&(e.platform=S.current),Mn(E.current,_.current,e).then((e=>{const t={...e,isPositioned:!0};R.current&&!Dn(P.current,t)&&(P.current=t,x.flushSync((()=>{d(t)})))}))}),[f,t,n,S]);zn((()=>{!1===c&&P.current.isPositioned&&(P.current.isPositioned=!1,d((e=>({...e,isPositioned:!1}))))}),[c]);const R=p.useRef(!1);zn((()=>(R.current=!0,()=>{R.current=!1})),[]),zn((()=>{if(k&&(E.current=k),O&&(_.current=O),k&&O){if(N.current)return N.current(k,O,C);C()}}),[k,O,C,N,j]);const T=p.useMemo((()=>({reference:E,floating:_,setReference:v,setFloating:w})),[v,w]),A=p.useMemo((()=>({reference:k,floating:O})),[k,O]),M=p.useMemo((()=>{const e={position:n,left:0,top:0};if(!A.floating)return e;const t=Bn(A.floating,u.x),r=Bn(A.floating,u.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...Ln(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,s,A.floating,u.x,u.y]);return p.useMemo((()=>({...u,update:C,refs:T,elements:A,floatingStyles:M})),[u,C,T,A,M])}(e),c=p.useContext(Zn),u=null!=((null==(d=p.useContext(Kn))?void 0:d.id)||null);var d;const f=function(e){const t=p.useRef((()=>{}));return In((()=>{t.current=e})),p.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}(((e,t,n)=>{e&&(m.current.openEvent=t),y.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==r||r(e,t,n)})),h=p.useRef(null),m=p.useRef({}),y=p.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],b=Vn(),g=p.useCallback((e=>{const t=Tt(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l.refs.setReference(t)}),[l.refs]),v=p.useCallback((e=>{(Tt(e)||null===e)&&(h.current=e,a(e)),(Tt(l.refs.reference.current)||null===l.refs.reference.current||null!==e&&!Tt(e))&&l.refs.setReference(e)}),[l.refs]),w=p.useMemo((()=>({...l.refs,setReference:v,setPositionReference:g,domReference:h})),[l.refs,v,g]),k=p.useMemo((()=>({...l.elements,domReference:s})),[l.elements,s]),O=p.useMemo((()=>({...l,refs:w,elements:k,dataRef:m,nodeId:o,floatingId:b,events:y,open:n,onOpenChange:f})),[l,o,b,y,n,f,w,k]);return qn((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===o));e&&(e.context=O)})),p.useMemo((()=>({...l,context:O,refs:w,elements:k})),[l,w,k,O])}var Un;function Jn(){return Jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jn.apply(this,arguments)}var Yn=function(e){return p.createElement("svg",Jn({viewBox:"0 0 10 10",style:{width:14,height:14,display:"block",flexShrink:0,transform:"rotate(90deg)"}},e),Un||(Un=p.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};const{BlockOptionsMenuGroup:Gn,BlockOptionsMenuItem:Qn,BlockOptions:er,BlockOptionsSeparator:tr}=r,nr=e=>{var{editor:t,blockId:r,element:o,onClose:i}=e,a=k(e,["editor","blockId","element","onClose"]);return d(er,Object.assign({},a,{onClose:i,actions:null},{children:u(Gn,{children:[d(Qn,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableColumn(t,r,{insertMode:"before"}),i()}},{children:[d(j,{className:"yoopta-table-icons"}),"Insert left"]}))}),d(Qn,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableColumn(t,r,{insertMode:"after"}),i()}},{children:[d(N,{className:"yoopta-table-icons"}),"Insert right"]}))}),d(tr,{}),d(Qn,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=t.blockEditorsMap[r],o=n.getElementEntry(t,r,{type:"table-data-cell",path:e.selection});if(o){const[,n]=o,i=nt.next(e,{at:n,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!i)return;const[,a]=i;vt.moveTableColumn(t,r,{from:n,to:a})}}},{children:[d(M,{className:"yoopta-table-icons"}),"Move right"]}))}),d(Qn,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=t.blockEditorsMap[r],o=n.getElementEntry(t,r,{type:"table-data-cell",path:e.selection});if(o){const[,n]=o,i=nt.previous(e,{at:n,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!i)return;const[,a]=i;vt.moveTableColumn(t,r,{from:n,to:a})}}},{children:[d(A,{className:"yoopta-table-icons"}),"Move left"]}))}),d(tr,{}),d(Qn,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{let e=n.getElementPath(t,r,o);e&&(vt.deleteTableColumn(t,r,{path:e}),i())}},{children:[d(B,{className:"yoopta-table-icons"}),"Delete"]}))})]})}))},rr=({editor:e,blockId:t,tdElement:r})=>{const[o,i]=v(!1),{refs:a,floatingStyles:s}=Xn({placement:"bottom-start",open:o,onOpenChange:i,middleware:[An(),Tn(),Rn(),hn(10)],whileElementsMounted:Cn});return u(f,{children:[d(nr,{refs:a,isOpen:o,onClose:()=>{i(!1)},style:s,editor:e,blockId:t,element:r}),d("button",Object.assign({type:"button",ref:a.setReference,onClick:()=>{if(e.readOnly)return;const o=e.blockEditorsMap[t],a=n.getElementPath(e,t,r);a&&(gt.select(o,{path:a.concat([0]),offset:0}),i(!0))},contentEditable:!1,style:o?{opacity:1}:void 0,className:"yoopta-table-column-button"},{children:d(Yn,{})}))]})},{BlockOptionsMenuGroup:or,BlockOptionsMenuItem:ir,BlockOptions:ar,BlockOptionsSeparator:sr}=r,lr=e=>{var{editor:t,blockId:r,onClose:o,tdElement:i}=e,a=k(e,["editor","blockId","onClose","tdElement"]);return d(ar,Object.assign({},a,{onClose:o,actions:null},{children:u(or,{children:[d(ir,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableRow(t,r,{insertMode:"before",select:!0}),o()}},{children:[d(R,{className:"yoopta-table-icons"}),"Insert above"]}))}),d(ir,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableRow(t,r,{insertMode:"after",select:!0}),o()}},{children:[d(C,{className:"yoopta-table-icons"}),"Insert below"]}))}),d(sr,{}),d(ir,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=n.getElementPath(t,r,i),a=n.getElement(t,r,{type:"table-row",path:e});if(!a)return;let s=n.getElementPath(t,r,a);const l=t.blockEditorsMap[r],c=nt.previous(l,{at:s,match:e=>Ze.isElement(e)&&"table-row"===e.type});if(!c)return o();vt.moveTableRow(t,r,{from:s,to:c[1]})}},{children:[d(z,{className:"yoopta-table-icons"}),"Move up"]}))}),d(ir,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=n.getElementPath(t,r,i),a=n.getElement(t,r,{type:"table-row",path:e});if(!a)return;let s=n.getElementPath(t,r,a);const l=t.blockEditorsMap[r],c=nt.next(l,{at:s,match:e=>Ze.isElement(e)&&"table-row"===e.type});if(!c)return o();vt.moveTableRow(t,r,{from:s,to:c[1]})}},{children:[d(T,{className:"yoopta-table-icons"}),"Move down"]}))}),d(sr,{}),d(ir,{children:u("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=n.getElementPath(t,r,i),a=n.getElement(t,r,{type:"table-row",path:e});if(!a)return;let s=n.getElementPath(t,r,a);vt.deleteTableRow(t,r,{path:s}),o()}},{children:[d(B,{className:"yoopta-table-icons"}),"Delete row"]}))})]})}))},cr=({editor:e,blockId:t,tdElement:r})=>{const[o,i]=v(!1),{refs:a,floatingStyles:s}=Xn({placement:"right-start",open:o,onOpenChange:i,middleware:[An(),Tn(),Rn(),hn(10)],whileElementsMounted:Cn});return u(f,{children:[d(lr,{refs:a,isOpen:o,onClose:()=>{i(!1)},style:s,editor:e,blockId:t,tdElement:r}),d("button",Object.assign({ref:a.setReference,type:"button",onClick:()=>{if(e.readOnly)return;const o=e.blockEditorsMap[t],a=n.getElementPath(e,t,r);a&&(gt.select(o,{path:a.concat([0]),offset:0}),i(!0))},contentEditable:!1,className:"yoopta-table-row-button",style:o?{opacity:1}:void 0},{children:d(Yn,{className:"yoo-table-w-[14px] yoo-table-h-[14px] yoo-table-block yoo-table-flex-shrink-0",style:{transform:"rotate(0deg)"}})}))]})};const ur=new c({type:"Table",elements:{table:{render:({attributes:e,children:t,blockId:n,element:r,HTMLAttributes:a,extendRender:s})=>{const l=o(),c=l.blockEditorsMap[n],f=i(n),p=l.readOnly,h=Pt.get(c);if(s)return s({attributes:e,children:t,blockId:n,element:r,HTMLAttributes:a,isSelecting:h});const m=a||{},{className:y}=m,b=k(m,["className"]);return u("div",Object.assign({className:`yoopta-table-block ${y}`},{children:[d("table",Object.assign({},b,{className:"yoopta-table "+(h?" yoopta-table-selecting":"")},{children:d("tbody",Object.assign({},e,{children:t}))})),!p&&d(Et,{block:f,editor:l,table:r})]}))},asRoot:!0,children:["table-row"],props:{headerRow:!1,headerColumn:!1}},"table-row":{render:({attributes:e,children:t,element:n,blockId:r,HTMLAttributes:o,extendRender:i})=>{if(i)return i({attributes:e,children:t,blockId:r,element:n,HTMLAttributes:o});const a=o||{},{className:s}=a,l=k(a,["className"]);return d("tr",Object.assign({},l,{className:`yoopta-table-row ${s}`,"data-element-id":n.id},e,{children:t}))},children:["table-data-cell"]},"table-data-cell":{render:({attributes:e,children:t,element:r,blockId:i,HTMLAttributes:a,extendRender:s})=>{var l,c,f;const p=o(),h=p.blockEditorsMap[i],m=n.getElementPath(p,i,r),y=null===(l=Pt.get(h))||void 0===l?void 0:l.has(r),b=(null===(c=null==r?void 0:r.props)||void 0===c?void 0:c.asHeader)||!1,g=w((()=>{var e,t;const n=nt.above(h,{at:m,match:e=>Ze.isElement(e)&&"table"===e.type});if(!n)return null;const[r]=n,o=(null===(e=null==r?void 0:r.props)||void 0===e?void 0:e.headerRow)||!1;return{headerColumn:(null===(t=null==r?void 0:r.props)||void 0===t?void 0:t.headerColumn)||!1,headerRow:o}}),[b]),{headerRow:v,headerColumn:x}=g||{},O=(null==m?void 0:m[m.length-1])||0,E=(null===(f=null==r?void 0:r.props)||void 0===f?void 0:f.width)||200,_=0===(null==m?void 0:m[m.length-1]),P=0===(null==m?void 0:m[m.length-2]);let j=!1;P&&v&&(j=!0),_&&x&&(j=!0);const N=e=>{vt.updateColumnWidth(p,i,O,e)},S=j?"th":"td",C={maxWidth:E,minWidth:E},R=a||{},{className:T}=R,A=k(R,["className"]),M=j?`yoopta-table-data-cell yoopta-table-data-cell-head ${T}`:`yoopta-table-data-cell ${T}`;return s?s({attributes:e,children:t,blockId:i,element:r,HTMLAttributes:a,isDataCellAsHeader:j,onResize:N,width:E,height:E,selected:y}):u(S,Object.assign({scope:j?"col":void 0,"data-cell-selected":y,style:C,colSpan:1,rowSpan:1},A,{className:M},{children:[d("div",Object.assign({className:"yoopta-table-data-cell-content"},e,{children:t})),!p.readOnly&&P&&d(jt,{onResize:N,tdWidth:E,columnIndex:O}),!p.readOnly&&P&&d(rr,{editor:p,blockId:i,tdElement:r}),!p.readOnly&&_&&d(cr,{editor:p,blockId:i,tdElement:r})]}))},props:{asHeader:!1,width:200}}},events:{onKeyDown:function(e,t,{hotkeys:n,currentBlock:r}){return o=>{if(t.selection){if(n.isBackspace(o)){const e=Te.parent(t.selection.anchor.path),n=nt.isStart(t,t.selection.anchor,e),r=_t.get(t);if(r)return o.preventDefault(),void nt.withoutNormalizing(t,(()=>{for(const[,e]of r)for(const[n,r]of Ye.children(t,e))if(pt.isText(n)){const e=Ye.string(n).length;e>0&>.delete(t,{at:{anchor:{path:r,offset:0},focus:{path:r,offset:e}}})}gt.select(t,{path:r[0][1].concat(0),offset:0})}));if(n&&Ve.isCollapsed(t.selection))return void o.preventDefault()}if(n.isCmdShiftEnter(o))return o.preventDefault(),void vt.insertTableRow(e,r.id,{select:!0,insertMode:"before"});if(n.isShiftEnter(o))return o.preventDefault(),void vt.insertTableRow(e,r.id,{select:!0,insertMode:"after"});if(n.isCmdShiftRight(o))return o.preventDefault(),void vt.insertTableColumn(e,r.id,{select:!0,insertMode:"after"});if(n.isCmdShiftLeft(o))return o.preventDefault(),void vt.insertTableColumn(e,r.id,{select:!0,insertMode:"before"});if(n.isCmdShiftDelete(o))return o.preventDefault(),void vt.deleteTableRow(e,r.id);if(n.isCmdAltDelete(o))return o.preventDefault(),void vt.deleteTableColumn(e,r.id);if(n.isArrowUp(o)){o.preventDefault();const e=nt.above(t,{at:t.selection.anchor,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!e)return;const[n,r]=e;try{const e=r[r.length-1],n=Te.previous(r.slice(0,-1)).concat(e);nt.node(t,n),gt.select(t,n)}catch(e){}}else if(n.isArrowDown(o)){o.preventDefault();const e=nt.above(t,{at:t.selection.anchor,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!e)return;const[n,r]=e;try{const e=r[r.length-1],n=Te.next(r.slice(0,-1)).concat(e);nt.node(t,n),gt.select(t,n)}catch(e){}}else{if(n.isEnter(o)&&(o.preventDefault(),gt.insertText(t,"\n")),n.isSelect(o)){const n=nt.above(t,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(n){o.preventDefault();const[i,a]=n,s=nt.string(t,a);if(Ve.isExpanded(t.selection)||0===s.length)return e.blur(),void e.setPath({current:null,selected:[r.meta.order]});gt.select(t,a)}}(o.metaKey||o.ctrlKey)&&o.shiftKey&&"h"===o.key&&(o.preventDefault(),vt.toggleHeaderRow(e,r.id)),(o.metaKey||o.ctrlKey)&&o.shiftKey&&"v"===o.key&&(o.preventDefault(),vt.toggleHeaderColumn(e,r.id))}}}},onBlur:(e,t)=>()=>{Pt.delete(t)},onBeforeCreate:e=>vt.buildTableElements(e,{rows:3,columns:3})},parsers:{html:{deserialize:{nodeNames:["TABLE"],parse:function(t,n){const r=t.querySelector("tbody"),o=t.querySelector("thead"),i={id:e(),type:"table",children:[],props:{headerRow:"true"===t.getAttribute("data-header-row"),headerColumn:"true"===t.getAttribute("data-header-column")}};if(!r&&!o)return;const s=null==o?void 0:o.querySelector("tr");if(s&&(i.props.headerRow=!0),s){const t={id:e(),type:"table-row",children:[]};Array.from(s.childNodes).forEach((r=>{if("TH"===r.nodeName){const o={id:e(),type:"table-data-cell",children:[{text:""}],props:{asHeader:!0,width:200}};r instanceof HTMLElement&&(null==r?void 0:r.hasAttribute("data-width"))&&(o.props.width=parseInt(r.getAttribute("data-width")||"200",10));let i=a(n,r.childNodes);o.children=i,t.children.push(o)}})),i.children.push(t)}return null==r||r.childNodes.forEach((t=>{const r=Array.from(t.childNodes).filter((e=>"TD"===e.nodeName||"TH"===e.nodeName));if(r.length>0){const t={id:e(),type:"table-row",children:[]};r.forEach((r=>{const o={id:e(),type:"table-data-cell",children:[{text:""}],props:{asHeader:!1,width:200}};if("TH"===r.nodeName&&(o.props.asHeader=!0),"TD"===r.nodeName&&(o.props.asHeader=!1),"TD"===r.nodeName||"TH"===r.nodeName){r instanceof HTMLElement&&(null==r?void 0:r.hasAttribute("data-width"))&&(o.props.width=parseInt(r.getAttribute("data-width")||"200",10));let e=a(n,r.childNodes);o.children=e,t.children.push(o)}})),i.children.push(t)}})),i}},serialize:function(e,t,n){var r,o;const i=e.children[0].children,{align:a="left",depth:l=0}=n||{};return`<table style="margin-left: ${l}px; text-align: ${a}" data-meta-align="${a}" data-meta-depth="${l}" data-header-row="${null===(r=e.props)||void 0===r?void 0:r.headerRow}" data-header-column="${null===(o=e.props)||void 0===o?void 0:o.headerColumn}">\n <colgroup>\n ${i.map((e=>{var t,n;return`<col style="width: ${(null===(t=e.props)||void 0===t?void 0:t.width)?`${null===(n=e.props)||void 0===n?void 0:n.width}px`:"auto"}" />`})).join("")}\n </colgroup>\n <tbody>${e.children.map((e=>`<tr>${e.children.map((e=>{var t,n,r;const o=s(e.children);return(null===(t=e.props)||void 0===t?void 0:t.asHeader)?`<th data-width="${(null===(n=e.props)||void 0===n?void 0:n.width)||200}" rowspan="1" colspan="1">${o}</th>`:`<td data-width="${(null===(r=e.props)||void 0===r?void 0:r.width)||200}" rowspan="1" colspan="1">${o}</td>`})).join("")}</tr>`)).join("")}</tbody></table>`}},markdown:{serialize:function(e,t){let n="";return e.children.forEach(((e,t)=>{const r=e.children.map((e=>` ${l(e.children)} `)).join("|");if(n+=`|${r}|\n`,0===t){const t=e.children.map((()=>" --- ")).join("|");n+=`|${t}|\n`}})),n}}},extensions:function(t,n){return t=function(e){const{deleteBackward:t}=e;return e.deleteBackward=n=>{const{selection:r}=e;if(!r||Ve.isExpanded(r))return t(n);const[o]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:r}),i=nt.before(e,r,{unit:n}),[a]=i?nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:i}):[void 0];if(!o&&!a)return t(n);if(!o&&a&&i)return gt.select(e,i);const[,s]=o,l=nt.start(e,s);it.equals(r.anchor,l)||t(n)},e}(t=function(t,n){const{normalizeNode:r}=t;return t.normalizeNode=(n,o)=>{const[i,a]=n;if(Ze.isElement(i)&&"table-data-cell"===i.type)for(const[e,n]of Ye.children(t,a)){if(Ze.isElement(e)&&"table"===e.type)return void gt.unwrapNodes(t,{at:n});if(Ze.isElement(e)&&"table-row"===e.type)return void gt.unwrapNodes(t,{at:n});if(Ze.isElement(e)&&"table-data-cell"===e.type)return void gt.unwrapNodes(t,{at:n})}if(Ze.isElement(i)&&"table-row"===i.type)for(const[n,r]of Ye.children(t,a))if(!Ze.isElement(n)||"table-data-cell"!==n.type)return gt.wrapNodes(t,{id:e(),type:"table-data-cell",children:[n]},{at:r});r(n,o)},t}(t=function(e){const{apply:t}=e;return e.apply=n=>{if(!et.isSelectionOperation(n)||!n.newProperties)return Pt.delete(e),_t.delete(e),t(n);const r=Object.assign(Object.assign({},e.selection),n.newProperties);if(!Ve.isRange(r))return Pt.delete(e),_t.delete(e),t(n);const[o]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:Ve.start(r)}),[i]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:Ve.end(r)});if(!o||!i)return Pt.delete(e),_t.delete(e),t(n);const[,a]=o,[,s]=i;if(Te.equals(a,s))return Pt.delete(e),_t.delete(e),t(n);const l=new WeakSet,c=nt.range(e,a,s),u=Array.from(nt.nodes(e,{at:c,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})),d=[];for(const[e,t]of u)Ze.isElement(e)&&"table-data-cell"===e.type&&(l.add(e),d.push([e,t]));_t.set(e,d),Pt.set(e,l),t(n)},e}(t)))},options:{display:{title:"Table",description:"Add simple table"},shortcuts:["table","||","3x3"]},commands:vt});export{vt as TableCommands,ur as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/table",
|
|
3
|
-
"version": "4.8.5-rc.
|
|
3
|
+
"version": "4.8.5-rc.7",
|
|
4
4
|
"description": "Table plugin for Yoopta Editor [IN PROGRESS]",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"lucide-react": "^0.436.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "a480dba03e9f723bb12b11c5ffa30e79af96bca0"
|
|
41
41
|
}
|