@yoopta/link 4.6.10-rc.1 → 4.7.1-rc.0

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.
@@ -0,0 +1,21 @@
1
+ import { SlateEditor, YooEditor } from '@yoopta/editor';
2
+ import { Location } from 'slate';
3
+ import { LinkElement, LinkElementProps } from '../types';
4
+ type LinkElementOptions = {
5
+ props: Omit<LinkElementProps, 'nodeType'>;
6
+ };
7
+ type LinkInsertOptions = LinkElementOptions & {
8
+ selection: Location | undefined;
9
+ slate: SlateEditor;
10
+ };
11
+ type DeleteElementOptions = {
12
+ slate: SlateEditor;
13
+ };
14
+ export type LinkCommands = {
15
+ buildLinkElements: (editor: YooEditor, options: LinkElementOptions) => LinkElement;
16
+ insertLink: (editor: YooEditor, options: LinkInsertOptions) => void;
17
+ deleteLink: (editor: YooEditor, options: DeleteElementOptions) => void;
18
+ };
19
+ export declare const LinkCommands: LinkCommands;
20
+ export {};
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,WAAW,EAEX,SAAS,EAEV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAmB,QAAQ,EAAoB,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEzD,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;CAC3C,CAAC;AAEF,KAAK,iBAAiB,GAAG,kBAAkB,GAAG;IAC5C,SAAS,EAAE,QAAQ,GAAG,SAAS,CAAC;IAChC,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,iBAAiB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,KAAK,WAAW,CAAC;IACnF,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACpE,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACxE,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,YA6E1B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ declare module 'slate' {
6
6
  Element: LinkElement;
7
7
  }
8
8
  }
9
+ export { LinkCommands } from './commands';
9
10
  export { LinkElement, LinkElementProps };
10
11
  export default Link;
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAExD,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,WAAW;QACnB,OAAO,EAAE,WAAW,CAAC;KACtB;CACF;AAED,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;AAEzC,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAExD,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,WAAW;QACnB,OAAO,EAAE,WAAW,CAAC;KACtB;CACF;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;AAEzC,eAAe,IAAI,CAAC"}
package/dist/index.js CHANGED
@@ -1,32 +1,32 @@
1
- import{useYooptaEditor as e,useYooptaTools as t,UI as n,Elements as r,findSlateBySelectionPath as o,useYooptaReadOnly as i,YooptaPlugin as s,generateId as a}from"@yoopta/editor";import{jsxs as l,jsx as c}from"react/jsx-runtime";import*as f from"react";import{forwardRef as u,createElement as p,useLayoutEffect as d,useEffect as h,useRef as g,useState as y}from"react";import*as m from"react-dom";function v(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"==typeof SuppressedError&&SuppressedError;
1
+ import{generateId as e,useYooptaEditor as t,useYooptaTools as n,UI as r,Elements as o,findSlateBySelectionPath as i,useYooptaReadOnly as s,YooptaPlugin as a,serializeTextNodes as l,deserializeTextNodes as c}from"@yoopta/editor";import{jsxs as f,jsx as u}from"react/jsx-runtime";import*as p from"react";import{forwardRef as d,createElement as h,useLayoutEffect as g,useEffect as y,useRef as m,useState as v}from"react";import*as b from"react-dom";
2
+ /*!
3
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
4
+ *
5
+ * Copyright (c) 2014-2017, Jon Schlinkert.
6
+ * Released under the MIT License.
7
+ */function w(e){return"[object Object]"===Object.prototype.toString.call(e)}function x(e){var t,n;return!1!==w(e)&&(void 0===(t=e.constructor)||!1!==w(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var O=Symbol.for("immer-nothing"),_=Symbol.for("immer-draftable"),P=Symbol.for("immer-state");function k(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var j=Object.getPrototypeOf;function E(e){return!!e&&!!e[P]}function S(e){return!!e&&(A(e)||Array.isArray(e)||!!e[_]||!!e.constructor?.[_]||D(e)||z(e))}var R=Object.prototype.constructor.toString();function A(e){if(!e||"object"!=typeof e)return!1;const t=j(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)===R}function T(e,t){0===C(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function C(e){const t=e[P];return t?t.type_:Array.isArray(e)?1:D(e)?2:z(e)?3:0}function N(e,t){return 2===C(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function L(e,t,n){const r=C(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function D(e){return e instanceof Map}function z(e){return e instanceof Set}function M(e){return e.copy_||e.base_}function F(e,t){if(D(e))return new Map(e);if(z(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&A(e)){if(!j(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[P];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(j(e),n)}function B(e,t=!1){return W(e)||E(e)||!S(e)||(C(e)>1&&(e.set=e.add=e.clear=e.delete=q),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>B(t,!0)))),e}function q(){k(2)}function W(e){return Object.isFrozen(e)}var V,I={};function H(e){const t=I[e];return t||k(0),t}function $(){return V}function Z(e,t){t&&(H("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function J(e){K(e),e.drafts_.forEach(X),e.drafts_=null}function K(e){e===V&&(V=e.parent_)}function U(e){return V={drafts_:[],parent_:V,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function X(e){const t=e[P];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Y(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[P].modified_&&(J(t),k(4)),S(e)&&(e=G(t,e),t.parent_||ee(t,e)),t.patches_&&H("Patches").generateReplacementPatches_(n[P].base_,e,t.patches_,t.inversePatches_)):e=G(t,n,[]),J(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==O?e:void 0}function G(e,t,n){if(W(t))return t;const r=t[P];if(!r)return T(t,((o,i)=>Q(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return ee(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),T(o,((o,s)=>Q(e,r,t,o,s,n,i))),ee(e,t,!1),n&&e.patches_&&H("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Q(e,t,n,r,o,i,s){if(E(o)){const s=G(e,o,i&&t&&3!==t.type_&&!N(t.assigned_,r)?i.concat(r):void 0);if(L(n,r,s),!E(s))return;e.canAutoFreeze_=!1}else s&&n.add(o);if(S(o)&&!W(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;G(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||ee(e,o)}}function ee(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&B(t,n)}var te={get(e,t){if(t===P)return e;const n=M(e);if(!N(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_||!S(r)?r:r===re(e.base_,t)?(se(e),e.copy_[t]=ae(r,e)):r},has:(e,t)=>t in M(e),ownKeys:e=>Reflect.ownKeys(M(e)),set(e,t,n){const r=oe(M(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=re(M(e),t),s=r?.[P];if(s&&s.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||N(e.base_,t)))return!0;se(e),ie(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!==re(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,se(e),ie(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=M(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){k(11)},getPrototypeOf:e=>j(e.base_),setPrototypeOf(){k(12)}},ne={};function re(e,t){const n=e[P];return(n?M(n):e)[t]}function oe(e,t){if(!(t in e))return;let n=j(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=j(n)}}function ie(e){e.modified_||(e.modified_=!0,e.parent_&&ie(e.parent_))}function se(e){e.copy_||(e.copy_=F(e.base_,e.scope_.immer_.useStrictShallowCopy_))}T(te,((e,t)=>{ne[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),ne.deleteProperty=function(e,t){return ne.set.call(this,e,t,void 0)},ne.set=function(e,t,n){return te.set.call(this,e[0],t,n,e[0])};function ae(e,t){const n=D(e)?H("MapSet").proxyMap_(e,t):z(e)?H("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:$(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=te;n&&(o=[r],i=ne);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:$()).drafts_.push(n),n}function le(e){if(!S(e)||W(e))return e;const t=e[P];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=F(e,t.scope_.immer_.useStrictShallowCopy_)}else n=F(e,!0);return T(n,((e,t)=>{L(n,e,le(t))})),t&&(t.finalized_=!1),n}var ce=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&&k(6),void 0!==n&&"function"!=typeof n&&k(7),S(e)){const o=U(this),i=ae(e,void 0);let s=!0;try{r=t(i),s=!1}finally{s?J(o):K(o)}return Z(o,n),Y(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===O&&(r=void 0),this.autoFreeze_&&B(r,!0),n){const t=[],o=[];H("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}k(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){S(e)||k(8),E(e)&&(e=function(e){E(e)||k(10);return le(e)}(e));const t=U(this),n=ae(e,void 0);return n[P].isManual_=!0,K(t),n}finishDraft(e,t){const n=e&&e[P];n&&n.isManual_||k(9);const{scope_:r}=n;return Z(r,t),Y(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=H("Patches").applyPatches_;return E(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},fe=ce.produce;ce.produceWithPatches.bind(ce),ce.setAutoFreeze.bind(ce),ce.setUseStrictShallowCopy.bind(ce),ce.applyPatches.bind(ce);var ue=ce.createDraft.bind(ce),pe=ce.finishDraft.bind(ce),de={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=de.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],s=t[n];return de.equals(r,o)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return de.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],s=t[n];return de.equals(r,o)&&i<s},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===de.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===de.compare(e,t),isBefore:(e,t)=>-1===de.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===de.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===de.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===de.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===de.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]&&de.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(!de.isAncestor(t,e)&&!de.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;(de.equals(i,r)||de.endsBefore(i,r)||de.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:s}=t;if(de.equals(s,r)||de.isAncestor(s,r))return null;de.endsBefore(s,r)&&(r[s.length-1]-=1);break;case"merge_node":var{path:a,position:l}=t;de.equals(a,r)||de.endsBefore(a,r)?r[a.length-1]-=1:de.isAncestor(a,r)&&(r[a.length-1]-=1,r[a.length]+=l);break;case"split_node":var{path:c,position:f}=t;if(de.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else de.endsBefore(c,r)?r[c.length-1]+=1:de.isAncestor(c,r)&&e[c.length]>=f&&(r[c.length-1]+=1,r[c.length]-=f);break;case"move_node":var{path:u,newPath:p}=t;if(de.equals(u,p))return r;if(de.isAncestor(u,r)||de.equals(u,r)){var d=p.slice();return de.endsBefore(u,p)&&u.length<p.length&&(d[u.length-1]-=1),d.concat(r.slice(u.length))}de.isSibling(u,p)&&(de.isAncestor(p,r)||de.equals(p,r))?de.endsBefore(u,r)?r[u.length-1]-=1:r[u.length-1]+=1:de.endsBefore(p,r)||de.equals(p,r)||de.isAncestor(p,r)?(de.endsBefore(u,r)&&(r[u.length-1]-=1),r[p.length-1]+=1):de.endsBefore(u,r)&&(de.equals(p,r)&&(r[p.length-1]+=1),r[u.length-1]-=1)}return r}};function he(e){return he="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},he(e)}function ge(e){var t=function(e,t){if("object"!==he(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==he(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===he(t)?t:String(t)}function ye(e,t,n){return(t=ge(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function me(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 ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?me(Object(n),!0).forEach((function(t){ye(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):me(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var be={transform(e,t){e.children=ue(e.children);var n=e.selection&&ue(e.selection);try{n=((e,t,n)=>{switch(n.type){case"insert_node":var{path:r,node:o}=n,i=Ce.parent(e,r),s=r[r.length-1];if(s>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(s,0,o),t)for(var[a,l]of je.points(t))t[l]=qe.transform(a,n);break;case"insert_text":var{path:c,offset:f,text:u}=n;if(0===u.length)break;var p=Ce.leaf(e,c),d=p.text.slice(0,f),h=p.text.slice(f);if(p.text=d+u+h,t)for(var[g,y]of je.points(t))t[y]=qe.transform(g,n);break;case"merge_node":var{path:m}=n,v=Ce.get(e,m),b=de.previous(m),w=Ce.get(e,b),x=Ce.parent(e,m),O=m[m.length-1];if(Ke.isText(v)&&Ke.isText(w))w.text+=v.text;else{if(Ke.isText(v)||Ke.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(m,"] to nodes of different interfaces: ").concat(Ve.stringify(v)," ").concat(Ve.stringify(w)));w.children.push(...v.children)}if(x.children.splice(O,1),t)for(var[_,P]of je.points(t))t[P]=qe.transform(_,n);break;case"move_node":var{path:k,newPath:j}=n;if(de.isAncestor(k,j))throw new Error("Cannot move a path [".concat(k,"] to new path [").concat(j,"] because the destination is inside itself."));var E=Ce.get(e,k),S=Ce.parent(e,k),R=k[k.length-1];S.children.splice(R,1);var A=de.transform(k,n),T=Ce.get(e,de.parent(A)),C=A[A.length-1];if(T.children.splice(C,0,E),t)for(var[N,L]of je.points(t))t[L]=qe.transform(N,n);break;case"remove_node":var{path:D}=n,z=D[D.length-1];if(Ce.parent(e,D).children.splice(z,1),t)for(var[M,F]of je.points(t)){var B=qe.transform(M,n);if(null!=t&&null!=B)t[F]=B;else{var q=void 0,W=void 0;for(var[V,I]of Ce.texts(e)){if(-1!==de.compare(I,D)){W=[V,I];break}q=[V,I]}var H=!1;q&&W&&(H=de.equals(W[1],D)?!de.hasPrevious(W[1]):de.common(q[1],D).length<de.common(W[1],D).length),q&&!H?(M.path=q[1],M.offset=q[0].text.length):W?(M.path=W[1],M.offset=0):t=null}}break;case"remove_text":var{path:$,offset:Z,text:J}=n;if(0===J.length)break;var K=Ce.leaf(e,$),U=K.text.slice(0,Z),X=K.text.slice(Z+J.length);if(K.text=U+X,t)for(var[Y,G]of je.points(t))t[G]=qe.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=Ce.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:se}=n;if(null==se)t=se;else{if(null==t){if(!je.isRange(se))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Ve.stringify(se)," when there is no current selection."));t=ve({},se)}for(var ae in se){var le=se[ae];if(null==le){if("anchor"===ae||"focus"===ae)throw new Error('Cannot remove the "'.concat(ae,'" selection property'));delete t[ae]}else t[ae]=le}}break;case"split_node":var{path:ce,position:fe,properties:ue}=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 pe,he=Ce.get(e,ce),ge=Ce.parent(e,ce),ye=ce[ce.length-1];if(Ke.isText(he)){var me=he.text.slice(0,fe),be=he.text.slice(fe);he.text=me,pe=ve(ve({},ue),{},{text:be})}else{var we=he.children.slice(0,fe),xe=he.children.slice(fe);he.children=we,pe=ve(ve({},ue),{},{children:xe})}if(ge.children.splice(ye+1,0,pe),t)for(var[Oe,_e]of je.points(t))t[_e]=qe.transform(Oe,n)}return t})(e,n,t)}finally{e.children=pe(e.children),e.selection=n?E(n)?pe(n):n:null}}},we={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)}},xe={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)}},Oe=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(x(r)&&x(o)){if(!Oe(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 s in t)if(void 0===e[s]&&void 0!==t[s])return!1;return!0};function _e(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 Pe=["anchor","focus"];function ke(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var je={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return je.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=je.edges(e);return t},equals:(e,t)=>qe.equals(e.anchor,t.anchor)&&qe.equals(e.focus,t.focus),includes(e,t){if(je.isRange(t)){if(je.includes(e,t.anchor)||je.includes(e,t.focus))return!0;var[n,r]=je.edges(e),[o,i]=je.edges(t);return qe.isBefore(n,o)&&qe.isAfter(r,i)}var[s,a]=je.edges(e),l=!1,c=!1;return qe.isPoint(t)?(l=qe.compare(t,s)>=0,c=qe.compare(t,a)<=0):(l=de.compare(t,s.path)>=0,c=de.compare(t,a.path)<=0),l&&c},intersection(e,t){var n=_e(e,Pe),[r,o]=je.edges(e),[i,s]=je.edges(t),a=qe.isBefore(r,i)?i:r,l=qe.isBefore(o,s)?o:s;return qe.isBefore(l,a)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ke(Object(n),!0).forEach((function(t){ye(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ke(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({anchor:a,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return qe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return qe.equals(t,n)},isExpanded:e=>!je.isCollapsed(e),isForward:e=>!je.isBackward(e),isRange:e=>x(e)&&qe.isPoint(e.anchor)&&qe.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=je.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fe(e,(e=>{if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var s=je.isCollapsed(e);je.isForward(e)?(r="forward",o=s?r:"backward"):(r="backward",o=s?r:"forward")}else"outward"===i?je.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var a=qe.transform(e.anchor,t,{affinity:r}),l=qe.transform(e.focus,t,{affinity:o});if(!a||!l)return null;e.anchor=a,e.focus=l}))}},Ee=e=>x(e)&&Ce.isNodeList(e.children)&&!Me.isEditor(e),Se={isAncestor:e=>x(e)&&Ce.isNodeList(e.children),isElement:Ee,isElementList:e=>Array.isArray(e)&&e.every((e=>Se.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 Ee(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},Re=["children"],Ae=["text"],Te=new WeakMap,Ce={ancestor(e,t){var n=Ce.get(e,t);if(Ke.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Ve.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of de.ancestors(t,n)){var o=[Ce.ancestor(e,r),r];yield o}}()},child(e,t){if(Ke.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Ve.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Ve.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=Ce.ancestor(e,t),{children:i}=o,s=r?i.length-1:0;r?s>=0:s<i.length;){var a=Ce.child(o,s),l=t.concat(s);yield[a,l],s=r?s-1:s+1}}()},common(e,t,n){var r=de.common(t,n);return[Ce.get(e,r),r]},descendant(e,t){var n=Ce.get(e,t);if(Me.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Ve.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ce.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 Ce.nodes(e,t))Se.isElement(n)&&(yield[n,r])}()},extractProps:e=>Se.isAncestor(e)?_e(e,Re):_e(e,Ae),first(e,t){for(var n=t.slice(),r=Ce.get(e,n);r&&!Ke.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(Ke.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Ve.stringify(e)));var n=fe({children:e.children},(e=>{var[n,r]=je.edges(t),o=Ce.nodes(e,{reverse:!0,pass:e=>{var[,n]=e;return!je.includes(t,n)}});for(var[,i]of o){if(!je.includes(t,i)){var s=Ce.parent(e,i),a=i[i.length-1];s.children.splice(a,1)}if(de.equals(i,r.path)){var l=Ce.leaf(e,i);l.text=l.text.slice(0,r.offset)}if(de.equals(i,n.path)){var c=Ce.leaf(e,i);c.text=c.text.slice(n.offset)}}Me.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(Ke.isText(n)||!n.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Ve.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(Ke.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode:e=>Ke.isText(e)||Se.isElement(e)||Me.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=Te.get(e);if(void 0!==t)return t;var n=e.every((e=>Ce.isNode(e)));return Te.set(e,n),n},last(e,t){for(var n=t.slice(),r=Ce.get(e,n);r&&!Ke.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=Ce.get(e,t);if(!Ke.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Ve.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of de.levels(t,n)){var o=Ce.get(e,r);yield[o,r]}}()},matches:(e,t)=>Se.isElement(e)&&Se.isElementProps(t)&&Se.matches(e,t)||Ke.isText(e)&&Ke.isTextProps(t)&&Ke.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,s=new Set,a=[],l=e;!i||!(r?de.isBefore(a,i):de.isAfter(a,i));)if(s.has(l)||(yield[l,a]),s.has(l)||Ke.isText(l)||0===l.children.length||null!=n&&!1!==n([l,a])){if(0===a.length)break;if(!r){var c=de.next(a);if(Ce.has(e,c)){a=c,l=Ce.get(e,a);continue}}if(r&&0!==a[a.length-1])a=de.previous(a),l=Ce.get(e,a);else a=de.parent(a),l=Ce.get(e,a),s.add(l)}else{s.add(l);var f=r?l.children.length-1:0;de.isAncestor(a,o)&&(f=o[a.length]),a=a.concat(f),l=Ce.get(e,a)}}()},parent(e,t){var n=de.parent(t),r=Ce.get(e,n);if(Ke.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=>Ke.isText(e)?e.text:e.children.map(Ce.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ce.nodes(e,t))Ke.isText(n)&&(yield[n,r])}()}};function Ne(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?Ne(Object(n),!0).forEach((function(t){ye(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var De={isNodeOperation:e=>De.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!x(e))return!1;switch(e.type){case"insert_node":case"remove_node":return de.isPath(e.path)&&Ce.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&de.isPath(e.path);case"merge_node":return"number"==typeof e.position&&de.isPath(e.path)&&x(e.properties);case"move_node":return de.isPath(e.path)&&de.isPath(e.newPath);case"set_node":return de.isPath(e.path)&&x(e.properties)&&x(e.newProperties);case"set_selection":return null===e.properties&&je.isRange(e.newProperties)||null===e.newProperties&&je.isRange(e.properties)||x(e.properties)&&x(e.newProperties);case"split_node":return de.isPath(e.path)&&"number"==typeof e.position&&x(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>De.isOperation(e))),isSelectionOperation:e=>De.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>De.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return Le(Le({},e),{},{type:"remove_node"});case"insert_text":return Le(Le({},e),{},{type:"remove_text"});case"merge_node":return Le(Le({},e),{},{type:"split_node",path:de.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(de.equals(t,n))return e;if(de.isSibling(n,t))return Le(Le({},e),{},{path:t,newPath:n});var r=de.transform(n,e),o=de.transform(de.next(n),e);return Le(Le({},e),{},{path:r,newPath:o});case"remove_node":return Le(Le({},e),{},{type:"insert_node"});case"remove_text":return Le(Le({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:s}=e;return Le(Le({},e),{},{properties:s,newProperties:i});case"set_selection":var{properties:a,newProperties:l}=e;return Le(Le({},e),{},null==a?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:a}:{properties:l,newProperties:a});case"split_node":return Le(Le({},e),{},{type:"merge_node",path:de.next(e.path)})}}},ze=new WeakMap,Me={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=ze.get(e);if(void 0!==t)return t;if(!x(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||x(e.marks))&&(null===e.selection||je.isRange(e.selection))&&Ce.isNodeList(e.children)&&De.isOperationList(e.operations);return ze.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 Fe(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 Be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fe(Object(n),!0).forEach((function(t){ye(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var qe={compare(e,t){var n=de.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===qe.compare(e,t),isBefore:(e,t)=>-1===qe.compare(e,t),equals:(e,t)=>e.offset===t.offset&&de.equals(e.path,t.path),isPoint:e=>x(e)&&"number"==typeof e.offset&&de.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fe(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=de.transform(o,t,n);break;case"insert_text":de.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(e.offset+=t.text.length);break;case"merge_node":de.equals(t.path,o)&&(e.offset+=t.position),e.path=de.transform(o,t,n);break;case"remove_text":de.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(de.equals(t.path,o)||de.isAncestor(t.path,o))return null;e.path=de.transform(o,t,n);break;case"split_node":if(de.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=de.transform(o,t,Be(Be({},n),{},{affinity:"forward"})))}else e.path=de.transform(o,t,n)}}))}},We=void 0,Ve={setScrubber(e){We=e},stringify:e=>JSON.stringify(e,We)},Ie=["text"],He=["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}function Ze(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){ye(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}var Je,Ke={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return _e(e,Ie)}return Oe(r?o(e):e,r?o(t):t)},isText:e=>x(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>Ke.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=[Ze({},e)];for(var r of t){var o=_e(r,He),[i,s]=je.edges(r),a=[],l=0,c=i.offset,f=s.offset;for(var u of n){var{length:p}=u.text,d=l;if(l+=p,c<=d&&l<=f)Object.assign(u,o),a.push(u);else if(c!==f&&(c===l||f===d)||c>l||f<d||f===d&&0!==d)a.push(u);else{var h=u,g=void 0,y=void 0;if(f<l){var m=f-d;y=Ze(Ze({},h),{},{text:h.text.slice(m)}),h=Ze(Ze({},h),{},{text:h.text.slice(0,m)})}if(c>d){var v=c-d;g=Ze(Ze({},h),{},{text:h.text.slice(0,v)}),h=Ze(Ze({},h),{},{text:h.text.slice(v)})}Object.assign(h,o),g&&a.push(g),a.push(h),y&&a.push(y)}}n=a}return n}},Ue=e=>e.selection?e.selection:e.children.length>0?Me.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"}(Je||(Je={})),Je.L,Je.L,Je.V,Je.LV,Je.LVT,Je.LV,Je.V,Je.V,Je.T,Je.LVT,Je.T,Je.T,Je.Any,Je.Extend,Je.ZWJ,Je.Any,Je.SpacingMark,Je.Prepend,Je.Any,Je.ZWJ,Je.ExtPict,Je.RI,Je.RI;var Xe={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]:{};Me.withoutNormalizing(e,(()=>{var{voids:r=!1}=n,{at:o=Ue(e)}=n;if(de.isPath(o)&&(o=Me.range(e,o)),je.isRange(o))if(je.isCollapsed(o))o=o.anchor;else{var i=je.end(o);if(!r&&Me.void(e,{at:i}))return;var s=je.start(o),a=Me.pointRef(e,s),l=Me.pointRef(e,i);Qe.delete(e,{at:o,voids:r});var c=a.unref(),f=l.unref();o=c||f,Qe.setSelection(e,{anchor:o,focus:o})}if(!(!r&&Me.void(e,{at:o})||Me.elementReadOnly(e,{at:o}))){var{path:u,offset:p}=o;t.length>0&&e.apply({type:"insert_text",path:u,offset:p,text:t})}}))}};function Ye(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 Ge(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ye(Object(n),!0).forEach((function(t){ye(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ye(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Qe=Ge(Ge(Ge(Ge({},be),we),xe),Xe);const et={buildLinkElements:(t,n)=>{const{props:r}=n||{},o=Object.assign(Object.assign({},r),{nodeType:"inline"});return{id:e(),type:"link",children:[{text:(null==r?void 0:r.title)||(null==r?void 0:r.url)||""}],props:o}},insertLink:(e,t)=>{let{props:n,slate:r}=t||{};if(!r||!r.selection)return;const o=Me.string(r,r.selection),i=Object.assign(Object.assign({},n),{title:n.title||o||n.url||"",nodeType:"inline"}),s=et.buildLinkElements(e,{props:n}),[a]=Me.nodes(r,{at:r.selection,match:e=>!Me.isEditor(e)&&Se.isElement(e)&&"link"===e.type});if(a){const[e,t]=a;return Qe.setNodes(r,{props:Object.assign(Object.assign(Object.assign({},null==e?void 0:e.props),i),{nodeType:"inline"})},{match:e=>Se.isElement(e)&&"link"===e.type,at:t}),Me.insertText(r,i.title||i.url||"",{at:r.selection}),void Qe.collapse(r,{edge:"end"})}Qe.wrapNodes(r,s,{split:!0,at:r.selection}),Qe.setNodes(r,{text:(null==n?void 0:n.title)||(null==n?void 0:n.url)||""},{at:r.selection,mode:"lowest",match:e=>!Me.isEditor(e)&&Se.isElement(e)&&"link"===e.type}),Me.insertText(r,(null==n?void 0:n.title)||(null==n?void 0:n.url)||"",{at:r.selection}),Qe.collapse(r,{edge:"end"})},deleteLink:(e,t)=>{const{slate:n}=t;if(!n||!n.selection)return;const[r]=Me.nodes(n,{at:n.selection,match:e=>!Me.isEditor(e)&&Se.isElement(e)&&"link"===e.type});r&&Qe.unwrapNodes(n,{match:e=>!Me.isEditor(e)&&Se.isElement(e)&&"link"===e.type,at:n.selection})}};function tt(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"==typeof SuppressedError&&SuppressedError;
2
8
  /**
3
9
  * @license lucide-react v0.379.0 - ISC
4
10
  *
5
11
  * This source code is licensed under the ISC license.
6
12
  * See the LICENSE file in the root directory of this source tree.
7
13
  */
8
- const b=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&n.indexOf(e)===t)).join(" ")
14
+ const nt=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&n.indexOf(e)===t)).join(" ")
9
15
  /**
10
16
  * @license lucide-react v0.379.0 - ISC
11
17
  *
12
18
  * This source code is licensed under the ISC license.
13
19
  * See the LICENSE file in the root directory of this source tree.
14
- */;var w={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
20
+ */;var rt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
15
21
  /**
16
22
  * @license lucide-react v0.379.0 - ISC
17
23
  *
18
24
  * This source code is licensed under the ISC license.
19
25
  * See the LICENSE file in the root directory of this source tree.
20
- */const x=u((({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>p("svg",{ref:l,...w,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:b("lucide",o),...a},[...s.map((([e,t])=>p(e,t))),...Array.isArray(i)?i:[i]]))),O=(e,t)=>{const n=u((({className:n,...r},o)=>{return p(x,{ref:o,iconNode:t,className:b(`lucide-${i=e,i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,n),...r});var i}));return n.displayName=`${e}`,n},_=O("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),P=O("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]);
26
+ */const ot=d((({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>h("svg",{ref:l,...rt,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:nt("lucide",o),...a},[...s.map((([e,t])=>h(e,t))),...Array.isArray(i)?i:[i]]))),it=(e,t)=>{const n=d((({className:n,...r},o)=>{return h(ot,{ref:o,iconNode:t,className:nt(`lucide-${i=e,i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,n),...r});var i}));return n.displayName=`${e}`,n},st=it("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),at=it("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]);
21
27
  /**
22
28
  * @license lucide-react v0.379.0 - ISC
23
29
  *
24
30
  * This source code is licensed under the ISC license.
25
31
  * See the LICENSE file in the root directory of this source tree.
26
- */function k(e){return S(e)?(e.nodeName||"").toLowerCase():"#document"}function j(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function E(e){var t;return null==(t=(S(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function S(e){return e instanceof Node||e instanceof j(e).Node}function R(e){return e instanceof Element||e instanceof j(e).Element}function A(e){return e instanceof HTMLElement||e instanceof j(e).HTMLElement}function C(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof j(e).ShadowRoot)}function T(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=M(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function N(e){return["table","td","th"].includes(k(e))}function L(e){const t=D(),n=M(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 D(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function z(e){return["html","body","#document"].includes(k(e))}function M(e){return j(e).getComputedStyle(e)}function F(e){return R(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function B(e){if("html"===k(e))return e;const t=e.assignedSlot||e.parentNode||C(e)&&e.host||E(e);return C(t)?t.host:t}function q(e){const t=B(e);return z(t)?e.ownerDocument?e.ownerDocument.body:e.body:A(t)&&T(t)?t:q(t)}function W(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=q(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),s=j(o);return i?t.concat(s,s.visualViewport||[],T(o)?o:[],s.frameElement&&n?W(s.frameElement):[]):t.concat(o,W(o,[],n))}const V=Math.min,I=Math.max,H=Math.round,$=Math.floor,Z=e=>({x:e,y:e}),J={left:"right",right:"left",bottom:"top",top:"bottom"},K={start:"end",end:"start"};function U(e,t,n){return I(e,V(t,n))}function X(e,t){return"function"==typeof e?e(t):e}function Y(e){return e.split("-")[0]}function G(e){return e.split("-")[1]}function Q(e){return"x"===e?"y":"x"}function ee(e){return"y"===e?"height":"width"}function te(e){return["top","bottom"].includes(Y(e))?"y":"x"}function ne(e){return Q(te(e))}function re(e){return e.replace(/start|end/g,(e=>K[e]))}function oe(e){return e.replace(/left|right|bottom|top/g,(e=>J[e]))}function ie(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 se(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function ae(e,t,n){let{reference:r,floating:o}=e;const i=te(t),s=ne(t),a=ee(s),l=Y(t),c="y"===i,f=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let d;switch(l){case"top":d={x:f,y:r.y-o.height};break;case"bottom":d={x:f,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:u};break;case"left":d={x:r.x-o.width,y:u};break;default:d={x:r.x,y:r.y}}switch(G(t)){case"start":d[s]-=p*(n&&c?-1:1);break;case"end":d[s]+=p*(n&&c?-1:1)}return d}async function le(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:p=!1,padding:d=0}=X(t,e),h=ie(d),g=a[p?"floating"===u?"reference":"floating":u],y=se(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:f,strategy:l})),m="floating"===u?{...s.floating,x:r,y:o}:s.reference,v=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),b=await(null==i.isElement?void 0:i.isElement(v))&&await(null==i.getScale?void 0:i.getScale(v))||{x:1,y:1},w=se(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:m,offsetParent:v,strategy:l}):m);return{top:(y.top-w.top+h.top)/b.y,bottom:(w.bottom-y.bottom+h.bottom)/b.y,left:(y.left-w.left+h.left)/b.x,right:(w.right-y.right+h.right)/b.x}}function ce(e){const t=V(...e.map((e=>e.left))),n=V(...e.map((e=>e.top)));return{x:t,y:n,width:I(...e.map((e=>e.right)))-t,height:I(...e.map((e=>e.bottom)))-n}}const fe=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=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)),s=Y(n),a=G(n),l="y"===te(n),c=["left","top"].includes(s)?-1:1,f=i&&l?-1:1,u=X(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return a&&"number"==typeof h&&(d="end"===a?-1*h:h),l?{x:d*f,y:p*c}:{x:p*c,y:d*f}}(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}};function ue(e){const t=M(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=A(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=H(n)!==i||H(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function pe(e){return R(e)?e:e.contextElement}function de(e){const t=pe(e);if(!A(t))return Z(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ue(t);let s=(i?H(n.width):n.width)/r,a=(i?H(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const he=Z(0);function ge(e){const t=j(e);return D()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:he}function ye(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=pe(e);let s=Z(1);t&&(r?R(r)&&(s=de(r)):s=de(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==j(e))&&t}(i,n,r)?ge(i):Z(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,f=o.width/s.x,u=o.height/s.y;if(i){const e=j(i),t=r&&R(r)?j(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=de(o),t=o.getBoundingClientRect(),r=M(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,f*=e.x,u*=e.y,l+=i,c+=s,n=j(o),o=n.frameElement}}return se({width:f,height:u,x:l,y:c})}const me=[":popover-open",":modal"];function ve(e){return me.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function be(e){return ye(E(e)).left+F(e).scrollLeft}function we(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=j(e),r=E(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const e=D();(!e||e&&"fixed"===t)&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}(e,n);else if("document"===t)r=function(e){const t=E(e),n=F(e),r=e.ownerDocument.body,o=I(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=I(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+be(e);const a=-n.scrollTop;return"rtl"===M(r).direction&&(s+=I(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}(E(e));else if(R(t))r=function(e,t){const n=ye(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=A(e)?de(e):Z(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=ge(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return se(r)}function xe(e,t){const n=B(e);return!(n===t||!R(n)||z(n))&&("fixed"===M(n).position||xe(n,t))}function Oe(e,t,n){const r=A(t),o=E(t),i="fixed"===n,s=ye(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Z(0);if(r||!r&&!i)if(("body"!==k(t)||T(o))&&(a=F(t)),r){const e=ye(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=be(o));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function _e(e,t){return A(e)&&"fixed"!==M(e).position?t?t(e):e.offsetParent:null}function Pe(e,t){const n=j(e);if(!A(e)||ve(e))return n;let r=_e(e,t);for(;r&&N(r)&&"static"===M(r).position;)r=_e(r,t);return r&&("html"===k(r)||"body"===k(r)&&"static"===M(r).position&&!L(r))?n:r||function(e){let t=B(e);for(;A(t)&&!z(t);){if(L(t))return t;t=B(t)}return null}(e)||n}const ke={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,s=E(r),a=!!t&&ve(t.floating);if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Z(1);const f=Z(0),u=A(r);if((u||!u&&!i)&&(("body"!==k(r)||T(s))&&(l=F(r)),A(r))){const e=ye(r);c=de(r),f.x=e.x+r.clientLeft,f.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+f.x,y:n.y*c.y-l.scrollTop*c.y+f.y}},getDocumentElement:E,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=W(e,[],!1).filter((e=>R(e)&&"body"!==k(e))),o=null;const i="fixed"===M(e).position;let s=i?B(e):e;for(;R(s)&&!z(s);){const t=M(s),n=L(s);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||T(s)&&!n&&xe(e,s))?r=r.filter((e=>e!==s)):o=t,s=B(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=i[0],a=i.reduce(((e,n)=>{const r=we(t,n,o);return e.top=I(r.top,e.top),e.right=V(r.right,e.right),e.bottom=V(r.bottom,e.bottom),e.left=I(r.left,e.left),e}),we(t,s,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Pe,getElementRects:async function(e){const t=this.getOffsetParent||Pe,n=this.getDimensions;return{reference:Oe(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}=ue(e);return{width:t,height:n}},getScale:de,isElement:R,isRTL:function(e){return"rtl"===M(e).direction}};function je(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=pe(e),f=o||i?[...c?W(c):[],...W(t)]:[];f.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=c&&a?function(e,t){let n,r=null;const o=E(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function s(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),i();const{left:c,top:f,width:u,height:p}=e.getBoundingClientRect();if(a||t(),!u||!p)return;const d={rootMargin:-$(f)+"px "+-$(o.clientWidth-(c+u))+"px "+-$(o.clientHeight-(f+p))+"px "+-$(c)+"px",threshold:I(0,V(1,l))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return s();t?s(!1,t):n=setTimeout((()=>{s(!1,1e-7)}),100)}h=!1}try{r=new IntersectionObserver(g,{...d,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,d)}r.observe(e)}(!0),i}(c,n):null;let p,d=-1,h=null;s&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!l&&h.observe(c),h.observe(t));let g=l?ye(e):null;return l&&function t(){const r=ye(e);!g||r.x===g.x&&r.y===g.y&&r.width===g.width&&r.height===g.height||n();g=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==u||u(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const Ee=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:s=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=X(e,t),c={x:n,y:r},f=await le(t,l),u=te(Y(o)),p=Q(u);let d=c[p],h=c[u];if(i){const e="y"===p?"bottom":"right";d=U(d+f["y"===p?"top":"left"],d,d-f[e])}if(s){const e="y"===u?"bottom":"right";h=U(h+f["y"===u?"top":"left"],h,h-f[e])}const g=a.fn({...t,[p]:d,[u]:h});return{...g,data:{x:g.x-n,y:g.y-r}}}}},Se=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...y}=X(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const m=Y(o),v=Y(a)===a,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(v||!g?[oe(a)]:function(e){const t=oe(e);return[re(e),t,re(t)]}(a));p||"none"===h||w.push(...function(e,t,n,r){const o=G(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}(Y(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(re)))),i}(a,g,h,b));const x=[a,...w],O=await le(t,y),_=[];let P=(null==(r=i.flip)?void 0:r.overflows)||[];if(f&&_.push(O[m]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=G(e),o=ne(e),i=ee(o);let s="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=oe(s)),[s,oe(s)]}(o,s,b);_.push(O[e[0]],O[e[1]])}if(P=[...P,{placement:o,overflows:_}],!_.every((e=>e<=0))){var k,j;const e=((null==(k=i.flip)?void 0:k.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:P},reset:{placement:t}};let n=null==(j=P.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:j.placement;if(!n)switch(d){case"bestFit":{var E;const e=null==(E=P.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:E[0];e&&(n=e);break}case"initialPlacement":n=a}if(o!==n)return{reset:{placement:n}}}return{}}}},Re=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:s}=t,{padding:a=2,x:l,y:c}=X(e,t),f=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),u=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=>se(ce(e))))}(f),p=se(ce(f)),d=ie(a);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=l&&null!=c)return u.find((e=>l>e.left-d.left&&l<e.right+d.right&&c>e.top-d.top&&c<e.bottom+d.bottom))||p;if(u.length>=2){if("y"===te(n)){const e=u[0],t=u[u.length-1],r="top"===Y(n),o=e.top,i=t.bottom,s=r?e.left:t.left,a=r?e.right:t.right;return{top:o,bottom:i,left:s,right:a,width:a-s,height:i-o,x:s,y:o}}const e="left"===Y(n),t=I(...u.map((e=>e.right))),r=V(...u.map((e=>e.left))),o=u.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,s=o[o.length-1].bottom;return{top:i,bottom:s,left:r,right:t,width:t-r,height:s-i,x:r,y:i}}return p}},floating:r.floating,strategy:s});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}}:{}}}},Ae=(e,t,n)=>{const r=new Map,o={platform:ke,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:u}=ae(c,r,l),p=r,d={},h=0;for(let n=0;n<a.length;n++){const{name:i,fn:g}=a[n],{x:y,y:m,data:v,reset:b}=await g({x:f,y:u,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:c,platform:s,elements:{reference:e,floating:t}});f=null!=y?y:f,u=null!=m?m:u,d={...d,[i]:{...d[i],...v}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(p=b.placement),b.rects&&(c=!0===b.rects?await s.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:f,y:u}=ae(c,p,l))),n=-1)}return{x:f,y:u,placement:p,strategy:o,middlewareData:d}})(e,t,{...o,platform:i})};var Ce="undefined"!=typeof document?d:h;function Te(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(!Te(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)&&!Te(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ne(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Le(e,t){const n=Ne(e);return Math.round(t*n)/n}function De(e){const t=f.useRef(e);return Ce((()=>{t.current=e})),t}const ze=f["useInsertionEffect".toString()]||(e=>e());var Me="undefined"!=typeof document?d:h;let Fe=!1,Be=0;const qe=()=>"floating-ui-"+Be++;const We=f["useId".toString()]||function(){const[e,t]=f.useState((()=>Fe?qe():void 0));return Me((()=>{null==e&&t(qe())}),[]),f.useEffect((()=>{Fe||(Fe=!0)}),[]),e};const Ve=f.createContext(null),Ie=f.createContext(null);function He(e){const t=g(e);return Me((()=>{t.current=e})),t}function $e(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:o}=e,[i,s]=f.useState(null),a=(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:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,p]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=f.useState(r);Te(d,r)||h(r);const[g,y]=f.useState(null),[v,b]=f.useState(null),w=f.useCallback((e=>{e!==P.current&&(P.current=e,y(e))}),[]),x=f.useCallback((e=>{e!==k.current&&(k.current=e,b(e))}),[]),O=i||g,_=s||v,P=f.useRef(null),k=f.useRef(null),j=f.useRef(u),E=null!=l,S=De(l),R=De(o),A=f.useCallback((()=>{if(!P.current||!k.current)return;const e={placement:t,strategy:n,middleware:d};R.current&&(e.platform=R.current),Ae(P.current,k.current,e).then((e=>{const t={...e,isPositioned:!0};C.current&&!Te(j.current,t)&&(j.current=t,m.flushSync((()=>{p(t)})))}))}),[d,t,n,R]);Ce((()=>{!1===c&&j.current.isPositioned&&(j.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[c]);const C=f.useRef(!1);Ce((()=>(C.current=!0,()=>{C.current=!1})),[]),Ce((()=>{if(O&&(P.current=O),_&&(k.current=_),O&&_){if(S.current)return S.current(O,_,A);A()}}),[O,_,A,S,E]);const T=f.useMemo((()=>({reference:P,floating:k,setReference:w,setFloating:x})),[w,x]),N=f.useMemo((()=>({reference:O,floating:_})),[O,_]),L=f.useMemo((()=>{const e={position:n,left:0,top:0};if(!N.floating)return e;const t=Le(N.floating,u.x),r=Le(N.floating,u.y);return a?{...e,transform:"translate("+t+"px, "+r+"px)",...Ne(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,a,N.floating,u.x,u.y]);return f.useMemo((()=>({...u,update:A,refs:T,elements:N,floatingStyles:L})),[u,A,T,N,L])}(e),c=f.useContext(Ie),u=null!=((null==(p=f.useContext(Ve))?void 0:p.id)||null);var p;const d=function(e){const t=f.useRef((()=>{}));return ze((()=>{t.current=e})),f.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&&(g.current.openEvent=t),y.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==r||r(e,t,n)})),h=f.useRef(null),g=f.useRef({}),y=f.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],v=We(),b=f.useCallback((e=>{const t=R(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l.refs.setReference(t)}),[l.refs]),w=f.useCallback((e=>{(R(e)||null===e)&&(h.current=e,s(e)),(R(l.refs.reference.current)||null===l.refs.reference.current||null!==e&&!R(e))&&l.refs.setReference(e)}),[l.refs]),x=f.useMemo((()=>({...l.refs,setReference:w,setPositionReference:b,domReference:h})),[l.refs,w,b]),O=f.useMemo((()=>({...l.elements,domReference:a})),[l.elements,a]),_=f.useMemo((()=>({...l,refs:x,elements:O,dataRef:g,nodeId:o,floatingId:v,events:y,open:n,onOpenChange:d})),[l,o,v,y,n,d,x,O]);return Me((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===o));e&&(e.context=_)})),f.useMemo((()=>({...l,context:_,refs:x,elements:O})),[l,x,O,_])}const Ze=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Je(e,t){return"function"==typeof e?e(t):e}function Ke(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("number"==typeof o?o:o.close)||0,[s,a]=f.useState(!1),[l,c]=f.useState("unmounted"),u=function(e,t){const[n,r]=f.useState(e);return e&&!n&&r(!0),f.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,i);return Me((()=>{s&&!u&&c("unmounted")}),[s,u]),Me((()=>{if(r){if(n){c("initial");const e=requestAnimationFrame((()=>{c("open")}));return()=>{cancelAnimationFrame(e)}}a(!0),c("close")}}),[n,r]),{isMounted:u,status:l}}function Ue(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:s=250}=t,a=e.placement,l=a.split("-")[0],c=f.useMemo((()=>({side:l,placement:a})),[l,a]),u="number"==typeof s,p=(u?s:s.open)||0,d=(u?s:s.close)||0,[h,g]=f.useState((()=>({...Je(i,c),...Je(n,c)}))),{isMounted:y,status:m}=Ke(e,{duration:s}),v=He(n),b=He(r),w=He(o),x=He(i);return Me((()=>{const e=Je(v.current,c),t=Je(w.current,c),n=Je(x.current,c),r=Je(b.current,c)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===m&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===m&&g({transitionProperty:Object.keys(r).map(Ze).join(","),transitionDuration:p+"ms",...n,...r}),"close"===m){const r=t||e;g({transitionProperty:Object.keys(r).map(Ze).join(","),transitionDuration:d+"ms",...n,...r})}}),[d,w,v,b,x,p,m,c]),{isMounted:y,styles:h}}
27
- /*!
28
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
29
- *
30
- * Copyright (c) 2014-2017, Jon Schlinkert.
31
- * Released under the MIT License.
32
- */function Xe(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ye(e){var t,n;return!1!==Xe(e)&&(void 0===(t=e.constructor)||!1!==Xe(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var Ge=Symbol.for("immer-nothing"),Qe=Symbol.for("immer-draftable"),et=Symbol.for("immer-state");function tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var nt=Object.getPrototypeOf;function rt(e){return!!e&&!!e[et]}function ot(e){return!!e&&(st(e)||Array.isArray(e)||!!e[Qe]||!!e.constructor?.[Qe]||ut(e)||pt(e))}var it=Object.prototype.constructor.toString();function st(e){if(!e||"object"!=typeof e)return!1;const t=nt(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)===it}function at(e,t){0===lt(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function lt(e){const t=e[et];return t?t.type_:Array.isArray(e)?1:ut(e)?2:pt(e)?3:0}function ct(e,t){return 2===lt(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ft(e,t,n){const r=lt(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ut(e){return e instanceof Map}function pt(e){return e instanceof Set}function dt(e){return e.copy_||e.base_}function ht(e,t){if(ut(e))return new Map(e);if(pt(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&st(e)){if(!nt(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[et];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(nt(e),n)}function gt(e,t=!1){return mt(e)||rt(e)||!ot(e)||(lt(e)>1&&(e.set=e.add=e.clear=e.delete=yt),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>gt(t,!0)))),e}function yt(){tt(2)}function mt(e){return Object.isFrozen(e)}var vt,bt={};function wt(e){const t=bt[e];return t||tt(0),t}function xt(){return vt}function Ot(e,t){t&&(wt("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function _t(e){Pt(e),e.drafts_.forEach(jt),e.drafts_=null}function Pt(e){e===vt&&(vt=e.parent_)}function kt(e){return vt={drafts_:[],parent_:vt,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function jt(e){const t=e[et];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Et(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[et].modified_&&(_t(t),tt(4)),ot(e)&&(e=St(t,e),t.parent_||At(t,e)),t.patches_&&wt("Patches").generateReplacementPatches_(n[et].base_,e,t.patches_,t.inversePatches_)):e=St(t,n,[]),_t(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ge?e:void 0}function St(e,t,n){if(mt(t))return t;const r=t[et];if(!r)return at(t,((o,i)=>Rt(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return At(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),at(o,((o,s)=>Rt(e,r,t,o,s,n,i))),At(e,t,!1),n&&e.patches_&&wt("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Rt(e,t,n,r,o,i,s){if(rt(o)){const s=St(e,o,i&&t&&3!==t.type_&&!ct(t.assigned_,r)?i.concat(r):void 0);if(ft(n,r,s),!rt(s))return;e.canAutoFreeze_=!1}else s&&n.add(o);if(ot(o)&&!mt(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;St(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||At(e,o)}}function At(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&gt(t,n)}var Ct={get(e,t){if(t===et)return e;const n=dt(e);if(!ct(n,t))return function(e,t,n){const r=Lt(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_||!ot(r)?r:r===Nt(e.base_,t)?(zt(e),e.copy_[t]=Mt(r,e)):r},has:(e,t)=>t in dt(e),ownKeys:e=>Reflect.ownKeys(dt(e)),set(e,t,n){const r=Lt(dt(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Nt(dt(e),t),s=r?.[et];if(s&&s.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||ct(e.base_,t)))return!0;zt(e),Dt(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!==Nt(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,zt(e),Dt(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=dt(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){tt(11)},getPrototypeOf:e=>nt(e.base_),setPrototypeOf(){tt(12)}},Tt={};function Nt(e,t){const n=e[et];return(n?dt(n):e)[t]}function Lt(e,t){if(!(t in e))return;let n=nt(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=nt(n)}}function Dt(e){e.modified_||(e.modified_=!0,e.parent_&&Dt(e.parent_))}function zt(e){e.copy_||(e.copy_=ht(e.base_,e.scope_.immer_.useStrictShallowCopy_))}at(Ct,((e,t)=>{Tt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Tt.deleteProperty=function(e,t){return Tt.set.call(this,e,t,void 0)},Tt.set=function(e,t,n){return Ct.set.call(this,e[0],t,n,e[0])};function Mt(e,t){const n=ut(e)?wt("MapSet").proxyMap_(e,t):pt(e)?wt("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:xt(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Ct;n&&(o=[r],i=Tt);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:xt()).drafts_.push(n),n}function Ft(e){if(!ot(e)||mt(e))return e;const t=e[et];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ht(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ht(e,!0);return at(n,((e,t)=>{ft(n,e,Ft(t))})),t&&(t.finalized_=!1),n}var Bt=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&&tt(6),void 0!==n&&"function"!=typeof n&&tt(7),ot(e)){const o=kt(this),i=Mt(e,void 0);let s=!0;try{r=t(i),s=!1}finally{s?_t(o):Pt(o)}return Ot(o,n),Et(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Ge&&(r=void 0),this.autoFreeze_&&gt(r,!0),n){const t=[],o=[];wt("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}tt(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){ot(e)||tt(8),rt(e)&&(e=function(e){rt(e)||tt(10);return Ft(e)}(e));const t=kt(this),n=Mt(e,void 0);return n[et].isManual_=!0,Pt(t),n}finishDraft(e,t){const n=e&&e[et];n&&n.isManual_||tt(9);const{scope_:r}=n;return Ot(r,t),Et(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=wt("Patches").applyPatches_;return rt(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},qt=Bt.produce;Bt.produceWithPatches.bind(Bt),Bt.setAutoFreeze.bind(Bt),Bt.setUseStrictShallowCopy.bind(Bt),Bt.applyPatches.bind(Bt);var Wt=Bt.createDraft.bind(Bt),Vt=Bt.finishDraft.bind(Bt),It={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=It.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],s=t[n];return It.equals(r,o)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return It.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],s=t[n];return It.equals(r,o)&&i<s},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===It.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===It.compare(e,t),isBefore:(e,t)=>-1===It.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===It.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===It.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===It.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===It.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]&&It.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(!It.isAncestor(t,e)&&!It.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;(It.equals(i,r)||It.endsBefore(i,r)||It.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:s}=t;if(It.equals(s,r)||It.isAncestor(s,r))return null;It.endsBefore(s,r)&&(r[s.length-1]-=1);break;case"merge_node":var{path:a,position:l}=t;It.equals(a,r)||It.endsBefore(a,r)?r[a.length-1]-=1:It.isAncestor(a,r)&&(r[a.length-1]-=1,r[a.length]+=l);break;case"split_node":var{path:c,position:f}=t;if(It.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else It.endsBefore(c,r)?r[c.length-1]+=1:It.isAncestor(c,r)&&e[c.length]>=f&&(r[c.length-1]+=1,r[c.length]-=f);break;case"move_node":var{path:u,newPath:p}=t;if(It.equals(u,p))return r;if(It.isAncestor(u,r)||It.equals(u,r)){var d=p.slice();return It.endsBefore(u,p)&&u.length<p.length&&(d[u.length-1]-=1),d.concat(r.slice(u.length))}It.isSibling(u,p)&&(It.isAncestor(p,r)||It.equals(p,r))?It.endsBefore(u,r)?r[u.length-1]-=1:r[u.length-1]+=1:It.endsBefore(p,r)||It.equals(p,r)||It.isAncestor(p,r)?(It.endsBefore(u,r)&&(r[u.length-1]-=1),r[p.length-1]+=1):It.endsBefore(u,r)&&(It.equals(p,r)&&(r[p.length-1]+=1),r[u.length-1]-=1)}return r}};function Ht(e){return Ht="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},Ht(e)}function $t(e){var t=function(e,t){if("object"!==Ht(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ht(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ht(t)?t:String(t)}function Zt(e,t,n){return(t=$t(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jt(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 Kt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jt(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ut={transform(e,t){e.children=Wt(e.children);var n=e.selection&&Wt(e.selection);try{n=((e,t,n)=>{switch(n.type){case"insert_node":var{path:r,node:o}=n,i=cn.parent(e,r),s=r[r.length-1];if(s>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(s,0,o),t)for(var[a,l]of nn.points(t))t[l]=mn.transform(a,n);break;case"insert_text":var{path:c,offset:f,text:u}=n;if(0===u.length)break;var p=cn.leaf(e,c),d=p.text.slice(0,f),h=p.text.slice(f);if(p.text=d+u+h,t)for(var[g,y]of nn.points(t))t[y]=mn.transform(g,n);break;case"merge_node":var{path:m}=n,v=cn.get(e,m),b=It.previous(m),w=cn.get(e,b),x=cn.parent(e,m),O=m[m.length-1];if(kn.isText(v)&&kn.isText(w))w.text+=v.text;else{if(kn.isText(v)||kn.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(m,"] to nodes of different interfaces: ").concat(bn.stringify(v)," ").concat(bn.stringify(w)));w.children.push(...v.children)}if(x.children.splice(O,1),t)for(var[_,P]of nn.points(t))t[P]=mn.transform(_,n);break;case"move_node":var{path:k,newPath:j}=n;if(It.isAncestor(k,j))throw new Error("Cannot move a path [".concat(k,"] to new path [").concat(j,"] because the destination is inside itself."));var E=cn.get(e,k),S=cn.parent(e,k),R=k[k.length-1];S.children.splice(R,1);var A=It.transform(k,n),C=cn.get(e,It.parent(A)),T=A[A.length-1];if(C.children.splice(T,0,E),t)for(var[N,L]of nn.points(t))t[L]=mn.transform(N,n);break;case"remove_node":var{path:D}=n,z=D[D.length-1];if(cn.parent(e,D).children.splice(z,1),t)for(var[M,F]of nn.points(t)){var B=mn.transform(M,n);if(null!=t&&null!=B)t[F]=B;else{var q=void 0,W=void 0;for(var[V,I]of cn.texts(e)){if(-1!==It.compare(I,D)){W=[V,I];break}q=[V,I]}var H=!1;q&&W&&(H=It.equals(W[1],D)?!It.hasPrevious(W[1]):It.common(q[1],D).length<It.common(W[1],D).length),q&&!H?(M.path=q[1],M.offset=q[0].text.length):W?(M.path=W[1],M.offset=0):t=null}}break;case"remove_text":var{path:$,offset:Z,text:J}=n;if(0===J.length)break;var K=cn.leaf(e,$),U=K.text.slice(0,Z),X=K.text.slice(Z+J.length);if(K.text=U+X,t)for(var[Y,G]of nn.points(t))t[G]=mn.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=cn.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:se}=n;if(null==se)t=se;else{if(null==t){if(!nn.isRange(se))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(bn.stringify(se)," when there is no current selection."));t=Kt({},se)}for(var ae in se){var le=se[ae];if(null==le){if("anchor"===ae||"focus"===ae)throw new Error('Cannot remove the "'.concat(ae,'" selection property'));delete t[ae]}else t[ae]=le}}break;case"split_node":var{path:ce,position:fe,properties:ue}=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 pe,de=cn.get(e,ce),he=cn.parent(e,ce),ge=ce[ce.length-1];if(kn.isText(de)){var ye=de.text.slice(0,fe),me=de.text.slice(fe);de.text=ye,pe=Kt(Kt({},ue),{},{text:me})}else{var ve=de.children.slice(0,fe),be=de.children.slice(fe);de.children=ve,pe=Kt(Kt({},ue),{},{children:be})}if(he.children.splice(ge+1,0,pe),t)for(var[we,xe]of nn.points(t))t[xe]=mn.transform(we,n)}return t})(e,n,t)}finally{e.children=Vt(e.children),e.selection=n?rt(n)?Vt(n):n:null}}},Xt={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)}},Yt={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)}},Gt=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(Ye(r)&&Ye(o)){if(!Gt(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 s in t)if(void 0===e[s]&&void 0!==t[s])return!1;return!0};function Qt(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 en=["anchor","focus"];function tn(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 nn={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return nn.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=nn.edges(e);return t},equals:(e,t)=>mn.equals(e.anchor,t.anchor)&&mn.equals(e.focus,t.focus),includes(e,t){if(nn.isRange(t)){if(nn.includes(e,t.anchor)||nn.includes(e,t.focus))return!0;var[n,r]=nn.edges(e),[o,i]=nn.edges(t);return mn.isBefore(n,o)&&mn.isAfter(r,i)}var[s,a]=nn.edges(e),l=!1,c=!1;return mn.isPoint(t)?(l=mn.compare(t,s)>=0,c=mn.compare(t,a)<=0):(l=It.compare(t,s.path)>=0,c=It.compare(t,a.path)<=0),l&&c},intersection(e,t){var n=Qt(e,en),[r,o]=nn.edges(e),[i,s]=nn.edges(t),a=mn.isBefore(r,i)?i:r,l=mn.isBefore(o,s)?o:s;return mn.isBefore(l,a)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tn(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({anchor:a,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return mn.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return mn.equals(t,n)},isExpanded:e=>!nn.isCollapsed(e),isForward:e=>!nn.isBackward(e),isRange:e=>Ye(e)&&mn.isPoint(e.anchor)&&mn.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=nn.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return qt(e,(e=>{if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var s=nn.isCollapsed(e);nn.isForward(e)?(r="forward",o=s?r:"backward"):(r="backward",o=s?r:"forward")}else"outward"===i?nn.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var a=mn.transform(e.anchor,t,{affinity:r}),l=mn.transform(e.focus,t,{affinity:o});if(!a||!l)return null;e.anchor=a,e.focus=l}))}},rn=e=>Ye(e)&&cn.isNodeList(e.children)&&!hn.isEditor(e),on={isAncestor:e=>Ye(e)&&cn.isNodeList(e.children),isElement:rn,isElementList:e=>Array.isArray(e)&&e.every((e=>on.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 rn(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},sn=["children"],an=["text"],ln=new WeakMap,cn={ancestor(e,t){var n=cn.get(e,t);if(kn.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(bn.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of It.ancestors(t,n)){var o=[cn.ancestor(e,r),r];yield o}}()},child(e,t){if(kn.isText(e))throw new Error("Cannot get the child of a text node: ".concat(bn.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(bn.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=cn.ancestor(e,t),{children:i}=o,s=r?i.length-1:0;r?s>=0:s<i.length;){var a=cn.child(o,s),l=t.concat(s);yield[a,l],s=r?s-1:s+1}}()},common(e,t,n){var r=It.common(t,n);return[cn.get(e,r),r]},descendant(e,t){var n=cn.get(e,t);if(hn.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(bn.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of cn.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 cn.nodes(e,t))on.isElement(n)&&(yield[n,r])}()},extractProps:e=>on.isAncestor(e)?Qt(e,sn):Qt(e,an),first(e,t){for(var n=t.slice(),r=cn.get(e,n);r&&!kn.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(kn.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(bn.stringify(e)));var n=qt({children:e.children},(e=>{var[n,r]=nn.edges(t),o=cn.nodes(e,{reverse:!0,pass:e=>{var[,n]=e;return!nn.includes(t,n)}});for(var[,i]of o){if(!nn.includes(t,i)){var s=cn.parent(e,i),a=i[i.length-1];s.children.splice(a,1)}if(It.equals(i,r.path)){var l=cn.leaf(e,i);l.text=l.text.slice(0,r.offset)}if(It.equals(i,n.path)){var c=cn.leaf(e,i);c.text=c.text.slice(n.offset)}}hn.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(kn.isText(n)||!n.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(bn.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(kn.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode:e=>kn.isText(e)||on.isElement(e)||hn.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=ln.get(e);if(void 0!==t)return t;var n=e.every((e=>cn.isNode(e)));return ln.set(e,n),n},last(e,t){for(var n=t.slice(),r=cn.get(e,n);r&&!kn.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=cn.get(e,t);if(!kn.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(bn.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of It.levels(t,n)){var o=cn.get(e,r);yield[o,r]}}()},matches:(e,t)=>on.isElement(e)&&on.isElementProps(t)&&on.matches(e,t)||kn.isText(e)&&kn.isTextProps(t)&&kn.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,s=new Set,a=[],l=e;!i||!(r?It.isBefore(a,i):It.isAfter(a,i));)if(s.has(l)||(yield[l,a]),s.has(l)||kn.isText(l)||0===l.children.length||null!=n&&!1!==n([l,a])){if(0===a.length)break;if(!r){var c=It.next(a);if(cn.has(e,c)){a=c,l=cn.get(e,a);continue}}if(r&&0!==a[a.length-1])a=It.previous(a),l=cn.get(e,a);else a=It.parent(a),l=cn.get(e,a),s.add(l)}else{s.add(l);var f=r?l.children.length-1:0;It.isAncestor(a,o)&&(f=o[a.length]),a=a.concat(f),l=cn.get(e,a)}}()},parent(e,t){var n=It.parent(t),r=cn.get(e,n);if(kn.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=>kn.isText(e)?e.text:e.children.map(cn.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of cn.nodes(e,t))kn.isText(n)&&(yield[n,r])}()}};function fn(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 un(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var pn={isNodeOperation:e=>pn.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!Ye(e))return!1;switch(e.type){case"insert_node":case"remove_node":return It.isPath(e.path)&&cn.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&It.isPath(e.path);case"merge_node":return"number"==typeof e.position&&It.isPath(e.path)&&Ye(e.properties);case"move_node":return It.isPath(e.path)&&It.isPath(e.newPath);case"set_node":return It.isPath(e.path)&&Ye(e.properties)&&Ye(e.newProperties);case"set_selection":return null===e.properties&&nn.isRange(e.newProperties)||null===e.newProperties&&nn.isRange(e.properties)||Ye(e.properties)&&Ye(e.newProperties);case"split_node":return It.isPath(e.path)&&"number"==typeof e.position&&Ye(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>pn.isOperation(e))),isSelectionOperation:e=>pn.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>pn.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return un(un({},e),{},{type:"remove_node"});case"insert_text":return un(un({},e),{},{type:"remove_text"});case"merge_node":return un(un({},e),{},{type:"split_node",path:It.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(It.equals(t,n))return e;if(It.isSibling(n,t))return un(un({},e),{},{path:t,newPath:n});var r=It.transform(n,e),o=It.transform(It.next(n),e);return un(un({},e),{},{path:r,newPath:o});case"remove_node":return un(un({},e),{},{type:"insert_node"});case"remove_text":return un(un({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:s}=e;return un(un({},e),{},{properties:s,newProperties:i});case"set_selection":var{properties:a,newProperties:l}=e;return un(un({},e),{},null==a?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:a}:{properties:l,newProperties:a});case"split_node":return un(un({},e),{},{type:"merge_node",path:It.next(e.path)})}}},dn=new WeakMap,hn={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=dn.get(e);if(void 0!==t)return t;if(!Ye(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||Ye(e.marks))&&(null===e.selection||nn.isRange(e.selection))&&cn.isNodeList(e.children)&&pn.isOperationList(e.operations);return dn.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 gn(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 yn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gn(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var mn={compare(e,t){var n=It.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===mn.compare(e,t),isBefore:(e,t)=>-1===mn.compare(e,t),equals:(e,t)=>e.offset===t.offset&&It.equals(e.path,t.path),isPoint:e=>Ye(e)&&"number"==typeof e.offset&&It.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return qt(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=It.transform(o,t,n);break;case"insert_text":It.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(e.offset+=t.text.length);break;case"merge_node":It.equals(t.path,o)&&(e.offset+=t.position),e.path=It.transform(o,t,n);break;case"remove_text":It.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(It.equals(t.path,o)||It.isAncestor(t.path,o))return null;e.path=It.transform(o,t,n);break;case"split_node":if(It.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=It.transform(o,t,yn(yn({},n),{},{affinity:"forward"})))}else e.path=It.transform(o,t,n)}}))}},vn=void 0,bn={setScrubber(e){vn=e},stringify:e=>JSON.stringify(e,vn)},wn=["text"],xn=["anchor","focus"];function On(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 _n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?On(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):On(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Pn,kn={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return Qt(e,wn)}return Gt(r?o(e):e,r?o(t):t)},isText:e=>Ye(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>kn.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=[_n({},e)];for(var r of t){var o=Qt(r,xn),[i,s]=nn.edges(r),a=[],l=0,c=i.offset,f=s.offset;for(var u of n){var{length:p}=u.text,d=l;if(l+=p,c<=d&&l<=f)Object.assign(u,o),a.push(u);else if(c!==f&&(c===l||f===d)||c>l||f<d||f===d&&0!==d)a.push(u);else{var h=u,g=void 0,y=void 0;if(f<l){var m=f-d;y=_n(_n({},h),{},{text:h.text.slice(m)}),h=_n(_n({},h),{},{text:h.text.slice(0,m)})}if(c>d){var v=c-d;g=_n(_n({},h),{},{text:h.text.slice(0,v)}),h=_n(_n({},h),{},{text:h.text.slice(v)})}Object.assign(h,o),g&&a.push(g),a.push(h),y&&a.push(y)}}n=a}return n}},jn=e=>e.selection?e.selection:e.children.length>0?hn.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"}(Pn||(Pn={})),Pn.L,Pn.L,Pn.V,Pn.LV,Pn.LVT,Pn.LV,Pn.V,Pn.V,Pn.T,Pn.LVT,Pn.T,Pn.T,Pn.Any,Pn.Extend,Pn.ZWJ,Pn.Any,Pn.SpacingMark,Pn.Prepend,Pn.Any,Pn.ZWJ,Pn.ExtPict,Pn.RI,Pn.RI;var En={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]:{};hn.withoutNormalizing(e,(()=>{var{voids:r=!1}=n,{at:o=jn(e)}=n;if(It.isPath(o)&&(o=hn.range(e,o)),nn.isRange(o))if(nn.isCollapsed(o))o=o.anchor;else{var i=nn.end(o);if(!r&&hn.void(e,{at:i}))return;var s=nn.start(o),a=hn.pointRef(e,s),l=hn.pointRef(e,i);An.delete(e,{at:o,voids:r});var c=a.unref(),f=l.unref();o=c||f,An.setSelection(e,{anchor:o,focus:o})}if(!(!r&&hn.void(e,{at:o})||hn.elementReadOnly(e,{at:o}))){var{path:u,offset:p}=o;t.length>0&&e.apply({type:"insert_text",path:u,offset:p,text:t})}}))}};function Sn(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 Rn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sn(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var An=Rn(Rn(Rn(Rn({},Ut),Xt),Yt),En);const{Overlay:Cn,Portal:Tn}=n,Nn=({style:n,setFloating:i,element:s,setHoldLinkTool:a,blockId:f,onClose:u})=>{const p=e(),d=t(),[h,g]=y(!1),{refs:m,floatingStyles:v,context:b}=$e({placement:"bottom",open:h,onOpenChange:e=>{g(e)},middleware:[Re(),Se(),Ee(),fe(10)],whileElementsMounted:je}),{isMounted:w,styles:x}=Ue(b,{duration:{open:100,close:100}}),O=Object.assign(Object.assign(Object.assign({},v),x),{maxWidth:400}),k=null==d?void 0:d.LinkTool,j=!!k;return l(Tn,Object.assign({id:"yoopta-link-preview"},{children:[w&&j&&c(Tn,Object.assign({id:"yoopta-link-tool"},{children:c(Cn,Object.assign({lockScroll:!0,className:"yoo-link-z-[100]",onClick:u},{children:c("div",Object.assign({ref:m.setFloating,style:O,onClick:e=>e.stopPropagation()},{children:c(k,{editor:p,link:s.props,onSave:e=>{r.updateElement(p,f,{type:s.type,props:Object.assign(Object.assign({},s.props),e)}),g(!1),u()},onDelete:()=>{const e=o(p),t=r.getElementPath(p,f,s);if(!e)return;const n=r.getElementEntry(p,f,{path:t,type:s.type});n&&An.unwrapNodes(e,{match:e=>!hn.isEditor(e)&&on.isElement(e)&&e.type===s.type,at:t||(null==n?void 0:n[1])})},withTitle:!1})}))}))})),l("div",Object.assign({className:"yoopta-link-preview",style:n,ref:i},{children:[c("span",Object.assign({className:"yoopta-link-preview-text"},{children:s.props.url})),c("span",{className:"yoopta-link-preview-separator"}),c("button",Object.assign({type:"button",onClick:()=>{navigator.clipboard.writeText(s.props.url)},className:"yoopta-button"},{children:c(_,{size:14,strokeWidth:1})})),c("span",{className:"yoopta-link-preview-separator"}),c("button",Object.assign({type:"button",onClick:()=>{window.open(s.props.url,s.props.target||"_self")},className:"yoopta-button"},{children:c(P,{size:14,strokeWidth:1})})),c("span",{className:"yoopta-link-preview-separator"}),c("button",Object.assign({ref:m.setReference,type:"button",className:"yoopta-button yoopta-link-edit-button",onClick:()=>{a((e=>!e)),g((e=>!e))}},{children:"Edit"}))]}))]}))},Ln=["_blank","_self","_parent","_top","framename"],Dn=new s({type:"LinkPlugin",elements:{link:{render:e=>{var{extendRender:t}=e,n=v(e,["extendRender"]);const[r,o]=y(!1),[s,a]=y(!1),f=n.HTMLAttributes||{},{className:u=""}=f,p=v(f,["className"]),{refs:d,floatingStyles:h,context:g}=$e({placement:"bottom",open:r,onOpenChange:o,middleware:[Re(),Se(),Ee(),fe(0)],whileElementsMounted:je}),{isMounted:m,styles:b}=Ue(g,{duration:{open:200,close:100}}),w=Object.assign(Object.assign({},h),b),{url:x,target:O="",rel:_}=n.element.props||{},P=i(),k={rel:_,target:O};Ln.includes(O)||delete k.target,"string"==typeof _&&0!==(null==_?void 0:_.length)||delete k.rel;const j=()=>{a(!1),o(!1)};return l("span",Object.assign({ref:d.setReference,onMouseOver:()=>{o(!0)},onMouseOut:()=>{s||j()}},{children:[t?t(n):c("a",Object.assign({},k,p,n.attributes,{draggable:!1,href:x||"",className:`yoopta-link ${u}`},{children:n.children})),m&&!P&&c(Nn,{style:w,setFloating:d.setFloating,element:n.element,setHoldLinkTool:a,onClose:j,blockId:n.blockId})]}))},props:{url:null,target:"_self",rel:"noopener noreferrer",nodeType:"inline",title:null}}},options:{display:{title:"Link",description:"Create link"}},parsers:{html:{serialize:(e,t)=>{const{url:n,target:r,rel:o,title:i}=e.props;return`<a href="${n}" target="${r}" rel="${o}">${i||t}</a>`},deserialize:{nodeNames:["A"],parse:(e,t)=>{if("A"===e.nodeName){const n=e.getAttribute("href")||"",r=t.plugins.LinkPlugin.elements.link.props,o=e.getAttribute("target")||r.target,i=e.getAttribute("rel")||r.rel,s=e.textContent||"",l={url:n,target:o,rel:i,title:s,nodeType:"inline"};return{id:a(),type:"link",props:l,children:[{text:s}]}}}}}}});!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-link-z-\\[100\\]{z-index:100}.yoopta-link{--tw-text-opacity:1;color:rgb(0 122 255/var(--tw-text-opacity));cursor:pointer;position:relative;text-decoration-line:underline;text-underline-offset:4px}.yoopta-link:hover{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity))}.yoopta-link-preview{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(227 227 227/var(--tw-border-opacity));border-radius:.375rem;border-style:solid;border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);display:flex;padding:6px;z-index:50}.yoopta-link-preview-text{font-size:.875rem;line-height:1.25rem;max-width:200px;overflow:hidden;text-overflow:ellipsis;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.yoopta-link-preview-separator{--tw-bg-opacity:1;background-color:rgb(227 227 227/var(--tw-bg-opacity));height:20px;margin-left:5px;margin-right:5px;width:1px}.yoopta-link-edit-button{cursor:pointer;font-size:.875rem;line-height:1.25rem}");export{Dn as default};
32
+ */function lt(e){return ut(e)?(e.nodeName||"").toLowerCase():"#document"}function ct(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function ft(e){var t;return null==(t=(ut(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ut(e){return e instanceof Node||e instanceof ct(e).Node}function pt(e){return e instanceof Element||e instanceof ct(e).Element}function dt(e){return e instanceof HTMLElement||e instanceof ct(e).HTMLElement}function ht(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof ct(e).ShadowRoot)}function gt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=wt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function yt(e){return["table","td","th"].includes(lt(e))}function mt(e){const t=vt(),n=wt(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 vt(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function bt(e){return["html","body","#document"].includes(lt(e))}function wt(e){return ct(e).getComputedStyle(e)}function xt(e){return pt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ot(e){if("html"===lt(e))return e;const t=e.assignedSlot||e.parentNode||ht(e)&&e.host||ft(e);return ht(t)?t.host:t}function _t(e){const t=Ot(e);return bt(t)?e.ownerDocument?e.ownerDocument.body:e.body:dt(t)&&gt(t)?t:_t(t)}function Pt(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=_t(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),s=ct(o);return i?t.concat(s,s.visualViewport||[],gt(o)?o:[],s.frameElement&&n?Pt(s.frameElement):[]):t.concat(o,Pt(o,[],n))}const kt=Math.min,jt=Math.max,Et=Math.round,St=Math.floor,Rt=e=>({x:e,y:e}),At={left:"right",right:"left",bottom:"top",top:"bottom"},Tt={start:"end",end:"start"};function Ct(e,t,n){return jt(e,kt(t,n))}function Nt(e,t){return"function"==typeof e?e(t):e}function Lt(e){return e.split("-")[0]}function Dt(e){return e.split("-")[1]}function zt(e){return"x"===e?"y":"x"}function Mt(e){return"y"===e?"height":"width"}function Ft(e){return["top","bottom"].includes(Lt(e))?"y":"x"}function Bt(e){return zt(Ft(e))}function qt(e){return e.replace(/start|end/g,(e=>Tt[e]))}function Wt(e){return e.replace(/left|right|bottom|top/g,(e=>At[e]))}function Vt(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 It(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function Ht(e,t,n){let{reference:r,floating:o}=e;const i=Ft(t),s=Bt(t),a=Mt(s),l=Lt(t),c="y"===i,f=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let d;switch(l){case"top":d={x:f,y:r.y-o.height};break;case"bottom":d={x:f,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:u};break;case"left":d={x:r.x-o.width,y:u};break;default:d={x:r.x,y:r.y}}switch(Dt(t)){case"start":d[s]-=p*(n&&c?-1:1);break;case"end":d[s]+=p*(n&&c?-1:1)}return d}async function $t(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:p=!1,padding:d=0}=Nt(t,e),h=Vt(d),g=a[p?"floating"===u?"reference":"floating":u],y=It(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:f,strategy:l})),m="floating"===u?{...s.floating,x:r,y:o}:s.reference,v=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),b=await(null==i.isElement?void 0:i.isElement(v))&&await(null==i.getScale?void 0:i.getScale(v))||{x:1,y:1},w=It(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:m,offsetParent:v,strategy:l}):m);return{top:(y.top-w.top+h.top)/b.y,bottom:(w.bottom-y.bottom+h.bottom)/b.y,left:(y.left-w.left+h.left)/b.x,right:(w.right-y.right+h.right)/b.x}}function Zt(e){const t=kt(...e.map((e=>e.left))),n=kt(...e.map((e=>e.top)));return{x:t,y:n,width:jt(...e.map((e=>e.right)))-t,height:jt(...e.map((e=>e.bottom)))-n}}const Jt=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=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)),s=Lt(n),a=Dt(n),l="y"===Ft(n),c=["left","top"].includes(s)?-1:1,f=i&&l?-1:1,u=Nt(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return a&&"number"==typeof h&&(d="end"===a?-1*h:h),l?{x:d*f,y:p*c}:{x:p*c,y:d*f}}(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}};function Kt(e){const t=wt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=dt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Et(n)!==i||Et(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Ut(e){return pt(e)?e:e.contextElement}function Xt(e){const t=Ut(e);if(!dt(t))return Rt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Kt(t);let s=(i?Et(n.width):n.width)/r,a=(i?Et(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const Yt=Rt(0);function Gt(e){const t=ct(e);return vt()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Yt}function Qt(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Ut(e);let s=Rt(1);t&&(r?pt(r)&&(s=Xt(r)):s=Xt(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==ct(e))&&t}(i,n,r)?Gt(i):Rt(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,f=o.width/s.x,u=o.height/s.y;if(i){const e=ct(i),t=r&&pt(r)?ct(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=Xt(o),t=o.getBoundingClientRect(),r=wt(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,f*=e.x,u*=e.y,l+=i,c+=s,n=ct(o),o=n.frameElement}}return It({width:f,height:u,x:l,y:c})}const en=[":popover-open",":modal"];function tn(e){return en.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function nn(e){return Qt(ft(e)).left+xt(e).scrollLeft}function rn(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=ct(e),r=ft(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const e=vt();(!e||e&&"fixed"===t)&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}(e,n);else if("document"===t)r=function(e){const t=ft(e),n=xt(e),r=e.ownerDocument.body,o=jt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=jt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+nn(e);const a=-n.scrollTop;return"rtl"===wt(r).direction&&(s+=jt(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}(ft(e));else if(pt(t))r=function(e,t){const n=Qt(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=dt(e)?Xt(e):Rt(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=Gt(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return It(r)}function on(e,t){const n=Ot(e);return!(n===t||!pt(n)||bt(n))&&("fixed"===wt(n).position||on(n,t))}function sn(e,t,n){const r=dt(t),o=ft(t),i="fixed"===n,s=Qt(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Rt(0);if(r||!r&&!i)if(("body"!==lt(t)||gt(o))&&(a=xt(t)),r){const e=Qt(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=nn(o));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function an(e,t){return dt(e)&&"fixed"!==wt(e).position?t?t(e):e.offsetParent:null}function ln(e,t){const n=ct(e);if(!dt(e)||tn(e))return n;let r=an(e,t);for(;r&&yt(r)&&"static"===wt(r).position;)r=an(r,t);return r&&("html"===lt(r)||"body"===lt(r)&&"static"===wt(r).position&&!mt(r))?n:r||function(e){let t=Ot(e);for(;dt(t)&&!bt(t);){if(mt(t))return t;t=Ot(t)}return null}(e)||n}const cn={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,s=ft(r),a=!!t&&tn(t.floating);if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Rt(1);const f=Rt(0),u=dt(r);if((u||!u&&!i)&&(("body"!==lt(r)||gt(s))&&(l=xt(r)),dt(r))){const e=Qt(r);c=Xt(r),f.x=e.x+r.clientLeft,f.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+f.x,y:n.y*c.y-l.scrollTop*c.y+f.y}},getDocumentElement:ft,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=Pt(e,[],!1).filter((e=>pt(e)&&"body"!==lt(e))),o=null;const i="fixed"===wt(e).position;let s=i?Ot(e):e;for(;pt(s)&&!bt(s);){const t=wt(s),n=mt(s);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||gt(s)&&!n&&on(e,s))?r=r.filter((e=>e!==s)):o=t,s=Ot(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=i[0],a=i.reduce(((e,n)=>{const r=rn(t,n,o);return e.top=jt(r.top,e.top),e.right=kt(r.right,e.right),e.bottom=kt(r.bottom,e.bottom),e.left=jt(r.left,e.left),e}),rn(t,s,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:ln,getElementRects:async function(e){const t=this.getOffsetParent||ln,n=this.getDimensions;return{reference:sn(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}=Kt(e);return{width:t,height:n}},getScale:Xt,isElement:pt,isRTL:function(e){return"rtl"===wt(e).direction}};function fn(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=Ut(e),f=o||i?[...c?Pt(c):[],...Pt(t)]:[];f.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=c&&a?function(e,t){let n,r=null;const o=ft(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function s(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),i();const{left:c,top:f,width:u,height:p}=e.getBoundingClientRect();if(a||t(),!u||!p)return;const d={rootMargin:-St(f)+"px "+-St(o.clientWidth-(c+u))+"px "+-St(o.clientHeight-(f+p))+"px "+-St(c)+"px",threshold:jt(0,kt(1,l))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return s();t?s(!1,t):n=setTimeout((()=>{s(!1,1e-7)}),100)}h=!1}try{r=new IntersectionObserver(g,{...d,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,d)}r.observe(e)}(!0),i}(c,n):null;let p,d=-1,h=null;s&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!l&&h.observe(c),h.observe(t));let g=l?Qt(e):null;return l&&function t(){const r=Qt(e);!g||r.x===g.x&&r.y===g.y&&r.width===g.width&&r.height===g.height||n();g=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==u||u(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const un=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:s=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Nt(e,t),c={x:n,y:r},f=await $t(t,l),u=Ft(Lt(o)),p=zt(u);let d=c[p],h=c[u];if(i){const e="y"===p?"bottom":"right";d=Ct(d+f["y"===p?"top":"left"],d,d-f[e])}if(s){const e="y"===u?"bottom":"right";h=Ct(h+f["y"===u?"top":"left"],h,h-f[e])}const g=a.fn({...t,[p]:d,[u]:h});return{...g,data:{x:g.x-n,y:g.y-r}}}}},pn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...y}=Nt(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const m=Lt(o),v=Lt(a)===a,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(v||!g?[Wt(a)]:function(e){const t=Wt(e);return[qt(e),t,qt(t)]}(a));p||"none"===h||w.push(...function(e,t,n,r){const o=Dt(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}(Lt(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(qt)))),i}(a,g,h,b));const x=[a,...w],O=await $t(t,y),_=[];let P=(null==(r=i.flip)?void 0:r.overflows)||[];if(f&&_.push(O[m]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=Dt(e),o=Bt(e),i=Mt(o);let s="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Wt(s)),[s,Wt(s)]}(o,s,b);_.push(O[e[0]],O[e[1]])}if(P=[...P,{placement:o,overflows:_}],!_.every((e=>e<=0))){var k,j;const e=((null==(k=i.flip)?void 0:k.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:P},reset:{placement:t}};let n=null==(j=P.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:j.placement;if(!n)switch(d){case"bestFit":{var E;const e=null==(E=P.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:E[0];e&&(n=e);break}case"initialPlacement":n=a}if(o!==n)return{reset:{placement:n}}}return{}}}},dn=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:s}=t,{padding:a=2,x:l,y:c}=Nt(e,t),f=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),u=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=>It(Zt(e))))}(f),p=It(Zt(f)),d=Vt(a);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=l&&null!=c)return u.find((e=>l>e.left-d.left&&l<e.right+d.right&&c>e.top-d.top&&c<e.bottom+d.bottom))||p;if(u.length>=2){if("y"===Ft(n)){const e=u[0],t=u[u.length-1],r="top"===Lt(n),o=e.top,i=t.bottom,s=r?e.left:t.left,a=r?e.right:t.right;return{top:o,bottom:i,left:s,right:a,width:a-s,height:i-o,x:s,y:o}}const e="left"===Lt(n),t=jt(...u.map((e=>e.right))),r=kt(...u.map((e=>e.left))),o=u.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,s=o[o.length-1].bottom;return{top:i,bottom:s,left:r,right:t,width:t-r,height:s-i,x:r,y:i}}return p}},floating:r.floating,strategy:s});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}}:{}}}},hn=(e,t,n)=>{const r=new Map,o={platform:cn,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:u}=Ht(c,r,l),p=r,d={},h=0;for(let n=0;n<a.length;n++){const{name:i,fn:g}=a[n],{x:y,y:m,data:v,reset:b}=await g({x:f,y:u,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:c,platform:s,elements:{reference:e,floating:t}});f=null!=y?y:f,u=null!=m?m:u,d={...d,[i]:{...d[i],...v}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(p=b.placement),b.rects&&(c=!0===b.rects?await s.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:f,y:u}=Ht(c,p,l))),n=-1)}return{x:f,y:u,placement:p,strategy:o,middlewareData:d}})(e,t,{...o,platform:i})};var gn="undefined"!=typeof document?g:y;function yn(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(!yn(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)&&!yn(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function mn(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vn(e,t){const n=mn(e);return Math.round(t*n)/n}function bn(e){const t=p.useRef(e);return gn((()=>{t.current=e})),t}const wn=p["useInsertionEffect".toString()]||(e=>e());var xn="undefined"!=typeof document?g:y;let On=!1,_n=0;const Pn=()=>"floating-ui-"+_n++;const kn=p["useId".toString()]||function(){const[e,t]=p.useState((()=>On?Pn():void 0));return xn((()=>{null==e&&t(Pn())}),[]),p.useEffect((()=>{On||(On=!0)}),[]),e};const jn=p.createContext(null),En=p.createContext(null);function Sn(e){const t=m(e);return xn((()=>{t.current=e})),t}function Rn(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:o}=e,[i,s]=p.useState(null),a=(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:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[f,u]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=p.useState(r);yn(d,r)||h(r);const[g,y]=p.useState(null),[m,v]=p.useState(null),w=p.useCallback((e=>{e!==P.current&&(P.current=e,y(e))}),[]),x=p.useCallback((e=>{e!==k.current&&(k.current=e,v(e))}),[]),O=i||g,_=s||m,P=p.useRef(null),k=p.useRef(null),j=p.useRef(f),E=null!=l,S=bn(l),R=bn(o),A=p.useCallback((()=>{if(!P.current||!k.current)return;const e={placement:t,strategy:n,middleware:d};R.current&&(e.platform=R.current),hn(P.current,k.current,e).then((e=>{const t={...e,isPositioned:!0};T.current&&!yn(j.current,t)&&(j.current=t,b.flushSync((()=>{u(t)})))}))}),[d,t,n,R]);gn((()=>{!1===c&&j.current.isPositioned&&(j.current.isPositioned=!1,u((e=>({...e,isPositioned:!1}))))}),[c]);const T=p.useRef(!1);gn((()=>(T.current=!0,()=>{T.current=!1})),[]),gn((()=>{if(O&&(P.current=O),_&&(k.current=_),O&&_){if(S.current)return S.current(O,_,A);A()}}),[O,_,A,S,E]);const C=p.useMemo((()=>({reference:P,floating:k,setReference:w,setFloating:x})),[w,x]),N=p.useMemo((()=>({reference:O,floating:_})),[O,_]),L=p.useMemo((()=>{const e={position:n,left:0,top:0};if(!N.floating)return e;const t=vn(N.floating,f.x),r=vn(N.floating,f.y);return a?{...e,transform:"translate("+t+"px, "+r+"px)",...mn(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,a,N.floating,f.x,f.y]);return p.useMemo((()=>({...f,update:A,refs:C,elements:N,floatingStyles:L})),[f,A,C,N,L])}(e),c=p.useContext(En),f=null!=((null==(u=p.useContext(jn))?void 0:u.id)||null);var u;const d=function(e){const t=p.useRef((()=>{}));return wn((()=>{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&&(g.current.openEvent=t),y.emit("openchange",{open:e,event:t,reason:n,nested:f}),null==r||r(e,t,n)})),h=p.useRef(null),g=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],m=kn(),v=p.useCallback((e=>{const t=pt(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l.refs.setReference(t)}),[l.refs]),w=p.useCallback((e=>{(pt(e)||null===e)&&(h.current=e,s(e)),(pt(l.refs.reference.current)||null===l.refs.reference.current||null!==e&&!pt(e))&&l.refs.setReference(e)}),[l.refs]),x=p.useMemo((()=>({...l.refs,setReference:w,setPositionReference:v,domReference:h})),[l.refs,w,v]),O=p.useMemo((()=>({...l.elements,domReference:a})),[l.elements,a]),_=p.useMemo((()=>({...l,refs:x,elements:O,dataRef:g,nodeId:o,floatingId:m,events:y,open:n,onOpenChange:d})),[l,o,m,y,n,d,x,O]);return xn((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===o));e&&(e.context=_)})),p.useMemo((()=>({...l,context:_,refs:x,elements:O})),[l,x,O,_])}const An=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Tn(e,t){return"function"==typeof e?e(t):e}function Cn(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("number"==typeof o?o:o.close)||0,[s,a]=p.useState(!1),[l,c]=p.useState("unmounted"),f=function(e,t){const[n,r]=p.useState(e);return e&&!n&&r(!0),p.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,i);return xn((()=>{s&&!f&&c("unmounted")}),[s,f]),xn((()=>{if(r){if(n){c("initial");const e=requestAnimationFrame((()=>{c("open")}));return()=>{cancelAnimationFrame(e)}}a(!0),c("close")}}),[n,r]),{isMounted:f,status:l}}function Nn(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:s=250}=t,a=e.placement,l=a.split("-")[0],c=p.useMemo((()=>({side:l,placement:a})),[l,a]),f="number"==typeof s,u=(f?s:s.open)||0,d=(f?s:s.close)||0,[h,g]=p.useState((()=>({...Tn(i,c),...Tn(n,c)}))),{isMounted:y,status:m}=Cn(e,{duration:s}),v=Sn(n),b=Sn(r),w=Sn(o),x=Sn(i);return xn((()=>{const e=Tn(v.current,c),t=Tn(w.current,c),n=Tn(x.current,c),r=Tn(b.current,c)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===m&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===m&&g({transitionProperty:Object.keys(r).map(An).join(","),transitionDuration:u+"ms",...n,...r}),"close"===m){const r=t||e;g({transitionProperty:Object.keys(r).map(An).join(","),transitionDuration:d+"ms",...n,...r})}}),[d,w,v,b,x,u,m,c]),{isMounted:y,styles:h}}const{Overlay:Ln,Portal:Dn}=r,zn=({style:e,setFloating:r,element:s,setHoldLinkTool:a,blockId:l,onClose:c})=>{const p=t(),d=n(),[h,g]=v(!1),{refs:y,floatingStyles:m,context:b}=Rn({placement:"bottom",open:h,onOpenChange:e=>{g(e)},middleware:[dn(),pn(),un(),Jt(10)],whileElementsMounted:fn}),{isMounted:w,styles:x}=Nn(b,{duration:{open:100,close:100}}),O=Object.assign(Object.assign(Object.assign({},m),x),{maxWidth:400}),_=null==d?void 0:d.LinkTool,P=!!_;return f(Dn,Object.assign({id:"yoopta-link-preview"},{children:[w&&P&&u(Dn,Object.assign({id:"yoopta-link-tool"},{children:u(Ln,Object.assign({lockScroll:!0,className:"yoo-link-z-[100]",onClick:c},{children:u("div",Object.assign({ref:y.setFloating,style:O,onClick:e=>e.stopPropagation()},{children:u(_,{editor:p,link:s.props,onSave:e=>{o.updateElement(p,l,{type:s.type,props:Object.assign(Object.assign({},s.props),e)}),g(!1),c()},onDelete:()=>{const e=i(p),t=o.getElementPath(p,l,s);if(!e)return;const n=o.getElementEntry(p,l,{path:t,type:s.type});n&&Qe.unwrapNodes(e,{match:e=>!Me.isEditor(e)&&Se.isElement(e)&&e.type===s.type,at:t||(null==n?void 0:n[1])})},withTitle:!1})}))}))})),f("div",Object.assign({className:"yoopta-link-preview",style:e,ref:r},{children:[u("span",Object.assign({className:"yoopta-link-preview-text"},{children:s.props.url})),u("span",{className:"yoopta-link-preview-separator"}),u("button",Object.assign({type:"button",onClick:()=>{navigator.clipboard.writeText(s.props.url)},className:"yoopta-button"},{children:u(st,{size:14,strokeWidth:1})})),u("span",{className:"yoopta-link-preview-separator"}),u("button",Object.assign({type:"button",onClick:()=>{window.open(s.props.url,s.props.target||"_self")},className:"yoopta-button"},{children:u(at,{size:14,strokeWidth:1})})),u("span",{className:"yoopta-link-preview-separator"}),u("button",Object.assign({ref:y.setReference,type:"button",className:"yoopta-button yoopta-link-edit-button",onClick:()=>{a((e=>!e)),g((e=>!e))}},{children:"Edit"}))]}))]}))},Mn=["_blank","_self","_parent","_top","framename"],Fn=new a({type:"LinkPlugin",elements:{link:{render:e=>{var{extendRender:t}=e,n=tt(e,["extendRender"]);const[r,o]=v(!1),[i,a]=v(!1),l=n.HTMLAttributes||{},{className:c=""}=l,p=tt(l,["className"]),{refs:d,floatingStyles:h,context:g}=Rn({placement:"bottom",open:r,onOpenChange:o,middleware:[dn(),pn(),un(),Jt(0)],whileElementsMounted:fn}),{isMounted:y,styles:m}=Nn(g,{duration:{open:200,close:100}}),b=Object.assign(Object.assign({},h),m),{url:w,target:x="",rel:O}=n.element.props||{},_=s(),P={rel:O,target:x};Mn.includes(x)||delete P.target,"string"==typeof O&&0!==(null==O?void 0:O.length)||delete P.rel;const k=()=>{a(!1),o(!1)};return f("span",Object.assign({ref:d.setReference,onMouseOver:()=>{o(!0)},onMouseOut:()=>{i||k()}},{children:[t?t(n):u("a",Object.assign({},P,p,n.attributes,{draggable:!1,href:w||"",className:`yoopta-link ${c}`},{children:n.children})),y&&!_&&u(zn,{style:b,setFloating:d.setFloating,element:n.element,setHoldLinkTool:a,onClose:k,blockId:n.blockId})]}))},props:{url:null,target:"_self",rel:"noopener noreferrer",nodeType:"inline",title:null}}},options:{display:{title:"Link",description:"Create link"}},commands:et,parsers:{html:{serialize:(e,t)=>{const{url:n,target:r,rel:o,title:i}=e.props;return`<a href="${n}" target="${r}" rel="${o}">${l(e.children)}</a>`},deserialize:{nodeNames:["A"],parse:(t,n)=>{if("A"===t.nodeName){const r=t.getAttribute("href")||"",o=n.plugins.LinkPlugin.elements.link.props,i={url:r,target:t.getAttribute("target")||o.target,rel:t.getAttribute("rel")||o.rel,title:t.textContent||"",nodeType:"inline"};return{id:e(),type:"link",props:i,children:c(n,t.childNodes)}}}}}}});!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-link-z-\\[100\\]{z-index:100}.yoopta-link{--tw-text-opacity:1;color:rgb(0 122 255/var(--tw-text-opacity));cursor:pointer;position:relative;text-decoration-line:underline;text-underline-offset:4px}.yoopta-link:hover{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity))}.yoopta-link-preview{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(227 227 227/var(--tw-border-opacity));border-radius:.375rem;border-style:solid;border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);display:flex;padding:6px;z-index:50}.yoopta-link-preview-text{font-size:.875rem;line-height:1.25rem;max-width:200px;overflow:hidden;text-overflow:ellipsis;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.yoopta-link-preview-separator{--tw-bg-opacity:1;background-color:rgb(227 227 227/var(--tw-bg-opacity));height:20px;margin-left:5px;margin-right:5px;width:1px}.yoopta-link-edit-button{cursor:pointer;font-size:.875rem;line-height:1.25rem}");export{et as LinkCommands,Fn as default};
@@ -1,5 +1,5 @@
1
1
  import { YooptaPlugin } from '@yoopta/editor';
2
- import { LinkElementProps } from '../types';
3
- declare const Link: YooptaPlugin<"link", LinkElementProps, Record<string, unknown>>;
2
+ import { LinkElementMap } from '../types';
3
+ declare const Link: YooptaPlugin<LinkElementMap, Record<string, unknown>>;
4
4
  export { Link };
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,UAAU,CAAC;AAGnE,QAAA,MAAM,IAAI,iEAyDR,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwD,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEpG,OAAO,EAAE,cAAc,EAAoB,MAAM,UAAU,CAAC;AAG5D,QAAA,MAAM,IAAI,uDA0DR,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC"}
package/dist/types.d.ts CHANGED
@@ -8,4 +8,7 @@ export type LinkElementProps = {
8
8
  title?: string | null;
9
9
  };
10
10
  export type LinkElement = SlateElement<'link', LinkElementProps>;
11
+ export type LinkElementMap = {
12
+ link: LinkElement;
13
+ };
11
14
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAC3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAC3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAEjE,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/link",
3
- "version": "4.6.10-rc.1",
3
+ "version": "4.7.1-rc.0",
4
4
  "description": "Link plugin for Yoopta Editor",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
@@ -37,5 +37,5 @@
37
37
  "dependencies": {
38
38
  "lucide-react": "^0.379.0"
39
39
  },
40
- "gitHead": "4181e51a227ff57a9c4939cb5a6d3d1507bb1f28"
40
+ "gitHead": "63bfe2afb5f9d7b3a8c49584d0ac8bdc5b2dcf1f"
41
41
  }