mirror of
https://github.com/standardnotes/app
synced 2026-09-13 00:45:26 -04:00
Compare commits
199
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4f9a18135 | ||
|
|
65c16ed246 | ||
|
|
852ddc677d | ||
|
|
17458b61d1 | ||
|
|
03da45537d | ||
|
|
7332f10ff4 | ||
|
|
b6eda707bd | ||
|
|
a37e095907 | ||
|
|
ef81e9d97e | ||
|
|
c6a31f209d | ||
|
|
292153333f | ||
|
|
6cef772212 | ||
|
|
f4ab9b0d97 | ||
|
|
73eba38c14 | ||
|
|
4b19076f9b | ||
|
|
da9c412703 | ||
|
|
9784ff0173 | ||
|
|
d8df19b0bd | ||
|
|
da16a779ce | ||
|
|
473fb6be53 | ||
|
|
d5cac8e32d | ||
|
|
45ca99c627 | ||
|
|
8a6e123fbc | ||
|
|
914c444349 | ||
|
|
bf8ad837ef | ||
|
|
e3ae421f7c | ||
|
|
a162294d04 | ||
|
|
f0613e7af5 | ||
|
|
7967ddead7 | ||
|
|
f868989bb5 | ||
|
|
eb5e5e11e0 | ||
|
|
0d1831ea49 | ||
|
|
a22000242a | ||
|
|
4068d5b480 | ||
|
|
fd0d08c153 | ||
|
|
adef74f23f | ||
|
|
b90c725f96 | ||
|
|
74b459cae0 | ||
|
|
c1e9a7fe40 | ||
|
|
edf8de4468 | ||
|
|
bb81c8acfc | ||
|
|
414a2dda0b | ||
|
|
45c661c136 | ||
|
|
c5ca4a9857 | ||
|
|
56813909bb | ||
|
|
7a4172ad11 | ||
|
|
e97e788b5f | ||
|
|
20a9ef0dad | ||
|
|
670f27b9cd | ||
|
|
f45d854006 | ||
|
|
5043b4c110 | ||
|
|
e1981f4eae | ||
|
|
3fb6d10a7f | ||
|
|
498cd1b27c | ||
|
|
6d872cd45a | ||
|
|
9e2d496804 | ||
|
|
7febc1fac6 | ||
|
|
6f571936c3 | ||
|
|
065f3562f4 | ||
|
|
41f542d1c5 | ||
|
|
94840a7afb | ||
|
|
fb19b37d5b | ||
|
|
3b2f761661 | ||
|
|
b28b59e4a0 | ||
|
|
9238759d38 | ||
|
|
d2404ba276 | ||
|
|
7301acd36c | ||
|
|
bf997e356c | ||
|
|
c151c3c6d7 | ||
|
|
6af7f66f46 | ||
|
|
1d0e8cfc7f | ||
|
|
f3f5c63185 | ||
|
|
1651a24370 | ||
|
|
e6b6674407 | ||
|
|
7aaa92ba57 | ||
|
|
612df361d7 | ||
|
|
d23f3ba4d5 | ||
|
|
43dd51b7e5 | ||
|
|
e4d85d50c9 | ||
|
|
4bd44c3a6a | ||
|
|
c42bfdcd2a | ||
|
|
89491870eb | ||
|
|
f797128e32 | ||
|
|
2acb7e3808 | ||
|
|
f8e3c4bbbd | ||
|
|
06ca2bdedb | ||
|
|
f9be8b3d03 | ||
|
|
fa2543b188 | ||
|
|
eb8794823c | ||
|
|
d4c94a67e2 | ||
|
|
3e78e6faf1 | ||
|
|
c85d7b556c | ||
|
|
5d14abe9d7 | ||
|
|
8aa4729233 | ||
|
|
8e11227e8e | ||
|
|
d6cb83a2bb | ||
|
|
a455304a7a | ||
|
|
74da19add8 | ||
|
|
e46f1b3c39 | ||
|
|
84ee718330 | ||
|
|
015660a2b3 | ||
|
|
9a7c947038 | ||
|
|
7c0bf5a9a7 | ||
|
|
d13b51697e | ||
|
|
47745cb79c | ||
|
|
85c401fa6e | ||
|
|
79374f017b | ||
|
|
bfbf9ab8ce | ||
|
|
3d1a038393 | ||
|
|
8542616a5d | ||
|
|
51600f15ad | ||
|
|
306a5e93b8 | ||
|
|
77f692fe66 | ||
|
|
32c5005b0c | ||
|
|
1ebe036149 | ||
|
|
6893f02652 | ||
|
|
345d188fbb | ||
|
|
c3dad5ae8d | ||
|
|
11a17086ac | ||
|
|
5f6c8dedf2 | ||
|
|
e81cf1f1e0 | ||
|
|
2d168a68cf | ||
|
|
700a9953dc | ||
|
|
8f15652ba1 | ||
|
|
1c6b31f643 | ||
|
|
19a515ee6e | ||
|
|
16c21f40d1 | ||
|
|
4c21a61dcf | ||
|
|
cfde0fd9b8 | ||
|
|
28825bc2ee | ||
|
|
b07abaa5df | ||
|
|
50c1977410 | ||
|
|
703a2898ac | ||
|
|
e1905fa121 | ||
|
|
9c73a23ca0 | ||
|
|
2950aaa09a | ||
|
|
3c0370aae2 | ||
|
|
9854ca898e | ||
|
|
8977da3960 | ||
|
|
5a49005e79 | ||
|
|
865ebe58d3 | ||
|
|
07cba245c1 | ||
|
|
dc22101a7c | ||
|
|
70ec1f1b54 | ||
|
|
c858e516bb | ||
|
|
853fab53ab | ||
|
|
ff3c45ba35 | ||
|
|
289849724a | ||
|
|
cf0a7a6bf1 | ||
|
|
cfa2e75adc | ||
|
|
418d1a7371 | ||
|
|
813304c959 | ||
|
|
ba236a2f2b | ||
|
|
2757884d10 | ||
|
|
f2bcab6131 | ||
|
|
327f732adc | ||
|
|
909ab8ffad | ||
|
|
814afc3e6d | ||
|
|
2d68fb7c7d | ||
|
|
5463b7b58e | ||
|
|
b53ae1d09b | ||
|
|
cb083e2a05 | ||
|
|
f3276e2876 | ||
|
|
396ee3f449 | ||
|
|
c6060aaab3 | ||
|
|
29a50f9353 | ||
|
|
6b7d260dda | ||
|
|
2156e77135 | ||
|
|
1bca31cdcb | ||
|
|
d91402e673 | ||
|
|
766f156c89 | ||
|
|
cf4b5ccf0a | ||
|
|
3d895ca499 | ||
|
|
7bafde5be7 | ||
|
|
9ccbea8e0a | ||
|
|
2298a551ed | ||
|
|
65d68f8080 | ||
|
|
130b63b1a5 | ||
|
|
ee895ad44d | ||
|
|
14a82941b8 | ||
|
|
6e1d7926c3 | ||
|
|
b7f8105cd6 | ||
|
|
04106b3e15 | ||
|
|
23efad85df | ||
|
|
acd20dcc70 | ||
|
|
604f341f8f | ||
|
|
afaf53a7a4 | ||
|
|
121d07288a | ||
|
|
b5a6e60146 | ||
|
|
bf18d242bf | ||
|
|
64351dd304 | ||
|
|
bc0f444ed8 | ||
|
|
83cefb3492 | ||
|
|
423c62bc8e | ||
|
|
9019e6de81 | ||
|
|
bcafb4a905 | ||
|
|
8a3fab1024 | ||
|
|
990baf2a06 | ||
|
|
948dd117d3 |
@@ -77,8 +77,12 @@ jobs:
|
||||
- name: Export version from package.json
|
||||
run:
|
||||
echo "PACKAGE_VERSION=$(grep '"version"' ../web/package.json | cut -d '"' -f 4 | cut -d "-" -f 1)" >> $GITHUB_ENV
|
||||
- name: Ruby Setup for Fastlane
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
working-directory: 'packages/mobile'
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable && yarn install:pods
|
||||
run: yarn install --immutable && bundle install && yarn install:pods
|
||||
- run: yarn build:mobile
|
||||
- name: Set ssh connection to Github
|
||||
uses: webfactory/[email protected]
|
||||
@@ -86,10 +90,6 @@ jobs:
|
||||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
- name: Export Apple AppStore Connect API key
|
||||
run: echo "${{ secrets.APPSTORE_CONNECT_KEY }}" > ios/Authkey.p8
|
||||
- name: Ruby Setup for Fastlane
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
working-directory: 'packages/mobile'
|
||||
- name: Setup fastlane
|
||||
uses: maierj/[email protected]
|
||||
env:
|
||||
|
||||
@@ -103,6 +103,44 @@ jobs:
|
||||
trigger_workflow: true
|
||||
wait_workflow: true
|
||||
|
||||
publish-web-docker:
|
||||
name: Build and publish Docker Image for Web App
|
||||
needs: [e2e-base, e2e-vaults]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.CI_PAT_TOKEN }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Build
|
||||
run: yarn build:web
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Publish SNJS Docker image for E2E testing
|
||||
run: |
|
||||
cd packages/web
|
||||
docker build -t standardnotes/web:${{ github.sha }} .
|
||||
docker tag standardnotes/web:${{ github.sha }} standardnotes/web:latest
|
||||
docker push standardnotes/web:${{ github.sha }}
|
||||
docker push standardnotes/web:latest
|
||||
|
||||
publish:
|
||||
name: Publish to NPM
|
||||
needs: [e2e-base, e2e-vaults]
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -1,85 +0,0 @@
|
||||
diff --git a/LexicalClipboard.dev.js b/LexicalClipboard.dev.js
|
||||
index 7f30124aa6bd71a27b171275c1bf7d366f6c1c95..f96c13e8e8c965e9cd485d0d2069f1ea096d92c4 100644
|
||||
--- a/LexicalClipboard.dev.js
|
||||
+++ b/LexicalClipboard.dev.js
|
||||
@@ -102,7 +102,7 @@ function $insertDataTransferForPlainText(dataTransfer, selection) {
|
||||
* @param selection the selection to use as the insertion point for the content in the DataTransfer object
|
||||
* @param editor the LexicalEditor the content is being inserted into.
|
||||
*/
|
||||
-function $insertDataTransferForRichText(dataTransfer, selection, editor) {
|
||||
+function $insertDataTransferForRichText(dataTransfer, selection, editor, event) {
|
||||
const lexicalString = dataTransfer.getData('application/x-lexical-editor');
|
||||
if (lexicalString) {
|
||||
try {
|
||||
@@ -115,15 +115,18 @@ function $insertDataTransferForRichText(dataTransfer, selection, editor) {
|
||||
// Fail silently.
|
||||
}
|
||||
}
|
||||
- const htmlString = dataTransfer.getData('text/html');
|
||||
- if (htmlString) {
|
||||
- try {
|
||||
- const parser = new DOMParser();
|
||||
- const dom = parser.parseFromString(htmlString, 'text/html');
|
||||
- const nodes = html.$generateNodesFromDOM(editor, dom);
|
||||
- return $insertGeneratedNodes(editor, nodes, selection);
|
||||
- } catch (_unused2) {
|
||||
- // Fail silently.
|
||||
+ const shouldIgnoreHTML = event && event.inputType === 'insertReplacementText' && dataTransfer.types.includes('text/plain');
|
||||
+ if (!shouldIgnoreHTML) {
|
||||
+ const htmlString = dataTransfer.getData('text/html');
|
||||
+ if (htmlString) {
|
||||
+ try {
|
||||
+ const parser = new DOMParser();
|
||||
+ const dom = parser.parseFromString(htmlString, 'text/html');
|
||||
+ const nodes = html.$generateNodesFromDOM(editor, dom);
|
||||
+ return $insertGeneratedNodes(editor, nodes, selection);
|
||||
+ } catch (_unused2) {
|
||||
+ // Fail silently.
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/LexicalClipboard.prod.js b/LexicalClipboard.prod.js
|
||||
index e4d91576b7802dd4c53276049ff4116c97b697a1..ca25d060e213c89663b656ee0a72716ebd4b343b 100644
|
||||
--- a/LexicalClipboard.prod.js
|
||||
+++ b/LexicalClipboard.prod.js
|
||||
@@ -7,15 +7,15 @@
|
||||
'use strict';var d=require("@lexical/html"),q=require("@lexical/selection"),r=require("@lexical/utils"),u=require("lexical");function z(a){let b=new URLSearchParams;b.append("code",a);for(let c=1;c<arguments.length;c++)b.append("v",arguments[c]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${b} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
|
||||
let A="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement;function B(a){let b=u.$getSelection();if(null==b)throw Error("Expected valid LexicalSelection");return u.$isRangeSelection(b)&&b.isCollapsed()||0===b.getNodes().length?"":d.$generateHtmlFromNodes(a,b)}
|
||||
function C(a){let b=u.$getSelection();if(null==b)throw Error("Expected valid LexicalSelection");return u.$isRangeSelection(b)&&b.isCollapsed()||0===b.getNodes().length?null:JSON.stringify(D(a,b))}
|
||||
-function E(a,b,c){let g=u.DEPRECATED_$isGridSelection(c),e=u.$isRangeSelection(c);(g||e&&null!==r.$findMatchingParent(c.anchor.getNode(),h=>u.DEPRECATED_$isGridCellNode(h))&&null!==r.$findMatchingParent(c.focus.getNode(),h=>u.DEPRECATED_$isGridCellNode(h)))&&1===b.length&&u.DEPRECATED_$isGridNode(b[0])?F(b,c,!1,a):c.insertNodes(b)}
|
||||
-function F(a,b,c,g){1===a.length&&u.DEPRECATED_$isGridNode(a[0])||z(42);var e=a[0];a=e.getChildren();c=e.getFirstChildOrThrow().getChildrenSize();var h=e.getChildrenSize(),f=r.$findMatchingParent(b.anchor.getNode(),l=>u.DEPRECATED_$isGridCellNode(l));b=(e=f&&r.$findMatchingParent(f,l=>u.DEPRECATED_$isGridRowNode(l)))&&r.$findMatchingParent(e,l=>u.DEPRECATED_$isGridNode(l));u.DEPRECATED_$isGridCellNode(f)&&u.DEPRECATED_$isGridRowNode(e)&&u.DEPRECATED_$isGridNode(b)||z(43);var k=e.getIndexWithinParent(),
|
||||
-m=Math.min(b.getChildrenSize()-1,k+h-1);h=f.getIndexWithinParent();f=Math.min(e.getChildrenSize()-1,h+c-1);c=Math.min(h,f);e=Math.min(k,m);h=Math.max(h,f);k=Math.max(k,m);m=b.getChildren();f=0;let n,p;for(let l=e;l<=k;l++){var t=m[l];u.DEPRECATED_$isGridRowNode(t)||z(24);var y=a[f];u.DEPRECATED_$isGridRowNode(y)||z(24);t=t.getChildren();y=y.getChildren();let G=0;for(let v=c;v<=h;v++){let w=t[v];u.DEPRECATED_$isGridCellNode(w)||z(25);let H=y[G];u.DEPRECATED_$isGridCellNode(H)||z(25);l===e&&v===c?n=
|
||||
-w.getKey():l===k&&v===h&&(p=w.getKey());let M=w.getChildren();H.getChildren().forEach(x=>{u.$isTextNode(x)&&u.$createParagraphNode().append(x);w.append(x)});M.forEach(x=>x.remove());G++}f++}n&&p&&(a=u.DEPRECATED_$createGridSelection(),a.set(b.getKey(),n,p),u.$setSelection(a),g.dispatchCommand(u.SELECTION_CHANGE_COMMAND,void 0))}
|
||||
-function I(a,b,c,g=[]){let e=null!=b?c.isSelected(b):!0,h=u.$isElementNode(c)&&c.excludeFromCopy("html");var f=c;if(null!==b){var k=q.$cloneWithProperties(c);f=k=u.$isTextNode(k)&&null!=b?q.$sliceSelectedTextNodeContent(b,k):k}let m=u.$isElementNode(f)?f.getChildren():[];var n=f;k=n.exportJSON();var p=n.constructor;k.type!==p.getType()&&z(58,p.name);let t=k.children;u.$isElementNode(n)&&(Array.isArray(t)||z(59,p.name));u.$isTextNode(f)&&(f=f.__text,0<f.length?k.text=f:e=!1);for(f=0;f<m.length;f++)n=
|
||||
-m[f],p=I(a,b,n,k.children),!e&&u.$isElementNode(c)&&p&&c.extractWithChild(n,b,"clone")&&(e=!0);if(e&&!h)g.push(k);else if(Array.isArray(k.children))for(a=0;a<k.children.length;a++)g.push(k.children[a]);return e}function D(a,b){let c=[],g=u.$getRoot().getChildren();for(let e=0;e<g.length;e++)I(a,b,g[e],c);return{namespace:a._config.namespace,nodes:c}}function J(a){let b=[];for(let c=0;c<a.length;c++){let g=u.$parseSerializedNode(a[c]);u.$isTextNode(g)&&q.$addNodeStyle(g);b.push(g)}return b}let K=null;
|
||||
-function L(a,b){var c=A?(a._window||window).getSelection():null;if(!c)return!1;var g=c.anchorNode;c=c.focusNode;if(null!==g&&null!==c&&!u.isSelectionWithinEditor(a,g,c))return!1;b.preventDefault();b=b.clipboardData;g=u.$getSelection();if(null===b||null===g)return!1;c=B(a);a=C(a);let e="";null!==g&&(e=g.getTextContent());null!==c&&b.setData("text/html",c);null!==a&&b.setData("application/x-lexical-editor",a);b.setData("text/plain",e);return!0}exports.$generateJSONFromSelectedNodes=D;
|
||||
+function E(a,b,c){let g=u.DEPRECATED_$isGridSelection(c),f=u.$isRangeSelection(c);(g||f&&null!==r.$findMatchingParent(c.anchor.getNode(),h=>u.DEPRECATED_$isGridCellNode(h))&&null!==r.$findMatchingParent(c.focus.getNode(),h=>u.DEPRECATED_$isGridCellNode(h)))&&1===b.length&&u.DEPRECATED_$isGridNode(b[0])?F(b,c,!1,a):c.insertNodes(b)}
|
||||
+function F(a,b,c,g){1===a.length&&u.DEPRECATED_$isGridNode(a[0])||z(42);var f=a[0];a=f.getChildren();c=f.getFirstChildOrThrow().getChildrenSize();var h=f.getChildrenSize(),e=r.$findMatchingParent(b.anchor.getNode(),l=>u.DEPRECATED_$isGridCellNode(l));b=(f=e&&r.$findMatchingParent(e,l=>u.DEPRECATED_$isGridRowNode(l)))&&r.$findMatchingParent(f,l=>u.DEPRECATED_$isGridNode(l));u.DEPRECATED_$isGridCellNode(e)&&u.DEPRECATED_$isGridRowNode(f)&&u.DEPRECATED_$isGridNode(b)||z(43);var k=f.getIndexWithinParent(),
|
||||
+m=Math.min(b.getChildrenSize()-1,k+h-1);h=e.getIndexWithinParent();e=Math.min(f.getChildrenSize()-1,h+c-1);c=Math.min(h,e);f=Math.min(k,m);h=Math.max(h,e);k=Math.max(k,m);m=b.getChildren();e=0;let n,p;for(let l=f;l<=k;l++){var t=m[l];u.DEPRECATED_$isGridRowNode(t)||z(24);var y=a[e];u.DEPRECATED_$isGridRowNode(y)||z(24);t=t.getChildren();y=y.getChildren();let G=0;for(let v=c;v<=h;v++){let w=t[v];u.DEPRECATED_$isGridCellNode(w)||z(25);let H=y[G];u.DEPRECATED_$isGridCellNode(H)||z(25);l===f&&v===c?n=
|
||||
+w.getKey():l===k&&v===h&&(p=w.getKey());let M=w.getChildren();H.getChildren().forEach(x=>{u.$isTextNode(x)&&u.$createParagraphNode().append(x);w.append(x)});M.forEach(x=>x.remove());G++}e++}n&&p&&(a=u.DEPRECATED_$createGridSelection(),a.set(b.getKey(),n,p),u.$setSelection(a),g.dispatchCommand(u.SELECTION_CHANGE_COMMAND,void 0))}
|
||||
+function I(a,b,c,g=[]){let f=null!=b?c.isSelected(b):!0,h=u.$isElementNode(c)&&c.excludeFromCopy("html");var e=c;if(null!==b){var k=q.$cloneWithProperties(c);e=k=u.$isTextNode(k)&&null!=b?q.$sliceSelectedTextNodeContent(b,k):k}let m=u.$isElementNode(e)?e.getChildren():[];var n=e;k=n.exportJSON();var p=n.constructor;k.type!==p.getType()&&z(58,p.name);let t=k.children;u.$isElementNode(n)&&(Array.isArray(t)||z(59,p.name));u.$isTextNode(e)&&(e=e.__text,0<e.length?k.text=e:f=!1);for(e=0;e<m.length;e++)n=
|
||||
+m[e],p=I(a,b,n,k.children),!f&&u.$isElementNode(c)&&p&&c.extractWithChild(n,b,"clone")&&(f=!0);if(f&&!h)g.push(k);else if(Array.isArray(k.children))for(a=0;a<k.children.length;a++)g.push(k.children[a]);return f}function D(a,b){let c=[],g=u.$getRoot().getChildren();for(let f=0;f<g.length;f++)I(a,b,g[f],c);return{namespace:a._config.namespace,nodes:c}}function J(a){let b=[];for(let c=0;c<a.length;c++){let g=u.$parseSerializedNode(a[c]);u.$isTextNode(g)&&q.$addNodeStyle(g);b.push(g)}return b}let K=null;
|
||||
+function L(a,b){var c=A?(a._window||window).getSelection():null;if(!c)return!1;var g=c.anchorNode;c=c.focusNode;if(null!==g&&null!==c&&!u.isSelectionWithinEditor(a,g,c))return!1;b.preventDefault();b=b.clipboardData;g=u.$getSelection();if(null===b||null===g)return!1;c=B(a);a=C(a);let f="";null!==g&&(f=g.getTextContent());null!==c&&b.setData("text/html",c);null!==a&&b.setData("application/x-lexical-editor",a);b.setData("text/plain",f);return!0}exports.$generateJSONFromSelectedNodes=D;
|
||||
exports.$generateNodesFromSerializedNodes=J;exports.$getHtmlContent=B;exports.$getLexicalContent=C;exports.$insertDataTransferForPlainText=function(a,b){a=a.getData("text/plain")||a.getData("text/uri-list");null!=a&&b.insertRawText(a)};
|
||||
-exports.$insertDataTransferForRichText=function(a,b,c){var g=a.getData("application/x-lexical-editor");if(g)try{let h=JSON.parse(g);if(h.namespace===c._config.namespace&&Array.isArray(h.nodes)){let f=J(h.nodes);return E(c,f,b)}}catch(h){}if(g=a.getData("text/html"))try{var e=(new DOMParser).parseFromString(g,"text/html");let h=d.$generateNodesFromDOM(c,e);return E(c,h,b)}catch(h){}a=a.getData("text/plain")||a.getData("text/uri-list");if(null!=a)if(u.$isRangeSelection(b))for(a=a.split(/(\r?\n|\t)/),
|
||||
-""===a[a.length-1]&&a.pop(),c=0;c<a.length;c++)e=a[c],"\n"===e||"\r\n"===e?b.insertParagraph():"\t"===e?b.insertNodes([u.$createTabNode()]):b.insertText(e);else b.insertRawText(a)};exports.$insertGeneratedNodes=E;
|
||||
-exports.copyToClipboard=async function(a,b){if(null!==K)return!1;if(null!==b)return new Promise(f=>{a.update(()=>{f(L(a,b))})});var c=a.getRootElement();let g=null==a._window?window.document:a._window.document,e=A?(a._window||window).getSelection():null;if(null===c||null===e)return!1;let h=g.createElement("span");h.style.cssText="position: fixed; top: -1000px;";h.append(g.createTextNode("#"));c.append(h);c=new Range;c.setStart(h,0);c.setEnd(h,1);e.removeAllRanges();e.addRange(c);return new Promise(f=>
|
||||
-{let k=a.registerCommand(u.COPY_COMMAND,m=>{r.objectKlassEquals(m,ClipboardEvent)&&(k(),null!==K&&(window.clearTimeout(K),K=null),f(L(a,m)));return!0},u.COMMAND_PRIORITY_CRITICAL);K=window.setTimeout(()=>{k();K=null;f(!1)},50);g.execCommand("copy");h.remove()})}
|
||||
+exports.$insertDataTransferForRichText=function(a,b,c,g){let f=a.getData("application/x-lexical-editor");if(f)try{let e=JSON.parse(f);if(e.namespace===c._config.namespace&&Array.isArray(e.nodes)){let k=J(e.nodes);return E(c,k,b)}}catch(e){}if(!g||"insertReplacementText"!==g.inputType||!a.types.includes("text/plain"))if(g=a.getData("text/html"))try{var h=(new DOMParser).parseFromString(g,"text/html");let e=d.$generateNodesFromDOM(c,h);return E(c,e,b)}catch(e){}a=a.getData("text/plain")||a.getData("text/uri-list");
|
||||
+if(null!=a)if(u.$isRangeSelection(b))for(a=a.split(/(\r?\n|\t)/),""===a[a.length-1]&&a.pop(),c=0;c<a.length;c++)h=a[c],"\n"===h||"\r\n"===h?b.insertParagraph():"\t"===h?b.insertNodes([u.$createTabNode()]):b.insertText(h);else b.insertRawText(a)};exports.$insertGeneratedNodes=E;
|
||||
+exports.copyToClipboard=async function(a,b){if(null!==K)return!1;if(null!==b)return new Promise(e=>{a.update(()=>{e(L(a,b))})});var c=a.getRootElement();let g=null==a._window?window.document:a._window.document,f=A?(a._window||window).getSelection():null;if(null===c||null===f)return!1;let h=g.createElement("span");h.style.cssText="position: fixed; top: -1000px;";h.append(g.createTextNode("#"));c.append(h);c=new Range;c.setStart(h,0);c.setEnd(h,1);f.removeAllRanges();f.addRange(c);return new Promise(e=>
|
||||
+{let k=a.registerCommand(u.COPY_COMMAND,m=>{r.objectKlassEquals(m,ClipboardEvent)&&(k(),null!==K&&(window.clearTimeout(K),K=null),e(L(a,m)));return!0},u.COMMAND_PRIORITY_CRITICAL);K=window.setTimeout(()=>{k();K=null;e(!1)},50);g.execCommand("copy");h.remove()})}
|
||||
diff --git a/clipboard.d.ts b/clipboard.d.ts
|
||||
index 99e2138389b64d298a1330d7b354ba87d2e6f24e..83250a4c2049f94e08bfdfc757e03e8a85a08dd4 100644
|
||||
--- a/clipboard.d.ts
|
||||
+++ b/clipboard.d.ts
|
||||
@@ -44,7 +44,7 @@ export declare function $insertDataTransferForPlainText(dataTransfer: DataTransf
|
||||
* @param selection the selection to use as the insertion point for the content in the DataTransfer object
|
||||
* @param editor the LexicalEditor the content is being inserted into.
|
||||
*/
|
||||
-export declare function $insertDataTransferForRichText(dataTransfer: DataTransfer, selection: BaseSelection, editor: LexicalEditor): void;
|
||||
+export declare function $insertDataTransferForRichText(dataTransfer: DataTransfer, selection: BaseSelection, editor: LexicalEditor, event?: InputEvent): void;
|
||||
/**
|
||||
* Inserts Lexical nodes into the editor using different strategies depending on
|
||||
* some simple selection-based heuristics. If you're looking for a generic way to
|
||||
@@ -0,0 +1,77 @@
|
||||
diff --git a/LexicalClipboard.dev.js b/LexicalClipboard.dev.js
|
||||
index 9e72de896d52d9c342e520a79b05dbf8fd9bcee3..512433f1dac08f8b8bd261315827924020035f85 100644
|
||||
--- a/LexicalClipboard.dev.js
|
||||
+++ b/LexicalClipboard.dev.js
|
||||
@@ -102,7 +102,7 @@ function $insertDataTransferForPlainText(dataTransfer, selection) {
|
||||
* @param selection the selection to use as the insertion point for the content in the DataTransfer object
|
||||
* @param editor the LexicalEditor the content is being inserted into.
|
||||
*/
|
||||
-function $insertDataTransferForRichText(dataTransfer, selection, editor) {
|
||||
+function $insertDataTransferForRichText(dataTransfer, selection, editor, event) {
|
||||
const lexicalString = dataTransfer.getData('application/x-lexical-editor');
|
||||
if (lexicalString) {
|
||||
try {
|
||||
@@ -115,15 +115,18 @@ function $insertDataTransferForRichText(dataTransfer, selection, editor) {
|
||||
// Fail silently.
|
||||
}
|
||||
}
|
||||
- const htmlString = dataTransfer.getData('text/html');
|
||||
- if (htmlString) {
|
||||
- try {
|
||||
- const parser = new DOMParser();
|
||||
- const dom = parser.parseFromString(htmlString, 'text/html');
|
||||
- const nodes = html.$generateNodesFromDOM(editor, dom);
|
||||
- return $insertGeneratedNodes(editor, nodes, selection);
|
||||
- } catch (_unused2) {
|
||||
- // Fail silently.
|
||||
+ const shouldIgnoreHTML = event && event.inputType === 'insertReplacementText' && dataTransfer.types.includes('text/plain');
|
||||
+ if (!shouldIgnoreHTML) {
|
||||
+ const htmlString = dataTransfer.getData('text/html');
|
||||
+ if (htmlString) {
|
||||
+ try {
|
||||
+ const parser = new DOMParser();
|
||||
+ const dom = parser.parseFromString(htmlString, 'text/html');
|
||||
+ const nodes = html.$generateNodesFromDOM(editor, dom);
|
||||
+ return $insertGeneratedNodes(editor, nodes, selection);
|
||||
+ } catch (_unused2) {
|
||||
+ // Fail silently.
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/LexicalClipboard.prod.js b/LexicalClipboard.prod.js
|
||||
index 494ab7597d14cfa0386f7bad294c567a8f0110c1..f60bbdf361d44ed078cf9cb403251f8976d665f9 100644
|
||||
--- a/LexicalClipboard.prod.js
|
||||
+++ b/LexicalClipboard.prod.js
|
||||
@@ -7,11 +7,11 @@
|
||||
'use strict';var f=require("@lexical/html"),m=require("@lexical/selection"),q=require("@lexical/utils"),r=require("lexical");function t(a){let b=new URLSearchParams;b.append("code",a);for(let c=1;c<arguments.length;c++)b.append("v",arguments[c]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${b} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
|
||||
let u="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement;function v(a){let b=r.$getSelection();if(null==b)throw Error("Expected valid LexicalSelection");return r.$isRangeSelection(b)&&b.isCollapsed()||0===b.getNodes().length?"":f.$generateHtmlFromNodes(a,b)}
|
||||
function w(a){let b=r.$getSelection();if(null==b)throw Error("Expected valid LexicalSelection");return r.$isRangeSelection(b)&&b.isCollapsed()||0===b.getNodes().length?null:JSON.stringify(x(a,b))}function y(a,b,c){a.dispatchCommand(r.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,{nodes:b,selection:c})||c.insertNodes(b)}
|
||||
-function z(a,b,c,d=[]){let e=null!==b?c.isSelected(b):!0,h=r.$isElementNode(c)&&c.excludeFromCopy("html");var g=c;if(null!==b){var k=m.$cloneWithProperties(c);g=k=r.$isTextNode(k)&&null!==b?m.$sliceSelectedTextNodeContent(b,k):k}let n=r.$isElementNode(g)?g.getChildren():[];var l=g;k=l.exportJSON();var p=l.constructor;k.type!==p.getType()&&t(58,p.name);r.$isElementNode(l)&&(Array.isArray(k.children)||t(59,p.name));r.$isTextNode(g)&&(g=g.__text,0<g.length?k.text=g:e=!1);for(g=0;g<n.length;g++)l=n[g],
|
||||
-p=z(a,b,l,k.children),!e&&r.$isElementNode(c)&&p&&c.extractWithChild(l,b,"clone")&&(e=!0);if(e&&!h)d.push(k);else if(Array.isArray(k.children))for(a=0;a<k.children.length;a++)d.push(k.children[a]);return e}function x(a,b){let c=[],d=r.$getRoot().getChildren();for(let e=0;e<d.length;e++)z(a,b,d[e],c);return{namespace:a._config.namespace,nodes:c}}function A(a){let b=[];for(let c=0;c<a.length;c++){let d=r.$parseSerializedNode(a[c]);r.$isTextNode(d)&&m.$addNodeStyle(d);b.push(d)}return b}let B=null;
|
||||
-function C(a,b){var c=u?(a._window||window).getSelection():null;if(!c)return!1;var d=c.anchorNode;c=c.focusNode;if(null!==d&&null!==c&&!r.isSelectionWithinEditor(a,d,c))return!1;b.preventDefault();b=b.clipboardData;d=r.$getSelection();if(null===b||null===d)return!1;c=v(a);a=w(a);let e="";null!==d&&(e=d.getTextContent());null!==c&&b.setData("text/html",c);null!==a&&b.setData("application/x-lexical-editor",a);b.setData("text/plain",e);return!0}exports.$generateJSONFromSelectedNodes=x;
|
||||
+function z(a,b,c,e=[]){let g=null!==b?c.isSelected(b):!0,k=r.$isElementNode(c)&&c.excludeFromCopy("html");var d=c;if(null!==b){var h=m.$cloneWithProperties(c);d=h=r.$isTextNode(h)&&null!==b?m.$sliceSelectedTextNodeContent(b,h):h}let n=r.$isElementNode(d)?d.getChildren():[];var l=d;h=l.exportJSON();var p=l.constructor;h.type!==p.getType()&&t(58,p.name);r.$isElementNode(l)&&(Array.isArray(h.children)||t(59,p.name));r.$isTextNode(d)&&(d=d.__text,0<d.length?h.text=d:g=!1);for(d=0;d<n.length;d++)l=n[d],
|
||||
+p=z(a,b,l,h.children),!g&&r.$isElementNode(c)&&p&&c.extractWithChild(l,b,"clone")&&(g=!0);if(g&&!k)e.push(h);else if(Array.isArray(h.children))for(a=0;a<h.children.length;a++)e.push(h.children[a]);return g}function x(a,b){let c=[],e=r.$getRoot().getChildren();for(let g=0;g<e.length;g++)z(a,b,e[g],c);return{namespace:a._config.namespace,nodes:c}}function A(a){let b=[];for(let c=0;c<a.length;c++){let e=r.$parseSerializedNode(a[c]);r.$isTextNode(e)&&m.$addNodeStyle(e);b.push(e)}return b}let B=null;
|
||||
+function C(a,b){var c=u?(a._window||window).getSelection():null;if(!c)return!1;var e=c.anchorNode;c=c.focusNode;if(null!==e&&null!==c&&!r.isSelectionWithinEditor(a,e,c))return!1;b.preventDefault();b=b.clipboardData;e=r.$getSelection();if(null===b||null===e)return!1;c=v(a);a=w(a);let g="";null!==e&&(g=e.getTextContent());null!==c&&b.setData("text/html",c);null!==a&&b.setData("application/x-lexical-editor",a);b.setData("text/plain",g);return!0}exports.$generateJSONFromSelectedNodes=x;
|
||||
exports.$generateNodesFromSerializedNodes=A;exports.$getHtmlContent=v;exports.$getLexicalContent=w;exports.$insertDataTransferForPlainText=function(a,b){a=a.getData("text/plain")||a.getData("text/uri-list");null!=a&&b.insertRawText(a)};
|
||||
-exports.$insertDataTransferForRichText=function(a,b,c){var d=a.getData("application/x-lexical-editor");if(d)try{let h=JSON.parse(d);if(h.namespace===c._config.namespace&&Array.isArray(h.nodes)){let g=A(h.nodes);return y(c,g,b)}}catch(h){}if(d=a.getData("text/html"))try{var e=(new DOMParser).parseFromString(d,"text/html");let h=f.$generateNodesFromDOM(c,e);return y(c,h,b)}catch(h){}a=a.getData("text/plain")||a.getData("text/uri-list");if(null!=a)if(r.$isRangeSelection(b))for(a=a.split(/(\r?\n|\t)/),
|
||||
-""===a[a.length-1]&&a.pop(),c=0;c<a.length;c++)e=a[c],"\n"===e||"\r\n"===e?b.insertParagraph():"\t"===e?b.insertNodes([r.$createTabNode()]):b.insertText(e);else b.insertRawText(a)};exports.$insertGeneratedNodes=y;
|
||||
-exports.copyToClipboard=async function(a,b){if(null!==B)return!1;if(null!==b)return new Promise(g=>{a.update(()=>{g(C(a,b))})});var c=a.getRootElement();let d=null==a._window?window.document:a._window.document,e=u?(a._window||window).getSelection():null;if(null===c||null===e)return!1;let h=d.createElement("span");h.style.cssText="position: fixed; top: -1000px;";h.append(d.createTextNode("#"));c.append(h);c=new Range;c.setStart(h,0);c.setEnd(h,1);e.removeAllRanges();e.addRange(c);return new Promise(g=>
|
||||
-{let k=a.registerCommand(r.COPY_COMMAND,n=>{q.objectKlassEquals(n,ClipboardEvent)&&(k(),null!==B&&(window.clearTimeout(B),B=null),g(C(a,n)));return!0},r.COMMAND_PRIORITY_CRITICAL);B=window.setTimeout(()=>{k();B=null;g(!1)},50);d.execCommand("copy");h.remove()})}
|
||||
+exports.$insertDataTransferForRichText=function(a,b,c,e){let g=a.getData("application/x-lexical-editor");if(g)try{let d=JSON.parse(g);if(d.namespace===c._config.namespace&&Array.isArray(d.nodes)){let h=A(d.nodes);return y(c,h,b)}}catch(d){}if(!e||"insertReplacementText"!==e.inputType||!a.types.includes("text/plain"))if(e=a.getData("text/html"))try{var k=(new DOMParser).parseFromString(e,"text/html");let d=f.$generateNodesFromDOM(c,k);return y(c,d,b)}catch(d){}a=a.getData("text/plain")||a.getData("text/uri-list");
|
||||
+if(null!=a)if(r.$isRangeSelection(b))for(a=a.split(/(\r?\n|\t)/),""===a[a.length-1]&&a.pop(),c=0;c<a.length;c++)k=a[c],"\n"===k||"\r\n"===k?b.insertParagraph():"\t"===k?b.insertNodes([r.$createTabNode()]):b.insertText(k);else b.insertRawText(a)};exports.$insertGeneratedNodes=y;
|
||||
+exports.copyToClipboard=async function(a,b){if(null!==B)return!1;if(null!==b)return new Promise(d=>{a.update(()=>{d(C(a,b))})});var c=a.getRootElement();let e=null==a._window?window.document:a._window.document,g=u?(a._window||window).getSelection():null;if(null===c||null===g)return!1;let k=e.createElement("span");k.style.cssText="position: fixed; top: -1000px;";k.append(e.createTextNode("#"));c.append(k);c=new Range;c.setStart(k,0);c.setEnd(k,1);g.removeAllRanges();g.addRange(c);return new Promise(d=>
|
||||
+{let h=a.registerCommand(r.COPY_COMMAND,n=>{q.objectKlassEquals(n,ClipboardEvent)&&(h(),null!==B&&(window.clearTimeout(B),B=null),d(C(a,n)));return!0},r.COMMAND_PRIORITY_CRITICAL);B=window.setTimeout(()=>{h();B=null;d(!1)},50);e.execCommand("copy");k.remove()})}
|
||||
diff --git a/clipboard.d.ts b/clipboard.d.ts
|
||||
index 99e2138389b64d298a1330d7b354ba87d2e6f24e..83250a4c2049f94e08bfdfc757e03e8a85a08dd4 100644
|
||||
--- a/clipboard.d.ts
|
||||
+++ b/clipboard.d.ts
|
||||
@@ -44,7 +44,7 @@ export declare function $insertDataTransferForPlainText(dataTransfer: DataTransf
|
||||
* @param selection the selection to use as the insertion point for the content in the DataTransfer object
|
||||
* @param editor the LexicalEditor the content is being inserted into.
|
||||
*/
|
||||
-export declare function $insertDataTransferForRichText(dataTransfer: DataTransfer, selection: BaseSelection, editor: LexicalEditor): void;
|
||||
+export declare function $insertDataTransferForRichText(dataTransfer: DataTransfer, selection: BaseSelection, editor: LexicalEditor, event?: InputEvent): void;
|
||||
/**
|
||||
* Inserts Lexical nodes into the editor using different strategies depending on
|
||||
* some simple selection-based heuristics. If you're looking for a generic way to
|
||||
@@ -0,0 +1,346 @@
|
||||
diff --git a/LexicalList.dev.js b/LexicalList.dev.js
|
||||
index 3b91ac0e93f7e6a9d784c7d8a19f11496369ecc0..de90d1b8de072015dc57a9174e1206c7371d0434 100644
|
||||
--- a/LexicalList.dev.js
|
||||
+++ b/LexicalList.dev.js
|
||||
@@ -140,27 +140,6 @@ function wrapInListItem(node) {
|
||||
function $isSelectingEmptyListItem(anchorNode, nodes) {
|
||||
return $isListItemNode(anchorNode) && (nodes.length === 0 || nodes.length === 1 && anchorNode.is(nodes[0]) && anchorNode.getChildrenSize() === 0);
|
||||
}
|
||||
-function $getListItemValue(listItem) {
|
||||
- const list = listItem.getParent();
|
||||
- let value = 1;
|
||||
- if (list != null) {
|
||||
- if (!$isListNode(list)) {
|
||||
- {
|
||||
- throw Error(`$getListItemValue: list node is not parent of list item node`);
|
||||
- }
|
||||
- } else {
|
||||
- value = list.getStart();
|
||||
- }
|
||||
- }
|
||||
- const siblings = listItem.getPreviousSiblings();
|
||||
- for (let i = 0; i < siblings.length; i++) {
|
||||
- const sibling = siblings[i];
|
||||
- if ($isListItemNode(sibling) && !$isListNode(sibling.getFirstChild())) {
|
||||
- value++;
|
||||
- }
|
||||
- }
|
||||
- return value;
|
||||
-}
|
||||
|
||||
/**
|
||||
* Inserts a new ListNode. If the selection's anchor node is an empty ListItemNode and is a child of
|
||||
@@ -217,7 +196,6 @@ function insertList(editor, listType) {
|
||||
const newListNode = $createListNode(listType);
|
||||
append(newListNode, parent.getChildren());
|
||||
parent.replace(newListNode);
|
||||
- updateChildrenListItemValue(newListNode);
|
||||
handled.add(parentKey);
|
||||
}
|
||||
break;
|
||||
@@ -268,7 +246,6 @@ function createListOrMerge(node, listType) {
|
||||
const list = $createListNode(listType);
|
||||
list.append(listItem);
|
||||
node.replace(list);
|
||||
- updateChildrenListItemValue(list);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -289,7 +266,6 @@ function mergeLists(list1, list2) {
|
||||
const toMerge = list2.getChildren();
|
||||
if (toMerge.length > 0) {
|
||||
list1.append(...toMerge);
|
||||
- updateChildrenListItemValue(list1);
|
||||
}
|
||||
list2.remove();
|
||||
}
|
||||
@@ -352,22 +328,23 @@ function removeList(editor) {
|
||||
|
||||
/**
|
||||
* Takes the value of a child ListItemNode and makes it the value the ListItemNode
|
||||
- * should be if it isn't already. If only certain children should be updated, they
|
||||
- * can be passed optionally in an array.
|
||||
+ * should be if it isn't already. Also ensures that checked is undefined if the
|
||||
+ * parent does not have a list type of 'check'.
|
||||
* @param list - The list whose children are updated.
|
||||
- * @param children - An array of the children to be updated.
|
||||
*/
|
||||
-function updateChildrenListItemValue(list, children) {
|
||||
- const childrenOrExisting = children || list.getChildren();
|
||||
- if (childrenOrExisting !== undefined) {
|
||||
- for (let i = 0; i < childrenOrExisting.length; i++) {
|
||||
- const child = childrenOrExisting[i];
|
||||
- if ($isListItemNode(child)) {
|
||||
- const prevValue = child.getValue();
|
||||
- const nextValue = $getListItemValue(child);
|
||||
- if (prevValue !== nextValue) {
|
||||
- child.setValue(nextValue);
|
||||
- }
|
||||
+function updateChildrenListItemValue(list) {
|
||||
+ const isNotChecklist = list.getListType() !== 'check';
|
||||
+ let value = list.getStart();
|
||||
+ for (const child of list.getChildren()) {
|
||||
+ if ($isListItemNode(child)) {
|
||||
+ if (child.getValue() !== value) {
|
||||
+ child.setValue(value);
|
||||
+ }
|
||||
+ if (isNotChecklist && child.getChecked() != null) {
|
||||
+ child.setChecked(undefined);
|
||||
+ }
|
||||
+ if (!$isListNode(child.getFirstChild())) {
|
||||
+ value++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -403,7 +380,6 @@ function $handleIndent(listItemNode) {
|
||||
nextSibling.remove();
|
||||
removed.add(nextSibling.getKey());
|
||||
}
|
||||
- updateChildrenListItemValue(innerList);
|
||||
}
|
||||
} else if (isNestedListNode(nextSibling)) {
|
||||
// if the ListItemNode is next to a nested ListNode, merge them
|
||||
@@ -413,13 +389,11 @@ function $handleIndent(listItemNode) {
|
||||
if (firstChild !== null) {
|
||||
firstChild.insertBefore(listItemNode);
|
||||
}
|
||||
- updateChildrenListItemValue(innerList);
|
||||
}
|
||||
} else if (isNestedListNode(previousSibling)) {
|
||||
const innerList = previousSibling.getFirstChild();
|
||||
if ($isListNode(innerList)) {
|
||||
innerList.append(listItemNode);
|
||||
- updateChildrenListItemValue(innerList);
|
||||
}
|
||||
} else {
|
||||
// otherwise, we need to create a new nested ListNode
|
||||
@@ -436,12 +410,8 @@ function $handleIndent(listItemNode) {
|
||||
} else {
|
||||
parent.append(newListItem);
|
||||
}
|
||||
- updateChildrenListItemValue(newList);
|
||||
}
|
||||
}
|
||||
- if ($isListNode(parent)) {
|
||||
- updateChildrenListItemValue(parent);
|
||||
- }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -495,8 +465,6 @@ function $handleOutdent(listItemNode) {
|
||||
// replace the grandparent list item (now between the siblings) with the outdented list item.
|
||||
grandparentListItem.replace(listItemNode);
|
||||
}
|
||||
- updateChildrenListItemValue(parentList);
|
||||
- updateChildrenListItemValue(greatGrandparentList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -603,12 +571,14 @@ class ListItemNode extends lexical.ElementNode {
|
||||
}
|
||||
static transform() {
|
||||
return node => {
|
||||
+ if (!$isListItemNode(node)) {
|
||||
+ throw Error(`node is not a ListItemNode`);
|
||||
+ }
|
||||
+ if (node.__checked == null) {
|
||||
+ return;
|
||||
+ }
|
||||
const parent = node.getParent();
|
||||
if ($isListNode(parent)) {
|
||||
- updateChildrenListItemValue(parent);
|
||||
- if (!$isListItemNode(node)) {
|
||||
- throw Error(`node is not a ListItemNode`);
|
||||
- }
|
||||
if (parent.getListType() !== 'check' && node.getChecked() != null) {
|
||||
node.setChecked(undefined);
|
||||
}
|
||||
@@ -704,15 +674,10 @@ class ListItemNode extends lexical.ElementNode {
|
||||
throw Error(`insertAfter: list node is not parent of list item node`);
|
||||
}
|
||||
}
|
||||
- const siblings = this.getNextSiblings();
|
||||
if ($isListItemNode(node)) {
|
||||
- const after = super.insertAfter(node, restoreSelection);
|
||||
- const afterListNode = node.getParentOrThrow();
|
||||
- if ($isListNode(afterListNode)) {
|
||||
- updateChildrenListItemValue(afterListNode);
|
||||
- }
|
||||
- return after;
|
||||
+ return super.insertAfter(node, restoreSelection);
|
||||
}
|
||||
+ const siblings = this.getNextSiblings();
|
||||
|
||||
// Attempt to merge if the list is of the same type.
|
||||
|
||||
@@ -743,11 +708,6 @@ class ListItemNode extends lexical.ElementNode {
|
||||
if (prevSibling && nextSibling && isNestedListNode(prevSibling) && isNestedListNode(nextSibling)) {
|
||||
mergeLists(prevSibling.getFirstChild(), nextSibling.getFirstChild());
|
||||
nextSibling.remove();
|
||||
- } else if (nextSibling) {
|
||||
- const parent = nextSibling.getParent();
|
||||
- if ($isListNode(parent)) {
|
||||
- updateChildrenListItemValue(parent);
|
||||
- }
|
||||
}
|
||||
}
|
||||
insertNewAfter(_, restoreSelection = true) {
|
||||
@@ -839,16 +799,6 @@ class ListItemNode extends lexical.ElementNode {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
- insertBefore(nodeToInsert) {
|
||||
- if ($isListItemNode(nodeToInsert)) {
|
||||
- const parent = this.getParentOrThrow();
|
||||
- if ($isListNode(parent)) {
|
||||
- const siblings = this.getNextSiblings();
|
||||
- updateChildrenListItemValue(parent, siblings);
|
||||
- }
|
||||
- }
|
||||
- return super.insertBefore(nodeToInsert);
|
||||
- }
|
||||
canInsertAfter(node) {
|
||||
return $isListItemNode(node);
|
||||
}
|
||||
@@ -1018,6 +968,14 @@ class ListNode extends lexical.ElementNode {
|
||||
setListThemeClassNames(dom, config.theme, this);
|
||||
return false;
|
||||
}
|
||||
+ static transform() {
|
||||
+ return node => {
|
||||
+ if (!$isListNode(node)) {
|
||||
+ throw Error(`node is not a ListNode`);
|
||||
+ }
|
||||
+ updateChildrenListItemValue(node);
|
||||
+ };
|
||||
+ }
|
||||
static importDOM() {
|
||||
return {
|
||||
ol: node => ({
|
||||
@@ -1087,7 +1045,6 @@ class ListNode extends lexical.ElementNode {
|
||||
super.append(listItemNode);
|
||||
}
|
||||
}
|
||||
- updateChildrenListItemValue(this);
|
||||
return this;
|
||||
}
|
||||
extractWithChild(child) {
|
||||
diff --git a/LexicalList.prod.js b/LexicalList.prod.js
|
||||
index 4687f6a90633c254974aedd06538d334f84de249..54fac0766cf47224af5d0e4e05054861f1072872 100644
|
||||
--- a/LexicalList.prod.js
|
||||
+++ b/LexicalList.prod.js
|
||||
@@ -4,32 +4,33 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
-'use strict';var h=require("lexical"),k=require("@lexical/utils");function l(a){let b=new URLSearchParams;b.append("code",a);for(let c=1;c<arguments.length;c++)b.append("v",arguments[c]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${b} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
|
||||
+'use strict';var g=require("lexical"),k=require("@lexical/utils");function l(a){let b=new URLSearchParams;b.append("code",a);for(let c=1;c<arguments.length;c++)b.append("v",arguments[c]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${b} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
|
||||
function n(a){let b=1;for(a=a.getParent();null!=a;){if(p(a)){a=a.getParent();if(q(a)){b++;a=a.getParent();continue}l(40)}break}return b}function r(a){a=a.getParent();q(a)||l(40);let b=a;for(;null!==b;)b=b.getParent(),q(b)&&(a=b);return a}function t(a){let b=[];a=a.getChildren().filter(p);for(let c=0;c<a.length;c++){let d=a[c],e=d.getFirstChild();q(e)?b=b.concat(t(e)):b.push(d)}return b}function u(a){return p(a)&&q(a.getFirstChild())}
|
||||
-function v(a){for(;null==a.getNextSibling()&&null==a.getPreviousSibling();){let b=a.getParent();if(null==b||!p(a)&&!q(a))break;a=b}a.remove()}function w(a){return y().append(a)}function z(a,b){return p(a)&&(0===b.length||1===b.length&&a.is(b[0])&&0===a.getChildrenSize())}function C(a,b){a.splice(a.getChildrenSize(),0,b)}
|
||||
-function D(a,b){if(q(a))return a;let c=a.getPreviousSibling(),d=a.getNextSibling(),e=y();e.setFormat(a.getFormatType());e.setIndent(a.getIndent());C(e,a.getChildren());if(q(c)&&b===c.getListType())return c.append(e),a.remove(),q(d)&&b===d.getListType()&&(C(c,d.getChildren()),d.remove()),c;if(q(d)&&b===d.getListType())return d.getFirstChildOrThrow().insertBefore(e),a.remove(),d;b=E(b);b.append(e);a.replace(b);F(b);return b}
|
||||
-function G(a,b){var c=a.getLastChild();let d=b.getFirstChild();c&&d&&u(c)&&u(d)&&(G(c.getFirstChild(),d.getFirstChild()),d.remove());c=b.getChildren();0<c.length&&(a.append(...c),F(a));b.remove()}function F(a,b){a=b||a.getChildren();if(void 0!==a)for(b=0;b<a.length;b++){let f=a[b];if(p(f)){let g=f.getValue();var c=f,d=c.getParent(),e=1;null!=d&&(q(d)?e=d.getStart():l(44));c=c.getPreviousSiblings();for(d=0;d<c.length;d++){let m=c[d];p(m)&&!q(m.getFirstChild())&&e++}g!==e&&f.setValue(e)}}}
|
||||
-function H(a){if(!u(a)){var b=a.getParent(),c=b?b.getParent():void 0,d=c?c.getParent():void 0;if(q(d)&&p(c)&&q(b)){var e=b?b.getFirstChild():void 0,f=b?b.getLastChild():void 0;if(a.is(e))c.insertBefore(a),b.isEmpty()&&c.remove();else if(a.is(f))c.insertAfter(a),b.isEmpty()&&c.remove();else{var g=b.getListType();e=y();let m=E(g);e.append(m);a.getPreviousSiblings().forEach(x=>m.append(x));f=y();g=E(g);f.append(g);C(g,a.getNextSiblings());c.insertBefore(e);c.insertAfter(f);c.replace(a)}F(b);F(d)}}}
|
||||
-class I extends h.ElementNode{static getType(){return"listitem"}static clone(a){return new I(a.__value,a.__checked,a.__key)}constructor(a,b,c){super(c);this.__value=void 0===a?1:a;this.__checked=b}createDOM(a){let b=document.createElement("li"),c=this.getParent();q(c)&&"check"===c.getListType()&&J(b,this,null);b.value=this.__value;K(b,a.theme,this);return b}updateDOM(a,b,c){let d=this.getParent();q(d)&&"check"===d.getListType()&&J(b,this,a);b.value=this.__value;K(b,c.theme,this);return!1}static transform(){return a=>
|
||||
-{let b=a.getParent();q(b)&&(F(b),p(a)||l(144),"check"!==b.getListType()&&null!=a.getChecked()&&a.setChecked(void 0))}}static importDOM(){return{li:()=>({conversion:L,priority:0})}}static importJSON(a){let b=y();b.setChecked(a.checked);b.setValue(a.value);b.setFormat(a.format);b.setDirection(a.direction);return b}exportDOM(a){a=this.createDOM(a._config);a.style.textAlign=this.getFormatType();return{element:a}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),
|
||||
-version:1}}append(...a){for(let b=0;b<a.length;b++){let c=a[b];if(h.$isElementNode(c)&&this.canMergeWith(c)){let d=c.getChildren();this.append(...d);c.remove()}else super.append(c)}return this}replace(a,b){if(p(a))return super.replace(a);this.setIndent(0);let c=this.getParentOrThrow();if(!q(c))return a;if(c.__first===this.getKey())c.insertBefore(a);else if(c.__last===this.getKey())c.insertAfter(a);else{let d=E(c.getListType()),e=this.getNextSibling();for(;e;){let f=e;e=e.getNextSibling();d.append(f)}c.insertAfter(a);
|
||||
-a.insertAfter(d)}b&&(h.$isElementNode(a)||l(139),this.getChildren().forEach(d=>{a.append(d)}));this.remove();0===c.getChildrenSize()&&c.remove();return a}insertAfter(a,b=!0){var c=this.getParentOrThrow();q(c)||l(39);var d=this.getNextSiblings();if(p(a))return b=super.insertAfter(a,b),a=a.getParentOrThrow(),q(a)&&F(a),b;if(q(a)){c=a;a=a.getChildren();for(d=a.length-1;0<=d;d--)c=a[d],this.insertAfter(c,b);return c}c.insertAfter(a,b);if(0!==d.length){let e=E(c.getListType());d.forEach(f=>e.append(f));
|
||||
-a.insertAfter(e,b)}return a}remove(a){let b=this.getPreviousSibling(),c=this.getNextSibling();super.remove(a);b&&c&&u(b)&&u(c)?(G(b.getFirstChild(),c.getFirstChild()),c.remove()):c&&(a=c.getParent(),q(a)&&F(a))}insertNewAfter(a,b=!0){a=y(null==this.__checked?void 0:!1);this.insertAfter(a,b);return a}collapseAtStart(a){let b=h.$createParagraphNode();this.getChildren().forEach(f=>b.append(f));var c=this.getParentOrThrow(),d=c.getParentOrThrow();let e=p(d);1===c.getChildrenSize()?e?(c.remove(),d.select()):
|
||||
-(c.insertBefore(b),c.remove(),c=a.anchor,a=a.focus,d=b.getKey(),"element"===c.type&&c.getNode().is(this)&&c.set(d,c.offset,"element"),"element"===a.type&&a.getNode().is(this)&&a.set(d,a.offset,"element")):(c.insertBefore(b),this.remove());return!0}getValue(){return this.getLatest().__value}setValue(a){this.getWritable().__value=a}getChecked(){return this.getLatest().__checked}setChecked(a){this.getWritable().__checked=a}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var a=this.getParent();
|
||||
-if(null===a)return this.getLatest().__indent;a=a.getParentOrThrow();let b=0;for(;p(a);)a=a.getParentOrThrow().getParentOrThrow(),b++;return b}setIndent(a){"number"===typeof a&&-1<a||l(117);let b=this.getIndent();for(;b!==a;)if(b<a){a:{var c=new Set;if(u(this)||c.has(this.getKey()))break a;let g=this.getParent();var d=this.getNextSibling(),e=this.getPreviousSibling();if(u(d)&&u(e)){if(e=e.getFirstChild(),q(e)){e.append(this);var f=d.getFirstChild();q(f)&&(f=f.getChildren(),C(e,f),d.remove(),c.add(d.getKey()));
|
||||
-F(e)}}else u(d)?(d=d.getFirstChild(),q(d)&&(c=d.getFirstChild(),null!==c&&c.insertBefore(this),F(d))):u(e)?(d=e.getFirstChild(),q(d)&&(d.append(this),F(d))):q(g)&&(c=y(),f=E(g.getListType()),c.append(f),f.append(this),e?e.insertAfter(c):d?d.insertBefore(c):g.append(c),F(f));q(g)&&F(g)}b++}else H(this),b--;return this}insertBefore(a){if(p(a)){let b=this.getParentOrThrow();if(q(b)){let c=this.getNextSiblings();F(b,c)}}return super.insertBefore(a)}canInsertAfter(a){return p(a)}canReplaceWith(a){return p(a)}canMergeWith(a){return h.$isParagraphNode(a)||
|
||||
-p(a)}extractWithChild(a,b){if(!h.$isRangeSelection(b))return!1;a=b.anchor.getNode();let c=b.focus.getNode();return this.isParentOf(a)&&this.isParentOf(c)&&this.getTextContent().length===b.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return E("bullet")}}
|
||||
-function K(a,b,c){let d=[],e=[];var f=(b=b.list)?b.listitem:void 0;if(b&&b.nested)var g=b.nested.listitem;void 0!==f&&(f=f.split(" "),d.push(...f));if(b){f=c.getParent();f=q(f)&&"check"===f.getListType();let m=c.getChecked();f&&!m||e.push(b.listitemUnchecked);f&&m||e.push(b.listitemChecked);f&&d.push(m?b.listitemChecked:b.listitemUnchecked)}void 0!==g&&(g=g.split(" "),c.getChildren().some(m=>q(m))?d.push(...g):e.push(...g));0<e.length&&k.removeClassNamesFromElement(a,...e);0<d.length&&k.addClassNamesToElement(a,
|
||||
-...d)}function J(a,b,c){q(b.getFirstChild())?(a.removeAttribute("role"),a.removeAttribute("tabIndex"),a.removeAttribute("aria-checked")):(a.setAttribute("role","checkbox"),a.setAttribute("tabIndex","-1"),c&&b.__checked===c.__checked||a.setAttribute("aria-checked",b.getChecked()?"true":"false"))}function L(a){a=k.isHTMLElement(a)&&"true"===a.getAttribute("aria-checked");return{node:y(a)}}function y(a){return h.$applyNodeReplacement(new I(void 0,a))}function p(a){return a instanceof I}
|
||||
-class M extends h.ElementNode{static getType(){return"list"}static clone(a){return new M(a.__listType||O[a.__tag],a.__start,a.__key)}constructor(a,b,c){super(c);this.__listType=a=O[a]||a;this.__tag="number"===a?"ol":"ul";this.__start=b}getTag(){return this.__tag}setListType(a){let b=this.getWritable();b.__listType=a;b.__tag="number"===a?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(a){let b=document.createElement(this.__tag);1!==this.__start&&b.setAttribute("start",
|
||||
-String(this.__start));b.__lexicalListType=this.__listType;P(b,a.theme,this);return b}updateDOM(a,b,c){if(a.__tag!==this.__tag)return!0;P(b,c.theme,this);return!1}static importDOM(){return{ol:()=>({conversion:Q,priority:0}),ul:()=>({conversion:Q,priority:0})}}static importJSON(a){let b=E(a.listType,a.start);b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportDOM(a){({element:a}=super.exportDOM(a));a&&k.isHTMLElement(a)&&(1!==this.__start&&a.setAttribute("start",String(this.__start)),
|
||||
-"check"===this.__listType&&a.setAttribute("__lexicalListType","check"));return{element:a}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...a){for(let c=0;c<a.length;c++){var b=a[c];if(p(b))super.append(b);else{let d=y();q(b)?d.append(b):h.$isElementNode(b)?(b=h.$createTextNode(b.getTextContent()),d.append(b)):d.append(b);super.append(d)}}F(this);return this}extractWithChild(a){return p(a)}}
|
||||
-function P(a,b,c){let d=[],e=[];var f=b.list;if(void 0!==f){let m=f[`${c.__tag}Depth`]||[];b=n(c)-1;let x=b%m.length;var g=m[x];let N=f[c.__tag],A,B=f.nested;f=f.checklist;void 0!==B&&B.list&&(A=B.list);void 0!==N&&d.push(N);void 0!==f&&"check"===c.__listType&&d.push(f);if(void 0!==g)for(g=g.split(" "),d.push(...g),g=0;g<m.length;g++)g!==x&&e.push(c.__tag+g);void 0!==A&&(c=A.split(" "),1<b?d.push(...c):e.push(...c))}0<e.length&&k.removeClassNamesFromElement(a,...e);0<d.length&&k.addClassNamesToElement(a,
|
||||
-...d)}function R(a){let b=[];for(let d=0;d<a.length;d++){var c=a[d];p(c)?(b.push(c),c=c.getChildren(),1<c.length&&c.forEach(e=>{q(e)&&b.push(w(e))})):b.push(w(c))}return b}function Q(a){let b=a.nodeName.toLowerCase(),c=null;"ol"===b?c=E("number",a.start):"ul"===b&&(c=k.isHTMLElement(a)&&"check"===a.getAttribute("__lexicallisttype")?E("check"):E("bullet"));return{after:R,node:c}}let O={ol:"number",ul:"bullet"};function E(a,b=1){return h.$applyNodeReplacement(new M(a,b))}
|
||||
-function q(a){return a instanceof M}let S=h.createCommand("INSERT_UNORDERED_LIST_COMMAND"),T=h.createCommand("INSERT_ORDERED_LIST_COMMAND"),U=h.createCommand("INSERT_CHECK_LIST_COMMAND"),V=h.createCommand("REMOVE_LIST_COMMAND");exports.$createListItemNode=y;exports.$createListNode=E;exports.$getListDepth=n;
|
||||
-exports.$handleListInsertParagraph=function(){var a=h.$getSelection();if(!h.$isRangeSelection(a)||!a.isCollapsed())return!1;a=a.anchor.getNode();if(!p(a)||0!==a.getChildrenSize())return!1;var b=r(a),c=a.getParent();q(c)||l(40);let d=c.getParent(),e;if(h.$isRootOrShadowRoot(d))e=h.$createParagraphNode(),b.insertAfter(e);else if(p(d))e=y(),d.insertAfter(e);else return!1;e.select();b=a.getNextSiblings();if(0<b.length){let f=E(c.getListType());h.$isParagraphNode(e)?e.insertAfter(f):(c=y(),c.append(f),
|
||||
-e.insertAfter(c));b.forEach(g=>{g.remove();f.append(g)})}v(a);return!0};exports.$isListItemNode=p;exports.$isListNode=q;exports.INSERT_CHECK_LIST_COMMAND=U;exports.INSERT_ORDERED_LIST_COMMAND=T;exports.INSERT_UNORDERED_LIST_COMMAND=S;exports.ListItemNode=I;exports.ListNode=M;exports.REMOVE_LIST_COMMAND=V;
|
||||
-exports.insertList=function(a,b){a.update(()=>{var c=h.$getSelection();if(null!==c){var d=c.getNodes();c=c.getStartEndPoints();null===c&&l(143);[c]=c;c=c.getNode();var e=c.getParent();if(z(c,d))d=E(b),h.$isRootOrShadowRoot(e)?(c.replace(d),e=y(),h.$isElementNode(c)&&(e.setFormat(c.getFormatType()),e.setIndent(c.getIndent())),d.append(e)):p(c)&&(c=c.getParentOrThrow(),C(d,c.getChildren()),c.replace(d));else for(c=new Set,e=0;e<d.length;e++){var f=d[e];if(h.$isElementNode(f)&&f.isEmpty()&&!p(f)&&!c.has(f.getKey()))D(f,
|
||||
-b);else if(h.$isLeafNode(f))for(f=f.getParent();null!=f;){let m=f.getKey();if(q(f)){if(!c.has(m)){var g=E(b);C(g,f.getChildren());f.replace(g);F(g);c.add(m)}break}else{g=f.getParent();if(h.$isRootOrShadowRoot(g)&&!c.has(m)){c.add(m);D(f,b);break}f=g}}}}})};
|
||||
-exports.removeList=function(a){a.update(()=>{let b=h.$getSelection();if(h.$isRangeSelection(b)){var c=new Set,d=b.getNodes(),e=b.anchor.getNode();if(z(e,d))c.add(r(e));else for(e=0;e<d.length;e++){var f=d[e];h.$isLeafNode(f)&&(f=k.$getNearestNodeOfType(f,I),null!=f&&c.add(r(f)))}for(let g of c){c=g;d=t(g);for(let m of d)d=h.$createParagraphNode(),C(d,m.getChildren()),c.insertAfter(d),c=d,m.__key===b.anchor.key&&b.anchor.set(d.getKey(),0,"element"),m.__key===b.focus.key&&b.focus.set(d.getKey(),0,"element"),
|
||||
-m.remove();g.remove()}}})}
|
||||
+function v(a){for(;null==a.getNextSibling()&&null==a.getPreviousSibling();){let b=a.getParent();if(null==b||!p(a)&&!q(a))break;a=b}a.remove()}function w(a){return x().append(a)}function A(a,b){return p(a)&&(0===b.length||1===b.length&&a.is(b[0])&&0===a.getChildrenSize())}function B(a,b){a.splice(a.getChildrenSize(),0,b)}
|
||||
+function C(a,b){if(q(a))return a;let c=a.getPreviousSibling(),d=a.getNextSibling(),e=x();e.setFormat(a.getFormatType());e.setIndent(a.getIndent());B(e,a.getChildren());if(q(c)&&b===c.getListType())return c.append(e),a.remove(),q(d)&&b===d.getListType()&&(B(c,d.getChildren()),d.remove()),c;if(q(d)&&b===d.getListType())return d.getFirstChildOrThrow().insertBefore(e),a.remove(),d;b=D(b);b.append(e);a.replace(b);return b}
|
||||
+function E(a,b){var c=a.getLastChild();let d=b.getFirstChild();c&&d&&u(c)&&u(d)&&(E(c.getFirstChild(),d.getFirstChild()),d.remove());c=b.getChildren();0<c.length&&a.append(...c);b.remove()}
|
||||
+function F(a){if(!u(a)){var b=a.getParent(),c=b?b.getParent():void 0,d=c?c.getParent():void 0;if(q(d)&&p(c)&&q(b)){d=b?b.getFirstChild():void 0;var e=b?b.getLastChild():void 0;if(a.is(d))c.insertBefore(a),b.isEmpty()&&c.remove();else if(a.is(e))c.insertAfter(a),b.isEmpty()&&c.remove();else{e=b.getListType();b=x();let f=D(e);b.append(f);a.getPreviousSiblings().forEach(h=>f.append(h));d=x();e=D(e);d.append(e);B(e,a.getNextSiblings());c.insertBefore(b);c.insertAfter(d);c.replace(a)}}}}
|
||||
+class G extends g.ElementNode{static getType(){return"listitem"}static clone(a){return new G(a.__value,a.__checked,a.__key)}constructor(a,b,c){super(c);this.__value=void 0===a?1:a;this.__checked=b}createDOM(a){let b=document.createElement("li"),c=this.getParent();q(c)&&"check"===c.getListType()&&H(b,this,null);b.value=this.__value;I(b,a.theme,this);return b}updateDOM(a,b,c){let d=this.getParent();q(d)&&"check"===d.getListType()&&H(b,this,a);b.value=this.__value;I(b,c.theme,this);return!1}static transform(){return a=>
|
||||
+{p(a)||l(144);if(null!=a.__checked){var b=a.getParent();q(b)&&"check"!==b.getListType()&&null!=a.getChecked()&&a.setChecked(void 0)}}}static importDOM(){return{li:()=>({conversion:J,priority:0})}}static importJSON(a){let b=x();b.setChecked(a.checked);b.setValue(a.value);b.setFormat(a.format);b.setDirection(a.direction);return b}exportDOM(a){a=this.createDOM(a._config);a.style.textAlign=this.getFormatType();return{element:a}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",
|
||||
+value:this.getValue(),version:1}}append(...a){for(let b=0;b<a.length;b++){let c=a[b];if(g.$isElementNode(c)&&this.canMergeWith(c)){let d=c.getChildren();this.append(...d);c.remove()}else super.append(c)}return this}replace(a,b){if(p(a))return super.replace(a);this.setIndent(0);let c=this.getParentOrThrow();if(!q(c))return a;if(c.__first===this.getKey())c.insertBefore(a);else if(c.__last===this.getKey())c.insertAfter(a);else{let d=D(c.getListType()),e=this.getNextSibling();for(;e;){let f=e;e=e.getNextSibling();
|
||||
+d.append(f)}c.insertAfter(a);a.insertAfter(d)}b&&(g.$isElementNode(a)||l(139),this.getChildren().forEach(d=>{a.append(d)}));this.remove();0===c.getChildrenSize()&&c.remove();return a}insertAfter(a,b=!0){var c=this.getParentOrThrow();q(c)||l(39);if(p(a))return super.insertAfter(a,b);var d=this.getNextSiblings();if(q(a)){c=a;a=a.getChildren();for(d=a.length-1;0<=d;d--)c=a[d],this.insertAfter(c,b);return c}c.insertAfter(a,b);if(0!==d.length){let e=D(c.getListType());d.forEach(f=>e.append(f));a.insertAfter(e,
|
||||
+b)}return a}remove(a){let b=this.getPreviousSibling(),c=this.getNextSibling();super.remove(a);b&&c&&u(b)&&u(c)&&(E(b.getFirstChild(),c.getFirstChild()),c.remove())}insertNewAfter(a,b=!0){a=x(null==this.__checked?void 0:!1);this.insertAfter(a,b);return a}collapseAtStart(a){let b=g.$createParagraphNode();this.getChildren().forEach(f=>b.append(f));var c=this.getParentOrThrow(),d=c.getParentOrThrow();let e=p(d);1===c.getChildrenSize()?e?(c.remove(),d.select()):(c.insertBefore(b),c.remove(),c=a.anchor,
|
||||
+a=a.focus,d=b.getKey(),"element"===c.type&&c.getNode().is(this)&&c.set(d,c.offset,"element"),"element"===a.type&&a.getNode().is(this)&&a.set(d,a.offset,"element")):(c.insertBefore(b),this.remove());return!0}getValue(){return this.getLatest().__value}setValue(a){this.getWritable().__value=a}getChecked(){return this.getLatest().__checked}setChecked(a){this.getWritable().__checked=a}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var a=this.getParent();if(null===a)return this.getLatest().__indent;
|
||||
+a=a.getParentOrThrow();let b=0;for(;p(a);)a=a.getParentOrThrow().getParentOrThrow(),b++;return b}setIndent(a){"number"===typeof a&&-1<a||l(117);let b=this.getIndent();for(;b!==a;)if(b<a){var c=new Set;if(!u(this)&&!c.has(this.getKey())){var d=this.getParent(),e=this.getNextSibling(),f=this.getPreviousSibling();if(u(e)&&u(f))d=f.getFirstChild(),q(d)&&(d.append(this),f=e.getFirstChild(),q(f)&&(f=f.getChildren(),B(d,f),e.remove(),c.add(e.getKey())));else if(u(e))e=e.getFirstChild(),q(e)&&(e=e.getFirstChild(),
|
||||
+null!==e&&e.insertBefore(this));else if(u(f))e=f.getFirstChild(),q(e)&&e.append(this);else if(q(d)){c=x();let h=D(d.getListType());c.append(h);h.append(this);f?f.insertAfter(c):e?e.insertBefore(c):d.append(c)}}b++}else F(this),b--;return this}canInsertAfter(a){return p(a)}canReplaceWith(a){return p(a)}canMergeWith(a){return g.$isParagraphNode(a)||p(a)}extractWithChild(a,b){if(!g.$isRangeSelection(b))return!1;a=b.anchor.getNode();let c=b.focus.getNode();return this.isParentOf(a)&&this.isParentOf(c)&&
|
||||
+this.getTextContent().length===b.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return D("bullet")}}
|
||||
+function I(a,b,c){let d=[],e=[];var f=(b=b.list)?b.listitem:void 0;if(b&&b.nested)var h=b.nested.listitem;void 0!==f&&(f=f.split(" "),d.push(...f));if(b){f=c.getParent();f=q(f)&&"check"===f.getListType();let m=c.getChecked();f&&!m||e.push(b.listitemUnchecked);f&&m||e.push(b.listitemChecked);f&&d.push(m?b.listitemChecked:b.listitemUnchecked)}void 0!==h&&(h=h.split(" "),c.getChildren().some(m=>q(m))?d.push(...h):e.push(...h));0<e.length&&k.removeClassNamesFromElement(a,...e);0<d.length&&k.addClassNamesToElement(a,
|
||||
+...d)}function H(a,b,c){q(b.getFirstChild())?(a.removeAttribute("role"),a.removeAttribute("tabIndex"),a.removeAttribute("aria-checked")):(a.setAttribute("role","checkbox"),a.setAttribute("tabIndex","-1"),c&&b.__checked===c.__checked||a.setAttribute("aria-checked",b.getChecked()?"true":"false"))}function J(a){a=k.isHTMLElement(a)&&"true"===a.getAttribute("aria-checked");return{node:x(a)}}function x(a){return g.$applyNodeReplacement(new G(void 0,a))}function p(a){return a instanceof G}
|
||||
+class K extends g.ElementNode{static getType(){return"list"}static clone(a){return new K(a.__listType||N[a.__tag],a.__start,a.__key)}constructor(a,b,c){super(c);this.__listType=a=N[a]||a;this.__tag="number"===a?"ol":"ul";this.__start=b}getTag(){return this.__tag}setListType(a){let b=this.getWritable();b.__listType=a;b.__tag="number"===a?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(a){let b=document.createElement(this.__tag);1!==this.__start&&b.setAttribute("start",
|
||||
+String(this.__start));b.__lexicalListType=this.__listType;O(b,a.theme,this);return b}updateDOM(a,b,c){if(a.__tag!==this.__tag)return!0;O(b,c.theme,this);return!1}static transform(){return a=>{if(!q(a))throw Error("node is not a ListNode");let b="check"!==a.getListType(),c=a.getStart();for(let d of a.getChildren())p(d)&&(d.getValue()!==c&&d.setValue(c),b&&null!=d.getChecked()&&d.setChecked(void 0),q(d.getFirstChild())||c++)}}static importDOM(){return{ol:()=>({conversion:P,priority:0}),ul:()=>({conversion:P,
|
||||
+priority:0})}}static importJSON(a){let b=D(a.listType,a.start);b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportDOM(a){({element:a}=super.exportDOM(a));a&&k.isHTMLElement(a)&&(1!==this.__start&&a.setAttribute("start",String(this.__start)),"check"===this.__listType&&a.setAttribute("__lexicalListType","check"));return{element:a}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...a){for(let c=
|
||||
+0;c<a.length;c++){var b=a[c];if(p(b))super.append(b);else{let d=x();q(b)?d.append(b):g.$isElementNode(b)?(b=g.$createTextNode(b.getTextContent()),d.append(b)):d.append(b);super.append(d)}}return this}extractWithChild(a){return p(a)}}
|
||||
+function O(a,b,c){let d=[],e=[];var f=b.list;if(void 0!==f){let m=f[`${c.__tag}Depth`]||[];b=n(c)-1;let L=b%m.length;var h=m[L];let M=f[c.__tag],y,z=f.nested;f=f.checklist;void 0!==z&&z.list&&(y=z.list);void 0!==M&&d.push(M);void 0!==f&&"check"===c.__listType&&d.push(f);if(void 0!==h)for(h=h.split(" "),d.push(...h),h=0;h<m.length;h++)h!==L&&e.push(c.__tag+h);void 0!==y&&(c=y.split(" "),1<b?d.push(...c):e.push(...c))}0<e.length&&k.removeClassNamesFromElement(a,...e);0<d.length&&k.addClassNamesToElement(a,
|
||||
+...d)}function Q(a){let b=[];for(let d=0;d<a.length;d++){var c=a[d];p(c)?(b.push(c),c=c.getChildren(),1<c.length&&c.forEach(e=>{q(e)&&b.push(w(e))})):b.push(w(c))}return b}function P(a){let b=a.nodeName.toLowerCase(),c=null;"ol"===b?c=D("number",a.start):"ul"===b&&(c=k.isHTMLElement(a)&&"check"===a.getAttribute("__lexicallisttype")?D("check"):D("bullet"));return{after:Q,node:c}}let N={ol:"number",ul:"bullet"};function D(a,b=1){return g.$applyNodeReplacement(new K(a,b))}
|
||||
+function q(a){return a instanceof K}let R=g.createCommand("INSERT_UNORDERED_LIST_COMMAND"),S=g.createCommand("INSERT_ORDERED_LIST_COMMAND"),T=g.createCommand("INSERT_CHECK_LIST_COMMAND"),U=g.createCommand("REMOVE_LIST_COMMAND");exports.$createListItemNode=x;exports.$createListNode=D;exports.$getListDepth=n;
|
||||
+exports.$handleListInsertParagraph=function(){var a=g.$getSelection();if(!g.$isRangeSelection(a)||!a.isCollapsed())return!1;a=a.anchor.getNode();if(!p(a)||0!==a.getChildrenSize())return!1;var b=r(a),c=a.getParent();q(c)||l(40);let d=c.getParent(),e;if(g.$isRootOrShadowRoot(d))e=g.$createParagraphNode(),b.insertAfter(e);else if(p(d))e=x(),d.insertAfter(e);else return!1;e.select();b=a.getNextSiblings();if(0<b.length){let f=D(c.getListType());g.$isParagraphNode(e)?e.insertAfter(f):(c=x(),c.append(f),
|
||||
+e.insertAfter(c));b.forEach(h=>{h.remove();f.append(h)})}v(a);return!0};exports.$isListItemNode=p;exports.$isListNode=q;exports.INSERT_CHECK_LIST_COMMAND=T;exports.INSERT_ORDERED_LIST_COMMAND=S;exports.INSERT_UNORDERED_LIST_COMMAND=R;exports.ListItemNode=G;exports.ListNode=K;exports.REMOVE_LIST_COMMAND=U;
|
||||
+exports.insertList=function(a,b){a.update(()=>{var c=g.$getSelection();if(null!==c){var d=c.getNodes();c=c.getStartEndPoints();null===c&&l(143);[c]=c;c=c.getNode();var e=c.getParent();if(A(c,d))d=D(b),g.$isRootOrShadowRoot(e)?(c.replace(d),e=x(),g.$isElementNode(c)&&(e.setFormat(c.getFormatType()),e.setIndent(c.getIndent())),d.append(e)):p(c)&&(c=c.getParentOrThrow(),B(d,c.getChildren()),c.replace(d));else for(c=new Set,e=0;e<d.length;e++){var f=d[e];if(g.$isElementNode(f)&&f.isEmpty()&&!p(f)&&!c.has(f.getKey()))C(f,
|
||||
+b);else if(g.$isLeafNode(f))for(f=f.getParent();null!=f;){let m=f.getKey();if(q(f)){if(!c.has(m)){var h=D(b);B(h,f.getChildren());f.replace(h);c.add(m)}break}else{h=f.getParent();if(g.$isRootOrShadowRoot(h)&&!c.has(m)){c.add(m);C(f,b);break}f=h}}}}})};
|
||||
+exports.removeList=function(a){a.update(()=>{let b=g.$getSelection();if(g.$isRangeSelection(b)){var c=new Set,d=b.getNodes(),e=b.anchor.getNode();if(A(e,d))c.add(r(e));else for(e=0;e<d.length;e++){var f=d[e];g.$isLeafNode(f)&&(f=k.$getNearestNodeOfType(f,G),null!=f&&c.add(r(f)))}for(let h of c){c=h;d=t(h);for(let m of d)d=g.$createParagraphNode(),B(d,m.getChildren()),c.insertAfter(d),c=d,m.__key===b.anchor.key&&b.anchor.set(d.getKey(),0,"element"),m.__key===b.focus.key&&b.focus.set(d.getKey(),0,"element"),
|
||||
+m.remove();h.remove()}}})}
|
||||
diff --git a/LexicalListItemNode.d.ts b/LexicalListItemNode.d.ts
|
||||
index 9fd289fd0ab65e4f63b4d2814ec97f053348f9a9..cfed87598b2882973198cbb811552340a0fdcff6 100644
|
||||
--- a/LexicalListItemNode.d.ts
|
||||
+++ b/LexicalListItemNode.d.ts
|
||||
@@ -40,7 +40,6 @@ export declare class ListItemNode extends ElementNode {
|
||||
toggleChecked(): void;
|
||||
getIndent(): number;
|
||||
setIndent(indent: number): this;
|
||||
- insertBefore(nodeToInsert: LexicalNode): LexicalNode;
|
||||
canInsertAfter(node: LexicalNode): boolean;
|
||||
canReplaceWith(replacement: LexicalNode): boolean;
|
||||
canMergeWith(node: LexicalNode): boolean;
|
||||
diff --git a/LexicalListNode.d.ts b/LexicalListNode.d.ts
|
||||
index a04521af0011a36bae4a15ad5d04ce06b887d54e..ab4e18ab7e4116a1969479ef44e84657c2c51c87 100644
|
||||
--- a/LexicalListNode.d.ts
|
||||
+++ b/LexicalListNode.d.ts
|
||||
@@ -30,6 +30,7 @@ export declare class ListNode extends ElementNode {
|
||||
getStart(): number;
|
||||
createDOM(config: EditorConfig, _editor?: LexicalEditor): HTMLElement;
|
||||
updateDOM(prevNode: ListNode, dom: HTMLElement, config: EditorConfig): boolean;
|
||||
+ static transform(): (node: LexicalNode) => void;
|
||||
static importDOM(): DOMConversionMap | null;
|
||||
static importJSON(serializedNode: SerializedListNode): ListNode;
|
||||
exportDOM(editor: LexicalEditor): DOMExportOutput;
|
||||
diff --git a/formatList.d.ts b/formatList.d.ts
|
||||
index d1f43e38e50680a1248a03ae8ea71f8541c33bc1..4359cbba12fa205eb6843ad1568e02c5efcc8ffc 100644
|
||||
--- a/formatList.d.ts
|
||||
+++ b/formatList.d.ts
|
||||
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
-import { LexicalEditor, LexicalNode } from 'lexical';
|
||||
+import { LexicalEditor } from 'lexical';
|
||||
import { ListItemNode, ListNode } from './';
|
||||
import { ListType } from './LexicalListNode';
|
||||
/**
|
||||
@@ -36,12 +36,11 @@ export declare function mergeLists(list1: ListNode, list2: ListNode): void;
|
||||
export declare function removeList(editor: LexicalEditor): void;
|
||||
/**
|
||||
* Takes the value of a child ListItemNode and makes it the value the ListItemNode
|
||||
- * should be if it isn't already. If only certain children should be updated, they
|
||||
- * can be passed optionally in an array.
|
||||
+ * should be if it isn't already. Also ensures that checked is undefined if the
|
||||
+ * parent does not have a list type of 'check'.
|
||||
* @param list - The list whose children are updated.
|
||||
- * @param children - An array of the children to be updated.
|
||||
*/
|
||||
-export declare function updateChildrenListItemValue(list: ListNode, children?: Array<LexicalNode>): void;
|
||||
+export declare function updateChildrenListItemValue(list: ListNode): void;
|
||||
/**
|
||||
* Adds an empty ListNode/ListItemNode chain at listItemNode, so as to
|
||||
* create an indent effect. Won't indent ListItemNodes that have a ListNode as
|
||||
@@ -0,0 +1,26 @@
|
||||
diff --git a/LexicalRichText.dev.js b/LexicalRichText.dev.js
|
||||
index cdd0f239f13391bdbb6e1c2f39113d879d458ec2..5f069efb0015438ecdffcfc1e031e40ce290a9b7 100644
|
||||
--- a/LexicalRichText.dev.js
|
||||
+++ b/LexicalRichText.dev.js
|
||||
@@ -458,7 +458,7 @@ function registerRichText(editor) {
|
||||
}
|
||||
const dataTransfer = eventOrText.dataTransfer;
|
||||
if (dataTransfer != null) {
|
||||
- clipboard.$insertDataTransferForRichText(dataTransfer, selection, editor);
|
||||
+ clipboard.$insertDataTransferForRichText(dataTransfer, selection, editor, eventOrText);
|
||||
} else if (lexical.$isRangeSelection(selection)) {
|
||||
const data = eventOrText.data;
|
||||
if (data) {
|
||||
diff --git a/LexicalRichText.prod.js b/LexicalRichText.prod.js
|
||||
index 2912dd466be878fd794d971d31d919afce0dcb62..cd35bcf41edc5b15f435464aa155519449d6e797 100644
|
||||
--- a/LexicalRichText.prod.js
|
||||
+++ b/LexicalRichText.prod.js
|
||||
@@ -18,7 +18,7 @@ function H(b){let a=null;b instanceof DragEvent?a=b.dataTransfer:b instanceof Cl
|
||||
function I(b){var a=k.$getSelection();if(!k.$isRangeSelection(a))return!1;let d=new Set;a=a.getNodes();for(let m=0;m<a.length;m++){var e=a[m],f=e.getKey();d.has(f)||(e=h.$getNearestBlockElementAncestorOrThrow(e),f=e.getKey(),e.canIndent()&&!d.has(f)&&(d.add(f),b(e)))}return 0<d.size}function J(b){b=k.$getNearestNodeFromDOMNode(b);return k.$isDecoratorNode(b)}exports.$createHeadingNode=E;exports.$createQuoteNode=z;exports.$isHeadingNode=function(b){return b instanceof B};
|
||||
exports.$isQuoteNode=function(b){return b instanceof x};exports.DRAG_DROP_PASTE=w;exports.HeadingNode=B;exports.QuoteNode=x;exports.eventFiles=H;
|
||||
exports.registerRichText=function(b){return h.mergeRegister(b.registerCommand(k.CLICK_COMMAND,()=>{const a=k.$getSelection();return k.$isNodeSelection(a)?(a.clear(),!0):!1},0),b.registerCommand(k.DELETE_CHARACTER_COMMAND,a=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;d.deleteCharacter(a);return!0},k.COMMAND_PRIORITY_EDITOR),b.registerCommand(k.DELETE_WORD_COMMAND,a=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;d.deleteWord(a);return!0},k.COMMAND_PRIORITY_EDITOR),
|
||||
-b.registerCommand(k.DELETE_LINE_COMMAND,a=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;d.deleteLine(a);return!0},k.COMMAND_PRIORITY_EDITOR),b.registerCommand(k.CONTROLLED_TEXT_INSERTION_COMMAND,a=>{const d=k.$getSelection();if("string"===typeof a)null!==d&&d.insertText(a);else{if(null===d)return!1;const e=a.dataTransfer;null!=e?c.$insertDataTransferForRichText(e,d,b):k.$isRangeSelection(d)&&(a=a.data)&&d.insertText(a)}return!0},k.COMMAND_PRIORITY_EDITOR),b.registerCommand(k.REMOVE_TEXT_COMMAND,
|
||||
+b.registerCommand(k.DELETE_LINE_COMMAND,a=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;d.deleteLine(a);return!0},k.COMMAND_PRIORITY_EDITOR),b.registerCommand(k.CONTROLLED_TEXT_INSERTION_COMMAND,a=>{const d=k.$getSelection();if("string"===typeof a)null!==d&&d.insertText(a);else{if(null===d)return!1;const e=a.dataTransfer;null!=e?c.$insertDataTransferForRichText(e,d,b,a):k.$isRangeSelection(d)&&(a=a.data)&&d.insertText(a)}return!0},k.COMMAND_PRIORITY_EDITOR),b.registerCommand(k.REMOVE_TEXT_COMMAND,
|
||||
()=>{const a=k.$getSelection();if(!k.$isRangeSelection(a))return!1;a.removeText();return!0},k.COMMAND_PRIORITY_EDITOR),b.registerCommand(k.FORMAT_TEXT_COMMAND,a=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;d.formatText(a);return!0},k.COMMAND_PRIORITY_EDITOR),b.registerCommand(k.FORMAT_ELEMENT_COMMAND,a=>{var d=k.$getSelection();if(!k.$isRangeSelection(d)&&!k.$isNodeSelection(d))return!1;d=d.getNodes();for(const e of d)d=h.$findMatchingParent(e,f=>k.$isElementNode(f)&&!f.isInline()),
|
||||
null!==d&&d.setFormat(a);return!0},k.COMMAND_PRIORITY_EDITOR),b.registerCommand(k.INSERT_LINE_BREAK_COMMAND,a=>{const d=k.$getSelection();if(!k.$isRangeSelection(d))return!1;d.insertLineBreak(a);return!0},k.COMMAND_PRIORITY_EDITOR),b.registerCommand(k.INSERT_PARAGRAPH_COMMAND,()=>{const a=k.$getSelection();if(!k.$isRangeSelection(a))return!1;a.insertParagraph();return!0},k.COMMAND_PRIORITY_EDITOR),b.registerCommand(k.INSERT_TAB_COMMAND,()=>{k.$insertNodes([k.$createTabNode()]);return!0},k.COMMAND_PRIORITY_EDITOR),
|
||||
b.registerCommand(k.INDENT_CONTENT_COMMAND,()=>I(a=>{const d=a.getIndent();a.setIndent(d+1)}),k.COMMAND_PRIORITY_EDITOR),b.registerCommand(k.OUTDENT_CONTENT_COMMAND,()=>I(a=>{const d=a.getIndent();0<d&&a.setIndent(d-1)}),k.COMMAND_PRIORITY_EDITOR),b.registerCommand(k.KEY_ARROW_UP_COMMAND,a=>{var d=k.$getSelection();if(k.$isNodeSelection(d)&&!J(a.target)){if(a=d.getNodes(),0<a.length)return a[0].selectPrevious(),!0}else if(k.$isRangeSelection(d)&&(d=k.$getAdjacentNode(d.focus,!0),!a.shiftKey&&k.$isDecoratorNode(d)&&
|
||||
@@ -1,435 +0,0 @@
|
||||
diff --git a/Lexical.dev.js b/Lexical.dev.js
|
||||
index 7d0b792b1a519ed783440119db38c103df24ec2c..7db2312e6afecac42f1a2d5a8ebc2591ac7e0a8a 100644
|
||||
--- a/Lexical.dev.js
|
||||
+++ b/Lexical.dev.js
|
||||
@@ -87,7 +87,7 @@ const IS_FIREFOX = CAN_USE_DOM && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(naviga
|
||||
const CAN_USE_BEFORE_INPUT = CAN_USE_DOM && 'InputEvent' in window && !documentMode ? 'getTargetRanges' in new window.InputEvent('input') : false;
|
||||
const IS_SAFARI = CAN_USE_DOM && /Version\/[\d.]+.*Safari/.test(navigator.userAgent);
|
||||
const IS_IOS = CAN_USE_DOM && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
||||
-const IS_ANDROID = CAN_USE_DOM && /Android/.test(navigator.userAgent);
|
||||
+CAN_USE_DOM && /Android/.test(navigator.userAgent);
|
||||
|
||||
// Keep these in case we need to use them in the future.
|
||||
// export const IS_WINDOWS: boolean = CAN_USE_DOM && /Win/.test(navigator.platform);
|
||||
@@ -2505,9 +2505,10 @@ function onBeforeInput(event, editor) {
|
||||
}
|
||||
if ($isRangeSelection(selection)) {
|
||||
// Used for handling backspace in Android.
|
||||
- if (IS_ANDROID) {
|
||||
- $setCompositionKey(selection.anchor.key);
|
||||
- }
|
||||
+ // if (IS_ANDROID) {
|
||||
+ // $setCompositionKey(selection.anchor.key);
|
||||
+ // }
|
||||
+
|
||||
if (isPossiblyAndroidKeyPress(event.timeStamp) && editor.isComposing() && selection.anchor.key === selection.focus.key) {
|
||||
$setCompositionKey(null);
|
||||
lastKeyDownTimeStamp = 0;
|
||||
diff --git a/Lexical.prod.js b/Lexical.prod.js
|
||||
index 97af535ab5ae20aecd68122770028b4bf4afb379..abdbeddba9e14515eabdb14e5ad5af34f5127420 100644
|
||||
--- a/Lexical.prod.js
|
||||
+++ b/Lexical.prod.js
|
||||
@@ -7,214 +7,215 @@
|
||||
'use strict';let ba={},ca={},ea={},fa={},ha={},la={},ma={},na={},pa={},qa={},ra={},sa={},ta={},ua={},va={},wa={},xa={},za={},Aa={},Ba={},Ca={},Da={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={},Na={},Oa={},Pa={},Qa={},Ra={},Sa={},Ta={};
|
||||
function r(a){let b=new URLSearchParams;b.append("code",a);for(let c=1;c<arguments.length;c++)b.append("v",arguments[c]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${b} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
|
||||
let Ua="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Wa=Ua&&"documentMode"in document?document.documentMode:null,t=Ua&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Xa=Ua&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Ya=Ua&&"InputEvent"in window&&!Wa?"getTargetRanges"in new window.InputEvent("input"):!1,Za=Ua&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),$a=Ua&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
|
||||
-!window.MSStream,ab=Ua&&/Android/.test(navigator.userAgent),bb=Ua&&/^(?=.*Chrome).*/i.test(navigator.userAgent),cb=Ua&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!bb,db=Za||$a||cb?"\u00a0":"\u200b",eb=Xa?"\u00a0":db,fb=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,gb=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,
|
||||
-hb={bold:1,code:16,highlight:128,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},ib={directionless:1,unmergeable:2},jb={center:2,end:6,justify:4,left:1,right:3,start:5},kb={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},lb={normal:0,segmented:2,token:1},pb={0:"normal",2:"segmented",1:"token"},qb=!1,rb=0;function sb(a){rb=a.timeStamp}function tb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}
|
||||
-function ub(a){return a.getEditorState().read(()=>{let b=v();return null!==b?b.clone():null})}
|
||||
-function vb(a,b,c){qb=!0;let d=100<performance.now()-rb;try{w(a,()=>{let e=v()||ub(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let m=!1,p="";for(var n=0;n<b.length;n++){var l=b[n],q=l.type,u=l.target,y=wb(u,h);if(!(null===y&&u!==g||z(y)))if("characterData"===q){if(l=d&&B(y))a:{l=e;q=u;var x=y;if(C(l)){var A=l.anchor.getNode();if(A.is(x)&&l.format!==A.getFormat()){l=!1;break a}}l=3===q.nodeType&&x.isAttached()}l&&(x=xb(a._window),q=l=null,null!==x&&x.anchorNode===
|
||||
-u&&(l=x.anchorOffset,q=x.focusOffset),u=u.nodeValue,null!==u&&yb(y,u,l,q,!1))}else if("childList"===q){m=!0;q=l.addedNodes;for(x=0;x<q.length;x++){A=q[x];var aa=zb(A),da=A.parentNode;null==da||A===k||null!==aa||"BR"===A.nodeName&&tb(A,da,a)||(Xa&&(aa=A.innerText||A.nodeValue)&&(p+=aa),da.removeChild(A))}l=l.removedNodes;q=l.length;if(0<q){x=0;for(A=0;A<q;A++)if(da=l[A],"BR"===da.nodeName&&tb(da,u,a)||k===da)u.appendChild(da),x++;q!==x&&(u===g&&(y=h._nodeMap.get("root")),f.set(u,y))}}}if(0<f.size)for(let [Va,
|
||||
-ka]of f)if(E(ka))for(f=ka.getChildrenKeys(),g=Va.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(Va.appendChild(k),g=k):g!==k&&Va.replaceChild(k,g),g=g.nextSibling);else B(ka)&&ka.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(k=f[g],h=k.addedNodes,k=k.target,n=0;n<h.length;n++)y=h[n],u=y.parentNode,null==u||"BR"!==y.nodeName||tb(y,k,a)||u.removeChild(y);c.takeRecords()}null!==e&&(m&&(e.dirty=!0,Ab(e)),Xa&&Bb(a)&&e.insertRawText(p))})}finally{qb=
|
||||
-!1}}function Cb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();vb(a,c,b)}}function Db(a){0===rb&&Eb(a).addEventListener("textInput",sb,!0);a._observer=new MutationObserver((b,c)=>{vb(a,b,c)})}function Fb(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function Gb(a,b){let c=a.mergeWithSibling(b),d=F()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
|
||||
-function Hb(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&B(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{Fb(b,a)&&(a=Gb(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{Fb(a,c)&&Gb(a,c);break}}}function Ib(a){Jb(a.anchor);Jb(a.focus);return a}
|
||||
-function Jb(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!E(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let Kb=1,Lb="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};
|
||||
-function Mb(a){let b=document.activeElement;if(null===b)return!1;let c=b.nodeName;return z(wb(a))&&("INPUT"===c||"TEXTAREA"===c||"true"===b.contentEditable&&null==b.__lexicalEditor)}function Nb(a,b,c){let d=a.getRootElement();try{return null!==d&&d.contains(b)&&d.contains(c)&&null!==b&&!Mb(b)&&Ob(b)===a}catch(e){return!1}}function Ob(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=Vb(a)}return null}function Wb(a){return a.isToken()||a.isSegmented()}
|
||||
-function Xb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Yb(a,b,c){let d=hb[b];if(null!==c&&(a&d)===(c&d))return a;a^=d;"subscript"===b?a&=~hb.superscript:"superscript"===b&&(a&=~hb.subscript);return a}function Zb(a,b){if(null!=b)a.__key=b;else{G();99<$b&&r(14);b=F();var c=ac(),d=""+Kb++;c._nodeMap.set(d,a);E(a)?b._dirtyElements.set(d,!0):b._dirtyLeaves.add(d);b._cloneNotNeeded.add(d);b._dirtyType=1;a.__key=d}}
|
||||
-function bc(a){var b=a.getParent();if(null!==b){let e=a.getWritable();b=b.getWritable();var c=a.getPreviousSibling();a=a.getNextSibling();if(null===c)if(null!==a){var d=a.getWritable();b.__first=a.__key;d.__prev=null}else b.__first=null;else{d=c.getWritable();if(null!==a){let f=a.getWritable();f.__prev=d.__key;d.__next=f.__key}else d.__next=null;e.__prev=null}null===a?null!==c?(a=c.getWritable(),b.__last=c.__key,a.__next=null):b.__last=null:(a=a.getWritable(),null!==c?(c=c.getWritable(),c.__next=
|
||||
-a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}function cc(a){99<$b&&r(14);var b=a.getLatest(),c=b.__parent,d=ac();let e=F(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;let g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;E(a)?d.set(b,!0):e._dirtyLeaves.add(b)}
|
||||
-function H(a){G();var b=F();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=I(c),null!==b&&b.getWritable()),null!==a&&(a=I(a),null!==a&&a.getWritable()))}function dc(){return ec()?null:F()._compositionKey}function I(a,b){a=(b||ac())._nodeMap.get(a);return void 0===a?null:a}function zb(a,b){let c=F();a=a[`__lexicalKey_${c._key}`];return void 0!==a?I(a,b):null}function wb(a,b){for(;null!=a;){let c=zb(a,b);if(null!==c)return c;a=Vb(a)}return null}
|
||||
-function fc(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function gc(a){return a.read(()=>J().getTextContent())}function hc(a,b){w(a,()=>{var c=ac();if(!c.isEmpty())if("root"===b)J().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function J(){return ac()._nodeMap.get("root")}function Ab(a){G();let b=ac();null!==a&&(a.dirty=!0,a.setCachedNodes(null));b._selection=a}
|
||||
-function ic(a){var b=F(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=Vb(c)}c=null}return null===c?(b=b.getRootElement(),a===b?I("root"):null):I(c)}function jc(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function kc(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function lc(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
|
||||
-function mc(a,b,c){b=xb(b._window);if(null!==b){var d=b.anchorNode,{anchorOffset:e,focusOffset:f}=b;if(null!==d&&(b=3===d.nodeType?d.nodeValue:null,d=wb(d),null!==b&&B(d))){if(b===db&&c){let g=c.length;b=c;f=e=g}null!==b&&yb(d,b,e,f,a)}}}
|
||||
-function yb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){let m=f.isComposing(),p=b;(m||e)&&b[b.length-1]===db&&(p=b.slice(0,-1));b=f.getTextContent();if(e||p!==b)if(""===p)if(H(null),Za||$a||cb)f.remove();else{let n=F();setTimeout(()=>{n.update(()=>{f.isAttached()&&f.remove()})},20)}else{e=f.getParent();b=nc();var g=f.getTextContentSize(),h=dc(),k=f.getKey();f.isToken()||null!==h&&k===h&&!m||C(b)&&(null!==e&&!e.canInsertTextBefore()&&0===b.anchor.offset||b.anchor.key===a.__key&&0===b.anchor.offset&&
|
||||
+!window.MSStream;Ua&&/Android/.test(navigator.userAgent);
|
||||
+let ab=Ua&&/^(?=.*Chrome).*/i.test(navigator.userAgent),bb=Ua&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ab,cb=Za||$a||bb?"\u00a0":"\u200b",db=Xa?"\u00a0":cb,eb=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,fb=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,gb=
|
||||
+{bold:1,code:16,highlight:128,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},hb={directionless:1,unmergeable:2},ib={center:2,end:6,justify:4,left:1,right:3,start:5},jb={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},kb={normal:0,segmented:2,token:1},lb={0:"normal",2:"segmented",1:"token"},pb=!1,qb=0;function rb(a){qb=a.timeStamp}function sb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}
|
||||
+function tb(a){return a.getEditorState().read(()=>{let b=v();return null!==b?b.clone():null})}
|
||||
+function ub(a,b,c){pb=!0;let d=100<performance.now()-qb;try{w(a,()=>{let e=v()||tb(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let m=!1,p="";for(var n=0;n<b.length;n++){var l=b[n],q=l.type,u=l.target,y=vb(u,h);if(!(null===y&&u!==g||z(y)))if("characterData"===q){if(l=d&&B(y))a:{l=e;q=u;var x=y;if(C(l)){var A=l.anchor.getNode();if(A.is(x)&&l.format!==A.getFormat()){l=!1;break a}}l=3===q.nodeType&&x.isAttached()}l&&(x=wb(a._window),q=l=null,null!==x&&x.anchorNode===
|
||||
+u&&(l=x.anchorOffset,q=x.focusOffset),u=u.nodeValue,null!==u&&xb(y,u,l,q,!1))}else if("childList"===q){m=!0;q=l.addedNodes;for(x=0;x<q.length;x++){A=q[x];var aa=yb(A),da=A.parentNode;null==da||A===k||null!==aa||"BR"===A.nodeName&&sb(A,da,a)||(Xa&&(aa=A.innerText||A.nodeValue)&&(p+=aa),da.removeChild(A))}l=l.removedNodes;q=l.length;if(0<q){x=0;for(A=0;A<q;A++)if(da=l[A],"BR"===da.nodeName&&sb(da,u,a)||k===da)u.appendChild(da),x++;q!==x&&(u===g&&(y=h._nodeMap.get("root")),f.set(u,y))}}}if(0<f.size)for(let [Va,
|
||||
+ka]of f)if(E(ka))for(f=ka.getChildrenKeys(),g=Va.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(Va.appendChild(k),g=k):g!==k&&Va.replaceChild(k,g),g=g.nextSibling);else B(ka)&&ka.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(k=f[g],h=k.addedNodes,k=k.target,n=0;n<h.length;n++)y=h[n],u=y.parentNode,null==u||"BR"!==y.nodeName||sb(y,k,a)||u.removeChild(y);c.takeRecords()}null!==e&&(m&&(e.dirty=!0,zb(e)),Xa&&Ab(a)&&e.insertRawText(p))})}finally{pb=
|
||||
+!1}}function Bb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();ub(a,c,b)}}function Cb(a){0===qb&&Db(a).addEventListener("textInput",rb,!0);a._observer=new MutationObserver((b,c)=>{ub(a,b,c)})}function Eb(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function Fb(a,b){let c=a.mergeWithSibling(b),d=F()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
|
||||
+function Gb(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&B(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{Eb(b,a)&&(a=Fb(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{Eb(a,c)&&Fb(a,c);break}}}function Hb(a){Ib(a.anchor);Ib(a.focus);return a}
|
||||
+function Ib(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!E(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let Jb=1,Kb="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};
|
||||
+function Lb(a){let b=document.activeElement;if(null===b)return!1;let c=b.nodeName;return z(vb(a))&&("INPUT"===c||"TEXTAREA"===c||"true"===b.contentEditable&&null==b.__lexicalEditor)}function Mb(a,b,c){let d=a.getRootElement();try{return null!==d&&d.contains(b)&&d.contains(c)&&null!==b&&!Lb(b)&&Nb(b)===a}catch(e){return!1}}function Nb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=Ob(a)}return null}function Vb(a){return a.isToken()||a.isSegmented()}
|
||||
+function Wb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Xb(a,b,c){let d=gb[b];if(null!==c&&(a&d)===(c&d))return a;a^=d;"subscript"===b?a&=~gb.superscript:"superscript"===b&&(a&=~gb.subscript);return a}function Yb(a,b){if(null!=b)a.__key=b;else{G();99<Zb&&r(14);b=F();var c=$b(),d=""+Jb++;c._nodeMap.set(d,a);E(a)?b._dirtyElements.set(d,!0):b._dirtyLeaves.add(d);b._cloneNotNeeded.add(d);b._dirtyType=1;a.__key=d}}
|
||||
+function ac(a){var b=a.getParent();if(null!==b){let e=a.getWritable();b=b.getWritable();var c=a.getPreviousSibling();a=a.getNextSibling();if(null===c)if(null!==a){var d=a.getWritable();b.__first=a.__key;d.__prev=null}else b.__first=null;else{d=c.getWritable();if(null!==a){let f=a.getWritable();f.__prev=d.__key;d.__next=f.__key}else d.__next=null;e.__prev=null}null===a?null!==c?(a=c.getWritable(),b.__last=c.__key,a.__next=null):b.__last=null:(a=a.getWritable(),null!==c?(c=c.getWritable(),c.__next=
|
||||
+a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}function bc(a){99<Zb&&r(14);var b=a.getLatest(),c=b.__parent,d=$b();let e=F(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;let g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;E(a)?d.set(b,!0):e._dirtyLeaves.add(b)}
|
||||
+function H(a){G();var b=F();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=I(c),null!==b&&b.getWritable()),null!==a&&(a=I(a),null!==a&&a.getWritable()))}function cc(){return dc()?null:F()._compositionKey}function I(a,b){a=(b||$b())._nodeMap.get(a);return void 0===a?null:a}function yb(a,b){let c=F();a=a[`__lexicalKey_${c._key}`];return void 0!==a?I(a,b):null}function vb(a,b){for(;null!=a;){let c=yb(a,b);if(null!==c)return c;a=Ob(a)}return null}
|
||||
+function ec(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function fc(a){return a.read(()=>J().getTextContent())}function gc(a,b){w(a,()=>{var c=$b();if(!c.isEmpty())if("root"===b)J().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function J(){return $b()._nodeMap.get("root")}function zb(a){G();let b=$b();null!==a&&(a.dirty=!0,a.setCachedNodes(null));b._selection=a}
|
||||
+function hc(a){var b=F(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=Ob(c)}c=null}return null===c?(b=b.getRootElement(),a===b?I("root"):null):I(c)}function ic(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function jc(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function kc(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
|
||||
+function lc(a,b,c){b=wb(b._window);if(null!==b){var d=b.anchorNode,{anchorOffset:e,focusOffset:f}=b;if(null!==d&&(b=3===d.nodeType?d.nodeValue:null,d=vb(d),null!==b&&B(d))){if(b===cb&&c){let g=c.length;b=c;f=e=g}null!==b&&xb(d,b,e,f,a)}}}
|
||||
+function xb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){let m=f.isComposing(),p=b;(m||e)&&b[b.length-1]===cb&&(p=b.slice(0,-1));b=f.getTextContent();if(e||p!==b)if(""===p)if(H(null),Za||$a||bb)f.remove();else{let n=F();setTimeout(()=>{n.update(()=>{f.isAttached()&&f.remove()})},20)}else{e=f.getParent();b=mc();var g=f.getTextContentSize(),h=cc(),k=f.getKey();f.isToken()||null!==h&&k===h&&!m||C(b)&&(null!==e&&!e.canInsertTextBefore()&&0===b.anchor.offset||b.anchor.key===a.__key&&0===b.anchor.offset&&
|
||||
!f.canInsertTextBefore()||b.focus.key===a.__key&&b.focus.offset===g&&!f.canInsertTextAfter())?f.markDirty():(a=v(),C(a)&&null!==c&&null!==d&&(a.setTextNodeRange(f,c,f,d),f.isSegmented()&&(c=f.getTextContent(),c=K(c),f.replace(c),f=c)),f.setTextContent(p))}}}
|
||||
-function oc(a,b){if(b.isSegmented())return!0;if(!a.isCollapsed())return!1;a=a.anchor.offset;let c=b.getParentOrThrow(),d=b.isToken();return 0===a?((a=!b.canInsertTextBefore()||!c.canInsertTextBefore()||d)||(b=b.getPreviousSibling(),a=(B(b)||E(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()||d:!1}
|
||||
-function pc(a,b){void 0===a.__lexicalClassNameCache&&(a.__lexicalClassNameCache={});let c=a.__lexicalClassNameCache,d=c[b];if(void 0!==d)return d;a=a[b];return"string"===typeof a?(a=a.split(" "),c[b]=a):a}function qc(a,b,c,d,e){0!==c.size&&(c=d.__type,d=d.__key,b=b.get(c),void 0===b&&r(33,c),c=b.klass,b=a.get(c),void 0===b&&(b=new Map,a.set(c,b)),a=b.get(d),c="destroyed"===a&&"created"===e,(void 0===a||c)&&b.set(d,c?"updated":e))}
|
||||
-function rc(a,b,c){let d=a.getParent(),e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}function sc(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),rc(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?rc(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}
|
||||
-function Bb(a){a=(a=Eb(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function tc(a){return!L(a)&&!a.isLastChild()&&!a.isInline()}function uc(a,b){a=a._keyToDOMMap.get(b);void 0===a&&r(75,b);return a}function Vb(a){a=a.assignedSlot||a.parentElement;return null!==a&&11===a.nodeType?a.host:a}function vc(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function Eb(a){a=a._window;null===a&&r(78);return a}
|
||||
-function wc(a){for(a=a.getParentOrThrow();null!==a&&!xc(a);)a=a.getParentOrThrow();return a}function xc(a){return L(a)||E(a)&&a.isShadowRoot()}function yc(a){a=a.constructor.clone(a);Zb(a,null);return a}function zc(a){var b=F();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&r(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||r(98),b):a}function Ac(a,b){a=a.getParent();!L(a)||E(b)||z(b)||r(99)}function Bc(a){return(z(a)||E(a)&&!a.canBeEmpty())&&!a.isInline()}
|
||||
-function Cc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}function xb(a){return Ua?(a||window).getSelection():null}function Dc(a,b){for(;a!==J()&&null!=a;){if(b(a))return a;a=a.getParent()}return null}function Ec(a){let b=[],c=[a];for(;0<c.length;){let d=c.pop();void 0===d&&r(112);E(d)&&c.unshift(...d.getChildren());d!==a&&b.push(d)}return b}function Fc(a){return 1===a.nodeType}
|
||||
-function Gc(a){if(z(a)&&!a.isInline())return!0;if(!E(a)||xc(a))return!1;var b=a.getFirstChild();b=null===b||Hc(b)||B(b)||b.isInline();return!a.isInline()&&!1!==a.canBeEmpty()&&b}function Ic(a,b){for(;null!==a&&null!==a.getParent()&&!b(a);)a=a.getParentOrThrow();return b(a)?a:null}function Jc(a,b,c,d,e,f){for(a=a.getFirstChild();null!==a;){let g=a.__key;a.__parent===b&&(E(a)&&Jc(a,g,c,d,e,f),c.has(g)||f.delete(g),e.push(g));a=a.getNextSibling()}}
|
||||
-function Kc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;let e=[];for(let [f]of d){let g=b.get(f);void 0===g||g.isAttached()||(E(g)&&Jc(g,f,a,b,e,d),a.has(f)||d.delete(f),e.push(f))}for(let f of e)b.delete(f);for(let f of c)d=b.get(f),void 0===d||d.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}let M="",N="",Lc="",Mc,O,Nc,Oc=!1,Pc=!1,Qc,Rc=null,Sc,Tc,Uc,Vc,Wc,Xc;
|
||||
-function Yc(a,b){let c=Uc.get(a);if(null!==b){let d=Zc(a);d.parentNode===b&&b.removeChild(d)}Vc.has(a)||O._keyToDOMMap.delete(a);E(c)&&(a=id(c,Uc),jd(a,0,a.length-1,null));void 0!==c&&qc(Xc,Nc,Qc,c,"destroyed")}function jd(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&Yc(e,d)}}function kd(a,b){a.setProperty("text-align",b)}
|
||||
-function ld(a,b){var c=Mc.theme.indent;if("string"===typeof c){let d=a.classList.contains(c);0<b&&!d?a.classList.add(c):1>b&&d&&a.classList.remove(c)}c=getComputedStyle(a).getPropertyValue("--lexical-indent-base-value")||"40px";a.style.setProperty("padding-inline-start",0===b?"":`calc(${b} * ${c})`)}function md(a,b){a=a.style;0===b?kd(a,""):1===b?kd(a,"left"):2===b?kd(a,"center"):3===b?kd(a,"right"):4===b?kd(a,"justify"):5===b?kd(a,"start"):6===b&&kd(a,"end")}
|
||||
-function nd(a,b,c){let d=Vc.get(a);void 0===d&&r(60);let e=d.createDOM(Mc,O);var f=O._keyToDOMMap;e["__lexicalKey_"+O._key]=a;f.set(a,e);B(d)?e.setAttribute("data-lexical-text","true"):z(d)&&e.setAttribute("data-lexical-decorator","true");if(E(d)){a=d.__indent;f=d.__size;0!==a&&ld(e,a);if(0!==f){--f;a=id(d,Vc);var g=N;N="";od(a,d,0,f,e,null);pd(d,e);N=g}a=d.__format;0!==a&&md(e,a);d.isInline()||qd(null,d,e);tc(d)&&(M+="\n\n",Lc+="\n\n")}else f=d.getTextContent(),z(d)?(g=d.decorate(O,Mc),null!==g&&
|
||||
-rd(a,g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(N+=f)),M+=f,Lc+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));qc(Xc,Nc,Qc,d,"created");return e}function od(a,b,c,d,e,f){let g=M;for(M="";c<=d;++c)nd(a[c],e,f);tc(b)&&(M+="\n\n");e.__lexicalTextContent=M;M=g+M}function sd(a,b){a=b.get(a);return Hc(a)||z(a)&&a.isInline()}
|
||||
-function qd(a,b,c){a=null!==a&&(0===a.__size||sd(a.__last,Uc));b=0===b.__size||sd(b.__last,Vc);a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
|
||||
-function pd(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==N||c!==Rc){let f=""===N;if(f)var d=Rc;else d=N,d=fb.test(d)?"rtl":gb.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=Mc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=e.split(" "),e=h[c]=e),g.remove(...e));null===d||f&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=k.split(" "),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);Pc||(a.getWritable().__dir=d)}Rc=
|
||||
-d;b.__lexicalDirTextContent=N;b.__lexicalDir=d}}function id(a,b){let c=[];for(a=a.__first;null!==a;){let d=b.get(a);void 0===d&&r(101);c.push(a);a=d.__next}return c}
|
||||
-function td(a,b){var c=Uc.get(a),d=Vc.get(a);void 0!==c&&void 0!==d||r(61);var e=Oc||Tc.has(a)||Sc.has(a);let f=uc(O,a);if(c===d&&!e)return E(c)?(d=f.__lexicalTextContent,void 0!==d&&(M+=d,Lc+=d),d=f.__lexicalDirTextContent,void 0!==d&&(N+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(N+=d),Lc+=d,M+=d),f;c!==d&&e&&qc(Xc,Nc,Qc,d,"updated");if(d.updateDOM(c,f,Mc))return d=nd(a,null,null),null===b&&r(62),b.replaceChild(d,f),Yc(a,null),d;if(E(c)&&E(d)){a=d.__indent;a!==c.__indent&&ld(f,a);a=
|
||||
-d.__format;a!==c.__format&&md(f,a);if(e){a=d;e=N;N="";b=M;var g=c.__size,h=a.__size;M="";if(1===g&&1===h){var k=c.__first,m=a.__first;if(k===m)td(k,f);else{var p=Zc(k);m=nd(m,null,null);f.replaceChild(m,p);Yc(k,null)}}else{m=id(c,Uc);var n=id(a,Vc);if(0===g)0!==h&&od(n,a,0,h-1,f,null);else if(0===h)0!==g&&(k=null==f.__lexicalLineBreak,jd(m,0,g-1,k?null:f),k&&(f.textContent=""));else{var l=m;m=n;n=g-1;g=h-1;let u=f.firstChild,y=0;for(h=0;y<=n&&h<=g;){var q=l[y];let x=m[h];if(q===x)u=ud(td(x,f)),y++,
|
||||
-h++;else{void 0===k&&(k=new Set(l));void 0===p&&(p=new Set(m));let A=p.has(q),aa=k.has(x);A?(aa?(q=uc(O,x),q===u?u=ud(td(x,f)):(null!=u?f.insertBefore(q,u):f.appendChild(q),td(x,f)),y++):nd(x,f,u),h++):(u=ud(Zc(q)),Yc(q,f),y++)}}k=y>n;p=h>g;k&&!p?(k=m[g+1],k=void 0===k?null:O.getElementByKey(k),od(m,a,h,g,f,k)):p&&!k&&jd(l,y,n,f)}}tc(a)&&(M+="\n\n");f.__lexicalTextContent=M;M=b+M;pd(a,f);N=e;L(d)||d.isInline()||qd(c,d,f)}tc(d)&&(M+="\n\n",Lc+="\n\n")}else c=d.getTextContent(),z(d)?(e=d.decorate(O,
|
||||
-Mc),null!==e&&rd(a,e)):B(d)&&!d.isDirectionless()&&(N+=c),M+=c,Lc+=c;!Pc&&L(d)&&d.__cachedText!==Lc&&(d=d.getWritable(),d.__cachedText=Lc);return f}function rd(a,b){let c=O._pendingDecorators,d=O._decorators;if(null===c){if(d[a]===b)return;c=fc(O)}c[a]=b}function ud(a){a=a.nextSibling;null!==a&&a===O._blockCursorElement&&(a=a.nextSibling);return a}function Zc(a){let b=Wc.get(a);void 0===b&&r(75,a);return b}
|
||||
-let vd=Object.freeze({}),Cd=[["keydown",wd],["pointerdown",xd],["compositionstart",yd],["compositionend",zd],["input",Ad],["click",Bd],["cut",vd],["copy",vd],["dragstart",vd],["dragover",vd],["dragend",vd],["paste",vd],["focus",vd],["blur",vd],["drop",vd]];Ya&&Cd.push(["beforeinput",(a,b)=>Dd(a,b)]);let Ed=0,Fd=0,Gd=0,Hd=null,Id=0,Jd=!1,Kd=!1,Ld=!1,Md=!1,Nd=[0,"",0,"root",0];
|
||||
-function Od(a,b,c,d,e){let f=a.anchor,g=a.focus,h=f.getNode();var k=F();let m=xb(k._window),p=null!==m?m.anchorNode:null,n=f.key;k=k.getElementByKey(n);let l=c.length;return n!==g.key||!B(h)||(!e&&(!Ya||Gd<d+50)||h.isDirty()&&2>l||jc(c))&&f.offset!==g.offset&&!h.isComposing()||Wb(h)||h.isDirty()&&1<l||(e||!Ya)&&null!==k&&!h.isComposing()&&p!==Xb(k)||null!==m&&null!==b&&(!b.collapsed||b.startContainer!==m.anchorNode||b.startOffset!==m.anchorOffset)||h.getFormat()!==a.format||h.getStyle()!==a.style||
|
||||
-oc(a,h)}function Pd(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
|
||||
-function Qd(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(Jd&&(Jd=!1,Pd(d,e)&&Pd(f,g)))return;w(b,()=>{if(!c)Ab(null);else if(Nb(b,d,f)){var h=v();if(C(h)){var k=h.anchor,m=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var p=Eb(b).event;p=p?p.timeStamp:performance.now();let [l,q,u,y,x]=Nd;var n=J();n=!1===b.isComposing()&&""===n.getTextContent();p<x+200&&k.offset===u&&k.key===y?(h.format=l,h.style=q):"text"===k.type?(h.format=
|
||||
+function nc(a,b){if(b.isSegmented())return!0;if(!a.isCollapsed())return!1;a=a.anchor.offset;let c=b.getParentOrThrow(),d=b.isToken();return 0===a?((a=!b.canInsertTextBefore()||!c.canInsertTextBefore()||d)||(b=b.getPreviousSibling(),a=(B(b)||E(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()||d:!1}
|
||||
+function oc(a,b){void 0===a.__lexicalClassNameCache&&(a.__lexicalClassNameCache={});let c=a.__lexicalClassNameCache,d=c[b];if(void 0!==d)return d;a=a[b];return"string"===typeof a?(a=a.split(" "),c[b]=a):a}function pc(a,b,c,d,e){0!==c.size&&(c=d.__type,d=d.__key,b=b.get(c),void 0===b&&r(33,c),c=b.klass,b=a.get(c),void 0===b&&(b=new Map,a.set(c,b)),a=b.get(d),c="destroyed"===a&&"created"===e,(void 0===a||c)&&b.set(d,c?"updated":e))}
|
||||
+function qc(a,b,c){let d=a.getParent(),e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}function rc(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),qc(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?qc(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}
|
||||
+function Ab(a){a=(a=Db(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function sc(a){return!L(a)&&!a.isLastChild()&&!a.isInline()}function tc(a,b){a=a._keyToDOMMap.get(b);void 0===a&&r(75,b);return a}function Ob(a){a=a.assignedSlot||a.parentElement;return null!==a&&11===a.nodeType?a.host:a}function uc(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function Db(a){a=a._window;null===a&&r(78);return a}
|
||||
+function vc(a){for(a=a.getParentOrThrow();null!==a&&!wc(a);)a=a.getParentOrThrow();return a}function wc(a){return L(a)||E(a)&&a.isShadowRoot()}function xc(a){a=a.constructor.clone(a);Yb(a,null);return a}function yc(a){var b=F();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&r(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||r(98),b):a}function zc(a,b){a=a.getParent();!L(a)||E(b)||z(b)||r(99)}function Ac(a){return(z(a)||E(a)&&!a.canBeEmpty())&&!a.isInline()}
|
||||
+function Bc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}function wb(a){return Ua?(a||window).getSelection():null}function Cc(a,b){for(;a!==J()&&null!=a;){if(b(a))return a;a=a.getParent()}return null}function Dc(a){let b=[],c=[a];for(;0<c.length;){let d=c.pop();void 0===d&&r(112);E(d)&&c.unshift(...d.getChildren());d!==a&&b.push(d)}return b}function Ec(a){return 1===a.nodeType}
|
||||
+function Fc(a){if(z(a)&&!a.isInline())return!0;if(!E(a)||wc(a))return!1;var b=a.getFirstChild();b=null===b||Gc(b)||B(b)||b.isInline();return!a.isInline()&&!1!==a.canBeEmpty()&&b}function Hc(a,b){for(;null!==a&&null!==a.getParent()&&!b(a);)a=a.getParentOrThrow();return b(a)?a:null}function Ic(a,b,c,d,e,f){for(a=a.getFirstChild();null!==a;){let g=a.__key;a.__parent===b&&(E(a)&&Ic(a,g,c,d,e,f),c.has(g)||f.delete(g),e.push(g));a=a.getNextSibling()}}
|
||||
+function Jc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;let e=[];for(let [f]of d){let g=b.get(f);void 0===g||g.isAttached()||(E(g)&&Ic(g,f,a,b,e,d),a.has(f)||d.delete(f),e.push(f))}for(let f of e)b.delete(f);for(let f of c)d=b.get(f),void 0===d||d.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}let M="",N="",Kc="",Lc,O,Mc,Nc=!1,Oc=!1,Pc,Qc=null,Rc,Sc,Tc,Uc,Vc,Wc;
|
||||
+function Xc(a,b){let c=Tc.get(a);if(null!==b){let d=Yc(a);d.parentNode===b&&b.removeChild(d)}Uc.has(a)||O._keyToDOMMap.delete(a);E(c)&&(a=Zc(c,Tc),id(a,0,a.length-1,null));void 0!==c&&pc(Wc,Mc,Pc,c,"destroyed")}function id(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&Xc(e,d)}}function jd(a,b){a.setProperty("text-align",b)}
|
||||
+function kd(a,b){var c=Lc.theme.indent;if("string"===typeof c){let d=a.classList.contains(c);0<b&&!d?a.classList.add(c):1>b&&d&&a.classList.remove(c)}c=getComputedStyle(a).getPropertyValue("--lexical-indent-base-value")||"40px";a.style.setProperty("padding-inline-start",0===b?"":`calc(${b} * ${c})`)}function ld(a,b){a=a.style;0===b?jd(a,""):1===b?jd(a,"left"):2===b?jd(a,"center"):3===b?jd(a,"right"):4===b?jd(a,"justify"):5===b?jd(a,"start"):6===b&&jd(a,"end")}
|
||||
+function md(a,b,c){let d=Uc.get(a);void 0===d&&r(60);let e=d.createDOM(Lc,O);var f=O._keyToDOMMap;e["__lexicalKey_"+O._key]=a;f.set(a,e);B(d)?e.setAttribute("data-lexical-text","true"):z(d)&&e.setAttribute("data-lexical-decorator","true");if(E(d)){a=d.__indent;f=d.__size;0!==a&&kd(e,a);if(0!==f){--f;a=Zc(d,Uc);var g=N;N="";nd(a,d,0,f,e,null);od(d,e);N=g}a=d.__format;0!==a&&ld(e,a);d.isInline()||pd(null,d,e);sc(d)&&(M+="\n\n",Kc+="\n\n")}else f=d.getTextContent(),z(d)?(g=d.decorate(O,Lc),null!==g&&
|
||||
+qd(a,g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(N+=f)),M+=f,Kc+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));pc(Wc,Mc,Pc,d,"created");return e}function nd(a,b,c,d,e,f){let g=M;for(M="";c<=d;++c)md(a[c],e,f);sc(b)&&(M+="\n\n");e.__lexicalTextContent=M;M=g+M}function rd(a,b){a=b.get(a);return Gc(a)||z(a)&&a.isInline()}
|
||||
+function pd(a,b,c){a=null!==a&&(0===a.__size||rd(a.__last,Tc));b=0===b.__size||rd(b.__last,Uc);a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
|
||||
+function od(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==N||c!==Qc){let f=""===N;if(f)var d=Qc;else d=N,d=eb.test(d)?"rtl":fb.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=Lc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=e.split(" "),e=h[c]=e),g.remove(...e));null===d||f&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=k.split(" "),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);Oc||(a.getWritable().__dir=d)}Qc=
|
||||
+d;b.__lexicalDirTextContent=N;b.__lexicalDir=d}}function Zc(a,b){let c=[];for(a=a.__first;null!==a;){let d=b.get(a);void 0===d&&r(101);c.push(a);a=d.__next}return c}
|
||||
+function sd(a,b){var c=Tc.get(a),d=Uc.get(a);void 0!==c&&void 0!==d||r(61);var e=Nc||Sc.has(a)||Rc.has(a);let f=tc(O,a);if(c===d&&!e)return E(c)?(d=f.__lexicalTextContent,void 0!==d&&(M+=d,Kc+=d),d=f.__lexicalDirTextContent,void 0!==d&&(N+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(N+=d),Kc+=d,M+=d),f;c!==d&&e&&pc(Wc,Mc,Pc,d,"updated");if(d.updateDOM(c,f,Lc))return d=md(a,null,null),null===b&&r(62),b.replaceChild(d,f),Xc(a,null),d;if(E(c)&&E(d)){a=d.__indent;a!==c.__indent&&kd(f,a);a=
|
||||
+d.__format;a!==c.__format&&ld(f,a);if(e){a=d;e=N;N="";b=M;var g=c.__size,h=a.__size;M="";if(1===g&&1===h){var k=c.__first,m=a.__first;if(k===m)sd(k,f);else{var p=Yc(k);m=md(m,null,null);f.replaceChild(m,p);Xc(k,null)}}else{m=Zc(c,Tc);var n=Zc(a,Uc);if(0===g)0!==h&&nd(n,a,0,h-1,f,null);else if(0===h)0!==g&&(k=null==f.__lexicalLineBreak,id(m,0,g-1,k?null:f),k&&(f.textContent=""));else{var l=m;m=n;n=g-1;g=h-1;let u=f.firstChild,y=0;for(h=0;y<=n&&h<=g;){var q=l[y];let x=m[h];if(q===x)u=td(sd(x,f)),y++,
|
||||
+h++;else{void 0===k&&(k=new Set(l));void 0===p&&(p=new Set(m));let A=p.has(q),aa=k.has(x);A?(aa?(q=tc(O,x),q===u?u=td(sd(x,f)):(null!=u?f.insertBefore(q,u):f.appendChild(q),sd(x,f)),y++):md(x,f,u),h++):(u=td(Yc(q)),Xc(q,f),y++)}}k=y>n;p=h>g;k&&!p?(k=m[g+1],k=void 0===k?null:O.getElementByKey(k),nd(m,a,h,g,f,k)):p&&!k&&id(l,y,n,f)}}sc(a)&&(M+="\n\n");f.__lexicalTextContent=M;M=b+M;od(a,f);N=e;L(d)||d.isInline()||pd(c,d,f)}sc(d)&&(M+="\n\n",Kc+="\n\n")}else c=d.getTextContent(),z(d)?(e=d.decorate(O,
|
||||
+Lc),null!==e&&qd(a,e)):B(d)&&!d.isDirectionless()&&(N+=c),M+=c,Kc+=c;!Oc&&L(d)&&d.__cachedText!==Kc&&(d=d.getWritable(),d.__cachedText=Kc);return f}function qd(a,b){let c=O._pendingDecorators,d=O._decorators;if(null===c){if(d[a]===b)return;c=ec(O)}c[a]=b}function td(a){a=a.nextSibling;null!==a&&a===O._blockCursorElement&&(a=a.nextSibling);return a}function Yc(a){let b=Vc.get(a);void 0===b&&r(75,a);return b}
|
||||
+let ud=Object.freeze({}),Bd=[["keydown",vd],["pointerdown",wd],["compositionstart",xd],["compositionend",yd],["input",zd],["click",Ad],["cut",ud],["copy",ud],["dragstart",ud],["dragover",ud],["dragend",ud],["paste",ud],["focus",ud],["blur",ud],["drop",ud]];Ya&&Bd.push(["beforeinput",(a,b)=>Cd(a,b)]);let Dd=0,Ed=0,Fd=0,Gd=null,Hd=0,Id=!1,Jd=!1,Kd=!1,Ld=!1,Md=[0,"",0,"root",0];
|
||||
+function Nd(a,b,c,d,e){let f=a.anchor,g=a.focus,h=f.getNode();var k=F();let m=wb(k._window),p=null!==m?m.anchorNode:null,n=f.key;k=k.getElementByKey(n);let l=c.length;return n!==g.key||!B(h)||(!e&&(!Ya||Fd<d+50)||h.isDirty()&&2>l||ic(c))&&f.offset!==g.offset&&!h.isComposing()||Vb(h)||h.isDirty()&&1<l||(e||!Ya)&&null!==k&&!h.isComposing()&&p!==Wb(k)||null!==m&&null!==b&&(!b.collapsed||b.startContainer!==m.anchorNode||b.startOffset!==m.anchorOffset)||h.getFormat()!==a.format||h.getStyle()!==a.style||
|
||||
+nc(a,h)}function Od(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
|
||||
+function Pd(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(Id&&(Id=!1,Od(d,e)&&Od(f,g)))return;w(b,()=>{if(!c)zb(null);else if(Mb(b,d,f)){var h=v();if(C(h)){var k=h.anchor,m=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var p=Db(b).event;p=p?p.timeStamp:performance.now();let [l,q,u,y,x]=Md;var n=J();n=!1===b.isComposing()&&""===n.getTextContent();p<x+200&&k.offset===u&&k.key===y?(h.format=l,h.style=q):"text"===k.type?(h.format=
|
||||
m.getFormat(),h.style=m.getStyle()):"element"!==k.type||n||(h.format=0,h.style="")}else{k=255;m=!1;p=h.getNodes();n=p.length;for(let l=0;l<n;l++){let q=p[l];if(B(q)&&(m=!0,k&=q.getFormat(),0===k))break}h.format=m?k:0}}R(b,ba,void 0)}})}
|
||||
-function Bd(a,b){w(b,()=>{let c=v();var d=xb(b._window);let e=nc();if(d)if(C(c)){let g=c.anchor;var f=g.getNode();"element"===g.type&&0===g.offset&&c.isCollapsed()&&!L(f)&&1===J().getChildrenSize()&&f.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)?(d.removeAllRanges(),c.dirty=!0):3!==a.detail||c.isCollapsed()||(d=c.focus.getNode(),f!==d&&(E(f)?f.select(0):f.getParentOrThrow().select(0)))}else"touch"===a.pointerType&&(f=d.anchorNode,null!==f&&(f=f.nodeType,1===f||3===f))&&(d=Rd(e,d,b),Ab(d));
|
||||
-R(b,ca,a)})}function xd(a,b){let c=a.target;a=a.pointerType;c instanceof Node&&"touch"!==a&&w(b,()=>{z(wb(c))||(Kd=!0)})}function Sd(a){if(!a.getTargetRanges)return null;a=a.getTargetRanges();return 0===a.length?null:a[0]}function Td(a,b){return a!==b||E(a)||E(b)||!a.isToken()||!b.isToken()}
|
||||
-function Dd(a,b){let c=a.inputType,d=Sd(a);"deleteCompositionText"===c||Xa&&Bb(b)||"insertCompositionText"!==c&&w(b,()=>{let e=v();if("deleteContentBackward"===c){if(null===e){var f=nc();if(!C(f))return;Ab(f.clone())}if(C(e)){ab&&H(e.anchor.key);229===Fd&&a.timeStamp<Ed+30&&b.isComposing()&&e.anchor.key===e.focus.key?(H(null),Ed=0,setTimeout(()=>{w(b,()=>{H(null)})},30),C(e)&&(f=e.anchor.getNode(),f.markDirty(),e.format=f.getFormat(),e.style=f.getStyle()),1>=e.anchor.getNode().getTextContent().length&&
|
||||
-(a.preventDefault(),R(b,ea,!0))):(a.preventDefault(),R(b,ea,!0));return}}if(C(e)){f=a.data;null!==Hd&&mc(!1,b,Hd);e.dirty&&null===Hd||!e.isCollapsed()||L(e.anchor.getNode())||null===d||e.applyDOMRange(d);Hd=null;var g=e.focus,h=e.anchor.getNode();g=g.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===f?(a.preventDefault(),R(b,fa,!1)):"\n\n"===f?(a.preventDefault(),R(b,ha,void 0)):null==f&&a.dataTransfer?(f=a.dataTransfer.getData("text/plain"),a.preventDefault(),e.insertRawText(f)):null!=
|
||||
-f&&Od(e,d,f,a.timeStamp,!0)?(a.preventDefault(),R(b,la,f)):Hd=f,Gd=a.timeStamp;else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":R(b,la,a);break;case "insertFromComposition":H(null);R(b,la,a);break;case "insertLineBreak":H(null);R(b,fa,!1);break;case "insertParagraph":H(null);Ld&&!$a?(Ld=!1,R(b,fa,!1)):R(b,ha,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":R(b,ma,a);break;case "deleteByComposition":Td(h,g)&&R(b,na,a);
|
||||
-break;case "deleteByDrag":case "deleteByCut":R(b,na,a);break;case "deleteContent":R(b,ea,!1);break;case "deleteWordBackward":R(b,pa,!0);break;case "deleteWordForward":R(b,pa,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":R(b,qa,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":R(b,qa,!1);break;case "formatStrikeThrough":R(b,ra,"strikethrough");break;case "formatBold":R(b,ra,"bold");break;case "formatItalic":R(b,ra,"italic");break;
|
||||
-case "formatUnderline":R(b,ra,"underline");break;case "historyUndo":R(b,sa,void 0);break;case "historyRedo":R(b,ta,void 0)}}})}
|
||||
-function Ad(a,b){a.stopPropagation();w(b,()=>{var c=v(),d=a.data,e=Sd(a);if(null!=d&&C(c)&&Od(c,e,d,a.timeStamp,!1)){Md&&(Ud(b,d),Md=!1);var f=c.anchor,g=f.getNode();e=xb(b._window);if(null===e)return;let h=f.offset;if(f=Ya&&!c.isCollapsed()&&B(g)&&null!==e.anchorNode)g=g.getTextContent().slice(0,h)+d+g.getTextContent().slice(h+c.focus.offset),e=e.anchorNode,f=g===(3===e.nodeType?e.nodeValue:null);f||R(b,la,d);d=d.length;Xa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=
|
||||
-d);Za||$a||cb||!b.isComposing()||(Ed=0,H(null))}else mc(!1,b,null!==d?d:void 0),Md&&(Ud(b,d||void 0),Md=!1);G();c=F();Cb(c)});Hd=null}function yd(a,b){w(b,()=>{let c=v();if(C(c)&&!b.isComposing()){let d=c.anchor,e=c.anchor.getNode();H(d.key);(a.timeStamp<Ed+30||"element"===d.type||!c.isCollapsed()||e.getFormat()!==c.format||e.getStyle()!==c.style)&&R(b,la,eb)}})}
|
||||
-function Ud(a,b){var c=a._compositionKey;H(null);if(null!==c&&null!=b){if(""===b){b=I(c);a=Xb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&yb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=v(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);R(a,Ca,null);return}}mc(!0,a,b)}function zd(a,b){Xa?Md=!0:w(b,()=>{Ud(b,a.data)})}
|
||||
-function wd(a,b){Ed=a.timeStamp;Fd=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(!R(b,ua,a)){if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)Ld=!0,R(b,Ca,a);else if(32===c)R(b,Da,a);else if(t&&e&&79===c)a.preventDefault(),Ld=!0,R(b,fa,!0);else if(13!==c||d){var h=t?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?R(b,Ga,a):(a.preventDefault(),R(b,ea,!0)):27===c?R(b,Ha,
|
||||
+function Ad(a,b){w(b,()=>{let c=v();var d=wb(b._window);let e=mc();if(d)if(C(c)){let g=c.anchor;var f=g.getNode();"element"===g.type&&0===g.offset&&c.isCollapsed()&&!L(f)&&1===J().getChildrenSize()&&f.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)?(d.removeAllRanges(),c.dirty=!0):3!==a.detail||c.isCollapsed()||(d=c.focus.getNode(),f!==d&&(E(f)?f.select(0):f.getParentOrThrow().select(0)))}else"touch"===a.pointerType&&(f=d.anchorNode,null!==f&&(f=f.nodeType,1===f||3===f))&&(d=Qd(e,d,b),zb(d));
|
||||
+R(b,ca,a)})}function wd(a,b){let c=a.target;a=a.pointerType;c instanceof Node&&"touch"!==a&&w(b,()=>{z(vb(c))||(Jd=!0)})}function Rd(a){if(!a.getTargetRanges)return null;a=a.getTargetRanges();return 0===a.length?null:a[0]}function Sd(a,b){return a!==b||E(a)||E(b)||!a.isToken()||!b.isToken()}
|
||||
+function Cd(a,b){let c=a.inputType,d=Rd(a);"deleteCompositionText"===c||Xa&&Ab(b)||"insertCompositionText"!==c&&w(b,()=>{let e=v();if("deleteContentBackward"===c){if(null===e){var f=mc();if(!C(f))return;zb(f.clone())}if(C(e)){229===Ed&&a.timeStamp<Dd+30&&b.isComposing()&&e.anchor.key===e.focus.key?(H(null),Dd=0,setTimeout(()=>{w(b,()=>{H(null)})},30),C(e)&&(f=e.anchor.getNode(),f.markDirty(),e.format=f.getFormat(),e.style=f.getStyle()),1>=e.anchor.getNode().getTextContent().length&&(a.preventDefault(),
|
||||
+R(b,ea,!0))):(a.preventDefault(),R(b,ea,!0));return}}if(C(e)){f=a.data;null!==Gd&&lc(!1,b,Gd);e.dirty&&null===Gd||!e.isCollapsed()||L(e.anchor.getNode())||null===d||e.applyDOMRange(d);Gd=null;var g=e.focus,h=e.anchor.getNode();g=g.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===f?(a.preventDefault(),R(b,fa,!1)):"\n\n"===f?(a.preventDefault(),R(b,ha,void 0)):null==f&&a.dataTransfer?(f=a.dataTransfer.getData("text/plain"),a.preventDefault(),e.insertRawText(f)):null!=f&&Nd(e,d,f,a.timeStamp,
|
||||
+!0)?(a.preventDefault(),R(b,la,f)):Gd=f,Fd=a.timeStamp;else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":R(b,la,a);break;case "insertFromComposition":H(null);R(b,la,a);break;case "insertLineBreak":H(null);R(b,fa,!1);break;case "insertParagraph":H(null);Kd&&!$a?(Kd=!1,R(b,fa,!1)):R(b,ha,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":R(b,ma,a);break;case "deleteByComposition":Sd(h,g)&&R(b,na,a);break;case "deleteByDrag":case "deleteByCut":R(b,
|
||||
+na,a);break;case "deleteContent":R(b,ea,!1);break;case "deleteWordBackward":R(b,pa,!0);break;case "deleteWordForward":R(b,pa,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":R(b,qa,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":R(b,qa,!1);break;case "formatStrikeThrough":R(b,ra,"strikethrough");break;case "formatBold":R(b,ra,"bold");break;case "formatItalic":R(b,ra,"italic");break;case "formatUnderline":R(b,ra,"underline");break;
|
||||
+case "historyUndo":R(b,sa,void 0);break;case "historyRedo":R(b,ta,void 0)}}})}
|
||||
+function zd(a,b){a.stopPropagation();w(b,()=>{var c=v(),d=a.data,e=Rd(a);if(null!=d&&C(c)&&Nd(c,e,d,a.timeStamp,!1)){Ld&&(Td(b,d),Ld=!1);var f=c.anchor,g=f.getNode();e=wb(b._window);if(null===e)return;let h=f.offset;if(f=Ya&&!c.isCollapsed()&&B(g)&&null!==e.anchorNode)g=g.getTextContent().slice(0,h)+d+g.getTextContent().slice(h+c.focus.offset),e=e.anchorNode,f=g===(3===e.nodeType?e.nodeValue:null);f||R(b,la,d);d=d.length;Xa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=
|
||||
+d);Za||$a||bb||!b.isComposing()||(Dd=0,H(null))}else lc(!1,b,null!==d?d:void 0),Ld&&(Td(b,d||void 0),Ld=!1);G();c=F();Bb(c)});Gd=null}function xd(a,b){w(b,()=>{let c=v();if(C(c)&&!b.isComposing()){let d=c.anchor,e=c.anchor.getNode();H(d.key);(a.timeStamp<Dd+30||"element"===d.type||!c.isCollapsed()||e.getFormat()!==c.format||e.getStyle()!==c.style)&&R(b,la,db)}})}
|
||||
+function Td(a,b){var c=a._compositionKey;H(null);if(null!==c&&null!=b){if(""===b){b=I(c);a=Wb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&xb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=v(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);R(a,Ca,null);return}}lc(!0,a,b)}function yd(a,b){Xa?Ld=!0:w(b,()=>{Td(b,a.data)})}
|
||||
+function vd(a,b){Dd=a.timeStamp;Ed=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(!R(b,ua,a)){if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)Kd=!0,R(b,Ca,a);else if(32===c)R(b,Da,a);else if(t&&e&&79===c)a.preventDefault(),Kd=!0,R(b,fa,!0);else if(13!==c||d){var h=t?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?R(b,Ga,a):(a.preventDefault(),R(b,ea,!0)):27===c?R(b,Ha,
|
||||
a):(h=t?d||g||f?!1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?R(b,Ia,a):(a.preventDefault(),R(b,ea,!1)):8===c&&(t?g:e)?(a.preventDefault(),R(b,pa,!0)):46===c&&(t?g:e)?(a.preventDefault(),R(b,pa,!1)):t&&f&&8===c?(a.preventDefault(),R(b,qa,!0)):t&&f&&46===c?(a.preventDefault(),R(b,qa,!1)):66===c&&!g&&(t?f:e)?(a.preventDefault(),R(b,ra,"bold")):85===c&&!g&&(t?f:e)?(a.preventDefault(),R(b,ra,"underline")):73===c&&!g&&(t?f:e)?(a.preventDefault(),R(b,ra,"italic")):9!==c||g||e||f?90===c&&!d&&(t?f:e)?(a.preventDefault(),
|
||||
-R(b,sa,void 0)):(h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),R(b,ta,void 0)):Vd(b._editorState._selection)?(h=d?!1:67===c?t?f:e:!1,h?(a.preventDefault(),R(b,Oa,a)):(h=d?!1:88===c?t?f:e:!1,h?(a.preventDefault(),R(b,Pa,a)):65===c&&(t?f:e)&&(a.preventDefault(),R(b,Qa,a)))):!Xa&&65===c&&(t?f:e)&&(a.preventDefault(),R(b,Qa,a))):R(b,Ja,a))}else Ld=!1,R(b,Ca,a);else R(b,Ba,a);else R(b,Aa,a);else R(b,za,a);else R(b,xa,a);else R(b,wa,a);else R(b,va,a);(e||d||g||f)&&R(b,Ta,a)}}}
|
||||
-function Wd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let Xd=new Map;function Yd(a){a=a.target;let b=xb(null==a?null:9===a.nodeType?a.defaultView:a.ownerDocument.defaultView);if(null!==b){var c=Ob(b.anchorNode);if(null!==c){Kd&&(Kd=!1,w(c,()=>{var g=nc(),h=b.anchorNode;null!==h&&(h=h.nodeType,1===h||3===h)&&(g=Rd(g,b,c),Ab(g))}));a=kc(c);a=a[a.length-1];var d=a._key,e=Xd.get(d),f=e||a;f!==c&&Qd(b,f,!1);Qd(b,c,!0);c!==a?Xd.set(d,c):e&&Xd.delete(d)}}}
|
||||
-function Zd(a,b){0===Id&&a.ownerDocument.addEventListener("selectionchange",Yd);Id++;a.__lexicalEditor=b;let c=Wd(a);for(let d=0;d<Cd.length;d++){let [e,f]=Cd[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return R(b,Pa,h);case "copy":return R(b,Oa,h);case "paste":return R(b,ma,h);case "dragstart":return R(b,La,h);case "dragover":return R(b,Ma,h);case "dragend":return R(b,
|
||||
+R(b,sa,void 0)):(h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),R(b,ta,void 0)):Ud(b._editorState._selection)?(h=d?!1:67===c?t?f:e:!1,h?(a.preventDefault(),R(b,Oa,a)):(h=d?!1:88===c?t?f:e:!1,h?(a.preventDefault(),R(b,Pa,a)):65===c&&(t?f:e)&&(a.preventDefault(),R(b,Qa,a)))):!Xa&&65===c&&(t?f:e)&&(a.preventDefault(),R(b,Qa,a))):R(b,Ja,a))}else Kd=!1,R(b,Ca,a);else R(b,Ba,a);else R(b,Aa,a);else R(b,za,a);else R(b,xa,a);else R(b,wa,a);else R(b,va,a);(e||d||g||f)&&R(b,Ta,a)}}}
|
||||
+function Vd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let Wd=new Map;function Xd(a){a=a.target;let b=wb(null==a?null:9===a.nodeType?a.defaultView:a.ownerDocument.defaultView);if(null!==b){var c=Nb(b.anchorNode);if(null!==c){Jd&&(Jd=!1,w(c,()=>{var g=mc(),h=b.anchorNode;null!==h&&(h=h.nodeType,1===h||3===h)&&(g=Qd(g,b,c),zb(g))}));a=jc(c);a=a[a.length-1];var d=a._key,e=Wd.get(d),f=e||a;f!==c&&Pd(b,f,!1);Pd(b,c,!0);c!==a?Wd.set(d,c):e&&Wd.delete(d)}}}
|
||||
+function Yd(a,b){0===Hd&&a.ownerDocument.addEventListener("selectionchange",Xd);Hd++;a.__lexicalEditor=b;let c=Vd(a);for(let d=0;d<Bd.length;d++){let [e,f]=Bd[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return R(b,Pa,h);case "copy":return R(b,Oa,h);case "paste":return R(b,ma,h);case "dragstart":return R(b,La,h);case "dragover":return R(b,Ma,h);case "dragend":return R(b,
|
||||
Na,h);case "focus":return R(b,Ra,h);case "blur":return R(b,Sa,h);case "drop":return R(b,Ka,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}
|
||||
-function $d(a,b,c){G();var d=a.__key;let e=a.getParent();if(null!==e){var f=v();if(C(f)&&E(a)){var {anchor:g,focus:h}=f;var k=g.getNode();var m=h.getNode();vc(k,a)&&g.set(a.__key,0,"element");vc(m,a)&&h.set(a.__key,0,"element")}k=f;m=!1;if(C(k)&&b){f=k.anchor;let p=k.focus;f.key===d&&(ae(f,a,e,a.getPreviousSibling(),a.getNextSibling()),m=!0);p.key===d&&(ae(p,a,e,a.getPreviousSibling(),a.getNextSibling()),m=!0)}else Vd(k)&&b&&a.isSelected()&&a.selectPrevious();C(k)&&b&&!m?(d=a.getIndexWithinParent(),
|
||||
-bc(a),be(k,e,d,-1)):bc(a);c||xc(e)||e.canBeEmpty()||!e.isEmpty()||$d(e,b);b&&L(e)&&e.isEmpty()&&e.selectEnd()}}
|
||||
-class ce{static getType(){r(64,this.name)}static clone(){r(65,this.name)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;Zb(this,a)}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=I(a);if(null===a)break;a=a.__parent}return!1}isSelected(a){a=a||v();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return B(this)?b:C(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===
|
||||
-a.focus.key&&a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){var a=this.getParent();if(null===a)return-1;a=a.getFirstChild();let b=0;for(;null!==a;){if(this.is(a))return b;b++;a=a.getNextSibling()}return-1}getParent(){let a=this.getLatest().__parent;return null===a?null:I(a)}getParentOrThrow(){let a=this.getParent();null===a&&r(66,this.__key);return a}getTopLevelElement(){let a=this;for(;null!==a;){let b=a.getParent();if(xc(b))return a;a=b}return null}getTopLevelElementOrThrow(){let a=
|
||||
+function Zd(a,b,c){G();var d=a.__key;let e=a.getParent();if(null!==e){var f=v();if(C(f)&&E(a)){var {anchor:g,focus:h}=f;var k=g.getNode();var m=h.getNode();uc(k,a)&&g.set(a.__key,0,"element");uc(m,a)&&h.set(a.__key,0,"element")}k=f;m=!1;if(C(k)&&b){f=k.anchor;let p=k.focus;f.key===d&&($d(f,a,e,a.getPreviousSibling(),a.getNextSibling()),m=!0);p.key===d&&($d(p,a,e,a.getPreviousSibling(),a.getNextSibling()),m=!0)}else Ud(k)&&b&&a.isSelected()&&a.selectPrevious();C(k)&&b&&!m?(d=a.getIndexWithinParent(),
|
||||
+ac(a),ae(k,e,d,-1)):ac(a);c||wc(e)||e.canBeEmpty()||!e.isEmpty()||Zd(e,b);b&&L(e)&&e.isEmpty()&&e.selectEnd()}}
|
||||
+class be{static getType(){r(64,this.name)}static clone(){r(65,this.name)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;Yb(this,a)}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=I(a);if(null===a)break;a=a.__parent}return!1}isSelected(a){a=a||v();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return B(this)?b:C(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===
|
||||
+a.focus.key&&a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){var a=this.getParent();if(null===a)return-1;a=a.getFirstChild();let b=0;for(;null!==a;){if(this.is(a))return b;b++;a=a.getNextSibling()}return-1}getParent(){let a=this.getLatest().__parent;return null===a?null:I(a)}getParentOrThrow(){let a=this.getParent();null===a&&r(66,this.__key);return a}getTopLevelElement(){let a=this;for(;null!==a;){let b=a.getParent();if(wc(b))return a;a=b}return null}getTopLevelElementOrThrow(){let a=
|
||||
this.getTopLevelElement();null===a&&r(67,this.__key);return a}getParents(){let a=[],b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){let a=[],b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){let a=this.getLatest().__prev;return null===a?null:I(a)}getPreviousSiblings(){let a=[];var b=this.getParent();if(null===b)return a;for(b=b.getFirstChild();null!==b&&!b.is(this);)a.push(b),b=b.getNextSibling();return a}getNextSibling(){let a=
|
||||
this.getLatest().__next;return null===a?null:I(a)}getNextSiblings(){let a=[],b=this.getNextSibling();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getCommonAncestor(a){let b=this.getParents();var c=a.getParents();E(this)&&b.unshift(this);E(a)&&c.unshift(a);a=b.length;var d=c.length;if(0===a||0===d||b[a-1]!==c[d-1])return null;c=new Set(c);for(d=0;d<a;d++){let e=b[d];if(c.has(e))return e}return null}is(a){return null==a?!1:this.__key===a.__key}isBefore(a){if(this===a)return!1;if(a.isParentOf(this))return!0;
|
||||
if(this.isParentOf(a))return!1;var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=c.getIndexWithinParent();break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===b){b=c.getIndexWithinParent();break}c=a}return d<b}isParentOf(a){let b=this.__key;if(b===a.__key)return!1;for(;null!==a;){if(a.__key===b)return!0;a=a.getParent()}return!1}getNodesBetween(a){let b=this.isBefore(a),c=[],d=new Set;for(var e=this;;){var f=e.__key;d.has(f)||(d.add(f),c.push(e));if(e===a)break;
|
||||
f=E(e)?b?e.getFirstChild():e.getLastChild():null;if(null!==f)e=f;else if(f=b?e.getNextSibling():e.getPreviousSibling(),null!==f)e=f;else{e=e.getParentOrThrow();d.has(e.__key)||c.push(e);if(e===a)break;f=e;do null===f&&r(68),e=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(null!==e||d.has(f.__key)||c.push(f));while(null===e)}}b||c.reverse();return c}isDirty(){let a=F()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=I(this.__key);null===a&&r(113);return a}getWritable(){G();
|
||||
-var a=ac(),b=F();a=a._nodeMap;let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=v();de(f)&&f.setCachedNodes(null);if(b.has(c))return cc(d),d;f=d.constructor.clone(d);f.__parent=e;f.__next=d.__next;f.__prev=d.__prev;E(d)&&E(f)?(f.__first=d.__first,f.__last=d.__last,f.__size=d.__size,f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):B(d)&&B(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;cc(f);a.set(c,f);
|
||||
-return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){r(70)}updateDOM(){r(71)}exportDOM(a){return{element:this.createDOM(a._config,a)}}exportJSON(){r(72)}static importJSON(){r(18,this.name)}static transform(){return null}remove(a){$d(this,!0,a)}replace(a,b){G();var c=v();null!==c&&(c=c.clone());Ac(this,a);let d=this.getLatest(),e=this.__key,f=a.__key,g=a.getWritable();a=this.getParentOrThrow().getWritable();let h=a.__size;bc(g);let k=d.getPreviousSibling(),
|
||||
-m=d.getNextSibling(),p=d.__prev,n=d.__next,l=d.__parent;$d(d,!1,!0);null===k?a.__first=f:k.getWritable().__next=f;g.__prev=p;null===m?a.__last=f:m.getWritable().__prev=f;g.__next=n;g.__parent=l;a.__size=h;b&&this.getChildren().forEach(q=>{g.append(q)});C(c)&&(Ab(c),b=c.anchor,c=c.focus,b.key===e&&ee(b,g),c.key===e&&ee(c,g));dc()===e&&H(f);return g}insertAfter(a,b=!0){G();Ac(this,a);var c=this.getWritable();let d=a.getWritable();var e=d.getParent();let f=v();var g=!1,h=!1;if(null!==e){var k=a.getIndexWithinParent();
|
||||
-bc(d);C(f)&&(h=e.__key,g=f.anchor,e=f.focus,g="element"===g.type&&g.key===h&&g.offset===k+1,h="element"===e.type&&e.key===h&&e.offset===k+1)}e=this.getNextSibling();k=this.getParentOrThrow().getWritable();let m=d.__key,p=c.__next;null===e?k.__last=m:e.getWritable().__prev=m;k.__size++;c.__next=m;d.__next=p;d.__prev=c.__key;d.__parent=c.__parent;b&&C(f)&&(b=this.getIndexWithinParent(),be(f,k,b+1),c=k.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));return a}insertBefore(a,b=
|
||||
-!0){G();Ac(this,a);var c=this.getWritable();let d=a.getWritable(),e=d.__key;bc(d);let f=this.getPreviousSibling(),g=this.getParentOrThrow().getWritable(),h=c.__prev,k=this.getIndexWithinParent();null===f?g.__first=e:f.getWritable().__next=e;g.__size++;c.__prev=e;d.__prev=h;d.__next=c.__key;d.__parent=c.__parent;c=v();b&&C(c)&&(b=this.getParentOrThrow(),be(c,b,k));return a}isParentRequired(){return!1}createParentElementNode(){return fe()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,
|
||||
+var a=$b(),b=F();a=a._nodeMap;let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=v();ce(f)&&f.setCachedNodes(null);if(b.has(c))return bc(d),d;f=d.constructor.clone(d);f.__parent=e;f.__next=d.__next;f.__prev=d.__prev;E(d)&&E(f)?(f.__first=d.__first,f.__last=d.__last,f.__size=d.__size,f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):B(d)&&B(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;bc(f);a.set(c,f);
|
||||
+return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){r(70)}updateDOM(){r(71)}exportDOM(a){return{element:this.createDOM(a._config,a)}}exportJSON(){r(72)}static importJSON(){r(18,this.name)}static transform(){return null}remove(a){Zd(this,!0,a)}replace(a,b){G();var c=v();null!==c&&(c=c.clone());zc(this,a);let d=this.getLatest(),e=this.__key,f=a.__key,g=a.getWritable();a=this.getParentOrThrow().getWritable();let h=a.__size;ac(g);let k=d.getPreviousSibling(),
|
||||
+m=d.getNextSibling(),p=d.__prev,n=d.__next,l=d.__parent;Zd(d,!1,!0);null===k?a.__first=f:k.getWritable().__next=f;g.__prev=p;null===m?a.__last=f:m.getWritable().__prev=f;g.__next=n;g.__parent=l;a.__size=h;b&&this.getChildren().forEach(q=>{g.append(q)});C(c)&&(zb(c),b=c.anchor,c=c.focus,b.key===e&&de(b,g),c.key===e&&de(c,g));cc()===e&&H(f);return g}insertAfter(a,b=!0){G();zc(this,a);var c=this.getWritable();let d=a.getWritable();var e=d.getParent();let f=v();var g=!1,h=!1;if(null!==e){var k=a.getIndexWithinParent();
|
||||
+ac(d);C(f)&&(h=e.__key,g=f.anchor,e=f.focus,g="element"===g.type&&g.key===h&&g.offset===k+1,h="element"===e.type&&e.key===h&&e.offset===k+1)}e=this.getNextSibling();k=this.getParentOrThrow().getWritable();let m=d.__key,p=c.__next;null===e?k.__last=m:e.getWritable().__prev=m;k.__size++;c.__next=m;d.__next=p;d.__prev=c.__key;d.__parent=c.__parent;b&&C(f)&&(b=this.getIndexWithinParent(),ae(f,k,b+1),c=k.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));return a}insertBefore(a,b=
|
||||
+!0){G();zc(this,a);var c=this.getWritable();let d=a.getWritable(),e=d.__key;ac(d);let f=this.getPreviousSibling(),g=this.getParentOrThrow().getWritable(),h=c.__prev,k=this.getIndexWithinParent();null===f?g.__first=e:f.getWritable().__next=e;g.__size++;c.__prev=e;d.__prev=h;d.__next=c.__key;d.__parent=c.__parent;c=v();b&&C(c)&&(b=this.getParentOrThrow(),ae(c,b,k));return a}isParentRequired(){return!1}createParentElementNode(){return ee()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,
|
||||
0)}selectPrevious(a,b){G();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):E(c)?c.select():B(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){G();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():E(c)?c.select(0,0):B(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}
|
||||
-function ge(a,b,c){c=c||b.getParentOrThrow().getLastChild();let d=b;for(b=[b];d!==c;){if(!d.getNextSibling())throw Error("insertRangeAfter: lastToInsert must be a later sibling of firstToInsert");d=d.getNextSibling();b.push(d)}for(let e of b)a=a.insertAfter(e)}
|
||||
-class he extends ce{static getType(){return"linebreak"}static clone(a){return new he(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:a=>{let b=a.parentElement,c,d;return null!==b&&((c=b.firstChild)===a||c.nextSibling===a&&3===c.nodeType&&null!==(c.textContent||"").match(/^( |\t|\r?\n)+$/))&&((d=b.lastChild)===a||d.previousSibling===a&&3===d.nodeType&&null!==(d.textContent||"").match(/^( |\t|\r?\n)+$/))?
|
||||
-null:{conversion:ie,priority:0}}}}static importJSON(){return je()}exportJSON(){return{type:"linebreak",version:1}}}function ie(){return{node:je()}}function je(){return zc(new he)}function Hc(a){return a instanceof he}function ke(a,b){return b&16?"code":b&128?"mark":b&32?"sub":b&64?"sup":null}function le(a,b){return b&1?"strong":b&2?"em":"span"}
|
||||
-function me(a,b,c,d,e){a=d.classList;d=pc(e,"base");void 0!==d&&a.add(...d);d=pc(e,"underlineStrikethrough");let f=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in hb)h=hb[k],d=pc(e,k),void 0!==d&&(c&h?!f||"underline"!==k&&"strikethrough"!==k?(0===(b&h)||g&&"underline"===k||"strikethrough"===k)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
|
||||
-function ne(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?db:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Xa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,m]=a;0!==k&&d.deleteData(h,k);d.insertData(h,m)}else d.nodeValue=a}function oe(a,b){b=document.createElement(b);b.appendChild(a);return b}
|
||||
-class pe extends ce{static getType(){return"text"}static clone(a){return new pe(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return pb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===dc()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
|
||||
-(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=hb[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Yb(c,a,b)}createDOM(a){var b=this.__format,c=ke(this,b);let d=le(this,b),e=document.createElement(null===c?d:c),f=e;this.hasFormat("code")&&e.setAttribute("spellcheck","false");null!==c&&(f=document.createElement(d),
|
||||
-e.appendChild(f));c=f;ne(this.__text,c,this);a=a.theme.text;void 0!==a&&me(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){let d=this.__text;var e=a.__format,f=this.__format,g=ke(this,e);let h=ke(this,f);var k=le(this,e);let m=le(this,f);if((null===g?k:g)!==(null===h?m:h))return!0;if(g===h&&k!==m)return e=b.firstChild,null==e&&r(48),a=g=document.createElement(m),ne(d,a,this),c=c.theme.text,void 0!==c&&me(m,0,f,a,c),b.replaceChild(g,e),!1;k=b;null!==h&&null!==g&&(k=
|
||||
-b.firstChild,null==k&&r(49));ne(d,k,this);c=c.theme.text;void 0!==c&&e!==f&&me(m,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:qe,priority:0}),b:()=>({conversion:re,priority:0}),code:()=>({conversion:se,priority:0}),em:()=>({conversion:se,priority:0}),i:()=>({conversion:se,priority:0}),s:()=>({conversion:se,priority:0}),span:()=>({conversion:te,priority:0}),strong:()=>({conversion:se,priority:0}),sub:()=>({conversion:se,priority:0}),
|
||||
-sup:()=>({conversion:se,priority:0}),u:()=>({conversion:se,priority:0})}}static importJSON(a){let b=K(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportDOM(a){({element:a}=super.exportDOM(a));null!==a&&Fc(a)||r(132);a.style.whiteSpace="pre-wrap";this.hasFormat("bold")&&(a=oe(a,"b"));this.hasFormat("italic")&&(a=oe(a,"i"));this.hasFormat("strikethrough")&&(a=oe(a,"s"));this.hasFormat("underline")&&(a=oe(a,"u"));return{element:a}}exportJSON(){return{detail:this.getDetail(),
|
||||
-format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?hb[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?ib[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){let b=this.getFormat();a=Yb(b,a,null);return this.setFormat(a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=
|
||||
-1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=lb[a];if(this.__mode===a)return this;let b=this.getWritable();b.__mode=a;return b}setTextContent(a){if(this.__text===a)return this;let b=this.getWritable();b.__text=a;return b}select(a,b){G();let c=v();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(C(c))d=dc(),d!==c.anchor.key&&d!==c.focus.key||H(e),c.setTextNodeRange(this,a,this,b);
|
||||
-else return ue(e,a,e,b,"text","text");return c}selectStart(){return this.select(0,0)}selectEnd(){let a=this.getTextContentSize();return this.select(a,a)}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,h=a;0>h&&(h=g+h,0>h&&(h=0));let k=v();d&&C(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){G();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=dc(),f=new Set(a);
|
||||
+function fe(a,b,c){c=c||b.getParentOrThrow().getLastChild();let d=b;for(b=[b];d!==c;){if(!d.getNextSibling())throw Error("insertRangeAfter: lastToInsert must be a later sibling of firstToInsert");d=d.getNextSibling();b.push(d)}for(let e of b)a=a.insertAfter(e)}
|
||||
+class ge extends be{static getType(){return"linebreak"}static clone(a){return new ge(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:a=>{let b=a.parentElement,c,d;return null!==b&&((c=b.firstChild)===a||c.nextSibling===a&&3===c.nodeType&&null!==(c.textContent||"").match(/^( |\t|\r?\n)+$/))&&((d=b.lastChild)===a||d.previousSibling===a&&3===d.nodeType&&null!==(d.textContent||"").match(/^( |\t|\r?\n)+$/))?
|
||||
+null:{conversion:he,priority:0}}}}static importJSON(){return ie()}exportJSON(){return{type:"linebreak",version:1}}}function he(){return{node:ie()}}function ie(){return yc(new ge)}function Gc(a){return a instanceof ge}function je(a,b){return b&16?"code":b&128?"mark":b&32?"sub":b&64?"sup":null}function ke(a,b){return b&1?"strong":b&2?"em":"span"}
|
||||
+function le(a,b,c,d,e){a=d.classList;d=oc(e,"base");void 0!==d&&a.add(...d);d=oc(e,"underlineStrikethrough");let f=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in gb)h=gb[k],d=oc(e,k),void 0!==d&&(c&h?!f||"underline"!==k&&"strikethrough"!==k?(0===(b&h)||g&&"underline"===k||"strikethrough"===k)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
|
||||
+function me(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?cb:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Xa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,m]=a;0!==k&&d.deleteData(h,k);d.insertData(h,m)}else d.nodeValue=a}function ne(a,b){b=document.createElement(b);b.appendChild(a);return b}
|
||||
+class oe extends be{static getType(){return"text"}static clone(a){return new oe(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return lb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===cc()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
|
||||
+(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=gb[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Xb(c,a,b)}createDOM(a){var b=this.__format,c=je(this,b);let d=ke(this,b),e=document.createElement(null===c?d:c),f=e;this.hasFormat("code")&&e.setAttribute("spellcheck","false");null!==c&&(f=document.createElement(d),
|
||||
+e.appendChild(f));c=f;me(this.__text,c,this);a=a.theme.text;void 0!==a&&le(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){let d=this.__text;var e=a.__format,f=this.__format,g=je(this,e);let h=je(this,f);var k=ke(this,e);let m=ke(this,f);if((null===g?k:g)!==(null===h?m:h))return!0;if(g===h&&k!==m)return e=b.firstChild,null==e&&r(48),a=g=document.createElement(m),me(d,a,this),c=c.theme.text,void 0!==c&&le(m,0,f,a,c),b.replaceChild(g,e),!1;k=b;null!==h&&null!==g&&(k=
|
||||
+b.firstChild,null==k&&r(49));me(d,k,this);c=c.theme.text;void 0!==c&&e!==f&&le(m,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:pe,priority:0}),b:()=>({conversion:qe,priority:0}),code:()=>({conversion:re,priority:0}),em:()=>({conversion:re,priority:0}),i:()=>({conversion:re,priority:0}),s:()=>({conversion:re,priority:0}),span:()=>({conversion:se,priority:0}),strong:()=>({conversion:re,priority:0}),sub:()=>({conversion:re,priority:0}),
|
||||
+sup:()=>({conversion:re,priority:0}),u:()=>({conversion:re,priority:0})}}static importJSON(a){let b=K(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportDOM(a){({element:a}=super.exportDOM(a));null!==a&&Ec(a)||r(132);a.style.whiteSpace="pre-wrap";this.hasFormat("bold")&&(a=ne(a,"b"));this.hasFormat("italic")&&(a=ne(a,"i"));this.hasFormat("strikethrough")&&(a=ne(a,"s"));this.hasFormat("underline")&&(a=ne(a,"u"));return{element:a}}exportJSON(){return{detail:this.getDetail(),
|
||||
+format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?gb[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?hb[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){let b=this.getFormat();a=Xb(b,a,null);return this.setFormat(a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=
|
||||
+1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=kb[a];if(this.__mode===a)return this;let b=this.getWritable();b.__mode=a;return b}setTextContent(a){if(this.__text===a)return this;let b=this.getWritable();b.__text=a;return b}select(a,b){G();let c=v();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(C(c))d=cc(),d!==c.anchor.key&&d!==c.focus.key||H(e),c.setTextNodeRange(this,a,this,b);
|
||||
+else return te(e,a,e,b,"text","text");return c}selectStart(){return this.select(0,0)}selectEnd(){let a=this.getTextContentSize();return this.select(a,a)}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,h=a;0>h&&(h=g+h,0>h&&(h=0));let k=v();d&&C(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){G();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=cc(),f=new Set(a);
|
||||
a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==h&&f.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);f=a.length;if(0===f)return[];if(a[0]===c)return[b];var m=a[0];c=b.getParentOrThrow();k=b.getFormat();let p=b.getStyle(),n=b.__detail;g=!1;b.isSegmented()?(h=K(m),h.__format=k,h.__style=p,h.__detail=n,g=!0):(h=b.getWritable(),h.__text=m);b=v();h=[h];m=m.length;for(let u=1;u<f;u++){var l=a[u],q=l.length;l=K(l).getWritable();l.__format=k;l.__style=p;l.__detail=n;let y=l.__key;q=m+q;if(C(b)){let x=
|
||||
-b.anchor,A=b.focus;x.key===d&&"text"===x.type&&x.offset>m&&x.offset<=q&&(x.key=y,x.offset-=m,b.dirty=!0);A.key===d&&"text"===A.type&&A.offset>m&&A.offset<=q&&(A.key=y,A.offset-=m,b.dirty=!0)}e===d&&H(y);m=q;h.push(l)}d=this.getPreviousSibling();e=this.getNextSibling();null!==d&&cc(d);null!==e&&cc(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&be(b,c,e,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||a===this.getNextSibling()||
|
||||
-r(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;dc()===d&&H(c);let g=v();if(C(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(ve(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(ve(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?c+e:e+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
|
||||
-function te(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,e="underline"===a.style.textDecoration,f=a.style.verticalAlign;return{forChild:g=>{if(!B(g))return g;b&&g.toggleFormat("bold");c&&g.toggleFormat("strikethrough");d&&g.toggleFormat("italic");e&&g.toggleFormat("underline");"sub"===f&&g.toggleFormat("subscript");"super"===f&&g.toggleFormat("superscript");return g},node:null}}
|
||||
-function re(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}let we=new WeakMap;
|
||||
-function qe(a){null===a.parentElement&&r(129);for(var b=a.textContent||"",c,d=a.parentNode,e=[a];null!==d&&void 0===(c=we.get(d))&&!("PRE"===d.nodeName||1===d.nodeType&&void 0!==d.style&&void 0!==d.style.whiteSpace&&d.style.whiteSpace.startsWith("pre"));)e.push(d),d=d.parentNode;c=void 0===c?d:c;for(d=0;d<e.length;d++)we.set(e[d],c);if(null!==c){b=b.split(/(\r?\n|\t)/);a=[];e=b.length;for(c=0;c<e;c++)d=b[c],"\n"===d||"\r\n"===d?a.push(je()):"\t"===d?a.push(xe()):""!==d&&a.push(K(d));return{node:a}}b=
|
||||
-b.replace(/\r/g,"").replace(/[ \t\n]+/g," ");if(""===b)return{node:null};if(" "===b[0]){e=a;for(c=!0;null!==e&&null!==(e=ye(e,!1));)if(d=e.textContent||"",0<d.length){/[ \t\n]$/.test(d)&&(b=b.slice(1));c=!1;break}c&&(b=b.slice(1))}if(" "===b[b.length-1]){for(e=!0;null!==a&&null!==(a=ye(a,!0));)if(0<(a.textContent||"").replace(/^( |\t|\r?\n)+/,"").length){e=!1;break}e&&(b=b.slice(0,b.length-1))}return""===b?{node:null}:{node:K(b)}}
|
||||
-let ze=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/,"i");function ye(a,b){for(;;){for(var c=void 0;null===(c=b?a.nextSibling:a.previousSibling);)if(a=a.parentElement,null===a)return null;a=c;if(1===a.nodeType&&(c=a.style.display,""===c&&null===a.nodeName.match(ze)||""!==c&&!c.startsWith("inline")))return null;for(;null!==(c=b?a.firstChild:a.lastChild);)a=c;if(3===a.nodeType)return a;if("BR"===a.nodeName)return null}}
|
||||
-let Ae={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function se(a){let b=Ae[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&!c.hasFormat(b)&&c.toggleFormat(b);return c},node:null}}function K(a=""){return zc(new pe(a))}function B(a){return a instanceof pe}
|
||||
-class Be extends pe{static getType(){return"tab"}static clone(a){let b=new Be(a.__key);b.__text=a.__text;b.__format=a.__format;b.__style=a.__style;return b}constructor(a){super("\t",a);this.__detail=2}static importDOM(){return null}static importJSON(a){let b=xe();b.setFormat(a.format);b.setStyle(a.style);return b}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(){r(126)}setDetail(){r(127)}setMode(){r(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}
|
||||
-function xe(){return zc(new Be)}function Ce(a){return a instanceof Be}
|
||||
-class De{constructor(a,b,c){this._selection=null;this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode(),d=this.offset;a=a.offset;if(E(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}E(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=I(this.key);null===a&&r(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
|
||||
-ec()||(dc()===e&&H(a),null!==d&&(d.setCachedNodes(null),d.dirty=!0))}}function Ee(a,b){let c=b.__key,d=a.offset,e="element";if(B(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!E(b)){var f=b.getNextSibling();if(B(f))c=f.__key,d=0,e="text";else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function ee(a,b){if(E(b)){let c=b.getLastDescendant();E(c)||B(c)?Ee(a,c):Ee(a,b)}else Ee(a,b)}
|
||||
-function Fe(a,b,c,d){let e=a.getNode(),f=e.getChildAtIndex(a.offset),g=K(),h=L(e)?fe().append(g):g;g.setFormat(c);g.setStyle(d);null===f?e.append(h):f.insertBefore(h);a.is(b)&&b.set(g.__key,0,"text");a.set(g.__key,0,"text")}function Ge(a,b,c,d){a.key=b;a.offset=c;a.type=d}
|
||||
-class Qe{constructor(a,b){this.anchor=a;this.focus=b;a._selection=this;b._selection=this;this._cachedNodes=null;this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){return de(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus):!1}isCollapsed(){return!1}extract(){return this.getNodes()}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return Re(this)}}
|
||||
-class Se{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){if(!Vd(a))return!1;let b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}add(a){this.dirty=!0;this._nodes.add(a);this._cachedNodes=null}delete(a){this.dirty=!0;this._nodes.delete(a);this._cachedNodes=null}clear(){this.dirty=!0;this._nodes.clear();this._cachedNodes=null}has(a){return this._nodes.has(a)}clone(){return new Se(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a){let b=
|
||||
-this.getNodes(),c=b.length;var d=b[c-1];if(B(d))d=d.select();else{let e=d.getIndexWithinParent()+1;d=d.getParentOrThrow().select(e,e)}d.insertNodes(a);for(a=0;a<c;a++)b[a].remove()}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=I(c),null!==b&&a.push(b);ec()||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function C(a){return a instanceof Te}
|
||||
-function de(a){return a instanceof Qe}function Ue(a){let [b,,c]=Ve(a);a=c.getChildren();let d=a.length;var e=a[0].getChildren().length;let f=Array(d);for(var g=0;g<d;g++)f[g]=Array(e);for(e=0;e<d;e++){g=a[e].getChildren();let h=0;for(let k=0;k<g.length;k++){for(;f[e][h];)h++;let m=g[k],p=m.__rowSpan||1,n=m.__colSpan||1;for(let l=0;l<p;l++)for(let q=0;q<n;q++)f[e+l][h+q]=m;if(b===m)return{colSpan:n,columnIndex:h,rowIndex:e,rowSpan:p};h+=n}}return null}
|
||||
-class We extends Qe{constructor(a,b,c){super(b,c);this.gridKey=a}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){return Xe(a)?this.gridKey===a.gridKey&&this.anchor.is(a.anchor)&&this.focus.is(a.focus):!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchor.key=b;this.focus.key=c;this._cachedNodes=null}clone(){return new We(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a){let b=
|
||||
-this.focus.getNode();Ib(b.select(0,b.getChildrenSize())).insertNodes(a)}getShape(){var a=I(this.anchor.key);S(a)||r(103);a=Ue(a);if(null===a)throw Error("getCellRect: expected to find AnchorNode");var b=I(this.focus.key);S(b)||r(104);let c=Ue(b);if(null===c)throw Error("getCellRect: expected to find focusCellNode");b=Math.min(a.columnIndex,c.columnIndex);let d=Math.max(a.columnIndex,c.columnIndex),e=Math.min(a.rowIndex,c.rowIndex);a=Math.max(a.rowIndex,c.rowIndex);return{fromX:Math.min(b,d),fromY:Math.min(e,
|
||||
-a),toX:Math.max(b,d),toY:Math.max(e,a)}}getNodes(){function a(y){let {cell:x,startColumn:A,startRow:aa}=y;k=Math.min(k,A);m=Math.min(m,aa);p=Math.max(p,A+x.__colSpan-1);n=Math.max(n,aa+x.__rowSpan-1)}var b=this._cachedNodes;if(null!==b)return b;var c=this.anchor.getNode();b=this.focus.getNode();var d=Dc(c,S);c=Dc(b,S);S(d)||r(103);S(c)||r(104);b=d.getParent();Ye(b)||r(105);b=b.getParent();Ze(b)||r(106);var e=c.getParents()[1];if(e!==b){if(b.isParentOf(c)){b=e.getParent();if(null==b)throw Error("Expected focusCellParent to have a parent");
|
||||
-this.set(this.gridKey,c.getKey(),b.getKey())}else{b=b.getParent();if(null==b)throw Error("Expected gridParent to have a parent");this.set(this.gridKey,b.getKey(),c.getKey())}return this.getNodes()}let [f,g,h]=$e(b,d,c),k=Math.min(g.startColumn,h.startColumn),m=Math.min(g.startRow,h.startRow),p=Math.max(g.startColumn+g.cell.__colSpan-1,h.startColumn+h.cell.__colSpan-1),n=Math.max(g.startRow+g.cell.__rowSpan-1,h.startRow+h.cell.__rowSpan-1);c=k;d=m;e=k;for(var l=m;k<c||m<d||p>e||n>l;){if(k<c){var q=
|
||||
-l-d;--c;for(var u=0;u<=q;u++)a(f[d+u][c])}if(m<d)for(q=e-c,--d,u=0;u<=q;u++)a(f[d][c+u]);if(p>e)for(q=l-d,e+=1,u=0;u<=q;u++)a(f[d+u][e]);if(n>l)for(q=e-c,l+=1,u=0;u<=q;u++)a(f[l][c+u])}b=[b];c=null;for(d=m;d<=n;d++)for(e=k;e<=p;e++)({cell:l}=f[d][e]),q=l.getParent(),Ye(q)||r(107),q!==c&&b.push(q),b.push(l,...Ec(l)),c=q;ec()||(this._cachedNodes=b);return b}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}
|
||||
-function Xe(a){return a instanceof We}
|
||||
-class Te extends Qe{constructor(a,b,c,d){super(a,b);this.format=c;this.style=d}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){return C(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format&&this.style===a.style:!1}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var a=this._cachedNodes;if(null!==a)return a;a=this.anchor;var b=this.focus,c=a.isBefore(b),d=c?a:b;c=c?b:a;a=d.getNode();b=c.getNode();let e=d.offset;d=c.offset;E(a)&&
|
||||
-(c=a.getDescendantByIndex(e),a=null!=c?c:a);E(b)&&(c=b.getDescendantByIndex(d),null!==c&&c!==a&&b.getChildAtIndex(d)===c&&(c=c.getPreviousSibling()),b=null!=c?c:b);a=a.is(b)?E(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(b);ec()||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){Ge(this.anchor,a.__key,b,"text");Ge(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor,e=
|
||||
-this.focus,f=d.isBefore(e),[g,h]=Re(this),k="",m=!0;for(let p=0;p<a.length;p++){let n=a[p];if(E(n)&&!n.isInline())m||(k+="\n"),m=n.isEmpty()?!1:!0;else if(m=!1,B(n)){let l=n.getTextContent();if(n===b)if(n===c){if("element"!==d.type||"element"!==e.type||e.offset===d.offset)l=g<h?l.slice(g,h):l.slice(h,g)}else l=f?l.slice(g):l.slice(h);else n===c&&(l=f?l.slice(0,h):l.slice(0,g));k+=l}else!z(n)&&!Hc(n)||n===c&&this.isCollapsed()||(k+=n.getTextContent())}return k}applyDOMRange(a){let b=F(),c=b.getEditorState()._selection;
|
||||
-a=af(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;Ge(this.anchor,d.key,d.offset,d.type);Ge(this.focus,e.key,e.offset,e.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new Te(new De(a.key,a.offset,a.type),new De(b.key,b.offset,b.type),this.format,this.style)}toggleFormat(a){this.format=Yb(this.format,a,null);this.dirty=!0}setStyle(a){this.style=a;this.dirty=!0}hasFormat(a){return 0!==(this.format&hb[a])}insertRawText(a){a=a.split(/(\r?\n|\t)/);
|
||||
-let b=[],c=a.length;for(let d=0;d<c;d++){let e=a[d];"\n"===e||"\r\n"===e?b.push(je()):"\t"===e?b.push(xe()):b.push(K(e))}this.insertNodes(b)}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),e=this.format,f=this.style;d&&"element"===b.type?Fe(b,c,e,f):d||"element"!==c.type||Fe(c,b,e,f);var g=this.getNodes(),h=g.length,k=d?c:b;c=(d?b:c).offset;var m=k.offset;b=g[0];B(b)||r(26);d=b.getTextContent().length;var p=b.getParentOrThrow(),n=g[h-1];if(this.isCollapsed()&&c===
|
||||
-d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!p.canInsertTextAfter()&&null===b.getNextSibling())){var l=b.getNextSibling();B(l)&&l.canInsertTextBefore()&&!Wb(l)||(l=K(),l.setFormat(e),p.canInsertTextAfter()?b.insertAfter(l):p.insertAfter(l));l.select(0,0);b=l;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!p.canInsertTextBefore()&&null===b.getPreviousSibling())){l=b.getPreviousSibling();if(!B(l)||Wb(l))l=
|
||||
-K(),l.setFormat(e),p.canInsertTextBefore()?b.insertBefore(l):p.insertBefore(l);l.select();b=l;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)p=K(b.getTextContent()),p.setFormat(e),b.replace(p),b=p;else if(!(this.isCollapsed()||""===a||(l=n.getParent(),p.canInsertTextBefore()&&p.canInsertTextAfter()&&(!E(l)||l.canInsertTextBefore()&&l.canInsertTextAfter())))){this.insertText("");bf(this.anchor,this.focus,null);this.insertText(a);return}if(1===h)if(b.isToken())a=K(a),a.select(),
|
||||
-b.replace(a);else{g=b.getFormat();h=b.getStyle();if(c===m&&(g!==e||h!==f))if(""===b.getTextContent())b.setFormat(e),b.setStyle(f);else{g=K(a);g.setFormat(e);g.setStyle(f);g.select();0===c?b.insertBefore(g,!1):([h]=b.splitText(c),h.insertAfter(g,!1));g.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length);return}else if(Ce(b)){a=K(a);a.setFormat(e);a.setStyle(f);a.select();b.replace(a);return}b=b.spliceText(c,m-c,a,!0);""===b.getTextContent()?b.remove():"text"===this.anchor.type&&
|
||||
+b.anchor,A=b.focus;x.key===d&&"text"===x.type&&x.offset>m&&x.offset<=q&&(x.key=y,x.offset-=m,b.dirty=!0);A.key===d&&"text"===A.type&&A.offset>m&&A.offset<=q&&(A.key=y,A.offset-=m,b.dirty=!0)}e===d&&H(y);m=q;h.push(l)}d=this.getPreviousSibling();e=this.getNextSibling();null!==d&&bc(d);null!==e&&bc(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&ae(b,c,e,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||a===this.getNextSibling()||
|
||||
+r(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;cc()===d&&H(c);let g=v();if(C(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(ue(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(ue(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?c+e:e+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
|
||||
+function se(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,e="underline"===a.style.textDecoration,f=a.style.verticalAlign;return{forChild:g=>{if(!B(g))return g;b&&g.toggleFormat("bold");c&&g.toggleFormat("strikethrough");d&&g.toggleFormat("italic");e&&g.toggleFormat("underline");"sub"===f&&g.toggleFormat("subscript");"super"===f&&g.toggleFormat("superscript");return g},node:null}}
|
||||
+function qe(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}let ve=new WeakMap;
|
||||
+function pe(a){null===a.parentElement&&r(129);for(var b=a.textContent||"",c,d=a.parentNode,e=[a];null!==d&&void 0===(c=ve.get(d))&&!("PRE"===d.nodeName||1===d.nodeType&&void 0!==d.style&&void 0!==d.style.whiteSpace&&d.style.whiteSpace.startsWith("pre"));)e.push(d),d=d.parentNode;c=void 0===c?d:c;for(d=0;d<e.length;d++)ve.set(e[d],c);if(null!==c){b=b.split(/(\r?\n|\t)/);a=[];e=b.length;for(c=0;c<e;c++)d=b[c],"\n"===d||"\r\n"===d?a.push(ie()):"\t"===d?a.push(we()):""!==d&&a.push(K(d));return{node:a}}b=
|
||||
+b.replace(/\r/g,"").replace(/[ \t\n]+/g," ");if(""===b)return{node:null};if(" "===b[0]){e=a;for(c=!0;null!==e&&null!==(e=xe(e,!1));)if(d=e.textContent||"",0<d.length){/[ \t\n]$/.test(d)&&(b=b.slice(1));c=!1;break}c&&(b=b.slice(1))}if(" "===b[b.length-1]){for(e=!0;null!==a&&null!==(a=xe(a,!0));)if(0<(a.textContent||"").replace(/^( |\t|\r?\n)+/,"").length){e=!1;break}e&&(b=b.slice(0,b.length-1))}return""===b?{node:null}:{node:K(b)}}
|
||||
+let ye=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/,"i");function xe(a,b){for(;;){for(var c=void 0;null===(c=b?a.nextSibling:a.previousSibling);)if(a=a.parentElement,null===a)return null;a=c;if(1===a.nodeType&&(c=a.style.display,""===c&&null===a.nodeName.match(ye)||""!==c&&!c.startsWith("inline")))return null;for(;null!==(c=b?a.firstChild:a.lastChild);)a=c;if(3===a.nodeType)return a;if("BR"===a.nodeName)return null}}
|
||||
+let ze={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function re(a){let b=ze[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&!c.hasFormat(b)&&c.toggleFormat(b);return c},node:null}}function K(a=""){return yc(new oe(a))}function B(a){return a instanceof oe}
|
||||
+class Ae extends oe{static getType(){return"tab"}static clone(a){let b=new Ae(a.__key);b.__text=a.__text;b.__format=a.__format;b.__style=a.__style;return b}constructor(a){super("\t",a);this.__detail=2}static importDOM(){return null}static importJSON(a){let b=we();b.setFormat(a.format);b.setStyle(a.style);return b}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(){r(126)}setDetail(){r(127)}setMode(){r(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}
|
||||
+function we(){return yc(new Ae)}function Be(a){return a instanceof Ae}
|
||||
+class Ce{constructor(a,b,c){this._selection=null;this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode(),d=this.offset;a=a.offset;if(E(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}E(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=I(this.key);null===a&&r(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
|
||||
+dc()||(cc()===e&&H(a),null!==d&&(d.setCachedNodes(null),d.dirty=!0))}}function De(a,b){let c=b.__key,d=a.offset,e="element";if(B(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!E(b)){var f=b.getNextSibling();if(B(f))c=f.__key,d=0,e="text";else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function de(a,b){if(E(b)){let c=b.getLastDescendant();E(c)||B(c)?De(a,c):De(a,b)}else De(a,b)}
|
||||
+function Ee(a,b,c,d){let e=a.getNode(),f=e.getChildAtIndex(a.offset),g=K(),h=L(e)?ee().append(g):g;g.setFormat(c);g.setStyle(d);null===f?e.append(h):f.insertBefore(h);a.is(b)&&b.set(g.__key,0,"text");a.set(g.__key,0,"text")}function Fe(a,b,c,d){a.key=b;a.offset=c;a.type=d}
|
||||
+class Ge{constructor(a,b){this.anchor=a;this.focus=b;a._selection=this;b._selection=this;this._cachedNodes=null;this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){return ce(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus):!1}isCollapsed(){return!1}extract(){return this.getNodes()}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return Qe(this)}}
|
||||
+class Re{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){if(!Ud(a))return!1;let b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}add(a){this.dirty=!0;this._nodes.add(a);this._cachedNodes=null}delete(a){this.dirty=!0;this._nodes.delete(a);this._cachedNodes=null}clear(){this.dirty=!0;this._nodes.clear();this._cachedNodes=null}has(a){return this._nodes.has(a)}clone(){return new Re(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a){let b=
|
||||
+this.getNodes(),c=b.length;var d=b[c-1];if(B(d))d=d.select();else{let e=d.getIndexWithinParent()+1;d=d.getParentOrThrow().select(e,e)}d.insertNodes(a);for(a=0;a<c;a++)b[a].remove()}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=I(c),null!==b&&a.push(b);dc()||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function C(a){return a instanceof Se}
|
||||
+function ce(a){return a instanceof Ge}function Te(a){let [b,,c]=Ue(a);a=c.getChildren();let d=a.length;var e=a[0].getChildren().length;let f=Array(d);for(var g=0;g<d;g++)f[g]=Array(e);for(e=0;e<d;e++){g=a[e].getChildren();let h=0;for(let k=0;k<g.length;k++){for(;f[e][h];)h++;let m=g[k],p=m.__rowSpan||1,n=m.__colSpan||1;for(let l=0;l<p;l++)for(let q=0;q<n;q++)f[e+l][h+q]=m;if(b===m)return{colSpan:n,columnIndex:h,rowIndex:e,rowSpan:p};h+=n}}return null}
|
||||
+class Ve extends Ge{constructor(a,b,c){super(b,c);this.gridKey=a}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){return We(a)?this.gridKey===a.gridKey&&this.anchor.is(a.anchor)&&this.focus.is(a.focus):!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchor.key=b;this.focus.key=c;this._cachedNodes=null}clone(){return new Ve(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a){let b=
|
||||
+this.focus.getNode();Hb(b.select(0,b.getChildrenSize())).insertNodes(a)}getShape(){var a=I(this.anchor.key);S(a)||r(103);a=Te(a);if(null===a)throw Error("getCellRect: expected to find AnchorNode");var b=I(this.focus.key);S(b)||r(104);let c=Te(b);if(null===c)throw Error("getCellRect: expected to find focusCellNode");b=Math.min(a.columnIndex,c.columnIndex);let d=Math.max(a.columnIndex,c.columnIndex),e=Math.min(a.rowIndex,c.rowIndex);a=Math.max(a.rowIndex,c.rowIndex);return{fromX:Math.min(b,d),fromY:Math.min(e,
|
||||
+a),toX:Math.max(b,d),toY:Math.max(e,a)}}getNodes(){function a(y){let {cell:x,startColumn:A,startRow:aa}=y;k=Math.min(k,A);m=Math.min(m,aa);p=Math.max(p,A+x.__colSpan-1);n=Math.max(n,aa+x.__rowSpan-1)}var b=this._cachedNodes;if(null!==b)return b;var c=this.anchor.getNode();b=this.focus.getNode();var d=Cc(c,S);c=Cc(b,S);S(d)||r(103);S(c)||r(104);b=d.getParent();Xe(b)||r(105);b=b.getParent();Ye(b)||r(106);var e=c.getParents()[1];if(e!==b){if(b.isParentOf(c)){b=e.getParent();if(null==b)throw Error("Expected focusCellParent to have a parent");
|
||||
+this.set(this.gridKey,c.getKey(),b.getKey())}else{b=b.getParent();if(null==b)throw Error("Expected gridParent to have a parent");this.set(this.gridKey,b.getKey(),c.getKey())}return this.getNodes()}let [f,g,h]=Ze(b,d,c),k=Math.min(g.startColumn,h.startColumn),m=Math.min(g.startRow,h.startRow),p=Math.max(g.startColumn+g.cell.__colSpan-1,h.startColumn+h.cell.__colSpan-1),n=Math.max(g.startRow+g.cell.__rowSpan-1,h.startRow+h.cell.__rowSpan-1);c=k;d=m;e=k;for(var l=m;k<c||m<d||p>e||n>l;){if(k<c){var q=
|
||||
+l-d;--c;for(var u=0;u<=q;u++)a(f[d+u][c])}if(m<d)for(q=e-c,--d,u=0;u<=q;u++)a(f[d][c+u]);if(p>e)for(q=l-d,e+=1,u=0;u<=q;u++)a(f[d+u][e]);if(n>l)for(q=e-c,l+=1,u=0;u<=q;u++)a(f[l][c+u])}b=[b];c=null;for(d=m;d<=n;d++)for(e=k;e<=p;e++)({cell:l}=f[d][e]),q=l.getParent(),Xe(q)||r(107),q!==c&&b.push(q),b.push(l,...Dc(l)),c=q;dc()||(this._cachedNodes=b);return b}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}
|
||||
+function We(a){return a instanceof Ve}
|
||||
+class Se extends Ge{constructor(a,b,c,d){super(a,b);this.format=c;this.style=d}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){return C(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format&&this.style===a.style:!1}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var a=this._cachedNodes;if(null!==a)return a;a=this.anchor;var b=this.focus,c=a.isBefore(b),d=c?a:b;c=c?b:a;a=d.getNode();b=c.getNode();let e=d.offset;d=c.offset;E(a)&&
|
||||
+(c=a.getDescendantByIndex(e),a=null!=c?c:a);E(b)&&(c=b.getDescendantByIndex(d),null!==c&&c!==a&&b.getChildAtIndex(d)===c&&(c=c.getPreviousSibling()),b=null!=c?c:b);a=a.is(b)?E(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(b);dc()||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){Fe(this.anchor,a.__key,b,"text");Fe(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor,e=
|
||||
+this.focus,f=d.isBefore(e),[g,h]=Qe(this),k="",m=!0;for(let p=0;p<a.length;p++){let n=a[p];if(E(n)&&!n.isInline())m||(k+="\n"),m=n.isEmpty()?!1:!0;else if(m=!1,B(n)){let l=n.getTextContent();if(n===b)if(n===c){if("element"!==d.type||"element"!==e.type||e.offset===d.offset)l=g<h?l.slice(g,h):l.slice(h,g)}else l=f?l.slice(g):l.slice(h);else n===c&&(l=f?l.slice(0,h):l.slice(0,g));k+=l}else!z(n)&&!Gc(n)||n===c&&this.isCollapsed()||(k+=n.getTextContent())}return k}applyDOMRange(a){let b=F(),c=b.getEditorState()._selection;
|
||||
+a=$e(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;Fe(this.anchor,d.key,d.offset,d.type);Fe(this.focus,e.key,e.offset,e.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new Se(new Ce(a.key,a.offset,a.type),new Ce(b.key,b.offset,b.type),this.format,this.style)}toggleFormat(a){this.format=Xb(this.format,a,null);this.dirty=!0}setStyle(a){this.style=a;this.dirty=!0}hasFormat(a){return 0!==(this.format&gb[a])}insertRawText(a){a=a.split(/(\r?\n|\t)/);
|
||||
+let b=[],c=a.length;for(let d=0;d<c;d++){let e=a[d];"\n"===e||"\r\n"===e?b.push(ie()):"\t"===e?b.push(we()):b.push(K(e))}this.insertNodes(b)}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),e=this.format,f=this.style;d&&"element"===b.type?Ee(b,c,e,f):d||"element"!==c.type||Ee(c,b,e,f);var g=this.getNodes(),h=g.length,k=d?c:b;c=(d?b:c).offset;var m=k.offset;b=g[0];B(b)||r(26);d=b.getTextContent().length;var p=b.getParentOrThrow(),n=g[h-1];if(this.isCollapsed()&&c===
|
||||
+d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!p.canInsertTextAfter()&&null===b.getNextSibling())){var l=b.getNextSibling();B(l)&&l.canInsertTextBefore()&&!Vb(l)||(l=K(),l.setFormat(e),p.canInsertTextAfter()?b.insertAfter(l):p.insertAfter(l));l.select(0,0);b=l;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!p.canInsertTextBefore()&&null===b.getPreviousSibling())){l=b.getPreviousSibling();if(!B(l)||Vb(l))l=
|
||||
+K(),l.setFormat(e),p.canInsertTextBefore()?b.insertBefore(l):p.insertBefore(l);l.select();b=l;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)p=K(b.getTextContent()),p.setFormat(e),b.replace(p),b=p;else if(!(this.isCollapsed()||""===a||(l=n.getParent(),p.canInsertTextBefore()&&p.canInsertTextAfter()&&(!E(l)||l.canInsertTextBefore()&&l.canInsertTextAfter())))){this.insertText("");af(this.anchor,this.focus,null);this.insertText(a);return}if(1===h)if(b.isToken())a=K(a),a.select(),
|
||||
+b.replace(a);else{g=b.getFormat();h=b.getStyle();if(c===m&&(g!==e||h!==f))if(""===b.getTextContent())b.setFormat(e),b.setStyle(f);else{g=K(a);g.setFormat(e);g.setStyle(f);g.select();0===c?b.insertBefore(g,!1):([h]=b.splitText(c),h.insertAfter(g,!1));g.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length);return}else if(Be(b)){a=K(a);a.setFormat(e);a.setStyle(f);a.select();b.replace(a);return}b=b.spliceText(c,m-c,a,!0);""===b.getTextContent()?b.remove():"text"===this.anchor.type&&
|
||||
(b.isComposing()?this.anchor.offset-=a.length:(this.format=g,this.style=h))}else{e=new Set([...b.getParentKeys(),...n.getParentKeys()]);l=E(b)?b:b.getParentOrThrow();f=E(n)?n:n.getParentOrThrow();p=n;if(!l.is(f)&&f.isInline()){do p=f,f=f.getParentOrThrow();while(f.isInline())}if("text"===k.type&&(0!==m||""===n.getTextContent())||"element"===k.type&&n.getIndexWithinParent()<m)if(B(n)&&!n.isToken()&&m!==n.getTextContentSize()){if(n.isSegmented()){var q=K(n.getTextContent());n.replace(q);n=q}L(k.getNode())||
|
||||
"text"!==k.type||(n=n.spliceText(0,m,""));e.add(n.__key)}else k=n.getParentOrThrow(),k.canBeEmpty()||1!==k.getChildrenSize()?n.remove():k.remove();else e.add(n.__key);k=f.getChildren();m=new Set(g);n=l.is(f);l=l.isInline()&&null===b.getNextSibling()?l:b;for(q=k.length-1;0<=q;q--){let u=k[q];if(u.is(b)||E(u)&&u.isParentOf(b))break;u.isAttached()&&(!m.has(u)||u.is(p)?n||l.insertAfter(u,!1):u.remove())}if(!n)for(k=f,f=null;null!==k;){m=k.getChildren();n=m.length;if(0===n||m[n-1].is(f))e.delete(k.__key),
|
||||
f=k;k=k.getParent()}b.isToken()?c===d?b.select():(a=K(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<h;a++)b=g[a],e.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){if(this.isCollapsed())this.toggleFormat(a),H(null);else{var b=this.getNodes(),c=[];for(var d of b)B(d)&&c.push(d);var e=c.length;if(0===e)this.toggleFormat(a),H(null);else{d=this.anchor;
|
||||
var f=this.focus,g=this.isBackward();b=g?f:d;d=g?d:f;var h=0,k=c[0];f="element"===b.type?0:b.offset;"text"===b.type&&f===k.getTextContentSize()&&(h=1,k=c[1],f=0);if(null!=k){g=k.getFormatFlags(a,null);var m=e-1,p=c[m];e="text"===d.type?d.offset:p.getTextContentSize();if(k.is(p))f!==e&&(0===f&&e===k.getTextContentSize()?k.setFormat(g):(a=k.splitText(f,e),a=0===f?a[0]:a[1],a.setFormat(g),"text"===b.type&&b.set(a.__key,0,"text"),"text"===d.type&&d.set(a.__key,e-f,"text")),this.format=g);else{0!==f&&
|
||||
([,k]=k.splitText(f),f=0);k.setFormat(g);var n=p.getFormatFlags(a,g);0<e&&(e!==p.getTextContentSize()&&([p]=p.splitText(e)),p.setFormat(n));for(h+=1;h<m;h++){let l=c[h];if(!l.isToken()){let q=l.getFormatFlags(a,n);l.setFormat(q)}}"text"===b.type&&b.set(k.__key,f,"text");"text"===d.type&&d.set(p.__key,e,"text");this.format=g|n}}}}}insertNodes(a){if(0!==a.length){if("root"===this.anchor.key){this.insertParagraph();var b=v();if(!C(b))throw Error("Expected RangeSelection after insertParagraph");return b.insertNodes(a)}var c=
|
||||
-Ic(this.anchor.getNode(),Gc);b=a[a.length-1];if("__language"in c)if("__language"in a[0])this.insertText(a[0].getTextContent());else{var d=cf(this);c.splice(d,0,a);b.selectEnd()}else if(a.some(g=>(E(g)||z(g))&&!g.isInline())){b=df(a);a=b.getLastDescendant();var e=b.getChildren();b=E(c)&&c.isEmpty()?null:this.insertParagraph();d=e[e.length-1];var f=e[0];(g=>E(g)&&Gc(g)&&!g.isEmpty()&&E(c)&&(!c.isEmpty()||"__value"in c&&"__checked"in c))(f)&&(c.append(...f.getChildren()),f=e[1]);f&&ge(c,f);e=Ic(a,Gc);
|
||||
-b&&E(e)&&("__value"in b&&"__checked"in b||Gc(d))&&(e.append(...b.getChildren()),b.remove());E(c)&&c.isEmpty()&&c.remove();a.selectEnd();a=E(c)?c.getLastChild():null;Hc(a)&&e!==c&&a.remove()}else d=cf(this),c.splice(d,0,a),b.selectEnd()}}insertParagraph(){if("root"===this.anchor.key){var a=fe();J().splice(this.anchor.offset,0,[a]);a.select();return a}var b=cf(this);a=Ic(this.anchor.getNode(),Gc);b=(b=a.getChildAtIndex(b))?[b,...b.getNextSiblings()]:[];return(a=a.insertNewAfter(this,!1))?(a.append(...b),
|
||||
-a.selectStart(),a):null}insertLineBreak(a){var b=je();this.insertNodes([b]);a&&(a=b.getParentOrThrow(),b=b.getIndexWithinParent(),a.select(b,b))}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=Re(this);if(0===b)return[];if(1===b)return B(f)&&!this.isCollapsed()?(a=h>k?k:h,c=f.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);B(f)&&(d=b?h:k,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));
|
||||
-B(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=sc(d,b);if(z(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=ef(),b.add(g.__key),Ab(b)):(a=b?g.getPreviousSibling():g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),E(a)?(c=a.__key,g=b?a.getChildrenSize():0):(g=g.getIndexWithinParent(),c=c.__key,b||g++),
|
||||
-d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(e=F(),d=xb(e._window)){var h=e._blockCursorElement,k=e._rootElement;null===k||null===h||!E(g)||g.isInline()||g.canBeEmpty()||Cc(h,e,k);d.modify(a,b?"backward":"forward",c);if(0<d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),e=L(e)?e:wc(e),this.applyDOMRange(g),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(h=0;h<f.length;h++)k=f[h],vc(k,e)?a.push(k):c=!0;c&&0<a.length&&(b?(b=a[0],E(b)?b.selectStart():b.getParentOrThrow().selectStart()):
|
||||
-(b=a[a.length-1],E(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,Ge(f,b.key,b.offset,b.type),Ge(b,d,g,e),this._cachedNodes=null}}}deleteCharacter(a){let b=this.isCollapsed();if(this.isCollapsed()){var c=this.anchor,d=this.focus,e=c.getNode();if(!a&&("element"===c.type&&E(e)&&c.offset===e.getChildrenSize()||"text"===c.type&&c.offset===e.getTextContentSize())){var f=e.getParent();
|
||||
-f=e.getNextSibling()||(null===f?null:f.getNextSibling());if(E(f)&&f.isShadowRoot())return}f=sc(d,a);if(z(f)&&!f.isIsolated()){f.isKeyboardSelectable()&&E(e)&&0===e.getChildrenSize()?(e.remove(),a=ef(),a.add(f.__key),Ab(a)):(f.remove(),F().dispatchCommand(ba,void 0));return}if(!a&&E(f)&&E(e)&&e.isEmpty()){e.remove();f.selectStart();return}this.modify("extend",a,"character");if(!this.isCollapsed()){f="text"===d.type?d.getNode():null;e="text"===c.type?c.getNode():null;if(null!==f&&f.isSegmented()){if(c=
|
||||
-d.offset,d=f.getTextContentSize(),f.is(e)||a&&c!==d||!a&&0!==c){ff(f,a,c);return}}else if(null!==e&&e.isSegmented()&&(c=c.offset,d=e.getTextContentSize(),e.is(f)||a&&0!==c||!a&&c!==d)){ff(e,a,c);return}e=this.anchor;f=this.focus;c=e.getNode();d=f.getNode();if(c===d&&"text"===e.type&&"text"===f.type){var g=e.offset,h=f.offset;let k=g<h;d=k?g:h;h=k?h:g;g=h-1;d!==g&&(c=c.getTextContent().slice(d,h),jc(c)||(a?f.offset=g:e.offset=g))}}else if(a&&0===c.offset&&("element"===c.type?c.getNode():c.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText();
|
||||
+Hc(this.anchor.getNode(),Fc);b=a[a.length-1];if("__language"in c)if("__language"in a[0])this.insertText(a[0].getTextContent());else{var d=bf(this);c.splice(d,0,a);b.selectEnd()}else if(a.some(g=>(E(g)||z(g))&&!g.isInline())){b=cf(a);a=b.getLastDescendant();var e=b.getChildren();b=E(c)&&c.isEmpty()?null:this.insertParagraph();d=e[e.length-1];var f=e[0];(g=>E(g)&&Fc(g)&&!g.isEmpty()&&E(c)&&(!c.isEmpty()||"__value"in c&&"__checked"in c))(f)&&(c.append(...f.getChildren()),f=e[1]);f&&fe(c,f);e=Hc(a,Fc);
|
||||
+b&&E(e)&&("__value"in b&&"__checked"in b||Fc(d))&&(e.append(...b.getChildren()),b.remove());E(c)&&c.isEmpty()&&c.remove();a.selectEnd();a=E(c)?c.getLastChild():null;Gc(a)&&e!==c&&a.remove()}else d=bf(this),c.splice(d,0,a),b.selectEnd()}}insertParagraph(){if("root"===this.anchor.key){var a=ee();J().splice(this.anchor.offset,0,[a]);a.select();return a}var b=bf(this);a=Hc(this.anchor.getNode(),Fc);b=(b=a.getChildAtIndex(b))?[b,...b.getNextSiblings()]:[];return(a=a.insertNewAfter(this,!1))?(a.append(...b),
|
||||
+a.selectStart(),a):null}insertLineBreak(a){var b=ie();this.insertNodes([b]);a&&(a=b.getParentOrThrow(),b=b.getIndexWithinParent(),a.select(b,b))}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=Qe(this);if(0===b)return[];if(1===b)return B(f)&&!this.isCollapsed()?(a=h>k?k:h,c=f.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);B(f)&&(d=b?h:k,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));
|
||||
+B(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=rc(d,b);if(z(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=df(),b.add(g.__key),zb(b)):(a=b?g.getPreviousSibling():g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),E(a)?(c=a.__key,g=b?a.getChildrenSize():0):(g=g.getIndexWithinParent(),c=c.__key,b||g++),
|
||||
+d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(e=F(),d=wb(e._window)){var h=e._blockCursorElement,k=e._rootElement;null===k||null===h||!E(g)||g.isInline()||g.canBeEmpty()||Bc(h,e,k);d.modify(a,b?"backward":"forward",c);if(0<d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),e=L(e)?e:vc(e),this.applyDOMRange(g),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(h=0;h<f.length;h++)k=f[h],uc(k,e)?a.push(k):c=!0;c&&0<a.length&&(b?(b=a[0],E(b)?b.selectStart():b.getParentOrThrow().selectStart()):
|
||||
+(b=a[a.length-1],E(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,Fe(f,b.key,b.offset,b.type),Fe(b,d,g,e),this._cachedNodes=null}}}deleteCharacter(a){let b=this.isCollapsed();if(this.isCollapsed()){var c=this.anchor,d=this.focus,e=c.getNode();if(!a&&("element"===c.type&&E(e)&&c.offset===e.getChildrenSize()||"text"===c.type&&c.offset===e.getTextContentSize())){var f=e.getParent();
|
||||
+f=e.getNextSibling()||(null===f?null:f.getNextSibling());if(E(f)&&f.isShadowRoot())return}f=rc(d,a);if(z(f)&&!f.isIsolated()){f.isKeyboardSelectable()&&E(e)&&0===e.getChildrenSize()?(e.remove(),a=df(),a.add(f.__key),zb(a)):(f.remove(),F().dispatchCommand(ba,void 0));return}if(!a&&E(f)&&E(e)&&e.isEmpty()){e.remove();f.selectStart();return}this.modify("extend",a,"character");if(!this.isCollapsed()){f="text"===d.type?d.getNode():null;e="text"===c.type?c.getNode():null;if(null!==f&&f.isSegmented()){if(c=
|
||||
+d.offset,d=f.getTextContentSize(),f.is(e)||a&&c!==d||!a&&0!==c){ef(f,a,c);return}}else if(null!==e&&e.isSegmented()&&(c=c.offset,d=e.getTextContentSize(),e.is(f)||a&&0!==c||!a&&c!==d)){ef(e,a,c);return}e=this.anchor;f=this.focus;c=e.getNode();d=f.getNode();if(c===d&&"text"===e.type&&"text"===f.type){var g=e.offset,h=f.offset;let k=g<h;d=k?g:h;h=k?h:g;g=h-1;d!==g&&(c=c.getTextContent().slice(d,h),ic(c)||(a?f.offset=g:e.offset=g))}}else if(a&&0===c.offset&&("element"===c.type?c.getNode():c.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText();
|
||||
a&&!b&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset&&(a=this.anchor.getNode(),a.isEmpty()&&L(a.getParent())&&0===a.getIndexWithinParent()&&a.collapseAtStart(this))}deleteLine(a){this.isCollapsed()&&("text"===this.anchor.type&&this.modify("extend",a,"lineboundary"),0===(a?this.focus:this.anchor).offset&&this.modify("extend",a,"character"));this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}
|
||||
-function Vd(a){return a instanceof Se}function gf(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}function Re(a){let b=a.anchor;a=a.focus;return"element"===b.type&&"element"===a.type&&b.key===a.key&&b.offset===a.offset?[0,0]:[gf(b),gf(a)]}
|
||||
-function ff(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),e=d.length,f=0,g=0;for(let h=0;h<e;h++){let k=d[h],m=h===e-1;g=f;f+=k.length;if(b&&f===c||f>c||m){d.splice(h,1);m&&(g=void 0);break}}b=d.join("").trim();""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
|
||||
-function hf(a,b,c,d){var e=b;if(1===a.nodeType){let h=!1;var f=a.childNodes,g=f.length;e===g&&(h=!0,e=g-1);let k=f[e];g=!1;k===d._blockCursorElement?(k=f[e+1],g=!0):null!==d._blockCursorElement&&e--;d=ic(k);if(B(d))e=h?d.getTextContentSize():0;else{f=ic(a);if(null===f)return null;if(E(f)){a=f.getChildAtIndex(e);if(b=E(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=h?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,e=0):(a=c,f=E(a)?a:a.getParentOrThrow()));
|
||||
-B(a)?(d=a,f=null,e=h?a.getTextContentSize():0):a!==f&&h&&!g&&e++}else e=f.getIndexWithinParent(),e=0===b&&z(f)&&ic(a)===f?e:e+1,f=f.getParentOrThrow();if(E(f))return new De(f.__key,e,"element")}}else d=ic(a);return B(d)?new De(d.__key,e,"text"):null}
|
||||
-function jf(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&E(e)&&e.isInline()&&(b=e.getPreviousSibling(),B(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):E(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):B(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&E(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
|
||||
-b)&&null===d&&E(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function bf(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);jf(a,d,e);jf(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=F();d.isComposing()&&d._compositionKey!==a.key&&C(c)&&(d=c.anchor,c=c.focus,Ge(a,d.key,d.offset,d.type),Ge(b,c.key,c.offset,c.type))}}
|
||||
-function af(a,b,c,d,e,f){if(null===a||null===c||!Nb(e,a,c))return null;b=hf(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=hf(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=ic(a),c=ic(c),z(a)&&z(c)))return null;bf(b,d,f);return[b,d]}function ue(a,b,c,d,e,f){let g=ac();a=new Te(new De(a,b,e),new De(c,d,f),0,"");a.dirty=!0;return g._selection=a}function ef(){return new Se(new Set)}
|
||||
-function kf(a){let b=a.getEditorState()._selection,c=xb(a._window);return C(b)||null==b?Rd(b,c,a):b.clone()}
|
||||
-function Rd(a,b,c){var d=c._window;if(null===d)return null;var e=d.event,f=e?e.type:void 0;d="selectionchange"===f;e=!qb&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!C(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&C(a)&&!Nb(c,e,f))return a.clone()}else return a.clone();c=af(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new Te(h,k,C(a)?a.format:0,C(a)?
|
||||
-a.style:"")}function v(){return ac()._selection}function nc(){return F()._editorState._selection}
|
||||
-function be(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h)){g=b.__key;if(a.isCollapsed()){if(b=e.offset,c<=b&&0<d||c<b&&0>d)c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),lf(a)}else{let m=a.isBackward();h=m?f:e;var k=h.getNode();e=m?e:f;f=e.getNode();b.is(k)&&(k=h.offset,(c<=k&&0<d||c<k&&0>d)&&h.set(g,Math.max(0,k+d),"element"));b.is(f)&&(b=e.offset,(c<=b&&0<d||c<b&&0>d)&&e.set(g,Math.max(0,b+d),"element"))}lf(a)}}
|
||||
-function lf(a){var b=a.anchor,c=b.offset;let d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())E(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),B(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(E(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);B(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}E(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
|
||||
-1):g.getChildAtIndex(e),B(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function mf(a,b){b=b.getEditorState()._selection;a=a._selection;if(C(a)){var c=a.anchor;let d=a.focus,e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
|
||||
-function ae(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):E(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,B(e)?h="text":E(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function ve(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
|
||||
-function $e(a,b,c){let d=[],e=null,f=null;a=a.getChildren();for(let p=0;p<a.length;p++){var g=a[p];Ye(g)||r(108);var h=g.getChildren();g=0;for(let n of h){for(S(n)||r(109);void 0!==d[p]&&void 0!==d[p][g];)g++;h=p;var k=g,m=n;let l={cell:m,startColumn:k,startRow:h},q=m.__rowSpan,u=m.__colSpan;for(let y=0;y<q;y++){void 0===d[h+y]&&(d[h+y]=[]);for(let x=0;x<u;x++)d[h+y][k+x]=l}b.is(m)&&(e=l);c.is(m)&&(f=l);g+=n.__colSpan}}null===e&&r(110);null===f&&r(111);return[d,e,f]}
|
||||
-function Ve(a){a instanceof nf||(a instanceof ce?(a=Dc(a,S),S(a)||r(114)):(a=Dc(a.getNode(),S),S(a)||r(114)));let b=a.getParent();Ye(b)||r(115);let c=b.getParent();Ze(c)||r(116);return[a,b,c]}
|
||||
-function cf(a){a.isCollapsed()||a.removeText();var b=a.anchor,c=b.getNode();if(!B(c))return b.offset;let d=c.getParent();if(!d)return a=fe(),J().append(a),a.select(),0;c=c.splitText(b.offset);if(0===c.length)return 0;b=0===b.offset?0:1;c=c[0].getIndexWithinParent()+b;if(!d.isInline()||0===c)return c;(c=d.getChildAtIndex(c))&&d.insertNewAfter(a).append(c,...c.getNextSiblings());return d.getIndexWithinParent()+b}
|
||||
-function df(a){let b=fe(),c=null;for(let d=0;d<a.length;d++){let e=a[d],f=Hc(e);if(f||z(e)&&e.isInline()||E(e)&&e.isInline()||B(e)||e.isParentRequired()){if(null===c&&(c=e.createParentElementNode(),b.append(c),f))continue;null!==c&&c.append(e)}else b.append(e),c=null}return b}let T=null,U=null,W=!1,of=!1,$b=0,pf={characterData:!0,childList:!0,subtree:!0};function ec(){return W||null!==T&&T._readOnly}function G(){W&&r(13)}function ac(){null===T&&r(15);return T}
|
||||
-function F(){null===U&&r(16);return U}function qf(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&r(30,d);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function rf(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),B(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&Hb(b)}
|
||||
-function sf(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=dc(),f=new Map;var g=c;let h=g.size;for(var k=d,m=k.size;0<h||0<m;){if(0<h){b._dirtyLeaves=new Set;for(let p of g)g=a.get(p),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&Hb(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&qf(b,g,f),c.add(p);g=b._dirtyLeaves;h=g.size;if(0<h){$b++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let p of k)if(k=p[0],m=p[1],"root"===k||m)g=a.get(k),void 0!==
|
||||
-g&&void 0!==g&&g.__key!==e&&g.isAttached()&&qf(b,g,f),d.set(k,m);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;m=k.size;$b++}b._dirtyLeaves=c;b._dirtyElements=d}function tf(a,b){var c=a.type,d=b.get(c);void 0===d&&r(17,c);c=d.klass;a.type!==c.getType()&&r(18,c.name);c=c.importJSON(a);a=a.children;if(E(c)&&Array.isArray(a))for(d=0;d<a.length;d++){let e=tf(a[d],b);c.append(e)}return c}function uf(a,b){let c=T,d=W,e=U;T=a;W=!0;U=null;try{return b()}finally{T=c,W=d,U=e}}
|
||||
-function vf(a,b){let c=a._pendingEditorState,d=a._rootElement,e=a._headless||null===d;if(null!==c){var f=a._editorState,g=f._selection,h=c._selection,k=0!==a._dirtyType,m=T,p=W,n=U,l=a._updating,q=a._observer,u=null;a._pendingEditorState=null;a._editorState=c;if(!e&&k&&null!==q){U=a;T=c;W=!1;a._updating=!0;try{let D=a._dirtyType,P=a._dirtyElements,Q=a._dirtyLeaves;q.disconnect();var y=D,x=P,A=Q;N=Lc=M="";Oc=2===y;Rc=null;O=a;Mc=a._config;Nc=a._nodes;Qc=O._listeners.mutation;Sc=x;Tc=A;Uc=f._nodeMap;
|
||||
-Vc=c._nodeMap;Pc=c._readOnly;Wc=new Map(a._keyToDOMMap);let ia=new Map;Xc=ia;td("root",null);Xc=Wc=Mc=Vc=Uc=Tc=Sc=Nc=O=void 0;u=ia}catch(D){D instanceof Error&&a._onError(D);if(of)throw D;wf(a,null,d,c);Db(a);a._dirtyType=2;of=!0;vf(a,f);of=!1;return}finally{q.observe(d,pf),a._updating=l,T=m,W=p,U=n}}c._readOnly||(c._readOnly=!0);var aa=a._dirtyLeaves,da=a._dirtyElements,Va=a._normalizedNodes,ka=a._updateTags,$c=a._deferred;k&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=
|
||||
-new Map,a._normalizedNodes=new Set,a._updateTags=new Set);var He=a._decorators,Pb=a._pendingDecorators||He,Kf=c._nodeMap,ad;for(ad in Pb)Kf.has(ad)||(Pb===He&&(Pb=fc(a)),delete Pb[ad]);var ja=e?null:xb(a._window);if(a._editable&&null!==ja&&(k||null===h||h.dirty)){U=a;T=c;try{null!==q&&q.disconnect();if(k||null===h||h.dirty){let D=a._blockCursorElement;null!==D&&Cc(D,a,d);a:{let P=ja.anchorNode,Q=ja.focusNode,ia=ja.anchorOffset,mb=ja.focusOffset,X=document.activeElement;if(!(ka.has("collaboration")&&
|
||||
-X!==d||null!==X&&Mb(X)))if(C(h)){var nb=h.anchor,bd=h.focus,Ie=nb.key,Lf=bd.key,Je=uc(a,Ie),Ke=uc(a,Lf),Qb=nb.offset,Le=bd.offset,cd=h.format,dd=h.style,Me=h.isCollapsed(),ob=Je,Rb=Ke,ed=!1;if("text"===nb.type){ob=Xb(Je);let Y=nb.getNode();ed=Y.getFormat()!==cd||Y.getStyle()!==dd}else C(g)&&"text"===g.anchor.type&&(ed=!0);"text"===bd.type&&(Rb=Xb(Ke));if(null!==ob&&null!==Rb){if(Me&&(null===g||ed||C(g)&&(g.format!==cd||g.style!==dd))){var Mf=performance.now();Nd=[cd,dd,Qb,Ie,Mf]}if(ia===Qb&&mb===
|
||||
-Le&&P===ob&&Q===Rb&&("Range"!==ja.type||!Me)&&(null!==X&&d.contains(X)||d.focus({preventScroll:!0}),"element"!==nb.type))break a;try{ja.setBaseAndExtent(ob,Qb,Rb,Le)}catch(Y){}if(!ka.has("skip-scroll-into-view")&&h.isCollapsed()&&null!==d&&d===document.activeElement){let Y=h instanceof Te&&"element"===h.anchor.type?ob.childNodes[Qb]||null:0<ja.rangeCount?ja.getRangeAt(0):null;if(null!==Y){let Z;if(Y instanceof Text){let V=document.createRange();V.selectNode(Y);Z=V.getBoundingClientRect()}else Z=Y.getBoundingClientRect();
|
||||
-let ya=d.ownerDocument,Ea=ya.defaultView;if(null!==Ea)for(var {top:fd,bottom:gd}=Z,Sb,Tb,oa=d;null!==oa;){let V=oa===ya.body;if(V)Sb=0,Tb=Eb(a).innerHeight;else{let Ub=oa.getBoundingClientRect();Sb=Ub.top;Tb=Ub.bottom}let Fa=0;fd<Sb?Fa=-(Sb-fd):gd>Tb&&(Fa=gd-Tb);if(0!==Fa)if(V)Ea.scrollBy(0,Fa);else{let Ub=oa.scrollTop;oa.scrollTop+=Fa;let Ne=oa.scrollTop-Ub;fd-=Ne;gd-=Ne}if(V)break;oa=Vb(oa)}}}Jd=!0}}else null!==g&&Nb(a,P,Q)&&ja.removeAllRanges()}}a:{let D=a._blockCursorElement;if(C(h)&&h.isCollapsed()&&
|
||||
-"element"===h.anchor.type&&d.contains(document.activeElement)){let P=h.anchor,Q=P.getNode(),ia=P.offset,mb=Q.getChildrenSize(),X=!1,Y=null;if(ia===mb){let Z=Q.getChildAtIndex(ia-1);Bc(Z)&&(X=!0)}else{let Z=Q.getChildAtIndex(ia);if(Bc(Z)){let ya=Z.getPreviousSibling();if(null===ya||Bc(ya))X=!0,Y=a.getElementByKey(Z.__key)}}if(X){let Z=a.getElementByKey(Q.__key);if(null===D){let ya=a._config.theme,Ea=document.createElement("div");Ea.contentEditable="false";Ea.setAttribute("data-lexical-cursor","true");
|
||||
-let V=ya.blockCursor;if(void 0!==V){if("string"===typeof V){let Fa=V.split(" ");V=ya.blockCursor=Fa}void 0!==V&&Ea.classList.add(...V)}a._blockCursorElement=D=Ea}d.style.caretColor="transparent";null===Y?Z.appendChild(D):Z.insertBefore(D,Y);break a}}null!==D&&Cc(D,a,d)}null!==q&&q.observe(d,pf)}finally{U=n,T=m}}if(null!==u){var Nf=u;let D=Array.from(a._listeners.mutation),P=D.length;for(let Q=0;Q<P;Q++){let [ia,mb]=D[Q],X=Nf.get(mb);void 0!==X&&ia(X,{dirtyLeaves:aa,prevEditorState:f,updateTags:ka})}}C(h)||
|
||||
-null===h||null!==g&&g.is(h)||a.dispatchCommand(ba,void 0);var hd=a._pendingDecorators;null!==hd&&(a._decorators=hd,a._pendingDecorators=null,xf("decorator",a,!0,hd));var Of=gc(b||f),Oe=gc(c);Of!==Oe&&xf("textcontent",a,!0,Oe);xf("update",a,!0,{dirtyElements:da,dirtyLeaves:aa,editorState:c,normalizedNodes:Va,prevEditorState:b||f,tags:ka});a._deferred=[];if(0!==$c.length){let D=a._updating;a._updating=!0;try{for(let P=0;P<$c.length;P++)$c[P]()}finally{a._updating=D}}var Pe=a._updates;if(0!==Pe.length){let D=
|
||||
-Pe.shift();if(D){let [P,Q]=D;yf(a,P,Q)}}}}function xf(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}
|
||||
-function R(a,b,c){if(!1===a._updating||U!==a){let f=!1;a.update(()=>{f=R(a,b,c)});return f}let d=kc(a);for(let f=4;0<=f;f--)for(let g=0;g<d.length;g++){var e=d[g]._commands.get(b);if(void 0!==e&&(e=e[f],void 0!==e)){e=Array.from(e);let h=e.length;for(let k=0;k<h;k++)if(!0===e[k](c,a))return!0}}return!1}
|
||||
-function zf(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [e,f]=d,g;void 0!==f&&(d=f.onUpdate,g=f.tag,f.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));e()}}return b}
|
||||
-function yf(a,b,c){let d=a._updateTags;var e,f=e=!1;if(void 0!==c){var g=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms||!1;f=c.discrete||!1}g&&a._deferred.push(g);c=a._editorState;g=a._pendingEditorState;let h=!1;if(null===g||g._readOnly)g=a._pendingEditorState=new Af(new Map((g||c)._nodeMap)),h=!0;g._flushSync=f;f=T;let k=W,m=U,p=a._updating;T=g;W=!1;a._updating=!0;U=a;try{h&&(a._headless?null!=c._selection&&(g._selection=c._selection.clone()):g._selection=kf(a));let n=a._compositionKey;
|
||||
-b();e=zf(a,e);mf(g,a);0!==a._dirtyType&&(e?rf(g,a):sf(g,a),zf(a),Kc(c,g,a._dirtyLeaves,a._dirtyElements));n!==a._compositionKey&&(g._flushSync=!0);let l=g._selection;if(C(l)){let q=g._nodeMap,u=l.focus.key;void 0!==q.get(l.anchor.key)&&void 0!==q.get(u)||r(19)}else Vd(l)&&0===l._nodes.size&&(g._selection=null)}catch(n){n instanceof Error&&a._onError(n);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();vf(a);return}finally{T=f,W=k,U=m,
|
||||
-a._updating=p,$b=0}0!==a._dirtyType||Bf(g,a)?g._flushSync?(g._flushSync=!1,vf(a)):h&&Lb(()=>{vf(a)}):(g._flushSync=!1,h&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function w(a,b,c){a._updating?a._updates.push([b,c]):yf(a,b,c)}class Cf extends ce{constructor(a){super(a)}decorate(){r(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function z(a){return a instanceof Cf}
|
||||
-class Df extends ce{constructor(a){super(a);this.__last=this.__first=null;this.__indent=this.__format=this.__size=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return kb[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getChildrenKeys(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b.__key),b=b.getNextSibling();return a}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===
|
||||
+function Ud(a){return a instanceof Re}function ff(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}function Qe(a){let b=a.anchor;a=a.focus;return"element"===b.type&&"element"===a.type&&b.key===a.key&&b.offset===a.offset?[0,0]:[ff(b),ff(a)]}
|
||||
+function ef(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),e=d.length,f=0,g=0;for(let h=0;h<e;h++){let k=d[h],m=h===e-1;g=f;f+=k.length;if(b&&f===c||f>c||m){d.splice(h,1);m&&(g=void 0);break}}b=d.join("").trim();""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
|
||||
+function gf(a,b,c,d){var e=b;if(1===a.nodeType){let h=!1;var f=a.childNodes,g=f.length;e===g&&(h=!0,e=g-1);let k=f[e];g=!1;k===d._blockCursorElement?(k=f[e+1],g=!0):null!==d._blockCursorElement&&e--;d=hc(k);if(B(d))e=h?d.getTextContentSize():0;else{f=hc(a);if(null===f)return null;if(E(f)){a=f.getChildAtIndex(e);if(b=E(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=h?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,e=0):(a=c,f=E(a)?a:a.getParentOrThrow()));
|
||||
+B(a)?(d=a,f=null,e=h?a.getTextContentSize():0):a!==f&&h&&!g&&e++}else e=f.getIndexWithinParent(),e=0===b&&z(f)&&hc(a)===f?e:e+1,f=f.getParentOrThrow();if(E(f))return new Ce(f.__key,e,"element")}}else d=hc(a);return B(d)?new Ce(d.__key,e,"text"):null}
|
||||
+function hf(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&E(e)&&e.isInline()&&(b=e.getPreviousSibling(),B(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):E(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):B(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&E(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
|
||||
+b)&&null===d&&E(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function af(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);hf(a,d,e);hf(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=F();d.isComposing()&&d._compositionKey!==a.key&&C(c)&&(d=c.anchor,c=c.focus,Fe(a,d.key,d.offset,d.type),Fe(b,c.key,c.offset,c.type))}}
|
||||
+function $e(a,b,c,d,e,f){if(null===a||null===c||!Mb(e,a,c))return null;b=gf(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=gf(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=hc(a),c=hc(c),z(a)&&z(c)))return null;af(b,d,f);return[b,d]}function te(a,b,c,d,e,f){let g=$b();a=new Se(new Ce(a,b,e),new Ce(c,d,f),0,"");a.dirty=!0;return g._selection=a}function df(){return new Re(new Set)}
|
||||
+function jf(a){let b=a.getEditorState()._selection,c=wb(a._window);return C(b)||null==b?Qd(b,c,a):b.clone()}
|
||||
+function Qd(a,b,c){var d=c._window;if(null===d)return null;var e=d.event,f=e?e.type:void 0;d="selectionchange"===f;e=!pb&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!C(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&C(a)&&!Mb(c,e,f))return a.clone()}else return a.clone();c=$e(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new Se(h,k,C(a)?a.format:0,C(a)?
|
||||
+a.style:"")}function v(){return $b()._selection}function mc(){return F()._editorState._selection}
|
||||
+function ae(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h)){g=b.__key;if(a.isCollapsed()){if(b=e.offset,c<=b&&0<d||c<b&&0>d)c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),kf(a)}else{let m=a.isBackward();h=m?f:e;var k=h.getNode();e=m?e:f;f=e.getNode();b.is(k)&&(k=h.offset,(c<=k&&0<d||c<k&&0>d)&&h.set(g,Math.max(0,k+d),"element"));b.is(f)&&(b=e.offset,(c<=b&&0<d||c<b&&0>d)&&e.set(g,Math.max(0,b+d),"element"))}kf(a)}}
|
||||
+function kf(a){var b=a.anchor,c=b.offset;let d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())E(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),B(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(E(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);B(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}E(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
|
||||
+1):g.getChildAtIndex(e),B(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function lf(a,b){b=b.getEditorState()._selection;a=a._selection;if(C(a)){var c=a.anchor;let d=a.focus,e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
|
||||
+function $d(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):E(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,B(e)?h="text":E(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function ue(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
|
||||
+function Ze(a,b,c){let d=[],e=null,f=null;a=a.getChildren();for(let p=0;p<a.length;p++){var g=a[p];Xe(g)||r(108);var h=g.getChildren();g=0;for(let n of h){for(S(n)||r(109);void 0!==d[p]&&void 0!==d[p][g];)g++;h=p;var k=g,m=n;let l={cell:m,startColumn:k,startRow:h},q=m.__rowSpan,u=m.__colSpan;for(let y=0;y<q;y++){void 0===d[h+y]&&(d[h+y]=[]);for(let x=0;x<u;x++)d[h+y][k+x]=l}b.is(m)&&(e=l);c.is(m)&&(f=l);g+=n.__colSpan}}null===e&&r(110);null===f&&r(111);return[d,e,f]}
|
||||
+function Ue(a){a instanceof mf||(a instanceof be?(a=Cc(a,S),S(a)||r(114)):(a=Cc(a.getNode(),S),S(a)||r(114)));let b=a.getParent();Xe(b)||r(115);let c=b.getParent();Ye(c)||r(116);return[a,b,c]}
|
||||
+function bf(a){a.isCollapsed()||a.removeText();var b=a.anchor,c=b.getNode();if(!B(c))return b.offset;let d=c.getParent();if(!d)return a=ee(),J().append(a),a.select(),0;c=c.splitText(b.offset);if(0===c.length)return 0;b=0===b.offset?0:1;c=c[0].getIndexWithinParent()+b;if(!d.isInline()||0===c)return c;(c=d.getChildAtIndex(c))&&d.insertNewAfter(a).append(c,...c.getNextSiblings());return d.getIndexWithinParent()+b}
|
||||
+function cf(a){let b=ee(),c=null;for(let d=0;d<a.length;d++){let e=a[d],f=Gc(e);if(f||z(e)&&e.isInline()||E(e)&&e.isInline()||B(e)||e.isParentRequired()){if(null===c&&(c=e.createParentElementNode(),b.append(c),f))continue;null!==c&&c.append(e)}else b.append(e),c=null}return b}let T=null,U=null,W=!1,nf=!1,Zb=0,of={characterData:!0,childList:!0,subtree:!0};function dc(){return W||null!==T&&T._readOnly}function G(){W&&r(13)}function $b(){null===T&&r(15);return T}
|
||||
+function F(){null===U&&r(16);return U}function pf(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&r(30,d);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function qf(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),B(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&Gb(b)}
|
||||
+function rf(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=cc(),f=new Map;var g=c;let h=g.size;for(var k=d,m=k.size;0<h||0<m;){if(0<h){b._dirtyLeaves=new Set;for(let p of g)g=a.get(p),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&Gb(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&pf(b,g,f),c.add(p);g=b._dirtyLeaves;h=g.size;if(0<h){Zb++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let p of k)if(k=p[0],m=p[1],"root"===k||m)g=a.get(k),void 0!==
|
||||
+g&&void 0!==g&&g.__key!==e&&g.isAttached()&&pf(b,g,f),d.set(k,m);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;m=k.size;Zb++}b._dirtyLeaves=c;b._dirtyElements=d}function sf(a,b){var c=a.type,d=b.get(c);void 0===d&&r(17,c);c=d.klass;a.type!==c.getType()&&r(18,c.name);c=c.importJSON(a);a=a.children;if(E(c)&&Array.isArray(a))for(d=0;d<a.length;d++){let e=sf(a[d],b);c.append(e)}return c}function tf(a,b){let c=T,d=W,e=U;T=a;W=!0;U=null;try{return b()}finally{T=c,W=d,U=e}}
|
||||
+function uf(a,b){let c=a._pendingEditorState,d=a._rootElement,e=a._headless||null===d;if(null!==c){var f=a._editorState,g=f._selection,h=c._selection,k=0!==a._dirtyType,m=T,p=W,n=U,l=a._updating,q=a._observer,u=null;a._pendingEditorState=null;a._editorState=c;if(!e&&k&&null!==q){U=a;T=c;W=!1;a._updating=!0;try{let D=a._dirtyType,P=a._dirtyElements,Q=a._dirtyLeaves;q.disconnect();var y=D,x=P,A=Q;N=Kc=M="";Nc=2===y;Qc=null;O=a;Lc=a._config;Mc=a._nodes;Pc=O._listeners.mutation;Rc=x;Sc=A;Tc=f._nodeMap;
|
||||
+Uc=c._nodeMap;Oc=c._readOnly;Vc=new Map(a._keyToDOMMap);let ia=new Map;Wc=ia;sd("root",null);Wc=Vc=Lc=Uc=Tc=Sc=Rc=Mc=O=void 0;u=ia}catch(D){D instanceof Error&&a._onError(D);if(nf)throw D;vf(a,null,d,c);Cb(a);a._dirtyType=2;nf=!0;uf(a,f);nf=!1;return}finally{q.observe(d,of),a._updating=l,T=m,W=p,U=n}}c._readOnly||(c._readOnly=!0);var aa=a._dirtyLeaves,da=a._dirtyElements,Va=a._normalizedNodes,ka=a._updateTags,$c=a._deferred;k&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=
|
||||
+new Map,a._normalizedNodes=new Set,a._updateTags=new Set);var He=a._decorators,Pb=a._pendingDecorators||He,Jf=c._nodeMap,ad;for(ad in Pb)Jf.has(ad)||(Pb===He&&(Pb=ec(a)),delete Pb[ad]);var ja=e?null:wb(a._window);if(a._editable&&null!==ja&&(k||null===h||h.dirty)){U=a;T=c;try{null!==q&&q.disconnect();if(k||null===h||h.dirty){let D=a._blockCursorElement;null!==D&&Bc(D,a,d);a:{let P=ja.anchorNode,Q=ja.focusNode,ia=ja.anchorOffset,mb=ja.focusOffset,X=document.activeElement;if(!(ka.has("collaboration")&&
|
||||
+X!==d||null!==X&&Lb(X)))if(C(h)){var nb=h.anchor,bd=h.focus,Ie=nb.key,Kf=bd.key,Je=tc(a,Ie),Ke=tc(a,Kf),Qb=nb.offset,Le=bd.offset,cd=h.format,dd=h.style,Me=h.isCollapsed(),ob=Je,Rb=Ke,ed=!1;if("text"===nb.type){ob=Wb(Je);let Y=nb.getNode();ed=Y.getFormat()!==cd||Y.getStyle()!==dd}else C(g)&&"text"===g.anchor.type&&(ed=!0);"text"===bd.type&&(Rb=Wb(Ke));if(null!==ob&&null!==Rb){if(Me&&(null===g||ed||C(g)&&(g.format!==cd||g.style!==dd))){var Lf=performance.now();Md=[cd,dd,Qb,Ie,Lf]}if(ia===Qb&&mb===
|
||||
+Le&&P===ob&&Q===Rb&&("Range"!==ja.type||!Me)&&(null!==X&&d.contains(X)||d.focus({preventScroll:!0}),"element"!==nb.type))break a;try{ja.setBaseAndExtent(ob,Qb,Rb,Le)}catch(Y){}if(!ka.has("skip-scroll-into-view")&&h.isCollapsed()&&null!==d&&d===document.activeElement){let Y=h instanceof Se&&"element"===h.anchor.type?ob.childNodes[Qb]||null:0<ja.rangeCount?ja.getRangeAt(0):null;if(null!==Y){let Z;if(Y instanceof Text){let V=document.createRange();V.selectNode(Y);Z=V.getBoundingClientRect()}else Z=Y.getBoundingClientRect();
|
||||
+let ya=d.ownerDocument,Ea=ya.defaultView;if(null!==Ea)for(var {top:fd,bottom:gd}=Z,Sb,Tb,oa=d;null!==oa;){let V=oa===ya.body;if(V)Sb=0,Tb=Db(a).innerHeight;else{let Ub=oa.getBoundingClientRect();Sb=Ub.top;Tb=Ub.bottom}let Fa=0;fd<Sb?Fa=-(Sb-fd):gd>Tb&&(Fa=gd-Tb);if(0!==Fa)if(V)Ea.scrollBy(0,Fa);else{let Ub=oa.scrollTop;oa.scrollTop+=Fa;let Ne=oa.scrollTop-Ub;fd-=Ne;gd-=Ne}if(V)break;oa=Ob(oa)}}}Id=!0}}else null!==g&&Mb(a,P,Q)&&ja.removeAllRanges()}}a:{let D=a._blockCursorElement;if(C(h)&&h.isCollapsed()&&
|
||||
+"element"===h.anchor.type&&d.contains(document.activeElement)){let P=h.anchor,Q=P.getNode(),ia=P.offset,mb=Q.getChildrenSize(),X=!1,Y=null;if(ia===mb){let Z=Q.getChildAtIndex(ia-1);Ac(Z)&&(X=!0)}else{let Z=Q.getChildAtIndex(ia);if(Ac(Z)){let ya=Z.getPreviousSibling();if(null===ya||Ac(ya))X=!0,Y=a.getElementByKey(Z.__key)}}if(X){let Z=a.getElementByKey(Q.__key);if(null===D){let ya=a._config.theme,Ea=document.createElement("div");Ea.contentEditable="false";Ea.setAttribute("data-lexical-cursor","true");
|
||||
+let V=ya.blockCursor;if(void 0!==V){if("string"===typeof V){let Fa=V.split(" ");V=ya.blockCursor=Fa}void 0!==V&&Ea.classList.add(...V)}a._blockCursorElement=D=Ea}d.style.caretColor="transparent";null===Y?Z.appendChild(D):Z.insertBefore(D,Y);break a}}null!==D&&Bc(D,a,d)}null!==q&&q.observe(d,of)}finally{U=n,T=m}}if(null!==u){var Mf=u;let D=Array.from(a._listeners.mutation),P=D.length;for(let Q=0;Q<P;Q++){let [ia,mb]=D[Q],X=Mf.get(mb);void 0!==X&&ia(X,{dirtyLeaves:aa,prevEditorState:f,updateTags:ka})}}C(h)||
|
||||
+null===h||null!==g&&g.is(h)||a.dispatchCommand(ba,void 0);var hd=a._pendingDecorators;null!==hd&&(a._decorators=hd,a._pendingDecorators=null,wf("decorator",a,!0,hd));var Nf=fc(b||f),Oe=fc(c);Nf!==Oe&&wf("textcontent",a,!0,Oe);wf("update",a,!0,{dirtyElements:da,dirtyLeaves:aa,editorState:c,normalizedNodes:Va,prevEditorState:b||f,tags:ka});a._deferred=[];if(0!==$c.length){let D=a._updating;a._updating=!0;try{for(let P=0;P<$c.length;P++)$c[P]()}finally{a._updating=D}}var Pe=a._updates;if(0!==Pe.length){let D=
|
||||
+Pe.shift();if(D){let [P,Q]=D;xf(a,P,Q)}}}}function wf(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}
|
||||
+function R(a,b,c){if(!1===a._updating||U!==a){let f=!1;a.update(()=>{f=R(a,b,c)});return f}let d=jc(a);for(let f=4;0<=f;f--)for(let g=0;g<d.length;g++){var e=d[g]._commands.get(b);if(void 0!==e&&(e=e[f],void 0!==e)){e=Array.from(e);let h=e.length;for(let k=0;k<h;k++)if(!0===e[k](c,a))return!0}}return!1}
|
||||
+function yf(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [e,f]=d,g;void 0!==f&&(d=f.onUpdate,g=f.tag,f.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));e()}}return b}
|
||||
+function xf(a,b,c){let d=a._updateTags;var e,f=e=!1;if(void 0!==c){var g=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms||!1;f=c.discrete||!1}g&&a._deferred.push(g);c=a._editorState;g=a._pendingEditorState;let h=!1;if(null===g||g._readOnly)g=a._pendingEditorState=new zf(new Map((g||c)._nodeMap)),h=!0;g._flushSync=f;f=T;let k=W,m=U,p=a._updating;T=g;W=!1;a._updating=!0;U=a;try{h&&(a._headless?null!=c._selection&&(g._selection=c._selection.clone()):g._selection=jf(a));let n=a._compositionKey;
|
||||
+b();e=yf(a,e);lf(g,a);0!==a._dirtyType&&(e?qf(g,a):rf(g,a),yf(a),Jc(c,g,a._dirtyLeaves,a._dirtyElements));n!==a._compositionKey&&(g._flushSync=!0);let l=g._selection;if(C(l)){let q=g._nodeMap,u=l.focus.key;void 0!==q.get(l.anchor.key)&&void 0!==q.get(u)||r(19)}else Ud(l)&&0===l._nodes.size&&(g._selection=null)}catch(n){n instanceof Error&&a._onError(n);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();uf(a);return}finally{T=f,W=k,U=m,
|
||||
+a._updating=p,Zb=0}0!==a._dirtyType||Af(g,a)?g._flushSync?(g._flushSync=!1,uf(a)):h&&Kb(()=>{uf(a)}):(g._flushSync=!1,h&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function w(a,b,c){a._updating?a._updates.push([b,c]):xf(a,b,c)}class Bf extends be{constructor(a){super(a)}decorate(){r(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function z(a){return a instanceof Bf}
|
||||
+class Cf extends be{constructor(a){super(a);this.__last=this.__first=null;this.__indent=this.__format=this.__size=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return jb[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getChildrenKeys(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b.__key),b=b.getNextSibling();return a}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===
|
||||
this.getChildrenSize()}isDirty(){let a=F()._dirtyElements;return null!==a&&a.has(this.__key)}isLastChild(){let a=this.getLatest(),b=this.getParentOrThrow().getLastChild();return null!==b&&b.is(a)}getAllTextNodes(){let a=[],b=this.getFirstChild();for(;null!==b;){B(b)&&a.push(b);if(E(b)){let c=b.getAllTextNodes();a.push(...c)}b=b.getNextSibling()}return a}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(E(a)){let b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=
|
||||
this.getLastChild();for(;null!==a;){if(E(a)){let b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){let b=this.getChildren(),c=b.length;if(a>=c)return a=b[c-1],E(a)&&a.getLastDescendant()||a||null;a=b[a];return E(a)&&a.getFirstDescendant()||a||null}getFirstChild(){let a=this.getLatest().__first;return null===a?null:I(a)}getFirstChildOrThrow(){let a=this.getFirstChild();null===a&&r(45,this.__key);return a}getLastChild(){let a=this.getLatest().__last;return null===
|
||||
a?null:I(a)}getLastChildOrThrow(){let a=this.getLastChild();null===a&&r(96,this.__key);return a}getChildAtIndex(a){var b=this.getChildrenSize();let c;if(a<b/2){c=this.getFirstChild();for(b=0;null!==c&&b<=a;){if(b===a)return c;c=c.getNextSibling();b++}return null}c=this.getLastChild();for(--b;null!==c&&b>=a;){if(b===a)return c;c=c.getPreviousSibling();b--}return null}getTextContent(){let a="",b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContent();E(e)&&d!==c-1&&!e.isInline()&&
|
||||
-(a+="\n\n")}return a}getTextContentSize(){let a=0,b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContentSize();E(e)&&d!==c-1&&!e.isInline()&&(a+=2)}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a=jb[a],0!==(this.getFormat()&a)):!1}select(a,b){G();let c=v(),d=a,e=b;var f=this.getChildrenSize();if(!this.canBeEmpty())if(0===a&&0===b){if(a=this.getFirstChild(),B(a)||E(a))return a.select(0,0)}else if(!(void 0!==a&&a!==f||void 0!==b&&b!==f)&&
|
||||
-(a=this.getLastChild(),B(a)||E(a)))return a.select();void 0===d&&(d=f);void 0===e&&(e=f);f=this.__key;if(C(c))c.anchor.set(f,d,"element"),c.focus.set(f,e,"element"),c.dirty=!0;else return ue(f,d,f,e,"element","element");return c}selectStart(){let a=this.getFirstDescendant();return a?a.selectStart():this.select()}selectEnd(){let a=this.getLastDescendant();return a?a.selectEnd():this.select()}clear(){let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){return this.splice(this.getChildrenSize(),
|
||||
-0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?jb[a]:0;return this}setIndent(a){this.getWritable().__indent=a;return this}splice(a,b,c){let d=c.length,e=this.getChildrenSize(),f=this.getWritable(),g=f.__key;var h=[],k=[];let m=this.getChildAtIndex(a+b),p=null,n=e-b+d;if(0!==a)if(a===e)p=this.getLastChild();else{var l=this.getChildAtIndex(a);null!==l&&(p=l.getPreviousSibling())}if(0<b){var q=null===p?this.getFirstChild():p.getNextSibling();
|
||||
-for(l=0;l<b;l++){null===q&&r(100);var u=q.getNextSibling(),y=q.__key;q=q.getWritable();bc(q);k.push(y);q=u}}l=p;for(u=0;u<d;u++){y=c[u];null!==l&&y.is(l)&&(p=l=l.getPreviousSibling());q=y.getWritable();q.__parent===g&&n--;bc(q);let x=y.__key;null===l?(f.__first=x,q.__prev=null):(l=l.getWritable(),l.__next=x,q.__prev=l.__key);y.__key===g&&r(76);q.__parent=g;h.push(x);l=y}a+b===e?null!==l&&(l.getWritable().__next=null,f.__last=l.__key):null!==m&&(a=m.getWritable(),null!==l?(b=l.getWritable(),a.__prev=
|
||||
-l.__key,b.__next=m.__key):a.__prev=null);f.__size=n;if(k.length&&(a=v(),C(a))){k=new Set(k);h=new Set(h);let {anchor:x,focus:A}=a;Ef(x,k,h)&&ae(x,x.getNode(),this,p,m);Ef(A,k,h)&&ae(A,A.getNode(),this,p,m);0!==n||this.canBeEmpty()||xc(this)||this.remove()}return f}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(){return null}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}
|
||||
-function E(a){return a instanceof Df}function Ef(a,b,c){for(a=a.getNode();a;){let d=a.__key;if(b.has(d)&&!c.has(d))return!0;a=a.getParent()}return!1}
|
||||
-class Ff extends Df{static getType(){return"root"}static clone(){return new Ff}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){r(51)}getTextContent(){let a=this.__cachedText;return!ec()&&0!==F()._dirtyType||null===a?super.getTextContent():a}remove(){r(52)}replace(){r(53)}insertBefore(){r(54)}insertAfter(){r(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];E(c)||z(c)||r(56)}return super.append(...a)}static importJSON(a){let b=J();b.setFormat(a.format);
|
||||
-b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function L(a){return a instanceof Ff}function Bf(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function Gf(){return new Af(new Map([["root",new Ff]]))}
|
||||
-function Hf(a){let b=a.exportJSON();var c=a.constructor;b.type!==c.getType()&&r(130,c.name);let d=b.children;if(E(a))for(Array.isArray(d)||r(59,c.name),a=a.getChildren(),c=0;c<a.length;c++){let e=Hf(a[c]);d.push(e)}return b}
|
||||
-class Af{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){return uf(this,a)}clone(a){a=new Af(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return uf(this,()=>({root:Hf(J())}))}}
|
||||
-class If extends Df{static getType(){return"paragraph"}static clone(a){return new If(a.__key)}createDOM(a){let b=document.createElement("p");a=pc(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Jf,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));if(a&&Fc(a)){this.isEmpty()&&a.append(document.createElement("br"));var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();
|
||||
-0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=fe();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(a,b){a=fe();let c=this.getDirection();a.setDirection(c);this.insertAfter(a,b);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||B(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),
|
||||
-this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Jf(a){let b=fe();a.style&&(b.setFormat(a.style.textAlign),a=parseInt(a.style.textIndent,10)/20,0<a&&b.setIndent(a));return{node:b}}function fe(){return zc(new If)}
|
||||
-function wf(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=Gf();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];a._blockCursorElement=null;d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
|
||||
-function Pf(a,b){let c=new Map,d=new Set,e=f=>{Object.keys(f).forEach(g=>{let h=c.get(g);void 0===h&&(h=[],c.set(g,h));h.push(f[g])})};a.forEach(f=>{f=null!=f.klass.importDOM?f.klass.importDOM.bind(f.klass):null;null==f||d.has(f)||(d.add(f),f=f(),null!==f&&e(f))});b&&e(b);return c}
|
||||
-class Qf{constructor(a,b,c,d,e,f,g){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
|
||||
-new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=lc();this._onError=e;this._htmlConversions=f;this._editable=g;this._headless=null!==b&&b._headless;this._blockCursorElement=this._window=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerEditableListener(a){let b=this._listeners.editable;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=
|
||||
+(a+="\n\n")}return a}getTextContentSize(){let a=0,b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContentSize();E(e)&&d!==c-1&&!e.isInline()&&(a+=2)}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a=ib[a],0!==(this.getFormat()&a)):!1}select(a,b){G();let c=v(),d=a,e=b;var f=this.getChildrenSize();if(!this.canBeEmpty())if(0===a&&0===b){if(a=this.getFirstChild(),B(a)||E(a))return a.select(0,0)}else if(!(void 0!==a&&a!==f||void 0!==b&&b!==f)&&
|
||||
+(a=this.getLastChild(),B(a)||E(a)))return a.select();void 0===d&&(d=f);void 0===e&&(e=f);f=this.__key;if(C(c))c.anchor.set(f,d,"element"),c.focus.set(f,e,"element"),c.dirty=!0;else return te(f,d,f,e,"element","element");return c}selectStart(){let a=this.getFirstDescendant();return a?a.selectStart():this.select()}selectEnd(){let a=this.getLastDescendant();return a?a.selectEnd():this.select()}clear(){let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){return this.splice(this.getChildrenSize(),
|
||||
+0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?ib[a]:0;return this}setIndent(a){this.getWritable().__indent=a;return this}splice(a,b,c){let d=c.length,e=this.getChildrenSize(),f=this.getWritable(),g=f.__key;var h=[],k=[];let m=this.getChildAtIndex(a+b),p=null,n=e-b+d;if(0!==a)if(a===e)p=this.getLastChild();else{var l=this.getChildAtIndex(a);null!==l&&(p=l.getPreviousSibling())}if(0<b){var q=null===p?this.getFirstChild():p.getNextSibling();
|
||||
+for(l=0;l<b;l++){null===q&&r(100);var u=q.getNextSibling(),y=q.__key;q=q.getWritable();ac(q);k.push(y);q=u}}l=p;for(u=0;u<d;u++){y=c[u];null!==l&&y.is(l)&&(p=l=l.getPreviousSibling());q=y.getWritable();q.__parent===g&&n--;ac(q);let x=y.__key;null===l?(f.__first=x,q.__prev=null):(l=l.getWritable(),l.__next=x,q.__prev=l.__key);y.__key===g&&r(76);q.__parent=g;h.push(x);l=y}a+b===e?null!==l&&(l.getWritable().__next=null,f.__last=l.__key):null!==m&&(a=m.getWritable(),null!==l?(b=l.getWritable(),a.__prev=
|
||||
+l.__key,b.__next=m.__key):a.__prev=null);f.__size=n;if(k.length&&(a=v(),C(a))){k=new Set(k);h=new Set(h);let {anchor:x,focus:A}=a;Df(x,k,h)&&$d(x,x.getNode(),this,p,m);Df(A,k,h)&&$d(A,A.getNode(),this,p,m);0!==n||this.canBeEmpty()||wc(this)||this.remove()}return f}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(){return null}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}
|
||||
+function E(a){return a instanceof Cf}function Df(a,b,c){for(a=a.getNode();a;){let d=a.__key;if(b.has(d)&&!c.has(d))return!0;a=a.getParent()}return!1}
|
||||
+class Ef extends Cf{static getType(){return"root"}static clone(){return new Ef}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){r(51)}getTextContent(){let a=this.__cachedText;return!dc()&&0!==F()._dirtyType||null===a?super.getTextContent():a}remove(){r(52)}replace(){r(53)}insertBefore(){r(54)}insertAfter(){r(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];E(c)||z(c)||r(56)}return super.append(...a)}static importJSON(a){let b=J();b.setFormat(a.format);
|
||||
+b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function L(a){return a instanceof Ef}function Af(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function Ff(){return new zf(new Map([["root",new Ef]]))}
|
||||
+function Gf(a){let b=a.exportJSON();var c=a.constructor;b.type!==c.getType()&&r(130,c.name);let d=b.children;if(E(a))for(Array.isArray(d)||r(59,c.name),a=a.getChildren(),c=0;c<a.length;c++){let e=Gf(a[c]);d.push(e)}return b}
|
||||
+class zf{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){return tf(this,a)}clone(a){a=new zf(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return tf(this,()=>({root:Gf(J())}))}}
|
||||
+class Hf extends Cf{static getType(){return"paragraph"}static clone(a){return new Hf(a.__key)}createDOM(a){let b=document.createElement("p");a=oc(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:If,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));if(a&&Ec(a)){this.isEmpty()&&a.append(document.createElement("br"));var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();
|
||||
+0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=ee();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(a,b){a=ee();let c=this.getDirection();a.setDirection(c);this.insertAfter(a,b);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||B(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),
|
||||
+this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function If(a){let b=ee();a.style&&(b.setFormat(a.style.textAlign),a=parseInt(a.style.textIndent,10)/20,0<a&&b.setIndent(a));return{node:b}}function ee(){return yc(new Hf)}
|
||||
+function vf(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=Ff();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];a._blockCursorElement=null;d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
|
||||
+function Of(a,b){let c=new Map,d=new Set,e=f=>{Object.keys(f).forEach(g=>{let h=c.get(g);void 0===h&&(h=[],c.set(g,h));h.push(f[g])})};a.forEach(f=>{f=null!=f.klass.importDOM?f.klass.importDOM.bind(f.klass):null;null==f||d.has(f)||(d.add(f),f=f(),null!==f&&e(f))});b&&e(b);return c}
|
||||
+class Pf{constructor(a,b,c,d,e,f,g){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
|
||||
+new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=kc();this._onError=e;this._htmlConversions=f;this._editable=g;this._headless=null!==b&&b._headless;this._blockCursorElement=this._window=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerEditableListener(a){let b=this._listeners.editable;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=
|
||||
this._listeners.decorator;b.add(a);return()=>{b.delete(a)}}registerTextContentListener(a){let b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){let b=this._listeners.root;a(this._rootElement,null);b.add(a);return()=>{a(null,this._rootElement);b.delete(a)}}registerCommand(a,b,c){void 0===c&&r(35);let d=this._commands;d.has(a)||d.set(a,[new Set,new Set,new Set,new Set,new Set]);let e=d.get(a);void 0===e&&r(36,String(a));let f=e[c];f.add(b);return()=>{f.delete(b);
|
||||
-e.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,b){void 0===this._nodes.get(a.getType())&&r(37,a.name);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransformToKlass(a,b){var c=a.getType();c=this._nodes.get(c);void 0===c&&r(37,a.name);c.transforms.add(b);return c}registerNodeTransform(a,b){var c=this.registerNodeTransformToKlass(a,b);let d=[c];c=c.replaceWithKlass;null!=c&&(c=this.registerNodeTransformToKlass(c,b),d.push(c));hc(this,a.getType());return()=>
|
||||
-{d.forEach(e=>e.transforms.delete(b))}}hasNode(a){return this._nodes.has(a.getType())}hasNodes(a){return a.every(this.hasNode.bind(this))}dispatchCommand(a,b){return R(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=this._rootElement;if(a!==b){let f=pc(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;wf(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==
|
||||
-Id&&(Id--,0===Id&&b.ownerDocument.removeEventListener("selectionchange",Yd));var d=b.__lexicalEditor;if(null!==d&&void 0!==d){if(null!==d._parentEditor){var e=kc(d);e=e[e.length-1]._key;Xd.get(e)===d&&Xd.delete(e)}else Xd.delete(d._key);b.__lexicalEditor=null}d=Wd(b);for(e=0;e<d.length;e++)d[e]();b.__lexicalEventHandles=[]}null!=f&&b.classList.remove(...f)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor",
|
||||
-"true"),this._window=c,this._dirtyType=2,Db(this),this._updateTags.add("history-merge"),vf(this),this._config.disableEvents||Zd(a,this),null!=f&&a.classList.add(...f)):(this._editorState=c,this._window=this._pendingEditorState=null);xf("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&r(38);Cb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||
|
||||
-(null!=b&&d.add(b),vf(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);vf(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=Gf(),d=T,e=W,f=U,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,m=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;T=c;W=!1;U=this;try{tf(a.root,this._nodes),b&&b(),c._readOnly=!0}catch(p){p instanceof
|
||||
+e.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,b){void 0===this._nodes.get(a.getType())&&r(37,a.name);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransformToKlass(a,b){var c=a.getType();c=this._nodes.get(c);void 0===c&&r(37,a.name);c.transforms.add(b);return c}registerNodeTransform(a,b){var c=this.registerNodeTransformToKlass(a,b);let d=[c];c=c.replaceWithKlass;null!=c&&(c=this.registerNodeTransformToKlass(c,b),d.push(c));gc(this,a.getType());return()=>
|
||||
+{d.forEach(e=>e.transforms.delete(b))}}hasNode(a){return this._nodes.has(a.getType())}hasNodes(a){return a.every(this.hasNode.bind(this))}dispatchCommand(a,b){return R(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=this._rootElement;if(a!==b){let f=oc(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;vf(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==
|
||||
+Hd&&(Hd--,0===Hd&&b.ownerDocument.removeEventListener("selectionchange",Xd));var d=b.__lexicalEditor;if(null!==d&&void 0!==d){if(null!==d._parentEditor){var e=jc(d);e=e[e.length-1]._key;Wd.get(e)===d&&Wd.delete(e)}else Wd.delete(d._key);b.__lexicalEditor=null}d=Vd(b);for(e=0;e<d.length;e++)d[e]();b.__lexicalEventHandles=[]}null!=f&&b.classList.remove(...f)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor",
|
||||
+"true"),this._window=c,this._dirtyType=2,Cb(this),this._updateTags.add("history-merge"),uf(this),this._config.disableEvents||Yd(a,this),null!=f&&a.classList.add(...f)):(this._editorState=c,this._window=this._pendingEditorState=null);wf("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&r(38);Bb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||
|
||||
+(null!=b&&d.add(b),uf(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);uf(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=Ff(),d=T,e=W,f=U,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,m=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;T=c;W=!1;U=this;try{sf(a.root,this._nodes),b&&b(),c._readOnly=!0}catch(p){p instanceof
|
||||
Error&&this._onError(p)}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=m,T=d,W=e,U=f}return c}update(a,b){w(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),w(this,()=>{let d=v(),e=J();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");a&&a()},tag:"focus"}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=
|
||||
-this._rootElement;null!==a&&a.blur();a=xb(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,xf("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}
|
||||
-class nf extends Df{constructor(a,b){super(b);this.__colSpan=a;this.__rowSpan=1}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan,rowSpan:this.__rowSpan}}getColSpan(){return this.__colSpan}setColSpan(a){this.getWritable().__colSpan=a;return this}getRowSpan(){return this.__rowSpan}setRowSpan(a){this.getWritable().__rowSpan=a;return this}}function S(a){return a instanceof nf}class Rf extends Df{}function Ze(a){return a instanceof Rf}class Sf extends Df{}
|
||||
-function Ye(a){return a instanceof Sf}exports.$INTERNAL_isPointSelection=de;exports.$addUpdateTag=function(a){G();F()._updateTags.add(a)};exports.$applyNodeReplacement=zc;exports.$copyNode=yc;exports.$createLineBreakNode=je;exports.$createNodeSelection=ef;exports.$createParagraphNode=fe;exports.$createRangeSelection=function(){let a=new De("root",0,"element"),b=new De("root",0,"element");return new Te(a,b,0,"")};exports.$createTabNode=xe;exports.$createTextNode=K;exports.$getAdjacentNode=sc;
|
||||
-exports.$getNearestNodeFromDOMNode=wb;exports.$getNearestRootOrShadowRoot=wc;exports.$getNodeByKey=I;exports.$getPreviousSelection=nc;exports.$getRoot=J;exports.$getSelection=v;exports.$getTextContent=function(){let a=v();return null===a?"":a.getTextContent()};exports.$hasAncestor=vc;exports.$hasUpdateTag=function(a){return F()._updateTags.has(a)};exports.$insertNodes=function(a){let b=v()||nc();null===b&&(b=J().selectEnd());b.insertNodes(a)};exports.$isBlockElementNode=function(a){return E(a)&&!a.isInline()};
|
||||
-exports.$isDecoratorNode=z;exports.$isElementNode=E;exports.$isInlineElementOrDecoratorNode=function(a){return E(a)&&a.isInline()||z(a)&&a.isInline()};exports.$isLeafNode=function(a){return B(a)||Hc(a)||z(a)};exports.$isLineBreakNode=Hc;exports.$isNodeSelection=Vd;exports.$isParagraphNode=function(a){return a instanceof If};exports.$isRangeSelection=C;exports.$isRootNode=L;exports.$isRootOrShadowRoot=xc;exports.$isTabNode=Ce;exports.$isTextNode=B;
|
||||
-exports.$nodesOfType=function(a){var b=ac();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};exports.$normalizeSelection__EXPERIMENTAL=Ib;exports.$parseSerializedNode=function(a){return tf(a,F()._nodes)};exports.$selectAll=function(){var a=J();a=a.select(0,a.getChildrenSize());Ab(Ib(a))};exports.$setCompositionKey=H;exports.$setSelection=Ab;
|
||||
-exports.$splitNode=function(a,b){let c=a.getChildAtIndex(b);null==c&&(c=a);xc(a)&&r(102);let d=g=>{const h=g.getParentOrThrow(),k=xc(h),m=g!==c||k?yc(g):g;if(k)return g.insertAfter(m),[g,m,m];const [p,n,l]=d(h);g=g.getNextSiblings();l.append(m,...g);return[p,n,m]},[e,f]=d(c);return[e,f]};exports.BLUR_COMMAND=Sa;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=ca;exports.COMMAND_PRIORITY_CRITICAL=4;
|
||||
-exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=la;exports.COPY_COMMAND=Oa;exports.CUT_COMMAND=Pa;exports.DELETE_CHARACTER_COMMAND=ea;exports.DELETE_LINE_COMMAND=qa;exports.DELETE_WORD_COMMAND=pa;exports.DEPRECATED_$computeGridMap=$e;exports.DEPRECATED_$createGridSelection=function(){let a=new De("root",0,"element"),b=new De("root",0,"element");return new We("root",a,b)};
|
||||
-exports.DEPRECATED_$getGridCellNodeRect=Ue;exports.DEPRECATED_$getNodeTriplet=Ve;exports.DEPRECATED_$isGridCellNode=S;exports.DEPRECATED_$isGridNode=Ze;exports.DEPRECATED_$isGridRowNode=Ye;exports.DEPRECATED_$isGridSelection=Xe;exports.DEPRECATED_GridCellNode=nf;exports.DEPRECATED_GridNode=Rf;exports.DEPRECATED_GridRowNode=Sf;exports.DRAGEND_COMMAND=Na;exports.DRAGOVER_COMMAND=Ma;exports.DRAGSTART_COMMAND=La;exports.DROP_COMMAND=Ka;exports.DecoratorNode=Cf;exports.ElementNode=Df;
|
||||
+this._rootElement;null!==a&&a.blur();a=wb(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,wf("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}
|
||||
+class mf extends Cf{constructor(a,b){super(b);this.__colSpan=a;this.__rowSpan=1}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan,rowSpan:this.__rowSpan}}getColSpan(){return this.__colSpan}setColSpan(a){this.getWritable().__colSpan=a;return this}getRowSpan(){return this.__rowSpan}setRowSpan(a){this.getWritable().__rowSpan=a;return this}}function S(a){return a instanceof mf}class Qf extends Cf{}function Ye(a){return a instanceof Qf}class Rf extends Cf{}
|
||||
+function Xe(a){return a instanceof Rf}exports.$INTERNAL_isPointSelection=ce;exports.$addUpdateTag=function(a){G();F()._updateTags.add(a)};exports.$applyNodeReplacement=yc;exports.$copyNode=xc;exports.$createLineBreakNode=ie;exports.$createNodeSelection=df;exports.$createParagraphNode=ee;exports.$createRangeSelection=function(){let a=new Ce("root",0,"element"),b=new Ce("root",0,"element");return new Se(a,b,0,"")};exports.$createTabNode=we;exports.$createTextNode=K;exports.$getAdjacentNode=rc;
|
||||
+exports.$getNearestNodeFromDOMNode=vb;exports.$getNearestRootOrShadowRoot=vc;exports.$getNodeByKey=I;exports.$getPreviousSelection=mc;exports.$getRoot=J;exports.$getSelection=v;exports.$getTextContent=function(){let a=v();return null===a?"":a.getTextContent()};exports.$hasAncestor=uc;exports.$hasUpdateTag=function(a){return F()._updateTags.has(a)};exports.$insertNodes=function(a){let b=v()||mc();null===b&&(b=J().selectEnd());b.insertNodes(a)};exports.$isBlockElementNode=function(a){return E(a)&&!a.isInline()};
|
||||
+exports.$isDecoratorNode=z;exports.$isElementNode=E;exports.$isInlineElementOrDecoratorNode=function(a){return E(a)&&a.isInline()||z(a)&&a.isInline()};exports.$isLeafNode=function(a){return B(a)||Gc(a)||z(a)};exports.$isLineBreakNode=Gc;exports.$isNodeSelection=Ud;exports.$isParagraphNode=function(a){return a instanceof Hf};exports.$isRangeSelection=C;exports.$isRootNode=L;exports.$isRootOrShadowRoot=wc;exports.$isTabNode=Be;exports.$isTextNode=B;
|
||||
+exports.$nodesOfType=function(a){var b=$b();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};exports.$normalizeSelection__EXPERIMENTAL=Hb;exports.$parseSerializedNode=function(a){return sf(a,F()._nodes)};exports.$selectAll=function(){var a=J();a=a.select(0,a.getChildrenSize());zb(Hb(a))};exports.$setCompositionKey=H;exports.$setSelection=zb;
|
||||
+exports.$splitNode=function(a,b){let c=a.getChildAtIndex(b);null==c&&(c=a);wc(a)&&r(102);let d=g=>{const h=g.getParentOrThrow(),k=wc(h),m=g!==c||k?xc(g):g;if(k)return g.insertAfter(m),[g,m,m];const [p,n,l]=d(h);g=g.getNextSiblings();l.append(m,...g);return[p,n,m]},[e,f]=d(c);return[e,f]};exports.BLUR_COMMAND=Sa;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=ca;exports.COMMAND_PRIORITY_CRITICAL=4;
|
||||
+exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=la;exports.COPY_COMMAND=Oa;exports.CUT_COMMAND=Pa;exports.DELETE_CHARACTER_COMMAND=ea;exports.DELETE_LINE_COMMAND=qa;exports.DELETE_WORD_COMMAND=pa;exports.DEPRECATED_$computeGridMap=Ze;exports.DEPRECATED_$createGridSelection=function(){let a=new Ce("root",0,"element"),b=new Ce("root",0,"element");return new Ve("root",a,b)};
|
||||
+exports.DEPRECATED_$getGridCellNodeRect=Te;exports.DEPRECATED_$getNodeTriplet=Ue;exports.DEPRECATED_$isGridCellNode=S;exports.DEPRECATED_$isGridNode=Ye;exports.DEPRECATED_$isGridRowNode=Xe;exports.DEPRECATED_$isGridSelection=We;exports.DEPRECATED_GridCellNode=mf;exports.DEPRECATED_GridNode=Qf;exports.DEPRECATED_GridRowNode=Rf;exports.DRAGEND_COMMAND=Na;exports.DRAGOVER_COMMAND=Ma;exports.DRAGSTART_COMMAND=La;exports.DROP_COMMAND=Ka;exports.DecoratorNode=Bf;exports.ElementNode=Cf;
|
||||
exports.FOCUS_COMMAND=Ra;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=ra;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=fa;exports.INSERT_PARAGRAPH_COMMAND=ha;exports.INSERT_TAB_COMMAND={};exports.KEY_ARROW_DOWN_COMMAND=Ba;exports.KEY_ARROW_LEFT_COMMAND=xa;exports.KEY_ARROW_RIGHT_COMMAND=va;exports.KEY_ARROW_UP_COMMAND=Aa;exports.KEY_BACKSPACE_COMMAND=Ga;exports.KEY_DELETE_COMMAND=Ia;exports.KEY_DOWN_COMMAND=ua;exports.KEY_ENTER_COMMAND=Ca;
|
||||
-exports.KEY_ESCAPE_COMMAND=Ha;exports.KEY_MODIFIER_COMMAND=Ta;exports.KEY_SPACE_COMMAND=Da;exports.KEY_TAB_COMMAND=Ja;exports.LineBreakNode=he;exports.MOVE_TO_END=wa;exports.MOVE_TO_START=za;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ma;exports.ParagraphNode=If;exports.REDO_COMMAND=ta;exports.REMOVE_TEXT_COMMAND=na;exports.RootNode=Ff;exports.SELECTION_CHANGE_COMMAND=ba;exports.SELECT_ALL_COMMAND=Qa;exports.TabNode=Be;exports.TextNode=pe;exports.UNDO_COMMAND=sa;
|
||||
+exports.KEY_ESCAPE_COMMAND=Ha;exports.KEY_MODIFIER_COMMAND=Ta;exports.KEY_SPACE_COMMAND=Da;exports.KEY_TAB_COMMAND=Ja;exports.LineBreakNode=ge;exports.MOVE_TO_END=wa;exports.MOVE_TO_START=za;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ma;exports.ParagraphNode=Hf;exports.REDO_COMMAND=ta;exports.REMOVE_TEXT_COMMAND=na;exports.RootNode=Ef;exports.SELECTION_CHANGE_COMMAND=ba;exports.SELECT_ALL_COMMAND=Qa;exports.TabNode=Ae;exports.TextNode=oe;exports.UNDO_COMMAND=sa;
|
||||
exports.createCommand=function(){return{}};
|
||||
-exports.createEditor=function(a){var b=a||{},c=U,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=Gf(),h=b.namespace||(null!==e?e._config.namespace:lc()),k=b.editorState,m=[Ff,pe,he,Be,If,...(b.nodes||[])],{onError:p,html:n}=b;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<m.length;c++){let q=m[c],u=null;var l=null;"function"!==typeof q&&(l=q,q=l.replace,u=l.with,l=l.withKlass||null);let y=q.getType(),x=q.transform(),A=
|
||||
-new Set;null!==x&&A.add(x);a.set(y,{exportDOM:n&&n.export?n.export.get(q):void 0,klass:q,replace:u,replaceWithKlass:l,transforms:A})}d=new Qf(g,e,a,{disableEvents:f,namespace:h,theme:d},p?p:console.error,Pf(a,n?n.import:void 0),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d};exports.getNearestEditorFromDOMNode=Ob;exports.isHTMLAnchorElement=function(a){return Fc(a)&&"A"===a.tagName};exports.isHTMLElement=Fc;exports.isSelectionCapturedInDecoratorInput=Mb;
|
||||
-exports.isSelectionWithinEditor=Nb
|
||||
+exports.createEditor=function(a){var b=a||{},c=U,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=Ff(),h=b.namespace||(null!==e?e._config.namespace:kc()),k=b.editorState,m=[Ef,oe,ge,Ae,Hf,...(b.nodes||[])],{onError:p,html:n}=b;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<m.length;c++){let q=m[c],u=null;var l=null;"function"!==typeof q&&(l=q,q=l.replace,u=l.with,l=l.withKlass||null);let y=q.getType(),x=q.transform(),A=
|
||||
+new Set;null!==x&&A.add(x);a.set(y,{exportDOM:n&&n.export?n.export.get(q):void 0,klass:q,replace:u,replaceWithKlass:l,transforms:A})}d=new Pf(g,e,a,{disableEvents:f,namespace:h,theme:d},p?p:console.error,Of(a,n?n.import:void 0),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d};exports.getNearestEditorFromDOMNode=Nb;exports.isHTMLAnchorElement=function(a){return Ec(a)&&"A"===a.tagName};exports.isHTMLElement=Ec;exports.isSelectionCapturedInDecoratorInput=Lb;
|
||||
+exports.isSelectionWithinEditor=Mb
|
||||
@@ -0,0 +1,462 @@
|
||||
diff --git a/Lexical.dev.js b/Lexical.dev.js
|
||||
index a21fdea722a3b77d94be5850e9effe5f1745348c..9b4281e416e8a1c7c8715f16dc37c088295aaa56 100644
|
||||
--- a/Lexical.dev.js
|
||||
+++ b/Lexical.dev.js
|
||||
@@ -95,6 +95,7 @@ const IS_ANDROID = CAN_USE_DOM && /Android/.test(navigator.userAgent);
|
||||
const IS_CHROME = CAN_USE_DOM && /^(?=.*Chrome).*/i.test(navigator.userAgent);
|
||||
// export const canUseTextInputEvent: boolean = CAN_USE_DOM && 'TextEvent' in window && !documentMode;
|
||||
|
||||
+const IS_ANDROID_CHROME = IS_ANDROID && IS_CHROME;
|
||||
const IS_APPLE_WEBKIT = CAN_USE_DOM && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !IS_CHROME;
|
||||
|
||||
/**
|
||||
@@ -2508,7 +2509,8 @@ function onBeforeInput(event, editor) {
|
||||
if (IS_ANDROID) {
|
||||
$setCompositionKey(selection.anchor.key);
|
||||
}
|
||||
- if (isPossiblyAndroidKeyPress(event.timeStamp) && editor.isComposing() && selection.anchor.key === selection.focus.key) {
|
||||
+ const isSelectionAnchorSameAsFocus = selection.anchor.key === selection.focus.key;
|
||||
+ if (isPossiblyAndroidKeyPress(event.timeStamp) && editor.isComposing() && isSelectionAnchorSameAsFocus) {
|
||||
$setCompositionKey(null);
|
||||
lastKeyDownTimeStamp = 0;
|
||||
// Fixes an Android bug where selection flickers when backspacing
|
||||
@@ -2526,15 +2528,24 @@ function onBeforeInput(event, editor) {
|
||||
}
|
||||
selection.style = anchorNode.getStyle();
|
||||
}
|
||||
- const selectedText = selection.anchor.getNode().getTextContent();
|
||||
- if (selectedText.length <= 1) {
|
||||
+ const selectedNodeText = selection.anchor.getNode().getTextContent();
|
||||
+ const isSelectedNodeTextOneOrLessCharacters = selectedNodeText.length <= 1;
|
||||
+ const hasSelectedAllTextInNode = selection.anchor.offset === 0 && selection.focus.offset === selectedNodeText.length;
|
||||
+ if (isSelectedNodeTextOneOrLessCharacters || hasSelectedAllTextInNode) {
|
||||
event.preventDefault();
|
||||
dispatchCommand(editor, DELETE_CHARACTER_COMMAND, true);
|
||||
}
|
||||
} else {
|
||||
$setCompositionKey(null);
|
||||
event.preventDefault();
|
||||
- dispatchCommand(editor, DELETE_CHARACTER_COMMAND, true);
|
||||
+ // Chromium Android at the moment seems to ignore the preventDefault
|
||||
+ // on 'deleteContentBackward' and still deletes the content. Which leads
|
||||
+ // to multiple deletions, especially when handling replacement from keyboard
|
||||
+ // suggestions. So we let the browser handle the deletion in this case.
|
||||
+ const shouldLetBrowserHandleDelete = IS_ANDROID_CHROME && isSelectionAnchorSameAsFocus;
|
||||
+ if (!shouldLetBrowserHandleDelete) {
|
||||
+ dispatchCommand(editor, DELETE_CHARACTER_COMMAND, true);
|
||||
+ }
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -3575,6 +3586,9 @@ class LexicalNode {
|
||||
const visited = new Set();
|
||||
let node = this;
|
||||
while (true) {
|
||||
+ if (node === null) {
|
||||
+ break;
|
||||
+ }
|
||||
const key = node.__key;
|
||||
if (!visited.has(key)) {
|
||||
visited.add(key);
|
||||
@@ -3614,6 +3628,8 @@ class LexicalNode {
|
||||
if (parentSibling === null && !visited.has(ancestor.__key)) {
|
||||
nodes.push(ancestor);
|
||||
}
|
||||
+ } else {
|
||||
+ break;
|
||||
}
|
||||
} while (parentSibling === null);
|
||||
node = parentSibling;
|
||||
diff --git a/Lexical.prod.js b/Lexical.prod.js
|
||||
index 387fa75af19a8d926e3c1b2d38848387de041ec3..70fcd5fc9fb3e93e82803e7d52f563c056e8386f 100644
|
||||
--- a/Lexical.prod.js
|
||||
+++ b/Lexical.prod.js
|
||||
@@ -7,205 +7,205 @@
|
||||
'use strict';let ba={},ca={},da={},ea={},fa={},ka={},la={},ma={},oa={},pa={},qa={},ra={},sa={},ta={},ua={},va={},wa={},ya={},za={},Aa={},Ba={},Ca={},Da={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={},Na={},Oa={},Pa={},Qa={},Ra={},Sa={};
|
||||
function n(a){let b=new URLSearchParams;b.append("code",a);for(let c=1;c<arguments.length;c++)b.append("v",arguments[c]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${b} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
|
||||
let Ta="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Va=Ta&&"documentMode"in document?document.documentMode:null,t=Ta&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Wa=Ta&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Xa=Ta&&"InputEvent"in window&&!Va?"getTargetRanges"in new window.InputEvent("input"):!1,Ya=Ta&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Za=Ta&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
|
||||
-!window.MSStream,$a=Ta&&/Android/.test(navigator.userAgent),ab=Ta&&/^(?=.*Chrome).*/i.test(navigator.userAgent),bb=Ta&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ab,cb=Ya||Za||bb?"\u00a0":"\u200b",db=Wa?"\u00a0":cb,eb=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,fb=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,
|
||||
-gb={bold:1,code:16,highlight:128,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},hb={directionless:1,unmergeable:2},lb={center:2,end:6,justify:4,left:1,right:3,start:5},mb={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},nb={normal:0,segmented:2,token:1},ob={0:"normal",2:"segmented",1:"token"},pb=!1,qb=0;function rb(a){qb=a.timeStamp}function sb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}
|
||||
-function tb(a){return a.getEditorState().read(()=>{let b=u();return null!==b?b.clone():null})}
|
||||
-function ub(a,b,c){pb=!0;let d=100<performance.now()-qb;try{v(a,()=>{let e=u()||tb(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let m=!1,q="";for(var p=0;p<b.length;p++){var l=b[p],r=l.type,w=l.target,A=vb(w,h);if(!(null===A&&w!==g||y(A)))if("characterData"===r){if(l=d&&B(A))a:{l=e;r=w;var x=A;if(C(l)){var z=l.anchor.getNode();if(z.is(x)&&l.format!==z.getFormat()){l=!1;break a}}l=3===r.nodeType&&x.isAttached()}l&&(x=wb(a._window),r=l=null,null!==x&&x.anchorNode===
|
||||
-w&&(l=x.anchorOffset,r=x.focusOffset),w=w.nodeValue,null!==w&&xb(A,w,l,r,!1))}else if("childList"===r){m=!0;r=l.addedNodes;for(x=0;x<r.length;x++){z=r[x];var aa=yb(z),W=z.parentNode;null==W||z===k||null!==aa||"BR"===z.nodeName&&sb(z,W,a)||(Wa&&(aa=z.innerText||z.nodeValue)&&(q+=aa),W.removeChild(z))}l=l.removedNodes;r=l.length;if(0<r){x=0;for(z=0;z<r;z++)if(W=l[z],"BR"===W.nodeName&&sb(W,w,a)||k===W)w.appendChild(W),x++;r!==x&&(w===g&&(A=h._nodeMap.get("root")),f.set(w,A))}}}if(0<f.size)for(let [Ua,
|
||||
-ja]of f)if(E(ja))for(f=ja.getChildrenKeys(),g=Ua.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(Ua.appendChild(k),g=k):g!==k&&Ua.replaceChild(k,g),g=g.nextSibling);else B(ja)&&ja.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(k=f[g],h=k.addedNodes,k=k.target,p=0;p<h.length;p++)A=h[p],w=A.parentNode,null==w||"BR"!==A.nodeName||sb(A,k,a)||w.removeChild(A);c.takeRecords()}null!==e&&(m&&(e.dirty=!0,zb(e)),Wa&&Ab(a)&&e.insertRawText(q))})}finally{pb=
|
||||
-!1}}function Bb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();ub(a,c,b)}}function Cb(a){0===qb&&Db(a).addEventListener("textInput",rb,!0);a._observer=new MutationObserver((b,c)=>{ub(a,b,c)})}function Eb(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function Fb(a,b){let c=a.mergeWithSibling(b),d=F()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
|
||||
-function Gb(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&B(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{Eb(b,a)&&(a=Fb(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{Eb(a,c)&&Fb(a,c);break}}}function Hb(a){Ib(a.anchor);Ib(a.focus);return a}
|
||||
-function Ib(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!E(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let Jb=1,Kb="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};
|
||||
-function Rb(a){let b=document.activeElement;if(null===b)return!1;let c=b.nodeName;return y(vb(a))&&("INPUT"===c||"TEXTAREA"===c||"true"===b.contentEditable&&null==b.__lexicalEditor)}function Sb(a,b,c){let d=a.getRootElement();try{return null!==d&&d.contains(b)&&d.contains(c)&&null!==b&&!Rb(b)&&Tb(b)===a}catch(e){return!1}}function Tb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=Ub(a)}return null}function Vb(a){return a.isToken()||a.isSegmented()}
|
||||
-function Wb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Xb(a,b,c){let d=gb[b];if(null!==c&&(a&d)===(c&d))return a;a^=d;"subscript"===b?a&=~gb.superscript:"superscript"===b&&(a&=~gb.subscript);return a}function Yb(a,b){if(null!=b)a.__key=b;else{G();99<Zb&&n(14);b=F();var c=$b(),d=""+Jb++;c._nodeMap.set(d,a);E(a)?b._dirtyElements.set(d,!0):b._dirtyLeaves.add(d);b._cloneNotNeeded.add(d);b._dirtyType=1;a.__key=d}}
|
||||
-function ac(a){var b=a.getParent();if(null!==b){let e=a.getWritable();b=b.getWritable();var c=a.getPreviousSibling();a=a.getNextSibling();if(null===c)if(null!==a){var d=a.getWritable();b.__first=a.__key;d.__prev=null}else b.__first=null;else{d=c.getWritable();if(null!==a){let f=a.getWritable();f.__prev=d.__key;d.__next=f.__key}else d.__next=null;e.__prev=null}null===a?null!==c?(a=c.getWritable(),b.__last=c.__key,a.__next=null):b.__last=null:(a=a.getWritable(),null!==c?(c=c.getWritable(),c.__next=
|
||||
-a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}function bc(a){99<Zb&&n(14);var b=a.getLatest(),c=b.__parent,d=$b();let e=F(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;let g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;E(a)?d.set(b,!0):e._dirtyLeaves.add(b)}
|
||||
-function H(a){G();var b=F();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=I(c),null!==b&&b.getWritable()),null!==a&&(a=I(a),null!==a&&a.getWritable()))}function cc(){return dc()?null:F()._compositionKey}function I(a,b){a=(b||$b())._nodeMap.get(a);return void 0===a?null:a}function yb(a,b){let c=F();a=a[`__lexicalKey_${c._key}`];return void 0!==a?I(a,b):null}function vb(a,b){for(;null!=a;){let c=yb(a,b);if(null!==c)return c;a=Ub(a)}return null}
|
||||
-function ec(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function fc(a){return a.read(()=>J().getTextContent())}function gc(a,b){v(a,()=>{var c=$b();if(!c.isEmpty())if("root"===b)J().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function J(){return $b()._nodeMap.get("root")}function zb(a){G();let b=$b();null!==a&&(a.dirty=!0,a.setCachedNodes(null));b._selection=a}
|
||||
-function hc(a){var b=F(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=Ub(c)}c=null}return null===c?(b=b.getRootElement(),a===b?I("root"):null):I(c)}function ic(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function jc(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function kc(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
|
||||
-function lc(a,b,c){b=wb(b._window);if(null!==b){var d=b.anchorNode,{anchorOffset:e,focusOffset:f}=b;if(null!==d&&(b=3===d.nodeType?d.nodeValue:null,d=vb(d),null!==b&&B(d))){if(b===cb&&c){let g=c.length;b=c;f=e=g}null!==b&&xb(d,b,e,f,a)}}}
|
||||
-function xb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){let m=f.isComposing(),q=b;(m||e)&&b[b.length-1]===cb&&(q=b.slice(0,-1));b=f.getTextContent();if(e||q!==b)if(""===q)if(H(null),Ya||Za||bb)f.remove();else{let p=F();setTimeout(()=>{p.update(()=>{f.isAttached()&&f.remove()})},20)}else{e=f.getParent();b=mc();var g=f.getTextContentSize(),h=cc(),k=f.getKey();f.isToken()||null!==h&&k===h&&!m||C(b)&&(null!==e&&!e.canInsertTextBefore()&&0===b.anchor.offset||b.anchor.key===a.__key&&0===b.anchor.offset&&
|
||||
+!window.MSStream,$a=Ta&&/Android/.test(navigator.userAgent),ab=Ta&&/^(?=.*Chrome).*/i.test(navigator.userAgent),bb=$a&&ab,cb=Ta&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ab,db=Ya||Za||cb?"\u00a0":"\u200b",eb=Wa?"\u00a0":db,fb=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,gb=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,
|
||||
+hb={bold:1,code:16,highlight:128,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},lb={directionless:1,unmergeable:2},mb={center:2,end:6,justify:4,left:1,right:3,start:5},nb={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},ob={normal:0,segmented:2,token:1},pb={0:"normal",2:"segmented",1:"token"},qb=!1,rb=0;function sb(a){rb=a.timeStamp}function tb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}
|
||||
+function ub(a){return a.getEditorState().read(()=>{let b=u();return null!==b?b.clone():null})}
|
||||
+function vb(a,b,c){qb=!0;let d=100<performance.now()-rb;try{v(a,()=>{let e=u()||ub(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let m=!1,q="";for(var p=0;p<b.length;p++){var l=b[p],r=l.type,w=l.target,A=wb(w,h);if(!(null===A&&w!==g||y(A)))if("characterData"===r){if(l=d&&B(A))a:{l=e;r=w;var x=A;if(C(l)){var z=l.anchor.getNode();if(z.is(x)&&l.format!==z.getFormat()){l=!1;break a}}l=3===r.nodeType&&x.isAttached()}l&&(x=xb(a._window),r=l=null,null!==x&&x.anchorNode===
|
||||
+w&&(l=x.anchorOffset,r=x.focusOffset),w=w.nodeValue,null!==w&&yb(A,w,l,r,!1))}else if("childList"===r){m=!0;r=l.addedNodes;for(x=0;x<r.length;x++){z=r[x];var aa=zb(z),W=z.parentNode;null==W||z===k||null!==aa||"BR"===z.nodeName&&tb(z,W,a)||(Wa&&(aa=z.innerText||z.nodeValue)&&(q+=aa),W.removeChild(z))}l=l.removedNodes;r=l.length;if(0<r){x=0;for(z=0;z<r;z++)if(W=l[z],"BR"===W.nodeName&&tb(W,w,a)||k===W)w.appendChild(W),x++;r!==x&&(w===g&&(A=h._nodeMap.get("root")),f.set(w,A))}}}if(0<f.size)for(let [Ua,
|
||||
+ja]of f)if(E(ja))for(f=ja.getChildrenKeys(),g=Ua.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(Ua.appendChild(k),g=k):g!==k&&Ua.replaceChild(k,g),g=g.nextSibling);else B(ja)&&ja.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(k=f[g],h=k.addedNodes,k=k.target,p=0;p<h.length;p++)A=h[p],w=A.parentNode,null==w||"BR"!==A.nodeName||tb(A,k,a)||w.removeChild(A);c.takeRecords()}null!==e&&(m&&(e.dirty=!0,Ab(e)),Wa&&Bb(a)&&e.insertRawText(q))})}finally{qb=
|
||||
+!1}}function Cb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();vb(a,c,b)}}function Db(a){0===rb&&Eb(a).addEventListener("textInput",sb,!0);a._observer=new MutationObserver((b,c)=>{vb(a,b,c)})}function Fb(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function Gb(a,b){let c=a.mergeWithSibling(b),d=F()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
|
||||
+function Hb(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&B(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{Fb(b,a)&&(a=Gb(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{Fb(a,c)&&Gb(a,c);break}}}function Ib(a){Jb(a.anchor);Jb(a.focus);return a}
|
||||
+function Jb(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!E(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let Kb=1,Rb="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};
|
||||
+function Sb(a){let b=document.activeElement;if(null===b)return!1;let c=b.nodeName;return y(wb(a))&&("INPUT"===c||"TEXTAREA"===c||"true"===b.contentEditable&&null==b.__lexicalEditor)}function Tb(a,b,c){let d=a.getRootElement();try{return null!==d&&d.contains(b)&&d.contains(c)&&null!==b&&!Sb(b)&&Ub(b)===a}catch(e){return!1}}function Ub(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=Vb(a)}return null}function Wb(a){return a.isToken()||a.isSegmented()}
|
||||
+function Xb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Yb(a,b,c){let d=hb[b];if(null!==c&&(a&d)===(c&d))return a;a^=d;"subscript"===b?a&=~hb.superscript:"superscript"===b&&(a&=~hb.subscript);return a}function Zb(a,b){if(null!=b)a.__key=b;else{G();99<$b&&n(14);b=F();var c=ac(),d=""+Kb++;c._nodeMap.set(d,a);E(a)?b._dirtyElements.set(d,!0):b._dirtyLeaves.add(d);b._cloneNotNeeded.add(d);b._dirtyType=1;a.__key=d}}
|
||||
+function bc(a){var b=a.getParent();if(null!==b){let e=a.getWritable();b=b.getWritable();var c=a.getPreviousSibling();a=a.getNextSibling();if(null===c)if(null!==a){var d=a.getWritable();b.__first=a.__key;d.__prev=null}else b.__first=null;else{d=c.getWritable();if(null!==a){let f=a.getWritable();f.__prev=d.__key;d.__next=f.__key}else d.__next=null;e.__prev=null}null===a?null!==c?(a=c.getWritable(),b.__last=c.__key,a.__next=null):b.__last=null:(a=a.getWritable(),null!==c?(c=c.getWritable(),c.__next=
|
||||
+a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}function cc(a){99<$b&&n(14);var b=a.getLatest(),c=b.__parent,d=ac();let e=F(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;let g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;E(a)?d.set(b,!0):e._dirtyLeaves.add(b)}
|
||||
+function H(a){G();var b=F();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=I(c),null!==b&&b.getWritable()),null!==a&&(a=I(a),null!==a&&a.getWritable()))}function dc(){return ec()?null:F()._compositionKey}function I(a,b){a=(b||ac())._nodeMap.get(a);return void 0===a?null:a}function zb(a,b){let c=F();a=a[`__lexicalKey_${c._key}`];return void 0!==a?I(a,b):null}function wb(a,b){for(;null!=a;){let c=zb(a,b);if(null!==c)return c;a=Vb(a)}return null}
|
||||
+function fc(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function gc(a){return a.read(()=>J().getTextContent())}function hc(a,b){v(a,()=>{var c=ac();if(!c.isEmpty())if("root"===b)J().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function J(){return ac()._nodeMap.get("root")}function Ab(a){G();let b=ac();null!==a&&(a.dirty=!0,a.setCachedNodes(null));b._selection=a}
|
||||
+function ic(a){var b=F(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=Vb(c)}c=null}return null===c?(b=b.getRootElement(),a===b?I("root"):null):I(c)}function jc(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function kc(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function lc(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
|
||||
+function mc(a,b,c){b=xb(b._window);if(null!==b){var d=b.anchorNode,{anchorOffset:e,focusOffset:f}=b;if(null!==d&&(b=3===d.nodeType?d.nodeValue:null,d=wb(d),null!==b&&B(d))){if(b===db&&c){let g=c.length;b=c;f=e=g}null!==b&&yb(d,b,e,f,a)}}}
|
||||
+function yb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){let m=f.isComposing(),q=b;(m||e)&&b[b.length-1]===db&&(q=b.slice(0,-1));b=f.getTextContent();if(e||q!==b)if(""===q)if(H(null),Ya||Za||cb)f.remove();else{let p=F();setTimeout(()=>{p.update(()=>{f.isAttached()&&f.remove()})},20)}else{e=f.getParent();b=nc();var g=f.getTextContentSize(),h=dc(),k=f.getKey();f.isToken()||null!==h&&k===h&&!m||C(b)&&(null!==e&&!e.canInsertTextBefore()&&0===b.anchor.offset||b.anchor.key===a.__key&&0===b.anchor.offset&&
|
||||
!f.canInsertTextBefore()&&!m||b.focus.key===a.__key&&b.focus.offset===g&&!f.canInsertTextAfter()&&!m)?f.markDirty():(a=u(),C(a)&&null!==c&&null!==d&&(a.setTextNodeRange(f,c,f,d),f.isSegmented()&&(c=f.getTextContent(),c=K(c),f.replace(c),f=c)),f.setTextContent(q))}}}
|
||||
-function nc(a,b){if(b.isSegmented())return!0;if(!a.isCollapsed())return!1;a=a.anchor.offset;let c=b.getParentOrThrow(),d=b.isToken();return 0===a?((a=!b.canInsertTextBefore()||!c.canInsertTextBefore()||d)||(b=b.getPreviousSibling(),a=(B(b)||E(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()||d:!1}
|
||||
-function oc(a,b){void 0===a.__lexicalClassNameCache&&(a.__lexicalClassNameCache={});let c=a.__lexicalClassNameCache,d=c[b];if(void 0!==d)return d;a=a[b];return"string"===typeof a?(a=a.split(" "),c[b]=a):a}function pc(a,b,c,d,e){0!==c.size&&(c=d.__type,d=d.__key,b=b.get(c),void 0===b&&n(33,c),c=b.klass,b=a.get(c),void 0===b&&(b=new Map,a.set(c,b)),a=b.get(d),c="destroyed"===a&&"created"===e,(void 0===a||c)&&b.set(d,c?"updated":e))}
|
||||
-function qc(a,b,c){let d=a.getParent(),e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}function rc(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),qc(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?qc(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}
|
||||
-function Ab(a){a=(a=Db(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function sc(a){return!L(a)&&!a.isLastChild()&&!a.isInline()}function tc(a,b){a=a._keyToDOMMap.get(b);void 0===a&&n(75,b);return a}function Ub(a){a=a.assignedSlot||a.parentElement;return null!==a&&11===a.nodeType?a.host:a}function uc(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function Db(a){a=a._window;null===a&&n(78);return a}
|
||||
-function vc(a){for(a=a.getParentOrThrow();null!==a&&!wc(a);)a=a.getParentOrThrow();return a}function wc(a){return L(a)||E(a)&&a.isShadowRoot()}function xc(a){a=a.constructor.clone(a);Yb(a,null);return a}function yc(a){var b=F();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&n(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||n(98),b):a}function zc(a,b){a=a.getParent();!L(a)||E(b)||y(b)||n(99)}function Ac(a){return(y(a)||E(a)&&!a.canBeEmpty())&&!a.isInline()}
|
||||
-function Bc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}function wb(a){return Ta?(a||window).getSelection():null}function Cc(a){return 1===a.nodeType}function Dc(a){if(y(a)&&!a.isInline())return!0;if(!E(a)||wc(a))return!1;var b=a.getFirstChild();b=null===b||Ec(b)||B(b)||b.isInline();return!a.isInline()&&!1!==a.canBeEmpty()&&b}
|
||||
-function Fc(a,b){for(;null!==a&&null!==a.getParent()&&!b(a);)a=a.getParentOrThrow();return b(a)?a:null}function Gc(a,b,c,d,e,f){for(a=a.getFirstChild();null!==a;){let g=a.__key;a.__parent===b&&(E(a)&&Gc(a,g,c,d,e,f),c.has(g)||f.delete(g),e.push(g));a=a.getNextSibling()}}
|
||||
-function Hc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;let e=[];for(let [f]of d){let g=b.get(f);void 0===g||g.isAttached()||(E(g)&&Gc(g,f,a,b,e,d),a.has(f)||d.delete(f),e.push(f))}for(let f of e)b.delete(f);for(let f of c)d=b.get(f),void 0===d||d.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}let M="",N="",Ic="",Jc,O,Kc,Lc=!1,Mc=!1,Nc,Oc=null,Pc,Zc,$c,ad,bd,cd;
|
||||
-function dd(a,b){let c=$c.get(a);if(null!==b){let d=ed(a);d.parentNode===b&&b.removeChild(d)}ad.has(a)||O._keyToDOMMap.delete(a);E(c)&&(a=fd(c,$c),gd(a,0,a.length-1,null));void 0!==c&&pc(cd,Kc,Nc,c,"destroyed")}function gd(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&dd(e,d)}}function hd(a,b){a.setProperty("text-align",b)}
|
||||
-function id(a,b){var c=Jc.theme.indent;if("string"===typeof c){let d=a.classList.contains(c);0<b&&!d?a.classList.add(c):1>b&&d&&a.classList.remove(c)}c=getComputedStyle(a).getPropertyValue("--lexical-indent-base-value")||"40px";a.style.setProperty("padding-inline-start",0===b?"":`calc(${b} * ${c})`)}function jd(a,b){a=a.style;0===b?hd(a,""):1===b?hd(a,"left"):2===b?hd(a,"center"):3===b?hd(a,"right"):4===b?hd(a,"justify"):5===b?hd(a,"start"):6===b&&hd(a,"end")}
|
||||
-function kd(a,b,c){let d=ad.get(a);void 0===d&&n(60);let e=d.createDOM(Jc,O);var f=O._keyToDOMMap;e["__lexicalKey_"+O._key]=a;f.set(a,e);B(d)?e.setAttribute("data-lexical-text","true"):y(d)&&e.setAttribute("data-lexical-decorator","true");if(E(d)){a=d.__indent;f=d.__size;0!==a&&id(e,a);if(0!==f){--f;a=fd(d,ad);var g=N;N="";ld(a,d,0,f,e,null);md(d,e);N=g}a=d.__format;0!==a&&jd(e,a);d.isInline()||nd(null,d,e);sc(d)&&(M+="\n\n",Ic+="\n\n")}else f=d.getTextContent(),y(d)?(g=d.decorate(O,Jc),null!==g&&
|
||||
-od(a,g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(N+=f)),M+=f,Ic+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));pc(cd,Kc,Nc,d,"created");return e}function ld(a,b,c,d,e,f){let g=M;for(M="";c<=d;++c)kd(a[c],e,f);sc(b)&&(M+="\n\n");e.__lexicalTextContent=M;M=g+M}function pd(a,b){a=b.get(a);return Ec(a)||y(a)&&a.isInline()}
|
||||
-function nd(a,b,c){a=null!==a&&(0===a.__size||pd(a.__last,$c));b=0===b.__size||pd(b.__last,ad);a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
|
||||
-function md(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==N||c!==Oc){let f=""===N;if(f)var d=Oc;else d=N,d=eb.test(d)?"rtl":fb.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=Jc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=e.split(" "),e=h[c]=e),g.remove(...e));null===d||f&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=k.split(" "),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);Mc||(a.getWritable().__dir=d)}Oc=
|
||||
-d;b.__lexicalDirTextContent=N;b.__lexicalDir=d}}function fd(a,b){let c=[];for(a=a.__first;null!==a;){let d=b.get(a);void 0===d&&n(101);c.push(a);a=d.__next}return c}
|
||||
-function qd(a,b){var c=$c.get(a),d=ad.get(a);void 0!==c&&void 0!==d||n(61);var e=Lc||Zc.has(a)||Pc.has(a);let f=tc(O,a);if(c===d&&!e)return E(c)?(d=f.__lexicalTextContent,void 0!==d&&(M+=d,Ic+=d),d=f.__lexicalDirTextContent,void 0!==d&&(N+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(N+=d),Ic+=d,M+=d),f;c!==d&&e&&pc(cd,Kc,Nc,d,"updated");if(d.updateDOM(c,f,Jc))return d=kd(a,null,null),null===b&&n(62),b.replaceChild(d,f),dd(a,null),d;if(E(c)&&E(d)){a=d.__indent;a!==c.__indent&&id(f,a);a=
|
||||
-d.__format;a!==c.__format&&jd(f,a);if(e){a=N;N="";e=M;var g=c.__size,h=d.__size;M="";if(1===g&&1===h){var k=c.__first;b=d.__first;if(k===b)qd(k,f);else{var m=ed(k);b=kd(b,null,null);f.replaceChild(b,m);dd(k,null)}}else{b=fd(c,$c);var q=fd(d,ad);if(0===g)0!==h&&ld(q,d,0,h-1,f,null);else if(0===h)0!==g&&(k=null==f.__lexicalLineBreak,gd(b,0,g-1,k?null:f),k&&(f.textContent=""));else{var p=b;b=q;q=g-1;g=h-1;let r=f.firstChild,w=0;for(h=0;w<=q&&h<=g;){var l=p[w];let A=b[h];if(l===A)r=rd(qd(A,f)),w++,h++;
|
||||
-else{void 0===k&&(k=new Set(p));void 0===m&&(m=new Set(b));let x=m.has(l),z=k.has(A);x?(z?(l=tc(O,A),l===r?r=rd(qd(A,f)):(null!=r?f.insertBefore(l,r):f.appendChild(l),qd(A,f)),w++):kd(A,f,r),h++):(r=rd(ed(l)),dd(l,f),w++)}}k=w>q;m=h>g;k&&!m?(k=b[g+1],k=void 0===k?null:O.getElementByKey(k),ld(b,d,h,g,f,k)):m&&!k&&gd(p,w,q,f)}}sc(d)&&(M+="\n\n");f.__lexicalTextContent=M;M=e+M;md(d,f);N=a;L(d)||d.isInline()||nd(c,d,f)}sc(d)&&(M+="\n\n",Ic+="\n\n")}else c=d.getTextContent(),y(d)?(e=d.decorate(O,Jc),null!==
|
||||
-e&&od(a,e)):B(d)&&!d.isDirectionless()&&(N+=c),M+=c,Ic+=c;!Mc&&L(d)&&d.__cachedText!==Ic&&(d.getWritable().__cachedText=Ic);return f}function od(a,b){let c=O._pendingDecorators,d=O._decorators;if(null===c){if(d[a]===b)return;c=ec(O)}c[a]=b}function rd(a){a=a.nextSibling;null!==a&&a===O._blockCursorElement&&(a=a.nextSibling);return a}function ed(a){let b=bd.get(a);void 0===b&&n(75,a);return b}
|
||||
-let sd=Object.freeze({}),zd=[["keydown",td],["pointerdown",ud],["compositionstart",vd],["compositionend",wd],["input",xd],["click",yd],["cut",sd],["copy",sd],["dragstart",sd],["dragover",sd],["dragend",sd],["paste",sd],["focus",sd],["blur",sd],["drop",sd]];Xa&&zd.push(["beforeinput",(a,b)=>Ad(a,b)]);let Bd=0,Cd=0,Dd=0,Ed=null,Fd=0,Gd=!1,Hd=!1,Id=!1,Jd=!1,Kd=[0,"",0,"root",0];
|
||||
-function Ld(a,b,c,d,e){let f=a.anchor,g=a.focus,h=f.getNode();var k=F();let m=wb(k._window),q=null!==m?m.anchorNode:null,p=f.key;k=k.getElementByKey(p);let l=c.length;return p!==g.key||!B(h)||(!e&&(!Xa||Dd<d+50)||h.isDirty()&&2>l||ic(c))&&f.offset!==g.offset&&!h.isComposing()||Vb(h)||h.isDirty()&&1<l||(e||!Xa)&&null!==k&&!h.isComposing()&&q!==Wb(k)||null!==m&&null!==b&&(!b.collapsed||b.startContainer!==m.anchorNode||b.startOffset!==m.anchorOffset)||h.getFormat()!==a.format||h.getStyle()!==a.style||
|
||||
-nc(a,h)}function Md(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
|
||||
-function Nd(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(Gd&&(Gd=!1,Md(d,e)&&Md(f,g)))return;v(b,()=>{if(!c)zb(null);else if(Sb(b,d,f)){var h=u();if(C(h)){var k=h.anchor,m=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var q=Db(b).event;q=q?q.timeStamp:performance.now();let [A,x,z,aa,W]=Kd;var p=J();p=!1===b.isComposing()&&""===p.getTextContent();q<W+200&&k.offset===z&&k.key===aa?(h.format=A,h.style=x):"text"===k.type?(B(m)||n(141),
|
||||
+function oc(a,b){if(b.isSegmented())return!0;if(!a.isCollapsed())return!1;a=a.anchor.offset;let c=b.getParentOrThrow(),d=b.isToken();return 0===a?((a=!b.canInsertTextBefore()||!c.canInsertTextBefore()||d)||(b=b.getPreviousSibling(),a=(B(b)||E(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()||d:!1}
|
||||
+function pc(a,b){void 0===a.__lexicalClassNameCache&&(a.__lexicalClassNameCache={});let c=a.__lexicalClassNameCache,d=c[b];if(void 0!==d)return d;a=a[b];return"string"===typeof a?(a=a.split(" "),c[b]=a):a}function qc(a,b,c,d,e){0!==c.size&&(c=d.__type,d=d.__key,b=b.get(c),void 0===b&&n(33,c),c=b.klass,b=a.get(c),void 0===b&&(b=new Map,a.set(c,b)),a=b.get(d),c="destroyed"===a&&"created"===e,(void 0===a||c)&&b.set(d,c?"updated":e))}
|
||||
+function rc(a,b,c){let d=a.getParent(),e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}function sc(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),rc(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?rc(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}
|
||||
+function Bb(a){a=(a=Eb(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function tc(a){return!L(a)&&!a.isLastChild()&&!a.isInline()}function uc(a,b){a=a._keyToDOMMap.get(b);void 0===a&&n(75,b);return a}function Vb(a){a=a.assignedSlot||a.parentElement;return null!==a&&11===a.nodeType?a.host:a}function vc(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function Eb(a){a=a._window;null===a&&n(78);return a}
|
||||
+function wc(a){for(a=a.getParentOrThrow();null!==a&&!xc(a);)a=a.getParentOrThrow();return a}function xc(a){return L(a)||E(a)&&a.isShadowRoot()}function yc(a){a=a.constructor.clone(a);Zb(a,null);return a}function zc(a){var b=F();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&n(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||n(98),b):a}function Ac(a,b){a=a.getParent();!L(a)||E(b)||y(b)||n(99)}function Bc(a){return(y(a)||E(a)&&!a.canBeEmpty())&&!a.isInline()}
|
||||
+function Cc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}function xb(a){return Ta?(a||window).getSelection():null}function Dc(a){return 1===a.nodeType}function Ec(a){if(y(a)&&!a.isInline())return!0;if(!E(a)||xc(a))return!1;var b=a.getFirstChild();b=null===b||Fc(b)||B(b)||b.isInline();return!a.isInline()&&!1!==a.canBeEmpty()&&b}
|
||||
+function Gc(a,b){for(;null!==a&&null!==a.getParent()&&!b(a);)a=a.getParentOrThrow();return b(a)?a:null}function Hc(a,b,c,d,e,f){for(a=a.getFirstChild();null!==a;){let g=a.__key;a.__parent===b&&(E(a)&&Hc(a,g,c,d,e,f),c.has(g)||f.delete(g),e.push(g));a=a.getNextSibling()}}
|
||||
+function Ic(a,b,c,d){a=a._nodeMap;b=b._nodeMap;let e=[];for(let [f]of d){let g=b.get(f);void 0===g||g.isAttached()||(E(g)&&Hc(g,f,a,b,e,d),a.has(f)||d.delete(f),e.push(f))}for(let f of e)b.delete(f);for(let f of c)d=b.get(f),void 0===d||d.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}let M="",N="",Jc="",Kc,O,Lc,Mc=!1,Nc=!1,Oc,Pc=null,Zc,$c,ad,bd,cd,dd;
|
||||
+function ed(a,b){let c=ad.get(a);if(null!==b){let d=fd(a);d.parentNode===b&&b.removeChild(d)}bd.has(a)||O._keyToDOMMap.delete(a);E(c)&&(a=gd(c,ad),hd(a,0,a.length-1,null));void 0!==c&&qc(dd,Lc,Oc,c,"destroyed")}function hd(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&ed(e,d)}}function id(a,b){a.setProperty("text-align",b)}
|
||||
+function jd(a,b){var c=Kc.theme.indent;if("string"===typeof c){let d=a.classList.contains(c);0<b&&!d?a.classList.add(c):1>b&&d&&a.classList.remove(c)}c=getComputedStyle(a).getPropertyValue("--lexical-indent-base-value")||"40px";a.style.setProperty("padding-inline-start",0===b?"":`calc(${b} * ${c})`)}function kd(a,b){a=a.style;0===b?id(a,""):1===b?id(a,"left"):2===b?id(a,"center"):3===b?id(a,"right"):4===b?id(a,"justify"):5===b?id(a,"start"):6===b&&id(a,"end")}
|
||||
+function ld(a,b,c){let d=bd.get(a);void 0===d&&n(60);let e=d.createDOM(Kc,O);var f=O._keyToDOMMap;e["__lexicalKey_"+O._key]=a;f.set(a,e);B(d)?e.setAttribute("data-lexical-text","true"):y(d)&&e.setAttribute("data-lexical-decorator","true");if(E(d)){a=d.__indent;f=d.__size;0!==a&&jd(e,a);if(0!==f){--f;a=gd(d,bd);var g=N;N="";md(a,d,0,f,e,null);nd(d,e);N=g}a=d.__format;0!==a&&kd(e,a);d.isInline()||od(null,d,e);tc(d)&&(M+="\n\n",Jc+="\n\n")}else f=d.getTextContent(),y(d)?(g=d.decorate(O,Kc),null!==g&&
|
||||
+pd(a,g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(N+=f)),M+=f,Jc+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));qc(dd,Lc,Oc,d,"created");return e}function md(a,b,c,d,e,f){let g=M;for(M="";c<=d;++c)ld(a[c],e,f);tc(b)&&(M+="\n\n");e.__lexicalTextContent=M;M=g+M}function qd(a,b){a=b.get(a);return Fc(a)||y(a)&&a.isInline()}
|
||||
+function od(a,b,c){a=null!==a&&(0===a.__size||qd(a.__last,ad));b=0===b.__size||qd(b.__last,bd);a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
|
||||
+function nd(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==N||c!==Pc){let f=""===N;if(f)var d=Pc;else d=N,d=fb.test(d)?"rtl":gb.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=Kc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=e.split(" "),e=h[c]=e),g.remove(...e));null===d||f&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=k.split(" "),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);Nc||(a.getWritable().__dir=d)}Pc=
|
||||
+d;b.__lexicalDirTextContent=N;b.__lexicalDir=d}}function gd(a,b){let c=[];for(a=a.__first;null!==a;){let d=b.get(a);void 0===d&&n(101);c.push(a);a=d.__next}return c}
|
||||
+function rd(a,b){var c=ad.get(a),d=bd.get(a);void 0!==c&&void 0!==d||n(61);var e=Mc||$c.has(a)||Zc.has(a);let f=uc(O,a);if(c===d&&!e)return E(c)?(d=f.__lexicalTextContent,void 0!==d&&(M+=d,Jc+=d),d=f.__lexicalDirTextContent,void 0!==d&&(N+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(N+=d),Jc+=d,M+=d),f;c!==d&&e&&qc(dd,Lc,Oc,d,"updated");if(d.updateDOM(c,f,Kc))return d=ld(a,null,null),null===b&&n(62),b.replaceChild(d,f),ed(a,null),d;if(E(c)&&E(d)){a=d.__indent;a!==c.__indent&&jd(f,a);a=
|
||||
+d.__format;a!==c.__format&&kd(f,a);if(e){a=N;N="";e=M;var g=c.__size,h=d.__size;M="";if(1===g&&1===h){var k=c.__first;b=d.__first;if(k===b)rd(k,f);else{var m=fd(k);b=ld(b,null,null);f.replaceChild(b,m);ed(k,null)}}else{b=gd(c,ad);var q=gd(d,bd);if(0===g)0!==h&&md(q,d,0,h-1,f,null);else if(0===h)0!==g&&(k=null==f.__lexicalLineBreak,hd(b,0,g-1,k?null:f),k&&(f.textContent=""));else{var p=b;b=q;q=g-1;g=h-1;let r=f.firstChild,w=0;for(h=0;w<=q&&h<=g;){var l=p[w];let A=b[h];if(l===A)r=sd(rd(A,f)),w++,h++;
|
||||
+else{void 0===k&&(k=new Set(p));void 0===m&&(m=new Set(b));let x=m.has(l),z=k.has(A);x?(z?(l=uc(O,A),l===r?r=sd(rd(A,f)):(null!=r?f.insertBefore(l,r):f.appendChild(l),rd(A,f)),w++):ld(A,f,r),h++):(r=sd(fd(l)),ed(l,f),w++)}}k=w>q;m=h>g;k&&!m?(k=b[g+1],k=void 0===k?null:O.getElementByKey(k),md(b,d,h,g,f,k)):m&&!k&&hd(p,w,q,f)}}tc(d)&&(M+="\n\n");f.__lexicalTextContent=M;M=e+M;nd(d,f);N=a;L(d)||d.isInline()||od(c,d,f)}tc(d)&&(M+="\n\n",Jc+="\n\n")}else c=d.getTextContent(),y(d)?(e=d.decorate(O,Kc),null!==
|
||||
+e&&pd(a,e)):B(d)&&!d.isDirectionless()&&(N+=c),M+=c,Jc+=c;!Nc&&L(d)&&d.__cachedText!==Jc&&(d.getWritable().__cachedText=Jc);return f}function pd(a,b){let c=O._pendingDecorators,d=O._decorators;if(null===c){if(d[a]===b)return;c=fc(O)}c[a]=b}function sd(a){a=a.nextSibling;null!==a&&a===O._blockCursorElement&&(a=a.nextSibling);return a}function fd(a){let b=cd.get(a);void 0===b&&n(75,a);return b}
|
||||
+let td=Object.freeze({}),Ad=[["keydown",ud],["pointerdown",vd],["compositionstart",wd],["compositionend",xd],["input",yd],["click",zd],["cut",td],["copy",td],["dragstart",td],["dragover",td],["dragend",td],["paste",td],["focus",td],["blur",td],["drop",td]];Xa&&Ad.push(["beforeinput",(a,b)=>Bd(a,b)]);let Cd=0,Dd=0,Ed=0,Fd=null,Gd=0,Hd=!1,Id=!1,Jd=!1,Kd=!1,Ld=[0,"",0,"root",0];
|
||||
+function Md(a,b,c,d,e){let f=a.anchor,g=a.focus,h=f.getNode();var k=F();let m=xb(k._window),q=null!==m?m.anchorNode:null,p=f.key;k=k.getElementByKey(p);let l=c.length;return p!==g.key||!B(h)||(!e&&(!Xa||Ed<d+50)||h.isDirty()&&2>l||jc(c))&&f.offset!==g.offset&&!h.isComposing()||Wb(h)||h.isDirty()&&1<l||(e||!Xa)&&null!==k&&!h.isComposing()&&q!==Xb(k)||null!==m&&null!==b&&(!b.collapsed||b.startContainer!==m.anchorNode||b.startOffset!==m.anchorOffset)||h.getFormat()!==a.format||h.getStyle()!==a.style||
|
||||
+oc(a,h)}function Nd(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
|
||||
+function Od(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(Hd&&(Hd=!1,Nd(d,e)&&Nd(f,g)))return;v(b,()=>{if(!c)Ab(null);else if(Tb(b,d,f)){var h=u();if(C(h)){var k=h.anchor,m=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var q=Eb(b).event;q=q?q.timeStamp:performance.now();let [A,x,z,aa,W]=Ld;var p=J();p=!1===b.isComposing()&&""===p.getTextContent();q<W+200&&k.offset===z&&k.key===aa?(h.format=A,h.style=x):"text"===k.type?(B(m)||n(141),
|
||||
h.format=m.getFormat(),h.style=m.getStyle()):"element"!==k.type||p||(h.format=0,h.style="")}else{var l=k.key,r=h.focus.key;k=h.getNodes();m=k.length;var w=h.isBackward();q=w?g:e;p=w?e:g;let A=w?r:l;l=w?l:r;r=255;w=!1;for(let x=0;x<m;x++){let z=k[x],aa=z.getTextContentSize();if(B(z)&&0!==aa&&!(0===x&&z.__key===A&&q===aa||x===m-1&&z.__key===l&&0===p)&&(w=!0,r&=z.getFormat(),0===r))break}h.format=w?r:0}}R(b,ba,void 0)}})}
|
||||
-function yd(a,b){v(b,()=>{let c=u();var d=wb(b._window);let e=mc();if(d)if(C(c)){let g=c.anchor;var f=g.getNode();"element"===g.type&&0===g.offset&&c.isCollapsed()&&!L(f)&&1===J().getChildrenSize()&&f.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)?(d.removeAllRanges(),c.dirty=!0):3!==a.detail||c.isCollapsed()||(d=c.focus.getNode(),f!==d&&(E(f)?f.select(0):f.getParentOrThrow().select(0)))}else"touch"===a.pointerType&&(f=d.anchorNode,null!==f&&(f=f.nodeType,1===f||3===f))&&(d=Od(e,d,b,a),
|
||||
-zb(d));R(b,ca,a)})}function ud(a,b){let c=a.target;a=a.pointerType;c instanceof Node&&"touch"!==a&&v(b,()=>{y(vb(c))||(Hd=!0)})}function Pd(a){if(!a.getTargetRanges)return null;a=a.getTargetRanges();return 0===a.length?null:a[0]}function Qd(a,b){return a!==b||E(a)||E(b)||!a.isToken()||!b.isToken()}
|
||||
-function Ad(a,b){let c=a.inputType,d=Pd(a);"deleteCompositionText"===c||Wa&&Ab(b)||"insertCompositionText"!==c&&v(b,()=>{let e=u();if("deleteContentBackward"===c){if(null===e){var f=mc();if(!C(f))return;zb(f.clone())}if(C(e)){$a&&H(e.anchor.key);229===Cd&&a.timeStamp<Bd+30&&b.isComposing()&&e.anchor.key===e.focus.key?(H(null),Bd=0,setTimeout(()=>{v(b,()=>{H(null)})},30),C(e)&&(f=e.anchor.getNode(),f.markDirty(),e.format=f.getFormat(),B(f)||n(142),e.style=f.getStyle()),1>=e.anchor.getNode().getTextContent().length&&
|
||||
-(a.preventDefault(),R(b,da,!0))):(H(null),a.preventDefault(),R(b,da,!0));return}}if(C(e)){f=a.data;null!==Ed&&lc(!1,b,Ed);e.dirty&&null===Ed||!e.isCollapsed()||L(e.anchor.getNode())||null===d||e.applyDOMRange(d);Ed=null;var g=e.focus,h=e.anchor.getNode();g=g.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===f?(a.preventDefault(),R(b,ea,!1)):"\n\n"===f?(a.preventDefault(),R(b,fa,void 0)):null==f&&a.dataTransfer?(f=a.dataTransfer.getData("text/plain"),a.preventDefault(),e.insertRawText(f)):
|
||||
-null!=f&&Ld(e,d,f,a.timeStamp,!0)?(a.preventDefault(),R(b,ka,f)):Ed=f,Dd=a.timeStamp;else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":R(b,ka,a);break;case "insertFromComposition":H(null);R(b,ka,a);break;case "insertLineBreak":H(null);R(b,ea,!1);break;case "insertParagraph":H(null);Id&&!Za?(Id=!1,R(b,ea,!1)):R(b,fa,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":R(b,la,a);break;case "deleteByComposition":Qd(h,g)&&R(b,
|
||||
-ma,a);break;case "deleteByDrag":case "deleteByCut":R(b,ma,a);break;case "deleteContent":R(b,da,!1);break;case "deleteWordBackward":R(b,oa,!0);break;case "deleteWordForward":R(b,oa,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":R(b,pa,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":R(b,pa,!1);break;case "formatStrikeThrough":R(b,qa,"strikethrough");break;case "formatBold":R(b,qa,"bold");break;case "formatItalic":R(b,qa,"italic");
|
||||
-break;case "formatUnderline":R(b,qa,"underline");break;case "historyUndo":R(b,ra,void 0);break;case "historyRedo":R(b,sa,void 0)}}})}
|
||||
-function xd(a,b){a.stopPropagation();v(b,()=>{var c=u(),d=a.data,e=Pd(a);if(null!=d&&C(c)&&Ld(c,e,d,a.timeStamp,!1)){Jd&&(Rd(b,d),Jd=!1);var f=c.anchor,g=f.getNode();e=wb(b._window);if(null===e)return;let h=f.offset;if(f=Xa&&!c.isCollapsed()&&B(g)&&null!==e.anchorNode)g=g.getTextContent().slice(0,h)+d+g.getTextContent().slice(h+c.focus.offset),e=e.anchorNode,f=g===(3===e.nodeType?e.nodeValue:null);f||R(b,ka,d);d=d.length;Wa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=
|
||||
-d);Ya||Za||bb||!b.isComposing()||(Bd=0,H(null))}else lc(!1,b,null!==d?d:void 0),Jd&&(Rd(b,d||void 0),Jd=!1);G();c=F();Bb(c)});Ed=null}function vd(a,b){v(b,()=>{let c=u();if(C(c)&&!b.isComposing()){let d=c.anchor,e=c.anchor.getNode();H(d.key);(a.timeStamp<Bd+30||"element"===d.type||!c.isCollapsed()||e.getFormat()!==c.format||B(e)&&e.getStyle()!==c.style)&&R(b,ka,db)}})}
|
||||
-function Rd(a,b){var c=a._compositionKey;H(null);if(null!==c&&null!=b){if(""===b){b=I(c);a=Wb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&xb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=u(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);R(a,Ba,null);return}}lc(!0,a,b)}function wd(a,b){Wa?Jd=!0:v(b,()=>{Rd(b,a.data)})}
|
||||
-function td(a,b){Bd=a.timeStamp;Cd=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(!R(b,ta,a)){if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)Id=!0,R(b,Ba,a);else if(32===c)R(b,Ca,a);else if(t&&e&&79===c)a.preventDefault(),Id=!0,R(b,ea,!0);else if(13!==c||d){var h=t?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?R(b,Da,a):(a.preventDefault(),R(b,da,!0)):27===c?R(b,Ga,
|
||||
+function zd(a,b){v(b,()=>{let c=u();var d=xb(b._window);let e=nc();if(d)if(C(c)){let g=c.anchor;var f=g.getNode();"element"===g.type&&0===g.offset&&c.isCollapsed()&&!L(f)&&1===J().getChildrenSize()&&f.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)?(d.removeAllRanges(),c.dirty=!0):3!==a.detail||c.isCollapsed()||(d=c.focus.getNode(),f!==d&&(E(f)?f.select(0):f.getParentOrThrow().select(0)))}else"touch"===a.pointerType&&(f=d.anchorNode,null!==f&&(f=f.nodeType,1===f||3===f))&&(d=Pd(e,d,b,a),
|
||||
+Ab(d));R(b,ca,a)})}function vd(a,b){let c=a.target;a=a.pointerType;c instanceof Node&&"touch"!==a&&v(b,()=>{y(wb(c))||(Id=!0)})}function Qd(a){if(!a.getTargetRanges)return null;a=a.getTargetRanges();return 0===a.length?null:a[0]}function Rd(a,b){return a!==b||E(a)||E(b)||!a.isToken()||!b.isToken()}
|
||||
+function Bd(a,b){let c=a.inputType,d=Qd(a);"deleteCompositionText"===c||Wa&&Bb(b)||"insertCompositionText"!==c&&v(b,()=>{var e=u();if("deleteContentBackward"===c){if(null===e){var f=nc();if(!C(f))return;Ab(f.clone())}if(C(e)){$a&&H(e.anchor.key);f=e.anchor.key===e.focus.key;if(229===Dd&&a.timeStamp<Cd+30&&b.isComposing()&&f){if(H(null),Cd=0,setTimeout(()=>{v(b,()=>{H(null)})},30),C(e)&&(f=e.anchor.getNode(),f.markDirty(),e.format=f.getFormat(),B(f)||n(142),e.style=f.getStyle()),f=e.anchor.getNode().getTextContent(),
|
||||
+e=0===e.anchor.offset&&e.focus.offset===f.length,1>=f.length||e)a.preventDefault(),R(b,da,!0)}else H(null),a.preventDefault(),bb&&f||R(b,da,!0);return}}if(C(e)){f=a.data;null!==Fd&&mc(!1,b,Fd);e.dirty&&null===Fd||!e.isCollapsed()||L(e.anchor.getNode())||null===d||e.applyDOMRange(d);Fd=null;var g=e.focus,h=e.anchor.getNode();g=g.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===f?(a.preventDefault(),R(b,ea,!1)):"\n\n"===f?(a.preventDefault(),R(b,fa,void 0)):null==f&&a.dataTransfer?(f=a.dataTransfer.getData("text/plain"),
|
||||
+a.preventDefault(),e.insertRawText(f)):null!=f&&Md(e,d,f,a.timeStamp,!0)?(a.preventDefault(),R(b,ka,f)):Fd=f,Ed=a.timeStamp;else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":R(b,ka,a);break;case "insertFromComposition":H(null);R(b,ka,a);break;case "insertLineBreak":H(null);R(b,ea,!1);break;case "insertParagraph":H(null);Jd&&!Za?(Jd=!1,R(b,ea,!1)):R(b,fa,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":R(b,la,a);break;case "deleteByComposition":Rd(h,
|
||||
+g)&&R(b,ma,a);break;case "deleteByDrag":case "deleteByCut":R(b,ma,a);break;case "deleteContent":R(b,da,!1);break;case "deleteWordBackward":R(b,oa,!0);break;case "deleteWordForward":R(b,oa,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":R(b,pa,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":R(b,pa,!1);break;case "formatStrikeThrough":R(b,qa,"strikethrough");break;case "formatBold":R(b,qa,"bold");break;case "formatItalic":R(b,qa,
|
||||
+"italic");break;case "formatUnderline":R(b,qa,"underline");break;case "historyUndo":R(b,ra,void 0);break;case "historyRedo":R(b,sa,void 0)}}})}
|
||||
+function yd(a,b){a.stopPropagation();v(b,()=>{var c=u(),d=a.data,e=Qd(a);if(null!=d&&C(c)&&Md(c,e,d,a.timeStamp,!1)){Kd&&(Sd(b,d),Kd=!1);var f=c.anchor,g=f.getNode();e=xb(b._window);if(null===e)return;let h=f.offset;if(f=Xa&&!c.isCollapsed()&&B(g)&&null!==e.anchorNode)g=g.getTextContent().slice(0,h)+d+g.getTextContent().slice(h+c.focus.offset),e=e.anchorNode,f=g===(3===e.nodeType?e.nodeValue:null);f||R(b,ka,d);d=d.length;Wa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=
|
||||
+d);Ya||Za||cb||!b.isComposing()||(Cd=0,H(null))}else mc(!1,b,null!==d?d:void 0),Kd&&(Sd(b,d||void 0),Kd=!1);G();c=F();Cb(c)});Fd=null}function wd(a,b){v(b,()=>{let c=u();if(C(c)&&!b.isComposing()){let d=c.anchor,e=c.anchor.getNode();H(d.key);(a.timeStamp<Cd+30||"element"===d.type||!c.isCollapsed()||e.getFormat()!==c.format||B(e)&&e.getStyle()!==c.style)&&R(b,ka,eb)}})}
|
||||
+function Sd(a,b){var c=a._compositionKey;H(null);if(null!==c&&null!=b){if(""===b){b=I(c);a=Xb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&yb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=u(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);R(a,Ba,null);return}}mc(!0,a,b)}function xd(a,b){Wa?Kd=!0:v(b,()=>{Sd(b,a.data)})}
|
||||
+function ud(a,b){Cd=a.timeStamp;Dd=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(!R(b,ta,a)){if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)Jd=!0,R(b,Ba,a);else if(32===c)R(b,Ca,a);else if(t&&e&&79===c)a.preventDefault(),Jd=!0,R(b,ea,!0);else if(13!==c||d){var h=t?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?R(b,Da,a):(a.preventDefault(),R(b,da,!0)):27===c?R(b,Ga,
|
||||
a):(h=t?d||g||f?!1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?R(b,Ha,a):(a.preventDefault(),R(b,da,!1)):8===c&&(t?g:e)?(a.preventDefault(),R(b,oa,!0)):46===c&&(t?g:e)?(a.preventDefault(),R(b,oa,!1)):t&&f&&8===c?(a.preventDefault(),R(b,pa,!0)):t&&f&&46===c?(a.preventDefault(),R(b,pa,!1)):66===c&&!g&&(t?f:e)?(a.preventDefault(),R(b,qa,"bold")):85===c&&!g&&(t?f:e)?(a.preventDefault(),R(b,qa,"underline")):73===c&&!g&&(t?f:e)?(a.preventDefault(),R(b,qa,"italic")):9!==c||g||e||f?90===c&&!d&&(t?f:e)?(a.preventDefault(),
|
||||
-R(b,ra,void 0)):(h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),R(b,sa,void 0)):Sd(b._editorState._selection)?(h=d?!1:67===c?t?f:e:!1,h?(a.preventDefault(),R(b,Na,a)):(h=d?!1:88===c?t?f:e:!1,h?(a.preventDefault(),R(b,Oa,a)):65===c&&(t?f:e)&&(a.preventDefault(),R(b,Pa,a)))):!Wa&&65===c&&(t?f:e)&&(a.preventDefault(),R(b,Pa,a))):R(b,Ia,a))}else Id=!1,R(b,Ba,a);else R(b,Aa,a);else R(b,za,a);else R(b,ya,a);else R(b,wa,a);else R(b,va,a);else R(b,ua,a);(e||d||g||f)&&R(b,Sa,a)}}}
|
||||
-function Td(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let Ud=new Map;
|
||||
-function Vd(a){var b=a.target;let c=wb(null==b?null:9===b.nodeType?b.defaultView:b.ownerDocument.defaultView);if(null!==c){var d=Tb(c.anchorNode);if(null!==d){Hd&&(Hd=!1,v(d,()=>{var h=mc(),k=c.anchorNode;null!==k&&(k=k.nodeType,1===k||3===k)&&(h=Od(h,c,d,a),zb(h))}));b=jc(d);b=b[b.length-1];var e=b._key,f=Ud.get(e),g=f||b;g!==d&&Nd(c,g,!1);Nd(c,d,!0);d!==b?Ud.set(e,d):f&&Ud.delete(e)}}}
|
||||
-function Wd(a,b){0===Fd&&a.ownerDocument.addEventListener("selectionchange",Vd);Fd++;a.__lexicalEditor=b;let c=Td(a);for(let d=0;d<zd.length;d++){let [e,f]=zd[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return R(b,Oa,h);case "copy":return R(b,Na,h);case "paste":return R(b,la,h);case "dragstart":return R(b,Ka,h);case "dragover":return R(b,La,h);case "dragend":return R(b,
|
||||
+R(b,ra,void 0)):(h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),R(b,sa,void 0)):Td(b._editorState._selection)?(h=d?!1:67===c?t?f:e:!1,h?(a.preventDefault(),R(b,Na,a)):(h=d?!1:88===c?t?f:e:!1,h?(a.preventDefault(),R(b,Oa,a)):65===c&&(t?f:e)&&(a.preventDefault(),R(b,Pa,a)))):!Wa&&65===c&&(t?f:e)&&(a.preventDefault(),R(b,Pa,a))):R(b,Ia,a))}else Jd=!1,R(b,Ba,a);else R(b,Aa,a);else R(b,za,a);else R(b,ya,a);else R(b,wa,a);else R(b,va,a);else R(b,ua,a);(e||d||g||f)&&R(b,Sa,a)}}}
|
||||
+function Ud(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let Vd=new Map;
|
||||
+function Wd(a){var b=a.target;let c=xb(null==b?null:9===b.nodeType?b.defaultView:b.ownerDocument.defaultView);if(null!==c){var d=Ub(c.anchorNode);if(null!==d){Id&&(Id=!1,v(d,()=>{var h=nc(),k=c.anchorNode;null!==k&&(k=k.nodeType,1===k||3===k)&&(h=Pd(h,c,d,a),Ab(h))}));b=kc(d);b=b[b.length-1];var e=b._key,f=Vd.get(e),g=f||b;g!==d&&Od(c,g,!1);Od(c,d,!0);d!==b?Vd.set(e,d):f&&Vd.delete(e)}}}
|
||||
+function Xd(a,b){0===Gd&&a.ownerDocument.addEventListener("selectionchange",Wd);Gd++;a.__lexicalEditor=b;let c=Ud(a);for(let d=0;d<Ad.length;d++){let [e,f]=Ad[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return R(b,Oa,h);case "copy":return R(b,Na,h);case "paste":return R(b,la,h);case "dragstart":return R(b,Ka,h);case "dragover":return R(b,La,h);case "dragend":return R(b,
|
||||
Ma,h);case "focus":return R(b,Qa,h);case "blur":return R(b,Ra,h);case "drop":return R(b,Ja,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}
|
||||
-function Xd(a,b,c){G();var d=a.__key;let e=a.getParent();if(null!==e){var f=u();if(C(f)&&E(a)){var {anchor:g,focus:h}=f;var k=g.getNode();var m=h.getNode();uc(k,a)&&g.set(a.__key,0,"element");uc(m,a)&&h.set(a.__key,0,"element")}k=f;m=!1;if(C(k)&&b){f=k.anchor;let q=k.focus;f.key===d&&(Yd(f,a,e,a.getPreviousSibling(),a.getNextSibling()),m=!0);q.key===d&&(Yd(q,a,e,a.getPreviousSibling(),a.getNextSibling()),m=!0)}else Sd(k)&&b&&a.isSelected()&&a.selectPrevious();C(k)&&b&&!m?(d=a.getIndexWithinParent(),
|
||||
-ac(a),Zd(k,e,d,-1)):ac(a);c||wc(e)||e.canBeEmpty()||!e.isEmpty()||Xd(e,b);b&&L(e)&&e.isEmpty()&&e.selectEnd()}}
|
||||
-class $d{static getType(){n(64,this.name)}static clone(){n(65,this.name)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;Yb(this,a)}getType(){return this.__type}isInline(){n(137,this.constructor.name)}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=I(a);if(null===a)break;a=a.__parent}return!1}isSelected(a){a=a||u();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return B(this)?b:C(a)&&"element"===a.anchor.type&&
|
||||
+function Yd(a,b,c){G();var d=a.__key;let e=a.getParent();if(null!==e){var f=u();if(C(f)&&E(a)){var {anchor:g,focus:h}=f;var k=g.getNode();var m=h.getNode();vc(k,a)&&g.set(a.__key,0,"element");vc(m,a)&&h.set(a.__key,0,"element")}k=f;m=!1;if(C(k)&&b){f=k.anchor;let q=k.focus;f.key===d&&(Zd(f,a,e,a.getPreviousSibling(),a.getNextSibling()),m=!0);q.key===d&&(Zd(q,a,e,a.getPreviousSibling(),a.getNextSibling()),m=!0)}else Td(k)&&b&&a.isSelected()&&a.selectPrevious();C(k)&&b&&!m?(d=a.getIndexWithinParent(),
|
||||
+bc(a),$d(k,e,d,-1)):bc(a);c||xc(e)||e.canBeEmpty()||!e.isEmpty()||Yd(e,b);b&&L(e)&&e.isEmpty()&&e.selectEnd()}}
|
||||
+class ae{static getType(){n(64,this.name)}static clone(){n(65,this.name)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;Zb(this,a)}getType(){return this.__type}isInline(){n(137,this.constructor.name)}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=I(a);if(null===a)break;a=a.__parent}return!1}isSelected(a){a=a||u();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return B(this)?b:C(a)&&"element"===a.anchor.type&&
|
||||
"element"===a.focus.type&&a.anchor.key===a.focus.key&&a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){var a=this.getParent();if(null===a)return-1;a=a.getFirstChild();let b=0;for(;null!==a;){if(this.is(a))return b;b++;a=a.getNextSibling()}return-1}getParent(){let a=this.getLatest().__parent;return null===a?null:I(a)}getParentOrThrow(){let a=this.getParent();null===a&&n(66,this.__key);return a}getTopLevelElement(){let a=this;for(;null!==a;){let b=a.getParent();
|
||||
-if(wc(b))return E(a)||n(138),a;a=b}return null}getTopLevelElementOrThrow(){let a=this.getTopLevelElement();null===a&&n(67,this.__key);return a}getParents(){let a=[],b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){let a=[],b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){let a=this.getLatest().__prev;return null===a?null:I(a)}getPreviousSiblings(){let a=[];var b=this.getParent();if(null===b)return a;for(b=b.getFirstChild();null!==
|
||||
+if(xc(b))return E(a)||n(138),a;a=b}return null}getTopLevelElementOrThrow(){let a=this.getTopLevelElement();null===a&&n(67,this.__key);return a}getParents(){let a=[],b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){let a=[],b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){let a=this.getLatest().__prev;return null===a?null:I(a)}getPreviousSiblings(){let a=[];var b=this.getParent();if(null===b)return a;for(b=b.getFirstChild();null!==
|
||||
b&&!b.is(this);)a.push(b),b=b.getNextSibling();return a}getNextSibling(){let a=this.getLatest().__next;return null===a?null:I(a)}getNextSiblings(){let a=[],b=this.getNextSibling();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getCommonAncestor(a){let b=this.getParents();var c=a.getParents();E(this)&&b.unshift(this);E(a)&&c.unshift(a);a=b.length;var d=c.length;if(0===a||0===d||b[a-1]!==c[d-1])return null;c=new Set(c);for(d=0;d<a;d++){let e=b[d];if(c.has(e))return e}return null}is(a){return null==
|
||||
a?!1:this.__key===a.__key}isBefore(a){if(this===a)return!1;if(a.isParentOf(this))return!0;if(this.isParentOf(a))return!1;var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=c.getIndexWithinParent();break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===b){b=c.getIndexWithinParent();break}c=a}return d<b}isParentOf(a){let b=this.__key;if(b===a.__key)return!1;for(;null!==a;){if(a.__key===b)return!0;a=a.getParent()}return!1}getNodesBetween(a){let b=this.isBefore(a),c=
|
||||
-[],d=new Set;for(var e=this;;){var f=e.__key;d.has(f)||(d.add(f),c.push(e));if(e===a)break;f=E(e)?b?e.getFirstChild():e.getLastChild():null;if(null!==f)e=f;else if(f=b?e.getNextSibling():e.getPreviousSibling(),null!==f)e=f;else{e=e.getParentOrThrow();d.has(e.__key)||c.push(e);if(e===a)break;f=e;do null===f&&n(68),e=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(null!==e||d.has(f.__key)||c.push(f));while(null===e)}}b||c.reverse();return c}isDirty(){let a=F()._dirtyLeaves;return null!==
|
||||
-a&&a.has(this.__key)}getLatest(){let a=I(this.__key);null===a&&n(113);return a}getWritable(){G();var a=$b(),b=F();a=a._nodeMap;let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=u();null!==f&&f.setCachedNodes(null);if(b.has(c))return bc(d),d;f=d.constructor.clone(d);f.__parent=e;f.__next=d.__next;f.__prev=d.__prev;E(d)&&E(f)?(f.__first=d.__first,f.__last=d.__last,f.__size=d.__size,f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):B(d)&&B(f)&&(f.__format=d.__format,
|
||||
-f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;bc(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){n(70)}updateDOM(){n(71)}exportDOM(a){return{element:this.createDOM(a._config,a)}}exportJSON(){n(72)}static importJSON(){n(18,this.name)}static transform(){return null}remove(a){Xd(this,!0,a)}replace(a,b){G();var c=u();null!==c&&(c=c.clone());zc(this,a);let d=this.getLatest(),e=this.__key,f=a.__key,g=
|
||||
-a.getWritable();a=this.getParentOrThrow().getWritable();let h=a.__size;ac(g);let k=d.getPreviousSibling(),m=d.getNextSibling(),q=d.__prev,p=d.__next,l=d.__parent;Xd(d,!1,!0);null===k?a.__first=f:k.getWritable().__next=f;g.__prev=q;null===m?a.__last=f:m.getWritable().__prev=f;g.__next=p;g.__parent=l;a.__size=h;b&&(E(this)&&E(g)||n(139),this.getChildren().forEach(r=>{g.append(r)}));C(c)&&(zb(c),b=c.anchor,c=c.focus,b.key===e&&ae(b,g),c.key===e&&ae(c,g));cc()===e&&H(f);return g}insertAfter(a,b=!0){G();
|
||||
-zc(this,a);var c=this.getWritable();let d=a.getWritable();var e=d.getParent();let f=u();var g=!1,h=!1;if(null!==e){var k=a.getIndexWithinParent();ac(d);C(f)&&(h=e.__key,g=f.anchor,e=f.focus,g="element"===g.type&&g.key===h&&g.offset===k+1,h="element"===e.type&&e.key===h&&e.offset===k+1)}e=this.getNextSibling();k=this.getParentOrThrow().getWritable();let m=d.__key,q=c.__next;null===e?k.__last=m:e.getWritable().__prev=m;k.__size++;c.__next=m;d.__next=q;d.__prev=c.__key;d.__parent=c.__parent;b&&C(f)&&
|
||||
-(b=this.getIndexWithinParent(),Zd(f,k,b+1),c=k.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));return a}insertBefore(a,b=!0){G();zc(this,a);var c=this.getWritable();let d=a.getWritable(),e=d.__key;ac(d);let f=this.getPreviousSibling(),g=this.getParentOrThrow().getWritable(),h=c.__prev,k=this.getIndexWithinParent();null===f?g.__first=e:f.getWritable().__next=e;g.__size++;c.__prev=e;d.__prev=h;d.__next=c.__key;d.__parent=c.__parent;c=u();b&&C(c)&&(b=this.getParentOrThrow(),Zd(c,
|
||||
-b,k));return a}isParentRequired(){return!1}createParentElementNode(){return be()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(a,b){G();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):E(c)?c.select():B(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){G();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():E(c)?c.select(0,0):B(c)?c.select(a,b):(a=c.getIndexWithinParent(),
|
||||
-d.select(a,a))}markDirty(){this.getWritable()}}function ce(a,b,c){c=c||b.getParentOrThrow().getLastChild();let d=b;for(b=[b];d!==c;)d.getNextSibling()||n(140),d=d.getNextSibling(),b.push(d);for(let e of b)a=a.insertAfter(e)}
|
||||
-class de extends $d{static getType(){return"linebreak"}static clone(a){return new de(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:a=>{a:{var b=a.parentElement;if(null!==b){let c=b.firstChild;if(c===a||c.nextSibling===a&&ee(c))if(b=b.lastChild,b===a||b.previousSibling===a&&ee(b)){a=!0;break a}}a=!1}return a?null:{conversion:fe,priority:0}}}}static importJSON(){return ge()}exportJSON(){return{type:"linebreak",
|
||||
-version:1}}}function fe(){return{node:ge()}}function ge(){return yc(new de)}function Ec(a){return a instanceof de}function ee(a){return 3===a.nodeType&&/^( |\t|\r?\n)+$/.test(a.textContent||"")}function he(a,b){return b&16?"code":b&128?"mark":b&32?"sub":b&64?"sup":null}function ie(a,b){return b&1?"strong":b&2?"em":"span"}
|
||||
-function je(a,b,c,d,e){a=d.classList;d=oc(e,"base");void 0!==d&&a.add(...d);d=oc(e,"underlineStrikethrough");let f=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in gb)h=gb[k],d=oc(e,k),void 0!==d&&(c&h?!f||"underline"!==k&&"strikethrough"!==k?(0===(b&h)||g&&"underline"===k||"strikethrough"===k)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
|
||||
-function ke(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?cb:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Wa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,m]=a;0!==k&&d.deleteData(h,k);d.insertData(h,m)}else d.nodeValue=a}function le(a,b){b=document.createElement(b);b.appendChild(a);return b}
|
||||
-class me extends $d{static getType(){return"text"}static clone(a){return new me(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return ob[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===cc()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
|
||||
-(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=gb[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Xb(c,a,b)}canHaveFormat(){return!0}createDOM(a){var b=this.__format,c=he(this,b);let d=ie(this,b),e=document.createElement(null===c?d:c),f=e;this.hasFormat("code")&&e.setAttribute("spellcheck","false");
|
||||
-null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;ke(this.__text,c,this);a=a.theme.text;void 0!==a&&je(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){let d=this.__text;var e=a.__format,f=this.__format,g=he(this,e);let h=he(this,f);var k=ie(this,e);let m=ie(this,f);if((null===g?k:g)!==(null===h?m:h))return!0;if(g===h&&k!==m)return e=b.firstChild,null==e&&n(48),a=g=document.createElement(m),ke(d,a,this),c=c.theme.text,void 0!==c&&je(m,0,f,a,c),b.replaceChild(g,
|
||||
-e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&n(49));ke(d,k,this);c=c.theme.text;void 0!==c&&e!==f&&je(m,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:ne,priority:0}),b:()=>({conversion:oe,priority:0}),code:()=>({conversion:pe,priority:0}),em:()=>({conversion:pe,priority:0}),i:()=>({conversion:pe,priority:0}),s:()=>({conversion:pe,priority:0}),span:()=>({conversion:qe,priority:0}),strong:()=>({conversion:pe,priority:0}),
|
||||
-sub:()=>({conversion:pe,priority:0}),sup:()=>({conversion:pe,priority:0}),u:()=>({conversion:pe,priority:0})}}static importJSON(a){let b=K(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportDOM(a){({element:a}=super.exportDOM(a));null!==a&&Cc(a)||n(132);a.style.whiteSpace="pre-wrap";this.hasFormat("bold")&&(a=le(a,"b"));this.hasFormat("italic")&&(a=le(a,"i"));this.hasFormat("strikethrough")&&(a=le(a,"s"));this.hasFormat("underline")&&(a=le(a,"u"));
|
||||
-return{element:a}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?gb[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?hb[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){let b=this.getFormat();a=Xb(b,a,null);return this.setFormat(a)}toggleDirectionless(){let a=
|
||||
-this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=nb[a];if(this.__mode===a)return this;let b=this.getWritable();b.__mode=a;return b}setTextContent(a){if(this.__text===a)return this;let b=this.getWritable();b.__text=a;return b}select(a,b){G();let c=u();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(C(c))d=cc(),d!==c.anchor.key&&d!==c.focus.key||H(e),c.setTextNodeRange(this,
|
||||
-a,this,b);else return re(e,a,e,b,"text","text");return c}selectStart(){return this.select(0,0)}selectEnd(){let a=this.getTextContentSize();return this.select(a,a)}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,h=a;0>h&&(h=g+h,0>h&&(h=0));let k=u();d&&C(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){G();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=cc(),
|
||||
+[],d=new Set;for(var e=this;null!==e;){var f=e.__key;d.has(f)||(d.add(f),c.push(e));if(e===a)break;f=E(e)?b?e.getFirstChild():e.getLastChild():null;if(null!==f)e=f;else if(f=b?e.getNextSibling():e.getPreviousSibling(),null!==f)e=f;else{e=e.getParentOrThrow();d.has(e.__key)||c.push(e);if(e===a)break;f=e;do if(null===f&&n(68),e=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f)null!==e||d.has(f.__key)||c.push(f);else break;while(null===e)}}b||c.reverse();return c}isDirty(){let a=
|
||||
+F()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=I(this.__key);null===a&&n(113);return a}getWritable(){G();var a=ac(),b=F();a=a._nodeMap;let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=u();null!==f&&f.setCachedNodes(null);if(b.has(c))return cc(d),d;f=d.constructor.clone(d);f.__parent=e;f.__next=d.__next;f.__prev=d.__prev;E(d)&&E(f)?(f.__first=d.__first,f.__last=d.__last,f.__size=d.__size,f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):B(d)&&
|
||||
+B(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;cc(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){n(70)}updateDOM(){n(71)}exportDOM(a){return{element:this.createDOM(a._config,a)}}exportJSON(){n(72)}static importJSON(){n(18,this.name)}static transform(){return null}remove(a){Yd(this,!0,a)}replace(a,b){G();var c=u();null!==c&&(c=c.clone());Ac(this,a);let d=this.getLatest(),
|
||||
+e=this.__key,f=a.__key,g=a.getWritable();a=this.getParentOrThrow().getWritable();let h=a.__size;bc(g);let k=d.getPreviousSibling(),m=d.getNextSibling(),q=d.__prev,p=d.__next,l=d.__parent;Yd(d,!1,!0);null===k?a.__first=f:k.getWritable().__next=f;g.__prev=q;null===m?a.__last=f:m.getWritable().__prev=f;g.__next=p;g.__parent=l;a.__size=h;b&&(E(this)&&E(g)||n(139),this.getChildren().forEach(r=>{g.append(r)}));C(c)&&(Ab(c),b=c.anchor,c=c.focus,b.key===e&&be(b,g),c.key===e&&be(c,g));dc()===e&&H(f);return g}insertAfter(a,
|
||||
+b=!0){G();Ac(this,a);var c=this.getWritable();let d=a.getWritable();var e=d.getParent();let f=u();var g=!1,h=!1;if(null!==e){var k=a.getIndexWithinParent();bc(d);C(f)&&(h=e.__key,g=f.anchor,e=f.focus,g="element"===g.type&&g.key===h&&g.offset===k+1,h="element"===e.type&&e.key===h&&e.offset===k+1)}e=this.getNextSibling();k=this.getParentOrThrow().getWritable();let m=d.__key,q=c.__next;null===e?k.__last=m:e.getWritable().__prev=m;k.__size++;c.__next=m;d.__next=q;d.__prev=c.__key;d.__parent=c.__parent;
|
||||
+b&&C(f)&&(b=this.getIndexWithinParent(),$d(f,k,b+1),c=k.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));return a}insertBefore(a,b=!0){G();Ac(this,a);var c=this.getWritable();let d=a.getWritable(),e=d.__key;bc(d);let f=this.getPreviousSibling(),g=this.getParentOrThrow().getWritable(),h=c.__prev,k=this.getIndexWithinParent();null===f?g.__first=e:f.getWritable().__next=e;g.__size++;c.__prev=e;d.__prev=h;d.__next=c.__key;d.__parent=c.__parent;c=u();b&&C(c)&&(b=this.getParentOrThrow(),
|
||||
+$d(c,b,k));return a}isParentRequired(){return!1}createParentElementNode(){return ce()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(a,b){G();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):E(c)?c.select():B(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){G();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():E(c)?c.select(0,0):B(c)?c.select(a,b):(a=
|
||||
+c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}function de(a,b,c){c=c||b.getParentOrThrow().getLastChild();let d=b;for(b=[b];d!==c;)d.getNextSibling()||n(140),d=d.getNextSibling(),b.push(d);for(let e of b)a=a.insertAfter(e)}
|
||||
+class ee extends ae{static getType(){return"linebreak"}static clone(a){return new ee(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:a=>{a:{var b=a.parentElement;if(null!==b){let c=b.firstChild;if(c===a||c.nextSibling===a&&fe(c))if(b=b.lastChild,b===a||b.previousSibling===a&&fe(b)){a=!0;break a}}a=!1}return a?null:{conversion:ge,priority:0}}}}static importJSON(){return he()}exportJSON(){return{type:"linebreak",
|
||||
+version:1}}}function ge(){return{node:he()}}function he(){return zc(new ee)}function Fc(a){return a instanceof ee}function fe(a){return 3===a.nodeType&&/^( |\t|\r?\n)+$/.test(a.textContent||"")}function ie(a,b){return b&16?"code":b&128?"mark":b&32?"sub":b&64?"sup":null}function je(a,b){return b&1?"strong":b&2?"em":"span"}
|
||||
+function ke(a,b,c,d,e){a=d.classList;d=pc(e,"base");void 0!==d&&a.add(...d);d=pc(e,"underlineStrikethrough");let f=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in hb)h=hb[k],d=pc(e,k),void 0!==d&&(c&h?!f||"underline"!==k&&"strikethrough"!==k?(0===(b&h)||g&&"underline"===k||"strikethrough"===k)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
|
||||
+function le(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?db:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Wa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,m]=a;0!==k&&d.deleteData(h,k);d.insertData(h,m)}else d.nodeValue=a}function me(a,b){b=document.createElement(b);b.appendChild(a);return b}
|
||||
+class ne extends ae{static getType(){return"text"}static clone(a){return new ne(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return pb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===dc()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
|
||||
+(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=hb[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Yb(c,a,b)}canHaveFormat(){return!0}createDOM(a){var b=this.__format,c=ie(this,b);let d=je(this,b),e=document.createElement(null===c?d:c),f=e;this.hasFormat("code")&&e.setAttribute("spellcheck","false");
|
||||
+null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;le(this.__text,c,this);a=a.theme.text;void 0!==a&&ke(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){let d=this.__text;var e=a.__format,f=this.__format,g=ie(this,e);let h=ie(this,f);var k=je(this,e);let m=je(this,f);if((null===g?k:g)!==(null===h?m:h))return!0;if(g===h&&k!==m)return e=b.firstChild,null==e&&n(48),a=g=document.createElement(m),le(d,a,this),c=c.theme.text,void 0!==c&&ke(m,0,f,a,c),b.replaceChild(g,
|
||||
+e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&n(49));le(d,k,this);c=c.theme.text;void 0!==c&&e!==f&&ke(m,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:oe,priority:0}),b:()=>({conversion:pe,priority:0}),code:()=>({conversion:qe,priority:0}),em:()=>({conversion:qe,priority:0}),i:()=>({conversion:qe,priority:0}),s:()=>({conversion:qe,priority:0}),span:()=>({conversion:re,priority:0}),strong:()=>({conversion:qe,priority:0}),
|
||||
+sub:()=>({conversion:qe,priority:0}),sup:()=>({conversion:qe,priority:0}),u:()=>({conversion:qe,priority:0})}}static importJSON(a){let b=K(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportDOM(a){({element:a}=super.exportDOM(a));null!==a&&Dc(a)||n(132);a.style.whiteSpace="pre-wrap";this.hasFormat("bold")&&(a=me(a,"b"));this.hasFormat("italic")&&(a=me(a,"i"));this.hasFormat("strikethrough")&&(a=me(a,"s"));this.hasFormat("underline")&&(a=me(a,"u"));
|
||||
+return{element:a}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?hb[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?lb[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){let b=this.getFormat();a=Yb(b,a,null);return this.setFormat(a)}toggleDirectionless(){let a=
|
||||
+this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=ob[a];if(this.__mode===a)return this;let b=this.getWritable();b.__mode=a;return b}setTextContent(a){if(this.__text===a)return this;let b=this.getWritable();b.__text=a;return b}select(a,b){G();let c=u();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(C(c))d=dc(),d!==c.anchor.key&&d!==c.focus.key||H(e),c.setTextNodeRange(this,
|
||||
+a,this,b);else return se(e,a,e,b,"text","text");return c}selectStart(){return this.select(0,0)}selectEnd(){let a=this.getTextContentSize();return this.select(a,a)}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,h=a;0>h&&(h=g+h,0>h&&(h=0));let k=u();d&&C(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){G();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=dc(),
|
||||
f=new Set(a);a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==h&&f.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);f=a.length;if(0===f)return[];if(a[0]===c)return[b];var m=a[0];c=b.getParentOrThrow();k=b.getFormat();let q=b.getStyle(),p=b.__detail;g=!1;b.isSegmented()?(h=K(m),h.__format=k,h.__style=q,h.__detail=p,g=!0):(h=b.getWritable(),h.__text=m);b=u();h=[h];m=m.length;for(let w=1;w<f;w++){var l=a[w],r=l.length;l=K(l).getWritable();l.__format=k;l.__style=q;l.__detail=p;let A=l.__key;r=m+r;
|
||||
-if(C(b)){let x=b.anchor,z=b.focus;x.key===d&&"text"===x.type&&x.offset>m&&x.offset<=r&&(x.key=A,x.offset-=m,b.dirty=!0);z.key===d&&"text"===z.type&&z.offset>m&&z.offset<=r&&(z.key=A,z.offset-=m,b.dirty=!0)}e===d&&H(A);m=r;h.push(l)}d=this.getPreviousSibling();e=this.getNextSibling();null!==d&&bc(d);null!==e&&bc(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&Zd(b,c,e,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||
|
||||
-a===this.getNextSibling()||n(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;cc()===d&&H(c);let g=u();if(C(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(se(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(se(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?c+e:e+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
|
||||
-function qe(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,e="underline"===a.style.textDecoration,f=a.style.verticalAlign;return{forChild:g=>{if(!B(g))return g;b&&g.toggleFormat("bold");c&&g.toggleFormat("strikethrough");d&&g.toggleFormat("italic");e&&g.toggleFormat("underline");"sub"===f&&g.toggleFormat("subscript");"super"===f&&g.toggleFormat("superscript");return g},node:null}}
|
||||
-function oe(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}let te=new WeakMap;
|
||||
-function ne(a){null===a.parentElement&&n(129);for(var b=a.textContent||"",c,d=a.parentNode,e=[a];null!==d&&void 0===(c=te.get(d))&&!("PRE"===d.nodeName||1===d.nodeType&&void 0!==d.style&&void 0!==d.style.whiteSpace&&d.style.whiteSpace.startsWith("pre"));)e.push(d),d=d.parentNode;c=void 0===c?d:c;for(d=0;d<e.length;d++)te.set(e[d],c);if(null!==c){b=b.split(/(\r?\n|\t)/);a=[];e=b.length;for(c=0;c<e;c++)d=b[c],"\n"===d||"\r\n"===d?a.push(ge()):"\t"===d?a.push(ue()):""!==d&&a.push(K(d));return{node:a}}b=
|
||||
-b.replace(/\r/g,"").replace(/[ \t\n]+/g," ");if(""===b)return{node:null};if(" "===b[0]){e=a;for(c=!0;null!==e&&null!==(e=ve(e,!1));)if(d=e.textContent||"",0<d.length){/[ \t\n]$/.test(d)&&(b=b.slice(1));c=!1;break}c&&(b=b.slice(1))}if(" "===b[b.length-1]){for(e=!0;null!==a&&null!==(a=ve(a,!0));)if(0<(a.textContent||"").replace(/^( |\t|\r?\n)+/,"").length){e=!1;break}e&&(b=b.slice(0,b.length-1))}return""===b?{node:null}:{node:K(b)}}
|
||||
-let Fe=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/,"i");function ve(a,b){for(;;){for(var c=void 0;null===(c=b?a.nextSibling:a.previousSibling);)if(a=a.parentElement,null===a)return null;a=c;if(1===a.nodeType&&(c=a.style.display,""===c&&null===a.nodeName.match(Fe)||""!==c&&!c.startsWith("inline")))return null;for(;null!==(c=b?a.firstChild:a.lastChild);)a=c;if(3===a.nodeType)return a;if("BR"===a.nodeName)return null}}
|
||||
-let Ge={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function pe(a){let b=Ge[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&!c.hasFormat(b)&&c.toggleFormat(b);return c},node:null}}function K(a=""){return yc(new me(a))}function B(a){return a instanceof me}
|
||||
-class He extends me{static getType(){return"tab"}static clone(a){let b=new He(a.__key);b.__text=a.__text;b.__format=a.__format;b.__style=a.__style;return b}constructor(a){super("\t",a);this.__detail=2}static importDOM(){return null}static importJSON(a){let b=ue();b.setFormat(a.format);b.setStyle(a.style);return b}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(){n(126)}setDetail(){n(127)}setMode(){n(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}
|
||||
-function ue(){return yc(new He)}function Ie(a){return a instanceof He}
|
||||
-class Je{constructor(a,b,c){this._selection=null;this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode(),d=this.offset;a=a.offset;if(E(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}E(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=I(this.key);null===a&&n(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
|
||||
-dc()||(cc()===e&&H(a),null!==d&&(d.setCachedNodes(null),d.dirty=!0))}}function Ke(a,b,c){return new Je(a,b,c)}function Le(a,b){let c=b.__key,d=a.offset,e="element";if(B(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!E(b)){var f=b.getNextSibling();if(B(f))c=f.__key,d=0,e="text";else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function ae(a,b){if(E(b)){let c=b.getLastDescendant();E(c)||B(c)?Le(a,c):Le(a,b)}else Le(a,b)}
|
||||
-function Me(a,b,c,d){let e=a.getNode(),f=e.getChildAtIndex(a.offset),g=K(),h=L(e)?be().append(g):g;g.setFormat(c);g.setStyle(d);null===f?e.append(h):f.insertBefore(h);a.is(b)&&b.set(g.__key,0,"text");a.set(g.__key,0,"text")}function Ne(a,b,c,d){a.key=b;a.offset=c;a.type=d}
|
||||
-class Oe{constructor(a){this._cachedNodes=null;this._nodes=a;this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){if(!Sd(a))return!1;let b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(a){this.dirty=!0;this._nodes.add(a);this._cachedNodes=null}delete(a){this.dirty=!0;this._nodes.delete(a);this._cachedNodes=null}clear(){this.dirty=!0;this._nodes.clear();
|
||||
-this._cachedNodes=null}has(a){return this._nodes.has(a)}clone(){return new Oe(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a){let b=this.getNodes(),c=b.length;var d=b[c-1];if(B(d))d=d.select();else{let e=d.getIndexWithinParent()+1;d=d.getParentOrThrow().select(e,e)}d.insertNodes(a);for(a=0;a<c;a++)b[a].remove()}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=I(c),null!==b&&a.push(b);dc()||(this._cachedNodes=
|
||||
-a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function C(a){return a instanceof Pe}
|
||||
-class Pe{constructor(a,b,c,d){this.anchor=a;this.focus=b;a._selection=this;b._selection=this;this._cachedNodes=null;this.format=c;this.style=d;this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){return C(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format&&this.style===a.style:!1}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var a=this._cachedNodes;if(null!==a)return a;a=this.anchor;var b=this.focus,c=a.isBefore(b),
|
||||
-d=c?a:b;c=c?b:a;a=d.getNode();b=c.getNode();let e=d.offset;d=c.offset;E(a)&&(c=a.getDescendantByIndex(e),a=null!=c?c:a);E(b)&&(c=b.getDescendantByIndex(d),null!==c&&c!==a&&b.getChildAtIndex(d)===c&&(c=c.getPreviousSibling()),b=null!=c?c:b);a=a.is(b)?E(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(b);dc()||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){Ne(this.anchor,a.__key,b,"text");Ne(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();
|
||||
-if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor,e=this.focus,f=d.isBefore(e),[g,h]=Qe(this),k="",m=!0;for(let q=0;q<a.length;q++){let p=a[q];if(E(p)&&!p.isInline())m||(k+="\n"),m=p.isEmpty()?!1:!0;else if(m=!1,B(p)){let l=p.getTextContent();if(p===b)if(p===c){if("element"!==d.type||"element"!==e.type||e.offset===d.offset)l=g<h?l.slice(g,h):l.slice(h,g)}else l=f?l.slice(g):l.slice(h);else p===c&&(l=f?l.slice(0,h):l.slice(0,g));k+=l}else!y(p)&&!Ec(p)||p===c&&this.isCollapsed()||(k+=
|
||||
-p.getTextContent())}return k}applyDOMRange(a){let b=F(),c=b.getEditorState()._selection;a=Re(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;Ne(this.anchor,d.key,d.offset,d.type);Ne(this.focus,e.key,e.offset,e.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new Pe(Ke(a.key,a.offset,a.type),Ke(b.key,b.offset,b.type),this.format,this.style)}toggleFormat(a){this.format=Xb(this.format,a,null);this.dirty=!0}setStyle(a){this.style=a;this.dirty=
|
||||
-!0}hasFormat(a){return 0!==(this.format&gb[a])}insertRawText(a){a=a.split(/(\r?\n|\t)/);let b=[],c=a.length;for(let d=0;d<c;d++){let e=a[d];"\n"===e||"\r\n"===e?b.push(ge()):"\t"===e?b.push(ue()):b.push(K(e))}this.insertNodes(b)}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),e=this.format,f=this.style;d&&"element"===b.type?Me(b,c,e,f):d||"element"!==c.type||Me(c,b,e,f);var g=this.getNodes(),h=g.length,k=d?c:b;c=(d?b:c).offset;var m=k.offset;b=g[0];B(b)||n(26);d=b.getTextContent().length;
|
||||
-var q=b.getParentOrThrow(),p=g[h-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!q.canInsertTextAfter()&&null===b.getNextSibling())){var l=b.getNextSibling();B(l)&&l.canInsertTextBefore()&&!Vb(l)||(l=K(),l.setFormat(e),q.canInsertTextAfter()?b.insertAfter(l):q.insertAfter(l));l.select(0,0);b=l;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!q.canInsertTextBefore()&&null===b.getPreviousSibling())){l=
|
||||
-b.getPreviousSibling();if(!B(l)||Vb(l))l=K(),l.setFormat(e),q.canInsertTextBefore()?b.insertBefore(l):q.insertBefore(l);l.select();b=l;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)q=K(b.getTextContent()),q.setFormat(e),b.replace(q),b=q;else if(!(this.isCollapsed()||""===a||(l=p.getParent(),q.canInsertTextBefore()&&q.canInsertTextAfter()&&(!E(l)||l.canInsertTextBefore()&&l.canInsertTextAfter())))){this.insertText("");Se(this.anchor,this.focus,null);this.insertText(a);return}if(1===
|
||||
-h)if(b.isToken())a=K(a),a.select(),b.replace(a);else{g=b.getFormat();h=b.getStyle();if(c===m&&(g!==e||h!==f))if(""===b.getTextContent())b.setFormat(e),b.setStyle(f);else{g=K(a);g.setFormat(e);g.setStyle(f);g.select();0===c?b.insertBefore(g,!1):([h]=b.splitText(c),h.insertAfter(g,!1));g.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length);return}else if(Ie(b)){a=K(a);a.setFormat(e);a.setStyle(f);a.select();b.replace(a);return}b=b.spliceText(c,m-c,a,!0);""===b.getTextContent()?b.remove():
|
||||
+if(C(b)){let x=b.anchor,z=b.focus;x.key===d&&"text"===x.type&&x.offset>m&&x.offset<=r&&(x.key=A,x.offset-=m,b.dirty=!0);z.key===d&&"text"===z.type&&z.offset>m&&z.offset<=r&&(z.key=A,z.offset-=m,b.dirty=!0)}e===d&&H(A);m=r;h.push(l)}d=this.getPreviousSibling();e=this.getNextSibling();null!==d&&cc(d);null!==e&&cc(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&$d(b,c,e,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||
|
||||
+a===this.getNextSibling()||n(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;dc()===d&&H(c);let g=u();if(C(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(te(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(te(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?c+e:e+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
|
||||
+function re(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,e="underline"===a.style.textDecoration,f=a.style.verticalAlign;return{forChild:g=>{if(!B(g))return g;b&&g.toggleFormat("bold");c&&g.toggleFormat("strikethrough");d&&g.toggleFormat("italic");e&&g.toggleFormat("underline");"sub"===f&&g.toggleFormat("subscript");"super"===f&&g.toggleFormat("superscript");return g},node:null}}
|
||||
+function pe(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}let ue=new WeakMap;
|
||||
+function oe(a){null===a.parentElement&&n(129);for(var b=a.textContent||"",c,d=a.parentNode,e=[a];null!==d&&void 0===(c=ue.get(d))&&!("PRE"===d.nodeName||1===d.nodeType&&void 0!==d.style&&void 0!==d.style.whiteSpace&&d.style.whiteSpace.startsWith("pre"));)e.push(d),d=d.parentNode;c=void 0===c?d:c;for(d=0;d<e.length;d++)ue.set(e[d],c);if(null!==c){b=b.split(/(\r?\n|\t)/);a=[];e=b.length;for(c=0;c<e;c++)d=b[c],"\n"===d||"\r\n"===d?a.push(he()):"\t"===d?a.push(ve()):""!==d&&a.push(K(d));return{node:a}}b=
|
||||
+b.replace(/\r/g,"").replace(/[ \t\n]+/g," ");if(""===b)return{node:null};if(" "===b[0]){e=a;for(c=!0;null!==e&&null!==(e=we(e,!1));)if(d=e.textContent||"",0<d.length){/[ \t\n]$/.test(d)&&(b=b.slice(1));c=!1;break}c&&(b=b.slice(1))}if(" "===b[b.length-1]){for(e=!0;null!==a&&null!==(a=we(a,!0));)if(0<(a.textContent||"").replace(/^( |\t|\r?\n)+/,"").length){e=!1;break}e&&(b=b.slice(0,b.length-1))}return""===b?{node:null}:{node:K(b)}}
|
||||
+let xe=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/,"i");function we(a,b){for(;;){for(var c=void 0;null===(c=b?a.nextSibling:a.previousSibling);)if(a=a.parentElement,null===a)return null;a=c;if(1===a.nodeType&&(c=a.style.display,""===c&&null===a.nodeName.match(xe)||""!==c&&!c.startsWith("inline")))return null;for(;null!==(c=b?a.firstChild:a.lastChild);)a=c;if(3===a.nodeType)return a;if("BR"===a.nodeName)return null}}
|
||||
+let He={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function qe(a){let b=He[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&!c.hasFormat(b)&&c.toggleFormat(b);return c},node:null}}function K(a=""){return zc(new ne(a))}function B(a){return a instanceof ne}
|
||||
+class Ie extends ne{static getType(){return"tab"}static clone(a){let b=new Ie(a.__key);b.__text=a.__text;b.__format=a.__format;b.__style=a.__style;return b}constructor(a){super("\t",a);this.__detail=2}static importDOM(){return null}static importJSON(a){let b=ve();b.setFormat(a.format);b.setStyle(a.style);return b}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(){n(126)}setDetail(){n(127)}setMode(){n(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}
|
||||
+function ve(){return zc(new Ie)}function Je(a){return a instanceof Ie}
|
||||
+class Ke{constructor(a,b,c){this._selection=null;this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode(),d=this.offset;a=a.offset;if(E(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}E(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=I(this.key);null===a&&n(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
|
||||
+ec()||(dc()===e&&H(a),null!==d&&(d.setCachedNodes(null),d.dirty=!0))}}function Le(a,b,c){return new Ke(a,b,c)}function Me(a,b){let c=b.__key,d=a.offset,e="element";if(B(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!E(b)){var f=b.getNextSibling();if(B(f))c=f.__key,d=0,e="text";else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function be(a,b){if(E(b)){let c=b.getLastDescendant();E(c)||B(c)?Me(a,c):Me(a,b)}else Me(a,b)}
|
||||
+function Ne(a,b,c,d){let e=a.getNode(),f=e.getChildAtIndex(a.offset),g=K(),h=L(e)?ce().append(g):g;g.setFormat(c);g.setStyle(d);null===f?e.append(h):f.insertBefore(h);a.is(b)&&b.set(g.__key,0,"text");a.set(g.__key,0,"text")}function Oe(a,b,c,d){a.key=b;a.offset=c;a.type=d}
|
||||
+class Pe{constructor(a){this._cachedNodes=null;this._nodes=a;this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){if(!Td(a))return!1;let b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(a){this.dirty=!0;this._nodes.add(a);this._cachedNodes=null}delete(a){this.dirty=!0;this._nodes.delete(a);this._cachedNodes=null}clear(){this.dirty=!0;this._nodes.clear();
|
||||
+this._cachedNodes=null}has(a){return this._nodes.has(a)}clone(){return new Pe(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a){let b=this.getNodes(),c=b.length;var d=b[c-1];if(B(d))d=d.select();else{let e=d.getIndexWithinParent()+1;d=d.getParentOrThrow().select(e,e)}d.insertNodes(a);for(a=0;a<c;a++)b[a].remove()}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=I(c),null!==b&&a.push(b);ec()||(this._cachedNodes=
|
||||
+a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function C(a){return a instanceof Qe}
|
||||
+class Qe{constructor(a,b,c,d){this.anchor=a;this.focus=b;a._selection=this;b._selection=this;this._cachedNodes=null;this.format=c;this.style=d;this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){return C(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format&&this.style===a.style:!1}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var a=this._cachedNodes;if(null!==a)return a;a=this.anchor;var b=this.focus,c=a.isBefore(b),
|
||||
+d=c?a:b;c=c?b:a;a=d.getNode();b=c.getNode();let e=d.offset;d=c.offset;E(a)&&(c=a.getDescendantByIndex(e),a=null!=c?c:a);E(b)&&(c=b.getDescendantByIndex(d),null!==c&&c!==a&&b.getChildAtIndex(d)===c&&(c=c.getPreviousSibling()),b=null!=c?c:b);a=a.is(b)?E(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(b);ec()||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){Oe(this.anchor,a.__key,b,"text");Oe(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();
|
||||
+if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor,e=this.focus,f=d.isBefore(e),[g,h]=Re(this),k="",m=!0;for(let q=0;q<a.length;q++){let p=a[q];if(E(p)&&!p.isInline())m||(k+="\n"),m=p.isEmpty()?!1:!0;else if(m=!1,B(p)){let l=p.getTextContent();if(p===b)if(p===c){if("element"!==d.type||"element"!==e.type||e.offset===d.offset)l=g<h?l.slice(g,h):l.slice(h,g)}else l=f?l.slice(g):l.slice(h);else p===c&&(l=f?l.slice(0,h):l.slice(0,g));k+=l}else!y(p)&&!Fc(p)||p===c&&this.isCollapsed()||(k+=
|
||||
+p.getTextContent())}return k}applyDOMRange(a){let b=F(),c=b.getEditorState()._selection;a=Se(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;Oe(this.anchor,d.key,d.offset,d.type);Oe(this.focus,e.key,e.offset,e.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new Qe(Le(a.key,a.offset,a.type),Le(b.key,b.offset,b.type),this.format,this.style)}toggleFormat(a){this.format=Yb(this.format,a,null);this.dirty=!0}setStyle(a){this.style=a;this.dirty=
|
||||
+!0}hasFormat(a){return 0!==(this.format&hb[a])}insertRawText(a){a=a.split(/(\r?\n|\t)/);let b=[],c=a.length;for(let d=0;d<c;d++){let e=a[d];"\n"===e||"\r\n"===e?b.push(he()):"\t"===e?b.push(ve()):b.push(K(e))}this.insertNodes(b)}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),e=this.format,f=this.style;d&&"element"===b.type?Ne(b,c,e,f):d||"element"!==c.type||Ne(c,b,e,f);var g=this.getNodes(),h=g.length,k=d?c:b;c=(d?b:c).offset;var m=k.offset;b=g[0];B(b)||n(26);d=b.getTextContent().length;
|
||||
+var q=b.getParentOrThrow(),p=g[h-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!q.canInsertTextAfter()&&null===b.getNextSibling())){var l=b.getNextSibling();B(l)&&l.canInsertTextBefore()&&!Wb(l)||(l=K(),l.setFormat(e),q.canInsertTextAfter()?b.insertAfter(l):q.insertAfter(l));l.select(0,0);b=l;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!q.canInsertTextBefore()&&null===b.getPreviousSibling())){l=
|
||||
+b.getPreviousSibling();if(!B(l)||Wb(l))l=K(),l.setFormat(e),q.canInsertTextBefore()?b.insertBefore(l):q.insertBefore(l);l.select();b=l;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)q=K(b.getTextContent()),q.setFormat(e),b.replace(q),b=q;else if(!(this.isCollapsed()||""===a||(l=p.getParent(),q.canInsertTextBefore()&&q.canInsertTextAfter()&&(!E(l)||l.canInsertTextBefore()&&l.canInsertTextAfter())))){this.insertText("");Te(this.anchor,this.focus,null);this.insertText(a);return}if(1===
|
||||
+h)if(b.isToken())a=K(a),a.select(),b.replace(a);else{g=b.getFormat();h=b.getStyle();if(c===m&&(g!==e||h!==f))if(""===b.getTextContent())b.setFormat(e),b.setStyle(f);else{g=K(a);g.setFormat(e);g.setStyle(f);g.select();0===c?b.insertBefore(g,!1):([h]=b.splitText(c),h.insertAfter(g,!1));g.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length);return}else if(Je(b)){a=K(a);a.setFormat(e);a.setStyle(f);a.select();b.replace(a);return}b=b.spliceText(c,m-c,a,!0);""===b.getTextContent()?b.remove():
|
||||
"text"===this.anchor.type&&(b.isComposing()?this.anchor.offset-=a.length:(this.format=g,this.style=h))}else{e=new Set([...b.getParentKeys(),...p.getParentKeys()]);l=E(b)?b:b.getParentOrThrow();f=E(p)?p:p.getParentOrThrow();q=p;if(!l.is(f)&&f.isInline()){do q=f,f=f.getParentOrThrow();while(f.isInline())}if("text"===k.type&&(0!==m||""===p.getTextContent())||"element"===k.type&&p.getIndexWithinParent()<m)if(B(p)&&!p.isToken()&&m!==p.getTextContentSize()){if(p.isSegmented()){var r=K(p.getTextContent());
|
||||
p.replace(r);p=r}L(k.getNode())||"text"!==k.type||(p=p.spliceText(0,m,""));e.add(p.__key)}else k=p.getParentOrThrow(),k.canBeEmpty()||1!==k.getChildrenSize()?p.remove():k.remove();else e.add(p.__key);k=f.getChildren();m=new Set(g);p=l.is(f);l=l.isInline()&&null===b.getNextSibling()?l:b;for(r=k.length-1;0<=r;r--){let w=k[r];if(w.is(b)||E(w)&&w.isParentOf(b))break;w.isAttached()&&(!m.has(w)||w.is(q)?p||l.insertAfter(w,!1):w.remove())}if(!p)for(k=f,f=null;null!==k;){m=k.getChildren();p=m.length;if(0===
|
||||
p||m[p-1].is(f))e.delete(k.__key),f=k;k=k.getParent()}b.isToken()?c===d?b.select():(a=K(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<h;a++)b=g[a],e.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){if(this.isCollapsed())this.toggleFormat(a),H(null);else{var b=this.getNodes(),c=[];for(var d of b)B(d)&&c.push(d);var e=c.length;if(0===e)this.toggleFormat(a),
|
||||
H(null);else{d=this.anchor;var f=this.focus,g=this.isBackward();b=g?f:d;d=g?d:f;var h=0,k=c[0];f="element"===b.type?0:b.offset;"text"===b.type&&f===k.getTextContentSize()&&(h=1,k=c[1],f=0);if(null!=k){g=k.getFormatFlags(a,null);var m=e-1,q=c[m];e="text"===d.type?d.offset:q.getTextContentSize();if(k.is(q))f!==e&&(0===f&&e===k.getTextContentSize()?k.setFormat(g):(a=k.splitText(f,e),a=0===f?a[0]:a[1],a.setFormat(g),"text"===b.type&&b.set(a.__key,0,"text"),"text"===d.type&&d.set(a.__key,e-f,"text")),
|
||||
this.format=g);else{0!==f&&([,k]=k.splitText(f),f=0);k.setFormat(g);var p=q.getFormatFlags(a,g);0<e&&(e!==q.getTextContentSize()&&([q]=q.splitText(e)),q.setFormat(p));for(h+=1;h<m;h++){let l=c[h];if(!l.isToken()){let r=l.getFormatFlags(a,p);l.setFormat(r)}}"text"===b.type&&b.set(k.__key,f,"text");"text"===d.type&&d.set(q.__key,e,"text");this.format=g|p}}}}}insertNodes(a){if(0!==a.length){if("root"===this.anchor.key){this.insertParagraph();var b=u();C(b)||n(134);return b.insertNodes(a)}b=this.isBackward()?
|
||||
-this.focus:this.anchor;var c=Fc(b.getNode(),Dc);b=a[a.length-1];if("__language"in c&&E(c))if("__language"in a[0])this.insertText(a[0].getTextContent());else{var d=Te(this);c.splice(d,0,a);b.selectEnd()}else if(a.some(g=>(E(g)||y(g))&&!g.isInline())){b=Ue(a);a=b.getLastDescendant();var e=b.getChildren();b=E(c)&&c.isEmpty()?null:this.insertParagraph();d=e[e.length-1];var f=e[0];(g=>E(g)&&Dc(g)&&!g.isEmpty()&&E(c)&&(!c.isEmpty()||"__value"in c&&"__checked"in c))(f)&&(E(c)||n(135),c.append(...f.getChildren()),
|
||||
-f=e[1]);f&&ce(c,f);e=Fc(a,Dc);b&&E(e)&&("__value"in b&&"__checked"in b||Dc(d))&&(e.append(...b.getChildren()),b.remove());E(c)&&c.isEmpty()&&c.remove();a.selectEnd();a=E(c)?c.getLastChild():null;Ec(a)&&e!==c&&a.remove()}else E(c)||n(135),d=Te(this),c.splice(d,0,a),b.selectEnd()}}insertParagraph(){if("root"===this.anchor.key){var a=be();J().splice(this.anchor.offset,0,[a]);a.select();return a}var b=Te(this);a=Fc(this.anchor.getNode(),Dc);E(a)||n(136);b=(b=a.getChildAtIndex(b))?[b,...b.getNextSiblings()]:
|
||||
-[];return(a=a.insertNewAfter(this,!1))?(a.append(...b),a.selectStart(),a):null}insertLineBreak(a){var b=ge();this.insertNodes([b]);a&&(a=b.getParentOrThrow(),b=b.getIndexWithinParent(),a.select(b,b))}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=Qe(this);if(0===b)return[];if(1===b)return B(f)&&!this.isCollapsed()?(a=h>k?k:h,c=f.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);B(f)&&(d=b?h:k,d===f.getTextContentSize()?
|
||||
-a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));B(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=rc(d,b);if(y(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=Ve(),b.add(g.__key),zb(b)):(a=b?g.getPreviousSibling():g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),E(a)?(c=a.__key,g=b?a.getChildrenSize():0):
|
||||
-(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(e=F(),d=wb(e._window)){var h=e._blockCursorElement,k=e._rootElement;null===k||null===h||!E(g)||g.isInline()||g.canBeEmpty()||Bc(h,e,k);d.modify(a,b?"backward":"forward",c);if(0<d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),e=L(e)?e:vc(e),this.applyDOMRange(g),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(h=0;h<f.length;h++)k=f[h],uc(k,e)?a.push(k):c=!0;c&&0<a.length&&(b?(b=a[0],E(b)?
|
||||
-b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-1],E(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,Ne(f,b.key,b.offset,b.type),Ne(b,d,g,e),this._cachedNodes=null}}}deleteCharacter(a){let b=this.isCollapsed();if(this.isCollapsed()){var c=this.anchor,d=this.focus,e=c.getNode();if(!a&&("element"===c.type&&E(e)&&c.offset===e.getChildrenSize()||"text"===c.type&&
|
||||
-c.offset===e.getTextContentSize())){var f=e.getParent();f=e.getNextSibling()||(null===f?null:f.getNextSibling());if(E(f)&&f.isShadowRoot())return}f=rc(d,a);if(y(f)&&!f.isIsolated()){f.isKeyboardSelectable()&&E(e)&&0===e.getChildrenSize()?(e.remove(),a=Ve(),a.add(f.__key),zb(a)):(f.remove(),F().dispatchCommand(ba,void 0));return}if(!a&&E(f)&&E(e)&&e.isEmpty()){e.remove();f.selectStart();return}this.modify("extend",a,"character");if(!this.isCollapsed()){f="text"===d.type?d.getNode():null;e="text"===
|
||||
-c.type?c.getNode():null;if(null!==f&&f.isSegmented()){if(c=d.offset,d=f.getTextContentSize(),f.is(e)||a&&c!==d||!a&&0!==c){We(f,a,c);return}}else if(null!==e&&e.isSegmented()&&(c=c.offset,d=e.getTextContentSize(),e.is(f)||a&&0!==c||!a&&c!==d)){We(e,a,c);return}e=this.anchor;f=this.focus;c=e.getNode();d=f.getNode();if(c===d&&"text"===e.type&&"text"===f.type){var g=e.offset,h=f.offset;let k=g<h;d=k?g:h;h=k?h:g;g=h-1;d!==g&&(c=c.getTextContent().slice(d,h),ic(c)||(a?f.offset=g:e.offset=g))}}else if(a&&
|
||||
+this.focus:this.anchor;var c=Gc(b.getNode(),Ec);b=a[a.length-1];if("__language"in c&&E(c))if("__language"in a[0])this.insertText(a[0].getTextContent());else{var d=Ue(this);c.splice(d,0,a);b.selectEnd()}else if(a.some(g=>(E(g)||y(g))&&!g.isInline())){b=Ve(a);a=b.getLastDescendant();var e=b.getChildren();b=E(c)&&c.isEmpty()?null:this.insertParagraph();d=e[e.length-1];var f=e[0];(g=>E(g)&&Ec(g)&&!g.isEmpty()&&E(c)&&(!c.isEmpty()||"__value"in c&&"__checked"in c))(f)&&(E(c)||n(135),c.append(...f.getChildren()),
|
||||
+f=e[1]);f&&de(c,f);e=Gc(a,Ec);b&&E(e)&&("__value"in b&&"__checked"in b||Ec(d))&&(e.append(...b.getChildren()),b.remove());E(c)&&c.isEmpty()&&c.remove();a.selectEnd();a=E(c)?c.getLastChild():null;Fc(a)&&e!==c&&a.remove()}else E(c)||n(135),d=Ue(this),c.splice(d,0,a),b.selectEnd()}}insertParagraph(){if("root"===this.anchor.key){var a=ce();J().splice(this.anchor.offset,0,[a]);a.select();return a}var b=Ue(this);a=Gc(this.anchor.getNode(),Ec);E(a)||n(136);b=(b=a.getChildAtIndex(b))?[b,...b.getNextSiblings()]:
|
||||
+[];return(a=a.insertNewAfter(this,!1))?(a.append(...b),a.selectStart(),a):null}insertLineBreak(a){var b=he();this.insertNodes([b]);a&&(a=b.getParentOrThrow(),b=b.getIndexWithinParent(),a.select(b,b))}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=Re(this);if(0===b)return[];if(1===b)return B(f)&&!this.isCollapsed()?(a=h>k?k:h,c=f.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);B(f)&&(d=b?h:k,d===f.getTextContentSize()?
|
||||
+a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));B(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=sc(d,b);if(y(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=We(),b.add(g.__key),Ab(b)):(a=b?g.getPreviousSibling():g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),E(a)?(c=a.__key,g=b?a.getChildrenSize():0):
|
||||
+(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(e=F(),d=xb(e._window)){var h=e._blockCursorElement,k=e._rootElement;null===k||null===h||!E(g)||g.isInline()||g.canBeEmpty()||Cc(h,e,k);d.modify(a,b?"backward":"forward",c);if(0<d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),e=L(e)?e:wc(e),this.applyDOMRange(g),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(h=0;h<f.length;h++)k=f[h],vc(k,e)?a.push(k):c=!0;c&&0<a.length&&(b?(b=a[0],E(b)?
|
||||
+b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-1],E(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,Oe(f,b.key,b.offset,b.type),Oe(b,d,g,e),this._cachedNodes=null}}}deleteCharacter(a){let b=this.isCollapsed();if(this.isCollapsed()){var c=this.anchor,d=this.focus,e=c.getNode();if(!a&&("element"===c.type&&E(e)&&c.offset===e.getChildrenSize()||"text"===c.type&&
|
||||
+c.offset===e.getTextContentSize())){var f=e.getParent();f=e.getNextSibling()||(null===f?null:f.getNextSibling());if(E(f)&&f.isShadowRoot())return}f=sc(d,a);if(y(f)&&!f.isIsolated()){f.isKeyboardSelectable()&&E(e)&&0===e.getChildrenSize()?(e.remove(),a=We(),a.add(f.__key),Ab(a)):(f.remove(),F().dispatchCommand(ba,void 0));return}if(!a&&E(f)&&E(e)&&e.isEmpty()){e.remove();f.selectStart();return}this.modify("extend",a,"character");if(!this.isCollapsed()){f="text"===d.type?d.getNode():null;e="text"===
|
||||
+c.type?c.getNode():null;if(null!==f&&f.isSegmented()){if(c=d.offset,d=f.getTextContentSize(),f.is(e)||a&&c!==d||!a&&0!==c){Xe(f,a,c);return}}else if(null!==e&&e.isSegmented()&&(c=c.offset,d=e.getTextContentSize(),e.is(f)||a&&0!==c||!a&&c!==d)){Xe(e,a,c);return}e=this.anchor;f=this.focus;c=e.getNode();d=f.getNode();if(c===d&&"text"===e.type&&"text"===f.type){var g=e.offset,h=f.offset;let k=g<h;d=k?g:h;h=k?h:g;g=h-1;d!==g&&(c=c.getTextContent().slice(d,h),jc(c)||(a?f.offset=g:e.offset=g))}}else if(a&&
|
||||
0===c.offset&&("element"===c.type?c.getNode():c.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText();a&&!b&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset&&(a=this.anchor.getNode(),a.isEmpty()&&L(a.getParent())&&0===a.getIndexWithinParent()&&a.collapseAtStart(this))}deleteLine(a){this.isCollapsed()&&("text"===this.anchor.type&&this.modify("extend",a,"lineboundary"),0===(a?this.focus:this.anchor).offset&&this.modify("extend",a,"character"));this.removeText()}deleteWord(a){this.isCollapsed()&&
|
||||
-this.modify("extend",a,"word");this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Sd(a){return a instanceof Oe}function Xe(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}function Qe(a){a=a.getStartEndPoints();if(null===a)return[0,0];let [b,c]=a;return"element"===b.type&&"element"===c.type&&b.key===c.key&&b.offset===c.offset?[0,0]:[Xe(b),Xe(c)]}
|
||||
-function We(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),e=d.length,f=0,g=0;for(let h=0;h<e;h++){let k=d[h],m=h===e-1;g=f;f+=k.length;if(b&&f===c||f>c||m){d.splice(h,1);m&&(g=void 0);break}}b=d.join("").trim();""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
|
||||
-function Ye(a,b,c,d){var e=b;if(1===a.nodeType){let h=!1;var f=a.childNodes,g=f.length;e===g&&(h=!0,e=g-1);let k=f[e];g=!1;k===d._blockCursorElement?(k=f[e+1],g=!0):null!==d._blockCursorElement&&e--;d=hc(k);if(B(d))e=h?d.getTextContentSize():0;else{f=hc(a);if(null===f)return null;if(E(f)){a=f.getChildAtIndex(e);if(b=E(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=h?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,e=0):(a=c,f=E(a)?a:a.getParentOrThrow()));
|
||||
-B(a)?(d=a,f=null,e=h?a.getTextContentSize():0):a!==f&&h&&!g&&e++}else e=f.getIndexWithinParent(),e=0===b&&y(f)&&hc(a)===f?e:e+1,f=f.getParentOrThrow();if(E(f))return Ke(f.__key,e,"element")}}else d=hc(a);return B(d)?Ke(d.__key,e,"text"):null}
|
||||
-function Ze(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&E(e)&&e.isInline()&&(b=e.getPreviousSibling(),B(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):E(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):B(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&E(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
|
||||
-b)&&null===d&&E(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function Se(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);Ze(a,d,e);Ze(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=F();d.isComposing()&&d._compositionKey!==a.key&&C(c)&&(d=c.anchor,c=c.focus,Ne(a,d.key,d.offset,d.type),Ne(b,c.key,c.offset,c.type))}}
|
||||
-function Re(a,b,c,d,e,f){if(null===a||null===c||!Sb(e,a,c))return null;b=Ye(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=Ye(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=hc(a),c=hc(c),y(a)&&y(c)))return null;Se(b,d,f);return[b,d]}function re(a,b,c,d,e,f){let g=$b();a=new Pe(Ke(a,b,e),Ke(c,d,f),0,"");a.dirty=!0;return g._selection=a}function Ve(){return new Oe(new Set)}
|
||||
-function $e(a){let b=a.getEditorState()._selection,c=wb(a._window);return C(b)||null==b?Od(b,c,a,null):b.clone()}
|
||||
-function Od(a,b,c,d){var e=c._window;if(null===e)return null;var f=(e=d||e.event)?e.type:void 0;d="selectionchange"===f;e=!pb&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!C(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&C(a)&&!Sb(c,e,f))return a.clone()}else return a.clone();c=Re(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new Pe(h,k,C(a)?a.format:
|
||||
-0,C(a)?a.style:"")}function u(){return $b()._selection}function mc(){return F()._editorState._selection}
|
||||
-function Zd(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h)){g=b.__key;if(a.isCollapsed()){if(b=e.offset,c<=b&&0<d||c<b&&0>d)c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),af(a)}else{let m=a.isBackward();h=m?f:e;var k=h.getNode();e=m?e:f;f=e.getNode();b.is(k)&&(k=h.offset,(c<=k&&0<d||c<k&&0>d)&&h.set(g,Math.max(0,k+d),"element"));b.is(f)&&(b=e.offset,(c<=b&&0<d||c<b&&0>d)&&e.set(g,Math.max(0,b+d),"element"))}af(a)}}
|
||||
-function af(a){var b=a.anchor,c=b.offset;let d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())E(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),B(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(E(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);B(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}E(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
|
||||
-1):g.getChildAtIndex(e),B(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function bf(a,b){b=b.getEditorState()._selection;a=a._selection;if(C(a)){var c=a.anchor;let d=a.focus,e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
|
||||
-function Yd(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):E(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,B(e)?h="text":E(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function se(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
|
||||
-function Te(a){a.isCollapsed()||a.removeText();var b=a.anchor;a=b.getNode();for(b=b.offset;!Dc(a);)[a,b]=cf(a,b);return b}
|
||||
-function cf(a,b){var c=a.getParent();if(!c)return c=be(),J().append(c),c.select(),[J(),0];if(B(a)){var d=a.splitText(b);if(0===d.length)return[c,a.getIndexWithinParent()];a=0===b?0:1;a=d[0].getIndexWithinParent()+a;return[c,a]}if(!E(a)||0===b)return[c,a.getIndexWithinParent()];if(d=a.getChildAtIndex(b))b=new Pe(Ke(a.__key,b,"element"),Ke(a.__key,b,"element"),0,""),(b=a.insertNewAfter(b))&&b.append(d,...d.getNextSiblings());return[c,a.getIndexWithinParent()+1]}
|
||||
-function Ue(a){let b=be(),c=null;for(let d=0;d<a.length;d++){let e=a[d],f=Ec(e);if(f||y(e)&&e.isInline()||E(e)&&e.isInline()||B(e)||e.isParentRequired()){if(null===c&&(c=e.createParentElementNode(),b.append(c),f))continue;null!==c&&c.append(e)}else b.append(e),c=null}return b}let S=null,T=null,U=!1,df=!1,Zb=0,ef={characterData:!0,childList:!0,subtree:!0};function dc(){return U||null!==S&&S._readOnly}function G(){U&&n(13)}function $b(){null===S&&n(15);return S}
|
||||
-function F(){null===T&&n(16);return T}function ff(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&n(30,d);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function gf(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),B(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&Gb(b)}
|
||||
-function hf(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=cc(),f=new Map;var g=c;let h=g.size;for(var k=d,m=k.size;0<h||0<m;){if(0<h){b._dirtyLeaves=new Set;for(let q of g)g=a.get(q),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&Gb(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ff(b,g,f),c.add(q);g=b._dirtyLeaves;h=g.size;if(0<h){Zb++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let q of k)if(k=q[0],m=q[1],"root"===k||m)g=a.get(k),void 0!==
|
||||
-g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ff(b,g,f),d.set(k,m);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;m=k.size;Zb++}b._dirtyLeaves=c;b._dirtyElements=d}function jf(a,b){var c=a.type,d=b.get(c);void 0===d&&n(17,c);c=d.klass;a.type!==c.getType()&&n(18,c.name);c=c.importJSON(a);a=a.children;if(E(c)&&Array.isArray(a))for(d=0;d<a.length;d++){let e=jf(a[d],b);c.append(e)}return c}function kf(a,b){let c=S,d=U,e=T;S=a;U=!0;T=null;try{return b()}finally{S=c,U=d,T=e}}
|
||||
-function lf(a,b){let c=a._pendingEditorState,d=a._rootElement,e=a._headless||null===d;if(null!==c){var f=a._editorState,g=f._selection,h=c._selection,k=0!==a._dirtyType,m=S,q=U,p=T,l=a._updating,r=a._observer,w=null;a._pendingEditorState=null;a._editorState=c;if(!e&&k&&null!==r){T=a;S=c;U=!1;a._updating=!0;try{let D=a._dirtyType,P=a._dirtyElements,Q=a._dirtyLeaves;r.disconnect();var A=D,x=P,z=Q;N=Ic=M="";Lc=2===A;Oc=null;O=a;Jc=a._config;Kc=a._nodes;Nc=O._listeners.mutation;Pc=x;Zc=z;$c=f._nodeMap;
|
||||
-ad=c._nodeMap;Mc=c._readOnly;bd=new Map(a._keyToDOMMap);let ha=new Map;cd=ha;qd("root",null);cd=bd=Jc=ad=$c=Zc=Pc=Kc=O=void 0;w=ha}catch(D){D instanceof Error&&a._onError(D);if(df)throw D;mf(a,null,d,c);Cb(a);a._dirtyType=2;df=!0;lf(a,f);df=!1;return}finally{r.observe(d,ef),a._updating=l,S=m,U=q,T=p}}c._readOnly||(c._readOnly=!0);var aa=a._dirtyLeaves,W=a._dirtyElements,Ua=a._normalizedNodes,ja=a._updateTags,Qc=a._deferred;k&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=
|
||||
-new Map,a._normalizedNodes=new Set,a._updateTags=new Set);var we=a._decorators,Lb=a._pendingDecorators||we,yf=c._nodeMap,Rc;for(Rc in Lb)yf.has(Rc)||(Lb===we&&(Lb=ec(a)),delete Lb[Rc]);var ia=e?null:wb(a._window);if(a._editable&&null!==ia&&(k||null===h||h.dirty)){T=a;S=c;try{null!==r&&r.disconnect();if(k||null===h||h.dirty){let D=a._blockCursorElement;null!==D&&Bc(D,a,d);a:{let P=ia.anchorNode,Q=ia.focusNode,ha=ia.anchorOffset,ib=ia.focusOffset,X=document.activeElement;if(!(ja.has("collaboration")&&
|
||||
-X!==d||null!==X&&Rb(X)))if(C(h)){var jb=h.anchor,Sc=h.focus,xe=jb.key,zf=Sc.key,ye=tc(a,xe),ze=tc(a,zf),Mb=jb.offset,Ae=Sc.offset,Tc=h.format,Uc=h.style,Be=h.isCollapsed(),kb=ye,Nb=ze,Vc=!1;if("text"===jb.type){kb=Wb(ye);let Y=jb.getNode();Vc=Y.getFormat()!==Tc||Y.getStyle()!==Uc}else C(g)&&"text"===g.anchor.type&&(Vc=!0);"text"===Sc.type&&(Nb=Wb(ze));if(null!==kb&&null!==Nb){if(Be&&(null===g||Vc||C(g)&&(g.format!==Tc||g.style!==Uc))){var Af=performance.now();Kd=[Tc,Uc,Mb,xe,Af]}if(ha===Mb&&ib===
|
||||
-Ae&&P===kb&&Q===Nb&&("Range"!==ia.type||!Be)&&(null!==X&&d.contains(X)||d.focus({preventScroll:!0}),"element"!==jb.type))break a;try{ia.setBaseAndExtent(kb,Mb,Nb,Ae)}catch(Y){}if(!ja.has("skip-scroll-into-view")&&h.isCollapsed()&&null!==d&&d===document.activeElement){let Y=h instanceof Pe&&"element"===h.anchor.type?kb.childNodes[Mb]||null:0<ia.rangeCount?ia.getRangeAt(0):null;if(null!==Y){let Z;if(Y instanceof Text){let V=document.createRange();V.selectNode(Y);Z=V.getBoundingClientRect()}else Z=Y.getBoundingClientRect();
|
||||
-let xa=d.ownerDocument,Ea=xa.defaultView;if(null!==Ea)for(var {top:Wc,bottom:Xc}=Z,Ob,Pb,na=d;null!==na;){let V=na===xa.body;if(V)Ob=0,Pb=Db(a).innerHeight;else{let Qb=na.getBoundingClientRect();Ob=Qb.top;Pb=Qb.bottom}let Fa=0;Wc<Ob?Fa=-(Ob-Wc):Xc>Pb&&(Fa=Xc-Pb);if(0!==Fa)if(V)Ea.scrollBy(0,Fa);else{let Qb=na.scrollTop;na.scrollTop+=Fa;let Ce=na.scrollTop-Qb;Wc-=Ce;Xc-=Ce}if(V)break;na=Ub(na)}}}Gd=!0}}else null!==g&&Sb(a,P,Q)&&ia.removeAllRanges()}}a:{let D=a._blockCursorElement;if(C(h)&&h.isCollapsed()&&
|
||||
-"element"===h.anchor.type&&d.contains(document.activeElement)){let P=h.anchor,Q=P.getNode(),ha=P.offset,ib=Q.getChildrenSize(),X=!1,Y=null;if(ha===ib){let Z=Q.getChildAtIndex(ha-1);Ac(Z)&&(X=!0)}else{let Z=Q.getChildAtIndex(ha);if(Ac(Z)){let xa=Z.getPreviousSibling();if(null===xa||Ac(xa))X=!0,Y=a.getElementByKey(Z.__key)}}if(X){let Z=a.getElementByKey(Q.__key);if(null===D){let xa=a._config.theme,Ea=document.createElement("div");Ea.contentEditable="false";Ea.setAttribute("data-lexical-cursor","true");
|
||||
-let V=xa.blockCursor;if(void 0!==V){if("string"===typeof V){let Fa=V.split(" ");V=xa.blockCursor=Fa}void 0!==V&&Ea.classList.add(...V)}a._blockCursorElement=D=Ea}d.style.caretColor="transparent";null===Y?Z.appendChild(D):Z.insertBefore(D,Y);break a}}null!==D&&Bc(D,a,d)}null!==r&&r.observe(d,ef)}finally{T=p,S=m}}if(null!==w){var Bf=w;let D=Array.from(a._listeners.mutation),P=D.length;for(let Q=0;Q<P;Q++){let [ha,ib]=D[Q],X=Bf.get(ib);void 0!==X&&ha(X,{dirtyLeaves:aa,prevEditorState:f,updateTags:ja})}}C(h)||
|
||||
-null===h||null!==g&&g.is(h)||a.dispatchCommand(ba,void 0);var Yc=a._pendingDecorators;null!==Yc&&(a._decorators=Yc,a._pendingDecorators=null,nf("decorator",a,!0,Yc));var Cf=fc(b||f),De=fc(c);Cf!==De&&nf("textcontent",a,!0,De);nf("update",a,!0,{dirtyElements:W,dirtyLeaves:aa,editorState:c,normalizedNodes:Ua,prevEditorState:b||f,tags:ja});a._deferred=[];if(0!==Qc.length){let D=a._updating;a._updating=!0;try{for(let P=0;P<Qc.length;P++)Qc[P]()}finally{a._updating=D}}var Ee=a._updates;if(0!==Ee.length){let D=
|
||||
-Ee.shift();if(D){let [P,Q]=D;of(a,P,Q)}}}}function nf(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}
|
||||
-function R(a,b,c){if(!1===a._updating||T!==a){let f=!1;a.update(()=>{f=R(a,b,c)});return f}let d=jc(a);for(let f=4;0<=f;f--)for(let g=0;g<d.length;g++){var e=d[g]._commands.get(b);if(void 0!==e&&(e=e[f],void 0!==e)){e=Array.from(e);let h=e.length;for(let k=0;k<h;k++)if(!0===e[k](c,a))return!0}}return!1}
|
||||
-function pf(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [e,f]=d,g;void 0!==f&&(d=f.onUpdate,g=f.tag,f.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));e()}}return b}
|
||||
-function of(a,b,c){let d=a._updateTags;var e,f=e=!1;if(void 0!==c){var g=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms||!1;f=c.discrete||!1}g&&a._deferred.push(g);c=a._editorState;g=a._pendingEditorState;let h=!1;if(null===g||g._readOnly)g=a._pendingEditorState=new qf(new Map((g||c)._nodeMap)),h=!0;g._flushSync=f;f=S;let k=U,m=T,q=a._updating;S=g;U=!1;a._updating=!0;T=a;try{h&&(a._headless?null!==c._selection&&(g._selection=c._selection.clone()):g._selection=$e(a));let p=a._compositionKey;
|
||||
-b();e=pf(a,e);bf(g,a);0!==a._dirtyType&&(e?gf(g,a):hf(g,a),pf(a),Hc(c,g,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&(g._flushSync=!0);let l=g._selection;if(C(l)){let r=g._nodeMap,w=l.focus.key;void 0!==r.get(l.anchor.key)&&void 0!==r.get(w)||n(19)}else Sd(l)&&0===l._nodes.size&&(g._selection=null)}catch(p){p instanceof Error&&a._onError(p);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();lf(a);return}finally{S=f,U=k,T=m,
|
||||
-a._updating=q,Zb=0}0!==a._dirtyType||rf(g,a)?g._flushSync?(g._flushSync=!1,lf(a)):h&&Kb(()=>{lf(a)}):(g._flushSync=!1,h&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function v(a,b,c){a._updating?a._updates.push([b,c]):of(a,b,c)}class sf extends $d{constructor(a){super(a)}decorate(){n(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function y(a){return a instanceof sf}
|
||||
-class tf extends $d{constructor(a){super(a);this.__last=this.__first=null;this.__indent=this.__format=this.__size=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return mb[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getChildrenKeys(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b.__key),b=b.getNextSibling();return a}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===
|
||||
+this.modify("extend",a,"word");this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Td(a){return a instanceof Pe}function Ye(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}function Re(a){a=a.getStartEndPoints();if(null===a)return[0,0];let [b,c]=a;return"element"===b.type&&"element"===c.type&&b.key===c.key&&b.offset===c.offset?[0,0]:[Ye(b),Ye(c)]}
|
||||
+function Xe(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),e=d.length,f=0,g=0;for(let h=0;h<e;h++){let k=d[h],m=h===e-1;g=f;f+=k.length;if(b&&f===c||f>c||m){d.splice(h,1);m&&(g=void 0);break}}b=d.join("").trim();""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
|
||||
+function Ze(a,b,c,d){var e=b;if(1===a.nodeType){let h=!1;var f=a.childNodes,g=f.length;e===g&&(h=!0,e=g-1);let k=f[e];g=!1;k===d._blockCursorElement?(k=f[e+1],g=!0):null!==d._blockCursorElement&&e--;d=ic(k);if(B(d))e=h?d.getTextContentSize():0;else{f=ic(a);if(null===f)return null;if(E(f)){a=f.getChildAtIndex(e);if(b=E(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=h?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,e=0):(a=c,f=E(a)?a:a.getParentOrThrow()));
|
||||
+B(a)?(d=a,f=null,e=h?a.getTextContentSize():0):a!==f&&h&&!g&&e++}else e=f.getIndexWithinParent(),e=0===b&&y(f)&&ic(a)===f?e:e+1,f=f.getParentOrThrow();if(E(f))return Le(f.__key,e,"element")}}else d=ic(a);return B(d)?Le(d.__key,e,"text"):null}
|
||||
+function $e(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&E(e)&&e.isInline()&&(b=e.getPreviousSibling(),B(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):E(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):B(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&E(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
|
||||
+b)&&null===d&&E(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function Te(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);$e(a,d,e);$e(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=F();d.isComposing()&&d._compositionKey!==a.key&&C(c)&&(d=c.anchor,c=c.focus,Oe(a,d.key,d.offset,d.type),Oe(b,c.key,c.offset,c.type))}}
|
||||
+function Se(a,b,c,d,e,f){if(null===a||null===c||!Tb(e,a,c))return null;b=Ze(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=Ze(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=ic(a),c=ic(c),y(a)&&y(c)))return null;Te(b,d,f);return[b,d]}function se(a,b,c,d,e,f){let g=ac();a=new Qe(Le(a,b,e),Le(c,d,f),0,"");a.dirty=!0;return g._selection=a}function We(){return new Pe(new Set)}
|
||||
+function af(a){let b=a.getEditorState()._selection,c=xb(a._window);return C(b)||null==b?Pd(b,c,a,null):b.clone()}
|
||||
+function Pd(a,b,c,d){var e=c._window;if(null===e)return null;var f=(e=d||e.event)?e.type:void 0;d="selectionchange"===f;e=!qb&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!C(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&C(a)&&!Tb(c,e,f))return a.clone()}else return a.clone();c=Se(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new Qe(h,k,C(a)?a.format:
|
||||
+0,C(a)?a.style:"")}function u(){return ac()._selection}function nc(){return F()._editorState._selection}
|
||||
+function $d(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h)){g=b.__key;if(a.isCollapsed()){if(b=e.offset,c<=b&&0<d||c<b&&0>d)c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),bf(a)}else{let m=a.isBackward();h=m?f:e;var k=h.getNode();e=m?e:f;f=e.getNode();b.is(k)&&(k=h.offset,(c<=k&&0<d||c<k&&0>d)&&h.set(g,Math.max(0,k+d),"element"));b.is(f)&&(b=e.offset,(c<=b&&0<d||c<b&&0>d)&&e.set(g,Math.max(0,b+d),"element"))}bf(a)}}
|
||||
+function bf(a){var b=a.anchor,c=b.offset;let d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())E(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),B(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(E(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);B(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}E(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
|
||||
+1):g.getChildAtIndex(e),B(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function cf(a,b){b=b.getEditorState()._selection;a=a._selection;if(C(a)){var c=a.anchor;let d=a.focus,e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
|
||||
+function Zd(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):E(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,B(e)?h="text":E(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function te(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
|
||||
+function Ue(a){a.isCollapsed()||a.removeText();var b=a.anchor;a=b.getNode();for(b=b.offset;!Ec(a);)[a,b]=df(a,b);return b}
|
||||
+function df(a,b){var c=a.getParent();if(!c)return c=ce(),J().append(c),c.select(),[J(),0];if(B(a)){var d=a.splitText(b);if(0===d.length)return[c,a.getIndexWithinParent()];a=0===b?0:1;a=d[0].getIndexWithinParent()+a;return[c,a]}if(!E(a)||0===b)return[c,a.getIndexWithinParent()];if(d=a.getChildAtIndex(b))b=new Qe(Le(a.__key,b,"element"),Le(a.__key,b,"element"),0,""),(b=a.insertNewAfter(b))&&b.append(d,...d.getNextSiblings());return[c,a.getIndexWithinParent()+1]}
|
||||
+function Ve(a){let b=ce(),c=null;for(let d=0;d<a.length;d++){let e=a[d],f=Fc(e);if(f||y(e)&&e.isInline()||E(e)&&e.isInline()||B(e)||e.isParentRequired()){if(null===c&&(c=e.createParentElementNode(),b.append(c),f))continue;null!==c&&c.append(e)}else b.append(e),c=null}return b}let S=null,T=null,U=!1,ef=!1,$b=0,ff={characterData:!0,childList:!0,subtree:!0};function ec(){return U||null!==S&&S._readOnly}function G(){U&&n(13)}function ac(){null===S&&n(15);return S}
|
||||
+function F(){null===T&&n(16);return T}function gf(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&n(30,d);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function hf(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),B(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&Hb(b)}
|
||||
+function jf(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=dc(),f=new Map;var g=c;let h=g.size;for(var k=d,m=k.size;0<h||0<m;){if(0<h){b._dirtyLeaves=new Set;for(let q of g)g=a.get(q),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&Hb(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&gf(b,g,f),c.add(q);g=b._dirtyLeaves;h=g.size;if(0<h){$b++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let q of k)if(k=q[0],m=q[1],"root"===k||m)g=a.get(k),void 0!==
|
||||
+g&&void 0!==g&&g.__key!==e&&g.isAttached()&&gf(b,g,f),d.set(k,m);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;m=k.size;$b++}b._dirtyLeaves=c;b._dirtyElements=d}function kf(a,b){var c=a.type,d=b.get(c);void 0===d&&n(17,c);c=d.klass;a.type!==c.getType()&&n(18,c.name);c=c.importJSON(a);a=a.children;if(E(c)&&Array.isArray(a))for(d=0;d<a.length;d++){let e=kf(a[d],b);c.append(e)}return c}function lf(a,b){let c=S,d=U,e=T;S=a;U=!0;T=null;try{return b()}finally{S=c,U=d,T=e}}
|
||||
+function mf(a,b){let c=a._pendingEditorState,d=a._rootElement,e=a._headless||null===d;if(null!==c){var f=a._editorState,g=f._selection,h=c._selection,k=0!==a._dirtyType,m=S,q=U,p=T,l=a._updating,r=a._observer,w=null;a._pendingEditorState=null;a._editorState=c;if(!e&&k&&null!==r){T=a;S=c;U=!1;a._updating=!0;try{let D=a._dirtyType,P=a._dirtyElements,Q=a._dirtyLeaves;r.disconnect();var A=D,x=P,z=Q;N=Jc=M="";Mc=2===A;Pc=null;O=a;Kc=a._config;Lc=a._nodes;Oc=O._listeners.mutation;Zc=x;$c=z;ad=f._nodeMap;
|
||||
+bd=c._nodeMap;Nc=c._readOnly;cd=new Map(a._keyToDOMMap);let ha=new Map;dd=ha;rd("root",null);dd=cd=Kc=bd=ad=$c=Zc=Lc=O=void 0;w=ha}catch(D){D instanceof Error&&a._onError(D);if(ef)throw D;nf(a,null,d,c);Db(a);a._dirtyType=2;ef=!0;mf(a,f);ef=!1;return}finally{r.observe(d,ff),a._updating=l,S=m,U=q,T=p}}c._readOnly||(c._readOnly=!0);var aa=a._dirtyLeaves,W=a._dirtyElements,Ua=a._normalizedNodes,ja=a._updateTags,Qc=a._deferred;k&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=
|
||||
+new Map,a._normalizedNodes=new Set,a._updateTags=new Set);var ye=a._decorators,Lb=a._pendingDecorators||ye,zf=c._nodeMap,Rc;for(Rc in Lb)zf.has(Rc)||(Lb===ye&&(Lb=fc(a)),delete Lb[Rc]);var ia=e?null:xb(a._window);if(a._editable&&null!==ia&&(k||null===h||h.dirty)){T=a;S=c;try{null!==r&&r.disconnect();if(k||null===h||h.dirty){let D=a._blockCursorElement;null!==D&&Cc(D,a,d);a:{let P=ia.anchorNode,Q=ia.focusNode,ha=ia.anchorOffset,ib=ia.focusOffset,X=document.activeElement;if(!(ja.has("collaboration")&&
|
||||
+X!==d||null!==X&&Sb(X)))if(C(h)){var jb=h.anchor,Sc=h.focus,ze=jb.key,Af=Sc.key,Ae=uc(a,ze),Be=uc(a,Af),Mb=jb.offset,Ce=Sc.offset,Tc=h.format,Uc=h.style,De=h.isCollapsed(),kb=Ae,Nb=Be,Vc=!1;if("text"===jb.type){kb=Xb(Ae);let Y=jb.getNode();Vc=Y.getFormat()!==Tc||Y.getStyle()!==Uc}else C(g)&&"text"===g.anchor.type&&(Vc=!0);"text"===Sc.type&&(Nb=Xb(Be));if(null!==kb&&null!==Nb){if(De&&(null===g||Vc||C(g)&&(g.format!==Tc||g.style!==Uc))){var Bf=performance.now();Ld=[Tc,Uc,Mb,ze,Bf]}if(ha===Mb&&ib===
|
||||
+Ce&&P===kb&&Q===Nb&&("Range"!==ia.type||!De)&&(null!==X&&d.contains(X)||d.focus({preventScroll:!0}),"element"!==jb.type))break a;try{ia.setBaseAndExtent(kb,Mb,Nb,Ce)}catch(Y){}if(!ja.has("skip-scroll-into-view")&&h.isCollapsed()&&null!==d&&d===document.activeElement){let Y=h instanceof Qe&&"element"===h.anchor.type?kb.childNodes[Mb]||null:0<ia.rangeCount?ia.getRangeAt(0):null;if(null!==Y){let Z;if(Y instanceof Text){let V=document.createRange();V.selectNode(Y);Z=V.getBoundingClientRect()}else Z=Y.getBoundingClientRect();
|
||||
+let xa=d.ownerDocument,Ea=xa.defaultView;if(null!==Ea)for(var {top:Wc,bottom:Xc}=Z,Ob,Pb,na=d;null!==na;){let V=na===xa.body;if(V)Ob=0,Pb=Eb(a).innerHeight;else{let Qb=na.getBoundingClientRect();Ob=Qb.top;Pb=Qb.bottom}let Fa=0;Wc<Ob?Fa=-(Ob-Wc):Xc>Pb&&(Fa=Xc-Pb);if(0!==Fa)if(V)Ea.scrollBy(0,Fa);else{let Qb=na.scrollTop;na.scrollTop+=Fa;let Ee=na.scrollTop-Qb;Wc-=Ee;Xc-=Ee}if(V)break;na=Vb(na)}}}Hd=!0}}else null!==g&&Tb(a,P,Q)&&ia.removeAllRanges()}}a:{let D=a._blockCursorElement;if(C(h)&&h.isCollapsed()&&
|
||||
+"element"===h.anchor.type&&d.contains(document.activeElement)){let P=h.anchor,Q=P.getNode(),ha=P.offset,ib=Q.getChildrenSize(),X=!1,Y=null;if(ha===ib){let Z=Q.getChildAtIndex(ha-1);Bc(Z)&&(X=!0)}else{let Z=Q.getChildAtIndex(ha);if(Bc(Z)){let xa=Z.getPreviousSibling();if(null===xa||Bc(xa))X=!0,Y=a.getElementByKey(Z.__key)}}if(X){let Z=a.getElementByKey(Q.__key);if(null===D){let xa=a._config.theme,Ea=document.createElement("div");Ea.contentEditable="false";Ea.setAttribute("data-lexical-cursor","true");
|
||||
+let V=xa.blockCursor;if(void 0!==V){if("string"===typeof V){let Fa=V.split(" ");V=xa.blockCursor=Fa}void 0!==V&&Ea.classList.add(...V)}a._blockCursorElement=D=Ea}d.style.caretColor="transparent";null===Y?Z.appendChild(D):Z.insertBefore(D,Y);break a}}null!==D&&Cc(D,a,d)}null!==r&&r.observe(d,ff)}finally{T=p,S=m}}if(null!==w){var Cf=w;let D=Array.from(a._listeners.mutation),P=D.length;for(let Q=0;Q<P;Q++){let [ha,ib]=D[Q],X=Cf.get(ib);void 0!==X&&ha(X,{dirtyLeaves:aa,prevEditorState:f,updateTags:ja})}}C(h)||
|
||||
+null===h||null!==g&&g.is(h)||a.dispatchCommand(ba,void 0);var Yc=a._pendingDecorators;null!==Yc&&(a._decorators=Yc,a._pendingDecorators=null,of("decorator",a,!0,Yc));var Df=gc(b||f),Fe=gc(c);Df!==Fe&&of("textcontent",a,!0,Fe);of("update",a,!0,{dirtyElements:W,dirtyLeaves:aa,editorState:c,normalizedNodes:Ua,prevEditorState:b||f,tags:ja});a._deferred=[];if(0!==Qc.length){let D=a._updating;a._updating=!0;try{for(let P=0;P<Qc.length;P++)Qc[P]()}finally{a._updating=D}}var Ge=a._updates;if(0!==Ge.length){let D=
|
||||
+Ge.shift();if(D){let [P,Q]=D;pf(a,P,Q)}}}}function of(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}
|
||||
+function R(a,b,c){if(!1===a._updating||T!==a){let f=!1;a.update(()=>{f=R(a,b,c)});return f}let d=kc(a);for(let f=4;0<=f;f--)for(let g=0;g<d.length;g++){var e=d[g]._commands.get(b);if(void 0!==e&&(e=e[f],void 0!==e)){e=Array.from(e);let h=e.length;for(let k=0;k<h;k++)if(!0===e[k](c,a))return!0}}return!1}
|
||||
+function qf(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [e,f]=d,g;void 0!==f&&(d=f.onUpdate,g=f.tag,f.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));e()}}return b}
|
||||
+function pf(a,b,c){let d=a._updateTags;var e,f=e=!1;if(void 0!==c){var g=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms||!1;f=c.discrete||!1}g&&a._deferred.push(g);c=a._editorState;g=a._pendingEditorState;let h=!1;if(null===g||g._readOnly)g=a._pendingEditorState=new rf(new Map((g||c)._nodeMap)),h=!0;g._flushSync=f;f=S;let k=U,m=T,q=a._updating;S=g;U=!1;a._updating=!0;T=a;try{h&&(a._headless?null!==c._selection&&(g._selection=c._selection.clone()):g._selection=af(a));let p=a._compositionKey;
|
||||
+b();e=qf(a,e);cf(g,a);0!==a._dirtyType&&(e?hf(g,a):jf(g,a),qf(a),Ic(c,g,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&(g._flushSync=!0);let l=g._selection;if(C(l)){let r=g._nodeMap,w=l.focus.key;void 0!==r.get(l.anchor.key)&&void 0!==r.get(w)||n(19)}else Td(l)&&0===l._nodes.size&&(g._selection=null)}catch(p){p instanceof Error&&a._onError(p);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();mf(a);return}finally{S=f,U=k,T=m,
|
||||
+a._updating=q,$b=0}0!==a._dirtyType||sf(g,a)?g._flushSync?(g._flushSync=!1,mf(a)):h&&Rb(()=>{mf(a)}):(g._flushSync=!1,h&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function v(a,b,c){a._updating?a._updates.push([b,c]):pf(a,b,c)}class tf extends ae{constructor(a){super(a)}decorate(){n(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function y(a){return a instanceof tf}
|
||||
+class uf extends ae{constructor(a){super(a);this.__last=this.__first=null;this.__indent=this.__format=this.__size=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return nb[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getChildrenKeys(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b.__key),b=b.getNextSibling();return a}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===
|
||||
this.getChildrenSize()}isDirty(){let a=F()._dirtyElements;return null!==a&&a.has(this.__key)}isLastChild(){let a=this.getLatest(),b=this.getParentOrThrow().getLastChild();return null!==b&&b.is(a)}getAllTextNodes(){let a=[],b=this.getFirstChild();for(;null!==b;){B(b)&&a.push(b);if(E(b)){let c=b.getAllTextNodes();a.push(...c)}b=b.getNextSibling()}return a}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(E(a)){let b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=
|
||||
this.getLastChild();for(;null!==a;){if(E(a)){let b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){let b=this.getChildren(),c=b.length;if(a>=c)return a=b[c-1],E(a)&&a.getLastDescendant()||a||null;a=b[a];return E(a)&&a.getFirstDescendant()||a||null}getFirstChild(){let a=this.getLatest().__first;return null===a?null:I(a)}getFirstChildOrThrow(){let a=this.getFirstChild();null===a&&n(45,this.__key);return a}getLastChild(){let a=this.getLatest().__last;return null===
|
||||
a?null:I(a)}getLastChildOrThrow(){let a=this.getLastChild();null===a&&n(96,this.__key);return a}getChildAtIndex(a){var b=this.getChildrenSize();let c;if(a<b/2){c=this.getFirstChild();for(b=0;null!==c&&b<=a;){if(b===a)return c;c=c.getNextSibling();b++}return null}c=this.getLastChild();for(--b;null!==c&&b>=a;){if(b===a)return c;c=c.getPreviousSibling();b--}return null}getTextContent(){let a="",b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContent();E(e)&&d!==c-1&&!e.isInline()&&
|
||||
-(a+="\n\n")}return a}getTextContentSize(){let a=0,b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContentSize();E(e)&&d!==c-1&&!e.isInline()&&(a+=2)}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a=lb[a],0!==(this.getFormat()&a)):!1}select(a,b){G();let c=u(),d=a,e=b;var f=this.getChildrenSize();if(!this.canBeEmpty())if(0===a&&0===b){if(a=this.getFirstChild(),B(a)||E(a))return a.select(0,0)}else if(!(void 0!==a&&a!==f||void 0!==b&&b!==f)&&
|
||||
-(a=this.getLastChild(),B(a)||E(a)))return a.select();void 0===d&&(d=f);void 0===e&&(e=f);f=this.__key;if(C(c))c.anchor.set(f,d,"element"),c.focus.set(f,e,"element"),c.dirty=!0;else return re(f,d,f,e,"element","element");return c}selectStart(){let a=this.getFirstDescendant();return a?a.selectStart():this.select()}selectEnd(){let a=this.getLastDescendant();return a?a.selectEnd():this.select()}clear(){let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){return this.splice(this.getChildrenSize(),
|
||||
-0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?lb[a]:0;return this}setIndent(a){this.getWritable().__indent=a;return this}splice(a,b,c){let d=c.length,e=this.getChildrenSize(),f=this.getWritable(),g=f.__key;var h=[],k=[];let m=this.getChildAtIndex(a+b),q=null,p=e-b+d;if(0!==a)if(a===e)q=this.getLastChild();else{var l=this.getChildAtIndex(a);null!==l&&(q=l.getPreviousSibling())}if(0<b){var r=null===q?this.getFirstChild():q.getNextSibling();
|
||||
-for(l=0;l<b;l++){null===r&&n(100);var w=r.getNextSibling(),A=r.__key;r=r.getWritable();ac(r);k.push(A);r=w}}l=q;for(w=0;w<d;w++){A=c[w];null!==l&&A.is(l)&&(q=l=l.getPreviousSibling());r=A.getWritable();r.__parent===g&&p--;ac(r);let x=A.__key;null===l?(f.__first=x,r.__prev=null):(l=l.getWritable(),l.__next=x,r.__prev=l.__key);A.__key===g&&n(76);r.__parent=g;h.push(x);l=A}a+b===e?null!==l&&(l.getWritable().__next=null,f.__last=l.__key):null!==m&&(a=m.getWritable(),null!==l?(b=l.getWritable(),a.__prev=
|
||||
-l.__key,b.__next=m.__key):a.__prev=null);f.__size=p;if(k.length&&(a=u(),C(a))){k=new Set(k);h=new Set(h);let {anchor:x,focus:z}=a;uf(x,k,h)&&Yd(x,x.getNode(),this,q,m);uf(z,k,h)&&Yd(z,z.getNode(),this,q,m);0!==p||this.canBeEmpty()||wc(this)||this.remove()}return f}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(){return null}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}
|
||||
-function E(a){return a instanceof tf}function uf(a,b,c){for(a=a.getNode();a;){let d=a.__key;if(b.has(d)&&!c.has(d))return!0;a=a.getParent()}return!1}
|
||||
-class vf extends tf{static getType(){return"root"}static clone(){return new vf}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){n(51)}getTextContent(){let a=this.__cachedText;return!dc()&&0!==F()._dirtyType||null===a?super.getTextContent():a}remove(){n(52)}replace(){n(53)}insertBefore(){n(54)}insertAfter(){n(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];E(c)||y(c)||n(56)}return super.append(...a)}static importJSON(a){let b=J();b.setFormat(a.format);
|
||||
-b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function L(a){return a instanceof vf}function rf(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function wf(){return new qf(new Map([["root",new vf]]))}
|
||||
-function xf(a){let b=a.exportJSON();var c=a.constructor;b.type!==c.getType()&&n(130,c.name);if(E(a)){let d=b.children;Array.isArray(d)||n(59,c.name);a=a.getChildren();for(c=0;c<a.length;c++){let e=xf(a[c]);d.push(e)}}return b}
|
||||
-class qf{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){return kf(this,a)}clone(a){a=new qf(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return kf(this,()=>({root:xf(J())}))}}
|
||||
-class Df extends tf{static getType(){return"paragraph"}static clone(a){return new Df(a.__key)}createDOM(a){let b=document.createElement("p");a=oc(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Ef,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));if(a&&Cc(a)){this.isEmpty()&&a.append(document.createElement("br"));var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();
|
||||
-0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=be();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(a,b){a=be();let c=this.getDirection();a.setDirection(c);this.insertAfter(a,b);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||B(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),
|
||||
-this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Ef(a){let b=be();a.style&&(b.setFormat(a.style.textAlign),a=parseInt(a.style.textIndent,10)/20,0<a&&b.setIndent(a));return{node:b}}function be(){return yc(new Df)}
|
||||
-function mf(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=wf();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];a._blockCursorElement=null;d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
|
||||
-function Ff(a,b){let c=new Map,d=new Set,e=f=>{Object.keys(f).forEach(g=>{let h=c.get(g);void 0===h&&(h=[],c.set(g,h));h.push(f[g])})};a.forEach(f=>{f=null!=f.klass.importDOM?f.klass.importDOM.bind(f.klass):null;null==f||d.has(f)||(d.add(f),f=f(),null!==f&&e(f))});b&&e(b);return c}
|
||||
-class Gf{constructor(a,b,c,d,e,f,g){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
|
||||
-new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=kc();this._onError=e;this._htmlConversions=f;this._editable=g;this._headless=null!==b&&b._headless;this._blockCursorElement=this._window=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerEditableListener(a){let b=this._listeners.editable;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=
|
||||
+(a+="\n\n")}return a}getTextContentSize(){let a=0,b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContentSize();E(e)&&d!==c-1&&!e.isInline()&&(a+=2)}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a=mb[a],0!==(this.getFormat()&a)):!1}select(a,b){G();let c=u(),d=a,e=b;var f=this.getChildrenSize();if(!this.canBeEmpty())if(0===a&&0===b){if(a=this.getFirstChild(),B(a)||E(a))return a.select(0,0)}else if(!(void 0!==a&&a!==f||void 0!==b&&b!==f)&&
|
||||
+(a=this.getLastChild(),B(a)||E(a)))return a.select();void 0===d&&(d=f);void 0===e&&(e=f);f=this.__key;if(C(c))c.anchor.set(f,d,"element"),c.focus.set(f,e,"element"),c.dirty=!0;else return se(f,d,f,e,"element","element");return c}selectStart(){let a=this.getFirstDescendant();return a?a.selectStart():this.select()}selectEnd(){let a=this.getLastDescendant();return a?a.selectEnd():this.select()}clear(){let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){return this.splice(this.getChildrenSize(),
|
||||
+0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?mb[a]:0;return this}setIndent(a){this.getWritable().__indent=a;return this}splice(a,b,c){let d=c.length,e=this.getChildrenSize(),f=this.getWritable(),g=f.__key;var h=[],k=[];let m=this.getChildAtIndex(a+b),q=null,p=e-b+d;if(0!==a)if(a===e)q=this.getLastChild();else{var l=this.getChildAtIndex(a);null!==l&&(q=l.getPreviousSibling())}if(0<b){var r=null===q?this.getFirstChild():q.getNextSibling();
|
||||
+for(l=0;l<b;l++){null===r&&n(100);var w=r.getNextSibling(),A=r.__key;r=r.getWritable();bc(r);k.push(A);r=w}}l=q;for(w=0;w<d;w++){A=c[w];null!==l&&A.is(l)&&(q=l=l.getPreviousSibling());r=A.getWritable();r.__parent===g&&p--;bc(r);let x=A.__key;null===l?(f.__first=x,r.__prev=null):(l=l.getWritable(),l.__next=x,r.__prev=l.__key);A.__key===g&&n(76);r.__parent=g;h.push(x);l=A}a+b===e?null!==l&&(l.getWritable().__next=null,f.__last=l.__key):null!==m&&(a=m.getWritable(),null!==l?(b=l.getWritable(),a.__prev=
|
||||
+l.__key,b.__next=m.__key):a.__prev=null);f.__size=p;if(k.length&&(a=u(),C(a))){k=new Set(k);h=new Set(h);let {anchor:x,focus:z}=a;vf(x,k,h)&&Zd(x,x.getNode(),this,q,m);vf(z,k,h)&&Zd(z,z.getNode(),this,q,m);0!==p||this.canBeEmpty()||xc(this)||this.remove()}return f}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(){return null}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}
|
||||
+function E(a){return a instanceof uf}function vf(a,b,c){for(a=a.getNode();a;){let d=a.__key;if(b.has(d)&&!c.has(d))return!0;a=a.getParent()}return!1}
|
||||
+class wf extends uf{static getType(){return"root"}static clone(){return new wf}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){n(51)}getTextContent(){let a=this.__cachedText;return!ec()&&0!==F()._dirtyType||null===a?super.getTextContent():a}remove(){n(52)}replace(){n(53)}insertBefore(){n(54)}insertAfter(){n(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];E(c)||y(c)||n(56)}return super.append(...a)}static importJSON(a){let b=J();b.setFormat(a.format);
|
||||
+b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function L(a){return a instanceof wf}function sf(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function xf(){return new rf(new Map([["root",new wf]]))}
|
||||
+function yf(a){let b=a.exportJSON();var c=a.constructor;b.type!==c.getType()&&n(130,c.name);if(E(a)){let d=b.children;Array.isArray(d)||n(59,c.name);a=a.getChildren();for(c=0;c<a.length;c++){let e=yf(a[c]);d.push(e)}}return b}
|
||||
+class rf{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){return lf(this,a)}clone(a){a=new rf(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return lf(this,()=>({root:yf(J())}))}}
|
||||
+class Ef extends uf{static getType(){return"paragraph"}static clone(a){return new Ef(a.__key)}createDOM(a){let b=document.createElement("p");a=pc(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Ff,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));if(a&&Dc(a)){this.isEmpty()&&a.append(document.createElement("br"));var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();
|
||||
+0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=ce();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(a,b){a=ce();let c=this.getDirection();a.setDirection(c);this.insertAfter(a,b);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||B(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),
|
||||
+this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Ff(a){let b=ce();a.style&&(b.setFormat(a.style.textAlign),a=parseInt(a.style.textIndent,10)/20,0<a&&b.setIndent(a));return{node:b}}function ce(){return zc(new Ef)}
|
||||
+function nf(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=xf();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];a._blockCursorElement=null;d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
|
||||
+function Gf(a,b){let c=new Map,d=new Set,e=f=>{Object.keys(f).forEach(g=>{let h=c.get(g);void 0===h&&(h=[],c.set(g,h));h.push(f[g])})};a.forEach(f=>{f=null!=f.klass.importDOM?f.klass.importDOM.bind(f.klass):null;null==f||d.has(f)||(d.add(f),f=f(),null!==f&&e(f))});b&&e(b);return c}
|
||||
+class Hf{constructor(a,b,c,d,e,f,g){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
|
||||
+new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=lc();this._onError=e;this._htmlConversions=f;this._editable=g;this._headless=null!==b&&b._headless;this._blockCursorElement=this._window=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerEditableListener(a){let b=this._listeners.editable;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=
|
||||
this._listeners.decorator;b.add(a);return()=>{b.delete(a)}}registerTextContentListener(a){let b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){let b=this._listeners.root;a(this._rootElement,null);b.add(a);return()=>{a(null,this._rootElement);b.delete(a)}}registerCommand(a,b,c){void 0===c&&n(35);let d=this._commands;d.has(a)||d.set(a,[new Set,new Set,new Set,new Set,new Set]);let e=d.get(a);void 0===e&&n(36,String(a));let f=e[c];f.add(b);return()=>{f.delete(b);
|
||||
-e.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,b){void 0===this._nodes.get(a.getType())&&n(37,a.name);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransformToKlass(a,b){var c=a.getType();c=this._nodes.get(c);void 0===c&&n(37,a.name);c.transforms.add(b);return c}registerNodeTransform(a,b){var c=this.registerNodeTransformToKlass(a,b);let d=[c];c=c.replaceWithKlass;null!=c&&(c=this.registerNodeTransformToKlass(c,b),d.push(c));gc(this,a.getType());return()=>
|
||||
-{d.forEach(e=>e.transforms.delete(b))}}hasNode(a){return this._nodes.has(a.getType())}hasNodes(a){return a.every(this.hasNode.bind(this))}dispatchCommand(a,b){return R(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=this._rootElement;if(a!==b){let f=oc(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;mf(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==
|
||||
-Fd&&(Fd--,0===Fd&&b.ownerDocument.removeEventListener("selectionchange",Vd));var d=b.__lexicalEditor;if(null!==d&&void 0!==d){if(null!==d._parentEditor){var e=jc(d);e=e[e.length-1]._key;Ud.get(e)===d&&Ud.delete(e)}else Ud.delete(d._key);b.__lexicalEditor=null}d=Td(b);for(e=0;e<d.length;e++)d[e]();b.__lexicalEventHandles=[]}null!=f&&b.classList.remove(...f)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor",
|
||||
-"true"),this._window=c,this._dirtyType=2,Cb(this),this._updateTags.add("history-merge"),lf(this),this._config.disableEvents||Wd(a,this),null!=f&&a.classList.add(...f)):(this._editorState=c,this._window=this._pendingEditorState=null);nf("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&n(38);Bb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||
|
||||
-(null!=b&&d.add(b),lf(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);lf(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=wf(),d=S,e=U,f=T,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,m=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;S=c;U=!1;T=this;try{jf(a.root,this._nodes),b&&b(),c._readOnly=!0}catch(q){q instanceof
|
||||
+e.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,b){void 0===this._nodes.get(a.getType())&&n(37,a.name);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransformToKlass(a,b){var c=a.getType();c=this._nodes.get(c);void 0===c&&n(37,a.name);c.transforms.add(b);return c}registerNodeTransform(a,b){var c=this.registerNodeTransformToKlass(a,b);let d=[c];c=c.replaceWithKlass;null!=c&&(c=this.registerNodeTransformToKlass(c,b),d.push(c));hc(this,a.getType());return()=>
|
||||
+{d.forEach(e=>e.transforms.delete(b))}}hasNode(a){return this._nodes.has(a.getType())}hasNodes(a){return a.every(this.hasNode.bind(this))}dispatchCommand(a,b){return R(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=this._rootElement;if(a!==b){let f=pc(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;nf(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==
|
||||
+Gd&&(Gd--,0===Gd&&b.ownerDocument.removeEventListener("selectionchange",Wd));var d=b.__lexicalEditor;if(null!==d&&void 0!==d){if(null!==d._parentEditor){var e=kc(d);e=e[e.length-1]._key;Vd.get(e)===d&&Vd.delete(e)}else Vd.delete(d._key);b.__lexicalEditor=null}d=Ud(b);for(e=0;e<d.length;e++)d[e]();b.__lexicalEventHandles=[]}null!=f&&b.classList.remove(...f)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor",
|
||||
+"true"),this._window=c,this._dirtyType=2,Db(this),this._updateTags.add("history-merge"),mf(this),this._config.disableEvents||Xd(a,this),null!=f&&a.classList.add(...f)):(this._editorState=c,this._window=this._pendingEditorState=null);of("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&n(38);Cb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||
|
||||
+(null!=b&&d.add(b),mf(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);mf(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=xf(),d=S,e=U,f=T,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,m=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;S=c;U=!1;T=this;try{kf(a.root,this._nodes),b&&b(),c._readOnly=!0}catch(q){q instanceof
|
||||
Error&&this._onError(q)}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=m,S=d,U=e,T=f}return c}update(a,b){v(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),v(this,()=>{let d=u(),e=J();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");a&&a()},tag:"focus"}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=
|
||||
-this._rootElement;null!==a&&a.blur();a=wb(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,nf("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}exports.$addUpdateTag=function(a){G();F()._updateTags.add(a)};exports.$applyNodeReplacement=yc;exports.$copyNode=xc;exports.$createLineBreakNode=ge;exports.$createNodeSelection=Ve;exports.$createParagraphNode=be;exports.$createPoint=Ke;
|
||||
-exports.$createRangeSelection=function(){let a=Ke("root",0,"element"),b=Ke("root",0,"element");return new Pe(a,b,0,"")};exports.$createTabNode=ue;exports.$createTextNode=K;exports.$getAdjacentNode=rc;exports.$getCharacterOffsets=Qe;exports.$getEditor=function(){return F()};exports.$getNearestNodeFromDOMNode=vb;exports.$getNearestRootOrShadowRoot=vc;exports.$getNodeByKey=I;exports.$getPreviousSelection=mc;exports.$getRoot=J;exports.$getSelection=u;
|
||||
-exports.$getTextContent=function(){let a=u();return null===a?"":a.getTextContent()};exports.$hasAncestor=uc;exports.$hasUpdateTag=function(a){return F()._updateTags.has(a)};exports.$insertNodes=function(a){let b=u()||mc();null===b&&(b=J().selectEnd());b.insertNodes(a)};exports.$isBlockElementNode=function(a){return E(a)&&!a.isInline()};exports.$isDecoratorNode=y;exports.$isElementNode=E;exports.$isInlineElementOrDecoratorNode=function(a){return E(a)&&a.isInline()||y(a)&&a.isInline()};
|
||||
-exports.$isLeafNode=function(a){return B(a)||Ec(a)||y(a)};exports.$isLineBreakNode=Ec;exports.$isNodeSelection=Sd;exports.$isParagraphNode=function(a){return a instanceof Df};exports.$isRangeSelection=C;exports.$isRootNode=L;exports.$isRootOrShadowRoot=wc;exports.$isTabNode=Ie;exports.$isTextNode=B;exports.$nodesOfType=function(a){var b=$b();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};
|
||||
-exports.$normalizeSelection__EXPERIMENTAL=Hb;exports.$parseSerializedNode=function(a){return jf(a,F()._nodes)};exports.$selectAll=function(){var a=J();a=a.select(0,a.getChildrenSize());zb(Hb(a))};exports.$setCompositionKey=H;exports.$setSelection=zb;
|
||||
-exports.$splitNode=function(a,b){let c=a.getChildAtIndex(b);null==c&&(c=a);wc(a)&&n(102);let d=g=>{const h=g.getParentOrThrow(),k=wc(h),m=g!==c||k?xc(g):g;if(k)return E(g)&&E(m)||n(133),g.insertAfter(m),[g,m,m];const [q,p,l]=d(h);g=g.getNextSiblings();l.append(m,...g);return[q,p,m]},[e,f]=d(c);return[e,f]};exports.BLUR_COMMAND=Ra;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=ca;
|
||||
-exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=ka;exports.COPY_COMMAND=Na;exports.CUT_COMMAND=Oa;exports.DELETE_CHARACTER_COMMAND=da;exports.DELETE_LINE_COMMAND=pa;exports.DELETE_WORD_COMMAND=oa;exports.DRAGEND_COMMAND=Ma;exports.DRAGOVER_COMMAND=La;exports.DRAGSTART_COMMAND=Ka;exports.DROP_COMMAND=Ja;exports.DecoratorNode=sf;
|
||||
-exports.ElementNode=tf;exports.FOCUS_COMMAND=Qa;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=qa;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=ea;exports.INSERT_PARAGRAPH_COMMAND=fa;exports.INSERT_TAB_COMMAND={};exports.KEY_ARROW_DOWN_COMMAND=Aa;exports.KEY_ARROW_LEFT_COMMAND=wa;exports.KEY_ARROW_RIGHT_COMMAND=ua;exports.KEY_ARROW_UP_COMMAND=za;exports.KEY_BACKSPACE_COMMAND=Da;exports.KEY_DELETE_COMMAND=Ha;exports.KEY_DOWN_COMMAND=ta;
|
||||
-exports.KEY_ENTER_COMMAND=Ba;exports.KEY_ESCAPE_COMMAND=Ga;exports.KEY_MODIFIER_COMMAND=Sa;exports.KEY_SPACE_COMMAND=Ca;exports.KEY_TAB_COMMAND=Ia;exports.LineBreakNode=de;exports.MOVE_TO_END=va;exports.MOVE_TO_START=ya;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=la;exports.ParagraphNode=Df;exports.REDO_COMMAND=sa;exports.REMOVE_TEXT_COMMAND=ma;exports.RootNode=vf;exports.SELECTION_CHANGE_COMMAND=ba;exports.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND={};exports.SELECT_ALL_COMMAND=Pa;
|
||||
-exports.TabNode=He;exports.TextNode=me;exports.UNDO_COMMAND=ra;exports.createCommand=function(){return{}};
|
||||
-exports.createEditor=function(a){var b=a||{},c=T,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=wf(),h=b.namespace||(null!==e?e._config.namespace:kc()),k=b.editorState,m=[vf,me,de,He,Df,...(b.nodes||[])],{onError:q,html:p}=b;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<m.length;c++){let r=m[c],w=null;var l=null;"function"!==typeof r&&(l=r,r=l.replace,w=l.with,l=l.withKlass||null);let A=r.getType(),x=r.transform(),z=
|
||||
-new Set;null!==x&&z.add(x);a.set(A,{exportDOM:p&&p.export?p.export.get(r):void 0,klass:r,replace:w,replaceWithKlass:l,transforms:z})}d=new Gf(g,e,a,{disableEvents:f,namespace:h,theme:d},q?q:console.error,Ff(a,p?p.import:void 0),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d};exports.getNearestEditorFromDOMNode=Tb;exports.isCurrentlyReadOnlyMode=dc;exports.isHTMLAnchorElement=function(a){return Cc(a)&&"A"===a.tagName};exports.isHTMLElement=Cc;
|
||||
-exports.isSelectionCapturedInDecoratorInput=Rb;exports.isSelectionWithinEditor=Sb
|
||||
+this._rootElement;null!==a&&a.blur();a=xb(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,of("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}exports.$addUpdateTag=function(a){G();F()._updateTags.add(a)};exports.$applyNodeReplacement=zc;exports.$copyNode=yc;exports.$createLineBreakNode=he;exports.$createNodeSelection=We;exports.$createParagraphNode=ce;exports.$createPoint=Le;
|
||||
+exports.$createRangeSelection=function(){let a=Le("root",0,"element"),b=Le("root",0,"element");return new Qe(a,b,0,"")};exports.$createTabNode=ve;exports.$createTextNode=K;exports.$getAdjacentNode=sc;exports.$getCharacterOffsets=Re;exports.$getEditor=function(){return F()};exports.$getNearestNodeFromDOMNode=wb;exports.$getNearestRootOrShadowRoot=wc;exports.$getNodeByKey=I;exports.$getPreviousSelection=nc;exports.$getRoot=J;exports.$getSelection=u;
|
||||
+exports.$getTextContent=function(){let a=u();return null===a?"":a.getTextContent()};exports.$hasAncestor=vc;exports.$hasUpdateTag=function(a){return F()._updateTags.has(a)};exports.$insertNodes=function(a){let b=u()||nc();null===b&&(b=J().selectEnd());b.insertNodes(a)};exports.$isBlockElementNode=function(a){return E(a)&&!a.isInline()};exports.$isDecoratorNode=y;exports.$isElementNode=E;exports.$isInlineElementOrDecoratorNode=function(a){return E(a)&&a.isInline()||y(a)&&a.isInline()};
|
||||
+exports.$isLeafNode=function(a){return B(a)||Fc(a)||y(a)};exports.$isLineBreakNode=Fc;exports.$isNodeSelection=Td;exports.$isParagraphNode=function(a){return a instanceof Ef};exports.$isRangeSelection=C;exports.$isRootNode=L;exports.$isRootOrShadowRoot=xc;exports.$isTabNode=Je;exports.$isTextNode=B;exports.$nodesOfType=function(a){var b=ac();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};
|
||||
+exports.$normalizeSelection__EXPERIMENTAL=Ib;exports.$parseSerializedNode=function(a){return kf(a,F()._nodes)};exports.$selectAll=function(){var a=J();a=a.select(0,a.getChildrenSize());Ab(Ib(a))};exports.$setCompositionKey=H;exports.$setSelection=Ab;
|
||||
+exports.$splitNode=function(a,b){let c=a.getChildAtIndex(b);null==c&&(c=a);xc(a)&&n(102);let d=g=>{const h=g.getParentOrThrow(),k=xc(h),m=g!==c||k?yc(g):g;if(k)return E(g)&&E(m)||n(133),g.insertAfter(m),[g,m,m];const [q,p,l]=d(h);g=g.getNextSiblings();l.append(m,...g);return[q,p,m]},[e,f]=d(c);return[e,f]};exports.BLUR_COMMAND=Ra;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=ca;
|
||||
+exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=ka;exports.COPY_COMMAND=Na;exports.CUT_COMMAND=Oa;exports.DELETE_CHARACTER_COMMAND=da;exports.DELETE_LINE_COMMAND=pa;exports.DELETE_WORD_COMMAND=oa;exports.DRAGEND_COMMAND=Ma;exports.DRAGOVER_COMMAND=La;exports.DRAGSTART_COMMAND=Ka;exports.DROP_COMMAND=Ja;exports.DecoratorNode=tf;
|
||||
+exports.ElementNode=uf;exports.FOCUS_COMMAND=Qa;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=qa;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=ea;exports.INSERT_PARAGRAPH_COMMAND=fa;exports.INSERT_TAB_COMMAND={};exports.KEY_ARROW_DOWN_COMMAND=Aa;exports.KEY_ARROW_LEFT_COMMAND=wa;exports.KEY_ARROW_RIGHT_COMMAND=ua;exports.KEY_ARROW_UP_COMMAND=za;exports.KEY_BACKSPACE_COMMAND=Da;exports.KEY_DELETE_COMMAND=Ha;exports.KEY_DOWN_COMMAND=ta;
|
||||
+exports.KEY_ENTER_COMMAND=Ba;exports.KEY_ESCAPE_COMMAND=Ga;exports.KEY_MODIFIER_COMMAND=Sa;exports.KEY_SPACE_COMMAND=Ca;exports.KEY_TAB_COMMAND=Ia;exports.LineBreakNode=ee;exports.MOVE_TO_END=va;exports.MOVE_TO_START=ya;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=la;exports.ParagraphNode=Ef;exports.REDO_COMMAND=sa;exports.REMOVE_TEXT_COMMAND=ma;exports.RootNode=wf;exports.SELECTION_CHANGE_COMMAND=ba;exports.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND={};exports.SELECT_ALL_COMMAND=Pa;
|
||||
+exports.TabNode=Ie;exports.TextNode=ne;exports.UNDO_COMMAND=ra;exports.createCommand=function(){return{}};
|
||||
+exports.createEditor=function(a){var b=a||{},c=T,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=xf(),h=b.namespace||(null!==e?e._config.namespace:lc()),k=b.editorState,m=[wf,ne,ee,Ie,Ef,...(b.nodes||[])],{onError:q,html:p}=b;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<m.length;c++){let r=m[c],w=null;var l=null;"function"!==typeof r&&(l=r,r=l.replace,w=l.with,l=l.withKlass||null);let A=r.getType(),x=r.transform(),z=
|
||||
+new Set;null!==x&&z.add(x);a.set(A,{exportDOM:p&&p.export?p.export.get(r):void 0,klass:r,replace:w,replaceWithKlass:l,transforms:z})}d=new Hf(g,e,a,{disableEvents:f,namespace:h,theme:d},q?q:console.error,Gf(a,p?p.import:void 0),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d};exports.getNearestEditorFromDOMNode=Ub;exports.isCurrentlyReadOnlyMode=ec;exports.isHTMLAnchorElement=function(a){return Dc(a)&&"A"===a.tagName};exports.isHTMLElement=Dc;
|
||||
+exports.isSelectionCapturedInDecoratorInput=Sb;exports.isSelectionWithinEditor=Tb
|
||||
@@ -45,15 +45,18 @@ Questions? Find answers on our [Help page](https://standardnotes.com/help).
|
||||
|
||||
---
|
||||
|
||||
### Docker setup
|
||||
### Self-hosting the web app
|
||||
|
||||
If you'd like to self-host the web application, we recommend using our official [Docker hub image](https://hub.docker.com/repository/docker/standardnotes/web).
|
||||
Our web app is compiled into a folder of static HTML, JS, and CSS files. You can serve these files behind a web server to get started:
|
||||
|
||||
```
|
||||
docker run -d -p 3001:3001 --env-file=.env.sample standardnotes/web:stable
|
||||
```
|
||||
1. `git clone https://github.com/standardnotes/app.git`
|
||||
2. `cd app`
|
||||
3. `yarn install`
|
||||
4. `yarn build:web`
|
||||
5. `cd packages/web`
|
||||
6. You can then use Python to serve this folder over http: `python -m http.server 8080`
|
||||
|
||||
You can then access the app at `http://localhost:3001`. It may take a minute for the server to start up.
|
||||
You can now access the app at `http://localhost:8080`.
|
||||
|
||||
### Running Web App in Development Mode
|
||||
|
||||
|
||||
+4
-2
@@ -44,8 +44,10 @@
|
||||
"@types/react-native-vector-icons/@types/react": "17.0.2",
|
||||
"@types/react-native/@types/react": "17.0.2",
|
||||
"@types/hoist-non-react-statics/@types/react": "17.0.2",
|
||||
"[email protected]2.5": "patch:lexical@npm:0.12.5#.yarn/patches/lexical-npm-0.12.5-4685aa4776.patch",
|
||||
"@lexical/[email protected]2.5": "patch:@lexical/clipboard@npm:0.12.5#.yarn/patches/@lexical-clipboard-npm-0.12.5-e1ca4ff56d.patch"
|
||||
"[email protected]3.1": "patch:lexical@npm:0.13.1#.yarn/patches/lexical-npm-0.13.1-ac06219fd6.patch",
|
||||
"@lexical/[email protected]3.1": "patch:@lexical/clipboard@npm:0.13.1#.yarn/patches/@lexical-clipboard-npm-0.13.1-b4788bb0a9.patch",
|
||||
"@lexical/[email protected]": "patch:@lexical/rich-text@npm:0.13.1#.yarn/patches/@lexical-rich-text-npm-0.13.1-df610fad54.patch",
|
||||
"@lexical/[email protected]": "patch:@lexical/list@npm:0.13.1#.yarn/patches/@lexical-list-npm-0.13.1-788c53f078.patch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/snjs": "workspace:*"
|
||||
|
||||
@@ -3,6 +3,56 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.26.87](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-04-10)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.86](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-04-10)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.85](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-04-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.84](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.83](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use API v0 on iOS ([#2858](https://github.com/standardnotes/app/issues/2858)) [skip e2e] ([3b2f761](https://github.com/standardnotes/app/commit/3b2f76166126a5b11f35b64aacefa37618622c3d))
|
||||
|
||||
## [1.26.82](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.81](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-02-22)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.80](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-02-17)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.79](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-02-02)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.78](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-01-27)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.77](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-01-24)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.76](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-01-20)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.75](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-12-28)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/api",
|
||||
"version": "1.26.75",
|
||||
"version": "1.26.87",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export enum ApiVersion {
|
||||
v0 = '20200115',
|
||||
v1 = '20240226',
|
||||
}
|
||||
|
||||
@@ -15,7 +15,10 @@ import { AuthApiServiceInterface } from './AuthApiServiceInterface'
|
||||
export class AuthApiService implements AuthApiServiceInterface {
|
||||
private operationsInProgress: Map<AuthApiOperations, boolean>
|
||||
|
||||
constructor(private authServer: AuthServerInterface) {
|
||||
constructor(
|
||||
private authServer: AuthServerInterface,
|
||||
private apiVersion: ApiVersion,
|
||||
) {
|
||||
this.operationsInProgress = new Map()
|
||||
}
|
||||
|
||||
@@ -50,7 +53,7 @@ export class AuthApiService implements AuthApiServiceInterface {
|
||||
|
||||
try {
|
||||
const response = await this.authServer.recoveryKeyParams({
|
||||
api_version: ApiVersion.v0,
|
||||
api_version: this.apiVersion,
|
||||
code_challenge: dto.codeChallenge,
|
||||
recovery_codes: dto.recoveryCodes,
|
||||
username: dto.username,
|
||||
@@ -69,6 +72,7 @@ export class AuthApiService implements AuthApiServiceInterface {
|
||||
password: string
|
||||
codeVerifier: string
|
||||
recoveryCodes: string
|
||||
hvmToken?: string
|
||||
}): Promise<HttpResponse<SignInWithRecoveryCodesResponseBody>> {
|
||||
if (this.operationsInProgress.get(AuthApiOperations.SignInWithRecoveryCodes)) {
|
||||
throw new ApiCallError(ErrorMessage.GenericInProgress)
|
||||
@@ -78,11 +82,12 @@ export class AuthApiService implements AuthApiServiceInterface {
|
||||
|
||||
try {
|
||||
const response = await this.authServer.signInWithRecoveryCodes({
|
||||
api_version: ApiVersion.v0,
|
||||
api_version: this.apiVersion,
|
||||
code_verifier: dto.codeVerifier,
|
||||
password: dto.password,
|
||||
recovery_codes: dto.recoveryCodes,
|
||||
username: dto.username,
|
||||
hvm_token: dto.hvmToken,
|
||||
})
|
||||
|
||||
return response
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user