@yoopta/editor 4.8.5-rc.4 → 4.8.5-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/UI/BlockOptions/BlockOptions.d.ts.map +1 -1
- package/dist/components/Block/BlockActions.d.ts.map +1 -1
- package/dist/components/Editor/Editor.d.ts.map +1 -1
- package/dist/components/Editor/selection.d.ts.map +1 -1
- package/dist/editor/core/blur.d.ts.map +1 -1
- package/dist/handlers/onKeyDown.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -99,7 +99,6 @@ export type YooEditor<TNodes> = {
|
|
|
99
99
|
setEditorValue: (value: YooptaContentValue) => void;
|
|
100
100
|
path: YooptaPath;
|
|
101
101
|
setPath: (path: YooptaPath | null, options?: SetSelectionOptions) => void;
|
|
102
|
-
// setBlockSelected: (path: number[] | null, options?: BlockSelectedOptions) => void;
|
|
103
102
|
blockEditorsMap: YooptaPluginsEditorMap;
|
|
104
103
|
blocks: YooptaBlocks;
|
|
105
104
|
formats: YooptaFormats;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockOptions.d.ts","sourceRoot":"","sources":["../../../src/UI/BlockOptions/BlockOptions.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAY,MAAM,OAAO,CAAC;AAUhD,QAAA,MAAM,qBAAqB;;6CAAiF,CAAC;AAE7G,QAAA,MAAM,uBAAuB;;6CAO5B,CAAC;AAEF,QAAA,MAAM,oBAAoB;;6CAAgF,CAAC;AAE3G,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,qBAAqB,kBAAwB,0BAA0B,4CAE5E,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC9D,CAAC;AAIF,QAAA,MAAM,YAAY,wDAA2E,iBAAiB,
|
|
1
|
+
{"version":3,"file":"BlockOptions.d.ts","sourceRoot":"","sources":["../../../src/UI/BlockOptions/BlockOptions.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAY,MAAM,OAAO,CAAC;AAUhD,QAAA,MAAM,qBAAqB;;6CAAiF,CAAC;AAE7G,QAAA,MAAM,uBAAuB;;6CAO5B,CAAC;AAEF,QAAA,MAAM,oBAAoB;;6CAAgF,CAAC;AAE3G,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,qBAAqB,kBAAwB,0BAA0B,4CAE5E,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC9D,CAAC;AAIF,QAAA,MAAM,YAAY,wDAA2E,iBAAiB,mDAuH7G,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockActions.d.ts","sourceRoot":"","sources":["../../../src/components/Block/BlockActions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAkB5E,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,SAAS,CAAC;IAClB,eAAe,EAAE,GAAG,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,YAAY,yEAA0E,YAAY,
|
|
1
|
+
{"version":3,"file":"BlockActions.d.ts","sourceRoot":"","sources":["../../../src/components/Block/BlockActions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAkB5E,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,SAAS,CAAC;IAClB,eAAe,EAAE,GAAG,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,YAAY,yEAA0E,YAAY,4CAkIvG,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAezC,KAAK,KAAK,GAAG;IACX,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;IACpF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAQF,QAAA,MAAM,MAAM,4FAST,KAAK,
|
|
1
|
+
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAezC,KAAK,KAAK,GAAG;IACX,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;IACpF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAQF,QAAA,MAAM,MAAM,4FAST,KAAK,4CAqSP,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/selection.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAK3D,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,IAAI,GAAG,MAAM,CAAC;IAC7B,oBAAoB,EAAE,IAAI,GAAG,MAAM,CAAC;CACrC,CAAC;AAQF,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAAE,qBAAqB;qBA4CzC,gBAAgB;;;;
|
|
1
|
+
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/selection.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAK3D,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,IAAI,GAAG,MAAM,CAAC;IAC7B,oBAAoB,EAAE,IAAI,GAAG,MAAM,CAAC;CACrC,CAAC;AAQF,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAAE,qBAAqB;qBA4CzC,gBAAgB;;;;EAyOzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../../src/editor/core/blur.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../../src/editor/core/blur.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;AAYF,wBAAgB,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,GAAE,iBAAsB,QAiBtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onKeyDown.d.ts","sourceRoot":"","sources":["../../src/handlers/onKeyDown.ts"],"names":[],"mappings":"AAKA,OAAO,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAsBzD,MAAM;AAEN,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,WAC1B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"onKeyDown.d.ts","sourceRoot":"","sources":["../../src/handlers/onKeyDown.ts"],"names":[],"mappings":"AAKA,OAAO,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAsBzD,MAAM;AAEN,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,WAC1B,mBAAmB,UA4PnC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from"react";import o,{createContext as i,useContext as a,useRef as l,useLayoutEffect as s,useEffect as c,useMemo as d,useCallback as u,useState as f,memo as p,useReducer as h,forwardRef as g,createElement as v}from"react";import{Editor as m,Element as y,Text as b,Transforms as w,Point as x,Path as k,Node as E,Range as O,createEditor as S,Operation as C}from"slate";import{ReactEditor as _,withReact as D,useSelected as j,Slate as R,Editable as A,DefaultElement as P}from"slate-react";import*as B from"react-dom";import{unstable_batchedUpdates as T,createPortal as N}from"react-dom";class M{constructor(e){this.plugin=e}get getPlugin(){return this.plugin}extend(e){const{renders:t,options:n,elementProps:r,events:o}=e,i=Object.assign(Object.assign({},this.plugin.options),n),a=Object.assign({},this.plugin.elements);return t&&Object.keys(t).forEach((e=>{const n=a[e];if(n&&n.render){const r=t[e];let o=n.render;n.render=e=>o(Object.assign(Object.assign({},e),{extendRender:r}))}})),r&&Object.keys(r).forEach((e=>{const t=a[e];if(t){const n=r[e],o=t.props;n&&o&&(t.props=n(o))}})),o&&Object.keys(o).forEach((e=>{const t=o[e];t&&(this.plugin.events||(this.plugin.events={}),this.plugin.events[e]=t)})),new M(Object.assign(Object.assign({},this.plugin),{elements:a,options:i}))}}function L(){let e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}const I=()=>{var e,t;return"undefined"==typeof window||"function"!=typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?L():null===(t=window.crypto)||void 0===t?void 0:t.randomUUID()},z=e=>({id:I(),type:(null==e?void 0:e.type)||"paragraph",children:(null==e?void 0:e.children)||[{text:""}],props:Object.assign({nodeType:"block"},null==e?void 0:e.props)}),F=e=>({id:(null==e?void 0:e.id)||I(),value:(null==e?void 0:e.value)||[z()],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:0,depth:0},null==e?void 0:e.meta)});function H(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function V(e){if(!e)return;const t=H(e);return t?e[t]:void 0}function $(e,t={nodeType:"block"}){return{id:I(),type:e,children:[{text:""}],props:t}}function U(e,t,n){var r;return(null===(r=e.children)||void 0===r?void 0:r.map((e=>{const r=t[e];if(!r)throw new Error(`Element definition for ${e} not found`);return z({id:I(),type:e,props:r.props,children:r.children&&r.children.length>0?U(r,t,n):[{text:(null==n?void 0:n[e])||""}]})})))||[]}function K(e,t,n){e.plugins[t];const r=e.blocks[t].elements,o=H(r);if(!o)throw new Error(`Root element type not found for block type ${t}`);const i=r[o];return{id:I(),type:o,props:i.props,children:i.children&&i.children.length>0?U(i,r,n):[{text:""}]}}function W(e,t,n={}){var r,o;const{at:i=e.path.current,focus:a=!1,blockData:l}=n,s=e.plugins[t],{onBeforeCreate:c,onCreate:d}=s.events||{};let u;u=l&&Array.isArray(null==l?void 0:l.value)?l.value[0]:(null==c?void 0:c(e))||K(e,t);const f={id:(null==l?void 0:l.id)||I(),type:t,value:[u],meta:{align:(null===(r=null==l?void 0:l.meta)||void 0===r?void 0:r.align)||"left",depth:(null===(o=null==l?void 0:l.meta)||void 0===o?void 0:o.depth)||0,order:"number"==typeof i?i:Object.keys(e.children).length}},p=[];return p.push({type:"insert_block",path:{current:f.meta.order},block:f}),e.applyTransforms(p),null==d||d(e,f.id),a&&e.focusBlock(f.id),f.id}function Y(e){const t=e.path.current;return"number"==typeof t&&0!==t?t-1:null}function X(e,t){e.applyTransforms([{type:"set_block_path",path:t}])}function q(e){try{let t;const[n,r]=m.last(e,[]);if(y.isElement(n)&&!m.isEditor(n)){const[n,o]=m.last(e,r);b.isText(n)&&(t={path:o,offset:n.text.length})}else b.isText(n)&&(t={path:r,offset:n.text.length});return t}catch(e){return{path:[0,0],offset:0}}}const Z={getPath:function(e){return e.path.current},getNextPath:function(e){const t=e.path.current;return"number"==typeof t?t+1:null},getPreviousPath:Y,isBlockSelected:function(e,t){const n=e.path.selected;return!!Array.isArray(n)&&n.includes(t.meta.order)},getSelectedPaths:function(e){return e.path.selected},isPathEmpty:function(e){return null===e.path.current},setPath:X,getLastNodePoint:q};function J(e,t){if(!(null==t?void 0:t.id)&&"number"!=typeof(null==t?void 0:t.at))throw new Error("getSlate requires either an id or at");const n=(null==t?void 0:t.id)||Object.keys(e.children).find((n=>e.children[n].meta.order===(null==t?void 0:t.at))),r=e.blockEditorsMap[n||""],o=e.children[n||""],i=e.blocks[(null==o?void 0:o.type)||""];if(!(null==i?void 0:i.hasCustomEditor)&&!r)throw new Error(`Slate not found with params: ${JSON.stringify(t)}`);return r}function G(e,t){const{focus:n,blockId:r,at:o}=t;if(!r&&"number"!=typeof o)throw new Error("blockId or path should be provided");const i=e.getBlock({id:r,at:o});if(!i)throw new Error("Block not found");const a=Z.getPreviousPath(e),l=null!==a?e.getBlock({at:a}):void 0,s=l?J(e,{id:null==l?void 0:l.id}):void 0,c=e.children[i.id],d=[];if(d.push({type:"delete_block",block:c,path:e.path}),e.applyTransforms(d,{normalizePaths:!1}),n&&s&&l){const t=Z.getLastNodePoint(s);e.focusBlock(l.id,{focusAt:t})}}function Q(e,t,n){const r=n,o=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===r));if(!o||!i)return void console.warn("Invalid block ids for move operation");const a=[],l={type:"move_block",prevProperties:{id:t,order:o.meta.order},properties:{id:t,order:r}};a.push(l),e.applyTransforms(a),e.setPath({current:r})}const ee=new WeakMap;function te(e,t,n={}){const{focusAt:r,waitExecution:o=!0,waitExecutionMs:i=0,shouldUpdateBlockSelection:a=!0}=n,l=()=>{const o=n.slate||e.blockEditorsMap[t],i=e.children[t];if(!o||!i)return;if(!e.blocks[i.type].hasCustomEditor)try{const e=function(e,t){if(x.isPoint(t))return t;if(k.isPath(t))return{path:t,offset:0};const[,n]=m.first(e,[0]);return{path:n||[0,0],offset:0}}(o,r);w.select(o,e),_.focus(o)}catch(e){}a&&setTimeout((()=>{e.setPath({current:i.meta.order})}),0)};o?setTimeout((()=>l()),i):l(),ee.set(e,!0)}function ne(e,t){const n=Object.keys(e.children),{at:r=e.path.current}=t||{},o=n.find((t=>e.children[t].meta.order===r));return o?e.children[o]:null}function re(e,t){const n=Object.keys(e.children),{at:r=e.path.current}=t||{},o=n.find((t=>e.children[t].meta.order===r));if(o)return e.blockEditorsMap[o]}var oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ie={};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",l="[object Function]",s="[object GeneratorFunction]",c="[object Map]",d="[object Number]",u="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",m="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",O="[object Int32Array]",S="[object Uint8Array]",C="[object Uint8ClampedArray]",_="[object Uint16Array]",D="[object Uint32Array]",j=/\w*$/,R=/^\[object .+?Constructor\]$/,A=/^(?:0|[1-9]\d*)$/,P={};P[o]=P["[object Array]"]=P[y]=P[b]=P[i]=P[a]=P[w]=P[x]=P[k]=P[E]=P[O]=P[c]=P[d]=P[u]=P[p]=P[h]=P[g]=P[v]=P[S]=P[C]=P[_]=P[D]=!0,P["[object Error]"]=P[l]=P[m]=!1;var B="object"==typeof oe&&oe&&oe.Object===Object&&oe,T="object"==typeof self&&self&&self.Object===Object&&self,N=B||T||Function("return this")(),M=t&&!t.nodeType&&t,L=M&&e&&!e.nodeType&&e,I=L&&L.exports===M;function z(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function H(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function $(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function U(e,t){return function(n){return e(t(n))}}function K(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var W,Y=Array.prototype,X=Function.prototype,q=Object.prototype,Z=N["__core-js_shared__"],J=(W=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",G=X.toString,Q=q.hasOwnProperty,ee=q.toString,te=RegExp("^"+G.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=I?N.Buffer:void 0,re=N.Symbol,ie=N.Uint8Array,ae=U(Object.getPrototypeOf,Object),le=Object.create,se=q.propertyIsEnumerable,ce=Y.splice,de=Object.getOwnPropertySymbols,ue=ne?ne.isBuffer:void 0,fe=U(Object.keys,Object),pe=Ie(N,"DataView"),he=Ie(N,"Map"),ge=Ie(N,"Promise"),ve=Ie(N,"Set"),me=Ie(N,"WeakMap"),ye=Ie(Object,"create"),be=$e(pe),we=$e(he),xe=$e(ge),ke=$e(ve),Ee=$e(me),Oe=re?re.prototype:void 0,Se=Oe?Oe.valueOf:void 0;function Ce(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function _e(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function De(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function je(e){this.__data__=new _e(e)}function Re(e,t){var n=Ke(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&We(e)}(e)&&Q.call(e,"callee")&&(!se.call(e,"callee")||ee.call(e)==o)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,i=!!r;for(var a in e)!t&&!Q.call(e,a)||i&&("length"==a||He(a,r))||n.push(a);return n}function Ae(e,t,n){var r=e[t];Q.call(e,t)&&Ue(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Pe(e,t){for(var n=e.length;n--;)if(Ue(e[n][0],t))return n;return-1}function Be(e,t,n,r,f,m,R){var A;if(r&&(A=m?r(e,f,m,R):r(e)),void 0!==A)return A;if(!qe(e))return e;var B=Ke(e);if(B){if(A=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,A)}else{var T=Fe(e),N=T==l||T==s;if(Ye(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(T==u||T==o||N&&!m){if(V(e))return m?e:{};if(A=function(e){return"function"!=typeof e.constructor||Ve(e)?{}:(t=ae(e),qe(t)?le(t):{});var t}(N?{}:e),!t)return function(e,t){return Me(e,ze(e),t)}(e,function(e,t){return e&&Me(t,Ze(t),e)}(A,e))}else{if(!P[T])return m?e:{};A=function(e,t,n,r){var o=e.constructor;switch(t){case y:return Ne(e);case i:case a:return new o(+e);case b:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case w:case x:case k:case E:case O:case S:case C:case _:case D:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n($(e),!0):$(e);return H(r,z,new e.constructor)}(e,r,n);case d:case g:return new o(e);case p:return function(e){var t=new e.constructor(e.source,j.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,n){var r=t?n(K(e),!0):K(e);return H(r,F,new e.constructor)}(e,r,n);case v:return l=e,Se?Object(Se.call(l)):{}}var l}(e,T,Be,t)}}R||(R=new je);var M=R.get(e);if(M)return M;if(R.set(e,A),!B)var L=n?function(e){return function(e,t,n){var r=t(e);return Ke(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Ze,ze)}(e):Ze(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(L||e,(function(o,i){L&&(o=e[i=o]),Ae(A,i,Be(o,t,n,r,i,e,R))})),A}function Te(e){return!(!qe(e)||(t=e,J&&J in t))&&(Xe(e)||V(e)?te:R).test($e(e));var t}function Ne(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Me(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var a=t[o],l=r?r(n[a],e[a],a,n,e):void 0;Ae(n,a,void 0===l?e[a]:l)}return n}function Le(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Ie(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Te(n)?n:void 0}Ce.prototype.clear=function(){this.__data__=ye?ye(null):{}},Ce.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ce.prototype.get=function(e){var t=this.__data__;if(ye){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},Ce.prototype.has=function(e){var t=this.__data__;return ye?void 0!==t[e]:Q.call(t,e)},Ce.prototype.set=function(e,t){return this.__data__[e]=ye&&void 0===t?n:t,this},_e.prototype.clear=function(){this.__data__=[]},_e.prototype.delete=function(e){var t=this.__data__,n=Pe(t,e);return!(n<0)&&(n==t.length-1?t.pop():ce.call(t,n,1),!0)},_e.prototype.get=function(e){var t=this.__data__,n=Pe(t,e);return n<0?void 0:t[n][1]},_e.prototype.has=function(e){return Pe(this.__data__,e)>-1},_e.prototype.set=function(e,t){var n=this.__data__,r=Pe(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},De.prototype.clear=function(){this.__data__={hash:new Ce,map:new(he||_e),string:new Ce}},De.prototype.delete=function(e){return Le(this,e).delete(e)},De.prototype.get=function(e){return Le(this,e).get(e)},De.prototype.has=function(e){return Le(this,e).has(e)},De.prototype.set=function(e,t){return Le(this,e).set(e,t),this},je.prototype.clear=function(){this.__data__=new _e},je.prototype.delete=function(e){return this.__data__.delete(e)},je.prototype.get=function(e){return this.__data__.get(e)},je.prototype.has=function(e){return this.__data__.has(e)},je.prototype.set=function(e,t){var n=this.__data__;if(n instanceof _e){var r=n.__data__;if(!he||r.length<199)return r.push([e,t]),this;n=this.__data__=new De(r)}return n.set(e,t),this};var ze=de?U(de,Object):function(){return[]},Fe=function(e){return ee.call(e)};function He(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||A.test(e))&&e>-1&&e%1==0&&e<t}function Ve(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||q)}function $e(e){if(null!=e){try{return G.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ue(e,t){return e===t||e!=e&&t!=t}(pe&&Fe(new pe(new ArrayBuffer(1)))!=b||he&&Fe(new he)!=c||ge&&Fe(ge.resolve())!=f||ve&&Fe(new ve)!=h||me&&Fe(new me)!=m)&&(Fe=function(e){var t=ee.call(e),n=t==u?e.constructor:void 0,r=n?$e(n):void 0;if(r)switch(r){case be:return b;case we:return c;case xe:return f;case ke:return h;case Ee:return m}return t});var Ke=Array.isArray;function We(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!Xe(e)}var Ye=ue||function(){return!1};function Xe(e){var t=qe(e)?ee.call(e):"";return t==l||t==s}function qe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ze(e){return We(e)?Re(e):function(e){if(!Ve(e))return fe(e);var t=[];for(var n in Object(e))Q.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Be(e,!0,!0)}}({get exports(){return ie},set exports(e){ie=e}},ie);var ae=ie;function le(e){return ae(e)}function se(e,t={}){const{focus:n=!0}=t,r=ne(e),o=t.slate||re(e);o&&r&&m.withoutNormalizing(o,(()=>{if(!o.selection)return;const t=le(o.children),i=[],[a,l]=function(e,t){const{path:n,offset:r}=t.focus,[,...o]=n,i=JSON.parse(JSON.stringify(e[0]));function a(e,t,n){if(0!==t.length){const[r,...o]=t,[i,l]=a(e.children[r],o,n),s=e.children.slice(0,r).concat(i?[i]:[]),c=(l?[l]:[]).concat(e.children.slice(r+1));return[Object.assign(Object.assign({},e),{children:s}),Object.assign(Object.assign({},e),{children:c})]}if(E.string(e).length<=n)return[e,null];if("text"in e)return[Object.assign(Object.assign({},e),{text:e.text.slice(0,n)}),Object.assign(Object.assign({},e),{text:e.text.slice(n)})];if("link"===e.type){const[t,r]=a(e.children[0],[],n);return[Object.assign(Object.assign({},e),{children:[t]}),Object.assign(Object.assign({},e),{children:[r]})]}}const[l,s]=a(i,o,r);function c(e){return"children"in e&&(e.children=e.children.filter((e=>""!==e.text&&void 0!==e.text||e.children&&e.children.length>0)),e.children.forEach(c)),e}return[c(l),c(s)].map((e=>[e])).filter((e=>e[0].children.length>0))}(o.children,o.selection),s={id:I(),type:r.type,meta:{order:r.meta.order+1,depth:r.meta.depth,align:r.meta.align},value:[]};i.push({type:"split_block",prevProperties:{originalBlock:r,originalValue:t},properties:{nextBlock:s,nextSlateValue:l||[$("paragraph")],splitSlateValue:a},path:e.path}),e.applyTransforms(i),n&&e.focusBlock(s.id)}))}function ce(e,t={}){const{at:n=e.path.current,blockId:r}=t,o=r?e.children[r]:ne(e,{at:n});if(!o)return;const i=o.meta.depth+1,a={type:"set_block_meta",id:o.id,properties:{depth:i},prevProperties:{depth:o.meta.depth}};e.applyTransforms([a])}function de(e,t={}){const{at:n=e.path.current,blockId:r}=t,o=r?e.children[r]:ne(e,{at:n});if(!o)return;const i=Math.max(0,o.meta.depth-1),a={type:"set_block_meta",id:o.id,properties:{depth:i},prevProperties:{depth:o.meta.depth}};e.applyTransforms([a])}function ue(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;const fe=(e,t)=>{const{insertText:n}=t;return t.insertText=r=>{var o;const{selection:i}=t;if(" "===r&&i&&O.isCollapsed(i)){const{anchor:a}=i,l=m.above(t,{match:e=>y.isElement(e)&&m.isBlock(t,e),mode:"lowest"});if(!l)return;const[,s]=l,c=m.parent(t,s),[d]=c;if(y.isElement(d)&&!b.isText(d.children[0]))return n(r);const u=l?s:[],f={anchor:a,focus:m.start(t,u)},p=m.string(t,f),h=null===(o=e.shortcuts)||void 0===o?void 0:o[p];if(!!h&&!h.isActive())return w.select(t,f),w.delete(t),void e.toggleBlock(h.type,{deleteText:!0,focus:!0})}n(r)},t};function pe(e){return fe(e,D(S()))}function he(e,t){const n=re(e);if(!n)return!1;const r=m.marks(n);return!!(null==r?void 0:r[t])}function ge(e,t){const n={};return t.forEach((t=>{const r=t.type;n[r]={hotkey:t.hotkey,type:r,getValue:()=>function(e,t){const n=re(e);if(!n)return null;const r=m.marks(n);return null==r?void 0:r[t]}(e,r),isActive:()=>he(e,r),toggle:()=>function(e,t){const n=re(e),r=he(e,t);n&&(r?m.removeMark(n,t):m.addMark(n,t,!0),e.emit("change",e.children))}(e,r),update:t=>function(e,t,n){const r=re(e);r&&r.selection&&O.isExpanded(r.selection)&&(m.addMark(r,t,n),e.emit("change",e.children))}(e,r,t)}})),n}function ve(e){const t={};return Object.keys(e.children).forEach((n=>{const r=pe(e);t[n]=r})),t}function me(e,t){const{original:n,focus:r,at:o}=t;if(!n)throw new Error("`original` should be provided");if(!n.blockId&&"number"!=typeof n.path)throw new Error("blockId or path should be provided");const{blockId:i,path:a}=n;let l=i?e.children[i]:ne(e,{at:a});if(!l)throw new Error("Block not found");const s=[];Object.values(e.children).forEach((e=>{e.meta.order,l.meta.order}));const c=le(l);return c.id=I(),c.meta.order=Array.isArray(o)&&"number"==typeof o?o:l.meta.order+1,s.push({type:"insert_block",path:{current:c.meta.order},block:c}),e.applyTransforms(s),r&&e.focusBlock(c.id,{waitExecution:!0}),c.id}function ye(e,t,n,r){const o=e.children[t];if(!o)return void console.warn(`Block with id ${t} does not exist.`);const i={type:"set_block_meta",id:t,properties:{},prevProperties:{}},a={type:"set_block_value",id:t,value:[]};n.meta&&(i.prevProperties=o.meta,i.properties=Object.assign(Object.assign({},o.meta),n.meta)),n.value&&(a.value=n.value);const l=[];Object.keys(i.properties).length&&l.push(i),a.value.length&&l.push(a),l.length>0&&e.applyTransforms(l,{normalizePaths:!1})}const be="Paragraph";function we(e,t,n,r){const o=r.plugins[n.type];return(null==o?void 0:o.customEditor)?n.value[0].children:m.isEditor(t)?t.children.flatMap((t=>we(e,t,n,r))):y.isElement(t)?m.isInline(e,t)?[t]:t.children.flatMap((t=>we(e,t,n,r))):[t]}function xe(e){return y.isElement(e)?0===e.children.length||b.isText(e.children[0])?e:xe(e.children[0]):null}function ke(e,t,n={}){const r=ne(e,{at:n.at||e.path.current});if(!r)throw new Error("Block not found at current selection");let o=r.type===t?be:t;const i=e.plugins[o],{onBeforeCreate:a}=i.events||{},l=re(e,{at:r.meta.order});if(!l)throw new Error(`Slate not found for block in position ${r.meta.order}`);const s=(null==a?void 0:a(e))||K(e,o),c=we(l,l.children[0],r,e),d=xe(s);d&&(d.children=c);const u={id:I(),type:o,meta:Object.assign({},r.meta),value:[s]},f=pe(e);f.children=[s];const p=[{type:"delete_block",block:r,path:{current:r.meta.order}},{type:"insert_block",path:{current:r.meta.order},block:u}];return e.applyTransforms(p),n.deleteText&&w.delete(f,{at:[0,0]}),n.focus&&e.focusBlock(u.id),u.id}function Ee(e,t){try{_.blur(t),_.deselect(t),w.deselect(t)}catch(e){}e.setPath({current:null})}function Oe(e,t){if(!(null==t?void 0:t.id)&&"number"!=typeof(null==t?void 0:t.at))throw new Error("getBlock requires either an id or at");if(null==t?void 0:t.id)return e.children[null==t?void 0:t.id];const n=Object.keys(e.children).find((n=>e.children[n].meta.order===(null==t?void 0:t.at)));return n?e.children[n]:null}const Se={underline:{type:"underline",tag:"U"},strike:{type:"strike",tag:"S"},code:{type:"code",tag:"CODE"},italic:{type:"italic",tag:"I"},bold:{type:"bold",tag:"B"}};function Ce(e,t){return e.map((e=>{var n,r;let o="";if(e.text)return o=Object.keys(Se).reduce(((t,n)=>e[n]?`<${Se[n].tag}>${t}</${Se[n].tag}>`:t),e.text),o;if(e.type){const i=function(e,t){return Object.values(e).find((e=>{var n,r;return e.type===(null===(r=null===(n=e.elements)||void 0===n?void 0:n[t])||void 0===r?void 0:r.rootPlugin)}))}(t,e.type);if(i&&(null===(r=null===(n=i.parsers)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize))return o=i.parsers.html.serialize(e,Ce(e.children,t)),o}return o})).join("")}function _e(e,t){const n=Object.values(t).filter((t=>{const n=Z.getSelectedPaths(e);return!(Array.isArray(n)&&n.length>0)||(null==n?void 0:n.includes(t.meta.order))})).sort(((e,t)=>e.meta.order-t.meta.order)).map((t=>{var n,r;const o=e.plugins[t.type];if(o&&(null===(r=null===(n=o.parsers)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize)){const n=Ce(t.value[0].children,e.plugins);return o.parsers.html.serialize(t.value[0],n,t.meta)}return""}));return`<body id="yoopta-clipboard" data-editor-id="${e.id}">${n.join("")}</body>`}var De=Symbol.for("immer-nothing"),je=Symbol.for("immer-draftable"),Re=Symbol.for("immer-state");function Ae(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Pe=Object.getPrototypeOf;function Be(e){return!!e&&!!e[Re]}function Te(e){return!!e&&(Me(e)||Array.isArray(e)||!!e[je]||!!e.constructor?.[je]||He(e)||Ve(e))}var Ne=Object.prototype.constructor.toString();function Me(e){if(!e||"object"!=typeof e)return!1;const t=Pe(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)===Ne}function Le(e,t){0===Ie(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Ie(e){const t=e[Re];return t?t.type_:Array.isArray(e)?1:He(e)?2:Ve(e)?3:0}function ze(e,t){return 2===Ie(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Fe(e,t,n){const r=Ie(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function He(e){return e instanceof Map}function Ve(e){return e instanceof Set}function $e(e){return e.copy_||e.base_}function Ue(e,t){if(He(e))return new Map(e);if(Ve(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Me(e)){if(!Pe(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Re];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(Pe(e),n)}function Ke(e,t=!1){return Ye(e)||Be(e)||!Te(e)||(Ie(e)>1&&(e.set=e.add=e.clear=e.delete=We),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>Ke(t,!0)))),e}function We(){Ae(2)}function Ye(e){return Object.isFrozen(e)}var Xe,qe={};function Ze(e){const t=qe[e];return t||Ae(0),t}function Je(){return Xe}function Ge(e,t){t&&(Ze("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Qe(e){et(e),e.drafts_.forEach(nt),e.drafts_=null}function et(e){e===Xe&&(Xe=e.parent_)}function tt(e){return Xe={drafts_:[],parent_:Xe,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function nt(e){const t=e[Re];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function rt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Re].modified_&&(Qe(t),Ae(4)),Te(e)&&(e=ot(t,e),t.parent_||at(t,e)),t.patches_&&Ze("Patches").generateReplacementPatches_(n[Re].base_,e,t.patches_,t.inversePatches_)):e=ot(t,n,[]),Qe(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==De?e:void 0}function ot(e,t,n){if(Ye(t))return t;const r=t[Re];if(!r)return Le(t,((o,i)=>it(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),Le(o,((o,a)=>it(e,r,t,o,a,n,i))),at(e,t,!1),n&&e.patches_&&Ze("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function it(e,t,n,r,o,i,a){if(Be(o)){const a=ot(e,o,i&&t&&3!==t.type_&&!ze(t.assigned_,r)?i.concat(r):void 0);if(Fe(n,r,a),!Be(a))return;e.canAutoFreeze_=!1}else a&&n.add(o);if(Te(o)&&!Ye(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ot(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_&&Ke(t,n)}var lt={get(e,t){if(t===Re)return e;const n=$e(e);if(!ze(n,t))return function(e,t,n){const r=dt(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_||!Te(r)?r:r===ct(e.base_,t)?(ft(e),e.copy_[t]=pt(r,e)):r},has:(e,t)=>t in $e(e),ownKeys:e=>Reflect.ownKeys($e(e)),set(e,t,n){const r=dt($e(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ct($e(e),t),a=r?.[Re];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||ze(e.base_,t)))return!0;ft(e),ut(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!==ct(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ft(e),ut(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=$e(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Ae(11)},getPrototypeOf:e=>Pe(e.base_),setPrototypeOf(){Ae(12)}},st={};function ct(e,t){const n=e[Re];return(n?$e(n):e)[t]}function dt(e,t){if(!(t in e))return;let n=Pe(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Pe(n)}}function ut(e){e.modified_||(e.modified_=!0,e.parent_&&ut(e.parent_))}function ft(e){e.copy_||(e.copy_=Ue(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Le(lt,((e,t)=>{st[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),st.deleteProperty=function(e,t){return st.set.call(this,e,t,void 0)},st.set=function(e,t,n){return lt.set.call(this,e[0],t,n,e[0])};function pt(e,t){const n=He(e)?Ze("MapSet").proxyMap_(e,t):Ve(e)?Ze("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Je(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=lt;n&&(o=[r],i=st);const{revoke:a,proxy:l}=Proxy.revocable(o,i);return r.draft_=l,r.revoke_=a,l}(e,t);return(t?t.scope_:Je()).drafts_.push(n),n}function ht(e){if(!Te(e)||Ye(e))return e;const t=e[Re];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ue(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ue(e,!0);return Le(n,((e,t)=>{Fe(n,e,ht(t))})),t&&(t.finalized_=!1),n}var gt=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&&Ae(6),void 0!==n&&"function"!=typeof n&&Ae(7),Te(e)){const o=tt(this),i=pt(e,void 0);let a=!0;try{r=t(i),a=!1}finally{a?Qe(o):et(o)}return Ge(o,n),rt(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===De&&(r=void 0),this.autoFreeze_&&Ke(r,!0),n){const t=[],o=[];Ze("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}Ae(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){Te(e)||Ae(8),Be(e)&&(e=function(e){Be(e)||Ae(10);return ht(e)}(e));const t=tt(this),n=pt(e,void 0);return n[Re].isManual_=!0,et(t),n}finishDraft(e,t){const n=e&&e[Re];n&&n.isManual_||Ae(9);const{scope_:r}=n;return Ge(r,t),rt(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=Ze("Patches").applyPatches_;return Be(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},vt=gt.produce;gt.produceWithPatches.bind(gt),gt.setAutoFreeze.bind(gt),gt.setUseStrictShallowCopy.bind(gt),gt.applyPatches.bind(gt);var mt=gt.createDraft.bind(gt),yt=gt.finishDraft.bind(gt);function bt(e,t){switch(t.type){case"set_slate":{const{properties:n,blockId:r}=t,o=e.blockEditorsMap[r];if(o){const{slateOps:e,selectionBefore:t}=n;m.withoutNormalizing(o,(()=>{for(const t of e)o.apply(t);if(t)try{w.select(o,t),_.focus(o)}catch(e){}}))}break}case"insert_block":e.blockEditorsMap[t.block.id]=pe(e),e.children[t.block.id]=t.block,e.blockEditorsMap[t.block.id].children=t.block.value,Object.keys(e.children).forEach((n=>{const r=e.children[n];r.meta.order>=t.block.meta.order&&r.id!==t.block.id&&Be(e.children[r.id])&&(r.meta.order=r.meta.order+1)}));break;case"delete_block":{delete e.blockEditorsMap[t.block.id],delete e.children[t.block.id];const n=Object.values(e.children);n.forEach((e=>{e.meta.order>t.block.meta.order&&(Be(e)?e.meta.order--:vt(e,(e=>{e.meta.order--})))})),n.sort(((e,t)=>e.meta.order-t.meta.order)),n.forEach(((e,t)=>{Be(e.meta)?e.meta.order=t:vt(e,(e=>{e.meta=Object.assign(Object.assign({},e.meta),{order:t})}))}));break}case"set_block_value":{const{id:n,value:r,forceSlate:o}=t,i=e.blockEditorsMap[n];o&&i&&(i.children=r),Array.isArray(r)&&(Be(e.children[n])?e.children[n].value=r:vt(e.children[n],(e=>{e.value=r})));break}case"set_block_meta":{const{id:n,prevProperties:r,properties:o}=t,i=e.children[n];if(!i)break;Be(i)?Object.keys(o).forEach((e=>{i.meta[e]=o[e]})):vt(i,(e=>{e.meta=Object.assign(Object.assign({},e.meta),o)}));break}case"split_block":{const{properties:n}=t,r=pe(e);r.children=n.nextSlateValue,e.children[n.nextBlock.id]=Object.assign(Object.assign({},n.nextBlock),{value:r.children}),e.blockEditorsMap[n.nextBlock.id]=r;const o=e.blockEditorsMap[t.prevProperties.originalBlock.id];o.children=n.splitSlateValue,e.children[t.prevProperties.originalBlock.id].value=o.children,Object.values(e.children).forEach((e=>{e.meta.order>=n.nextBlock.meta.order&&e.id!==n.nextBlock.id&&(Be(e)?e.meta.order++:vt(e,(e=>{e.meta.order++})))}));break}case"merge_block":{const{prevProperties:n,properties:r}=t;delete e.blockEditorsMap[n.sourceBlock.id],delete e.children[n.sourceBlock.id],e.children[r.mergedBlock.id]=r.mergedBlock,e.blockEditorsMap[r.mergedBlock.id].children=r.mergedSlateValue,Object.values(e.children).forEach((e=>{e.meta.order>r.mergedBlock.meta.order&&(Be(e)?e.meta.order--:vt(e,(e=>{e.meta.order--})))}));break}case"move_block":{const{prevProperties:n,properties:r}=t,o=e.children[n.id];o&&(o.meta.order=r.order,Object.values(e.children).forEach((e=>{e.id!==n.id&&(n.order<r.order?e.meta.order>n.order&&e.meta.order<=r.order&&e.meta.order--:e.meta.order<n.order&&e.meta.order>=r.order&&e.meta.order++)})));break}case"set_block_path":e.path=t.path;break;case"normalize_block_paths":{const t=Object.values(e.children);t.sort(((e,t)=>e.meta.order-t.meta.order)),t.forEach(((e,t)=>{Be(e.meta)?e.meta.order=t:vt(e,(e=>{e.meta=Object.assign(Object.assign({},e.meta),{order:t})}))}));break}}}const wt=100;function xt(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return void console.warn("No slate found");let i=e=>y.isElement(e);(null==n?void 0:n.type)&&(i=e=>y.isElement(e)&&e.type===(null==n?void 0:n.type));try{const[e]=m.nodes(o,{at:(null==n?void 0:n.path)||o.selection||[0],match:i,mode:"lowest"});return e}catch(e){}}function kt(e,t,n){const r=xt(e,t,n);if(r)return r[0]}const Et={createElement:function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const i=re(e,{at:o.meta.order});i?m.withoutNormalizing(i,(()=>{const a=e.blocks[o.type],l=a.elements[n.type],s=z({type:n.type,props:Object.assign(Object.assign({},l.props),n.props)}),c=Object.keys(a.elements);let d=[];c.forEach((e=>{const t=a.elements[e];e===n.type&&Array.isArray(t.children)&&t.children.length>0&&t.children.forEach((e=>{const t=a.elements[e];d.push(z({type:e,props:t.props}))}))})),d.length>0&&(s.children=d);const{path:u,focus:f=!0}=r||{};let p;const h=xt(e,t,{type:n.type});if(h){const[,e]=h;k.isPath(u)?p=u:"prev"===u?p=k.previous(e):"next"===u&&(p=k.next(e))}if(w.insertNodes(i,s,{at:p,select:f}),f&&d.length>0){const n=d[0],r=xt(e,t,{path:p,type:n.type});if(r){const[,e]=r;w.select(i,e)}}e.emit("change",e.children)})):console.warn("No slate found")},deleteElement:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});o?m.withoutNormalizing(o,(()=>{w.removeNodes(o,{at:n.path,match:e=>y.isElement(e)&&e.type===n.type}),e.emit("change",e.children)})):console.warn("No slate found")},updateElement:function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const i=re(e,{at:o.meta.order});i?m.withoutNormalizing(i,(()=>{const[t]=m.nodes(i,{at:(null==r?void 0:r.path)||[0],match:e=>y.isElement(e)&&e.type===n.type}),o=null==t?void 0:t[0],a=null==t?void 0:t[1],l=(null==o?void 0:o.props)||{},s={props:Object.assign(Object.assign({},l),n.props)};w.setNodes(i,s,{at:(null==r?void 0:r.path)||a||[0],match:e=>y.isElement(e)&&e.type===n.type,mode:"lowest"}),e.emit("change",e.children)})):console.warn("No slate found")},insertElementText:function(e,t,n){const{blockId:r,focus:o}=n||{},i=r?e.children[r]:ne(e);if(!i)return void console.warn(`To set text programmatically, you must provide a valid blockId. Got: ${r}`);const a=re(e,{at:i.meta.order});if(!a)return void console.warn("No slate found");const l=e.blocks[i.type],s=Array.from({length:Object.keys(l.elements).length},(e=>0));let c=a.selection||s;c?m.withoutNormalizing(a,(()=>{O.isRange(c)&&!O.isCollapsed(c)&&w.collapse(a,{edge:"end"}),w.insertText(a,t,{at:c}),e.emit("change",e.children),o&&e.focusBlock(i.id,{waitExecution:!0,shouldUpdateBlockSelection:!0})})):console.warn("No valid path or selection found for text insertion")},getElement:kt,getElementChildren:function(e,t,n){const r=kt(e,t,n);if(r)return r.children},getElementEntry:xt,isElementEmpty:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return void console.warn("No slate found");const[i]=m.nodes(o,{at:n.path||o.selection,match:e=>y.isElement(e)&&e.type===n.type});if(i){const[e,t]=i;return 0===m.string(o,t).trim().length}return!1},getElementPath:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(o)try{return _.findPath(o,n)}catch(e){}else console.warn("No slate found")},getParentElementPath:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return console.warn("No slate found"),[];try{const e=_.findPath(o,n);return k.parent(e)}catch(e){}}};function Ot(e){var t;const n=ne(e),r=re(e,{at:e.path.current}),o=Z.getPreviousPath(e),i=re(e,{at:o}),a=ne(e,{at:o}),l=e.blocks[(null==a?void 0:a.type)||""];if(!(r&&n&&i&&a))return;const s=Et.getElement(e,a.id);if(l&&!l.hasCustomEditor&&"void"!==(null===(t=null==s?void 0:s.props)||void 0===t?void 0:t.nodeType)){try{const e=q(i);w.select(i,e)}catch(e){w.select(i,m.start(i,[]))}m.withoutNormalizing(i,(()=>{const t=[],o=function(e,t){const n=JSON.parse(JSON.stringify(e.children)),r=JSON.parse(JSON.stringify(t.children)),o=n[n.length-1],i=r[0];return b.isText(o)&&b.isText(i)?(o.text+=i.text,[...n.slice(0,-1),o,...r.slice(1)]):[...n,...r]}(i.children[0],r.children[0]),l=[Object.assign(Object.assign({},i.children[0]),{children:o})],s=Object.assign(Object.assign({},a),{value:l});t.push({type:"merge_block",prevProperties:{sourceBlock:n,sourceSlateValue:r.children,targetBlock:a,targetSlateValue:i.children},properties:{mergedBlock:s,mergedSlateValue:l},path:e.path}),e.applyTransforms(t),e.setPath({current:a.meta.order});try{_.focus(i)}catch(e){console.error("Error setting focus:",e)}}))}}function St(e){var t,n,r;return{id:(null==e?void 0:e.id)||I(),value:(null==e?void 0:e.value)||[{id:I(),type:(null==r?void 0:r.type)||"paragraph",children:(null==r?void 0:r.children)||[{text:""}],props:Object.assign({nodeType:"block"},null==r?void 0:r.props)}],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:(null===(t=null==e?void 0:e.meta)||void 0===t?void 0:t.order)||0,depth:(null===(n=null==e?void 0:e.meta)||void 0===n?void 0:n.depth)||0},null==e?void 0:e.meta)}}const Ct={insertBlock:W,deleteBlock:G,moveBlock:Q,focusBlock:te,splitBlock:se,increaseBlockDepth:ce,decreaseBlockDepth:de,duplicateBlock:me,updateBlock:ye,toggleBlock:ke,getBlock:Oe,getSlate:J,buildDefaultChildren:()=>{const e=I();return{[e]:St({id:e})}},buildBlockData:St,mergeBlock:Ot};const _t=new WeakMap,Dt=new WeakMap,jt={isMergingHistory:e=>Dt.get(e),isSavingHistory:e=>_t.get(e),withMergingHistory(e,t){const n=jt.isMergingHistory(e);Dt.set(e,!0),t(),Dt.set(e,n)},withoutMergingHistory(e,t){const n=jt.isMergingHistory(e);Dt.set(e,!1),t(),Dt.set(e,n)},withoutSavingHistory(e,t){const n=jt.isSavingHistory(e);_t.set(e,!1),t(),_t.set(e,n)},redo:(e,t)=>{const{redos:n}=e.historyStack;if(n.length>0){const r=n[n.length-1];jt.withoutSavingHistory(e,(()=>{e.applyTransforms(r.operations,{source:"history"}),e.setPath(r.path);const{scroll:n=!0}=t||{};if(n&&"number"==typeof r.path.current){const t=Ct.getBlock(e,{at:r.path.current}),n=document.querySelector(`[data-yoopta-block-id="${null==t?void 0:t.id}"]`);n&&!Rt(n)&&n.scrollIntoView({block:"center",behavior:"auto"})}})),e.historyStack.redos.pop(),e.historyStack.undos.push(r)}},undo:(e,t)=>{const{undos:n}=e.historyStack;if(n.length>0){const n=e.historyStack.undos[e.historyStack.undos.length-1];jt.withoutSavingHistory(e,(()=>{const r=n.operations.flatMap((e=>function(e,t){switch(t.type){case"insert_block":return{type:"delete_block",path:t.path,block:t.block};case"delete_block":return{type:"insert_block",path:t.path,block:t.block};case"set_block_meta":return{type:"set_block_meta",id:t.id,properties:t.prevProperties,prevProperties:t.properties};case"split_block":return[{type:"delete_block",block:t.properties.nextBlock,path:t.path},{type:"set_block_value",id:t.prevProperties.originalBlock.id,value:t.prevProperties.originalValue,forceSlate:!0}];case"merge_block":return[{type:"split_block",properties:{nextBlock:t.prevProperties.sourceBlock,nextSlateValue:t.prevProperties.sourceSlateValue,splitSlateValue:t.prevProperties.targetSlateValue},prevProperties:{originalBlock:t.properties.mergedBlock,originalValue:t.properties.mergedSlateValue},path:t.path}];case"move_block":return{type:"move_block",properties:t.prevProperties,prevProperties:t.properties};case"set_slate":return{type:"set_slate",properties:{slateOps:t.properties.slateOps.map(C.inverse).reverse(),selectionBefore:t.properties.selectionBefore},slate:t.slate,blockId:t.blockId};default:return t}}(0,e))).reverse();e.applyTransforms(r,{source:"history"}),e.setPath(n.path);const{scroll:o=!0}=t||{};if(o&&"number"==typeof n.path.current){const t=Ct.getBlock(e,{at:n.path.current}),r=document.querySelector(`[data-yoopta-block-id="${null==t?void 0:t.id}"]`);r&&!Rt(r)&&r.scrollIntoView({block:"center",behavior:"auto"})}})),e.historyStack.redos.push(n),e.historyStack.undos.pop()}}};function Rt(e){var t=e.getBoundingClientRect(),n=document.documentElement;return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||n.clientHeight)&&t.right<=(window.innerWidth||n.clientWidth)}function At(){const e={id:"",children:{},path:{current:null},readOnly:!1,isEmpty:()=>function(e){const t=Object.values(e.children);if(t.length>1)return!1;const n=t[0];if(!n)return!0;if("Paragraph"!==n.type)return!1;const r=re(e,{at:n.meta.order});if(!r)return!0;try{return!(m.string(r,[0]).length>0)}catch(e){return!0}}(e),getEditorValue:()=>function(e){return e.children}(e),setEditorValue:(...t)=>function(e,t){e.children=t,e.blockEditorsMap=ve(e),e.emit("change",e.children)}(e,...t),insertBlock:(...t)=>W(e,...t),deleteBlock:(...t)=>G(e,...t),duplicateBlock:(...t)=>me(e,...t),toggleBlock:(...t)=>ke(e,...t),increaseBlockDepth:(...t)=>ce(e,...t),decreaseBlockDepth:(...t)=>de(e,...t),moveBlock:(...t)=>Q(e,...t),focusBlock:(...t)=>te(e,...t),getBlock:(...t)=>Oe(e,...t),updateBlock:(...t)=>ye(e,...t),splitBlock:(...t)=>se(e,...t),mergeBlock:(...t)=>Ot(e,...t),setPath:(...t)=>X(e,...t),blockEditorsMap:{},blocks:{},formats:{},shortcuts:{},plugins:{},commands:{},applyTransforms:(t,...n)=>function(e,t,n){e.children=mt(e.children),e.path=mt(e.path);const{normalizePaths:r=!0,source:o}=n||{},i=[...t];r&&i.push({type:"normalize_block_paths"}),i.sort(((e,t)=>"insert_block"===e.type&&"insert_block"===t.type?e.block.meta.order-t.block.meta.order:0));for(const t of i)"set_slate"===t.type&&"api"===o||bt(e,t);Be(e.children)||(e.children=mt(e.children)),e.children=yt(e.children),Be(e.path)&&(e.path=yt(e.path));const a={operations:i.filter((e=>"set_block_path"!==e.type&&"set_block_value"!==e.type&&"normalize_block_paths"!==e.type)),path:e.path};a.operations.length>0&&"history"!==o&&(e.historyStack.undos.push(a),e.historyStack.redos=[]),e.historyStack.undos.length>wt&&e.historyStack.undos.shift(),e.emit("change",{value:e.children,operations:i}),e.emit("path-change",e.path)}(e,t,...n),batchOperations:t=>function(e,t){const n=[],r=e.applyTransforms;e.applyTransforms=e=>{n.push(...e)},t(),e.applyTransforms=r,n.length>0&&e.applyTransforms(n)}(e,t),on:(e,t)=>{},off:(e,t)=>{},emit:(e,...t)=>{},once:(e,t)=>{},isFocused:()=>function(e){return!!ee.get(e)}(e),focus:()=>function(e){if(e.readOnly)return;const t=ne(e,{at:0});t&&(ee.set(e,!0),e.focusBlock(t.id,{waitExecution:!0}),e.emit("focus",!0))}(e),blur:(...t)=>function(e,t={}){var n;const r=null!==(n=t.slate)&&void 0!==n?n:re(e);if(!r)return;const{waitExecution:o,waitExecutionMs:i}=t;o?setTimeout((()=>Ee(e,r)),i):(ee.set(e,!1),Ee(e,r),e.emit("blur",!1))}(e,...t),getHTML:t=>_e(e,t),getMarkdown:t=>function(e,t){return function(e,t){return t.sort(((e,t)=>e.meta.order>t.meta.order?1:-1)).map((t=>{var n,r;const o=e.plugins[t.type];if(o){const e=t.value[0];if(null===(r=null===(n=o.parsers)||void 0===n?void 0:n.markdown)||void 0===r?void 0:r.serialize){const t=o.parsers.markdown.serialize(e,e.children.map((e=>e.text)).join(""));if(t)return t}}return""})).join("\n")}(e,Object.values(t))}(e,t),getPlainText:t=>function(e,t){const n=_e(e,t),r=document.createElement("div");return r.innerHTML=n,r.innerText}(e,t),refElement:null,historyStack:{undos:[],redos:[]},redo:t=>jt.redo(e,t),undo:t=>jt.undo(e,t),isSavingHistory:()=>jt.isSavingHistory(e),isMergingHistory:()=>jt.isMergingHistory(e),withoutSavingHistory:t=>jt.withoutSavingHistory(e,t),withoutMergingHistory:t=>jt.withoutMergingHistory(e,t),withMergingHistory:t=>jt.withMergingHistory(e,t)};return e}const Pt={editor:At()},Bt=i(Pt),Tt=({children:t,editorState:n})=>{const r=l(Pt);return r.current={editor:n.editor},e(Bt.Provider,Object.assign({value:r.current},{children:t}))},Nt=()=>{const e=a(Bt);if(!e)throw new Error("useYooptaEditor must be used within a YooptaEditorContext");return e.editor},Mt=e=>Nt().children[e],Lt=()=>Nt().isFocused(),It=()=>Nt().readOnly,zt=e=>{var t;return null===(t=Nt().plugins[e])||void 0===t?void 0:t.options},Ft=({blockId:e,at:t})=>{const n=Nt();if(!e&&"number"!=typeof t)throw new Error("useBlockSelected must receive either blockId or at");let r;return e&&(r=n.children[e]),t&&(r=Ct.getBlock(n,{at:t})),n.path.current===(null==r?void 0:r.meta.order)};var Ht={};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new o(r,i||e,a),s=n?n+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],l]:e._events[s].push(l):(e._events[s]=l,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},l.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o<i;o++)a[o]=r[o].fn;return a},l.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,o,i,a){var l=n?n+e:e;if(!this._events[l])return!1;var s,c,d=this._events[l],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,o),!0;case 5:return d.fn.call(d.context,t,r,o,i),!0;case 6:return d.fn.call(d.context,t,r,o,i,a),!0}for(c=1,s=new Array(u-1);c<u;c++)s[c-1]=arguments[c];d.fn.apply(d.context,s)}else{var f,p=d.length;for(c=0;c<p;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),u){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,r);break;case 4:d[c].fn.call(d[c].context,t,r,o);break;default:if(!s)for(f=1,s=new Array(u-1);f<u;f++)s[f-1]=arguments[f];d[c].fn.apply(d[c].context,s)}}return!0},l.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return a(this,i),this;var l=this._events[i];if(l.fn)l.fn!==t||o&&!l.once||r&&l.context!==r||a(this,i);else{for(var s=0,c=[],d=l.length;s<d;s++)(l[s].fn!==t||o&&!l[s].once||r&&l[s].context!==r)&&c.push(l[s]);c.length?this._events[i]=1===c.length?c[0]:c:a(this,i)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l}({get exports(){return Ht},set exports(e){Ht=e}});var Vt=Ht;const $t="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function Ut(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Kt(e){return"nodeType"in e}function Wt(e){var t,n;return e?Ut(e)?e:Kt(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function Yt(e){const{Document:t}=Wt(e);return e instanceof t}function Xt(e){return!Ut(e)&&e instanceof Wt(e).HTMLElement}function qt(e){return e instanceof Wt(e).SVGElement}function Zt(e){return e?Ut(e)?e.document:Kt(e)?Yt(e)?e:Xt(e)||qt(e)?e.ownerDocument:document:document:document}const Jt=$t?s:c;function Gt(e){const t=l(e);return Jt((()=>{t.current=e})),u((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)}),[])}function Qt(e,t){void 0===t&&(t=[e]);const n=l(e);return Jt((()=>{n.current!==e&&(n.current=e)}),t),n}function en(e,t){const n=l();return d((()=>{const t=e(n.current);return n.current=t,t}),[...t])}function tn(e){const t=Gt(e),n=l(null),r=u((e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,r]}function nn(e){const t=l();return c((()=>{t.current=e}),[e]),t.current}let rn={};function on(e,t){return d((()=>{if(t)return t;const n=null==rn[e]?0:rn[e]+1;return rn[e]=n,e+"-"+n}),[e,t])}function an(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce(((t,n)=>{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t}),{...t})}}const ln=an(1),sn=an(-1);function cn(e){if(!e)return!1;const{KeyboardEvent:t}=Wt(e.target);return t&&e instanceof t}function dn(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=Wt(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const un=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[un.Translate.toString(e),un.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),fn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function pn(e){return e.matches(fn)?e:e.querySelector(fn)}const hn={display:"none"};function gn(e){let{id:t,value:n}=e;return o.createElement("div",{id:t,style:hn},n)}function vn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return o.createElement("div",{id:t,style:{position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const mn=i(null);const yn={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},bn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function wn(e){let{announcements:t=bn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=yn}=e;const{announce:l,announcement:s}=function(){const[e,t]=f("");return{announce:u((e=>{null!=e&&t(e)}),[]),announcement:e}}(),p=on("DndLiveRegion"),[h,g]=f(!1);if(c((()=>{g(!0)}),[]),function(e){const t=a(mn);c((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}(d((()=>({onDragStart(e){let{active:n}=e;l(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&l(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;l(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;l(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;l(t.onDragCancel({active:n,over:r}))}})),[l,t])),!h)return null;const v=o.createElement(o.Fragment,null,o.createElement(gn,{id:r,value:i.draggable}),o.createElement(vn,{id:p,announcement:s}));return n?N(v,n):v}var xn;function kn(){}function En(e,t){return d((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(xn||(xn={}));const On=Object.freeze({x:0,y:0});function Sn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Cn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function _n(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Dn(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function jn(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function Rn(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const An=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Rn(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=Sn(Rn(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(Cn)};function Pn(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,l=i-n;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=a*l;return Number((o/(n+r-o)).toFixed(4))}return 0}const Bn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const e of r){const{id:r}=e,i=n.get(r);if(i){const n=Pn(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(_n)};function Tn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:On}function Nn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce(((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const Mn=Nn(1);const Ln={ignoreTransform:!1};function In(e,t){void 0===t&&(t=Ln);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=Wt(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:l}=r,s=e.left-a-(1-o)*parseFloat(n),c=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:c,right:s+d,bottom:c+u,left:s}}(n,t,r))}const{top:r,left:o,width:i,height:a,bottom:l,right:s}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:s}}function zn(e){return In(e,{ignoreTransform:!0})}function Fn(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(Yt(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Xt(o)||qt(o))return n;if(n.includes(o))return n;const i=Wt(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=Wt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const r=t[e];return"string"==typeof r&&n.test(r)}))}(o,i)&&n.push(o),function(e,t){return void 0===t&&(t=Wt(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function Hn(e){const[t]=Fn(e,1);return null!=t?t:null}function Vn(e){return $t&&e?Ut(e)?e:Kt(e)?Yt(e)||e===Zt(e).scrollingElement?window:Xt(e)?e:null:null:null}function $n(e){return Ut(e)?e.scrollX:e.scrollLeft}function Un(e){return Ut(e)?e.scrollY:e.scrollTop}function Kn(e){return{x:$n(e),y:Un(e)}}var Wn;function Yn(e){return!(!$t||!e)&&e===document.scrollingElement}function Xn(e){const t={x:0,y:0},n=Yn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Wn||(Wn={}));const qn={x:.2,y:.2};function Zn(e,t,n,r,o){let{top:i,left:a,right:l,bottom:s}=n;void 0===r&&(r=10),void 0===o&&(o=qn);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=Xn(e),p={x:0,y:0},h={x:0,y:0},g=t.height*o.y,v=t.width*o.x;return!c&&i<=t.top+g?(p.y=Wn.Backward,h.y=r*Math.abs((t.top+g-i)/g)):!d&&s>=t.bottom-g&&(p.y=Wn.Forward,h.y=r*Math.abs((t.bottom-g-s)/g)),!f&&l>=t.right-v?(p.x=Wn.Forward,h.x=r*Math.abs((t.right-v-l)/v)):!u&&a<=t.left+v&&(p.x=Wn.Backward,h.x=r*Math.abs((t.left+v-a)/v)),{direction:p,speed:h}}function Jn(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Gn(e){return e.reduce(((e,t)=>ln(e,Kn(t))),On)}const Qn=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+$n(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+Un(t)),0)}]];class er{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Fn(t),r=Gn(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of Qn)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),a=r[e]-t;return this.rect[i]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class tr{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function nr(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var rr,or;function ir(e){e.preventDefault()}function ar(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(rr||(rr={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(or||(or={}));const lr={start:[or.Space,or.Enter],cancel:[or.Esc],end:[or.Space,or.Enter]},sr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case or.Right:return{...n,x:n.x+25};case or.Left:return{...n,x:n.x-25};case or.Down:return{...n,y:n.y+25};case or.Up:return{...n,y:n.y-25}}};class cr{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new tr(Zt(t)),this.windowListeners=new tr(Wt(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(rr.Resize,this.handleCancel),this.windowListeners.add(rr.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(rr.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=In),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Hn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(On)}handleKeyDown(e){if(cn(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=lr,coordinateGetter:i=sr,scrollBehavior:a="smooth"}=r,{code:l}=e;if(o.end.includes(l))return void this.handleEnd(e);if(o.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:On;this.referenceCoordinates||(this.referenceCoordinates=c);const d=i(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=sn(d,c),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:l,isLeft:s,isBottom:c,maxScroll:u,minScroll:f}=Xn(n),p=Jn(n),h={x:Math.min(o===or.Right?p.right-p.width/2:p.right,Math.max(o===or.Right?p.left:p.left+p.width/2,d.x)),y:Math.min(o===or.Down?p.bottom-p.height/2:p.bottom,Math.max(o===or.Down?p.top:p.top+p.height/2,d.y))},g=o===or.Right&&!l||o===or.Left&&!s,v=o===or.Down&&!c||o===or.Up&&!i;if(g&&h.x!==d.x){const e=n.scrollLeft+t.x,i=o===or.Right&&e<=u.x||o===or.Left&&e>=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:a});r.x=i?n.scrollLeft-e:o===or.Right?n.scrollLeft-u.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(v&&h.y!==d.y){const e=n.scrollTop+t.y,i=o===or.Down&&e<=u.y||o===or.Up&&e>=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:a});r.y=i?n.scrollTop-e:o===or.Down?n.scrollTop-u.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:a});break}}this.handleMove(e,ln(sn(d,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function dr(e){return Boolean(e&&"distance"in e)}function ur(e){return Boolean(e&&"delay"in e)}cr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=lr,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class fr{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=Wt(e);return e instanceof t?e:Zt(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:o}=e,{target:i}=o;this.props=e,this.events=t,this.document=Zt(i),this.documentListeners=new tr(this.document),this.listeners=new tr(n),this.windowListeners=new tr(Wt(i)),this.initialCoordinates=null!=(r=dn(o))?r:On,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(rr.Resize,this.handleCancel),this.windowListeners.add(rr.DragStart,ir),this.windowListeners.add(rr.VisibilityChange,this.handleCancel),this.windowListeners.add(rr.ContextMenu,ir),this.documentListeners.add(rr.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ur(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(dr(t))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(rr.Click,ar,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(rr.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!r)return;const l=null!=(t=dn(e))?t:On,s=sn(r,l);if(!n&&a){if(dr(a)){if(null!=a.tolerance&&nr(s,a.tolerance))return this.handleCancel();if(nr(s,a.distance))return this.handleStart()}return ur(a)&&nr(s,a.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===or.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const pr={move:{name:"pointermove"},end:{name:"pointerup"}};class hr extends fr{constructor(e){const{event:t}=e,n=Zt(t.target);super(e,pr,n)}}hr.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const gr={move:{name:"mousemove"},end:{name:"mouseup"}};var vr;!function(e){e[e.RightClick=2]="RightClick"}(vr||(vr={}));(class extends fr{constructor(e){super(e,gr,Zt(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==vr.RightClick&&(null==r||r({event:n}),!0)}}];const mr={move:{name:"touchmove"},end:{name:"touchend"}};var yr,br;function wr(e){let{acceleration:t,activator:n=yr.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:s=br.TreeOrder,pointerCoordinates:f,scrollableAncestors:p,scrollableAncestorRects:h,delta:g,threshold:v}=e;const m=function(e){let{delta:t,disabled:n}=e;const r=nn(t);return en((e=>{if(n||!r||!e)return xr;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Wn.Backward]:e.x[Wn.Backward]||-1===o.x,[Wn.Forward]:e.x[Wn.Forward]||1===o.x},y:{[Wn.Backward]:e.y[Wn.Backward]||-1===o.y,[Wn.Forward]:e.y[Wn.Forward]||1===o.y}}}),[n,t,r])}({delta:g,disabled:!i}),[y,b]=function(){const e=l(null);return[u(((t,n)=>{e.current=setInterval(t,n)}),[]),u((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),w=l({x:0,y:0}),x=l({x:0,y:0}),k=d((()=>{switch(n){case yr.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case yr.DraggableRect:return o}}),[n,o,f]),E=l(null),O=u((()=>{const e=E.current;if(!e)return;const t=w.current.x*x.current.x,n=w.current.y*x.current.y;e.scrollBy(t,n)}),[]),S=d((()=>s===br.TreeOrder?[...p].reverse():p),[s,p]);c((()=>{if(i&&p.length&&k){for(const e of S){if(!1===(null==r?void 0:r(e)))continue;const n=p.indexOf(e),o=h[n];if(!o)continue;const{direction:i,speed:l}=Zn(e,o,k,t,v);for(const e of["x","y"])m[e][i[e]]||(l[e]=0,i[e]=0);if(l.x>0||l.y>0)return b(),E.current=e,y(O,a),w.current=l,void(x.current=i)}w.current={x:0,y:0},x.current={x:0,y:0},b()}else b()}),[t,O,r,b,i,a,JSON.stringify(k),JSON.stringify(m),y,p,S,h,JSON.stringify(v)])}(class extends fr{constructor(e){super(e,mr)}static setup(){return window.addEventListener(mr.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(mr.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return!(o.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(yr||(yr={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(br||(br={}));const xr={x:{[Wn.Backward]:!1,[Wn.Forward]:!1},y:{[Wn.Backward]:!1,[Wn.Forward]:!1}};var kr,Er;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(kr||(kr={})),function(e){e.Optimized="optimized"}(Er||(Er={}));const Or=new Map;function Sr(e,t){return en((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function Cr(e){let{callback:t,disabled:n}=e;const r=Gt(t),o=d((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)}),[n]);return c((()=>()=>null==o?void 0:o.disconnect()),[o]),o}function _r(e){return new er(In(e),e)}function Dr(e,t,n){void 0===t&&(t=_r);const[r,o]=h((function(r){if(!e)return null;var o;if(!1===e.isConnected)return null!=(o=null!=r?r:n)?o:null;const i=t(e);if(JSON.stringify(r)===JSON.stringify(i))return r;return i}),null),i=function(e){let{callback:t,disabled:n}=e;const r=Gt(t),o=d((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)}),[r,n]);return c((()=>()=>null==o?void 0:o.disconnect()),[o]),o}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),a=Cr({callback:o});return Jt((()=>{o(),e?(null==a||a.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==a||a.disconnect(),null==i||i.disconnect())}),[e]),r}const jr=[];function Rr(e,t){void 0===t&&(t=[]);const n=l(null);return c((()=>{n.current=null}),t),c((()=>{const t=e!==On;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?sn(e,n.current):On}function Ar(e){return d((()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null),[e])}const Pr=[];function Br(e){let{measure:t}=e;const[n,r]=f(null),o=u((e=>{for(const{target:n}of e)if(Xt(n)){r((e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r}));break}}),[t]),i=Cr({callback:o}),a=u((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Xt(t)?t:e}(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)}),[t,i]),[l,s]=tn(a);return d((()=>({nodeRef:l,rect:n,setRef:s})),[n,l,s])}const Tr=[{sensor:hr,options:{}},{sensor:cr,options:{}}],Nr={current:{}},Mr={draggable:{measure:zn},droppable:{measure:zn,strategy:kr.WhileDragging,frequency:Er.Optimized},dragOverlay:{measure:In}};class Lr extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const Ir={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Lr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:kn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mr,measureDroppableContainers:kn,windowRect:null,measuringScheduled:!1},zr=i({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:kn,draggableNodes:new Map,over:null,measureDroppableContainers:kn}),Fr=i(Ir);function Hr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Lr}}}function Vr(e,t){switch(t.type){case xn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case xn.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case xn.DragEnd:case xn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case xn.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Lr(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case xn.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Lr(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case xn.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Lr(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function $r(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=a(zr),i=nn(r),l=nn(null==n?void 0:n.id);return c((()=>{if(!t&&!r&&i&&null!=l){if(!cn(i))return;if(document.activeElement===i.target)return;const e=o.get(l);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=pn(e);if(t){t.focus();break}}}))}}),[r,t,o,l,i]),null}const Ur=i({...On,scaleX:1,scaleY:1});var Kr;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Kr||(Kr={}));const Wr=p((function(e){var t,n,r,i;let{id:a,accessibility:s,autoScroll:p=!0,children:g,sensors:v=Tr,collisionDetection:m=Bn,measuring:y,modifiers:b,...w}=e;const x=h(Vr,void 0,Hr),[k,E]=x,[O,S]=function(){const[e]=f((()=>new Set)),t=u((t=>(e.add(t),()=>e.delete(t))),[e]);return[u((t=>{let{type:n,event:r}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)}))}),[e]),t]}(),[C,_]=f(Kr.Uninitialized),D=C===Kr.Initialized,{draggable:{active:j,nodes:R,translate:A},droppable:{containers:P}}=k,B=j?R.get(j):null,N=l({initial:null,translated:null}),M=d((()=>{var e;return null!=j?{id:j,data:null!=(e=null==B?void 0:B.data)?e:Nr,rect:N}:null}),[j,B]),L=l(null),[I,z]=f(null),[F,H]=f(null),V=Qt(w,Object.values(w)),$=on("DndDescribedBy",a),U=d((()=>P.getEnabled()),[P]),K=d((()=>({draggable:{...Mr.draggable,...null==W?void 0:W.draggable},droppable:{...Mr.droppable,...null==W?void 0:W.droppable},dragOverlay:{...Mr.dragOverlay,...null==W?void 0:W.dragOverlay}})),[null==(W=y)?void 0:W.draggable,null==W?void 0:W.droppable,null==W?void 0:W.dragOverlay]);var W;const{droppableRects:Y,measureDroppableContainers:X,measuringScheduled:q}=function(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=f(null),{frequency:s,measure:d,strategy:p}=o,h=l(e),g=function(){switch(p){case kr.Always:return!1;case kr.BeforeDragging:return n;default:return!n}}(),v=Qt(g),m=u((function(e){void 0===e&&(e=[]),v.current||a((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[v]),y=l(null),b=en((t=>{if(g&&!n)return Or;if(!t||t===Or||h.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new er(d(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t}),[e,i,n,g,d]);return c((()=>{h.current=e}),[e]),c((()=>{g||m()}),[n,g]),c((()=>{i&&i.length>0&&a(null)}),[JSON.stringify(i)]),c((()=>{g||"number"!=typeof s||null!==y.current||(y.current=setTimeout((()=>{m(),y.current=null}),s))}),[s,g,m,...r]),{droppableRects:b,measureDroppableContainers:m,measuringScheduled:null!=i}}(U,{dragging:D,dependencies:[A.x,A.y],config:K.droppable}),Z=function(e,t){const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return en((e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])}(R,j),J=d((()=>F?dn(F):null),[F]),G=function(){const e=!1===(null==I?void 0:I.autoScrollEnabled),t="object"==typeof p?!1===p.enabled:!1===p,n=D&&!e&&!t;if("object"==typeof p)return{...p,enabled:n};return{enabled:n}}(),Q=function(e,t){return Sr(e,t)}(Z,K.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=l(!1),{x:a,y:s}="boolean"==typeof o?{x:o,y:o}:o;Jt((()=>{if(!a&&!s||!t)return void(i.current=!1);if(i.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const o=Tn(n(e),r);if(a||(o.x=0),s||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const t=Hn(e);t&&t.scrollBy({top:o.y,left:o.x})}}),[t,a,s,r,n])}({activeNode:j?R.get(j):null,config:G.layoutShiftCompensation,initialRect:Q,measure:K.draggable.measure});const ee=Dr(Z,K.draggable.measure,Q),te=Dr(Z?Z.parentElement:null),ne=l({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=P.getNodeFor(null==(t=ne.current.over)?void 0:t.id),oe=Br({measure:K.dragOverlay.measure}),ie=null!=(n=oe.nodeRef.current)?n:Z,ae=D?null!=(r=oe.rect)?r:ee:null,le=Boolean(oe.nodeRef.current&&oe.rect),se=Tn(ce=le?null:ee,Sr(ce));var ce;const de=Ar(ie?Wt(ie):null),ue=function(e){const t=l(e),n=en((n=>e?n&&n!==jr&&e&&t.current&&e.parentNode===t.current.parentNode?n:Fn(e):jr),[e]);return c((()=>{t.current=e}),[e]),n}(D?null!=re?re:Z:null),fe=function(e,t){void 0===t&&(t=In);const[n]=e,r=Ar(n?Wt(n):null),[o,i]=h((function(){return e.length?e.map((e=>Yn(e)?r:new er(t(e),e))):Pr}),Pr),a=Cr({callback:i});return e.length>0&&o===Pr&&i(),Jt((()=>{e.length?e.forEach((e=>null==a?void 0:a.observe(e))):(null==a||a.disconnect(),i())}),[e]),o}(ue),pe=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}(b,{transform:{x:A.x-se.x,y:A.y-se.y,scaleX:1,scaleY:1},activatorEvent:F,active:M,activeNodeRect:ee,containerNodeRect:te,draggingNodeRect:ae,over:ne.current.over,overlayNodeRect:oe.rect,scrollableAncestors:ue,scrollableAncestorRects:fe,windowRect:de}),he=J?ln(J,A):null,ge=function(e){const[t,n]=f(null),r=l(e),o=u((e=>{const t=Vn(e.target);t&&n((e=>e?(e.set(t,Kn(t)),new Map(e)):null))}),[]);return c((()=>{const t=r.current;if(e!==t){i(t);const a=e.map((e=>{const t=Vn(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,Kn(t)]):null})).filter((e=>null!=e));n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach((e=>{const t=Vn(e);null==t||t.removeEventListener("scroll",o)}))}}),[o,e]),d((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>ln(e,t)),On):Gn(e):On),[e,t])}(ue),ve=Rr(ge),me=Rr(ge,[ee]),ye=ln(pe,ve),be=ae?Mn(ae,pe):null,we=M&&be?m({active:M,collisionRect:be,droppableRects:Y,droppableContainers:U,pointerCoordinates:he}):null,xe=jn(we,"id"),[ke,Ee]=f(null),Oe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(le?pe:ln(pe,me),null!=(i=null==ke?void 0:ke.rect)?i:null,ee),Se=u(((e,t)=>{let{sensor:n,options:r}=t;if(null==L.current)return;const o=R.get(L.current);if(!o)return;const i=e.nativeEvent,a=new n({active:L.current,activeNode:o,event:i,options:r,context:ne,onStart(e){const t=L.current;if(null==t)return;const n=R.get(t);if(!n)return;const{onDragStart:r}=V.current,o={active:{id:t,data:n.data,rect:N}};T((()=>{null==r||r(o),_(Kr.Initializing),E({type:xn.DragStart,initialCoordinates:e,active:t}),O({type:"onDragStart",event:o})}))},onMove(e){E({type:xn.DragMove,coordinates:e})},onEnd:l(xn.DragEnd),onCancel:l(xn.DragCancel)});function l(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=ne.current;let a=null;if(t&&o){const{cancelDrop:l}=V.current;if(a={activatorEvent:i,active:t,collisions:n,delta:o,over:r},e===xn.DragEnd&&"function"==typeof l){await Promise.resolve(l(a))&&(e=xn.DragCancel)}}L.current=null,T((()=>{E({type:e}),_(Kr.Uninitialized),Ee(null),z(null),H(null);const t=e===xn.DragEnd?"onDragEnd":"onDragCancel";if(a){const e=V.current[t];null==e||e(a),O({type:t,event:a})}}))}}T((()=>{z(a),H(e.nativeEvent)}))}),[R]),Ce=u(((e,t)=>(n,r)=>{const o=n.nativeEvent,i=R.get(r);if(null!==L.current||!i||o.dndKit||o.defaultPrevented)return;const a={active:i};!0===e(n,t.options,a)&&(o.dndKit={capturedBy:t.sensor},L.current=r,Se(n,t))}),[R,Se]),_e=function(e,t){return d((()=>e.reduce(((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,n)})))]}),[])),[e,t])}(v,Ce);!function(e){c((()=>{if(!$t)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}(v),Jt((()=>{ee&&C===Kr.Initializing&&_(Kr.Initialized)}),[ee,C]),c((()=>{const{onDragMove:e}=V.current,{active:t,activatorEvent:n,collisions:r,over:o}=ne.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:ye.x,y:ye.y},over:o};T((()=>{null==e||e(i),O({type:"onDragMove",event:i})}))}),[ye.x,ye.y]),c((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=ne.current;if(!e||null==L.current||!t||!o)return;const{onDragOver:i}=V.current,a=r.get(xe),l=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,s={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:l};T((()=>{Ee(l),null==i||i(s),O({type:"onDragOver",event:s})}))}),[xe]),Jt((()=>{ne.current={activatorEvent:F,active:M,activeNode:Z,collisionRect:be,collisions:we,droppableRects:Y,draggableNodes:R,draggingNode:ie,draggingNodeRect:ae,droppableContainers:P,over:ke,scrollableAncestors:ue,scrollAdjustedTranslate:ye},N.current={initial:ae,translated:be}}),[M,Z,we,be,R,ie,ae,Y,P,ke,ue,ye]),wr({...G,delta:A,draggingRect:be,pointerCoordinates:he,scrollableAncestors:ue,scrollableAncestorRects:fe});const De=d((()=>({active:M,activeNode:Z,activeNodeRect:ee,activatorEvent:F,collisions:we,containerNodeRect:te,dragOverlay:oe,draggableNodes:R,droppableContainers:P,droppableRects:Y,over:ke,measureDroppableContainers:X,scrollableAncestors:ue,scrollableAncestorRects:fe,measuringConfiguration:K,measuringScheduled:q,windowRect:de})),[M,Z,ee,F,we,te,oe,R,P,Y,ke,X,ue,fe,K,q,de]),je=d((()=>({activatorEvent:F,activators:_e,active:M,activeNodeRect:ee,ariaDescribedById:{draggable:$},dispatch:E,draggableNodes:R,over:ke,measureDroppableContainers:X})),[F,_e,M,ee,E,$,R,ke,X]);return o.createElement(mn.Provider,{value:S},o.createElement(zr.Provider,{value:je},o.createElement(Fr.Provider,{value:De},o.createElement(Ur.Provider,{value:Oe},g)),o.createElement($r,{disabled:!1===(null==s?void 0:s.restoreFocus)})),o.createElement(wn,{...s,hiddenTextDescribedById:$}))})),Yr=i(null),Xr="button",qr="Droppable";function Zr(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=on(qr),{activators:l,activatorEvent:s,active:c,activeNodeRect:u,ariaDescribedById:f,draggableNodes:p,over:h}=a(zr),{role:g=Xr,roleDescription:v="draggable",tabIndex:m=0}=null!=o?o:{},y=(null==c?void 0:c.id)===t,b=a(y?Ur:Yr),[w,x]=tn(),[k,E]=tn(),O=function(e,t){return d((()=>e.reduce(((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{o(e,t)},e}),{})),[e,t])}(l,t),S=Qt(n);Jt((()=>(p.set(t,{id:t,key:i,node:w,activatorNode:k,data:S}),()=>{const e=p.get(t);e&&e.key===i&&p.delete(t)})),[p,t]);return{active:c,activatorEvent:s,activeNodeRect:u,attributes:d((()=>({role:g,tabIndex:m,"aria-disabled":r,"aria-pressed":!(!y||g!==Xr)||void 0,"aria-roledescription":v,"aria-describedby":f.draggable})),[r,g,m,y,v,f.draggable]),isDragging:y,listeners:r?void 0:O,node:w,over:h,setNodeRef:x,setActivatorNodeRef:E,transform:b}}const Jr="Droppable",Gr={timeout:25};function Qr(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function eo(e,t){return e.reduce(((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e}),Array(e.length))}function to(e){return null!==e&&e>=0}const no=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Qr(t,r,n),a=t[o],l=i[o];return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}:null},ro={scaleX:1,scaleY:1},oo=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const l=null!=(t=i[n])?t:r;if(!l)return null;if(o===n){const e=i[a];return e?{x:0,y:n<a?e.top+e.height-(l.top+l.height):e.top-l.top,...ro}:null}const s=function(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];if(!r)return 0;if(n<t)return o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0;return i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0}(i,o,n);return o>n&&o<=a?{x:0,y:-l.height-s,...ro}:o<n&&o>=a?{x:0,y:l.height+s,...ro}:{x:0,y:0,...ro}};const io="Sortable",ao=o.createContext({activeIndex:-1,containerId:io,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:no,disabled:{draggable:!1,droppable:!1}});function lo(e){let{children:t,id:n,items:r,strategy:i=no,disabled:s=!1}=e;const{active:u,dragOverlay:f,droppableRects:p,over:h,measureDroppableContainers:g}=a(Fr),v=on(io,n),m=Boolean(null!==f.rect),y=d((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),b=null!=u,w=u?y.indexOf(u.id):-1,x=h?y.indexOf(h.id):-1,k=l(y),E=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(y,k.current),O=-1!==x&&-1===w||E,S=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(s);Jt((()=>{E&&b&&g(y)}),[E,y,b,g]),c((()=>{k.current=y}),[y]);const C=d((()=>({activeIndex:w,containerId:v,disabled:S,disableTransforms:O,items:y,overIndex:x,useDragOverlay:m,sortedRects:eo(y,p),strategy:i})),[w,v,S.draggable,S.droppable,O,y,x,p,m,i]);return o.createElement(ao.Provider,{value:C},t)}const so=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Qr(n,r,o).indexOf(t)},co=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:s,transition:c}=e;return!(!c||!r)&&((l===i||o!==a)&&(!!n||a!==o&&t===s))},uo={duration:200,easing:"ease"},fo="transform",po=un.Transition.toString({property:fo,duration:0,easing:"linear"}),ho={roleDescription:"sortable"};function go(e){let{animateLayoutChanges:t=co,attributes:n,disabled:r,data:o,getNewIndex:i=so,id:s,strategy:p,resizeObserverConfig:h,transition:g=uo}=e;const{items:v,containerId:m,activeIndex:y,disabled:b,disableTransforms:w,sortedRects:x,overIndex:k,useDragOverlay:E,strategy:O}=a(ao),S=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,b),C=v.indexOf(s),_=d((()=>({sortable:{containerId:m,index:C,items:v},...o})),[m,o,C,v]),D=d((()=>v.slice(v.indexOf(s))),[v,s]),{rect:j,node:R,isOver:A,setNodeRef:P}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=on(Jr),{active:s,dispatch:d,over:f,measureDroppableContainers:p}=a(zr),h=l({disabled:n}),g=l(!1),v=l(null),m=l(null),{disabled:y,updateMeasurementsFor:b,timeout:w}={...Gr,...o},x=Qt(null!=b?b:r),k=Cr({callback:u((()=>{g.current?(null!=m.current&&clearTimeout(m.current),m.current=setTimeout((()=>{p(Array.isArray(x.current)?x.current:[x.current]),m.current=null}),w)):g.current=!0}),[w]),disabled:y||!s}),E=u(((e,t)=>{k&&(t&&(k.unobserve(t),g.current=!1),e&&k.observe(e))}),[k]),[O,S]=tn(E),C=Qt(t);return c((()=>{k&&O.current&&(k.disconnect(),g.current=!1,k.observe(O.current))}),[O,k]),Jt((()=>(d({type:xn.RegisterDroppable,element:{id:r,key:i,disabled:n,node:O,rect:v,data:C}}),()=>d({type:xn.UnregisterDroppable,key:i,id:r}))),[r]),c((()=>{n!==h.current.disabled&&(d({type:xn.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)}),[r,i,n,d]),{active:s,rect:v,isOver:(null==f?void 0:f.id)===r,node:O,over:f,setNodeRef:S}}({id:s,data:_,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...h}}),{active:B,activatorEvent:T,activeNodeRect:N,attributes:M,setNodeRef:L,listeners:I,isDragging:z,over:F,setActivatorNodeRef:H,transform:V}=Zr({id:s,data:_,attributes:{...ho,...n},disabled:S.draggable}),$=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d((()=>e=>{t.forEach((t=>t(e)))}),t)}(P,L),U=Boolean(B),K=U&&!w&&to(y)&&to(k),W=!E&&z,Y=W&&K?V:null,X=K?null!=Y?Y:(null!=p?p:O)({rects:x,activeNodeRect:N,activeIndex:y,overIndex:k,index:C}):null,q=to(y)&&to(k)?i({id:s,items:v,activeIndex:y,overIndex:k}):C,Z=null==B?void 0:B.id,J=l({activeId:Z,items:v,newIndex:q,containerId:m}),G=v!==J.current.items,Q=t({active:B,containerId:m,isDragging:z,isSorting:U,id:s,index:C,items:v,newIndex:J.current.newIndex,previousItems:J.current.items,previousContainerId:J.current.containerId,transition:g,wasDragging:null!=J.current.activeId}),ee=function(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=f(null),s=l(n);return Jt((()=>{if(!t&&n!==s.current&&r.current){const e=o.current;if(e){const t=In(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&a(n)}}n!==s.current&&(s.current=n)}),[t,n,r,o]),c((()=>{i&&a(null)}),[i]),i}({disabled:!Q,index:C,node:R,rect:j});return c((()=>{U&&J.current.newIndex!==q&&(J.current.newIndex=q),m!==J.current.containerId&&(J.current.containerId=m),v!==J.current.items&&(J.current.items=v)}),[U,q,m,v]),c((()=>{if(Z===J.current.activeId)return;if(Z&&!J.current.activeId)return void(J.current.activeId=Z);const e=setTimeout((()=>{J.current.activeId=Z}),50);return()=>clearTimeout(e)}),[Z]),{active:B,activeIndex:y,attributes:M,data:_,rect:j,index:C,newIndex:q,items:v,isOver:A,isSorting:U,isDragging:z,listeners:I,node:R,overIndex:k,over:F,setNodeRef:$,setActivatorNodeRef:H,setDroppableNodeRef:P,setDraggableNodeRef:L,transform:null!=ee?ee:X,transition:function(){if(ee||G&&J.current.newIndex===C)return po;if(W&&!cn(T)||!g)return;if(U||Q)return un.Transition.toString({...g,property:fo});return}()}}function vo(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const mo=[or.Down,or.Right,or.Up,or.Left],yo=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(mo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[];i.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return;const i=o.get(n.id);if(i)switch(e.code){case or.Down:r.top<i.top&&t.push(n);break;case or.Up:r.top>i.top&&t.push(n);break;case or.Left:r.left>i.left&&t.push(n);break;case or.Right:r.left<i.left&&t.push(n)}}));const s=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Dn(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=Dn(r),a=o.reduce(((e,t,r)=>e+Sn(n[r],t)),0),l=Number((a/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:l}})}}return i.sort(Cn)})({active:n,collisionRect:r,droppableRects:o,droppableContainers:t,pointerCoordinates:null});let c=jn(s,"id");if(c===(null==a?void 0:a.id)&&s.length>1&&(c=s[1].id),null!=c){const e=i.get(n.id),t=i.get(c),a=t?o.get(t.id):null,s=null==t?void 0:t.node.current;if(s&&a&&e&&t){const n=Fn(s).some(((e,t)=>l[t]!==e)),o=bo(e,t),i=function(e,t){if(!vo(e)||!vo(t))return!1;if(!bo(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!o?{x:0,y:0}:{x:i?r.width-a.width:0,y:i?r.height-a.height:0},d={x:a.left,y:a.top};return c.x&&c.y?d:sn(d,c)}}}};function bo(e,t){return!(!vo(e)||!vo(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}var wo;function xo(){return xo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xo.apply(this,arguments)}var ko,Eo=function(e){return r.createElement("svg",xo({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),wo||(wo=r.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function Oo(){return Oo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Oo.apply(this,arguments)}var So=function(e){return r.createElement("svg",Oo({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),ko||(ko=r.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))};function Co(e){return jo(e)?(e.nodeName||"").toLowerCase():"#document"}function _o(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Do(e){var t;return null==(t=(jo(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function jo(e){return e instanceof Node||e instanceof _o(e).Node}function Ro(e){return e instanceof Element||e instanceof _o(e).Element}function Ao(e){return e instanceof HTMLElement||e instanceof _o(e).HTMLElement}function Po(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof _o(e).ShadowRoot)}function Bo(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Io(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function To(e){return["table","td","th"].includes(Co(e))}function No(e){const t=Mo(),n=Io(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 Mo(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Lo(e){return["html","body","#document"].includes(Co(e))}function Io(e){return _o(e).getComputedStyle(e)}function zo(e){return Ro(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Fo(e){if("html"===Co(e))return e;const t=e.assignedSlot||e.parentNode||Po(e)&&e.host||Do(e);return Po(t)?t.host:t}function Ho(e){const t=Fo(e);return Lo(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ao(t)&&Bo(t)?t:Ho(t)}function Vo(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Ho(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=_o(o);return i?t.concat(a,a.visualViewport||[],Bo(o)?o:[],a.frameElement&&n?Vo(a.frameElement):[]):t.concat(o,Vo(o,[],n))}const $o=Math.min,Uo=Math.max,Ko=Math.round,Wo=Math.floor,Yo=e=>({x:e,y:e}),Xo={left:"right",right:"left",bottom:"top",top:"bottom"},qo={start:"end",end:"start"};function Zo(e,t,n){return Uo(e,$o(t,n))}function Jo(e,t){return"function"==typeof e?e(t):e}function Go(e){return e.split("-")[0]}function Qo(e){return e.split("-")[1]}function ei(e){return"x"===e?"y":"x"}function ti(e){return"y"===e?"height":"width"}function ni(e){return["top","bottom"].includes(Go(e))?"y":"x"}function ri(e){return ei(ni(e))}function oi(e){return e.replace(/start|end/g,(e=>qo[e]))}function ii(e){return e.replace(/left|right|bottom|top/g,(e=>Xo[e]))}function ai(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 li(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function si(e,t,n){let{reference:r,floating:o}=e;const i=ni(t),a=ri(t),l=ti(a),s=Go(t),c="y"===i,d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let p;switch(s){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(Qo(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function ci(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Jo(t,e),h=ai(p),g=l[f?"floating"===u?"reference":"floating":u],v=li(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(l.floating)),boundary:c,rootBoundary:d,strategy:s})),m="floating"===u?{...a.floating,x:r,y:o}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},w=li(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:m,offsetParent:y,strategy:s}):m);return{top:(v.top-w.top+h.top)/b.y,bottom:(w.bottom-v.bottom+h.bottom)/b.y,left:(v.left-w.left+h.left)/b.x,right:(w.right-v.right+h.right)/b.x}}function di(e){const t=$o(...e.map((e=>e.left))),n=$o(...e.map((e=>e.top)));return{x:t,y:n,width:Uo(...e.map((e=>e.right)))-t,height:Uo(...e.map((e=>e.bottom)))-n}}const ui=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:l}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=Go(n),l=Qo(n),s="y"===ni(n),c=["left","top"].includes(a)?-1:1,d=i&&s?-1:1,u=Jo(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return l&&"number"==typeof h&&(p="end"===l?-1*h:h),s?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return a===(null==(n=l.offset)?void 0:n.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:a}}}}};function fi(e){const t=Io(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ao(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=Ko(n)!==i||Ko(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function pi(e){return Ro(e)?e:e.contextElement}function hi(e){const t=pi(e);if(!Ao(t))return Yo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=fi(t);let a=(i?Ko(n.width):n.width)/r,l=(i?Ko(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),l&&Number.isFinite(l)||(l=1),{x:a,y:l}}const gi=Yo(0);function vi(e){const t=_o(e);return Mo()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:gi}function mi(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=pi(e);let a=Yo(1);t&&(r?Ro(r)&&(a=hi(r)):a=hi(e));const l=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==_o(e))&&t}(i,n,r)?vi(i):Yo(0);let s=(o.left+l.x)/a.x,c=(o.top+l.y)/a.y,d=o.width/a.x,u=o.height/a.y;if(i){const e=_o(i),t=r&&Ro(r)?_o(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=hi(o),t=o.getBoundingClientRect(),r=Io(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,c*=e.y,d*=e.x,u*=e.y,s+=i,c+=a,n=_o(o),o=n.frameElement}}return li({width:d,height:u,x:s,y:c})}const yi=[":popover-open",":modal"];function bi(e){return yi.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function wi(e){return mi(Do(e)).left+zo(e).scrollLeft}function xi(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=_o(e),r=Do(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=Mo();(!e||e&&"fixed"===t)&&(l=o.offsetLeft,s=o.offsetTop)}return{width:i,height:a,x:l,y:s}}(e,n);else if("document"===t)r=function(e){const t=Do(e),n=zo(e),r=e.ownerDocument.body,o=Uo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Uo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+wi(e);const l=-n.scrollTop;return"rtl"===Io(r).direction&&(a+=Uo(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}(Do(e));else if(Ro(t))r=function(e,t){const n=mi(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ao(e)?hi(e):Yo(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=vi(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return li(r)}function ki(e,t){const n=Fo(e);return!(n===t||!Ro(n)||Lo(n))&&("fixed"===Io(n).position||ki(n,t))}function Ei(e,t,n){const r=Ao(t),o=Do(t),i="fixed"===n,a=mi(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const s=Yo(0);if(r||!r&&!i)if(("body"!==Co(t)||Bo(o))&&(l=zo(t)),r){const e=mi(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=wi(o));return{x:a.left+l.scrollLeft-s.x,y:a.top+l.scrollTop-s.y,width:a.width,height:a.height}}function Oi(e,t){return Ao(e)&&"fixed"!==Io(e).position?t?t(e):e.offsetParent:null}function Si(e,t){const n=_o(e);if(!Ao(e)||bi(e))return n;let r=Oi(e,t);for(;r&&To(r)&&"static"===Io(r).position;)r=Oi(r,t);return r&&("html"===Co(r)||"body"===Co(r)&&"static"===Io(r).position&&!No(r))?n:r||function(e){let t=Fo(e);for(;Ao(t)&&!Lo(t);){if(No(t))return t;t=Fo(t)}return null}(e)||n}const Ci={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Do(r),l=!!t&&bi(t.floating);if(r===a||l&&i)return n;let s={scrollLeft:0,scrollTop:0},c=Yo(1);const d=Yo(0),u=Ao(r);if((u||!u&&!i)&&(("body"!==Co(r)||Bo(a))&&(s=zo(r)),Ao(r))){const e=mi(r);c=hi(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+d.x,y:n.y*c.y-s.scrollTop*c.y+d.y}},getDocumentElement:Do,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=Vo(e,[],!1).filter((e=>Ro(e)&&"body"!==Co(e))),o=null;const i="fixed"===Io(e).position;let a=i?Fo(e):e;for(;Ro(a)&&!Lo(a);){const t=Io(a),n=No(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Bo(a)&&!n&&ki(e,a))?r=r.filter((e=>e!==a)):o=t,a=Fo(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],l=i.reduce(((e,n)=>{const r=xi(t,n,o);return e.top=Uo(r.top,e.top),e.right=$o(r.right,e.right),e.bottom=$o(r.bottom,e.bottom),e.left=Uo(r.left,e.left),e}),xi(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:Si,getElementRects:async function(e){const t=this.getOffsetParent||Si,n=this.getDimensions;return{reference:Ei(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}=fi(e);return{width:t,height:n}},getScale:hi,isElement:Ro,isRTL:function(e){return"rtl"===Io(e).direction}};function _i(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,c=pi(e),d=o||i?[...c?Vo(c):[],...Vo(t)]:[];d.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=c&&l?function(e,t){let n,r=null;const o=Do(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(l,s){void 0===l&&(l=!1),void 0===s&&(s=1),i();const{left:c,top:d,width:u,height:f}=e.getBoundingClientRect();if(l||t(),!u||!f)return;const p={rootMargin:-Wo(d)+"px "+-Wo(o.clientWidth-(c+u))+"px "+-Wo(o.clientHeight-(d+f))+"px "+-Wo(c)+"px",threshold:Uo(0,$o(1,s))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==s){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),100)}h=!1}try{r=new IntersectionObserver(g,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,p)}r.observe(e)}(!0),i}(c,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!s&&h.observe(c),h.observe(t));let g=s?mi(e):null;return s&&function t(){const r=mi(e);!g||r.x===g.x&&r.y===g.y&&r.width===g.width&&r.height===g.height||n();g=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==u||u(),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(f)}}const Di=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=Jo(e,t),c={x:n,y:r},d=await ci(t,s),u=ni(Go(o)),f=ei(u);let p=c[f],h=c[u];if(i){const e="y"===f?"bottom":"right";p=Zo(p+d["y"===f?"top":"left"],p,p-d[e])}if(a){const e="y"===u?"bottom":"right";h=Zo(h+d["y"===u?"top":"left"],h,h-d[e])}const g=l.fn({...t,[f]:p,[u]:h});return{...g,data:{x:g.x-n,y:g.y-r}}}}},ji=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:s,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...v}=Jo(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const m=Go(o),y=Go(l)===l,b=await(null==s.isRTL?void 0:s.isRTL(c.floating)),w=f||(y||!g?[ii(l)]:function(e){const t=ii(e);return[oi(e),t,oi(t)]}(l));f||"none"===h||w.push(...function(e,t,n,r){const o=Qo(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(Go(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(oi)))),i}(l,g,h,b));const x=[l,...w],k=await ci(t,v),E=[];let O=(null==(r=i.flip)?void 0:r.overflows)||[];if(d&&E.push(k[m]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=Qo(e),o=ri(e),i=ti(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=ii(a)),[a,ii(a)]}(o,a,b);E.push(k[e[0]],k[e[1]])}if(O=[...O,{placement:o,overflows:E}],!E.every((e=>e<=0))){var S,C;const e=((null==(S=i.flip)?void 0:S.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:O},reset:{placement:t}};let n=null==(C=O.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:C.placement;if(!n)switch(p){case"bestFit":{var _;const e=null==(_=O.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:_[0];e&&(n=e);break}case"initialPlacement":n=l}if(o!==n)return{reset:{placement:n}}}return{}}}},Ri=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:l=2,x:s,y:c}=Jo(e,t),d=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=>li(di(e))))}(d),f=li(di(d)),p=ai(l);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=s&&null!=c)return u.find((e=>s>e.left-p.left&&s<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom))||f;if(u.length>=2){if("y"===ni(n)){const e=u[0],t=u[u.length-1],r="top"===Go(n),o=e.top,i=t.bottom,a=r?e.left:t.left,l=r?e.right:t.right;return{top:o,bottom:i,left:a,right:l,width:l-a,height:i-o,x:a,y:o}}const e="left"===Go(n),t=Uo(...u.map((e=>e.right))),r=$o(...u.map((e=>e.left))),o=u.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return f}},floating:r.floating,strategy:a});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Ai=(e,t,n)=>{const r=new Map,o={platform:Ci,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),s=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=si(c,r,s),f=r,p={},h=0;for(let n=0;n<l.length;n++){const{name:i,fn:g}=l[n],{x:v,y:m,data:y,reset:b}=await g({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=v?v:d,u=null!=m?m:u,p={...p,[i]:{...p[i],...y}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:d,y:u}=si(c,f,s))),n=-1)}return{x:d,y:u,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Pi="undefined"!=typeof document?s:c;function Bi(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(!Bi(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)&&!Bi(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ti(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ni(e,t){const n=Ti(e);return Math.round(t*n)/n}function Mi(e){const t=r.useRef(e);return Pi((()=>{t.current=e})),t}
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from"react";import o,{createContext as i,useContext as a,useRef as l,useLayoutEffect as s,useEffect as c,useMemo as d,useCallback as u,useState as f,memo as p,useReducer as h,forwardRef as g,createElement as v}from"react";import{Editor as m,Element as y,Text as b,Transforms as w,Point as x,Path as k,Node as E,Range as O,createEditor as S,Operation as C}from"slate";import{ReactEditor as _,withReact as D,useSelected as j,Slate as R,Editable as A,DefaultElement as P}from"slate-react";import*as B from"react-dom";import{unstable_batchedUpdates as T,createPortal as N}from"react-dom";class M{constructor(e){this.plugin=e}get getPlugin(){return this.plugin}extend(e){const{renders:t,options:n,elementProps:r,events:o}=e,i=Object.assign(Object.assign({},this.plugin.options),n),a=Object.assign({},this.plugin.elements);return t&&Object.keys(t).forEach((e=>{const n=a[e];if(n&&n.render){const r=t[e];let o=n.render;n.render=e=>o(Object.assign(Object.assign({},e),{extendRender:r}))}})),r&&Object.keys(r).forEach((e=>{const t=a[e];if(t){const n=r[e],o=t.props;n&&o&&(t.props=n(o))}})),o&&Object.keys(o).forEach((e=>{const t=o[e];t&&(this.plugin.events||(this.plugin.events={}),this.plugin.events[e]=t)})),new M(Object.assign(Object.assign({},this.plugin),{elements:a,options:i}))}}function L(){let e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}const I=()=>{var e,t;return"undefined"==typeof window||"function"!=typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?L():null===(t=window.crypto)||void 0===t?void 0:t.randomUUID()},z=e=>({id:I(),type:(null==e?void 0:e.type)||"paragraph",children:(null==e?void 0:e.children)||[{text:""}],props:Object.assign({nodeType:"block"},null==e?void 0:e.props)}),F=e=>({id:(null==e?void 0:e.id)||I(),value:(null==e?void 0:e.value)||[z()],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:0,depth:0},null==e?void 0:e.meta)});function H(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function V(e){if(!e)return;const t=H(e);return t?e[t]:void 0}function $(e,t={nodeType:"block"}){return{id:I(),type:e,children:[{text:""}],props:t}}function U(e,t,n){var r;return(null===(r=e.children)||void 0===r?void 0:r.map((e=>{const r=t[e];if(!r)throw new Error(`Element definition for ${e} not found`);return z({id:I(),type:e,props:r.props,children:r.children&&r.children.length>0?U(r,t,n):[{text:(null==n?void 0:n[e])||""}]})})))||[]}function K(e,t,n){e.plugins[t];const r=e.blocks[t].elements,o=H(r);if(!o)throw new Error(`Root element type not found for block type ${t}`);const i=r[o];return{id:I(),type:o,props:i.props,children:i.children&&i.children.length>0?U(i,r,n):[{text:""}]}}function W(e,t,n={}){var r,o;const{at:i=e.path.current,focus:a=!1,blockData:l}=n,s=e.plugins[t],{onBeforeCreate:c,onCreate:d}=s.events||{};let u;u=l&&Array.isArray(null==l?void 0:l.value)?l.value[0]:(null==c?void 0:c(e))||K(e,t);const f={id:(null==l?void 0:l.id)||I(),type:t,value:[u],meta:{align:(null===(r=null==l?void 0:l.meta)||void 0===r?void 0:r.align)||"left",depth:(null===(o=null==l?void 0:l.meta)||void 0===o?void 0:o.depth)||0,order:"number"==typeof i?i:Object.keys(e.children).length}},p=[];return p.push({type:"insert_block",path:{current:f.meta.order},block:f}),e.applyTransforms(p),null==d||d(e,f.id),a&&e.focusBlock(f.id),f.id}function Y(e){const t=e.path.current;return"number"==typeof t&&0!==t?t-1:null}function X(e,t){e.applyTransforms([{type:"set_block_path",path:t}],{normalizePaths:!1})}function q(e){try{let t;const[n,r]=m.last(e,[]);if(y.isElement(n)&&!m.isEditor(n)){const[n,o]=m.last(e,r);b.isText(n)&&(t={path:o,offset:n.text.length})}else b.isText(n)&&(t={path:r,offset:n.text.length});return t}catch(e){return{path:[0,0],offset:0}}}const Z={getPath:function(e){return e.path.current},getNextPath:function(e){const t=e.path.current;return"number"==typeof t?t+1:null},getPreviousPath:Y,isBlockSelected:function(e,t){const n=e.path.selected;return!!Array.isArray(n)&&n.includes(t.meta.order)},getSelectedPaths:function(e){return e.path.selected},isPathEmpty:function(e){return null===e.path.current},setPath:X,getLastNodePoint:q};function J(e,t){if(!(null==t?void 0:t.id)&&"number"!=typeof(null==t?void 0:t.at))throw new Error("getSlate requires either an id or at");const n=(null==t?void 0:t.id)||Object.keys(e.children).find((n=>e.children[n].meta.order===(null==t?void 0:t.at))),r=e.blockEditorsMap[n||""],o=e.children[n||""],i=e.blocks[(null==o?void 0:o.type)||""];if(!(null==i?void 0:i.hasCustomEditor)&&!r)throw new Error(`Slate not found with params: ${JSON.stringify(t)}`);return r}function G(e,t){const{focus:n,blockId:r,at:o}=t;if(!r&&"number"!=typeof o)throw new Error("blockId or path should be provided");const i=e.getBlock({id:r,at:o});if(!i)throw new Error("Block not found");const a=Z.getPreviousPath(e),l=null!==a?e.getBlock({at:a}):void 0,s=l?J(e,{id:null==l?void 0:l.id}):void 0,c=e.children[i.id],d=[];if(d.push({type:"delete_block",block:c,path:e.path}),e.applyTransforms(d,{normalizePaths:!1}),n&&s&&l){const t=Z.getLastNodePoint(s);e.focusBlock(l.id,{focusAt:t})}}function Q(e,t,n){const r=n,o=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===r));if(!o||!i)return void console.warn("Invalid block ids for move operation");const a=[],l={type:"move_block",prevProperties:{id:t,order:o.meta.order},properties:{id:t,order:r}};a.push(l),e.applyTransforms(a),e.setPath({current:r})}const ee=new WeakMap;function te(e,t,n={}){const{focusAt:r,waitExecution:o=!0,waitExecutionMs:i=0,shouldUpdateBlockSelection:a=!0}=n,l=()=>{const o=n.slate||e.blockEditorsMap[t],i=e.children[t];if(!o||!i)return;if(!e.blocks[i.type].hasCustomEditor)try{const e=function(e,t){if(x.isPoint(t))return t;if(k.isPath(t))return{path:t,offset:0};const[,n]=m.first(e,[0]);return{path:n||[0,0],offset:0}}(o,r);w.select(o,e),_.focus(o)}catch(e){}a&&setTimeout((()=>{e.setPath({current:i.meta.order})}),0)};o?setTimeout((()=>l()),i):l(),ee.set(e,!0)}function ne(e,t){const n=Object.keys(e.children),{at:r=e.path.current}=t||{},o=n.find((t=>e.children[t].meta.order===r));return o?e.children[o]:null}function re(e,t){const n=Object.keys(e.children),{at:r=e.path.current}=t||{},o=n.find((t=>e.children[t].meta.order===r));if(o)return e.blockEditorsMap[o]}var oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ie={};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",l="[object Function]",s="[object GeneratorFunction]",c="[object Map]",d="[object Number]",u="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",m="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",O="[object Int32Array]",S="[object Uint8Array]",C="[object Uint8ClampedArray]",_="[object Uint16Array]",D="[object Uint32Array]",j=/\w*$/,R=/^\[object .+?Constructor\]$/,A=/^(?:0|[1-9]\d*)$/,P={};P[o]=P["[object Array]"]=P[y]=P[b]=P[i]=P[a]=P[w]=P[x]=P[k]=P[E]=P[O]=P[c]=P[d]=P[u]=P[p]=P[h]=P[g]=P[v]=P[S]=P[C]=P[_]=P[D]=!0,P["[object Error]"]=P[l]=P[m]=!1;var B="object"==typeof oe&&oe&&oe.Object===Object&&oe,T="object"==typeof self&&self&&self.Object===Object&&self,N=B||T||Function("return this")(),M=t&&!t.nodeType&&t,L=M&&e&&!e.nodeType&&e,I=L&&L.exports===M;function z(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function H(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function $(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function U(e,t){return function(n){return e(t(n))}}function K(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var W,Y=Array.prototype,X=Function.prototype,q=Object.prototype,Z=N["__core-js_shared__"],J=(W=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",G=X.toString,Q=q.hasOwnProperty,ee=q.toString,te=RegExp("^"+G.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=I?N.Buffer:void 0,re=N.Symbol,ie=N.Uint8Array,ae=U(Object.getPrototypeOf,Object),le=Object.create,se=q.propertyIsEnumerable,ce=Y.splice,de=Object.getOwnPropertySymbols,ue=ne?ne.isBuffer:void 0,fe=U(Object.keys,Object),pe=Ie(N,"DataView"),he=Ie(N,"Map"),ge=Ie(N,"Promise"),ve=Ie(N,"Set"),me=Ie(N,"WeakMap"),ye=Ie(Object,"create"),be=$e(pe),we=$e(he),xe=$e(ge),ke=$e(ve),Ee=$e(me),Oe=re?re.prototype:void 0,Se=Oe?Oe.valueOf:void 0;function Ce(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function _e(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function De(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function je(e){this.__data__=new _e(e)}function Re(e,t){var n=Ke(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&We(e)}(e)&&Q.call(e,"callee")&&(!se.call(e,"callee")||ee.call(e)==o)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,i=!!r;for(var a in e)!t&&!Q.call(e,a)||i&&("length"==a||He(a,r))||n.push(a);return n}function Ae(e,t,n){var r=e[t];Q.call(e,t)&&Ue(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Pe(e,t){for(var n=e.length;n--;)if(Ue(e[n][0],t))return n;return-1}function Be(e,t,n,r,f,m,R){var A;if(r&&(A=m?r(e,f,m,R):r(e)),void 0!==A)return A;if(!qe(e))return e;var B=Ke(e);if(B){if(A=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,A)}else{var T=Fe(e),N=T==l||T==s;if(Ye(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(T==u||T==o||N&&!m){if(V(e))return m?e:{};if(A=function(e){return"function"!=typeof e.constructor||Ve(e)?{}:(t=ae(e),qe(t)?le(t):{});var t}(N?{}:e),!t)return function(e,t){return Me(e,ze(e),t)}(e,function(e,t){return e&&Me(t,Ze(t),e)}(A,e))}else{if(!P[T])return m?e:{};A=function(e,t,n,r){var o=e.constructor;switch(t){case y:return Ne(e);case i:case a:return new o(+e);case b:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case w:case x:case k:case E:case O:case S:case C:case _:case D:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n($(e),!0):$(e);return H(r,z,new e.constructor)}(e,r,n);case d:case g:return new o(e);case p:return function(e){var t=new e.constructor(e.source,j.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,n){var r=t?n(K(e),!0):K(e);return H(r,F,new e.constructor)}(e,r,n);case v:return l=e,Se?Object(Se.call(l)):{}}var l}(e,T,Be,t)}}R||(R=new je);var M=R.get(e);if(M)return M;if(R.set(e,A),!B)var L=n?function(e){return function(e,t,n){var r=t(e);return Ke(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Ze,ze)}(e):Ze(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(L||e,(function(o,i){L&&(o=e[i=o]),Ae(A,i,Be(o,t,n,r,i,e,R))})),A}function Te(e){return!(!qe(e)||(t=e,J&&J in t))&&(Xe(e)||V(e)?te:R).test($e(e));var t}function Ne(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Me(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var a=t[o],l=r?r(n[a],e[a],a,n,e):void 0;Ae(n,a,void 0===l?e[a]:l)}return n}function Le(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Ie(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Te(n)?n:void 0}Ce.prototype.clear=function(){this.__data__=ye?ye(null):{}},Ce.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ce.prototype.get=function(e){var t=this.__data__;if(ye){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},Ce.prototype.has=function(e){var t=this.__data__;return ye?void 0!==t[e]:Q.call(t,e)},Ce.prototype.set=function(e,t){return this.__data__[e]=ye&&void 0===t?n:t,this},_e.prototype.clear=function(){this.__data__=[]},_e.prototype.delete=function(e){var t=this.__data__,n=Pe(t,e);return!(n<0)&&(n==t.length-1?t.pop():ce.call(t,n,1),!0)},_e.prototype.get=function(e){var t=this.__data__,n=Pe(t,e);return n<0?void 0:t[n][1]},_e.prototype.has=function(e){return Pe(this.__data__,e)>-1},_e.prototype.set=function(e,t){var n=this.__data__,r=Pe(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},De.prototype.clear=function(){this.__data__={hash:new Ce,map:new(he||_e),string:new Ce}},De.prototype.delete=function(e){return Le(this,e).delete(e)},De.prototype.get=function(e){return Le(this,e).get(e)},De.prototype.has=function(e){return Le(this,e).has(e)},De.prototype.set=function(e,t){return Le(this,e).set(e,t),this},je.prototype.clear=function(){this.__data__=new _e},je.prototype.delete=function(e){return this.__data__.delete(e)},je.prototype.get=function(e){return this.__data__.get(e)},je.prototype.has=function(e){return this.__data__.has(e)},je.prototype.set=function(e,t){var n=this.__data__;if(n instanceof _e){var r=n.__data__;if(!he||r.length<199)return r.push([e,t]),this;n=this.__data__=new De(r)}return n.set(e,t),this};var ze=de?U(de,Object):function(){return[]},Fe=function(e){return ee.call(e)};function He(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||A.test(e))&&e>-1&&e%1==0&&e<t}function Ve(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||q)}function $e(e){if(null!=e){try{return G.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ue(e,t){return e===t||e!=e&&t!=t}(pe&&Fe(new pe(new ArrayBuffer(1)))!=b||he&&Fe(new he)!=c||ge&&Fe(ge.resolve())!=f||ve&&Fe(new ve)!=h||me&&Fe(new me)!=m)&&(Fe=function(e){var t=ee.call(e),n=t==u?e.constructor:void 0,r=n?$e(n):void 0;if(r)switch(r){case be:return b;case we:return c;case xe:return f;case ke:return h;case Ee:return m}return t});var Ke=Array.isArray;function We(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!Xe(e)}var Ye=ue||function(){return!1};function Xe(e){var t=qe(e)?ee.call(e):"";return t==l||t==s}function qe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ze(e){return We(e)?Re(e):function(e){if(!Ve(e))return fe(e);var t=[];for(var n in Object(e))Q.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Be(e,!0,!0)}}({get exports(){return ie},set exports(e){ie=e}},ie);var ae=ie;function le(e){return ae(e)}function se(e,t={}){const{focus:n=!0}=t,r=ne(e),o=t.slate||re(e);o&&r&&m.withoutNormalizing(o,(()=>{if(!o.selection)return;const t=le(o.children),i=[],[a,l]=function(e,t){const{path:n,offset:r}=t.focus,[,...o]=n,i=JSON.parse(JSON.stringify(e[0]));function a(e,t,n){if(0!==t.length){const[r,...o]=t,[i,l]=a(e.children[r],o,n),s=e.children.slice(0,r).concat(i?[i]:[]),c=(l?[l]:[]).concat(e.children.slice(r+1));return[Object.assign(Object.assign({},e),{children:s}),Object.assign(Object.assign({},e),{children:c})]}if(E.string(e).length<=n)return[e,null];if("text"in e)return[Object.assign(Object.assign({},e),{text:e.text.slice(0,n)}),Object.assign(Object.assign({},e),{text:e.text.slice(n)})];if("link"===e.type){const[t,r]=a(e.children[0],[],n);return[Object.assign(Object.assign({},e),{children:[t]}),Object.assign(Object.assign({},e),{children:[r]})]}}const[l,s]=a(i,o,r);function c(e){return"children"in e&&(e.children=e.children.filter((e=>""!==e.text&&void 0!==e.text||e.children&&e.children.length>0)),e.children.forEach(c)),e}return[c(l),c(s)].map((e=>[e])).filter((e=>e[0].children.length>0))}(o.children,o.selection),s={id:I(),type:r.type,meta:{order:r.meta.order+1,depth:r.meta.depth,align:r.meta.align},value:[]};i.push({type:"split_block",prevProperties:{originalBlock:r,originalValue:t},properties:{nextBlock:s,nextSlateValue:l||[$("paragraph")],splitSlateValue:a},path:e.path}),e.applyTransforms(i),n&&e.focusBlock(s.id)}))}function ce(e,t={}){const{at:n=e.path.current,blockId:r}=t,o=r?e.children[r]:ne(e,{at:n});if(!o)return;const i=o.meta.depth+1,a={type:"set_block_meta",id:o.id,properties:{depth:i},prevProperties:{depth:o.meta.depth}};e.applyTransforms([a])}function de(e,t={}){const{at:n=e.path.current,blockId:r}=t,o=r?e.children[r]:ne(e,{at:n});if(!o)return;const i=Math.max(0,o.meta.depth-1),a={type:"set_block_meta",id:o.id,properties:{depth:i},prevProperties:{depth:o.meta.depth}};e.applyTransforms([a])}function ue(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;const fe=(e,t)=>{const{insertText:n}=t;return t.insertText=r=>{var o;const{selection:i}=t;if(" "===r&&i&&O.isCollapsed(i)){const{anchor:a}=i,l=m.above(t,{match:e=>y.isElement(e)&&m.isBlock(t,e),mode:"lowest"});if(!l)return;const[,s]=l,c=m.parent(t,s),[d]=c;if(y.isElement(d)&&!b.isText(d.children[0]))return n(r);const u=l?s:[],f={anchor:a,focus:m.start(t,u)},p=m.string(t,f),h=null===(o=e.shortcuts)||void 0===o?void 0:o[p];if(!!h&&!h.isActive())return w.select(t,f),w.delete(t),void e.toggleBlock(h.type,{deleteText:!0,focus:!0})}n(r)},t};function pe(e){return fe(e,D(S()))}function he(e,t){const n=re(e);if(!n)return!1;const r=m.marks(n);return!!(null==r?void 0:r[t])}function ge(e,t){const n={};return t.forEach((t=>{const r=t.type;n[r]={hotkey:t.hotkey,type:r,getValue:()=>function(e,t){const n=re(e);if(!n)return null;const r=m.marks(n);return null==r?void 0:r[t]}(e,r),isActive:()=>he(e,r),toggle:()=>function(e,t){const n=re(e),r=he(e,t);n&&(r?m.removeMark(n,t):m.addMark(n,t,!0),e.emit("change",e.children))}(e,r),update:t=>function(e,t,n){const r=re(e);r&&r.selection&&O.isExpanded(r.selection)&&(m.addMark(r,t,n),e.emit("change",e.children))}(e,r,t)}})),n}function ve(e){const t={};return Object.keys(e.children).forEach((n=>{const r=pe(e);t[n]=r})),t}function me(e,t){const{original:n,focus:r,at:o}=t;if(!n)throw new Error("`original` should be provided");if(!n.blockId&&"number"!=typeof n.path)throw new Error("blockId or path should be provided");const{blockId:i,path:a}=n;let l=i?e.children[i]:ne(e,{at:a});if(!l)throw new Error("Block not found");const s=[];Object.values(e.children).forEach((e=>{e.meta.order,l.meta.order}));const c=le(l);return c.id=I(),c.meta.order=Array.isArray(o)&&"number"==typeof o?o:l.meta.order+1,s.push({type:"insert_block",path:{current:c.meta.order},block:c}),e.applyTransforms(s),r&&e.focusBlock(c.id,{waitExecution:!0}),c.id}function ye(e,t,n,r){const o=e.children[t];if(!o)return void console.warn(`Block with id ${t} does not exist.`);const i={type:"set_block_meta",id:t,properties:{},prevProperties:{}},a={type:"set_block_value",id:t,value:[]};n.meta&&(i.prevProperties=o.meta,i.properties=Object.assign(Object.assign({},o.meta),n.meta)),n.value&&(a.value=n.value);const l=[];Object.keys(i.properties).length&&l.push(i),a.value.length&&l.push(a),l.length>0&&e.applyTransforms(l,{normalizePaths:!1})}const be="Paragraph";function we(e,t,n,r){const o=r.plugins[n.type];return(null==o?void 0:o.customEditor)?n.value[0].children:m.isEditor(t)?t.children.flatMap((t=>we(e,t,n,r))):y.isElement(t)?m.isInline(e,t)?[t]:t.children.flatMap((t=>we(e,t,n,r))):[t]}function xe(e){return y.isElement(e)?0===e.children.length||b.isText(e.children[0])?e:xe(e.children[0]):null}function ke(e,t,n={}){const r=ne(e,{at:n.at||e.path.current});if(!r)throw new Error("Block not found at current selection");let o=r.type===t?be:t;const i=e.plugins[o],{onBeforeCreate:a}=i.events||{},l=re(e,{at:r.meta.order});if(!l)throw new Error(`Slate not found for block in position ${r.meta.order}`);const s=(null==a?void 0:a(e))||K(e,o),c=we(l,l.children[0],r,e),d=xe(s);d&&(d.children=c);const u={id:I(),type:o,meta:Object.assign(Object.assign({},r.meta),{align:void 0}),value:[s]},f=pe(e);f.children=[s];const p=[{type:"delete_block",block:r,path:{current:r.meta.order}},{type:"insert_block",path:{current:r.meta.order},block:u}];return e.applyTransforms(p),n.deleteText&&w.delete(f,{at:[0,0]}),n.focus&&e.focusBlock(u.id),u.id}function Ee(e,t){try{_.blur(t),_.deselect(t),w.deselect(t)}catch(e){}e.setPath({current:null})}function Oe(e,t){if(!(null==t?void 0:t.id)&&"number"!=typeof(null==t?void 0:t.at))throw new Error("getBlock requires either an id or at");if(null==t?void 0:t.id)return e.children[null==t?void 0:t.id];const n=Object.keys(e.children).find((n=>e.children[n].meta.order===(null==t?void 0:t.at)));return n?e.children[n]:null}const Se={underline:{type:"underline",tag:"U"},strike:{type:"strike",tag:"S"},code:{type:"code",tag:"CODE"},italic:{type:"italic",tag:"I"},bold:{type:"bold",tag:"B"}};function Ce(e,t){return e.map((e=>{var n,r;let o="";if(e.text)return o=Object.keys(Se).reduce(((t,n)=>e[n]?`<${Se[n].tag}>${t}</${Se[n].tag}>`:t),e.text),o;if(e.type){const i=function(e,t){return Object.values(e).find((e=>{var n,r;return e.type===(null===(r=null===(n=e.elements)||void 0===n?void 0:n[t])||void 0===r?void 0:r.rootPlugin)}))}(t,e.type);if(i&&(null===(r=null===(n=i.parsers)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize))return o=i.parsers.html.serialize(e,Ce(e.children,t)),o}return o})).join("")}function _e(e,t){const n=Object.values(t).filter((t=>{const n=Z.getSelectedPaths(e);return!(Array.isArray(n)&&n.length>0)||(null==n?void 0:n.includes(t.meta.order))})).sort(((e,t)=>e.meta.order-t.meta.order)).map((t=>{var n,r;const o=e.plugins[t.type];if(o&&(null===(r=null===(n=o.parsers)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize)){const n=Ce(t.value[0].children,e.plugins);return o.parsers.html.serialize(t.value[0],n,t.meta)}return""}));return`<body id="yoopta-clipboard" data-editor-id="${e.id}">${n.join("")}</body>`}var De=Symbol.for("immer-nothing"),je=Symbol.for("immer-draftable"),Re=Symbol.for("immer-state");function Ae(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Pe=Object.getPrototypeOf;function Be(e){return!!e&&!!e[Re]}function Te(e){return!!e&&(Me(e)||Array.isArray(e)||!!e[je]||!!e.constructor?.[je]||He(e)||Ve(e))}var Ne=Object.prototype.constructor.toString();function Me(e){if(!e||"object"!=typeof e)return!1;const t=Pe(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)===Ne}function Le(e,t){0===Ie(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Ie(e){const t=e[Re];return t?t.type_:Array.isArray(e)?1:He(e)?2:Ve(e)?3:0}function ze(e,t){return 2===Ie(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Fe(e,t,n){const r=Ie(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function He(e){return e instanceof Map}function Ve(e){return e instanceof Set}function $e(e){return e.copy_||e.base_}function Ue(e,t){if(He(e))return new Map(e);if(Ve(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Me(e)){if(!Pe(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Re];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(Pe(e),n)}function Ke(e,t=!1){return Ye(e)||Be(e)||!Te(e)||(Ie(e)>1&&(e.set=e.add=e.clear=e.delete=We),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>Ke(t,!0)))),e}function We(){Ae(2)}function Ye(e){return Object.isFrozen(e)}var Xe,qe={};function Ze(e){const t=qe[e];return t||Ae(0),t}function Je(){return Xe}function Ge(e,t){t&&(Ze("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Qe(e){et(e),e.drafts_.forEach(nt),e.drafts_=null}function et(e){e===Xe&&(Xe=e.parent_)}function tt(e){return Xe={drafts_:[],parent_:Xe,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function nt(e){const t=e[Re];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function rt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Re].modified_&&(Qe(t),Ae(4)),Te(e)&&(e=ot(t,e),t.parent_||at(t,e)),t.patches_&&Ze("Patches").generateReplacementPatches_(n[Re].base_,e,t.patches_,t.inversePatches_)):e=ot(t,n,[]),Qe(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==De?e:void 0}function ot(e,t,n){if(Ye(t))return t;const r=t[Re];if(!r)return Le(t,((o,i)=>it(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),Le(o,((o,a)=>it(e,r,t,o,a,n,i))),at(e,t,!1),n&&e.patches_&&Ze("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function it(e,t,n,r,o,i,a){if(Be(o)){const a=ot(e,o,i&&t&&3!==t.type_&&!ze(t.assigned_,r)?i.concat(r):void 0);if(Fe(n,r,a),!Be(a))return;e.canAutoFreeze_=!1}else a&&n.add(o);if(Te(o)&&!Ye(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ot(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_&&Ke(t,n)}var lt={get(e,t){if(t===Re)return e;const n=$e(e);if(!ze(n,t))return function(e,t,n){const r=dt(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_||!Te(r)?r:r===ct(e.base_,t)?(ft(e),e.copy_[t]=pt(r,e)):r},has:(e,t)=>t in $e(e),ownKeys:e=>Reflect.ownKeys($e(e)),set(e,t,n){const r=dt($e(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ct($e(e),t),a=r?.[Re];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||ze(e.base_,t)))return!0;ft(e),ut(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!==ct(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ft(e),ut(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=$e(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Ae(11)},getPrototypeOf:e=>Pe(e.base_),setPrototypeOf(){Ae(12)}},st={};function ct(e,t){const n=e[Re];return(n?$e(n):e)[t]}function dt(e,t){if(!(t in e))return;let n=Pe(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Pe(n)}}function ut(e){e.modified_||(e.modified_=!0,e.parent_&&ut(e.parent_))}function ft(e){e.copy_||(e.copy_=Ue(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Le(lt,((e,t)=>{st[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),st.deleteProperty=function(e,t){return st.set.call(this,e,t,void 0)},st.set=function(e,t,n){return lt.set.call(this,e[0],t,n,e[0])};function pt(e,t){const n=He(e)?Ze("MapSet").proxyMap_(e,t):Ve(e)?Ze("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Je(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=lt;n&&(o=[r],i=st);const{revoke:a,proxy:l}=Proxy.revocable(o,i);return r.draft_=l,r.revoke_=a,l}(e,t);return(t?t.scope_:Je()).drafts_.push(n),n}function ht(e){if(!Te(e)||Ye(e))return e;const t=e[Re];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ue(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ue(e,!0);return Le(n,((e,t)=>{Fe(n,e,ht(t))})),t&&(t.finalized_=!1),n}var gt=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&&Ae(6),void 0!==n&&"function"!=typeof n&&Ae(7),Te(e)){const o=tt(this),i=pt(e,void 0);let a=!0;try{r=t(i),a=!1}finally{a?Qe(o):et(o)}return Ge(o,n),rt(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===De&&(r=void 0),this.autoFreeze_&&Ke(r,!0),n){const t=[],o=[];Ze("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}Ae(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){Te(e)||Ae(8),Be(e)&&(e=function(e){Be(e)||Ae(10);return ht(e)}(e));const t=tt(this),n=pt(e,void 0);return n[Re].isManual_=!0,et(t),n}finishDraft(e,t){const n=e&&e[Re];n&&n.isManual_||Ae(9);const{scope_:r}=n;return Ge(r,t),rt(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=Ze("Patches").applyPatches_;return Be(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},vt=gt.produce;gt.produceWithPatches.bind(gt),gt.setAutoFreeze.bind(gt),gt.setUseStrictShallowCopy.bind(gt),gt.applyPatches.bind(gt);var mt=gt.createDraft.bind(gt),yt=gt.finishDraft.bind(gt);function bt(e,t){switch(t.type){case"set_slate":{const{properties:n,blockId:r}=t,o=e.blockEditorsMap[r];if(o){const{slateOps:e,selectionBefore:t}=n;m.withoutNormalizing(o,(()=>{for(const t of e)o.apply(t);if(t)try{w.select(o,t),_.focus(o)}catch(e){}}))}break}case"insert_block":e.blockEditorsMap[t.block.id]=pe(e),e.children[t.block.id]=t.block,e.blockEditorsMap[t.block.id].children=t.block.value,Object.keys(e.children).forEach((n=>{const r=e.children[n];r.meta.order>=t.block.meta.order&&r.id!==t.block.id&&Be(e.children[r.id])&&(r.meta.order=r.meta.order+1)}));break;case"delete_block":{delete e.blockEditorsMap[t.block.id],delete e.children[t.block.id];const n=Object.values(e.children);n.forEach((e=>{e.meta.order>t.block.meta.order&&(Be(e)?e.meta.order--:vt(e,(e=>{e.meta.order--})))})),n.sort(((e,t)=>e.meta.order-t.meta.order)),n.forEach(((e,t)=>{Be(e.meta)?e.meta.order=t:vt(e,(e=>{e.meta=Object.assign(Object.assign({},e.meta),{order:t})}))}));break}case"set_block_value":{const{id:n,value:r,forceSlate:o}=t,i=e.blockEditorsMap[n];o&&i&&(i.children=r),Array.isArray(r)&&(Be(e.children[n])?e.children[n].value=r:vt(e.children[n],(e=>{e.value=r})));break}case"set_block_meta":{const{id:n,prevProperties:r,properties:o}=t,i=e.children[n];if(!i)break;Be(i)?Object.keys(o).forEach((e=>{i.meta[e]=o[e]})):vt(i,(e=>{e.meta=Object.assign(Object.assign({},e.meta),o)}));break}case"split_block":{const{properties:n}=t,r=pe(e);r.children=n.nextSlateValue,e.children[n.nextBlock.id]=Object.assign(Object.assign({},n.nextBlock),{value:r.children}),e.blockEditorsMap[n.nextBlock.id]=r;const o=e.blockEditorsMap[t.prevProperties.originalBlock.id];o.children=n.splitSlateValue,e.children[t.prevProperties.originalBlock.id].value=o.children,Object.values(e.children).forEach((e=>{e.meta.order>=n.nextBlock.meta.order&&e.id!==n.nextBlock.id&&(Be(e)?e.meta.order++:vt(e,(e=>{e.meta.order++})))}));break}case"merge_block":{const{prevProperties:n,properties:r}=t;delete e.blockEditorsMap[n.sourceBlock.id],delete e.children[n.sourceBlock.id],e.children[r.mergedBlock.id]=r.mergedBlock,e.blockEditorsMap[r.mergedBlock.id].children=r.mergedSlateValue,Object.values(e.children).forEach((e=>{e.meta.order>r.mergedBlock.meta.order&&(Be(e)?e.meta.order--:vt(e,(e=>{e.meta.order--})))}));break}case"move_block":{const{prevProperties:n,properties:r}=t,o=e.children[n.id];o&&(o.meta.order=r.order,Object.values(e.children).forEach((e=>{e.id!==n.id&&(n.order<r.order?e.meta.order>n.order&&e.meta.order<=r.order&&e.meta.order--:e.meta.order<n.order&&e.meta.order>=r.order&&e.meta.order++)})));break}case"set_block_path":e.path=t.path;break;case"normalize_block_paths":{const t=Object.values(e.children);t.sort(((e,t)=>e.meta.order-t.meta.order)),t.forEach(((e,t)=>{Be(e.meta)?e.meta.order=t:vt(e,(e=>{e.meta=Object.assign(Object.assign({},e.meta),{order:t})}))}));break}}}const wt=100;function xt(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return void console.warn("No slate found");let i=e=>y.isElement(e);(null==n?void 0:n.type)&&(i=e=>y.isElement(e)&&e.type===(null==n?void 0:n.type));try{const[e]=m.nodes(o,{at:(null==n?void 0:n.path)||o.selection||[0],match:i,mode:"lowest"});return e}catch(e){}}function kt(e,t,n){const r=xt(e,t,n);if(r)return r[0]}const Et={createElement:function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const i=re(e,{at:o.meta.order});i?m.withoutNormalizing(i,(()=>{const a=e.blocks[o.type],l=a.elements[n.type],s=z({type:n.type,props:Object.assign(Object.assign({},l.props),n.props)}),c=Object.keys(a.elements);let d=[];c.forEach((e=>{const t=a.elements[e];e===n.type&&Array.isArray(t.children)&&t.children.length>0&&t.children.forEach((e=>{const t=a.elements[e];d.push(z({type:e,props:t.props}))}))})),d.length>0&&(s.children=d);const{path:u,focus:f=!0}=r||{};let p;const h=xt(e,t,{type:n.type});if(h){const[,e]=h;k.isPath(u)?p=u:"prev"===u?p=k.previous(e):"next"===u&&(p=k.next(e))}if(w.insertNodes(i,s,{at:p,select:f}),f&&d.length>0){const n=d[0],r=xt(e,t,{path:p,type:n.type});if(r){const[,e]=r;w.select(i,e)}}e.emit("change",e.children)})):console.warn("No slate found")},deleteElement:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});o?m.withoutNormalizing(o,(()=>{w.removeNodes(o,{at:n.path,match:e=>y.isElement(e)&&e.type===n.type}),e.emit("change",e.children)})):console.warn("No slate found")},updateElement:function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const i=re(e,{at:o.meta.order});i?m.withoutNormalizing(i,(()=>{const[t]=m.nodes(i,{at:(null==r?void 0:r.path)||[0],match:e=>y.isElement(e)&&e.type===n.type}),o=null==t?void 0:t[0],a=null==t?void 0:t[1],l=(null==o?void 0:o.props)||{},s={props:Object.assign(Object.assign({},l),n.props)};w.setNodes(i,s,{at:(null==r?void 0:r.path)||a||[0],match:e=>y.isElement(e)&&e.type===n.type,mode:"lowest"}),e.emit("change",e.children)})):console.warn("No slate found")},insertElementText:function(e,t,n){const{blockId:r,focus:o}=n||{},i=r?e.children[r]:ne(e);if(!i)return void console.warn(`To set text programmatically, you must provide a valid blockId. Got: ${r}`);const a=re(e,{at:i.meta.order});if(!a)return void console.warn("No slate found");const l=e.blocks[i.type],s=Array.from({length:Object.keys(l.elements).length},(e=>0));let c=a.selection||s;c?m.withoutNormalizing(a,(()=>{O.isRange(c)&&!O.isCollapsed(c)&&w.collapse(a,{edge:"end"}),w.insertText(a,t,{at:c}),e.emit("change",e.children),o&&e.focusBlock(i.id,{waitExecution:!0,shouldUpdateBlockSelection:!0})})):console.warn("No valid path or selection found for text insertion")},getElement:kt,getElementChildren:function(e,t,n){const r=kt(e,t,n);if(r)return r.children},getElementEntry:xt,isElementEmpty:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return void console.warn("No slate found");const[i]=m.nodes(o,{at:n.path||o.selection,match:e=>y.isElement(e)&&e.type===n.type});if(i){const[e,t]=i;return 0===m.string(o,t).trim().length}return!1},getElementPath:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(o)try{return _.findPath(o,n)}catch(e){}else console.warn("No slate found")},getParentElementPath:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return console.warn("No slate found"),[];try{const e=_.findPath(o,n);return k.parent(e)}catch(e){}}};function Ot(e){var t;const n=ne(e),r=re(e,{at:e.path.current}),o=Z.getPreviousPath(e),i=re(e,{at:o}),a=ne(e,{at:o}),l=e.blocks[(null==a?void 0:a.type)||""];if(!(r&&n&&i&&a))return;const s=Et.getElement(e,a.id);if(l&&!l.hasCustomEditor&&"void"!==(null===(t=null==s?void 0:s.props)||void 0===t?void 0:t.nodeType)){try{const e=q(i);w.select(i,e)}catch(e){w.select(i,m.start(i,[]))}m.withoutNormalizing(i,(()=>{const t=[],o=function(e,t){const n=JSON.parse(JSON.stringify(e.children)),r=JSON.parse(JSON.stringify(t.children)),o=n[n.length-1],i=r[0];return b.isText(o)&&b.isText(i)?(o.text+=i.text,[...n.slice(0,-1),o,...r.slice(1)]):[...n,...r]}(i.children[0],r.children[0]),l=[Object.assign(Object.assign({},i.children[0]),{children:o})],s=Object.assign(Object.assign({},a),{value:l});t.push({type:"merge_block",prevProperties:{sourceBlock:n,sourceSlateValue:r.children,targetBlock:a,targetSlateValue:i.children},properties:{mergedBlock:s,mergedSlateValue:l},path:e.path}),e.applyTransforms(t),e.setPath({current:a.meta.order});try{_.focus(i)}catch(e){console.error("Error setting focus:",e)}}))}}function St(e){var t,n,r;return{id:(null==e?void 0:e.id)||I(),value:(null==e?void 0:e.value)||[{id:I(),type:(null==r?void 0:r.type)||"paragraph",children:(null==r?void 0:r.children)||[{text:""}],props:Object.assign({nodeType:"block"},null==r?void 0:r.props)}],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:(null===(t=null==e?void 0:e.meta)||void 0===t?void 0:t.order)||0,depth:(null===(n=null==e?void 0:e.meta)||void 0===n?void 0:n.depth)||0},null==e?void 0:e.meta)}}const Ct={insertBlock:W,deleteBlock:G,moveBlock:Q,focusBlock:te,splitBlock:se,increaseBlockDepth:ce,decreaseBlockDepth:de,duplicateBlock:me,updateBlock:ye,toggleBlock:ke,getBlock:Oe,getSlate:J,buildDefaultChildren:()=>{const e=I();return{[e]:St({id:e})}},buildBlockData:St,mergeBlock:Ot};const _t=new WeakMap,Dt=new WeakMap,jt={isMergingHistory:e=>Dt.get(e),isSavingHistory:e=>_t.get(e),withMergingHistory(e,t){const n=jt.isMergingHistory(e);Dt.set(e,!0),t(),Dt.set(e,n)},withoutMergingHistory(e,t){const n=jt.isMergingHistory(e);Dt.set(e,!1),t(),Dt.set(e,n)},withoutSavingHistory(e,t){const n=jt.isSavingHistory(e);_t.set(e,!1),t(),_t.set(e,n)},redo:(e,t)=>{const{redos:n}=e.historyStack;if(n.length>0){const r=n[n.length-1];jt.withoutSavingHistory(e,(()=>{e.applyTransforms(r.operations,{source:"history"}),e.setPath(r.path);const{scroll:n=!0}=t||{};if(n&&"number"==typeof r.path.current){const t=Ct.getBlock(e,{at:r.path.current}),n=document.querySelector(`[data-yoopta-block-id="${null==t?void 0:t.id}"]`);n&&!Rt(n)&&n.scrollIntoView({block:"center",behavior:"auto"})}})),e.historyStack.redos.pop(),e.historyStack.undos.push(r)}},undo:(e,t)=>{const{undos:n}=e.historyStack;if(n.length>0){const n=e.historyStack.undos[e.historyStack.undos.length-1];jt.withoutSavingHistory(e,(()=>{const r=n.operations.flatMap((e=>function(e,t){switch(t.type){case"insert_block":return{type:"delete_block",path:t.path,block:t.block};case"delete_block":return{type:"insert_block",path:t.path,block:t.block};case"set_block_meta":return{type:"set_block_meta",id:t.id,properties:t.prevProperties,prevProperties:t.properties};case"split_block":return[{type:"delete_block",block:t.properties.nextBlock,path:t.path},{type:"set_block_value",id:t.prevProperties.originalBlock.id,value:t.prevProperties.originalValue,forceSlate:!0}];case"merge_block":return[{type:"split_block",properties:{nextBlock:t.prevProperties.sourceBlock,nextSlateValue:t.prevProperties.sourceSlateValue,splitSlateValue:t.prevProperties.targetSlateValue},prevProperties:{originalBlock:t.properties.mergedBlock,originalValue:t.properties.mergedSlateValue},path:t.path}];case"move_block":return{type:"move_block",properties:t.prevProperties,prevProperties:t.properties};case"set_slate":return{type:"set_slate",properties:{slateOps:t.properties.slateOps.map(C.inverse).reverse(),selectionBefore:t.properties.selectionBefore},slate:t.slate,blockId:t.blockId};default:return t}}(0,e))).reverse();e.applyTransforms(r,{source:"history"}),e.setPath(n.path);const{scroll:o=!0}=t||{};if(o&&"number"==typeof n.path.current){const t=Ct.getBlock(e,{at:n.path.current}),r=document.querySelector(`[data-yoopta-block-id="${null==t?void 0:t.id}"]`);r&&!Rt(r)&&r.scrollIntoView({block:"center",behavior:"auto"})}})),e.historyStack.redos.push(n),e.historyStack.undos.pop()}}};function Rt(e){var t=e.getBoundingClientRect(),n=document.documentElement;return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||n.clientHeight)&&t.right<=(window.innerWidth||n.clientWidth)}function At(){const e={id:"",children:{},path:{current:null},readOnly:!1,isEmpty:()=>function(e){const t=Object.values(e.children);if(t.length>1)return!1;const n=t[0];if(!n)return!0;if("Paragraph"!==n.type)return!1;const r=re(e,{at:n.meta.order});if(!r)return!0;try{return!(m.string(r,[0]).length>0)}catch(e){return!0}}(e),getEditorValue:()=>function(e){return e.children}(e),setEditorValue:(...t)=>function(e,t){e.children=t,e.blockEditorsMap=ve(e),e.emit("change",e.children)}(e,...t),insertBlock:(...t)=>W(e,...t),deleteBlock:(...t)=>G(e,...t),duplicateBlock:(...t)=>me(e,...t),toggleBlock:(...t)=>ke(e,...t),increaseBlockDepth:(...t)=>ce(e,...t),decreaseBlockDepth:(...t)=>de(e,...t),moveBlock:(...t)=>Q(e,...t),focusBlock:(...t)=>te(e,...t),getBlock:(...t)=>Oe(e,...t),updateBlock:(...t)=>ye(e,...t),splitBlock:(...t)=>se(e,...t),mergeBlock:(...t)=>Ot(e,...t),setPath:(...t)=>X(e,...t),blockEditorsMap:{},blocks:{},formats:{},shortcuts:{},plugins:{},commands:{},applyTransforms:(t,...n)=>function(e,t,n){e.children=mt(e.children),e.path=mt(e.path);const{normalizePaths:r=!0,source:o}=n||{},i=[...t];r&&i.push({type:"normalize_block_paths"}),i.sort(((e,t)=>"insert_block"===e.type&&"insert_block"===t.type?e.block.meta.order-t.block.meta.order:0));for(const t of i)"set_slate"===t.type&&"api"===o||bt(e,t);Be(e.children)||(e.children=mt(e.children)),e.children=yt(e.children),Be(e.path)&&(e.path=yt(e.path));const a={operations:i.filter((e=>"set_block_path"!==e.type&&"set_block_value"!==e.type&&"normalize_block_paths"!==e.type)),path:e.path};a.operations.length>0&&"history"!==o&&(e.historyStack.undos.push(a),e.historyStack.redos=[]),e.historyStack.undos.length>wt&&e.historyStack.undos.shift(),e.emit("change",{value:e.children,operations:i}),e.emit("path-change",e.path)}(e,t,...n),batchOperations:t=>function(e,t){const n=[],r=e.applyTransforms;e.applyTransforms=e=>{n.push(...e)},t(),e.applyTransforms=r,n.length>0&&e.applyTransforms(n)}(e,t),on:(e,t)=>{},off:(e,t)=>{},emit:(e,...t)=>{},once:(e,t)=>{},isFocused:()=>function(e){return!!ee.get(e)}(e),focus:()=>function(e){if(e.readOnly)return;const t=ne(e,{at:0});t&&(ee.set(e,!0),e.focusBlock(t.id,{waitExecution:!0}),e.emit("focus",!0))}(e),blur:(...t)=>function(e,t={}){var n;const r=null!==(n=t.slate)&&void 0!==n?n:re(e);if(!r)return;const{waitExecution:o,waitExecutionMs:i}=t;o?setTimeout((()=>Ee(e,r)),i):(ee.set(e,!1),Ee(e,r),e.emit("blur",!1))}(e,...t),getHTML:t=>_e(e,t),getMarkdown:t=>function(e,t){return function(e,t){return t.sort(((e,t)=>e.meta.order>t.meta.order?1:-1)).map((t=>{var n,r;const o=e.plugins[t.type];if(o){const e=t.value[0];if(null===(r=null===(n=o.parsers)||void 0===n?void 0:n.markdown)||void 0===r?void 0:r.serialize){const t=o.parsers.markdown.serialize(e,e.children.map((e=>e.text)).join(""));if(t)return t}}return""})).join("\n")}(e,Object.values(t))}(e,t),getPlainText:t=>function(e,t){const n=_e(e,t),r=document.createElement("div");return r.innerHTML=n,r.innerText}(e,t),refElement:null,historyStack:{undos:[],redos:[]},redo:t=>jt.redo(e,t),undo:t=>jt.undo(e,t),isSavingHistory:()=>jt.isSavingHistory(e),isMergingHistory:()=>jt.isMergingHistory(e),withoutSavingHistory:t=>jt.withoutSavingHistory(e,t),withoutMergingHistory:t=>jt.withoutMergingHistory(e,t),withMergingHistory:t=>jt.withMergingHistory(e,t)};return e}const Pt={editor:At()},Bt=i(Pt),Tt=({children:t,editorState:n})=>{const r=l(Pt);return r.current={editor:n.editor},e(Bt.Provider,Object.assign({value:r.current},{children:t}))},Nt=()=>{const e=a(Bt);if(!e)throw new Error("useYooptaEditor must be used within a YooptaEditorContext");return e.editor},Mt=e=>Nt().children[e],Lt=()=>Nt().isFocused(),It=()=>Nt().readOnly,zt=e=>{var t;return null===(t=Nt().plugins[e])||void 0===t?void 0:t.options},Ft=({blockId:e,at:t})=>{const n=Nt();if(!e&&"number"!=typeof t)throw new Error("useBlockSelected must receive either blockId or at");let r;return e&&(r=n.children[e]),t&&(r=Ct.getBlock(n,{at:t})),n.path.current===(null==r?void 0:r.meta.order)};var Ht={};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new o(r,i||e,a),s=n?n+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],l]:e._events[s].push(l):(e._events[s]=l,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},l.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o<i;o++)a[o]=r[o].fn;return a},l.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,o,i,a){var l=n?n+e:e;if(!this._events[l])return!1;var s,c,d=this._events[l],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,o),!0;case 5:return d.fn.call(d.context,t,r,o,i),!0;case 6:return d.fn.call(d.context,t,r,o,i,a),!0}for(c=1,s=new Array(u-1);c<u;c++)s[c-1]=arguments[c];d.fn.apply(d.context,s)}else{var f,p=d.length;for(c=0;c<p;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),u){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,r);break;case 4:d[c].fn.call(d[c].context,t,r,o);break;default:if(!s)for(f=1,s=new Array(u-1);f<u;f++)s[f-1]=arguments[f];d[c].fn.apply(d[c].context,s)}}return!0},l.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return a(this,i),this;var l=this._events[i];if(l.fn)l.fn!==t||o&&!l.once||r&&l.context!==r||a(this,i);else{for(var s=0,c=[],d=l.length;s<d;s++)(l[s].fn!==t||o&&!l[s].once||r&&l[s].context!==r)&&c.push(l[s]);c.length?this._events[i]=1===c.length?c[0]:c:a(this,i)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l}({get exports(){return Ht},set exports(e){Ht=e}});var Vt=Ht;const $t="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function Ut(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Kt(e){return"nodeType"in e}function Wt(e){var t,n;return e?Ut(e)?e:Kt(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function Yt(e){const{Document:t}=Wt(e);return e instanceof t}function Xt(e){return!Ut(e)&&e instanceof Wt(e).HTMLElement}function qt(e){return e instanceof Wt(e).SVGElement}function Zt(e){return e?Ut(e)?e.document:Kt(e)?Yt(e)?e:Xt(e)||qt(e)?e.ownerDocument:document:document:document}const Jt=$t?s:c;function Gt(e){const t=l(e);return Jt((()=>{t.current=e})),u((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)}),[])}function Qt(e,t){void 0===t&&(t=[e]);const n=l(e);return Jt((()=>{n.current!==e&&(n.current=e)}),t),n}function en(e,t){const n=l();return d((()=>{const t=e(n.current);return n.current=t,t}),[...t])}function tn(e){const t=Gt(e),n=l(null),r=u((e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,r]}function nn(e){const t=l();return c((()=>{t.current=e}),[e]),t.current}let rn={};function on(e,t){return d((()=>{if(t)return t;const n=null==rn[e]?0:rn[e]+1;return rn[e]=n,e+"-"+n}),[e,t])}function an(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce(((t,n)=>{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t}),{...t})}}const ln=an(1),sn=an(-1);function cn(e){if(!e)return!1;const{KeyboardEvent:t}=Wt(e.target);return t&&e instanceof t}function dn(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=Wt(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const un=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[un.Translate.toString(e),un.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),fn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function pn(e){return e.matches(fn)?e:e.querySelector(fn)}const hn={display:"none"};function gn(e){let{id:t,value:n}=e;return o.createElement("div",{id:t,style:hn},n)}function vn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return o.createElement("div",{id:t,style:{position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const mn=i(null);const yn={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},bn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function wn(e){let{announcements:t=bn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=yn}=e;const{announce:l,announcement:s}=function(){const[e,t]=f("");return{announce:u((e=>{null!=e&&t(e)}),[]),announcement:e}}(),p=on("DndLiveRegion"),[h,g]=f(!1);if(c((()=>{g(!0)}),[]),function(e){const t=a(mn);c((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}(d((()=>({onDragStart(e){let{active:n}=e;l(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&l(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;l(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;l(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;l(t.onDragCancel({active:n,over:r}))}})),[l,t])),!h)return null;const v=o.createElement(o.Fragment,null,o.createElement(gn,{id:r,value:i.draggable}),o.createElement(vn,{id:p,announcement:s}));return n?N(v,n):v}var xn;function kn(){}function En(e,t){return d((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(xn||(xn={}));const On=Object.freeze({x:0,y:0});function Sn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Cn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function _n(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Dn(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function jn(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function Rn(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const An=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Rn(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=Sn(Rn(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(Cn)};function Pn(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,l=i-n;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=a*l;return Number((o/(n+r-o)).toFixed(4))}return 0}const Bn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const e of r){const{id:r}=e,i=n.get(r);if(i){const n=Pn(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(_n)};function Tn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:On}function Nn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce(((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const Mn=Nn(1);const Ln={ignoreTransform:!1};function In(e,t){void 0===t&&(t=Ln);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=Wt(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:l}=r,s=e.left-a-(1-o)*parseFloat(n),c=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:c,right:s+d,bottom:c+u,left:s}}(n,t,r))}const{top:r,left:o,width:i,height:a,bottom:l,right:s}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:s}}function zn(e){return In(e,{ignoreTransform:!0})}function Fn(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(Yt(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Xt(o)||qt(o))return n;if(n.includes(o))return n;const i=Wt(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=Wt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const r=t[e];return"string"==typeof r&&n.test(r)}))}(o,i)&&n.push(o),function(e,t){return void 0===t&&(t=Wt(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function Hn(e){const[t]=Fn(e,1);return null!=t?t:null}function Vn(e){return $t&&e?Ut(e)?e:Kt(e)?Yt(e)||e===Zt(e).scrollingElement?window:Xt(e)?e:null:null:null}function $n(e){return Ut(e)?e.scrollX:e.scrollLeft}function Un(e){return Ut(e)?e.scrollY:e.scrollTop}function Kn(e){return{x:$n(e),y:Un(e)}}var Wn;function Yn(e){return!(!$t||!e)&&e===document.scrollingElement}function Xn(e){const t={x:0,y:0},n=Yn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Wn||(Wn={}));const qn={x:.2,y:.2};function Zn(e,t,n,r,o){let{top:i,left:a,right:l,bottom:s}=n;void 0===r&&(r=10),void 0===o&&(o=qn);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=Xn(e),p={x:0,y:0},h={x:0,y:0},g=t.height*o.y,v=t.width*o.x;return!c&&i<=t.top+g?(p.y=Wn.Backward,h.y=r*Math.abs((t.top+g-i)/g)):!d&&s>=t.bottom-g&&(p.y=Wn.Forward,h.y=r*Math.abs((t.bottom-g-s)/g)),!f&&l>=t.right-v?(p.x=Wn.Forward,h.x=r*Math.abs((t.right-v-l)/v)):!u&&a<=t.left+v&&(p.x=Wn.Backward,h.x=r*Math.abs((t.left+v-a)/v)),{direction:p,speed:h}}function Jn(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Gn(e){return e.reduce(((e,t)=>ln(e,Kn(t))),On)}const Qn=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+$n(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+Un(t)),0)}]];class er{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Fn(t),r=Gn(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of Qn)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),a=r[e]-t;return this.rect[i]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class tr{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function nr(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var rr,or;function ir(e){e.preventDefault()}function ar(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(rr||(rr={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(or||(or={}));const lr={start:[or.Space,or.Enter],cancel:[or.Esc],end:[or.Space,or.Enter]},sr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case or.Right:return{...n,x:n.x+25};case or.Left:return{...n,x:n.x-25};case or.Down:return{...n,y:n.y+25};case or.Up:return{...n,y:n.y-25}}};class cr{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new tr(Zt(t)),this.windowListeners=new tr(Wt(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(rr.Resize,this.handleCancel),this.windowListeners.add(rr.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(rr.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=In),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Hn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(On)}handleKeyDown(e){if(cn(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=lr,coordinateGetter:i=sr,scrollBehavior:a="smooth"}=r,{code:l}=e;if(o.end.includes(l))return void this.handleEnd(e);if(o.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:On;this.referenceCoordinates||(this.referenceCoordinates=c);const d=i(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=sn(d,c),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:l,isLeft:s,isBottom:c,maxScroll:u,minScroll:f}=Xn(n),p=Jn(n),h={x:Math.min(o===or.Right?p.right-p.width/2:p.right,Math.max(o===or.Right?p.left:p.left+p.width/2,d.x)),y:Math.min(o===or.Down?p.bottom-p.height/2:p.bottom,Math.max(o===or.Down?p.top:p.top+p.height/2,d.y))},g=o===or.Right&&!l||o===or.Left&&!s,v=o===or.Down&&!c||o===or.Up&&!i;if(g&&h.x!==d.x){const e=n.scrollLeft+t.x,i=o===or.Right&&e<=u.x||o===or.Left&&e>=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:a});r.x=i?n.scrollLeft-e:o===or.Right?n.scrollLeft-u.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(v&&h.y!==d.y){const e=n.scrollTop+t.y,i=o===or.Down&&e<=u.y||o===or.Up&&e>=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:a});r.y=i?n.scrollTop-e:o===or.Down?n.scrollTop-u.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:a});break}}this.handleMove(e,ln(sn(d,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function dr(e){return Boolean(e&&"distance"in e)}function ur(e){return Boolean(e&&"delay"in e)}cr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=lr,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class fr{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=Wt(e);return e instanceof t?e:Zt(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:o}=e,{target:i}=o;this.props=e,this.events=t,this.document=Zt(i),this.documentListeners=new tr(this.document),this.listeners=new tr(n),this.windowListeners=new tr(Wt(i)),this.initialCoordinates=null!=(r=dn(o))?r:On,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(rr.Resize,this.handleCancel),this.windowListeners.add(rr.DragStart,ir),this.windowListeners.add(rr.VisibilityChange,this.handleCancel),this.windowListeners.add(rr.ContextMenu,ir),this.documentListeners.add(rr.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ur(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(dr(t))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(rr.Click,ar,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(rr.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!r)return;const l=null!=(t=dn(e))?t:On,s=sn(r,l);if(!n&&a){if(dr(a)){if(null!=a.tolerance&&nr(s,a.tolerance))return this.handleCancel();if(nr(s,a.distance))return this.handleStart()}return ur(a)&&nr(s,a.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===or.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const pr={move:{name:"pointermove"},end:{name:"pointerup"}};class hr extends fr{constructor(e){const{event:t}=e,n=Zt(t.target);super(e,pr,n)}}hr.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const gr={move:{name:"mousemove"},end:{name:"mouseup"}};var vr;!function(e){e[e.RightClick=2]="RightClick"}(vr||(vr={}));(class extends fr{constructor(e){super(e,gr,Zt(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==vr.RightClick&&(null==r||r({event:n}),!0)}}];const mr={move:{name:"touchmove"},end:{name:"touchend"}};var yr,br;function wr(e){let{acceleration:t,activator:n=yr.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:s=br.TreeOrder,pointerCoordinates:f,scrollableAncestors:p,scrollableAncestorRects:h,delta:g,threshold:v}=e;const m=function(e){let{delta:t,disabled:n}=e;const r=nn(t);return en((e=>{if(n||!r||!e)return xr;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Wn.Backward]:e.x[Wn.Backward]||-1===o.x,[Wn.Forward]:e.x[Wn.Forward]||1===o.x},y:{[Wn.Backward]:e.y[Wn.Backward]||-1===o.y,[Wn.Forward]:e.y[Wn.Forward]||1===o.y}}}),[n,t,r])}({delta:g,disabled:!i}),[y,b]=function(){const e=l(null);return[u(((t,n)=>{e.current=setInterval(t,n)}),[]),u((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),w=l({x:0,y:0}),x=l({x:0,y:0}),k=d((()=>{switch(n){case yr.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case yr.DraggableRect:return o}}),[n,o,f]),E=l(null),O=u((()=>{const e=E.current;if(!e)return;const t=w.current.x*x.current.x,n=w.current.y*x.current.y;e.scrollBy(t,n)}),[]),S=d((()=>s===br.TreeOrder?[...p].reverse():p),[s,p]);c((()=>{if(i&&p.length&&k){for(const e of S){if(!1===(null==r?void 0:r(e)))continue;const n=p.indexOf(e),o=h[n];if(!o)continue;const{direction:i,speed:l}=Zn(e,o,k,t,v);for(const e of["x","y"])m[e][i[e]]||(l[e]=0,i[e]=0);if(l.x>0||l.y>0)return b(),E.current=e,y(O,a),w.current=l,void(x.current=i)}w.current={x:0,y:0},x.current={x:0,y:0},b()}else b()}),[t,O,r,b,i,a,JSON.stringify(k),JSON.stringify(m),y,p,S,h,JSON.stringify(v)])}(class extends fr{constructor(e){super(e,mr)}static setup(){return window.addEventListener(mr.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(mr.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return!(o.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(yr||(yr={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(br||(br={}));const xr={x:{[Wn.Backward]:!1,[Wn.Forward]:!1},y:{[Wn.Backward]:!1,[Wn.Forward]:!1}};var kr,Er;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(kr||(kr={})),function(e){e.Optimized="optimized"}(Er||(Er={}));const Or=new Map;function Sr(e,t){return en((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function Cr(e){let{callback:t,disabled:n}=e;const r=Gt(t),o=d((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)}),[n]);return c((()=>()=>null==o?void 0:o.disconnect()),[o]),o}function _r(e){return new er(In(e),e)}function Dr(e,t,n){void 0===t&&(t=_r);const[r,o]=h((function(r){if(!e)return null;var o;if(!1===e.isConnected)return null!=(o=null!=r?r:n)?o:null;const i=t(e);if(JSON.stringify(r)===JSON.stringify(i))return r;return i}),null),i=function(e){let{callback:t,disabled:n}=e;const r=Gt(t),o=d((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)}),[r,n]);return c((()=>()=>null==o?void 0:o.disconnect()),[o]),o}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),a=Cr({callback:o});return Jt((()=>{o(),e?(null==a||a.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==a||a.disconnect(),null==i||i.disconnect())}),[e]),r}const jr=[];function Rr(e,t){void 0===t&&(t=[]);const n=l(null);return c((()=>{n.current=null}),t),c((()=>{const t=e!==On;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?sn(e,n.current):On}function Ar(e){return d((()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null),[e])}const Pr=[];function Br(e){let{measure:t}=e;const[n,r]=f(null),o=u((e=>{for(const{target:n}of e)if(Xt(n)){r((e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r}));break}}),[t]),i=Cr({callback:o}),a=u((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Xt(t)?t:e}(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)}),[t,i]),[l,s]=tn(a);return d((()=>({nodeRef:l,rect:n,setRef:s})),[n,l,s])}const Tr=[{sensor:hr,options:{}},{sensor:cr,options:{}}],Nr={current:{}},Mr={draggable:{measure:zn},droppable:{measure:zn,strategy:kr.WhileDragging,frequency:Er.Optimized},dragOverlay:{measure:In}};class Lr extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const Ir={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Lr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:kn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mr,measureDroppableContainers:kn,windowRect:null,measuringScheduled:!1},zr=i({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:kn,draggableNodes:new Map,over:null,measureDroppableContainers:kn}),Fr=i(Ir);function Hr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Lr}}}function Vr(e,t){switch(t.type){case xn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case xn.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case xn.DragEnd:case xn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case xn.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Lr(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case xn.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Lr(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case xn.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Lr(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function $r(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=a(zr),i=nn(r),l=nn(null==n?void 0:n.id);return c((()=>{if(!t&&!r&&i&&null!=l){if(!cn(i))return;if(document.activeElement===i.target)return;const e=o.get(l);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=pn(e);if(t){t.focus();break}}}))}}),[r,t,o,l,i]),null}const Ur=i({...On,scaleX:1,scaleY:1});var Kr;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Kr||(Kr={}));const Wr=p((function(e){var t,n,r,i;let{id:a,accessibility:s,autoScroll:p=!0,children:g,sensors:v=Tr,collisionDetection:m=Bn,measuring:y,modifiers:b,...w}=e;const x=h(Vr,void 0,Hr),[k,E]=x,[O,S]=function(){const[e]=f((()=>new Set)),t=u((t=>(e.add(t),()=>e.delete(t))),[e]);return[u((t=>{let{type:n,event:r}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)}))}),[e]),t]}(),[C,_]=f(Kr.Uninitialized),D=C===Kr.Initialized,{draggable:{active:j,nodes:R,translate:A},droppable:{containers:P}}=k,B=j?R.get(j):null,N=l({initial:null,translated:null}),M=d((()=>{var e;return null!=j?{id:j,data:null!=(e=null==B?void 0:B.data)?e:Nr,rect:N}:null}),[j,B]),L=l(null),[I,z]=f(null),[F,H]=f(null),V=Qt(w,Object.values(w)),$=on("DndDescribedBy",a),U=d((()=>P.getEnabled()),[P]),K=d((()=>({draggable:{...Mr.draggable,...null==W?void 0:W.draggable},droppable:{...Mr.droppable,...null==W?void 0:W.droppable},dragOverlay:{...Mr.dragOverlay,...null==W?void 0:W.dragOverlay}})),[null==(W=y)?void 0:W.draggable,null==W?void 0:W.droppable,null==W?void 0:W.dragOverlay]);var W;const{droppableRects:Y,measureDroppableContainers:X,measuringScheduled:q}=function(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=f(null),{frequency:s,measure:d,strategy:p}=o,h=l(e),g=function(){switch(p){case kr.Always:return!1;case kr.BeforeDragging:return n;default:return!n}}(),v=Qt(g),m=u((function(e){void 0===e&&(e=[]),v.current||a((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[v]),y=l(null),b=en((t=>{if(g&&!n)return Or;if(!t||t===Or||h.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new er(d(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t}),[e,i,n,g,d]);return c((()=>{h.current=e}),[e]),c((()=>{g||m()}),[n,g]),c((()=>{i&&i.length>0&&a(null)}),[JSON.stringify(i)]),c((()=>{g||"number"!=typeof s||null!==y.current||(y.current=setTimeout((()=>{m(),y.current=null}),s))}),[s,g,m,...r]),{droppableRects:b,measureDroppableContainers:m,measuringScheduled:null!=i}}(U,{dragging:D,dependencies:[A.x,A.y],config:K.droppable}),Z=function(e,t){const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return en((e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])}(R,j),J=d((()=>F?dn(F):null),[F]),G=function(){const e=!1===(null==I?void 0:I.autoScrollEnabled),t="object"==typeof p?!1===p.enabled:!1===p,n=D&&!e&&!t;if("object"==typeof p)return{...p,enabled:n};return{enabled:n}}(),Q=function(e,t){return Sr(e,t)}(Z,K.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=l(!1),{x:a,y:s}="boolean"==typeof o?{x:o,y:o}:o;Jt((()=>{if(!a&&!s||!t)return void(i.current=!1);if(i.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const o=Tn(n(e),r);if(a||(o.x=0),s||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const t=Hn(e);t&&t.scrollBy({top:o.y,left:o.x})}}),[t,a,s,r,n])}({activeNode:j?R.get(j):null,config:G.layoutShiftCompensation,initialRect:Q,measure:K.draggable.measure});const ee=Dr(Z,K.draggable.measure,Q),te=Dr(Z?Z.parentElement:null),ne=l({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=P.getNodeFor(null==(t=ne.current.over)?void 0:t.id),oe=Br({measure:K.dragOverlay.measure}),ie=null!=(n=oe.nodeRef.current)?n:Z,ae=D?null!=(r=oe.rect)?r:ee:null,le=Boolean(oe.nodeRef.current&&oe.rect),se=Tn(ce=le?null:ee,Sr(ce));var ce;const de=Ar(ie?Wt(ie):null),ue=function(e){const t=l(e),n=en((n=>e?n&&n!==jr&&e&&t.current&&e.parentNode===t.current.parentNode?n:Fn(e):jr),[e]);return c((()=>{t.current=e}),[e]),n}(D?null!=re?re:Z:null),fe=function(e,t){void 0===t&&(t=In);const[n]=e,r=Ar(n?Wt(n):null),[o,i]=h((function(){return e.length?e.map((e=>Yn(e)?r:new er(t(e),e))):Pr}),Pr),a=Cr({callback:i});return e.length>0&&o===Pr&&i(),Jt((()=>{e.length?e.forEach((e=>null==a?void 0:a.observe(e))):(null==a||a.disconnect(),i())}),[e]),o}(ue),pe=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}(b,{transform:{x:A.x-se.x,y:A.y-se.y,scaleX:1,scaleY:1},activatorEvent:F,active:M,activeNodeRect:ee,containerNodeRect:te,draggingNodeRect:ae,over:ne.current.over,overlayNodeRect:oe.rect,scrollableAncestors:ue,scrollableAncestorRects:fe,windowRect:de}),he=J?ln(J,A):null,ge=function(e){const[t,n]=f(null),r=l(e),o=u((e=>{const t=Vn(e.target);t&&n((e=>e?(e.set(t,Kn(t)),new Map(e)):null))}),[]);return c((()=>{const t=r.current;if(e!==t){i(t);const a=e.map((e=>{const t=Vn(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,Kn(t)]):null})).filter((e=>null!=e));n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach((e=>{const t=Vn(e);null==t||t.removeEventListener("scroll",o)}))}}),[o,e]),d((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>ln(e,t)),On):Gn(e):On),[e,t])}(ue),ve=Rr(ge),me=Rr(ge,[ee]),ye=ln(pe,ve),be=ae?Mn(ae,pe):null,we=M&&be?m({active:M,collisionRect:be,droppableRects:Y,droppableContainers:U,pointerCoordinates:he}):null,xe=jn(we,"id"),[ke,Ee]=f(null),Oe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(le?pe:ln(pe,me),null!=(i=null==ke?void 0:ke.rect)?i:null,ee),Se=u(((e,t)=>{let{sensor:n,options:r}=t;if(null==L.current)return;const o=R.get(L.current);if(!o)return;const i=e.nativeEvent,a=new n({active:L.current,activeNode:o,event:i,options:r,context:ne,onStart(e){const t=L.current;if(null==t)return;const n=R.get(t);if(!n)return;const{onDragStart:r}=V.current,o={active:{id:t,data:n.data,rect:N}};T((()=>{null==r||r(o),_(Kr.Initializing),E({type:xn.DragStart,initialCoordinates:e,active:t}),O({type:"onDragStart",event:o})}))},onMove(e){E({type:xn.DragMove,coordinates:e})},onEnd:l(xn.DragEnd),onCancel:l(xn.DragCancel)});function l(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=ne.current;let a=null;if(t&&o){const{cancelDrop:l}=V.current;if(a={activatorEvent:i,active:t,collisions:n,delta:o,over:r},e===xn.DragEnd&&"function"==typeof l){await Promise.resolve(l(a))&&(e=xn.DragCancel)}}L.current=null,T((()=>{E({type:e}),_(Kr.Uninitialized),Ee(null),z(null),H(null);const t=e===xn.DragEnd?"onDragEnd":"onDragCancel";if(a){const e=V.current[t];null==e||e(a),O({type:t,event:a})}}))}}T((()=>{z(a),H(e.nativeEvent)}))}),[R]),Ce=u(((e,t)=>(n,r)=>{const o=n.nativeEvent,i=R.get(r);if(null!==L.current||!i||o.dndKit||o.defaultPrevented)return;const a={active:i};!0===e(n,t.options,a)&&(o.dndKit={capturedBy:t.sensor},L.current=r,Se(n,t))}),[R,Se]),_e=function(e,t){return d((()=>e.reduce(((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,n)})))]}),[])),[e,t])}(v,Ce);!function(e){c((()=>{if(!$t)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}(v),Jt((()=>{ee&&C===Kr.Initializing&&_(Kr.Initialized)}),[ee,C]),c((()=>{const{onDragMove:e}=V.current,{active:t,activatorEvent:n,collisions:r,over:o}=ne.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:ye.x,y:ye.y},over:o};T((()=>{null==e||e(i),O({type:"onDragMove",event:i})}))}),[ye.x,ye.y]),c((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=ne.current;if(!e||null==L.current||!t||!o)return;const{onDragOver:i}=V.current,a=r.get(xe),l=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,s={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:l};T((()=>{Ee(l),null==i||i(s),O({type:"onDragOver",event:s})}))}),[xe]),Jt((()=>{ne.current={activatorEvent:F,active:M,activeNode:Z,collisionRect:be,collisions:we,droppableRects:Y,draggableNodes:R,draggingNode:ie,draggingNodeRect:ae,droppableContainers:P,over:ke,scrollableAncestors:ue,scrollAdjustedTranslate:ye},N.current={initial:ae,translated:be}}),[M,Z,we,be,R,ie,ae,Y,P,ke,ue,ye]),wr({...G,delta:A,draggingRect:be,pointerCoordinates:he,scrollableAncestors:ue,scrollableAncestorRects:fe});const De=d((()=>({active:M,activeNode:Z,activeNodeRect:ee,activatorEvent:F,collisions:we,containerNodeRect:te,dragOverlay:oe,draggableNodes:R,droppableContainers:P,droppableRects:Y,over:ke,measureDroppableContainers:X,scrollableAncestors:ue,scrollableAncestorRects:fe,measuringConfiguration:K,measuringScheduled:q,windowRect:de})),[M,Z,ee,F,we,te,oe,R,P,Y,ke,X,ue,fe,K,q,de]),je=d((()=>({activatorEvent:F,activators:_e,active:M,activeNodeRect:ee,ariaDescribedById:{draggable:$},dispatch:E,draggableNodes:R,over:ke,measureDroppableContainers:X})),[F,_e,M,ee,E,$,R,ke,X]);return o.createElement(mn.Provider,{value:S},o.createElement(zr.Provider,{value:je},o.createElement(Fr.Provider,{value:De},o.createElement(Ur.Provider,{value:Oe},g)),o.createElement($r,{disabled:!1===(null==s?void 0:s.restoreFocus)})),o.createElement(wn,{...s,hiddenTextDescribedById:$}))})),Yr=i(null),Xr="button",qr="Droppable";function Zr(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=on(qr),{activators:l,activatorEvent:s,active:c,activeNodeRect:u,ariaDescribedById:f,draggableNodes:p,over:h}=a(zr),{role:g=Xr,roleDescription:v="draggable",tabIndex:m=0}=null!=o?o:{},y=(null==c?void 0:c.id)===t,b=a(y?Ur:Yr),[w,x]=tn(),[k,E]=tn(),O=function(e,t){return d((()=>e.reduce(((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{o(e,t)},e}),{})),[e,t])}(l,t),S=Qt(n);Jt((()=>(p.set(t,{id:t,key:i,node:w,activatorNode:k,data:S}),()=>{const e=p.get(t);e&&e.key===i&&p.delete(t)})),[p,t]);return{active:c,activatorEvent:s,activeNodeRect:u,attributes:d((()=>({role:g,tabIndex:m,"aria-disabled":r,"aria-pressed":!(!y||g!==Xr)||void 0,"aria-roledescription":v,"aria-describedby":f.draggable})),[r,g,m,y,v,f.draggable]),isDragging:y,listeners:r?void 0:O,node:w,over:h,setNodeRef:x,setActivatorNodeRef:E,transform:b}}const Jr="Droppable",Gr={timeout:25};function Qr(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function eo(e,t){return e.reduce(((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e}),Array(e.length))}function to(e){return null!==e&&e>=0}const no=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Qr(t,r,n),a=t[o],l=i[o];return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}:null},ro={scaleX:1,scaleY:1},oo=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const l=null!=(t=i[n])?t:r;if(!l)return null;if(o===n){const e=i[a];return e?{x:0,y:n<a?e.top+e.height-(l.top+l.height):e.top-l.top,...ro}:null}const s=function(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];if(!r)return 0;if(n<t)return o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0;return i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0}(i,o,n);return o>n&&o<=a?{x:0,y:-l.height-s,...ro}:o<n&&o>=a?{x:0,y:l.height+s,...ro}:{x:0,y:0,...ro}};const io="Sortable",ao=o.createContext({activeIndex:-1,containerId:io,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:no,disabled:{draggable:!1,droppable:!1}});function lo(e){let{children:t,id:n,items:r,strategy:i=no,disabled:s=!1}=e;const{active:u,dragOverlay:f,droppableRects:p,over:h,measureDroppableContainers:g}=a(Fr),v=on(io,n),m=Boolean(null!==f.rect),y=d((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),b=null!=u,w=u?y.indexOf(u.id):-1,x=h?y.indexOf(h.id):-1,k=l(y),E=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(y,k.current),O=-1!==x&&-1===w||E,S=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(s);Jt((()=>{E&&b&&g(y)}),[E,y,b,g]),c((()=>{k.current=y}),[y]);const C=d((()=>({activeIndex:w,containerId:v,disabled:S,disableTransforms:O,items:y,overIndex:x,useDragOverlay:m,sortedRects:eo(y,p),strategy:i})),[w,v,S.draggable,S.droppable,O,y,x,p,m,i]);return o.createElement(ao.Provider,{value:C},t)}const so=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Qr(n,r,o).indexOf(t)},co=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:s,transition:c}=e;return!(!c||!r)&&((l===i||o!==a)&&(!!n||a!==o&&t===s))},uo={duration:200,easing:"ease"},fo="transform",po=un.Transition.toString({property:fo,duration:0,easing:"linear"}),ho={roleDescription:"sortable"};function go(e){let{animateLayoutChanges:t=co,attributes:n,disabled:r,data:o,getNewIndex:i=so,id:s,strategy:p,resizeObserverConfig:h,transition:g=uo}=e;const{items:v,containerId:m,activeIndex:y,disabled:b,disableTransforms:w,sortedRects:x,overIndex:k,useDragOverlay:E,strategy:O}=a(ao),S=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,b),C=v.indexOf(s),_=d((()=>({sortable:{containerId:m,index:C,items:v},...o})),[m,o,C,v]),D=d((()=>v.slice(v.indexOf(s))),[v,s]),{rect:j,node:R,isOver:A,setNodeRef:P}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=on(Jr),{active:s,dispatch:d,over:f,measureDroppableContainers:p}=a(zr),h=l({disabled:n}),g=l(!1),v=l(null),m=l(null),{disabled:y,updateMeasurementsFor:b,timeout:w}={...Gr,...o},x=Qt(null!=b?b:r),k=Cr({callback:u((()=>{g.current?(null!=m.current&&clearTimeout(m.current),m.current=setTimeout((()=>{p(Array.isArray(x.current)?x.current:[x.current]),m.current=null}),w)):g.current=!0}),[w]),disabled:y||!s}),E=u(((e,t)=>{k&&(t&&(k.unobserve(t),g.current=!1),e&&k.observe(e))}),[k]),[O,S]=tn(E),C=Qt(t);return c((()=>{k&&O.current&&(k.disconnect(),g.current=!1,k.observe(O.current))}),[O,k]),Jt((()=>(d({type:xn.RegisterDroppable,element:{id:r,key:i,disabled:n,node:O,rect:v,data:C}}),()=>d({type:xn.UnregisterDroppable,key:i,id:r}))),[r]),c((()=>{n!==h.current.disabled&&(d({type:xn.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)}),[r,i,n,d]),{active:s,rect:v,isOver:(null==f?void 0:f.id)===r,node:O,over:f,setNodeRef:S}}({id:s,data:_,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...h}}),{active:B,activatorEvent:T,activeNodeRect:N,attributes:M,setNodeRef:L,listeners:I,isDragging:z,over:F,setActivatorNodeRef:H,transform:V}=Zr({id:s,data:_,attributes:{...ho,...n},disabled:S.draggable}),$=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d((()=>e=>{t.forEach((t=>t(e)))}),t)}(P,L),U=Boolean(B),K=U&&!w&&to(y)&&to(k),W=!E&&z,Y=W&&K?V:null,X=K?null!=Y?Y:(null!=p?p:O)({rects:x,activeNodeRect:N,activeIndex:y,overIndex:k,index:C}):null,q=to(y)&&to(k)?i({id:s,items:v,activeIndex:y,overIndex:k}):C,Z=null==B?void 0:B.id,J=l({activeId:Z,items:v,newIndex:q,containerId:m}),G=v!==J.current.items,Q=t({active:B,containerId:m,isDragging:z,isSorting:U,id:s,index:C,items:v,newIndex:J.current.newIndex,previousItems:J.current.items,previousContainerId:J.current.containerId,transition:g,wasDragging:null!=J.current.activeId}),ee=function(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=f(null),s=l(n);return Jt((()=>{if(!t&&n!==s.current&&r.current){const e=o.current;if(e){const t=In(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&a(n)}}n!==s.current&&(s.current=n)}),[t,n,r,o]),c((()=>{i&&a(null)}),[i]),i}({disabled:!Q,index:C,node:R,rect:j});return c((()=>{U&&J.current.newIndex!==q&&(J.current.newIndex=q),m!==J.current.containerId&&(J.current.containerId=m),v!==J.current.items&&(J.current.items=v)}),[U,q,m,v]),c((()=>{if(Z===J.current.activeId)return;if(Z&&!J.current.activeId)return void(J.current.activeId=Z);const e=setTimeout((()=>{J.current.activeId=Z}),50);return()=>clearTimeout(e)}),[Z]),{active:B,activeIndex:y,attributes:M,data:_,rect:j,index:C,newIndex:q,items:v,isOver:A,isSorting:U,isDragging:z,listeners:I,node:R,overIndex:k,over:F,setNodeRef:$,setActivatorNodeRef:H,setDroppableNodeRef:P,setDraggableNodeRef:L,transform:null!=ee?ee:X,transition:function(){if(ee||G&&J.current.newIndex===C)return po;if(W&&!cn(T)||!g)return;if(U||Q)return un.Transition.toString({...g,property:fo});return}()}}function vo(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const mo=[or.Down,or.Right,or.Up,or.Left],yo=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(mo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[];i.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return;const i=o.get(n.id);if(i)switch(e.code){case or.Down:r.top<i.top&&t.push(n);break;case or.Up:r.top>i.top&&t.push(n);break;case or.Left:r.left>i.left&&t.push(n);break;case or.Right:r.left<i.left&&t.push(n)}}));const s=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Dn(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=Dn(r),a=o.reduce(((e,t,r)=>e+Sn(n[r],t)),0),l=Number((a/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:l}})}}return i.sort(Cn)})({active:n,collisionRect:r,droppableRects:o,droppableContainers:t,pointerCoordinates:null});let c=jn(s,"id");if(c===(null==a?void 0:a.id)&&s.length>1&&(c=s[1].id),null!=c){const e=i.get(n.id),t=i.get(c),a=t?o.get(t.id):null,s=null==t?void 0:t.node.current;if(s&&a&&e&&t){const n=Fn(s).some(((e,t)=>l[t]!==e)),o=bo(e,t),i=function(e,t){if(!vo(e)||!vo(t))return!1;if(!bo(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!o?{x:0,y:0}:{x:i?r.width-a.width:0,y:i?r.height-a.height:0},d={x:a.left,y:a.top};return c.x&&c.y?d:sn(d,c)}}}};function bo(e,t){return!(!vo(e)||!vo(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}var wo;function xo(){return xo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xo.apply(this,arguments)}var ko,Eo=function(e){return r.createElement("svg",xo({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),wo||(wo=r.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function Oo(){return Oo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Oo.apply(this,arguments)}var So=function(e){return r.createElement("svg",Oo({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),ko||(ko=r.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))};function Co(e){return jo(e)?(e.nodeName||"").toLowerCase():"#document"}function _o(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Do(e){var t;return null==(t=(jo(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function jo(e){return e instanceof Node||e instanceof _o(e).Node}function Ro(e){return e instanceof Element||e instanceof _o(e).Element}function Ao(e){return e instanceof HTMLElement||e instanceof _o(e).HTMLElement}function Po(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof _o(e).ShadowRoot)}function Bo(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Io(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function To(e){return["table","td","th"].includes(Co(e))}function No(e){const t=Mo(),n=Io(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 Mo(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Lo(e){return["html","body","#document"].includes(Co(e))}function Io(e){return _o(e).getComputedStyle(e)}function zo(e){return Ro(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Fo(e){if("html"===Co(e))return e;const t=e.assignedSlot||e.parentNode||Po(e)&&e.host||Do(e);return Po(t)?t.host:t}function Ho(e){const t=Fo(e);return Lo(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ao(t)&&Bo(t)?t:Ho(t)}function Vo(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Ho(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=_o(o);return i?t.concat(a,a.visualViewport||[],Bo(o)?o:[],a.frameElement&&n?Vo(a.frameElement):[]):t.concat(o,Vo(o,[],n))}const $o=Math.min,Uo=Math.max,Ko=Math.round,Wo=Math.floor,Yo=e=>({x:e,y:e}),Xo={left:"right",right:"left",bottom:"top",top:"bottom"},qo={start:"end",end:"start"};function Zo(e,t,n){return Uo(e,$o(t,n))}function Jo(e,t){return"function"==typeof e?e(t):e}function Go(e){return e.split("-")[0]}function Qo(e){return e.split("-")[1]}function ei(e){return"x"===e?"y":"x"}function ti(e){return"y"===e?"height":"width"}function ni(e){return["top","bottom"].includes(Go(e))?"y":"x"}function ri(e){return ei(ni(e))}function oi(e){return e.replace(/start|end/g,(e=>qo[e]))}function ii(e){return e.replace(/left|right|bottom|top/g,(e=>Xo[e]))}function ai(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 li(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function si(e,t,n){let{reference:r,floating:o}=e;const i=ni(t),a=ri(t),l=ti(a),s=Go(t),c="y"===i,d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let p;switch(s){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(Qo(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function ci(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Jo(t,e),h=ai(p),g=l[f?"floating"===u?"reference":"floating":u],v=li(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(l.floating)),boundary:c,rootBoundary:d,strategy:s})),m="floating"===u?{...a.floating,x:r,y:o}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},w=li(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:m,offsetParent:y,strategy:s}):m);return{top:(v.top-w.top+h.top)/b.y,bottom:(w.bottom-v.bottom+h.bottom)/b.y,left:(v.left-w.left+h.left)/b.x,right:(w.right-v.right+h.right)/b.x}}function di(e){const t=$o(...e.map((e=>e.left))),n=$o(...e.map((e=>e.top)));return{x:t,y:n,width:Uo(...e.map((e=>e.right)))-t,height:Uo(...e.map((e=>e.bottom)))-n}}const ui=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:l}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=Go(n),l=Qo(n),s="y"===ni(n),c=["left","top"].includes(a)?-1:1,d=i&&s?-1:1,u=Jo(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return l&&"number"==typeof h&&(p="end"===l?-1*h:h),s?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return a===(null==(n=l.offset)?void 0:n.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:a}}}}};function fi(e){const t=Io(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ao(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=Ko(n)!==i||Ko(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function pi(e){return Ro(e)?e:e.contextElement}function hi(e){const t=pi(e);if(!Ao(t))return Yo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=fi(t);let a=(i?Ko(n.width):n.width)/r,l=(i?Ko(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),l&&Number.isFinite(l)||(l=1),{x:a,y:l}}const gi=Yo(0);function vi(e){const t=_o(e);return Mo()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:gi}function mi(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=pi(e);let a=Yo(1);t&&(r?Ro(r)&&(a=hi(r)):a=hi(e));const l=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==_o(e))&&t}(i,n,r)?vi(i):Yo(0);let s=(o.left+l.x)/a.x,c=(o.top+l.y)/a.y,d=o.width/a.x,u=o.height/a.y;if(i){const e=_o(i),t=r&&Ro(r)?_o(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=hi(o),t=o.getBoundingClientRect(),r=Io(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,c*=e.y,d*=e.x,u*=e.y,s+=i,c+=a,n=_o(o),o=n.frameElement}}return li({width:d,height:u,x:s,y:c})}const yi=[":popover-open",":modal"];function bi(e){return yi.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function wi(e){return mi(Do(e)).left+zo(e).scrollLeft}function xi(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=_o(e),r=Do(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=Mo();(!e||e&&"fixed"===t)&&(l=o.offsetLeft,s=o.offsetTop)}return{width:i,height:a,x:l,y:s}}(e,n);else if("document"===t)r=function(e){const t=Do(e),n=zo(e),r=e.ownerDocument.body,o=Uo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Uo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+wi(e);const l=-n.scrollTop;return"rtl"===Io(r).direction&&(a+=Uo(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}(Do(e));else if(Ro(t))r=function(e,t){const n=mi(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ao(e)?hi(e):Yo(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=vi(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return li(r)}function ki(e,t){const n=Fo(e);return!(n===t||!Ro(n)||Lo(n))&&("fixed"===Io(n).position||ki(n,t))}function Ei(e,t,n){const r=Ao(t),o=Do(t),i="fixed"===n,a=mi(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const s=Yo(0);if(r||!r&&!i)if(("body"!==Co(t)||Bo(o))&&(l=zo(t)),r){const e=mi(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=wi(o));return{x:a.left+l.scrollLeft-s.x,y:a.top+l.scrollTop-s.y,width:a.width,height:a.height}}function Oi(e,t){return Ao(e)&&"fixed"!==Io(e).position?t?t(e):e.offsetParent:null}function Si(e,t){const n=_o(e);if(!Ao(e)||bi(e))return n;let r=Oi(e,t);for(;r&&To(r)&&"static"===Io(r).position;)r=Oi(r,t);return r&&("html"===Co(r)||"body"===Co(r)&&"static"===Io(r).position&&!No(r))?n:r||function(e){let t=Fo(e);for(;Ao(t)&&!Lo(t);){if(No(t))return t;t=Fo(t)}return null}(e)||n}const Ci={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Do(r),l=!!t&&bi(t.floating);if(r===a||l&&i)return n;let s={scrollLeft:0,scrollTop:0},c=Yo(1);const d=Yo(0),u=Ao(r);if((u||!u&&!i)&&(("body"!==Co(r)||Bo(a))&&(s=zo(r)),Ao(r))){const e=mi(r);c=hi(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+d.x,y:n.y*c.y-s.scrollTop*c.y+d.y}},getDocumentElement:Do,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=Vo(e,[],!1).filter((e=>Ro(e)&&"body"!==Co(e))),o=null;const i="fixed"===Io(e).position;let a=i?Fo(e):e;for(;Ro(a)&&!Lo(a);){const t=Io(a),n=No(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Bo(a)&&!n&&ki(e,a))?r=r.filter((e=>e!==a)):o=t,a=Fo(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],l=i.reduce(((e,n)=>{const r=xi(t,n,o);return e.top=Uo(r.top,e.top),e.right=$o(r.right,e.right),e.bottom=$o(r.bottom,e.bottom),e.left=Uo(r.left,e.left),e}),xi(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:Si,getElementRects:async function(e){const t=this.getOffsetParent||Si,n=this.getDimensions;return{reference:Ei(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}=fi(e);return{width:t,height:n}},getScale:hi,isElement:Ro,isRTL:function(e){return"rtl"===Io(e).direction}};function _i(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,c=pi(e),d=o||i?[...c?Vo(c):[],...Vo(t)]:[];d.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=c&&l?function(e,t){let n,r=null;const o=Do(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(l,s){void 0===l&&(l=!1),void 0===s&&(s=1),i();const{left:c,top:d,width:u,height:f}=e.getBoundingClientRect();if(l||t(),!u||!f)return;const p={rootMargin:-Wo(d)+"px "+-Wo(o.clientWidth-(c+u))+"px "+-Wo(o.clientHeight-(d+f))+"px "+-Wo(c)+"px",threshold:Uo(0,$o(1,s))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==s){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),100)}h=!1}try{r=new IntersectionObserver(g,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,p)}r.observe(e)}(!0),i}(c,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!s&&h.observe(c),h.observe(t));let g=s?mi(e):null;return s&&function t(){const r=mi(e);!g||r.x===g.x&&r.y===g.y&&r.width===g.width&&r.height===g.height||n();g=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==u||u(),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(f)}}const Di=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=Jo(e,t),c={x:n,y:r},d=await ci(t,s),u=ni(Go(o)),f=ei(u);let p=c[f],h=c[u];if(i){const e="y"===f?"bottom":"right";p=Zo(p+d["y"===f?"top":"left"],p,p-d[e])}if(a){const e="y"===u?"bottom":"right";h=Zo(h+d["y"===u?"top":"left"],h,h-d[e])}const g=l.fn({...t,[f]:p,[u]:h});return{...g,data:{x:g.x-n,y:g.y-r}}}}},ji=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:s,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...v}=Jo(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const m=Go(o),y=Go(l)===l,b=await(null==s.isRTL?void 0:s.isRTL(c.floating)),w=f||(y||!g?[ii(l)]:function(e){const t=ii(e);return[oi(e),t,oi(t)]}(l));f||"none"===h||w.push(...function(e,t,n,r){const o=Qo(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(Go(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(oi)))),i}(l,g,h,b));const x=[l,...w],k=await ci(t,v),E=[];let O=(null==(r=i.flip)?void 0:r.overflows)||[];if(d&&E.push(k[m]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=Qo(e),o=ri(e),i=ti(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=ii(a)),[a,ii(a)]}(o,a,b);E.push(k[e[0]],k[e[1]])}if(O=[...O,{placement:o,overflows:E}],!E.every((e=>e<=0))){var S,C;const e=((null==(S=i.flip)?void 0:S.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:O},reset:{placement:t}};let n=null==(C=O.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:C.placement;if(!n)switch(p){case"bestFit":{var _;const e=null==(_=O.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:_[0];e&&(n=e);break}case"initialPlacement":n=l}if(o!==n)return{reset:{placement:n}}}return{}}}},Ri=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:l=2,x:s,y:c}=Jo(e,t),d=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=>li(di(e))))}(d),f=li(di(d)),p=ai(l);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=s&&null!=c)return u.find((e=>s>e.left-p.left&&s<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom))||f;if(u.length>=2){if("y"===ni(n)){const e=u[0],t=u[u.length-1],r="top"===Go(n),o=e.top,i=t.bottom,a=r?e.left:t.left,l=r?e.right:t.right;return{top:o,bottom:i,left:a,right:l,width:l-a,height:i-o,x:a,y:o}}const e="left"===Go(n),t=Uo(...u.map((e=>e.right))),r=$o(...u.map((e=>e.left))),o=u.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return f}},floating:r.floating,strategy:a});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Ai=(e,t,n)=>{const r=new Map,o={platform:Ci,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),s=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=si(c,r,s),f=r,p={},h=0;for(let n=0;n<l.length;n++){const{name:i,fn:g}=l[n],{x:v,y:m,data:y,reset:b}=await g({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=v?v:d,u=null!=m?m:u,p={...p,[i]:{...p[i],...y}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:d,y:u}=si(c,f,s))),n=-1)}return{x:d,y:u,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Pi="undefined"!=typeof document?s:c;function Bi(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(!Bi(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)&&!Bi(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ti(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ni(e,t){const n=Ti(e);return Math.round(t*n)/n}function Mi(e){const t=r.useRef(e);return Pi((()=>{t.current=e})),t}
|
|
2
2
|
/*!
|
|
3
3
|
* tabbable 6.2.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
5
|
*/
|
|
6
|
-
var Li=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),Ii="undefined"==typeof Element,zi=Ii?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Fi=!Ii&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Hi=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},Vi=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var a=i.shift();if(!Hi(a,!1))if("SLOT"===a.tagName){var l=a.assignedElements(),s=e(l.length?l:a.children,!0,r);r.flatten?o.push.apply(o,s):o.push({scopeParent:a,candidates:s})}else{zi.call(a,Li)&&r.filter(a)&&(n||!t.includes(a))&&o.push(a);var c=a.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(a),d=!Hi(c,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(c&&d){var u=e(!0===c?a.children:c.children,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return o},$i=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Ui=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!$i(e)?0:e.tabIndex},Ki=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Wi=function(e){return"INPUT"===e.tagName},Yi=function(e){return function(e){return Wi(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Fi(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},Xi=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},qi=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=zi.call(e,"details>summary:first-of-type")?e.parentElement:e;if(zi.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Xi(e)}else{if("function"==typeof r){for(var i=e;e;){var a=e.parentElement,l=Fi(e);if(a&&!a.shadowRoot&&!0===r(a))return Xi(e);e=e.assignedSlot?e.assignedSlot:a||l===e.ownerDocument?a:l.host}e=i}if(function(e){var t,n,r,o,i=e&&Fi(e),a=null===(t=i)||void 0===t?void 0:t.host,l=!1;if(i&&i!==e)for(l=!!(null!==(n=a)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(a)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!l&&a;){var s,c,d;l=!(null===(c=a=null===(s=i=Fi(a))||void 0===s?void 0:s.host)||void 0===c||null===(d=c.ownerDocument)||void 0===d||!d.contains(a))}return l}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Zi=function(e,t){return!(t.disabled||Hi(t)||function(e){return Wi(e)&&"hidden"===e.type}(t)||qi(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!zi.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Ji=function(e,t){return!(Yi(t)||Ui(t)<0||!Zi(e,t))},Gi=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Qi=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,a=i?t.scopeParent:t,l=function(e,t){var n=Ui(e);return n<0&&t&&!$i(e)?0:n}(a,i),s=i?e(t.candidates):a;0===l?i?n.push.apply(n,s):n.push(a):r.push({documentOrder:o,tabIndex:l,item:t,isScope:i,content:s})})),r.sort(Ki).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ea=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Vi([e],t.includeContainer,{filter:Ji.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Gi}):function(e,t,n){if(Hi(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Li));return t&&zi.call(e,Li)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Ji.bind(null,t)),Qi(n)};const ta=r["useInsertionEffect".toString()]||(e=>e());var na="undefined"!=typeof document?s:c;function ra(){return ra=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ra.apply(this,arguments)}let oa=!1,ia=0;const aa=()=>"floating-ui-"+ia++;const la=r["useId".toString()]||function(){const[e,t]=r.useState((()=>oa?aa():void 0));return na((()=>{null==e&&t(aa())}),[]),r.useEffect((()=>{oa||(oa=!0)}),[]),e};const sa=r.createContext(null),ca=r.createContext(null);function da(e){return"data-floating-ui-"+e}function ua(e){const t=l(e);return na((()=>{t.current=e})),t}const fa=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function pa(e,t){const n=ea(e,fa());"prev"===t&&n.reverse();const r=n.indexOf(function(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}((null==(o=e)?void 0:o.ownerDocument)||document));var o;return n.slice(r+1)[0]}function ha(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!function(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Po(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,r)}function ga(e){ea(e,fa()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function va(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ma={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ya(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const ba=r.forwardRef((function(e,t){const[n,o]=r.useState();na((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",ya),()=>{document.removeEventListener("keydown",ya)})),[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[da("focus-guard")]:"",style:ma};return r.createElement("span",ra({},e,i))})),wa=r.createContext(null),xa=da("portal");function ka(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const a=function(e){let{id:t,root:n}=void 0===e?{}:e;const[o,i]=r.useState(null),a=la(),l=Ea(),s=r.useRef(null);return na((()=>()=>{null==o||o.remove(),queueMicrotask((()=>{s.current=null}))}),[o]),na((()=>{if(s.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=a,n.setAttribute(xa,""),e.appendChild(n),s.current=n,i(n)}),[t,a]),na((()=>{if(s.current)return;let e=n||(null==l?void 0:l.portalNode);e&&!Ro(e)&&(e=e.current),e=e||document.body;let r=null;t&&(r=document.createElement("div"),r.id=t,e.appendChild(r));const o=document.createElement("div");o.id=a,o.setAttribute(xa,""),e=r||e,e.appendChild(o),s.current=o,i(o)}),[t,n,a,l]),o}({id:n,root:o}),[l,s]=r.useState(null),c=r.useRef(null),d=r.useRef(null),u=r.useRef(null),f=r.useRef(null),p=!!l&&!l.modal&&l.open&&i&&!(!o&&!a);return r.useEffect((()=>{if(a&&i&&(null==l||!l.modal))return a.addEventListener("focusin",e,!0),a.addEventListener("focusout",e,!0),()=>{a.removeEventListener("focusin",e,!0),a.removeEventListener("focusout",e,!0)};function e(e){if(a&&ha(e)){("focusin"===e.type?va:ga)(a)}}}),[a,i,null==l?void 0:l.modal]),r.createElement(wa.Provider,{value:r.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:f,portalNode:a,setFocusManagerState:s})),[i,a])},p&&a&&r.createElement(ba,{"data-type":"outside",ref:c,onFocus:e=>{if(ha(e,a)){var t;null==(t=u.current)||t.focus()}else{const e=pa(document.body,"prev")||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),p&&a&&r.createElement("span",{"aria-owns":a.id,style:ma}),a&&N(t,a),p&&a&&r.createElement(ba,{"data-type":"outside",ref:d,onFocus:e=>{if(ha(e,a)){var t;null==(t=f.current)||t.focus()}else{const t=pa(document.body,"next")||(null==l?void 0:l.refs.domReference.current);null==t||t.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,e.nativeEvent))}}}))}const Ea=()=>r.useContext(wa),Oa=new Set,Sa=r.forwardRef((function(e,t){let{lockScroll:n=!1,...o}=e;const i=la();return na((()=>{if(!n)return;Oa.add(i);const e=/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()),t=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,a=t.left?parseFloat(t.left):window.pageXOffset,l=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",o&&(t[r]=o+"px"),e){var s,c;const e=(null==(s=window.visualViewport)?void 0:s.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(l-Math.floor(n))+"px",left:-(a-Math.floor(e))+"px",right:"0"})}return()=>{Oa.delete(i),0===Oa.size&&(Object.assign(t,{overflow:"",[r]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(a,l)))}}),[i,n]),r.createElement("div",ra({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function Ca(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:o,nodeId:i}=e,[a,l]=r.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||a,c=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:l}={},transform:s=!0,whileElementsMounted:c,open:d}=e,[u,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=r.useState(o);Bi(p,o)||h(o);const[g,v]=r.useState(null),[m,y]=r.useState(null),b=r.useCallback((e=>{e!==E.current&&(E.current=e,v(e))}),[]),w=r.useCallback((e=>{e!==O.current&&(O.current=e,y(e))}),[]),x=a||g,k=l||m,E=r.useRef(null),O=r.useRef(null),S=r.useRef(u),C=null!=c,_=Mi(c),D=Mi(i),j=r.useCallback((()=>{if(!E.current||!O.current)return;const e={placement:t,strategy:n,middleware:p};D.current&&(e.platform=D.current),Ai(E.current,O.current,e).then((e=>{const t={...e,isPositioned:!0};R.current&&!Bi(S.current,t)&&(S.current=t,B.flushSync((()=>{f(t)})))}))}),[p,t,n,D]);Pi((()=>{!1===d&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const R=r.useRef(!1);Pi((()=>(R.current=!0,()=>{R.current=!1})),[]),Pi((()=>{if(x&&(E.current=x),k&&(O.current=k),x&&k){if(_.current)return _.current(x,k,j);j()}}),[x,k,j,_,C]);const A=r.useMemo((()=>({reference:E,floating:O,setReference:b,setFloating:w})),[b,w]),P=r.useMemo((()=>({reference:x,floating:k})),[x,k]),T=r.useMemo((()=>{const e={position:n,left:0,top:0};if(!P.floating)return e;const t=Ni(P.floating,u.x),r=Ni(P.floating,u.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...Ti(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,s,P.floating,u.x,u.y]);return r.useMemo((()=>({...u,update:j,refs:A,elements:P,floatingStyles:T})),[u,j,A,P,T])}(e),d=r.useContext(ca),u=null!=((null==(f=r.useContext(sa))?void 0:f.id)||null);var f;const p=function(e){const t=r.useRef((()=>{}));return ta((()=>{t.current=e})),r.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),v.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==o||o(e,t,n)})),h=r.useRef(null),g=r.useRef({}),v=r.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=la(),y=r.useCallback((e=>{const t=Ro(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c.refs.setReference(t)}),[c.refs]),b=r.useCallback((e=>{(Ro(e)||null===e)&&(h.current=e,l(e)),(Ro(c.refs.reference.current)||null===c.refs.reference.current||null!==e&&!Ro(e))&&c.refs.setReference(e)}),[c.refs]),w=r.useMemo((()=>({...c.refs,setReference:b,setPositionReference:y,domReference:h})),[c.refs,b,y]),x=r.useMemo((()=>({...c.elements,domReference:s})),[c.elements,s]),k=r.useMemo((()=>({...c,refs:w,elements:x,dataRef:g,nodeId:i,floatingId:m,events:v,open:n,onOpenChange:p})),[c,i,m,v,n,p,w,x]);return na((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===i));e&&(e.context=k)})),r.useMemo((()=>({...c,context:k,refs:w,elements:x})),[c,w,x,k])}const _a=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Da(e,t){return"function"==typeof e?e(t):e}function ja(e,t){void 0===t&&(t={});const{open:n,elements:{floating:o}}=e,{duration:i=250}=t,a=("number"==typeof i?i:i.close)||0,[l,s]=r.useState(!1),[c,d]=r.useState("unmounted"),u=function(e,t){const[n,o]=r.useState(e);return e&&!n&&o(!0),r.useEffect((()=>{if(!e){const e=setTimeout((()=>o(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,a);return na((()=>{l&&!u&&d("unmounted")}),[l,u]),na((()=>{if(o){if(n){d("initial");const e=requestAnimationFrame((()=>{d("open")}));return()=>{cancelAnimationFrame(e)}}s(!0),d("close")}}),[n,o]),{isMounted:u,status:c}}function Ra(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:o,close:i,common:a,duration:l=250}=t,s=e.placement,c=s.split("-")[0],d=r.useMemo((()=>({side:c,placement:s})),[c,s]),u="number"==typeof l,f=(u?l:l.open)||0,p=(u?l:l.close)||0,[h,g]=r.useState((()=>({...Da(a,d),...Da(n,d)}))),{isMounted:v,status:m}=ja(e,{duration:l}),y=ua(n),b=ua(o),w=ua(i),x=ua(a);return na((()=>{const e=Da(y.current,d),t=Da(w.current,d),n=Da(x.current,d),r=Da(b.current,d)||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(_a).join(","),transitionDuration:f+"ms",...n,...r}),"close"===m){const r=t||e;g({transitionProperty:Object.keys(r).map(_a).join(","),transitionDuration:p+"ms",...n,...r})}}),[p,w,y,b,x,f,m,d]),{isMounted:v,styles:h}}var Aa;function Pa(){return Pa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pa.apply(this,arguments)}var Ba=function(e){return r.createElement("svg",Pa({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Aa||(Aa=r.createElement("path",{d:"M5.804 3.123c.006.38.254.622.673.622h4.887c.59 0 .914.305.914.92v6.628l-.901-.978-.514-.514c-.267-.254-.629-.273-.895-.013-.254.26-.248.635.012.895l2.165 2.158c.476.47 1.022.47 1.498 0l2.165-2.158c.26-.26.266-.635.012-.895-.266-.26-.628-.241-.895.013l-.514.514-.895.971V4.564c0-1.358-.71-2.063-2.082-2.063H6.477c-.42 0-.68.241-.673.622ZM.186 7.06c.26.266.622.247.889-.013l.52-.508.889-.971v6.722c0 1.359.71 2.063 2.082 2.063h4.957c.42 0 .68-.241.673-.622-.006-.387-.254-.622-.673-.622h-4.88c-.591 0-.915-.311-.915-.927V5.554l.895.984.52.508c.26.26.629.28.89.013.26-.26.253-.629-.013-.89L3.855 4.013c-.476-.476-1.016-.476-1.492 0L.2 6.17c-.267.26-.273.628-.013.889Z"})))};function Ta(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}var Na=["color"],Ma=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Ta(e,Na);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M1 9.50006C1 10.3285 1.67157 11.0001 2.5 11.0001H4L4 10.0001H2.5C2.22386 10.0001 2 9.7762 2 9.50006L2 2.50006C2 2.22392 2.22386 2.00006 2.5 2.00006L9.5 2.00006C9.77614 2.00006 10 2.22392 10 2.50006V4.00002H5.5C4.67158 4.00002 4 4.67159 4 5.50002V12.5C4 13.3284 4.67158 14 5.5 14H12.5C13.3284 14 14 13.3284 14 12.5V5.50002C14 4.67159 13.3284 4.00002 12.5 4.00002H11V2.50006C11 1.67163 10.3284 1.00006 9.5 1.00006H2.5C1.67157 1.00006 1 1.67163 1 2.50006V9.50006ZM5 5.50002C5 5.22388 5.22386 5.00002 5.5 5.00002H12.5C12.7761 5.00002 13 5.22388 13 5.50002V12.5C13 12.7762 12.7761 13 12.5 13H5.5C5.22386 13 5 12.7762 5 12.5V5.50002Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),La=["color"],Ia=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Ta(e,La);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),za=["color"],Fa=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Ta(e,za);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M8.51194 3.00541C9.18829 2.54594 10.0435 2.53694 10.6788 2.95419C10.8231 3.04893 10.9771 3.1993 11.389 3.61119C11.8009 4.02307 11.9513 4.17714 12.046 4.32141C12.4633 4.95675 12.4543 5.81192 11.9948 6.48827C11.8899 6.64264 11.7276 6.80811 11.3006 7.23511L10.6819 7.85383C10.4867 8.04909 10.4867 8.36567 10.6819 8.56093C10.8772 8.7562 11.1938 8.7562 11.389 8.56093L12.0077 7.94221L12.0507 7.89929C12.4203 7.52976 12.6568 7.2933 12.822 7.0502C13.4972 6.05623 13.5321 4.76252 12.8819 3.77248C12.7233 3.53102 12.4922 3.30001 12.1408 2.94871L12.0961 2.90408L12.0515 2.85942C11.7002 2.508 11.4692 2.27689 11.2277 2.11832C10.2377 1.46813 8.94398 1.50299 7.95001 2.17822C7.70691 2.34336 7.47044 2.57991 7.1009 2.94955L7.058 2.99247L6.43928 3.61119C6.24401 3.80645 6.24401 4.12303 6.43928 4.31829C6.63454 4.51355 6.95112 4.51355 7.14638 4.31829L7.7651 3.69957C8.1921 3.27257 8.35757 3.11027 8.51194 3.00541ZM4.31796 7.14672C4.51322 6.95146 4.51322 6.63487 4.31796 6.43961C4.12269 6.24435 3.80611 6.24435 3.61085 6.43961L2.99213 7.05833L2.94922 7.10124C2.57957 7.47077 2.34303 7.70724 2.17788 7.95035C1.50265 8.94432 1.4678 10.238 2.11799 11.2281C2.27656 11.4695 2.50766 11.7005 2.8591 12.0518L2.90374 12.0965L2.94837 12.1411C3.29967 12.4925 3.53068 12.7237 3.77214 12.8822C4.76219 13.5324 6.05589 13.4976 7.04986 12.8223C7.29296 12.6572 7.52943 12.4206 7.89896 12.051L7.89897 12.051L7.94188 12.0081L8.5606 11.3894C8.75586 11.1941 8.75586 10.8775 8.5606 10.6823C8.36533 10.487 8.04875 10.487 7.85349 10.6823L7.23477 11.301C6.80777 11.728 6.6423 11.8903 6.48794 11.9951C5.81158 12.4546 4.95642 12.4636 4.32107 12.0464C4.17681 11.9516 4.02274 11.8012 3.61085 11.3894C3.19896 10.9775 3.0486 10.8234 2.95385 10.6791C2.53661 10.0438 2.54561 9.18863 3.00507 8.51227C3.10993 8.35791 3.27224 8.19244 3.69924 7.76544L4.31796 7.14672ZM9.62172 6.08558C9.81698 5.89032 9.81698 5.57373 9.62172 5.37847C9.42646 5.18321 9.10988 5.18321 8.91461 5.37847L5.37908 8.91401C5.18382 9.10927 5.18382 9.42585 5.37908 9.62111C5.57434 9.81637 5.89092 9.81637 6.08619 9.62111L9.62172 6.08558Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),Ha=["color"],Va=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Ta(e,Ha);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),$a=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},Ua={"text/plain":"Text","text/html":"Url",default:"Text"};var Ka=function(e,t){var n,r,o,i,a,l,s=!1;t||(t={}),n=t.debug||!1;try{if(o=$a(),i=document.createRange(),a=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=Ua[t.format]||Ua.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(l),i.selectNodeContents(l),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),o()}return s};const Wa=i(void 0),Ya=({children:r,tools:o})=>{const i=It(),a=d((()=>o?Object.keys(o).reduce(((e,t)=>{var n;return Object.assign(Object.assign({},e),{[t]:null===(n=o[t])||void 0===n?void 0:n.render})}),{}):{}),[o]),l=d((()=>!o||i?null:Object.keys(o).map((t=>{var n,r,i;const a=null===(n=null==o?void 0:o[t])||void 0===n?void 0:n.tool,l=null===(r=null==o?void 0:o[t])||void 0===r?void 0:r.render,s=null===(i=null==o?void 0:o[t])||void 0===i?void 0:i.props;return a?e(a,Object.assign({render:l},s),t):null}))),[o]);return e(Wa.Provider,Object.assign({value:a},{children:t(n,{children:[l,r]})}))},Xa=()=>{const e=a(Wa);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e};function qa({editor:e,view:t,onClose:n,mode:r="toggle"}){return{actions:(()=>{let t=Object.keys(e.blocks);return"toggle"===r&&(t=t.filter((t=>function(e,t){var n;const r=e.blocks[t];if(!r)return!1;const o=V(r.elements);return"void"!==(null===(n=null==o?void 0:o.props)||void 0===n?void 0:n.nodeType)}(e,t)))),t.map((t=>{var n,r,o,i,a,l;return{type:t,title:(null===(r=null===(n=e.blocks[t].options)||void 0===n?void 0:n.display)||void 0===r?void 0:r.title)||t,description:null===(i=null===(o=e.blocks[t].options)||void 0===o?void 0:o.display)||void 0===i?void 0:i.description,icon:null===(l=null===(a=e.blocks[t].options)||void 0===a?void 0:a.display)||void 0===l?void 0:l.icon}}))})(),onClose:n,empty:!1,getItemProps:t=>({onMouseEnter:()=>{},"data-action-menu-item":!0,"data-action-menu-item-type":t,"aria-selected":!1,onClick:()=>{e.toggleBlock(t,{deleteText:"toggle"===r,focus:!0}),n()}}),getRootProps:()=>({"data-action-menu-list":!0}),editor:e,view:t}}const Za=t=>{var{className:n,children:r,lockScroll:o=!0}=t,i=ue(t,["className","children","lockScroll"]);return e(Sa,Object.assign({lockScroll:o,className:n},i,{onClick:e=>{var t;e.stopPropagation(),null===(t=i.onClick)||void 0===t||t.call(i,e)},onMouseDown:e=>{var t;e.stopPropagation(),null===(t=i.onMouseDown)||void 0===t||t.call(i,e)}},{children:r}))},Ja=t=>{const[n,r]=f(!1),o=l(null),i=Nt();return c((()=>{r(!0);const e=i.refElement;if(!e)return;return e.querySelector(".yoopta-overlays")||(o.current=document.createElement("div"),o.current.className="yoopta-overlays",e.appendChild(o.current)),()=>{o.current&&o.current.remove()}}),[]),n?e(ka,Object.assign({id:`${t.id}-${i.id}`,root:o.current||i.refElement},{children:t.children})):null},Ga=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-group"},{children:t})),Qa=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"yoopta-block-options-menu-content data-[state=open]:yoo-editor-animate-in data-[state=closed]:yoo-editor-animate-out data-[state=closed]:yoo-editor-fade-out-0 data-[state=open]:yoo-editor-fade-in-0 data-[state=closed]:yoo-editor-zoom-out-95 data-[state=open]:yoo-editor-zoom-in-95 data-[side=bottom]:yoo-editor-slide-in-from-top-2 data-[side=left]:yoo-editor-slide-in-from-right-2 data-[side=right]:yoo-editor-slide-in-from-left-2 data-[side=top]:yoo-editor-slide-in-from-bottom-2"},{children:t})),el=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-item"},{children:t})),tl=["delete","duplicate","turnInto","copy"],nl=({isOpen:n,onClose:r,refs:o,style:i,actions:a=tl,children:l})=>{var s,c,d;const u=Nt(),p=Xa(),[h,g]=f(!1),{refs:v,floatingStyles:m,context:y}=Ca({placement:"right",open:h,onOpenChange:g,middleware:[Ri(),ji(),Di(),ui(10)],whileElementsMounted:_i}),{isMounted:b,styles:w}=Ra(y,{duration:100});if(!n)return null;const x=ne(u,{at:u.path.current}),k=V(null===(s=u.blocks[(null==x?void 0:x.type)||""])||void 0===s?void 0:s.elements),E="void"===(null===(c=null==k?void 0:k.props)||void 0===c?void 0:c.nodeType),O=p.ActionMenu,S=Object.assign(Object.assign({},m),w),C=qa({editor:u,view:"small",onClose:()=>{g(!1),r()}});return e(Ja,Object.assign({id:"yoo-block-options-portal"},{children:e(Za,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:r},{children:e("div",Object.assign({style:i,ref:o.setFloating,contentEditable:!1},{children:t(Qa,{children:[null!==a&&t(Ga,{children:[e(el,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{u.deleteBlock({at:u.path.current}),u.setPath({current:null}),r()}},{children:[e(Va,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Delete"]}))}),e(el,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{"number"==typeof u.path.current&&(u.duplicateBlock({original:{path:u.path.current},focus:!0}),r())}},{children:[e(Ma,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Duplicate"]}))}),!!O&&!E&&!(null===(d=u.blocks[(null==x?void 0:x.type)||""])||void 0===d?void 0:d.hasCustomEditor)&&t(el,{children:[b&&e(Ja,Object.assign({id:"yoo-block-options-portal"},{children:e(Za,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:()=>g(!1)},{children:e("div",Object.assign({style:S,ref:v.setFloating},{children:e(O,Object.assign({},C))}))}))})),t("button",Object.assign({type:"button",className:"yoopta-block-options-button",ref:v.setReference,onClick:()=>g((e=>!e))},{children:[e(Ba,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Turn into"]}))]}),e(el,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=ne(u);e&&(Ka(`${window.location.origin}${window.location.pathname}#${e.id}`),u.emit("block:copy",e)),r()}},{children:[e(Fa,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Copy link to block"]}))})]}),l]})}))}))}))};var rl=Object.freeze({__proto__:null,BlockOptions:nl,BlockOptionsMenuContent:Qa,BlockOptionsMenuGroup:Ga,BlockOptionsMenuItem:el,BlockOptionsSeparator:({className:t=""})=>e("div",{className:`yoopta-block-options-separator ${t}`})});const ol=({block:n,editor:r,dragHandleProps:o,onChangeActiveBlock:i,showActions:a})=>{const[l,s]=f(!1),{isActionMenuOpen:c,actionMenuRefs:d,hasActionMenu:u,actionMenuStyles:p,onChangeActionMenuOpen:h,onCloseActionMenu:g,actionMenuRenderProps:v,ActionMenu:y}=(({editor:e})=>{const t=Xa().ActionMenu,[n,r]=f(!1),{refs:o,floatingStyles:i,context:a}=Ca({placement:"bottom-start",open:n,onOpenChange:r,middleware:[Ri(),ji(),Di(),ui(10)],whileElementsMounted:_i}),{isMounted:l,styles:s}=Ra(a,{duration:100}),c=Object.assign(Object.assign({},i),s),d=e=>r(e),u=()=>d(!1),p=qa({editor:e,view:"default",mode:"create",onClose:u});return{isActionMenuOpen:l,actionMenuStyles:c,actionMenuRefs:o,hasActionMenu:!!t,onChangeActionMenuOpen:d,actionMenuRenderProps:p,onCloseActionMenu:u,ActionMenu:t}})({editor:r}),{refs:b,floatingStyles:x,context:k}=Ca({placement:"right-start",open:l,onOpenChange:s,middleware:[Ri(),ji(),Di(),ui()]}),{isMounted:E,styles:O}=Ra(k,{duration:100}),{setActivatorNodeRef:S,attributes:C,listeners:D}=o,j=Object.assign(Object.assign({},x),O);return t("div",Object.assign({contentEditable:!1,"data-hovered-state-open":a,className:"yoopta-block-actions"},{children:[c&&u&&e(Ja,Object.assign({id:"yoo-block-options-portal"},{children:e(Za,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:g},{children:e("div",Object.assign({style:p,ref:d.setFloating},{children:e(y,Object.assign({},v))}))}))})),e("button",Object.assign({type:"button",onClick:()=>{var e;const t=re(r,{at:n.meta.order}),o=r.blocks[n.type];if(!t)return;const i=document.querySelector(`[data-yoopta-block-id="${n.id}"]`),a=V(o.elements);let l;o.hasCustomEditor||(l=m.string(t,[0]));const s="string"==typeof l&&0===l.trim().length;if(u&&s&&"void"!==(null===(e=null==a?void 0:a.props)||void 0===e?void 0:e.nodeType))r.setPath({current:n.meta.order}),r.focusBlock(n.id),d.setReference(i),h(!0);else{const e=Ct.buildBlockData({id:I()}),t=n.meta.order+1;r.setPath({current:n.meta.order}),r.insertBlock(e.type,{at:t,focus:!0}),u&&setTimeout((()=>{i&&d.setReference(i.nextSibling),h(!0)}),0)}},className:"yoopta-block-actions-plus"},{children:e(So,{})})),e("button",Object.assign({type:"button",className:"yoopta-block-actions-drag",ref:e=>{S(e),b.setReference(e)}},C,D,{onClick:e=>{e.stopPropagation(),i(n.id);const t=re(r,{at:n.meta.order});r.focusBlock(n.id),t&&setTimeout((()=>{r.blocks[n.type].hasCustomEditor||(_.blur(t),_.deselect(t),w.deselect(t)),r.setPath({current:n.meta.order,selected:[n.meta.order]}),s(!0)}),10)},onMouseDown:e=>e.stopPropagation()},{children:e(Eo,{})})),e(nl,{isOpen:E,refs:b,style:j,onClose:()=>s(!1)})]}))},il=({children:n,block:r,blockId:i})=>{const a=Nt(),[l,s]=o.useState(null),{attributes:c,listeners:f,setNodeRef:p,setActivatorNodeRef:h,transform:g,transition:v,isOver:m,isDragging:y}=go({id:i,disabled:a.readOnly}),b=((e,t,n,r,o)=>d((()=>({container:{marginLeft:20*e.meta.depth+"px",transform:t?`translate3d(${t.x}px, ${t.y}px, 0)`:"none",transition:n,opacity:r?.7:1},content:o&&!r?{borderBottom:"2px solid #007aff"}:void 0})),[e.meta.depth,t,n,r,o]))(r,g,v,y,m),w=`yoopta-block yoopta-align-${r.meta.align||"left"}`,x=Z.isBlockSelected(a,r),k=l===i,E=u((()=>{a.readOnly||s(i)}),[a.readOnly,i]),O=u((()=>{a.readOnly||s(null)}),[a.readOnly]),S=d((()=>({setActivatorNodeRef:h,attributes:c,listeners:f})),[r]);return t("div",Object.assign({ref:p,className:w,onMouseEnter:E,onMouseLeave:O,style:b.container,"data-hovered-block":k,"data-yoopta-block":!0,"data-yoopta-block-id":i,"data-yoopta-block-type":r.type},{children:[!a.readOnly&&e(ol,{block:r,editor:a,dragHandleProps:S,showActions:k,onChangeActiveBlock:s}),e("div",Object.assign({style:b.content},{children:n})),x&&!a.readOnly&&e("div",{className:"yoopta-selection-block"})]}))};var al={};Object.defineProperty(al,"__esModule",{value:!0});for(var ll="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),sl={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},cl={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:ll?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},dl={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},ul=1;ul<20;ul++)dl["f"+ul]=111+ul;function fl(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map((function(e){return pl(e,t)})),o=function(e){return r.some((function(t){return hl(t,e)}))};return null==n?o:o(n)}function pl(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var a in sl)r[sl[a]]=!1;var l=!0,s=!1,c=void 0;try{for(var d,u=o[Symbol.iterator]();!(l=(d=u.next()).done);l=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=vl(f),g=sl[h];if(f.length>1&&!g&&!cl[f]&&!dl[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?r.key=h:r.which=gl(f)),g&&(r[g]=!p||null)}}catch(e){s=!0,c=e}finally{try{!l&&u.return&&u.return()}finally{if(s)throw c}}return r}function hl(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&((null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r))return!1}return!0}function gl(e){return e=vl(e),dl[e]||e.toUpperCase().charCodeAt(0)}function vl(e){return e=e.toLowerCase(),e=cl[e]||e}al.default=fl,al.isHotkey=fl,al.isCodeHotkey=function(e,t){return fl(e,t)};var ml=al.isKeyHotkey=function(e,t){return fl(e,{byKey:!0},t)};al.parseHotkey=pl,al.compareHotkey=hl,al.toKeyCode=gl,al.toKeyName=vl;const yl={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",shiftDelete:"shift+delete",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",shiftArrowUp:"shift+up",shiftArrowDown:"shift+down",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",cmdShiftEnter:"mod+shift+enter",slashCommand:"/",copy:"mod+c",cut:"mod+x",cmdShiftRight:"mod+shift+right",cmdShiftLeft:"mod+shift+left",cmdShiftDelete:"mod+shift+backspace",cmdShiftD:"mod+shift+d",cmdAltDelete:"mod+alt+backspace"},bl={moveLineBackward:"opt+up",moveLineForward:"opt+down",ctrlLeft:"opt+left",ctrlRight:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},wl={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},xl=e=>{const t=yl[e],n=bl[e],r=wl[e],o=t&&ml(t),i=n&&ml(n),a=r&&ml(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},kl={isBold:xl("bold"),isCompose:xl("compose"),isArrowLeft:xl("arrowLeft"),isArrowRight:xl("arrowRight"),isArrowUp:xl("arrowUp"),isArrowDown:xl("arrowDown"),isDeleteBackward:xl("deleteBackward"),isDeleteForward:xl("deleteForward"),isDeleteLineBackward:xl("deleteLineBackward"),isDeleteLineForward:xl("deleteLineForward"),isDeleteWordBackward:xl("deleteWordBackward"),isDeleteWordForward:xl("deleteWordForward"),isExtendBackward:xl("extendBackward"),isExtendForward:xl("extendForward"),isExtendLineBackward:xl("extendLineBackward"),isExtendLineForward:xl("extendLineForward"),isItalic:xl("italic"),isMoveLineBackward:xl("moveLineBackward"),isMoveLineForward:xl("moveLineForward"),isCtrlLeft:xl("ctrlLeft"),isCtrlRight:xl("ctrlRight"),isRedo:xl("redo"),isShiftEnter:xl("shiftEnter"),isEnter:xl("enter"),isTransposeCharacter:xl("transposeCharacter"),isUndo:xl("undo"),isSpace:xl("space"),isSelect:xl("select"),isTab:xl("tab"),isShiftTab:xl("shiftTab"),isBackspace:xl("backspace"),isCmdEnter:xl("cmdEnter"),isCmd:xl("cmd"),isEscape:xl("escape"),isSlashCommand:xl("slashCommand"),isShiftArrowUp:xl("shiftArrowUp"),isShiftArrowDown:xl("shiftArrowDown"),isCopy:xl("copy"),isCut:xl("cut"),isShiftDelete:xl("shiftDelete"),isCmdShiftEnter:xl("cmdShiftEnter"),isCmdShiftRight:xl("cmdShiftRight"),isCmdShiftLeft:xl("cmdShiftLeft"),isCmdShiftDelete:xl("cmdShiftDelete"),isCmdAltDelete:xl("cmdAltDelete"),isCmdShiftD:xl("cmdShiftD")};const El={onKeyDown:function(e){return t=>{const n=re(e,{at:e.path.current});if(kl.isShiftEnter(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;return t.preventDefault(),void n.insertText("\n")}if(kl.isUndo(t))t.preventDefault();else if(kl.isRedo(t))t.preventDefault();else if(kl.isEnter(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;t.preventDefault();const r=m.first(n,[]),o=m.last(n,[]),i=m.isStart(n,n.selection.anchor,r[1]),a=m.isEnd(n,n.selection.anchor,o[1]);if(!i&&!a)return void e.splitBlock({slate:n,focus:!0});const l=Ct.getBlock(e,{at:e.path.current}),s=Ct.buildBlockData({id:I()}),c=m.string(n,[]),d=i&&c.length>0,u=Z.getNextPath(e);e.batchOperations((()=>{e.insertBlock(s.type,{at:d?e.path.current:u,focus:!d}),d&&l&&e.focusBlock(l.id)}))}else if(kl.isBackspace(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const r=k.parent(n.selection.anchor.path);if(m.isStart(n,n.selection.anchor,r)){t.preventDefault();if(0===m.string(n,r).trim().length)return void e.deleteBlock({at:e.path.current,focus:!0});{if(O.isExpanded(n.selection))return w.delete(n,{at:n.selection});const t=Ct.getBlock(e,{at:Z.getPreviousPath(e)}),r=Ct.getSlate(e,{id:null==t?void 0:t.id});if(t&&r){const{node:n}=function(e){const t=m.last(e,[]);return{node:t[0],path:t[1]}}(r);if(0===E.string(n).trim().length)return e.deleteBlock({blockId:t.id,focus:!1}),void e.setPath({current:t.meta.order})}e.mergeBlock()}}}else{if(kl.isSelect(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const[,r]=m.first(n,[0]),[,o]=m.last(n,[n.children.length-1]),i=m.range(n,r,o),a=O.equals(n.selection,i),l=0===m.string(n,i).trim().length;if(O.isExpanded(n.selection)&&a||l){t.preventDefault(),_.blur(n),_.deselect(n),w.deselect(n);const r=Array.from({length:Object.keys(e.children).length},((e,t)=>t));return void e.setPath({current:null,selected:r})}}if(kl.isShiftTab(t)){if(t.isDefaultPrevented())return;t.preventDefault();const n=e.path.selected;return Array.isArray(n)&&n.length>0?void e.batchOperations((()=>{n.forEach((t=>{const n=Ct.getBlock(e,{at:t});n&&n.meta.depth>0&&e.decreaseBlockDepth({at:t})}))})):void e.decreaseBlockDepth()}if(kl.isTab(t)){if(t.isDefaultPrevented())return;t.preventDefault();const n=e.path.selected;return Array.isArray(n)&&n.length>0?void e.batchOperations((()=>{n.forEach((t=>{e.increaseBlockDepth({at:t})}))})):void e.increaseBlockDepth()}if(kl.isArrowUp(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;if(1===new Set(n.selection.anchor.path).size){const n=Z.getPreviousPath(e),r=re(e,{at:n}),o=ne(e,{at:n}),i=e.blocks[(null==o?void 0:o.type)||""];if(r&&o&&!(null==i?void 0:i.hasCustomEditor)){const[,n]=m.last(r,[0]),i={path:n,offset:m.string(r,n).length};return t.preventDefault(),void e.focusBlock(o.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(kl.isArrowDown(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const r=k.parent(n.selection.anchor.path);if(m.isEnd(n,n.selection.anchor,r)){const n=Z.getNextPath(e),o=re(e,{at:n}),i=ne(e,{at:n}),a=e.blocks[(null==i?void 0:i.type)||""];if(o&&i&&!(null==a?void 0:a.hasCustomEditor)){const n=function(e,t){try{const[,n]=m.first(e,t);return{path:n,offset:0}}catch(e){return{path:[0,0],offset:0}}}(o,r);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:n,waitExecution:!1})}}}if(n&&n.selection&&O.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&ml(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},Ol=({children:t,attributes:n,placeholder:r})=>{const o=j(),i=Object.assign({},n);return o&&r&&(i["data-placeholder"]=r,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))};function Sl(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const Cl={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"italic"}},_l=["left","center","right",void 0];function Dl(e,t,n,r){var o,i;let a;if(t.parse){a=t.parse(n,e);if(y.isElement(a)&&"inline"===(null===(o=a.props)||void 0===o?void 0:o.nodeType))return a}const l=e.blocks[t.type],s=H(l.elements)||"",c=l.elements[s],d="void"===(null===(i=c.props)||void 0===i?void 0:i.nodeType);let u={id:I(),type:s,children:d&&!l.hasCustomEditor?[{text:""}]:r.map(Rl).flat(),props:Object.assign({nodeType:"block"},c.props)};if(a)if(y.isElement(a))u=a;else if(Array.isArray(a)){return a}if(0===u.children.length&&(u.children=[{text:""}]),!a&&t.parse)return;const f=n.getAttribute("data-meta-align"),p=parseInt(n.getAttribute("data-meta-depth")||"0",10);return Ct.buildBlockData({id:I(),type:t.type,value:[u],meta:{order:0,depth:p,align:_l.includes(f)?f:void 0}})}function jl(e,t,n){var r;if(3===n.nodeType){return{text:null===(r=n.textContent)||void 0===r?void 0:r.replace(/[\t\n\r\f\v]+/g," ")}}if(1!==n.nodeType)return null;if("BR"===n.nodeName)return{text:"\n"};const o=n;let i=Array.from(o.childNodes).map((n=>jl(e,t,n))).flat().filter(Boolean);if(Cl[o.nodeName]){const e=Cl[o.nodeName].type;return i.map((t=>"string"==typeof t?{[e]:!0,text:t}:t.text?Object.assign(Object.assign({},t),{[e]:!0}):t))}const a=t[o.nodeName];if(a){if(Array.isArray(a)){return a.map((t=>Dl(e,t,o,i))).filter(Boolean)}return Dl(e,a,o,i)}return i}function Rl(e){if("string"==typeof e)return{text:e};if(y.isElement(e))return e;if(Array.isArray(e))return e.map(Rl).flat();if(null==e?void 0:e.text)return e;if(Sl(e)){return e.value[0].children.map(Rl).flat()}return{text:""}}function Al(e,t){console.log("pasted html",t);const n=function(e){const t={};return Object.keys(e.plugins).forEach((n=>{const r=e.plugins[n],{parsers:o}=r;if(o){const{html:e}=o;if(e){const{deserialize:r}=e;if(r){const{nodeNames:e}=r;e&&e.forEach((e=>{const o=t[e];if(o){const i=Array.isArray(o)?o:[o];t[e]=[...i,{type:n,parse:r.parse}]}else t[e]={type:n,parse:r.parse}}))}}}})),t}(e);return jl(e,n,t).flat().filter(Sl)}function Pl(e){return!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)}const Bl=(e,t,n)=>{var r,o,i,a;(e=>{const[t]=m.nodes(e,{match:e=>!m.isEditor(e)&&y.isElement(e)&&"link"===e.type});return!!t})(t)&&(e=>{w.unwrapNodes(e,{match:e=>!m.isEditor(e)&&y.isElement(e)&&"link"===e.type})})(t);const{selection:l}=t,s=l&&O.isCollapsed(l),c=null===(a=null===(i=null===(o=null===(r=e.plugins)||void 0===r?void 0:r.LinkPlugin)||void 0===o?void 0:o.elements)||void 0===i?void 0:i.link)||void 0===a?void 0:a.props,d={type:"link",children:s?[{text:n}]:[],props:{url:n,target:(null==c?void 0:c.target)||"_self",rel:(null==c?void 0:c.rel)||"noopener noreferrer"}};s?w.insertNodes(t,d):(w.wrapNodes(t,d,{split:!0}),w.collapse(t,{edge:"end"}))},Tl=(e,t,n,r,o)=>d((()=>{let i=t.blockEditorsMap[e];const{normalizeNode:a,insertText:l,apply:s}=i,c=Object.keys(r);return c.forEach((e=>{var n;const o=null===(n=r[e].props)||void 0===n?void 0:n.nodeType,a="inline"===o,l="void"===o,s="inlineVoid"===o;s&&(i.markableVoid=t=>t.type===e),(l||s)&&(i.isVoid=t=>t.type===e),(a||s)&&(i.isInline=t=>t.type===e,i=((e,t)=>{const{insertData:n,insertText:r}=t;return t.insertText=n=>{console.log("insertText",n),console.log("insertText isUrl(text)",Pl(n)),n&&Pl(n)?Bl(e,t,n):r(n)},t.insertData=r=>{const o=r.getData("text/plain");console.log("insertData",o),console.log("insertData isUrl(text)",Pl(o)),o&&Pl(o)?Bl(e,t,o):n(r)},t})(t,i))})),i.insertText=e=>{const n=Z.getSelectedPaths(t),r=Z.getPath(t);Array.isArray(n)&&n.length>0&&t.setPath({current:r}),l(e)},i.normalizeNode=e=>{const[r,o]=e,l=t.blocks[n.type].elements;if(Object.keys(l).length>1)return a(e);if(y.isElement(r)){const{type:e}=r,t=H(l);if(!c.includes(e))return void w.setNodes(i,{type:t,props:Object.assign({},r.props)},{at:o});if(r.type===t)for(const[e,t]of E.children(i,o))if(y.isElement(e)&&!i.isInline(e))return void w.unwrapNodes(i,{at:t})}a(e)},i.apply=n=>{var r,o,a;if(C.isSelectionOperation(n)){const e=Z.getSelectedPaths(t),n=Z.getPath(t);Array.isArray(e)&&i.selection&&O.isExpanded(i.selection)&&t.setPath({current:n})}let l=jt.isSavingHistory(t);if(void 0===l&&(l=Nl(n)),l){const l=t.historyStack.undos[t.historyStack.undos.length-1];if(!l||"set_slate"!==(null===(r=null==l?void 0:l.operations[0])||void 0===r?void 0:r.type)){const r={type:"set_slate",properties:{slateOps:[n],selectionBefore:i.selection},blockId:e,slate:i};return t.applyTransforms([r],{source:"api"}),void s(n)}const c=null===(a=null===(o=null==l?void 0:l.operations[0])||void 0===o?void 0:o.properties)||void 0===a?void 0:a.slateOps,d=c&&c[c.length-1];let u=Ml(n,d);if(0!==i.operations.length&&(u=!0),u)d!==n&&c.push(n);else{const r={operations:[n],selectionBefore:i.selection},o={type:"set_slate",properties:{slateOps:r.operations,selectionBefore:r.selectionBefore},blockId:e,slate:i};t.applyTransforms([o],{source:"api"})}}s(n)},o&&(i=o(i,t,e)),i}),[]),Nl=e=>"set_selection"!==e.type,Ml=(e,t)=>t===e||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!k.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!k.equals(e.path,t.path))),Ll=({id:t,customEditor:n,elements:r,marks:o,events:i,options:a,extensions:s,placeholder:c="Type '/' for commands"})=>{const f=Nt(),p=Mt(t);let h=l(p.value).current;const g=d((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(r)),[r]),v=d((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(o)),[o]),y=Tl(t,f,p,r,s),b=((e,t,n,r)=>d((()=>{if(!e||t.readOnly)return{};const o=ue(e||{},["onBeforeCreate","onDestroy","onCreate"]),i={hotkeys:kl,currentBlock:n,defaultBlock:Ct.buildBlockData({id:I()})},a={};return Object.keys(o).forEach((e=>{a[e]=function(n){o[e]&&o[e](t,r,i)(n)}})),a}),[e,t,n]))(i,f,p,y),w=u((e=>{f.updateBlock(t,{value:e})}),[t]),x=u((n=>{const r=g[n.element.type],{attributes:o}=n,i=ue(n,["attributes"]);return o["data-element-type"]=i.element.type,r?e(r,Object.assign({},i,{attributes:o,blockId:t,HTMLAttributes:null==a?void 0:a.HTMLAttributes})):e(P,Object.assign({},i,{attributes:o}))}),[r]),E=u((t=>{var n,r,o,i;let{children:a,leaf:l,attributes:s}=t;const d=ue(l,["text"]),u=f.path.current===p.meta.order;d&&Object.keys(d).forEach((e=>{const t=v[e];t&&(a=t.render({children:a,leaf:l}))}));const h=!("void"===(null===(i=null===(o=null===(r=null===(n=t.children)||void 0===n?void 0:n.props)||void 0===r?void 0:r.parent)||void 0===o?void 0:o.props)||void 0===i?void 0:i.nodeType))&&u&&l.withPlaceholder;return e(Ol,Object.assign({attributes:s,placeholder:h?c:void 0},{children:a}))}),[o]),S=u((e=>{var t;f.readOnly||(null===(t=b.onKeyDown)||void 0===t||t.call(b,e),El.onKeyDown(f)(e))}),[b.onKeyDown,f.readOnly,f.path.current,p.meta.order]),C=u((e=>{var t;f.readOnly||null===(t=null==b?void 0:b.onKeyUp)||void 0===t||t.call(b,e)}),[b.onKeyUp,f.readOnly]),D=u((e=>{var t;f.readOnly||(e.preventDefault(),null===(t=null==b?void 0:b.onBlur)||void 0===t||t.call(b,e))}),[b.onBlur,f.readOnly]),j=u((e=>{var t;f.readOnly||(f.isFocused()||(ee.set(f,!0),f.emit("focus",!0)),null===(t=null==b?void 0:b.onFocus)||void 0===t||t.call(b,e))}),[b.onFocus,f.readOnly]),R=u((e=>{var t;if(f.readOnly)return;null===(t=null==b?void 0:b.onPaste)||void 0===t||t.call(b,e);const n=e.clipboardData.getData("text/html"),r=(new DOMParser).parseFromString(n,"text/html");if(console.log("parsedHTML",r),r.body.childNodes.length>0){const t=Al(f,r.body);if(t.length>0&&null!==f.path.current){e.preventDefault();let n=!1,r=!1;if(y&&y.selection){const e=k.parent(y.selection.anchor.path),t=m.string(y,e).trim(),o=m.isStart(y,y.selection.anchor,e);r=""===t&&o,n=!o||t.length>0,_.blur(y)}const o=f.path.current;if(null===o)return;return void f.batchOperations((()=>{const e=[];r&&f.deleteBlock({at:o}),t.forEach(((t,r)=>{let i=n?o+r+1:o+r;e.push(i);const a=ue(t,["type"]);f.insertBlock(t.type,{at:i,focus:!1,blockData:a})})),f.setPath({current:null,selected:e})}))}}}),[b.onPaste,f.readOnly]),A=u((e=>{const t=[];if(f.readOnly)return t;const[n,r]=e,o=f.path.current===p.meta.order;return y.selection&&o&&!m.isEditor(n)&&""===m.string(y,[r[0]])&&O.includes(y.selection,r)&&O.isCollapsed(y.selection)&&t.push(Object.assign(Object.assign({},y.selection),{withPlaceholder:!0})),t}),[f.readOnly,f.path.current,p.meta.order]);return e(Il,{id:t,slate:y,initialValue:h,onChange:w,decorate:A,renderLeaf:E,renderElement:x,eventHandlers:b,onKeyDown:S,onKeyUp:C,onFocus:j,onBlur:D,customEditor:n,readOnly:f.readOnly,onPaste:R})},Il=p((({id:t,slate:n,initialValue:r,onChange:o,renderLeaf:i,renderElement:a,eventHandlers:l,onKeyDown:s,onKeyUp:c,onFocus:d,onBlur:u,onPaste:f,customEditor:p,decorate:h,readOnly:g})=>"function"==typeof p?p({blockId:t}):e(R,Object.assign({editor:n,initialValue:r,onValueChange:o},{children:e(A,Object.assign({renderElement:a,renderLeaf:i,className:"yoopta-slate",spellCheck:!0},l,{onKeyDown:s,onKeyUp:c,onFocus:d,decorate:h,readOnly:g,onPaste:f}),`editable-${t}`)}),`slate-${t}`)));Il.displayName="SlateEditorInstance";const zl=({editor:e})=>({sensors:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d((()=>[...t].filter((e=>null!=e))),[...t])}(En(hr,{activationConstraint:{distance:20}}),En(cr,{coordinateGetter:yo})),handleDragEnd:u((t=>{const{active:n,over:r}=t;if(n&&r&&n.id!==r.id){const t=e.children[r.id].meta.order;e.moveBlock(n.id,t)}}),[]),handleDragStart:u((t=>{e.setPath({current:null})}),[])}),Fl=[],Hl=({editor:t,marks:r,placeholder:o})=>{const i=It(),{sensors:a,handleDragEnd:l,handleDragStart:s}=zl({editor:t}),c=Object.keys(t.children),u=d((()=>0===c.length?Fl:c.sort(((e,n)=>t.children[e].meta.order-t.children[n].meta.order))),[c]),f=[];for(let n=0;n<u.length;n++){const i=u[n],a=t.children[i],l=t.plugins[a.type];a&&l?f.push(e(il,Object.assign({block:a,blockId:i},{children:e(Ll,{type:a.type,id:i,marks:r,customEditor:l.customEditor,events:l.events,elements:l.elements,options:l.options,extensions:l.extensions,placeholder:o},i)}),i)):console.error(`Plugin ${a.type} not found`)}return i?e(n,{children:f}):e(Wr,Object.assign({id:"yoopta-dnd-context",sensors:a,collisionDetection:An,onDragStart:s,onDragEnd:l},{children:e(lo,Object.assign({disabled:i,items:u,strategy:oo},{children:f}))}))},Vl=({editor:e,root:t})=>{const[n,r]=f({origin:[0,0],coords:[0,0],selection:!1}),o=o=>{var i;if(e.readOnly||!1===t)return;const a=null===(i=e.refElement)||void 0===i?void 0:i.contains(o.target),s=Z.getSelectedPaths(e);if(!a&&!n.selection&&Array.isArray(s)&&s.length>0)return e.setPath({current:null}),l();a||r({origin:[o.pageX,o.pageY-window.pageYOffset],coords:[o.pageX,o.pageY-window.pageYOffset],selection:!0})},i=o=>{if(!n.selection||e.readOnly||!1===t)return;r((e=>Object.assign(Object.assign({},e),{coords:[o.pageX,o.pageY-window.pageYOffset]})));const i=((e,t,n)=>{var r;const o=[],i=null===(r=e.refElement)||void 0===r?void 0:r.querySelectorAll("[data-yoopta-block]");return i?(i.forEach(((e,r)=>{if(!e)return;const i=e.getBoundingClientRect(),a=Math.min(t[1],n[1]),l=Math.min(t[0],n[0]),s=Math.max(t[1],n[1]),c=Math.max(t[0],n[0]);a<i.bottom&&s>i.top&&l<i.right&&c>i.left&&o.push(r)})),o):o})(e,n.origin,[o.pageX,o.pageY-window.pageYOffset]);e.setPath({current:null,selected:i})},a=()=>{e.readOnly||l()};c((()=>{var n;if(e.readOnly||!1===t)return;const r=t&&"current"in t?t.current:t||document;if(!r)throw new Error("Root element not found. Please check the `selectionBoxRoot` prop");if(!("nodeType"in r))throw new Error("Root element should be a DOM element or a ref object. Please check the `selectionBoxRoot` prop");if(null===(n=e.refElement)||void 0===n?void 0:n.contains(r))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return r.addEventListener("mousedown",o),r.addEventListener("mousemove",i),r.addEventListener("mouseup",a),()=>{r.removeEventListener("mousedown",o),r.removeEventListener("mousemove",i),r.removeEventListener("mouseup",a)}}),[e.path,n,t,e.readOnly]);const l=()=>{r({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},n),{onClose:l})},$l=({origin:t,coords:n,isOpen:r})=>{if(!r)return null;const o={zIndex:10,left:t[0],top:t[1],height:Math.abs(n[1]-t[1]-1),width:Math.abs(n[0]-t[0]-1),userSelect:"none",transformOrigin:"top left",transform:t[1]>n[1]&&t[0]>n[0]?"scaleY(-1) scaleX(-1)":t[1]>n[1]?"scaleY(-1)":t[0]>n[0]?"scaleX(-1)":void 0,position:"fixed",backgroundColor:"rgba(35, 131, 226, 0.14)"};return e("div",{style:o})},Ul={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null};function Kl({editor:e}){const t=l(!1),n=l(!1),r=l(null),o=l(null);let i=l(Ul).current;const a=()=>{const t=e.path.current;if("number"==typeof t){const n=Ct.getSlate(e,{at:t}),r=Ct.getBlock(e,{at:t}),o=e.blocks[(null==r?void 0:r.type)||""];if(!n||(null==o?void 0:o.hasCustomEditor))return;try{m.withoutNormalizing(n,(()=>{w.select(n,[0]),n.selection&&O.isExpanded(n.selection)&&(_.blur(n),_.deselect(n))}))}catch(e){}}},s=i=>{if(!t.current||e.readOnly)return;const l=document.elementFromPoint(i.clientX,i.clientY),s=null==l?void 0:l.closest("[data-yoopta-block]");s&&e.batchOperations((()=>{var t;const i=s.getAttribute("data-yoopta-block-id")||"",l=null===(t=e.children[i])||void 0===t?void 0:t.meta.order;if(n.current&&"number"==typeof l&&l===r.current)return o.current=l,void e.setPath({current:l,selected:[l]});if("number"==typeof l&&l!==o.current){o.current=l,n.current=!0;const t=Math.min(r.current,l),i=Math.max(r.current,l);a();const s=Array.from({length:i-t+1},((e,n)=>t+n));e.setPath({current:l,selected:s})}}))},c=()=>{var i,a;t.current=!1,n.current=!1,r.current=null,o.current=null,null===(i=e.refElement)||void 0===i||i.removeEventListener("mousemove",s),null===(a=e.refElement)||void 0===a||a.removeEventListener("mouseup",c),null===document||void 0===document||document.removeEventListener("mouseup",c)};return{onMouseDown:n=>{e.readOnly||e.batchOperations((()=>{var i,l,d;const u=Z.getSelectedPaths(e);Array.isArray(u)&&u.length>0&&!n.shiftKey&&!n.altKey&&e.setPath({current:null});const f=n.target.closest("[data-yoopta-block]");if(f&&0===n.button){const u=f.getAttribute("data-yoopta-block-id")||"",p=null===(i=e.children[u])||void 0===i?void 0:i.meta.order;if("number"==typeof p){if(t.current=!0,r.current=p,o.current=p,n.shiftKey&&!Z.isPathEmpty(e)&&p!==e.path.current)return void(t=>{a();const n=Z.getPath(e);if("number"!=typeof n)return;const r=Array.from({length:Math.abs(t-n)}).map(((e,r)=>t>n?n+r+1:n-r-1));e.setPath({current:t,selected:[...r,n]})})(p);p!==e.path.current&&e.setPath({current:p}),null===(l=e.refElement)||void 0===l||l.addEventListener("mousemove",s),null===(d=e.refElement)||void 0===d||d.addEventListener("mouseup",c),null===document||void 0===document||document.addEventListener("mouseup",c)}}}))},onShiftArrowUp:t=>{if("function"==typeof t.isDefaultPrevented&&t.isDefaultPrevented())return;if(i.selectionStarted&&null!==i.startedIndexToSelect&&null!==i.indexToSelect){const t=i.indexToSelect,n=t-1;if(0===t)return;if(t===i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t}),void(i.indexToSelect=n)}if(n<i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t}),void(i.indexToSelect=n)}const r=Z.getSelectedPaths(e);if((null==r?void 0:r.includes(t))&&t!==i.startedIndexToSelect){const o=r.filter((e=>e!==t));return e.setPath({current:n,selected:o}),void(i.indexToSelect=n)}return}const n=ne(e),r=re(e);if(!r||!r.selection||!n)return;const o=k.parent(r.selection.anchor.path),a=m.isStart(r,r.selection.focus,o);if(O.isExpanded(r.selection)&&a){const o=Y(e);if("number"!=typeof o)return;const a=ne(e,{at:o});if(n&&a){t.preventDefault(),_.blur(r),_.deselect(r),w.deselect(r);const o=e.path.selected?[...e.path.selected,null==n?void 0:n.meta.order,n.meta.order-1]:[null==n?void 0:n.meta.order,n.meta.order-1];e.setPath({current:null,selected:o}),i.startedIndexToSelect=n.meta.order,i.indexToSelect=n.meta.order-1,i.selectionStarted=!0}}},onShiftArrowDown:t=>{if(i.selectionStarted&&null!==i.indexToSelect&&null!==i.startedIndexToSelect){const t=i.indexToSelect,n=t+1;if(n===Object.keys(e.children).length)return;if(t===i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t}),void(i.indexToSelect=n)}if(n>i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t}),void(i.indexToSelect=n)}const r=Z.getSelectedPaths(e);if((null==r?void 0:r.includes(t))&&t!==i.startedIndexToSelect){const o=r.filter((e=>e!==t));return e.setPath({current:n,selected:o}),void(i.indexToSelect=n)}return}const n=ne(e),r=re(e);if(!r||!r.selection||!n)return;const o=k.parent(r.selection.anchor.path),a=m.isEnd(r,r.selection.focus,o);if(O.isExpanded(r.selection)&&a){const o=Z.getNextPath(e),a=ne(e,{at:o});if(n&&a){t.preventDefault(),_.blur(r),_.deselect(r),w.deselect(r);const o=e.path.selected?[...e.path.selected,null==n?void 0:n.meta.order,(null==n?void 0:n.meta.order)+1]:[null==n?void 0:n.meta.order,n.meta.order+1];e.setPath({current:null,selected:o}),i.startedIndexToSelect=n.meta.order,i.indexToSelect=n.meta.order+1,i.selectionStarted=!0}}},selectionState:i}}const Wl=({placeholder:n,marks:r,className:o,selectionBoxRoot:i,width:a,style:l,children:s,autoFocus:d=!0})=>{const u=Nt(),f=It(),p=Vl({editor:u,root:i}),h=Kl({editor:u});c((()=>{d&&!f&&u.focus()}),[d,f]),c((()=>{if(!f)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)}),[u.path,f]);const g=()=>{h.selectionState.indexToSelect=null,h.selectionState.startedIndexToSelect=null,h.selectionState.selectionStarted=!1},v=e=>{if(!f){if(kl.isRedo(e))return e.preventDefault(),void u.redo();if(kl.isUndo(e))return e.preventDefault(),void u.undo();if(kl.isSelect(e)){const t=Z.getSelectedPaths(u);if((null==t?void 0:t.length)===Object.keys(u.children).length)return void e.preventDefault();if(Array.isArray(t)&&t.length>0){e.preventDefault();const t=Object.keys(u.children).map(((e,t)=>t));return void u.setPath({current:null,selected:t})}}if(kl.isCopy(e)||kl.isCut(e)){const t=Z.getSelectedPaths(u);if(Array.isArray(t)&&t.length>0){e.preventDefault();const t=u.getHTML(u.getEditorValue()),n=u.getPlainText(u.getEditorValue()),r=new Blob([t],{type:"text/html"}),o=new Blob([n],{type:"text/plain"}),i=new ClipboardItem({"text/html":r,"text/plain":o});return navigator.clipboard.write([i]).then((()=>{const e=(new DOMParser).parseFromString(t,"text/html");console.log("HTML copied\n",e.body)})),void(kl.isCut(e)&&(u.batchOperations((()=>{const e=Z.getSelectedPaths(u);if(Array.isArray(e)&&e.length>0){const t=e.length===Object.keys(u.children).length;if(e.forEach((e=>{var t;const n=null===(t=Ct.getBlock(u,{at:e}))||void 0===t?void 0:t.id;n&&u.deleteBlock({blockId:n})})),t){const e=F({id:I()});u.insertBlock(e.type,{at:0,focus:!0})}}})),u.setPath({current:null,selected:null}),g()))}}if(kl.isBackspace(e)){e.stopPropagation();const t=Z.getSelectedPaths(u);return(null==t?void 0:t.length)===Object.keys(u.children).length?(e.preventDefault(),void u.batchOperations((()=>{Object.keys(u.children).forEach((e=>u.deleteBlock({blockId:e}))),u.setPath({current:null,selected:null}),g()}))):void u.batchOperations((()=>{const t=Z.getSelectedPaths(u);Array.isArray(t)&&(null==t?void 0:t.length)>0&&(e.preventDefault(),t.forEach((e=>u.deleteBlock({at:e}))),u.setPath({current:null,selected:null}),g())}))}if(kl.isShiftArrowUp(e)&&h.onShiftArrowUp(e),kl.isShiftArrowDown(e)&&h.onShiftArrowDown(e),kl.isTab(e)){const t=Z.getSelectedPaths(u);Array.isArray(t)&&t.length>0&&(e.preventDefault(),u.batchOperations((()=>{t.forEach((e=>{const t=Ct.getBlock(u,{at:e});u.increaseBlockDepth({blockId:null==t?void 0:t.id})}))})))}else if(kl.isShiftTab(e)){const t=Z.getSelectedPaths(u);Array.isArray(t)&&t.length>0&&(e.preventDefault(),u.batchOperations((()=>{t.forEach((e=>{const t=Ct.getBlock(u,{at:e});u.decreaseBlockDepth({blockId:null==t?void 0:t.id})}))})))}else;}},b=e=>{if(!f)return;const t=e.clipboardData,n=window.getSelection();if(n&&n.rangeCount>0){const e=n.getRangeAt(0);if(e.collapsed)return;const r=e.cloneContents().querySelectorAll("[data-yoopta-block-id]");if(!r.length)return;const o=Array.from(r).reduce(((e,t)=>{const n=t.getAttribute("data-yoopta-block-id")||"",r=u.children[n];return r&&(e[n]=r),e}),{}),i=u.getHTML(o),a=u.getPlainText(o);return t.setData("text/html",i),void t.setData("text/plain",a)}},w=(x={userSelect:p.selection?"none":"auto",pointerEvents:p.selection?"none":"auto",width:a||(null==l?void 0:l.width),paddingBottom:null==l?void 0:l.paddingBottom},Object.assign(Object.assign({},x),{width:x.width||400,paddingBottom:"number"==typeof x.paddingBottom?x.paddingBottom:100}));var x;return t("div",Object.assign({ref:e=>u.refElement=e,className:o?`yoopta-editor ${o}`:"yoopta-editor",style:w,onMouseDown:e=>{f||(h.onMouseDown(e),g(),(e=>{var t;const n=u.refElement;if(!n)return;const{bottom:r}=n.getBoundingClientRect(),o=r-parseInt(getComputedStyle(n).paddingBottom,10),i=F({id:I()});if(e.clientY>=o){const e=Object.keys(u.children).length-1,n=ne(u,{at:e}),r=re(u,{at:e});if(n&&r&&r.selection){const e=m.string(r,r.selection.anchor.path),o=k.parent(r.selection.anchor.path),[a]=m.node(r,o);if(n.type===i.type&&y.isElement(a)&&"void"!==(null===(t=a.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void u.focusBlock(n.id,{slate:r})}const o=e+1;u.insertBlock(i.type,{at:o,focus:!0})}})(e))},onBlur:e=>{var t;if((null===(t=u.refElement)||void 0===t?void 0:t.contains(e.relatedTarget))||f)return;g();const n=Z.getSelectedPaths(u);Array.isArray(n)&&n.length>0&&u.setPath({current:null,selected:null})},onCopy:b,onCut:b},{children:[e(Hl,{editor:u,marks:r,placeholder:n}),!1!==i&&e($l,{origin:p.origin,coords:p.coords,isOpen:p.selection&&!f}),s]}))};function Yl({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}const Xl=Yl({type:"fakeSelection",render:t=>e("span",Object.assign({style:{backgroundColor:"#d7e6fa"}},{children:t.children}))}),ql=(()=>{const e=I();return{[e]:F({id:e})}})(),Zl=new Vt,Jl=(e,t)=>Zl.on(e,t),Gl=(e,t)=>Zl.once(e,t),Ql=(e,t)=>Zl.off(e,t),es=(e,t)=>Zl.emit(e,t);const ts=({id:t,editor:n,value:r,marks:o,plugins:i,autoFocus:a,className:l,tools:s,selectionBoxRoot:p,children:h,placeholder:g,readOnly:v,width:m,style:y,onChange:b})=>{const w=d((()=>o?[Xl,...o]:[Xl]),[o]),x=d((()=>i.map((e=>e.getPlugin))),[i]),[k,E]=f((()=>{n.id||(n.id=t||I()),n.readOnly=v||!1,w&&(n.formats=ge(n,w)),n.blocks=function(e,t){const n={};return t.forEach((t=>{var r;const o=V(t.elements),i=null===(r=null==o?void 0:o.props)||void 0===r?void 0:r.nodeType;if("inline"!==i&&"inlineVoid"!==i){const r={};Object.keys(t.elements).forEach((e=>{const n=ue(t.elements[e],["render"]);r[e]=n}));const{display:o,placeholder:i,shortcuts:a}=t.options||{};n[t.type]={type:t.type,elements:r,hasCustomEditor:!!t.customEditor,options:{display:o,placeholder:i,shortcuts:a},isActive:()=>{const n=ne(e,{at:e.path.current});return(null==n?void 0:n.type)===t.type}}}})),n}(n,x);const e=function(e){return!!e&&"object"==typeof e&&0!==Object.keys(e).length}(r);return e||void 0===r||console.error(`Initial value is not valid. Should be an object with blocks. You passed: ${JSON.stringify(r)}`),n.children=e?r:ql,n.blockEditorsMap=ve(n),n.shortcuts=function(e){const t={};return Object.values(e.blocks).forEach((e=>{var n,r,o,i;e.options&&Array.isArray(null===(n=e.options)||void 0===n?void 0:n.shortcuts)&&(null===(r=e.options)||void 0===r?void 0:r.shortcuts.length)>0&&(null===(i=null===(o=e.options)||void 0===o?void 0:o.shortcuts)||void 0===i||i.forEach((n=>{t[n]=e})))})),t}(n),n.plugins=function(e){const t={},n={};return e.forEach((e=>{e.elements&&Object.keys(e.elements).forEach((t=>{var r;const o=e.elements[t],i=null===(r=o.props)||void 0===r?void 0:r.nodeType;"inline"!==i&&"inlineVoid"!==i||(n[t]=Object.assign(Object.assign({},o),{rootPlugin:e.type}))})),t[e.type]=e})),e.forEach((e=>{if(e.elements){const r=Object.assign(Object.assign({},e.elements),n);t[e.type]=Object.assign(Object.assign({},e),{elements:r})}})),t}(x),n.commands=function(e,t){const n={};return t.forEach((t=>{t.commands&&Object.keys(t.commands).forEach((r=>{var o;(null===(o=t.commands)||void 0===o?void 0:o[r])&&(n[r]=(...n)=>{var o;return null===(o=t.commands)||void 0===o?void 0:o[r](e,...n)})}))})),n}(n,x),n.on=Jl,n.once=Gl,n.off=Ql,n.emit=es,{editor:n,version:0}})),[O,S]=f(null),C=u((e=>{S(e)}),[]),_=u(((e,t)=>{if(E((e=>({editor:e.editor,version:e.version+1}))),"function"==typeof b&&Array.isArray(t.operations)){t.operations.filter((e=>"normalize_block_paths"!==e.type&&"set_block_path"!==e.type&&"set_slate"!==e.type)).length>0&&b(e,t)}}),[]);return c((()=>{const e=e=>{_(e.value,{operations:e.operations})};return n.on("change",e),n.on("path-change",C),()=>{n.off("change",e),n.off("path-change",C)}}),[n,_]),e(Tt,Object.assign({editorState:k},{children:e(Ya,Object.assign({tools:s},{children:e(Wl,Object.assign({placeholder:g,marks:w,autoFocus:a,className:l,selectionBoxRoot:p,width:m,style:y},{children:h}))}))}))},ns=Object.assign(Object.assign({},rl),{ExtendedBlockActions:({id:r,className:o,style:i,onClick:a,children:l})=>{const s=It(),[c,d]=f(!1),{refs:u,floatingStyles:p,context:h}=Ca({placement:"bottom-start",open:c,onOpenChange:d,middleware:[Ri(),ji(),Di(),ui(10)],whileElementsMounted:_i}),{isMounted:g,styles:v}=Ra(h,{duration:100}),m=Object.assign(Object.assign({},v),p);return s?null:t(n,{children:[g&&e(nl,Object.assign({isOpen:!0,onClose:()=>d(!1),refs:u,style:m},{children:l})),e("button",Object.assign({type:"button",contentEditable:!1,ref:u.setReference,id:r,className:`yoopta-button yoopta-extended-block-actions ${o||""}`,onClick:()=>{null==a||a(),d(!0)},style:c?Object.assign(Object.assign({},i),{opacity:1}):i},{children:e(Ia,{})}))]})},Portal:Ja,Overlay:Za});function rs(e,t){var n;const r=[];return t.forEach((t=>{if(t.nodeType===Node.TEXT_NODE&&r.push({text:t.textContent||""}),t.nodeType===Node.ELEMENT_NODE){const n=t;"P"!==n.nodeName&&"SPAN"!==n.nodeName&&"DIV"!==n.nodeName||r.push(Object.assign({},rs(e,n.childNodes)[0])),"B"!==n.nodeName&&"STRONG"!==n.nodeName||r.push(Object.assign({bold:!0},rs(e,n.childNodes)[0])),"I"!==n.nodeName&&"EM"!==n.nodeName||r.push(Object.assign({italic:!0},rs(e,n.childNodes)[0])),"S"!==n.nodeName&&"STRIKE"!==n.nodeName||r.push(Object.assign({strike:!0},rs(e,n.childNodes)[0])),"U"!==n.nodeName&&"INS"!==n.nodeName||r.push(Object.assign({underline:!0},rs(e,n.childNodes)[0])),"CODE"===n.nodeName&&r.push(Object.assign({code:!0},rs(e,n.childNodes)[0])),"A"===n.nodeName&&r.push({id:I(),type:"link",props:{url:n.getAttribute("href")||"",target:n.getAttribute("target")||"",rel:n.getAttribute("rel")||""},children:rs(e,n.childNodes)})}})),0!==r.length||(null===(n=r[0])||void 0===n?void 0:n.text)||r.push({text:""}),r}function os(e){return e.map((e=>{if("text"in e){let t=e.text;return e.bold&&(t=`<b>${t}</b>`),e.italic&&(t=`<i>${t}</i>`),e.strike&&(t=`<s>${t}</s>`),e.underline&&(t=`<u>${t}</u>`),e.code&&(t=`<code>${t}</code>`),t}if("link"===e.type){const{url:t,target:n,rel:r}=e.props;return`<a href="${t}" target="${n}" rel="${r}">${os(e.children)}</a>`}return""})).join("")}function is(e){return e.map((e=>{if("text"in e){let t=e.text;return e.bold&&(t=`**${t}**`),e.italic&&(t=`*${t}*`),e.strike&&(t=`~~${t}~~`),e.underline&&(t=`<u>${t}</u>`),e.code&&(t=`\`${t}\``),t}if("link"===e.type){const{url:t,target:n,rel:r}=e.props;return`[${is(e.children)}](${t})`}return""})).join("")}!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-editor-z-\\[100\\]{z-index:100}.yoo-editor-mr-2{margin-right:.5rem}.yoo-editor-h-4{height:1rem}.yoo-editor-w-4{width:1rem}.yoopta-editor *{border:0 solid #e5e7eb;box-sizing:border-box;scrollbar-color:#d3d1cb transparent}::-moz-selection{background:#c6ddf8}::selection{background:#c6ddf8}.yoopta-placeholder{display:contents;position:relative}.yoopta-placeholder:after{color:inherit;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;opacity:.5;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-button{background-color:transparent;border-style:none;cursor:pointer}.yoopta-block{border-radius:.25rem;margin-bottom:1px;margin-top:2px;padding:0 2px;position:relative}.yoopta-selection-block{background-color:#2383e224;border-radius:.25rem;height:100%;left:0;opacity:1;pointer-events:none;position:absolute;top:0;width:100%;z-index:90}.yoopta-block-actions{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yoopta-block-actions[data-hovered-state-open=true]{opacity:1}.yoopta-block-actions-plus{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:24px}.yoopta-block-actions-plus:active,.yoopta-block-actions-plus:focus,.yoopta-block-actions-plus:hover{background-color:#37362f14}.yoopta-block-actions-drag{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:18px}.yoopta-block-actions-drag:active,.yoopta-block-actions-drag:focus,.yoopta-block-actions-drag:hover{background-color:#37362f14}.yoopta-slate:focus{outline:2px solid transparent;outline-offset:2px}.yoopta-slate:focus-visible{outline:2px solid transparent;outline-offset:2px}.yoopta-block-options-button{background-color:transparent;border-radius:.125rem;border-style:none;cursor:pointer;display:flex;justify-content:flex-start;line-height:120%;margin-left:4px;margin-right:4px;padding:.375rem .5rem;width:100%}.yoopta-block-options-button:hover{background-color:#37352f14}.yoopta-block-options-item{align-items:center;cursor:default;display:flex;font-size:.875rem;line-height:1.25rem;outline:2px solid transparent;outline-offset:2px;position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-block-options-item[data-disabled]{opacity:.5;pointer-events:none}.yoopta-extended-block-actions{--tw-bg-opacity:1;align-items:center;background-color:rgb(238 238 238/var(--tw-bg-opacity));border-radius:2px;border-style:none;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:1;padding:0 4px;position:absolute;right:8px;top:8px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,1,1);width:22px;z-index:10}.yoopta-block-options-separator{background-color:#37352f14;height:1px;margin-bottom:4px;margin-top:4px;width:100%}.yoopta-block-options-menu-content{--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);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(229 231 235/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);min-width:200px;overflow:hidden;padding:6px 0;position:relative;width:auto}.yoopta-block-options-group{display:flex;flex-direction:column}.yoopta-align-left{justify-content:flex-start;text-align:left}.yoopta-align-center{justify-content:center;text-align:center}.yoopta-align-right{justify-content:flex-end;text-align:right}");export{Ct as Blocks,Et as Elements,kl as HOTKEYS,Z as Paths,ns as UI,M as YooptaPlugin,F as buildBlockData,z as buildBlockElement,K as buildBlockElementsStructure,pe as buildSlateEditor,At as createYooptaEditor,Yl as createYooptaMark,ts as default,rs as deserializeTextNodes,ne as findPluginBlockByPath,re as findSlateBySelectionPath,I as generateId,V as getRootBlockElement,H as getRootBlockElementType,os as serializeTextNodes,is as serializeTextNodesIntoMarkdown,Mt as useBlockData,Ft as useBlockSelected,Nt as useYooptaEditor,Lt as useYooptaFocused,zt as useYooptaPluginOptions,It as useYooptaReadOnly,Xa as useYooptaTools};
|
|
6
|
+
var Li=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),Ii="undefined"==typeof Element,zi=Ii?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Fi=!Ii&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Hi=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},Vi=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var a=i.shift();if(!Hi(a,!1))if("SLOT"===a.tagName){var l=a.assignedElements(),s=e(l.length?l:a.children,!0,r);r.flatten?o.push.apply(o,s):o.push({scopeParent:a,candidates:s})}else{zi.call(a,Li)&&r.filter(a)&&(n||!t.includes(a))&&o.push(a);var c=a.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(a),d=!Hi(c,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(c&&d){var u=e(!0===c?a.children:c.children,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return o},$i=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Ui=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!$i(e)?0:e.tabIndex},Ki=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Wi=function(e){return"INPUT"===e.tagName},Yi=function(e){return function(e){return Wi(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Fi(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},Xi=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},qi=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=zi.call(e,"details>summary:first-of-type")?e.parentElement:e;if(zi.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Xi(e)}else{if("function"==typeof r){for(var i=e;e;){var a=e.parentElement,l=Fi(e);if(a&&!a.shadowRoot&&!0===r(a))return Xi(e);e=e.assignedSlot?e.assignedSlot:a||l===e.ownerDocument?a:l.host}e=i}if(function(e){var t,n,r,o,i=e&&Fi(e),a=null===(t=i)||void 0===t?void 0:t.host,l=!1;if(i&&i!==e)for(l=!!(null!==(n=a)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(a)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!l&&a;){var s,c,d;l=!(null===(c=a=null===(s=i=Fi(a))||void 0===s?void 0:s.host)||void 0===c||null===(d=c.ownerDocument)||void 0===d||!d.contains(a))}return l}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Zi=function(e,t){return!(t.disabled||Hi(t)||function(e){return Wi(e)&&"hidden"===e.type}(t)||qi(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!zi.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Ji=function(e,t){return!(Yi(t)||Ui(t)<0||!Zi(e,t))},Gi=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Qi=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,a=i?t.scopeParent:t,l=function(e,t){var n=Ui(e);return n<0&&t&&!$i(e)?0:n}(a,i),s=i?e(t.candidates):a;0===l?i?n.push.apply(n,s):n.push(a):r.push({documentOrder:o,tabIndex:l,item:t,isScope:i,content:s})})),r.sort(Ki).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ea=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Vi([e],t.includeContainer,{filter:Ji.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Gi}):function(e,t,n){if(Hi(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Li));return t&&zi.call(e,Li)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Ji.bind(null,t)),Qi(n)};const ta=r["useInsertionEffect".toString()]||(e=>e());var na="undefined"!=typeof document?s:c;function ra(){return ra=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ra.apply(this,arguments)}let oa=!1,ia=0;const aa=()=>"floating-ui-"+ia++;const la=r["useId".toString()]||function(){const[e,t]=r.useState((()=>oa?aa():void 0));return na((()=>{null==e&&t(aa())}),[]),r.useEffect((()=>{oa||(oa=!0)}),[]),e};const sa=r.createContext(null),ca=r.createContext(null);function da(e){return"data-floating-ui-"+e}function ua(e){const t=l(e);return na((()=>{t.current=e})),t}const fa=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function pa(e,t){const n=ea(e,fa());"prev"===t&&n.reverse();const r=n.indexOf(function(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}((null==(o=e)?void 0:o.ownerDocument)||document));var o;return n.slice(r+1)[0]}function ha(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!function(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Po(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,r)}function ga(e){ea(e,fa()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function va(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ma={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ya(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const ba=r.forwardRef((function(e,t){const[n,o]=r.useState();na((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",ya),()=>{document.removeEventListener("keydown",ya)})),[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[da("focus-guard")]:"",style:ma};return r.createElement("span",ra({},e,i))})),wa=r.createContext(null),xa=da("portal");function ka(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const a=function(e){let{id:t,root:n}=void 0===e?{}:e;const[o,i]=r.useState(null),a=la(),l=Ea(),s=r.useRef(null);return na((()=>()=>{null==o||o.remove(),queueMicrotask((()=>{s.current=null}))}),[o]),na((()=>{if(s.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=a,n.setAttribute(xa,""),e.appendChild(n),s.current=n,i(n)}),[t,a]),na((()=>{if(s.current)return;let e=n||(null==l?void 0:l.portalNode);e&&!Ro(e)&&(e=e.current),e=e||document.body;let r=null;t&&(r=document.createElement("div"),r.id=t,e.appendChild(r));const o=document.createElement("div");o.id=a,o.setAttribute(xa,""),e=r||e,e.appendChild(o),s.current=o,i(o)}),[t,n,a,l]),o}({id:n,root:o}),[l,s]=r.useState(null),c=r.useRef(null),d=r.useRef(null),u=r.useRef(null),f=r.useRef(null),p=!!l&&!l.modal&&l.open&&i&&!(!o&&!a);return r.useEffect((()=>{if(a&&i&&(null==l||!l.modal))return a.addEventListener("focusin",e,!0),a.addEventListener("focusout",e,!0),()=>{a.removeEventListener("focusin",e,!0),a.removeEventListener("focusout",e,!0)};function e(e){if(a&&ha(e)){("focusin"===e.type?va:ga)(a)}}}),[a,i,null==l?void 0:l.modal]),r.createElement(wa.Provider,{value:r.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:f,portalNode:a,setFocusManagerState:s})),[i,a])},p&&a&&r.createElement(ba,{"data-type":"outside",ref:c,onFocus:e=>{if(ha(e,a)){var t;null==(t=u.current)||t.focus()}else{const e=pa(document.body,"prev")||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),p&&a&&r.createElement("span",{"aria-owns":a.id,style:ma}),a&&N(t,a),p&&a&&r.createElement(ba,{"data-type":"outside",ref:d,onFocus:e=>{if(ha(e,a)){var t;null==(t=f.current)||t.focus()}else{const t=pa(document.body,"next")||(null==l?void 0:l.refs.domReference.current);null==t||t.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,e.nativeEvent))}}}))}const Ea=()=>r.useContext(wa),Oa=new Set,Sa=r.forwardRef((function(e,t){let{lockScroll:n=!1,...o}=e;const i=la();return na((()=>{if(!n)return;Oa.add(i);const e=/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()),t=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,a=t.left?parseFloat(t.left):window.pageXOffset,l=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",o&&(t[r]=o+"px"),e){var s,c;const e=(null==(s=window.visualViewport)?void 0:s.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(l-Math.floor(n))+"px",left:-(a-Math.floor(e))+"px",right:"0"})}return()=>{Oa.delete(i),0===Oa.size&&(Object.assign(t,{overflow:"",[r]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(a,l)))}}),[i,n]),r.createElement("div",ra({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function Ca(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:o,nodeId:i}=e,[a,l]=r.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||a,c=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:l}={},transform:s=!0,whileElementsMounted:c,open:d}=e,[u,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=r.useState(o);Bi(p,o)||h(o);const[g,v]=r.useState(null),[m,y]=r.useState(null),b=r.useCallback((e=>{e!==E.current&&(E.current=e,v(e))}),[]),w=r.useCallback((e=>{e!==O.current&&(O.current=e,y(e))}),[]),x=a||g,k=l||m,E=r.useRef(null),O=r.useRef(null),S=r.useRef(u),C=null!=c,_=Mi(c),D=Mi(i),j=r.useCallback((()=>{if(!E.current||!O.current)return;const e={placement:t,strategy:n,middleware:p};D.current&&(e.platform=D.current),Ai(E.current,O.current,e).then((e=>{const t={...e,isPositioned:!0};R.current&&!Bi(S.current,t)&&(S.current=t,B.flushSync((()=>{f(t)})))}))}),[p,t,n,D]);Pi((()=>{!1===d&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const R=r.useRef(!1);Pi((()=>(R.current=!0,()=>{R.current=!1})),[]),Pi((()=>{if(x&&(E.current=x),k&&(O.current=k),x&&k){if(_.current)return _.current(x,k,j);j()}}),[x,k,j,_,C]);const A=r.useMemo((()=>({reference:E,floating:O,setReference:b,setFloating:w})),[b,w]),P=r.useMemo((()=>({reference:x,floating:k})),[x,k]),T=r.useMemo((()=>{const e={position:n,left:0,top:0};if(!P.floating)return e;const t=Ni(P.floating,u.x),r=Ni(P.floating,u.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...Ti(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,s,P.floating,u.x,u.y]);return r.useMemo((()=>({...u,update:j,refs:A,elements:P,floatingStyles:T})),[u,j,A,P,T])}(e),d=r.useContext(ca),u=null!=((null==(f=r.useContext(sa))?void 0:f.id)||null);var f;const p=function(e){const t=r.useRef((()=>{}));return ta((()=>{t.current=e})),r.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),v.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==o||o(e,t,n)})),h=r.useRef(null),g=r.useRef({}),v=r.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=la(),y=r.useCallback((e=>{const t=Ro(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c.refs.setReference(t)}),[c.refs]),b=r.useCallback((e=>{(Ro(e)||null===e)&&(h.current=e,l(e)),(Ro(c.refs.reference.current)||null===c.refs.reference.current||null!==e&&!Ro(e))&&c.refs.setReference(e)}),[c.refs]),w=r.useMemo((()=>({...c.refs,setReference:b,setPositionReference:y,domReference:h})),[c.refs,b,y]),x=r.useMemo((()=>({...c.elements,domReference:s})),[c.elements,s]),k=r.useMemo((()=>({...c,refs:w,elements:x,dataRef:g,nodeId:i,floatingId:m,events:v,open:n,onOpenChange:p})),[c,i,m,v,n,p,w,x]);return na((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===i));e&&(e.context=k)})),r.useMemo((()=>({...c,context:k,refs:w,elements:x})),[c,w,x,k])}const _a=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Da(e,t){return"function"==typeof e?e(t):e}function ja(e,t){void 0===t&&(t={});const{open:n,elements:{floating:o}}=e,{duration:i=250}=t,a=("number"==typeof i?i:i.close)||0,[l,s]=r.useState(!1),[c,d]=r.useState("unmounted"),u=function(e,t){const[n,o]=r.useState(e);return e&&!n&&o(!0),r.useEffect((()=>{if(!e){const e=setTimeout((()=>o(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,a);return na((()=>{l&&!u&&d("unmounted")}),[l,u]),na((()=>{if(o){if(n){d("initial");const e=requestAnimationFrame((()=>{d("open")}));return()=>{cancelAnimationFrame(e)}}s(!0),d("close")}}),[n,o]),{isMounted:u,status:c}}function Ra(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:o,close:i,common:a,duration:l=250}=t,s=e.placement,c=s.split("-")[0],d=r.useMemo((()=>({side:c,placement:s})),[c,s]),u="number"==typeof l,f=(u?l:l.open)||0,p=(u?l:l.close)||0,[h,g]=r.useState((()=>({...Da(a,d),...Da(n,d)}))),{isMounted:v,status:m}=ja(e,{duration:l}),y=ua(n),b=ua(o),w=ua(i),x=ua(a);return na((()=>{const e=Da(y.current,d),t=Da(w.current,d),n=Da(x.current,d),r=Da(b.current,d)||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(_a).join(","),transitionDuration:f+"ms",...n,...r}),"close"===m){const r=t||e;g({transitionProperty:Object.keys(r).map(_a).join(","),transitionDuration:p+"ms",...n,...r})}}),[p,w,y,b,x,f,m,d]),{isMounted:v,styles:h}}var Aa;function Pa(){return Pa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pa.apply(this,arguments)}var Ba=function(e){return r.createElement("svg",Pa({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Aa||(Aa=r.createElement("path",{d:"M5.804 3.123c.006.38.254.622.673.622h4.887c.59 0 .914.305.914.92v6.628l-.901-.978-.514-.514c-.267-.254-.629-.273-.895-.013-.254.26-.248.635.012.895l2.165 2.158c.476.47 1.022.47 1.498 0l2.165-2.158c.26-.26.266-.635.012-.895-.266-.26-.628-.241-.895.013l-.514.514-.895.971V4.564c0-1.358-.71-2.063-2.082-2.063H6.477c-.42 0-.68.241-.673.622ZM.186 7.06c.26.266.622.247.889-.013l.52-.508.889-.971v6.722c0 1.359.71 2.063 2.082 2.063h4.957c.42 0 .68-.241.673-.622-.006-.387-.254-.622-.673-.622h-4.88c-.591 0-.915-.311-.915-.927V5.554l.895.984.52.508c.26.26.629.28.89.013.26-.26.253-.629-.013-.89L3.855 4.013c-.476-.476-1.016-.476-1.492 0L.2 6.17c-.267.26-.273.628-.013.889Z"})))};function Ta(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}var Na=["color"],Ma=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Ta(e,Na);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M1 9.50006C1 10.3285 1.67157 11.0001 2.5 11.0001H4L4 10.0001H2.5C2.22386 10.0001 2 9.7762 2 9.50006L2 2.50006C2 2.22392 2.22386 2.00006 2.5 2.00006L9.5 2.00006C9.77614 2.00006 10 2.22392 10 2.50006V4.00002H5.5C4.67158 4.00002 4 4.67159 4 5.50002V12.5C4 13.3284 4.67158 14 5.5 14H12.5C13.3284 14 14 13.3284 14 12.5V5.50002C14 4.67159 13.3284 4.00002 12.5 4.00002H11V2.50006C11 1.67163 10.3284 1.00006 9.5 1.00006H2.5C1.67157 1.00006 1 1.67163 1 2.50006V9.50006ZM5 5.50002C5 5.22388 5.22386 5.00002 5.5 5.00002H12.5C12.7761 5.00002 13 5.22388 13 5.50002V12.5C13 12.7762 12.7761 13 12.5 13H5.5C5.22386 13 5 12.7762 5 12.5V5.50002Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),La=["color"],Ia=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Ta(e,La);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),za=["color"],Fa=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Ta(e,za);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M8.51194 3.00541C9.18829 2.54594 10.0435 2.53694 10.6788 2.95419C10.8231 3.04893 10.9771 3.1993 11.389 3.61119C11.8009 4.02307 11.9513 4.17714 12.046 4.32141C12.4633 4.95675 12.4543 5.81192 11.9948 6.48827C11.8899 6.64264 11.7276 6.80811 11.3006 7.23511L10.6819 7.85383C10.4867 8.04909 10.4867 8.36567 10.6819 8.56093C10.8772 8.7562 11.1938 8.7562 11.389 8.56093L12.0077 7.94221L12.0507 7.89929C12.4203 7.52976 12.6568 7.2933 12.822 7.0502C13.4972 6.05623 13.5321 4.76252 12.8819 3.77248C12.7233 3.53102 12.4922 3.30001 12.1408 2.94871L12.0961 2.90408L12.0515 2.85942C11.7002 2.508 11.4692 2.27689 11.2277 2.11832C10.2377 1.46813 8.94398 1.50299 7.95001 2.17822C7.70691 2.34336 7.47044 2.57991 7.1009 2.94955L7.058 2.99247L6.43928 3.61119C6.24401 3.80645 6.24401 4.12303 6.43928 4.31829C6.63454 4.51355 6.95112 4.51355 7.14638 4.31829L7.7651 3.69957C8.1921 3.27257 8.35757 3.11027 8.51194 3.00541ZM4.31796 7.14672C4.51322 6.95146 4.51322 6.63487 4.31796 6.43961C4.12269 6.24435 3.80611 6.24435 3.61085 6.43961L2.99213 7.05833L2.94922 7.10124C2.57957 7.47077 2.34303 7.70724 2.17788 7.95035C1.50265 8.94432 1.4678 10.238 2.11799 11.2281C2.27656 11.4695 2.50766 11.7005 2.8591 12.0518L2.90374 12.0965L2.94837 12.1411C3.29967 12.4925 3.53068 12.7237 3.77214 12.8822C4.76219 13.5324 6.05589 13.4976 7.04986 12.8223C7.29296 12.6572 7.52943 12.4206 7.89896 12.051L7.89897 12.051L7.94188 12.0081L8.5606 11.3894C8.75586 11.1941 8.75586 10.8775 8.5606 10.6823C8.36533 10.487 8.04875 10.487 7.85349 10.6823L7.23477 11.301C6.80777 11.728 6.6423 11.8903 6.48794 11.9951C5.81158 12.4546 4.95642 12.4636 4.32107 12.0464C4.17681 11.9516 4.02274 11.8012 3.61085 11.3894C3.19896 10.9775 3.0486 10.8234 2.95385 10.6791C2.53661 10.0438 2.54561 9.18863 3.00507 8.51227C3.10993 8.35791 3.27224 8.19244 3.69924 7.76544L4.31796 7.14672ZM9.62172 6.08558C9.81698 5.89032 9.81698 5.57373 9.62172 5.37847C9.42646 5.18321 9.10988 5.18321 8.91461 5.37847L5.37908 8.91401C5.18382 9.10927 5.18382 9.42585 5.37908 9.62111C5.57434 9.81637 5.89092 9.81637 6.08619 9.62111L9.62172 6.08558Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),Ha=["color"],Va=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Ta(e,Ha);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),$a=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},Ua={"text/plain":"Text","text/html":"Url",default:"Text"};var Ka=function(e,t){var n,r,o,i,a,l,s=!1;t||(t={}),n=t.debug||!1;try{if(o=$a(),i=document.createRange(),a=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=Ua[t.format]||Ua.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(l),i.selectNodeContents(l),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),o()}return s};const Wa=i(void 0),Ya=({children:r,tools:o})=>{const i=It(),a=d((()=>o?Object.keys(o).reduce(((e,t)=>{var n;return Object.assign(Object.assign({},e),{[t]:null===(n=o[t])||void 0===n?void 0:n.render})}),{}):{}),[o]),l=d((()=>!o||i?null:Object.keys(o).map((t=>{var n,r,i;const a=null===(n=null==o?void 0:o[t])||void 0===n?void 0:n.tool,l=null===(r=null==o?void 0:o[t])||void 0===r?void 0:r.render,s=null===(i=null==o?void 0:o[t])||void 0===i?void 0:i.props;return a?e(a,Object.assign({render:l},s),t):null}))),[o]);return e(Wa.Provider,Object.assign({value:a},{children:t(n,{children:[l,r]})}))},Xa=()=>{const e=a(Wa);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e};function qa({editor:e,view:t,onClose:n,mode:r="toggle"}){return{actions:(()=>{let t=Object.keys(e.blocks);return"toggle"===r&&(t=t.filter((t=>function(e,t){var n;const r=e.blocks[t];if(!r)return!1;const o=V(r.elements);return"void"!==(null===(n=null==o?void 0:o.props)||void 0===n?void 0:n.nodeType)}(e,t)))),t.map((t=>{var n,r,o,i,a,l;return{type:t,title:(null===(r=null===(n=e.blocks[t].options)||void 0===n?void 0:n.display)||void 0===r?void 0:r.title)||t,description:null===(i=null===(o=e.blocks[t].options)||void 0===o?void 0:o.display)||void 0===i?void 0:i.description,icon:null===(l=null===(a=e.blocks[t].options)||void 0===a?void 0:a.display)||void 0===l?void 0:l.icon}}))})(),onClose:n,empty:!1,getItemProps:t=>({onMouseEnter:()=>{},"data-action-menu-item":!0,"data-action-menu-item-type":t,"aria-selected":!1,onClick:()=>{e.toggleBlock(t,{deleteText:"toggle"===r,focus:!0}),n()}}),getRootProps:()=>({"data-action-menu-list":!0}),editor:e,view:t}}const Za=t=>{var{className:n,children:r,lockScroll:o=!0}=t,i=ue(t,["className","children","lockScroll"]);return e(Sa,Object.assign({lockScroll:o,className:n},i,{onClick:e=>{var t;e.stopPropagation(),null===(t=i.onClick)||void 0===t||t.call(i,e)},onMouseDown:e=>{var t;e.stopPropagation(),null===(t=i.onMouseDown)||void 0===t||t.call(i,e)}},{children:r}))},Ja=t=>{const[n,r]=f(!1),o=l(null),i=Nt();return c((()=>{r(!0);const e=i.refElement;if(!e)return;return e.querySelector(".yoopta-overlays")||(o.current=document.createElement("div"),o.current.className="yoopta-overlays",e.appendChild(o.current)),()=>{o.current&&o.current.remove()}}),[]),n?e(ka,Object.assign({id:`${t.id}-${i.id}`,root:o.current||i.refElement},{children:t.children})):null},Ga=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-group"},{children:t})),Qa=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"yoopta-block-options-menu-content data-[state=open]:yoo-editor-animate-in data-[state=closed]:yoo-editor-animate-out data-[state=closed]:yoo-editor-fade-out-0 data-[state=open]:yoo-editor-fade-in-0 data-[state=closed]:yoo-editor-zoom-out-95 data-[state=open]:yoo-editor-zoom-in-95 data-[side=bottom]:yoo-editor-slide-in-from-top-2 data-[side=left]:yoo-editor-slide-in-from-right-2 data-[side=right]:yoo-editor-slide-in-from-left-2 data-[side=top]:yoo-editor-slide-in-from-bottom-2"},{children:t})),el=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-item"},{children:t})),tl=["delete","duplicate","turnInto","copy"],nl=({isOpen:n,onClose:r,refs:o,style:i,actions:a=tl,children:l})=>{var s,c,d;const u=Nt(),p=Xa(),[h,g]=f(!1),{refs:v,floatingStyles:m,context:y}=Ca({placement:"right",open:h,onOpenChange:g,middleware:[Ri(),ji(),Di(),ui(10)],whileElementsMounted:_i}),{isMounted:b,styles:w}=Ra(y,{duration:100});if(!n)return null;const x=ne(u,{at:u.path.current}),k=V(null===(s=u.blocks[(null==x?void 0:x.type)||""])||void 0===s?void 0:s.elements),E="void"===(null===(c=null==k?void 0:k.props)||void 0===c?void 0:c.nodeType),O=p.ActionMenu,S=Object.assign(Object.assign({},m),w),C=qa({editor:u,view:"small",onClose:()=>{g(!1),r()}});return e(Ja,Object.assign({id:"yoo-block-options-portal"},{children:e(Za,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:r},{children:e("div",Object.assign({style:i,ref:o.setFloating,contentEditable:!1},{children:t(Qa,{children:[null!==a&&t(Ga,{children:[e(el,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{u.deleteBlock({at:u.path.current}),u.setPath({current:null}),r()}},{children:[e(Va,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Delete"]}))}),e(el,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{"number"==typeof u.path.current&&(u.duplicateBlock({original:{path:u.path.current},focus:!0}),r())}},{children:[e(Ma,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Duplicate"]}))}),!!O&&!E&&!(null===(d=u.blocks[(null==x?void 0:x.type)||""])||void 0===d?void 0:d.hasCustomEditor)&&t(el,{children:[b&&e(Ja,Object.assign({id:"yoo-block-options-portal"},{children:e(Za,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:()=>g(!1)},{children:e("div",Object.assign({style:S,ref:v.setFloating},{children:e(O,Object.assign({},C))}))}))})),t("button",Object.assign({type:"button",className:"yoopta-block-options-button",ref:v.setReference,onClick:()=>g((e=>!e))},{children:[e(Ba,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Turn into"]}))]}),e(el,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=ne(u);e&&(Ka(`${window.location.origin}${window.location.pathname}#${e.id}`),u.emit("block:copy",e)),r()}},{children:[e(Fa,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Copy link to block"]}))})]}),l]})}))}))}))};var rl=Object.freeze({__proto__:null,BlockOptions:nl,BlockOptionsMenuContent:Qa,BlockOptionsMenuGroup:Ga,BlockOptionsMenuItem:el,BlockOptionsSeparator:({className:t=""})=>e("div",{className:`yoopta-block-options-separator ${t}`})});const ol=({block:n,editor:r,dragHandleProps:o,onChangeActiveBlock:i,showActions:a})=>{const[l,s]=f(!1),{isActionMenuOpen:c,actionMenuRefs:d,hasActionMenu:u,actionMenuStyles:p,onChangeActionMenuOpen:h,onCloseActionMenu:g,actionMenuRenderProps:v,ActionMenu:y}=(({editor:e})=>{const t=Xa().ActionMenu,[n,r]=f(!1),{refs:o,floatingStyles:i,context:a}=Ca({placement:"bottom-start",open:n,onOpenChange:r,middleware:[Ri(),ji(),Di(),ui(10)],whileElementsMounted:_i}),{isMounted:l,styles:s}=Ra(a,{duration:100}),c=Object.assign(Object.assign({},i),s),d=e=>r(e),u=()=>d(!1),p=qa({editor:e,view:"default",mode:"create",onClose:u});return{isActionMenuOpen:l,actionMenuStyles:c,actionMenuRefs:o,hasActionMenu:!!t,onChangeActionMenuOpen:d,actionMenuRenderProps:p,onCloseActionMenu:u,ActionMenu:t}})({editor:r}),{refs:b,floatingStyles:x,context:k}=Ca({placement:"right-start",open:l,onOpenChange:s,middleware:[Ri(),ji(),Di(),ui()]}),{isMounted:E,styles:O}=Ra(k,{duration:100}),{setActivatorNodeRef:S,attributes:C,listeners:D}=o,j=Object.assign(Object.assign({},x),O);return t("div",Object.assign({contentEditable:!1,"data-hovered-state-open":a,className:"yoopta-block-actions"},{children:[c&&u&&e(Ja,Object.assign({id:"yoo-block-options-portal"},{children:e(Za,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:g},{children:e("div",Object.assign({style:p,ref:d.setFloating},{children:e(y,Object.assign({},v))}))}))})),e("button",Object.assign({type:"button",onClick:()=>{var e;const t=re(r,{at:n.meta.order}),o=r.blocks[n.type];if(!t)return;const i=document.querySelector(`[data-yoopta-block-id="${n.id}"]`),a=V(o.elements);let l;o.hasCustomEditor||(l=m.string(t,[0]));const s="string"==typeof l&&0===l.trim().length;if(u&&s&&"void"!==(null===(e=null==a?void 0:a.props)||void 0===e?void 0:e.nodeType))r.setPath({current:n.meta.order}),r.focusBlock(n.id),d.setReference(i),h(!0);else{const e=Ct.buildBlockData({id:I()}),t=n.meta.order+1;r.setPath({current:n.meta.order}),r.insertBlock(e.type,{at:t,focus:!0}),u&&setTimeout((()=>{i&&d.setReference(i.nextSibling),h(!0)}),0)}},className:"yoopta-block-actions-plus"},{children:e(So,{})})),e("button",Object.assign({type:"button",className:"yoopta-block-actions-drag",ref:e=>{S(e),b.setReference(e)}},C,D,{onClick:e=>{e.stopPropagation(),i(n.id);const t=re(r,{at:n.meta.order});r.focusBlock(n.id),t&&setTimeout((()=>{r.blocks[n.type].hasCustomEditor||(_.blur(t),_.deselect(t),w.deselect(t)),r.setPath({current:n.meta.order,selected:[n.meta.order]}),s(!0)}),10)},onMouseDown:e=>e.stopPropagation()},{children:e(Eo,{})})),e(nl,{isOpen:E,refs:b,style:j,onClose:()=>s(!1)})]}))},il=({children:n,block:r,blockId:i})=>{const a=Nt(),[l,s]=o.useState(null),{attributes:c,listeners:f,setNodeRef:p,setActivatorNodeRef:h,transform:g,transition:v,isOver:m,isDragging:y}=go({id:i,disabled:a.readOnly}),b=((e,t,n,r,o)=>d((()=>({container:{marginLeft:20*e.meta.depth+"px",transform:t?`translate3d(${t.x}px, ${t.y}px, 0)`:"none",transition:n,opacity:r?.7:1},content:o&&!r?{borderBottom:"2px solid #007aff"}:void 0})),[e.meta.depth,t,n,r,o]))(r,g,v,y,m),w=`yoopta-block yoopta-align-${r.meta.align||"left"}`,x=Z.isBlockSelected(a,r),k=l===i,E=u((()=>{a.readOnly||s(i)}),[a.readOnly,i]),O=u((()=>{a.readOnly||s(null)}),[a.readOnly]),S=d((()=>({setActivatorNodeRef:h,attributes:c,listeners:f})),[r]);return t("div",Object.assign({ref:p,className:w,onMouseEnter:E,onMouseLeave:O,style:b.container,"data-hovered-block":k,"data-yoopta-block":!0,"data-yoopta-block-id":i,"data-yoopta-block-type":r.type},{children:[!a.readOnly&&e(ol,{block:r,editor:a,dragHandleProps:S,showActions:k,onChangeActiveBlock:s}),e("div",Object.assign({style:b.content},{children:n})),x&&!a.readOnly&&e("div",{className:"yoopta-selection-block"})]}))};var al={};Object.defineProperty(al,"__esModule",{value:!0});for(var ll="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),sl={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},cl={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:ll?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},dl={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},ul=1;ul<20;ul++)dl["f"+ul]=111+ul;function fl(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map((function(e){return pl(e,t)})),o=function(e){return r.some((function(t){return hl(t,e)}))};return null==n?o:o(n)}function pl(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var a in sl)r[sl[a]]=!1;var l=!0,s=!1,c=void 0;try{for(var d,u=o[Symbol.iterator]();!(l=(d=u.next()).done);l=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=vl(f),g=sl[h];if(f.length>1&&!g&&!cl[f]&&!dl[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?r.key=h:r.which=gl(f)),g&&(r[g]=!p||null)}}catch(e){s=!0,c=e}finally{try{!l&&u.return&&u.return()}finally{if(s)throw c}}return r}function hl(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&((null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r))return!1}return!0}function gl(e){return e=vl(e),dl[e]||e.toUpperCase().charCodeAt(0)}function vl(e){return e=e.toLowerCase(),e=cl[e]||e}al.default=fl,al.isHotkey=fl,al.isCodeHotkey=function(e,t){return fl(e,t)};var ml=al.isKeyHotkey=function(e,t){return fl(e,{byKey:!0},t)};al.parseHotkey=pl,al.compareHotkey=hl,al.toKeyCode=gl,al.toKeyName=vl;const yl={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",shiftDelete:"shift+delete",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",shiftArrowUp:"shift+up",shiftArrowDown:"shift+down",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",cmdShiftEnter:"mod+shift+enter",slashCommand:"/",copy:"mod+c",cut:"mod+x",cmdShiftRight:"mod+shift+right",cmdShiftLeft:"mod+shift+left",cmdShiftDelete:"mod+shift+backspace",cmdShiftD:"mod+shift+d",cmdAltDelete:"mod+alt+backspace"},bl={moveLineBackward:"opt+up",moveLineForward:"opt+down",ctrlLeft:"opt+left",ctrlRight:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},wl={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},xl=e=>{const t=yl[e],n=bl[e],r=wl[e],o=t&&ml(t),i=n&&ml(n),a=r&&ml(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},kl={isBold:xl("bold"),isCompose:xl("compose"),isArrowLeft:xl("arrowLeft"),isArrowRight:xl("arrowRight"),isArrowUp:xl("arrowUp"),isArrowDown:xl("arrowDown"),isDeleteBackward:xl("deleteBackward"),isDeleteForward:xl("deleteForward"),isDeleteLineBackward:xl("deleteLineBackward"),isDeleteLineForward:xl("deleteLineForward"),isDeleteWordBackward:xl("deleteWordBackward"),isDeleteWordForward:xl("deleteWordForward"),isExtendBackward:xl("extendBackward"),isExtendForward:xl("extendForward"),isExtendLineBackward:xl("extendLineBackward"),isExtendLineForward:xl("extendLineForward"),isItalic:xl("italic"),isMoveLineBackward:xl("moveLineBackward"),isMoveLineForward:xl("moveLineForward"),isCtrlLeft:xl("ctrlLeft"),isCtrlRight:xl("ctrlRight"),isRedo:xl("redo"),isShiftEnter:xl("shiftEnter"),isEnter:xl("enter"),isTransposeCharacter:xl("transposeCharacter"),isUndo:xl("undo"),isSpace:xl("space"),isSelect:xl("select"),isTab:xl("tab"),isShiftTab:xl("shiftTab"),isBackspace:xl("backspace"),isCmdEnter:xl("cmdEnter"),isCmd:xl("cmd"),isEscape:xl("escape"),isSlashCommand:xl("slashCommand"),isShiftArrowUp:xl("shiftArrowUp"),isShiftArrowDown:xl("shiftArrowDown"),isCopy:xl("copy"),isCut:xl("cut"),isShiftDelete:xl("shiftDelete"),isCmdShiftEnter:xl("cmdShiftEnter"),isCmdShiftRight:xl("cmdShiftRight"),isCmdShiftLeft:xl("cmdShiftLeft"),isCmdShiftDelete:xl("cmdShiftDelete"),isCmdAltDelete:xl("cmdAltDelete"),isCmdShiftD:xl("cmdShiftD")};const El={onKeyDown:function(e){return t=>{const n=re(e,{at:e.path.current});if(kl.isShiftEnter(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;return t.preventDefault(),void n.insertText("\n")}if(kl.isUndo(t))t.preventDefault();else if(kl.isRedo(t))t.preventDefault();else if(kl.isEnter(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;t.preventDefault();const r=m.first(n,[]),o=m.last(n,[]),i=m.isStart(n,n.selection.anchor,r[1]),a=m.isEnd(n,n.selection.anchor,o[1]);if(O.isExpanded(n.selection)&&w.delete(n,{at:n.selection}),!i&&!a)return void e.splitBlock({slate:n,focus:!0});const l=Ct.getBlock(e,{at:e.path.current}),s=Ct.buildBlockData({id:I()}),c=m.string(n,[]),d=i&&c.length>0,u=Z.getNextPath(e);e.batchOperations((()=>{e.insertBlock(s.type,{at:d?e.path.current:u,focus:!d}),d&&l&&e.focusBlock(l.id)}))}else if(kl.isBackspace(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const r=k.parent(n.selection.anchor.path);if(m.isStart(n,n.selection.anchor,r)){t.preventDefault();if(0===m.string(n,r).trim().length)return void e.deleteBlock({at:e.path.current,focus:!0});{if(O.isExpanded(n.selection))return w.delete(n,{at:n.selection});const t=Ct.getBlock(e,{at:Z.getPreviousPath(e)}),r=Ct.getSlate(e,{id:null==t?void 0:t.id});if(t&&r){const{node:n}=function(e){const t=m.last(e,[]);return{node:t[0],path:t[1]}}(r);if(0===E.string(n).trim().length)return e.deleteBlock({blockId:t.id,focus:!1}),void e.setPath({current:t.meta.order})}e.mergeBlock()}}}else{if(kl.isSelect(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const[,r]=m.first(n,[0]),[,o]=m.last(n,[n.children.length-1]),i=m.range(n,r,o),a=O.equals(n.selection,i),l=0===m.string(n,i).trim().length;if(O.isExpanded(n.selection)&&a||l){t.preventDefault(),_.blur(n),_.deselect(n),w.deselect(n);const r=Array.from({length:Object.keys(e.children).length},((e,t)=>t));return void e.setPath({current:null,selected:r})}}if(kl.isShiftTab(t)){if(t.isDefaultPrevented())return;t.preventDefault();const n=e.path.selected;return Array.isArray(n)&&n.length>0?void e.batchOperations((()=>{n.forEach((t=>{const n=Ct.getBlock(e,{at:t});n&&n.meta.depth>0&&e.decreaseBlockDepth({at:t})}))})):void e.decreaseBlockDepth()}if(kl.isTab(t)){if(t.isDefaultPrevented())return;t.preventDefault();const n=e.path.selected;return Array.isArray(n)&&n.length>0?void e.batchOperations((()=>{n.forEach((t=>{e.increaseBlockDepth({at:t})}))})):void e.increaseBlockDepth()}if(kl.isArrowUp(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;if(1===new Set(n.selection.anchor.path).size){const n=Z.getPreviousPath(e),r=re(e,{at:n}),o=ne(e,{at:n}),i=e.blocks[(null==o?void 0:o.type)||""];if(r&&o&&!(null==i?void 0:i.hasCustomEditor)){const[,n]=m.last(r,[0]),i={path:n,offset:m.string(r,n).length};return t.preventDefault(),void e.focusBlock(o.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(kl.isArrowDown(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const r=k.parent(n.selection.anchor.path);if(m.isEnd(n,n.selection.anchor,r)){const n=Z.getNextPath(e),o=re(e,{at:n}),i=ne(e,{at:n}),a=e.blocks[(null==i?void 0:i.type)||""];if(o&&i&&!(null==a?void 0:a.hasCustomEditor)){const n=function(e,t){try{const[,n]=m.first(e,t);return{path:n,offset:0}}catch(e){return{path:[0,0],offset:0}}}(o,r);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:n,waitExecution:!1})}}}if(n&&n.selection&&O.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&ml(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},Ol=({children:t,attributes:n,placeholder:r})=>{const o=j(),i=Object.assign({},n);return o&&r&&(i["data-placeholder"]=r,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))};function Sl(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const Cl={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"italic"}},_l=["left","center","right",void 0];function Dl(e,t,n,r){var o,i;let a;if(t.parse){a=t.parse(n,e);if(y.isElement(a)&&"inline"===(null===(o=a.props)||void 0===o?void 0:o.nodeType))return a}const l=e.blocks[t.type],s=H(l.elements)||"",c=l.elements[s],d="void"===(null===(i=c.props)||void 0===i?void 0:i.nodeType);let u={id:I(),type:s,children:d&&!l.hasCustomEditor?[{text:""}]:r.map(Rl).flat(),props:Object.assign({nodeType:"block"},c.props)};if(a)if(y.isElement(a))u=a;else if(Array.isArray(a)){return a}if(0===u.children.length&&(u.children=[{text:""}]),!a&&t.parse)return;const f=n.getAttribute("data-meta-align"),p=parseInt(n.getAttribute("data-meta-depth")||"0",10);return Ct.buildBlockData({id:I(),type:t.type,value:[u],meta:{order:0,depth:p,align:_l.includes(f)?f:void 0}})}function jl(e,t,n){var r;if(3===n.nodeType){return{text:null===(r=n.textContent)||void 0===r?void 0:r.replace(/[\t\n\r\f\v]+/g," ")}}if(1!==n.nodeType)return null;if("BR"===n.nodeName)return{text:"\n"};const o=n;let i=Array.from(o.childNodes).map((n=>jl(e,t,n))).flat().filter(Boolean);if(Cl[o.nodeName]){const e=Cl[o.nodeName].type;return i.map((t=>"string"==typeof t?{[e]:!0,text:t}:t.text?Object.assign(Object.assign({},t),{[e]:!0}):t))}const a=t[o.nodeName];if(a){if(Array.isArray(a)){return a.map((t=>Dl(e,t,o,i))).filter(Boolean)}return Dl(e,a,o,i)}return i}function Rl(e){if("string"==typeof e)return{text:e};if(y.isElement(e))return e;if(Array.isArray(e))return e.map(Rl).flat();if(null==e?void 0:e.text)return e;if(Sl(e)){return e.value[0].children.map(Rl).flat()}return{text:""}}function Al(e,t){console.log("pasted html",t);const n=function(e){const t={};return Object.keys(e.plugins).forEach((n=>{const r=e.plugins[n],{parsers:o}=r;if(o){const{html:e}=o;if(e){const{deserialize:r}=e;if(r){const{nodeNames:e}=r;e&&e.forEach((e=>{const o=t[e];if(o){const i=Array.isArray(o)?o:[o];t[e]=[...i,{type:n,parse:r.parse}]}else t[e]={type:n,parse:r.parse}}))}}}})),t}(e);return jl(e,n,t).flat().filter(Sl)}function Pl(e){return!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)}const Bl=(e,t,n)=>{var r,o,i,a;(e=>{const[t]=m.nodes(e,{match:e=>!m.isEditor(e)&&y.isElement(e)&&"link"===e.type});return!!t})(t)&&(e=>{w.unwrapNodes(e,{match:e=>!m.isEditor(e)&&y.isElement(e)&&"link"===e.type})})(t);const{selection:l}=t,s=l&&O.isCollapsed(l),c=null===(a=null===(i=null===(o=null===(r=e.plugins)||void 0===r?void 0:r.LinkPlugin)||void 0===o?void 0:o.elements)||void 0===i?void 0:i.link)||void 0===a?void 0:a.props,d={type:"link",children:s?[{text:n}]:[],props:{url:n,target:(null==c?void 0:c.target)||"_self",rel:(null==c?void 0:c.rel)||"noopener noreferrer"}};s?w.insertNodes(t,d):(w.wrapNodes(t,d,{split:!0}),w.collapse(t,{edge:"end"}))},Tl=(e,t,n,r,o)=>d((()=>{let i=t.blockEditorsMap[e];const{normalizeNode:a,insertText:l,apply:s}=i,c=Object.keys(r);return c.forEach((e=>{var n;const o=null===(n=r[e].props)||void 0===n?void 0:n.nodeType,a="inline"===o,l="void"===o,s="inlineVoid"===o;s&&(i.markableVoid=t=>t.type===e),(l||s)&&(i.isVoid=t=>t.type===e),(a||s)&&(i.isInline=t=>t.type===e,i=((e,t)=>{const{insertData:n,insertText:r}=t;return t.insertText=n=>{console.log("insertText",n),console.log("insertText isUrl(text)",Pl(n)),n&&Pl(n)?Bl(e,t,n):r(n)},t.insertData=r=>{const o=r.getData("text/plain");console.log("insertData",o),console.log("insertData isUrl(text)",Pl(o)),o&&Pl(o)?Bl(e,t,o):n(r)},t})(t,i))})),i.insertText=e=>{const n=Z.getSelectedPaths(t),r=Z.getPath(t);Array.isArray(n)&&n.length>0&&t.setPath({current:r}),l(e)},i.normalizeNode=e=>{const[r,o]=e,l=t.blocks[n.type].elements;if(Object.keys(l).length>1)return a(e);if(y.isElement(r)){const{type:e}=r,t=H(l);if(!c.includes(e))return void w.setNodes(i,{type:t,props:Object.assign({},r.props)},{at:o});if(r.type===t)for(const[e,t]of E.children(i,o))if(y.isElement(e)&&!i.isInline(e))return void w.unwrapNodes(i,{at:t})}a(e)},i.apply=n=>{var r,o,a;if(C.isSelectionOperation(n)){const e=Z.getSelectedPaths(t),n=Z.getPath(t);Array.isArray(e)&&i.selection&&O.isExpanded(i.selection)&&t.setPath({current:n})}let l=jt.isSavingHistory(t);if(void 0===l&&(l=Nl(n)),l){const l=t.historyStack.undos[t.historyStack.undos.length-1];if(!l||"set_slate"!==(null===(r=null==l?void 0:l.operations[0])||void 0===r?void 0:r.type)){const r={type:"set_slate",properties:{slateOps:[n],selectionBefore:i.selection},blockId:e,slate:i};return t.applyTransforms([r],{source:"api",normalizePaths:!1}),void s(n)}const c=null===(a=null===(o=null==l?void 0:l.operations[0])||void 0===o?void 0:o.properties)||void 0===a?void 0:a.slateOps,d=c&&c[c.length-1];let u=Ml(n,d);if(0!==i.operations.length&&(u=!0),u)d!==n&&c.push(n);else{const r={operations:[n],selectionBefore:i.selection},o={type:"set_slate",properties:{slateOps:r.operations,selectionBefore:r.selectionBefore},blockId:e,slate:i};t.applyTransforms([o],{source:"api",normalizePaths:!1})}}s(n)},o&&(i=o(i,t,e)),i}),[]),Nl=e=>"set_selection"!==e.type,Ml=(e,t)=>t===e||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!k.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!k.equals(e.path,t.path))),Ll=({id:t,customEditor:n,elements:r,marks:o,events:i,options:a,extensions:s,placeholder:c="Type '/' for commands"})=>{const f=Nt(),p=Mt(t);let h=l(p.value).current;const g=d((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(r)),[r]),v=d((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(o)),[o]),y=Tl(t,f,p,r,s),b=((e,t,n,r)=>d((()=>{if(!e||t.readOnly)return{};const o=ue(e||{},["onBeforeCreate","onDestroy","onCreate"]),i={hotkeys:kl,currentBlock:n,defaultBlock:Ct.buildBlockData({id:I()})},a={};return Object.keys(o).forEach((e=>{a[e]=function(n){o[e]&&o[e](t,r,i)(n)}})),a}),[e,t,n]))(i,f,p,y),w=u((e=>{f.updateBlock(t,{value:e})}),[t]),x=u((n=>{const r=g[n.element.type],{attributes:o}=n,i=ue(n,["attributes"]);return o["data-element-type"]=i.element.type,r?e(r,Object.assign({},i,{attributes:o,blockId:t,HTMLAttributes:null==a?void 0:a.HTMLAttributes})):e(P,Object.assign({},i,{attributes:o}))}),[r]),E=u((t=>{var n,r,o,i;let{children:a,leaf:l,attributes:s}=t;const d=ue(l,["text"]),u=f.path.current===p.meta.order;d&&Object.keys(d).forEach((e=>{const t=v[e];t&&(a=t.render({children:a,leaf:l}))}));const h=!("void"===(null===(i=null===(o=null===(r=null===(n=t.children)||void 0===n?void 0:n.props)||void 0===r?void 0:r.parent)||void 0===o?void 0:o.props)||void 0===i?void 0:i.nodeType))&&u&&l.withPlaceholder;return e(Ol,Object.assign({attributes:s,placeholder:h?c:void 0},{children:a}))}),[o]),S=u((e=>{var t;f.readOnly||(null===(t=b.onKeyDown)||void 0===t||t.call(b,e),El.onKeyDown(f)(e))}),[b.onKeyDown,f.readOnly,f.path.current,p.meta.order]),C=u((e=>{var t;f.readOnly||null===(t=null==b?void 0:b.onKeyUp)||void 0===t||t.call(b,e)}),[b.onKeyUp,f.readOnly]),D=u((e=>{var t;f.readOnly||(e.preventDefault(),null===(t=null==b?void 0:b.onBlur)||void 0===t||t.call(b,e))}),[b.onBlur,f.readOnly]),j=u((e=>{var t;f.readOnly||(f.isFocused()||(ee.set(f,!0),f.emit("focus",!0)),null===(t=null==b?void 0:b.onFocus)||void 0===t||t.call(b,e))}),[b.onFocus,f.readOnly]),R=u((e=>{var t;if(f.readOnly)return;null===(t=null==b?void 0:b.onPaste)||void 0===t||t.call(b,e);const n=e.clipboardData.getData("text/html"),r=(new DOMParser).parseFromString(n,"text/html");if(console.log("parsedHTML",r),r.body.childNodes.length>0){const t=Al(f,r.body);if(t.length>0&&null!==f.path.current){e.preventDefault();let n=!1,r=!1;if(y&&y.selection){const e=k.parent(y.selection.anchor.path),t=m.string(y,e).trim(),o=m.isStart(y,y.selection.anchor,e);r=""===t&&o,n=!o||t.length>0,_.blur(y)}const o=f.path.current;if(null===o)return;return void f.batchOperations((()=>{const e=[];r&&f.deleteBlock({at:o}),t.forEach(((t,r)=>{let i=n?o+r+1:o+r;e.push(i);const a=ue(t,["type"]);f.insertBlock(t.type,{at:i,focus:!1,blockData:a})})),f.setPath({current:null,selected:e})}))}}}),[b.onPaste,f.readOnly]),A=u((e=>{const t=[];if(f.readOnly)return t;const[n,r]=e,o=f.path.current===p.meta.order;return y.selection&&o&&!m.isEditor(n)&&""===m.string(y,[r[0]])&&O.includes(y.selection,r)&&O.isCollapsed(y.selection)&&t.push(Object.assign(Object.assign({},y.selection),{withPlaceholder:!0})),t}),[f.readOnly,f.path.current,p.meta.order]);return e(Il,{id:t,slate:y,initialValue:h,onChange:w,decorate:A,renderLeaf:E,renderElement:x,eventHandlers:b,onKeyDown:S,onKeyUp:C,onFocus:j,onBlur:D,customEditor:n,readOnly:f.readOnly,onPaste:R})},Il=p((({id:t,slate:n,initialValue:r,onChange:o,renderLeaf:i,renderElement:a,eventHandlers:l,onKeyDown:s,onKeyUp:c,onFocus:d,onBlur:u,onPaste:f,customEditor:p,decorate:h,readOnly:g})=>"function"==typeof p?p({blockId:t}):e(R,Object.assign({editor:n,initialValue:r,onValueChange:o},{children:e(A,Object.assign({renderElement:a,renderLeaf:i,className:"yoopta-slate",spellCheck:!0},l,{onKeyDown:s,onKeyUp:c,onFocus:d,decorate:h,readOnly:g,onPaste:f}),`editable-${t}`)}),`slate-${t}`)));Il.displayName="SlateEditorInstance";const zl=({editor:e})=>({sensors:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d((()=>[...t].filter((e=>null!=e))),[...t])}(En(hr,{activationConstraint:{distance:20}}),En(cr,{coordinateGetter:yo})),handleDragEnd:u((t=>{const{active:n,over:r}=t;if(n&&r&&n.id!==r.id){const t=e.children[r.id].meta.order;e.moveBlock(n.id,t)}}),[]),handleDragStart:u((t=>{e.setPath({current:null})}),[])}),Fl=[],Hl=({editor:t,marks:r,placeholder:o})=>{const i=It(),{sensors:a,handleDragEnd:l,handleDragStart:s}=zl({editor:t}),c=Object.keys(t.children),u=d((()=>0===c.length?Fl:c.sort(((e,n)=>t.children[e].meta.order-t.children[n].meta.order))),[c]),f=[];for(let n=0;n<u.length;n++){const i=u[n],a=t.children[i],l=t.plugins[a.type];a&&l?f.push(e(il,Object.assign({block:a,blockId:i},{children:e(Ll,{type:a.type,id:i,marks:r,customEditor:l.customEditor,events:l.events,elements:l.elements,options:l.options,extensions:l.extensions,placeholder:o},i)}),i)):console.error(`Plugin ${a.type} not found`)}return i?e(n,{children:f}):e(Wr,Object.assign({id:"yoopta-dnd-context",sensors:a,collisionDetection:An,onDragStart:s,onDragEnd:l},{children:e(lo,Object.assign({disabled:i,items:u,strategy:oo},{children:f}))}))},Vl=({editor:e,root:t})=>{const[n,r]=f({origin:[0,0],coords:[0,0],selection:!1}),o=o=>{var i;if(e.readOnly||!1===t)return;const a=null===(i=e.refElement)||void 0===i?void 0:i.contains(o.target),s=Z.getSelectedPaths(e);if(!a&&!n.selection&&Array.isArray(s)&&s.length>0)return e.setPath({current:null}),l();a||r({origin:[o.pageX,o.pageY-window.pageYOffset],coords:[o.pageX,o.pageY-window.pageYOffset],selection:!0})},i=o=>{if(!n.selection||e.readOnly||!1===t)return;r((e=>Object.assign(Object.assign({},e),{coords:[o.pageX,o.pageY-window.pageYOffset]})));const i=((e,t,n)=>{var r;const o=[],i=null===(r=e.refElement)||void 0===r?void 0:r.querySelectorAll("[data-yoopta-block]");return i?(i.forEach(((e,r)=>{if(!e)return;const i=e.getBoundingClientRect(),a=Math.min(t[1],n[1]),l=Math.min(t[0],n[0]),s=Math.max(t[1],n[1]),c=Math.max(t[0],n[0]);a<i.bottom&&s>i.top&&l<i.right&&c>i.left&&o.push(r)})),o):o})(e,n.origin,[o.pageX,o.pageY-window.pageYOffset]);e.setPath({current:null,selected:i})},a=()=>{e.readOnly||l()};c((()=>{var n;if(e.readOnly||!1===t)return;const r=t&&"current"in t?t.current:t||document;if(!r)throw new Error("Root element not found. Please check the `selectionBoxRoot` prop");if(!("nodeType"in r))throw new Error("Root element should be a DOM element or a ref object. Please check the `selectionBoxRoot` prop");if(null===(n=e.refElement)||void 0===n?void 0:n.contains(r))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return r.addEventListener("mousedown",o),r.addEventListener("mousemove",i),r.addEventListener("mouseup",a),()=>{r.removeEventListener("mousedown",o),r.removeEventListener("mousemove",i),r.removeEventListener("mouseup",a)}}),[e.path,n,t,e.readOnly]);const l=()=>{r({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},n),{onClose:l})},$l=({origin:t,coords:n,isOpen:r})=>{if(!r)return null;const o={zIndex:10,left:t[0],top:t[1],height:Math.abs(n[1]-t[1]-1),width:Math.abs(n[0]-t[0]-1),userSelect:"none",transformOrigin:"top left",transform:t[1]>n[1]&&t[0]>n[0]?"scaleY(-1) scaleX(-1)":t[1]>n[1]?"scaleY(-1)":t[0]>n[0]?"scaleX(-1)":void 0,position:"fixed",backgroundColor:"rgba(35, 131, 226, 0.14)"};return e("div",{style:o})},Ul={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null};function Kl({editor:e}){const t=l(!1),n=l(!1),r=l(null),o=l(null);let i=l(Ul).current;const a=()=>{const t=e.path.current;if("number"==typeof t){const n=Ct.getSlate(e,{at:t}),r=Ct.getBlock(e,{at:t}),o=e.blocks[(null==r?void 0:r.type)||""];if(!n||(null==o?void 0:o.hasCustomEditor))return;try{m.withoutNormalizing(n,(()=>{w.select(n,[0]),n.selection&&O.isExpanded(n.selection)&&(_.blur(n),_.deselect(n))}))}catch(e){}}},s=i=>{if(!t.current||e.readOnly)return;const l=document.elementFromPoint(i.clientX,i.clientY),s=null==l?void 0:l.closest("[data-yoopta-block]");s&&e.batchOperations((()=>{var t;const i=s.getAttribute("data-yoopta-block-id")||"",l=null===(t=e.children[i])||void 0===t?void 0:t.meta.order;if(n.current&&"number"==typeof l&&l===r.current)return o.current=l,void e.setPath({current:l,selected:[l]});if("number"==typeof l&&l!==o.current){o.current=l,n.current=!0;const t=Math.min(r.current,l),i=Math.max(r.current,l);a();const s=Array.from({length:i-t+1},((e,n)=>t+n));e.setPath({current:l,selected:s})}}))},c=()=>{var i,a;t.current=!1,n.current=!1,r.current=null,o.current=null,null===(i=e.refElement)||void 0===i||i.removeEventListener("mousemove",s),null===(a=e.refElement)||void 0===a||a.removeEventListener("mouseup",c),null===document||void 0===document||document.removeEventListener("mouseup",c)};return{onMouseDown:n=>{e.readOnly||e.batchOperations((()=>{var i,l,d;const u=Z.getSelectedPaths(e);Array.isArray(u)&&u.length>0&&!n.shiftKey&&!n.altKey&&e.setPath({current:null});const f=n.target.closest("[data-yoopta-block]");if(f&&0===n.button){const u=f.getAttribute("data-yoopta-block-id")||"",p=null===(i=e.children[u])||void 0===i?void 0:i.meta.order;if("number"==typeof p){if(t.current=!0,r.current=p,o.current=p,n.shiftKey&&!Z.isPathEmpty(e)&&p!==e.path.current)return void(t=>{a();const n=Z.getPath(e);if("number"!=typeof n)return;const r=Array.from({length:Math.abs(t-n)}).map(((e,r)=>t>n?n+r+1:n-r-1));e.setPath({current:t,selected:[...r,n]})})(p);p!==e.path.current&&e.setPath({current:p}),null===(l=e.refElement)||void 0===l||l.addEventListener("mousemove",s),null===(d=e.refElement)||void 0===d||d.addEventListener("mouseup",c),null===document||void 0===document||document.addEventListener("mouseup",c)}}}))},onShiftArrowUp:t=>{if("function"==typeof t.isDefaultPrevented&&t.isDefaultPrevented())return;if(i.selectionStarted&&null!==i.startedIndexToSelect&&null!==i.indexToSelect){const t=i.indexToSelect,n=t-1;if(0===t)return;if(t===i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t}),void(i.indexToSelect=n)}if(n<i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t}),void(i.indexToSelect=n)}const r=Z.getSelectedPaths(e);if((null==r?void 0:r.includes(t))&&t!==i.startedIndexToSelect){const o=r.filter((e=>e!==t));return e.setPath({current:n,selected:o}),void(i.indexToSelect=n)}return}const n=ne(e),r=re(e);if(!r||!r.selection||!n)return;const o=k.parent(r.selection.anchor.path),a=m.isStart(r,r.selection.focus,o);if(O.isExpanded(r.selection)&&a){const o=Y(e);if("number"!=typeof o)return;const a=ne(e,{at:o});if(n&&a){t.preventDefault(),_.blur(r),_.deselect(r),w.deselect(r);const o=e.path.selected?[...e.path.selected,null==n?void 0:n.meta.order,n.meta.order-1]:[null==n?void 0:n.meta.order,n.meta.order-1];e.setPath({current:null,selected:o}),i.startedIndexToSelect=n.meta.order,i.indexToSelect=n.meta.order-1,i.selectionStarted=!0}}},onShiftArrowDown:t=>{if(i.selectionStarted&&null!==i.indexToSelect&&null!==i.startedIndexToSelect){const t=i.indexToSelect,n=t+1;if(n===Object.keys(e.children).length)return;if(t===i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t}),void(i.indexToSelect=n)}if(n>i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t}),void(i.indexToSelect=n)}const r=Z.getSelectedPaths(e);if((null==r?void 0:r.includes(t))&&t!==i.startedIndexToSelect){const o=r.filter((e=>e!==t));return e.setPath({current:n,selected:o}),void(i.indexToSelect=n)}return}const n=ne(e),r=re(e);if(!r||!r.selection||!n)return;const o=k.parent(r.selection.anchor.path),a=m.isEnd(r,r.selection.focus,o);if(O.isExpanded(r.selection)&&a){const o=Z.getNextPath(e),a=ne(e,{at:o});if(n&&a){t.preventDefault(),_.blur(r),_.deselect(r),w.deselect(r);const o=e.path.selected?[...e.path.selected,null==n?void 0:n.meta.order,(null==n?void 0:n.meta.order)+1]:[null==n?void 0:n.meta.order,n.meta.order+1];e.setPath({current:null,selected:o}),i.startedIndexToSelect=n.meta.order,i.indexToSelect=n.meta.order+1,i.selectionStarted=!0}}},selectionState:i}}const Wl=({placeholder:n,marks:r,className:o,selectionBoxRoot:i,width:a,style:l,children:s,autoFocus:d=!0})=>{const u=Nt(),f=It(),p=Vl({editor:u,root:i}),h=Kl({editor:u});c((()=>{d&&!f&&u.focus()}),[d,f]),c((()=>{if(!f)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)}),[u.path,f]);const g=()=>{h.selectionState.indexToSelect=null,h.selectionState.startedIndexToSelect=null,h.selectionState.selectionStarted=!1},v=e=>{if(!f){if(kl.isRedo(e))return e.preventDefault(),void u.redo();if(kl.isUndo(e))return e.preventDefault(),void u.undo();if(kl.isSelect(e)){const t=Z.getSelectedPaths(u);if((null==t?void 0:t.length)===Object.keys(u.children).length)return void e.preventDefault();if(Array.isArray(t)&&t.length>0){e.preventDefault();const t=Object.keys(u.children).map(((e,t)=>t));return void u.setPath({current:null,selected:t})}}if(kl.isCopy(e)||kl.isCut(e)){const t=Z.getSelectedPaths(u);if(Array.isArray(t)&&t.length>0){e.preventDefault();const t=u.getHTML(u.getEditorValue()),n=u.getPlainText(u.getEditorValue()),r=new Blob([t],{type:"text/html"}),o=new Blob([n],{type:"text/plain"}),i=new ClipboardItem({"text/html":r,"text/plain":o});return navigator.clipboard.write([i]).then((()=>{const e=(new DOMParser).parseFromString(t,"text/html");console.log("HTML copied\n",e.body)})),void(kl.isCut(e)&&(u.batchOperations((()=>{const e=Z.getSelectedPaths(u);if(Array.isArray(e)&&e.length>0){const t=e.length===Object.keys(u.children).length;if(e.forEach((e=>{var t;const n=null===(t=Ct.getBlock(u,{at:e}))||void 0===t?void 0:t.id;n&&u.deleteBlock({blockId:n})})),t){const e=F({id:I()});u.insertBlock(e.type,{at:0,focus:!0})}}})),u.setPath({current:null,selected:null}),g()))}}if(kl.isBackspace(e)){e.stopPropagation();const t=Z.getSelectedPaths(u);return(null==t?void 0:t.length)===Object.keys(u.children).length?(e.preventDefault(),void u.batchOperations((()=>{Object.keys(u.children).forEach((e=>u.deleteBlock({blockId:e}))),u.setPath({current:null,selected:null}),g()}))):void u.batchOperations((()=>{const t=Z.getSelectedPaths(u);Array.isArray(t)&&(null==t?void 0:t.length)>0&&(e.preventDefault(),t.forEach((e=>u.deleteBlock({at:e}))),u.setPath({current:null,selected:null}),g())}))}if(kl.isShiftArrowUp(e)&&h.onShiftArrowUp(e),kl.isShiftArrowDown(e)&&h.onShiftArrowDown(e),kl.isTab(e)){const t=Z.getSelectedPaths(u);Array.isArray(t)&&t.length>0&&(e.preventDefault(),u.batchOperations((()=>{t.forEach((e=>{const t=Ct.getBlock(u,{at:e});u.increaseBlockDepth({blockId:null==t?void 0:t.id})}))})))}else if(kl.isShiftTab(e)){const t=Z.getSelectedPaths(u);Array.isArray(t)&&t.length>0&&(e.preventDefault(),u.batchOperations((()=>{t.forEach((e=>{const t=Ct.getBlock(u,{at:e});u.decreaseBlockDepth({blockId:null==t?void 0:t.id})}))})))}else;}},b=e=>{if(!f)return;const t=e.clipboardData,n=window.getSelection();if(n&&n.rangeCount>0){const e=n.getRangeAt(0);if(e.collapsed)return;const r=e.cloneContents().querySelectorAll("[data-yoopta-block-id]");if(!r.length)return;const o=Array.from(r).reduce(((e,t)=>{const n=t.getAttribute("data-yoopta-block-id")||"",r=u.children[n];return r&&(e[n]=r),e}),{}),i=u.getHTML(o),a=u.getPlainText(o);return t.setData("text/html",i),void t.setData("text/plain",a)}},w=(x={userSelect:p.selection?"none":"auto",pointerEvents:p.selection?"none":"auto",width:a||(null==l?void 0:l.width),paddingBottom:null==l?void 0:l.paddingBottom},Object.assign(Object.assign({},x),{width:x.width||400,paddingBottom:"number"==typeof x.paddingBottom?x.paddingBottom:100}));var x;return t("div",Object.assign({ref:e=>u.refElement=e,className:o?`yoopta-editor ${o}`:"yoopta-editor",style:w,onMouseDown:e=>{f||(h.onMouseDown(e),g(),(e=>{var t;const n=u.refElement;if(!n)return;const{bottom:r}=n.getBoundingClientRect(),o=r-parseInt(getComputedStyle(n).paddingBottom,10),i=F({id:I()});if(e.clientY>=o){const e=Object.keys(u.children).length-1,n=ne(u,{at:e}),r=re(u,{at:e});if(n&&r&&r.selection){const e=m.string(r,r.selection.anchor.path),o=k.parent(r.selection.anchor.path),[a]=m.node(r,o);if(n.type===i.type&&y.isElement(a)&&"void"!==(null===(t=a.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void u.focusBlock(n.id,{slate:r})}const o=e+1;u.insertBlock(i.type,{at:o,focus:!0})}})(e))},onBlur:e=>{var t;if((null===(t=u.refElement)||void 0===t?void 0:t.contains(e.relatedTarget))||f)return;g();const n=Z.getSelectedPaths(u);Array.isArray(n)&&n.length>0&&u.setPath({current:null,selected:null})},onCopy:b,onCut:b},{children:[e(Hl,{editor:u,marks:r,placeholder:n}),!1!==i&&e($l,{origin:p.origin,coords:p.coords,isOpen:p.selection&&!f}),s]}))};function Yl({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}const Xl=Yl({type:"fakeSelection",render:t=>e("span",Object.assign({style:{backgroundColor:"#d7e6fa"}},{children:t.children}))}),ql=(()=>{const e=I();return{[e]:F({id:e})}})(),Zl=new Vt,Jl=(e,t)=>Zl.on(e,t),Gl=(e,t)=>Zl.once(e,t),Ql=(e,t)=>Zl.off(e,t),es=(e,t)=>Zl.emit(e,t);const ts=({id:t,editor:n,value:r,marks:o,plugins:i,autoFocus:a,className:l,tools:s,selectionBoxRoot:p,children:h,placeholder:g,readOnly:v,width:m,style:y,onChange:b})=>{const w=d((()=>o?[Xl,...o]:[Xl]),[o]),x=d((()=>i.map((e=>e.getPlugin))),[i]),[k,E]=f((()=>{n.id||(n.id=t||I()),n.readOnly=v||!1,w&&(n.formats=ge(n,w)),n.blocks=function(e,t){const n={};return t.forEach((t=>{var r;const o=V(t.elements),i=null===(r=null==o?void 0:o.props)||void 0===r?void 0:r.nodeType;if("inline"!==i&&"inlineVoid"!==i){const r={};Object.keys(t.elements).forEach((e=>{const n=ue(t.elements[e],["render"]);r[e]=n}));const{display:o,placeholder:i,shortcuts:a}=t.options||{};n[t.type]={type:t.type,elements:r,hasCustomEditor:!!t.customEditor,options:{display:o,placeholder:i,shortcuts:a},isActive:()=>{const n=ne(e,{at:e.path.current});return(null==n?void 0:n.type)===t.type}}}})),n}(n,x);const e=function(e){return!!e&&"object"==typeof e&&0!==Object.keys(e).length}(r);return e||void 0===r||console.error(`Initial value is not valid. Should be an object with blocks. You passed: ${JSON.stringify(r)}`),n.children=e?r:ql,n.blockEditorsMap=ve(n),n.shortcuts=function(e){const t={};return Object.values(e.blocks).forEach((e=>{var n,r,o,i;e.options&&Array.isArray(null===(n=e.options)||void 0===n?void 0:n.shortcuts)&&(null===(r=e.options)||void 0===r?void 0:r.shortcuts.length)>0&&(null===(i=null===(o=e.options)||void 0===o?void 0:o.shortcuts)||void 0===i||i.forEach((n=>{t[n]=e})))})),t}(n),n.plugins=function(e){const t={},n={};return e.forEach((e=>{e.elements&&Object.keys(e.elements).forEach((t=>{var r;const o=e.elements[t],i=null===(r=o.props)||void 0===r?void 0:r.nodeType;"inline"!==i&&"inlineVoid"!==i||(n[t]=Object.assign(Object.assign({},o),{rootPlugin:e.type}))})),t[e.type]=e})),e.forEach((e=>{if(e.elements){const r=Object.assign(Object.assign({},e.elements),n);t[e.type]=Object.assign(Object.assign({},e),{elements:r})}})),t}(x),n.commands=function(e,t){const n={};return t.forEach((t=>{t.commands&&Object.keys(t.commands).forEach((r=>{var o;(null===(o=t.commands)||void 0===o?void 0:o[r])&&(n[r]=(...n)=>{var o;return null===(o=t.commands)||void 0===o?void 0:o[r](e,...n)})}))})),n}(n,x),n.on=Jl,n.once=Gl,n.off=Ql,n.emit=es,{editor:n,version:0}})),[O,S]=f(null),C=u((e=>{S(e)}),[]),_=u(((e,t)=>{if(E((e=>({editor:e.editor,version:e.version+1}))),"function"==typeof b&&Array.isArray(t.operations)){const n=t.operations.filter((e=>"normalize_block_paths"!==e.type&&"set_block_path"!==e.type&&"set_slate"!==e.type));n.length>0&&b(e,{operations:n})}}),[]);return c((()=>{const e=e=>{_(e.value,{operations:e.operations})};return n.on("change",e),n.on("path-change",C),()=>{n.off("change",e),n.off("path-change",C)}}),[n,_]),e(Tt,Object.assign({editorState:k},{children:e(Ya,Object.assign({tools:s},{children:e(Wl,Object.assign({placeholder:g,marks:w,autoFocus:a,className:l,selectionBoxRoot:p,width:m,style:y},{children:h}))}))}))},ns=Object.assign(Object.assign({},rl),{ExtendedBlockActions:({id:r,className:o,style:i,onClick:a,children:l})=>{const s=It(),[c,d]=f(!1),{refs:u,floatingStyles:p,context:h}=Ca({placement:"bottom-start",open:c,onOpenChange:d,middleware:[Ri(),ji(),Di(),ui(10)],whileElementsMounted:_i}),{isMounted:g,styles:v}=Ra(h,{duration:100}),m=Object.assign(Object.assign({},v),p);return s?null:t(n,{children:[g&&e(nl,Object.assign({isOpen:!0,onClose:()=>d(!1),refs:u,style:m},{children:l})),e("button",Object.assign({type:"button",contentEditable:!1,ref:u.setReference,id:r,className:`yoopta-button yoopta-extended-block-actions ${o||""}`,onClick:()=>{null==a||a(),d(!0)},style:c?Object.assign(Object.assign({},i),{opacity:1}):i},{children:e(Ia,{})}))]})},Portal:Ja,Overlay:Za});function rs(e,t){var n;const r=[];return t.forEach((t=>{if(t.nodeType===Node.TEXT_NODE&&r.push({text:t.textContent||""}),t.nodeType===Node.ELEMENT_NODE){const n=t;"P"!==n.nodeName&&"SPAN"!==n.nodeName&&"DIV"!==n.nodeName||r.push(Object.assign({},rs(e,n.childNodes)[0])),"B"!==n.nodeName&&"STRONG"!==n.nodeName||r.push(Object.assign({bold:!0},rs(e,n.childNodes)[0])),"I"!==n.nodeName&&"EM"!==n.nodeName||r.push(Object.assign({italic:!0},rs(e,n.childNodes)[0])),"S"!==n.nodeName&&"STRIKE"!==n.nodeName||r.push(Object.assign({strike:!0},rs(e,n.childNodes)[0])),"U"!==n.nodeName&&"INS"!==n.nodeName||r.push(Object.assign({underline:!0},rs(e,n.childNodes)[0])),"CODE"===n.nodeName&&r.push(Object.assign({code:!0},rs(e,n.childNodes)[0])),"A"===n.nodeName&&r.push({id:I(),type:"link",props:{url:n.getAttribute("href")||"",target:n.getAttribute("target")||"",rel:n.getAttribute("rel")||""},children:rs(e,n.childNodes)})}})),0!==r.length||(null===(n=r[0])||void 0===n?void 0:n.text)||r.push({text:""}),r}function os(e){return e.map((e=>{if("text"in e){let t=e.text;return e.bold&&(t=`<b>${t}</b>`),e.italic&&(t=`<i>${t}</i>`),e.strike&&(t=`<s>${t}</s>`),e.underline&&(t=`<u>${t}</u>`),e.code&&(t=`<code>${t}</code>`),t}if("link"===e.type){const{url:t,target:n,rel:r}=e.props;return`<a href="${t}" target="${n}" rel="${r}">${os(e.children)}</a>`}return""})).join("")}function is(e){return e.map((e=>{if("text"in e){let t=e.text;return e.bold&&(t=`**${t}**`),e.italic&&(t=`*${t}*`),e.strike&&(t=`~~${t}~~`),e.underline&&(t=`<u>${t}</u>`),e.code&&(t=`\`${t}\``),t}if("link"===e.type){const{url:t,target:n,rel:r}=e.props;return`[${is(e.children)}](${t})`}return""})).join("")}!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-editor-z-\\[100\\]{z-index:100}.yoo-editor-mr-2{margin-right:.5rem}.yoo-editor-h-4{height:1rem}.yoo-editor-w-4{width:1rem}.yoopta-editor *{border:0 solid #e5e7eb;box-sizing:border-box;scrollbar-color:#d3d1cb transparent}::-moz-selection{background:#c6ddf8}::selection{background:#c6ddf8}.yoopta-placeholder{display:contents;position:relative}.yoopta-placeholder:after{color:inherit;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;opacity:.5;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-button{background-color:transparent;border-style:none;cursor:pointer}.yoopta-block{border-radius:.25rem;margin-bottom:1px;margin-top:2px;padding:0 2px;position:relative}.yoopta-selection-block{background-color:#2383e224;border-radius:.25rem;height:100%;left:0;opacity:1;pointer-events:none;position:absolute;top:0;width:100%;z-index:90}.yoopta-block-actions{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yoopta-block-actions[data-hovered-state-open=true]{opacity:1}.yoopta-block-actions-plus{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:24px}.yoopta-block-actions-plus:active,.yoopta-block-actions-plus:focus,.yoopta-block-actions-plus:hover{background-color:#37362f14}.yoopta-block-actions-drag{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:18px}.yoopta-block-actions-drag:active,.yoopta-block-actions-drag:focus,.yoopta-block-actions-drag:hover{background-color:#37362f14}.yoopta-slate:focus{outline:2px solid transparent;outline-offset:2px}.yoopta-slate:focus-visible{outline:2px solid transparent;outline-offset:2px}.yoopta-block-options-button{background-color:transparent;border-radius:.125rem;border-style:none;cursor:pointer;display:flex;justify-content:flex-start;line-height:120%;margin-left:4px;margin-right:4px;padding:.375rem .5rem;width:100%}.yoopta-block-options-button:hover{background-color:#37352f14}.yoopta-block-options-item{align-items:center;cursor:default;display:flex;font-size:.875rem;line-height:1.25rem;outline:2px solid transparent;outline-offset:2px;position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-block-options-item[data-disabled]{opacity:.5;pointer-events:none}.yoopta-extended-block-actions{--tw-bg-opacity:1;align-items:center;background-color:rgb(238 238 238/var(--tw-bg-opacity));border-radius:2px;border-style:none;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:1;padding:0 4px;position:absolute;right:8px;top:8px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,1,1);width:22px;z-index:10}.yoopta-block-options-separator{background-color:#37352f14;height:1px;margin-bottom:4px;margin-top:4px;width:100%}.yoopta-block-options-menu-content{--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);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(229 231 235/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);min-width:200px;overflow:hidden;padding:6px 0;position:relative;width:auto}.yoopta-block-options-group{display:flex;flex-direction:column}.yoopta-align-left{justify-content:flex-start;text-align:left}.yoopta-align-center{justify-content:center;text-align:center}.yoopta-align-right{justify-content:flex-end;text-align:right}");export{Ct as Blocks,Et as Elements,kl as HOTKEYS,Z as Paths,ns as UI,M as YooptaPlugin,F as buildBlockData,z as buildBlockElement,K as buildBlockElementsStructure,pe as buildSlateEditor,At as createYooptaEditor,Yl as createYooptaMark,ts as default,rs as deserializeTextNodes,ne as findPluginBlockByPath,re as findSlateBySelectionPath,I as generateId,V as getRootBlockElement,H as getRootBlockElementType,os as serializeTextNodes,is as serializeTextNodesIntoMarkdown,Mt as useBlockData,Ft as useBlockSelected,Nt as useYooptaEditor,Lt as useYooptaFocused,zt as useYooptaPluginOptions,It as useYooptaReadOnly,Xa as useYooptaTools};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/editor",
|
|
3
|
-
"version": "4.8.5-rc.
|
|
3
|
+
"version": "4.8.5-rc.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"url": "https://github.com/Darginec05/Yoopta-Editor/issues"
|
|
67
67
|
},
|
|
68
68
|
"homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "16e680541fb96cef3ad759cb78e653eb6f9ae95e"
|
|
70
70
|
}
|