kempo 4.2.24 → 4.2.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/bin/cli.js +10 -4
- package/dist/admin/init.js +1 -1
- package/dist/admin/init.js.map +1 -1
- package/dist/kempo/vendor/lexical/chunks/chunk-3XOIGVQI.js +3 -0
- package/dist/kempo/vendor/lexical/chunks/chunk-ERAFEOAX.js +2 -0
- package/dist/kempo/vendor/lexical/chunks/chunk-FYATIV3K.js +3 -0
- package/dist/kempo/vendor/lexical/chunks/chunk-LMH5Y7M4.js +1 -0
- package/dist/kempo/vendor/lexical/chunks/chunk-PZQA5MC4.js +1 -0
- package/dist/kempo/vendor/lexical/chunks/chunk-ZMJQPFLE.js +11 -0
- package/dist/kempo/vendor/lexical/lexical.js +1 -0
- package/dist/kempo/vendor/lexical/lexical__code.js +12 -0
- package/dist/kempo/vendor/lexical/lexical__history.js +1 -0
- package/dist/kempo/vendor/lexical/lexical__html.js +1 -0
- package/dist/kempo/vendor/lexical/lexical__link.js +1 -0
- package/dist/kempo/vendor/lexical/lexical__list.js +1 -0
- package/dist/kempo/vendor/lexical/lexical__rich-text.js +1 -0
- package/dist/kempo/vendor/lexical/lexical__selection.js +1 -0
- package/dist/kempo/vendor/lexical/lexical__table.js +2 -0
- package/dist/kempo/vendor/lexical/manifest.json +14 -0
- package/middleware/kempo.js +77 -0
- package/package.json +12 -2
- package/server/utils/lexical/packages.js +28 -0
package/README.md
CHANGED
|
@@ -360,6 +360,20 @@ Kempo uses [kempo-css](https://github.com/dustinpoissant/kempo-css) for styling
|
|
|
360
360
|
|
|
361
361
|
Refer to the [kempo-css docs](https://github.com/dustinpoissant/kempo-css) and [kempo-ui docs](https://github.com/dustinpoissant/kempo-ui) for available utility classes and components.
|
|
362
362
|
|
|
363
|
+
## The Rich Text Editor
|
|
364
|
+
|
|
365
|
+
The admin's WYSIWYG is kempo-ui's `<k-html-editor>`, which is built on [Lexical](https://lexical.dev). Kempo ships Lexical itself rather than letting the editor fetch it from a CDN, so the editor keeps working offline, behind a strict Content-Security-Policy, on an air-gapped install, and during a CDN outage — and no third party sees a request every time an administrator opens a page.
|
|
366
|
+
|
|
367
|
+
Nothing is required to set this up. `npm run build` bundles Lexical into `dist/kempo/vendor/lexical/`, kempo's middleware serves it, and `window.kempo.lexicalUrl` points the editor at it:
|
|
368
|
+
|
|
369
|
+
```js
|
|
370
|
+
window.kempo = { ..., lexicalUrl: '/kempo/vendor/lexical' };
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
To use a CDN instead — or a copy you host elsewhere — change that value, or set `lexical-src` on an individual editor. Removing it falls back to `https://esm.sh`.
|
|
374
|
+
|
|
375
|
+
Lexical cannot be served straight from `node_modules`: its published entry reads `process.env.NODE_ENV`, which does not exist in a browser, and its builds import bare specifiers that a browser cannot resolve. The build therefore bundles each package with esbuild, with code splitting so all nine share a single copy of Lexical's core — Lexical relies on class identity, and duplicate copies produce an editor that loads but stays empty.
|
|
376
|
+
|
|
363
377
|
## Development
|
|
364
378
|
|
|
365
379
|
### Running the framework
|
package/bin/cli.js
CHANGED
|
@@ -97,7 +97,7 @@ if(existsSync(join(projectDir, 'public'))){
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
const { action } = await inquirer.prompt([{
|
|
100
|
-
type: '
|
|
100
|
+
type: 'select',
|
|
101
101
|
name: 'action',
|
|
102
102
|
message: 'An existing Kempo project was detected. What would you like to do?',
|
|
103
103
|
choices: [
|
|
@@ -155,7 +155,7 @@ let customDatabaseUrl = null;
|
|
|
155
155
|
|
|
156
156
|
if(existingContainers.length > 0 && !useDefaults){
|
|
157
157
|
const { containerChoice } = await inquirer.prompt([{
|
|
158
|
-
type: '
|
|
158
|
+
type: 'select',
|
|
159
159
|
name: 'containerChoice',
|
|
160
160
|
message: 'Found existing PostgreSQL containers. Select one or create new:',
|
|
161
161
|
choices: [
|
|
@@ -194,7 +194,7 @@ if(containerMode === 'new' && !useDefaults){
|
|
|
194
194
|
containerName = name;
|
|
195
195
|
|
|
196
196
|
const { passwordChoice } = await inquirer.prompt([{
|
|
197
|
-
type: '
|
|
197
|
+
type: 'select',
|
|
198
198
|
name: 'passwordChoice',
|
|
199
199
|
message: 'Database password:',
|
|
200
200
|
choices: [
|
|
@@ -259,7 +259,7 @@ let emailServiceSkipped = false;
|
|
|
259
259
|
|
|
260
260
|
if(!useDefaults){
|
|
261
261
|
const { emailService } = await inquirer.prompt([{
|
|
262
|
-
type: '
|
|
262
|
+
type: 'select',
|
|
263
263
|
name: 'emailService',
|
|
264
264
|
message: 'Email service:',
|
|
265
265
|
choices: [
|
|
@@ -512,3 +512,9 @@ Then open:
|
|
|
512
512
|
http://localhost:9876 (your site)
|
|
513
513
|
http://localhost:9876/admin (admin panel)
|
|
514
514
|
`);
|
|
515
|
+
|
|
516
|
+
/*
|
|
517
|
+
createUser/addUserToGroup hold open the postgres client's connection (no idle_timeout is
|
|
518
|
+
configured), so without this the process never exits on its own once setup finishes.
|
|
519
|
+
*/
|
|
520
|
+
process.exit(0);
|
package/dist/admin/init.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
window.kempo={pathsToIcons:["/admin/icons","/kempo/icons","/kempo-ui/icons"],monacoUrl:"/monaco-editor"},window.litDisableBundleWarning=!0,import("/kempo-ui/components/Import.js"),import("/kempo-ui/components/Aside.js"),import("/kempo-ui/components/Main.js");
|
|
1
|
+
window.kempo={pathsToIcons:["/admin/icons","/kempo/icons","/kempo-ui/icons"],monacoUrl:"/monaco-editor",lexicalUrl:"/kempo/vendor/lexical"},window.litDisableBundleWarning=!0,import("/kempo-ui/components/Import.js"),import("/kempo-ui/components/Aside.js"),import("/kempo-ui/components/Main.js");
|
|
2
2
|
//# sourceMappingURL=C:\Users\dusti\dev\kempo\dist\admin\init.js.map
|
package/dist/admin/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"src\\admin\\init.js","names":["window","kempo","pathsToIcons","monacoUrl","litDisableBundleWarning"],"sources":["0"],"sourcesContent":["window.kempo = { pathsToIcons: ['/admin/icons', '/kempo/icons', '/kempo-ui/icons'], monacoUrl: '/monaco-editor' };\
|
|
1
|
+
{"version":3,"file":"src\\admin\\init.js","names":["window","kempo","pathsToIcons","monacoUrl","lexicalUrl","litDisableBundleWarning"],"sources":["0"],"sourcesContent":["window.kempo = { pathsToIcons: ['/admin/icons', '/kempo/icons', '/kempo-ui/icons'], monacoUrl: '/monaco-editor', lexicalUrl: '/kempo/vendor/lexical' };\nwindow.litDisableBundleWarning = true;\n\n/*\n Dynamic imports are required here becasue static imports are hoisted and resolved before any code runs,\n meaning window.kempo would not yet be set when these components initialize.\n Dynamic import() is called at runtime, after the synchronous assignments above,\n guaranteeing window.kempo.pathsToIcons is available when the components load.\n*/\nimport('/kempo-ui/components/Import.js');\nimport('/kempo-ui/components/Aside.js');\nimport('/kempo-ui/components/Main.js');\n"],"mappings":"AAAAA,OAAOC,MAAQ,CAAEC,aAAc,CAAC,eAAgB,eAAgB,mBAAoBC,UAAW,iBAAkBC,WAAY,yBAC7HJ,OAAOK,yBAA0B,SAQ1B,yCACA,wCACA","ignoreList":[]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as J,b as H}from"/kempo/vendor/lexical/chunks/chunk-LMH5Y7M4.js";import{q as I}from"/kempo/vendor/lexical/chunks/chunk-PZQA5MC4.js";import{a as M,r as _}from"/kempo/vendor/lexical/chunks/chunk-FYATIV3K.js";import{A as F,Ba as P,Bc as $,D as R,J as O,Q as T,R as u,Wa as b,Zc as A,b as K,eb as E,f as y,fa as g,gc as L,na as m,s as w,sa as x,ta as v}from"/kempo/vendor/lexical/chunks/chunk-ZMJQPFLE.js";var S={};K(S,{$generateJSONFromSelectedNodes:()=>W,$generateNodesFromSerializedNodes:()=>Y,$getClipboardDataFromSelection:()=>q,$getHtmlContent:()=>G,$getLexicalContent:()=>k,$insertDataTransferForPlainText:()=>V,$insertDataTransferForRichText:()=>Q,$insertGeneratedNodes:()=>D,copyToClipboard:()=>X,setLexicalClipboardDataTransfer:()=>B});function N(o,...e){let t=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",o);for(let s of e)n.append("v",s);throw t.search=n.toString(),Error(`Minified Lexical error #${o}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function G(o,e=u()){return e==null&&N(166),m(e)&&e.isCollapsed()||e.getNodes().length===0?"":J(o,e)}function k(o,e=u()){return e==null&&N(166),m(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(W(o,e))}function V(o,e){let t=o.getData("text/plain")||o.getData("text/uri-list");t!=null&&e.insertRawText(t)}function Q(o,e,t){let n=o.getData("application/x-lexical-editor");if(n)try{let r=JSON.parse(n);if(r.namespace===t._config.namespace&&Array.isArray(r.nodes))return D(t,Y(r.nodes),e)}catch(r){console.error(r)}let s=o.getData("text/html"),c=o.getData("text/plain");if(s&&c!==s)try{let r=new DOMParser().parseFromString((function(i){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:l=>l}).createHTML(i):i})(s),"text/html");return D(t,H(t,r),e)}catch(r){console.error(r)}let a=c||o.getData("text/uri-list");if(a!=null)if(m(e)){let r=a.split(/(\r?\n|\t)/);r[r.length-1]===""&&r.pop();for(let i=0;i<r.length;i++){let l=u();if(m(l)){let d=r[i];d===`
|
|
2
|
+
`||d===`\r
|
|
3
|
+
`?l.insertParagraph():d===" "?l.insertNodes([w()]):l.insertText(d)}}}else e.insertRawText(a)}function D(o,e,t){o.dispatchCommand(L,{nodes:e,selection:t})||(t.insertNodes(e),(function(n){if(m(n)&&n.isCollapsed()){let s=n.anchor,c=null,a=y(s,"previous");if(a)if(v(a))c=a.origin;else{let r=F(a,R(T(),"next").getFlipped());for(let i of r){if(x(i.origin)){c=i.origin;break}if(g(i.origin)&&!i.origin.isInline())break}}if(c&&x(c)){let r=c.getFormat(),i=c.getStyle();n.format===r&&n.style===i||(n.format=r,n.style=i,n.dirty=!0)}}})(t))}function U(o,e,t,n=[]){let s=e===null||t.isSelected(e),c=g(t)&&t.excludeFromCopy("html"),a=t;e!==null&&x(a)&&(a=_(e,a,"clone"));let r=g(a)?a.getChildren():[],i=(function(l){let d=l.exportJSON(),f=l.constructor;if(d.type!==f.getType()&&N(58,f.name),g(l)){let C=d.children;Array.isArray(C)||N(59,f.name)}return d})(a);x(a)&&a.getTextContentSize()===0&&(s=!1);for(let l=0;l<r.length;l++){let d=r[l],f=U(o,e,d,i.children);!s&&g(t)&&f&&t.extractWithChild(d,e,"clone")&&(s=!0)}if(s&&!c)n.push(i);else if(Array.isArray(i.children))for(let l=0;l<i.children.length;l++){let d=i.children[l];n.push(d)}return s}function W(o,e){let t=[],n=T().getChildren();for(let s=0;s<n.length;s++)U(o,e,n[s],t);return{namespace:o._config.namespace,nodes:t}}function Y(o){let e=[];for(let t=0;t<o.length;t++){let n=o[t],s=P(n);x(s)&&M(s),e.push(s)}return e}var h=null;async function X(o,e,t){if(h!==null)return!1;if(e!==null)return new Promise((l,d)=>{o.update(()=>{l(z(o,e,t))})});let n=o.getRootElement(),s=o._window||window,c=s.document,a=$(s);if(n===null||a===null)return!1;let r=c.createElement("span");r.style.cssText="position: fixed; top: -1000px;",r.append(c.createTextNode("#")),n.append(r);let i=new Range;return i.setStart(r,0),i.setEnd(r,1),a.removeAllRanges(),a.addRange(i),new Promise((l,d)=>{let f=o.registerCommand(E,C=>(I(C,ClipboardEvent)&&(f(),h!==null&&(s.clearTimeout(h),h=null),l(z(o,C,t))),!0),b);h=s.setTimeout(()=>{f(),h=null,l(!1)},50),c.execCommand("copy"),r.remove()})}function z(o,e,t){if(t===void 0){let s=$(o._window),c=u();if(!c||c.isCollapsed()||!s)return!1;let a=s.anchorNode,r=s.focusNode;if(a!==null&&r!==null&&!A(o,a,r))return!1;t=q(c)}e.preventDefault();let n=e.clipboardData;return n!==null&&(B(n,t),!0)}var j=[["text/html",G],["application/x-lexical-editor",k]];function q(o=u()){let e={"text/plain":o?o.getTextContent():""};if(o){let t=O();for(let[n,s]of j){let c=s(t,o);c!==null&&(e[n]=c)}}return e}function B(o,e){for(let[t]of j)e[t]===void 0&&o.setData(t,"");for(let t in e){let n=e[t];n!==void 0&&o.setData(t,n)}}var p=S,ne=p.$generateJSONFromSelectedNodes,re=p.$generateNodesFromSerializedNodes,se=p.$getClipboardDataFromSelection,ae=p.$getHtmlContent,ie=p.$getLexicalContent,le=p.$insertDataTransferForPlainText,ce=p.$insertDataTransferForRichText,de=p.$insertGeneratedNodes,pe=p.copyToClipboard,fe=p.setLexicalClipboardDataTransfer;export{se as a,ce as b,pe as c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as Gt,f as Wt,h as Yt,s as Vt}from"/kempo/vendor/lexical/chunks/chunk-PZQA5MC4.js";import{$c as w,Ha as bt,J as mt,Ja as Ot,M as Et,O as xt,Oc as Ut,Q as W,R as N,Sa as Dt,T as yt,Ua as Rt,Vb as Ft,Wa as wt,Wb as _t,Xa as $,Za as V,_b as It,b as ye,ba as vt,bc as At,bd as Zt,ea as St,ec as $t,ed as v,hd as L,id as q,l as ht,la as Y,mc as Pt,n as gt,na as R,nb as P,nc as Lt,o as G,oc as kt,q as pt,qc as X,rb as Ct,sc as zt,tb as Tt,tc as Kt,uc as jt,vb as J,wc as Ht,xc as Bt,yc as x,za as Nt,zb as Mt}from"/kempo/vendor/lexical/chunks/chunk-ZMJQPFLE.js";var ft={};ye(ft,{$createHorizontalRuleNode:()=>Z,$isDecoratorTextNode:()=>de,$isHorizontalRuleNode:()=>me,AutoFocusExtension:()=>be,ClearEditorExtension:()=>Oe,DecoratorTextExtension:()=>Me,DecoratorTextNode:()=>A,EditorStateExtension:()=>B,HorizontalRuleExtension:()=>Ke,HorizontalRuleNode:()=>D,INSERT_HORIZONTAL_RULE_COMMAND:()=>pe,InitialStateExtension:()=>he,LexicalBuilder:()=>O,NestedEditorExtension:()=>je,NodeSelectionExtension:()=>ct,SelectionAlwaysOnDisplayExtension:()=>He,TabIndentationExtension:()=>Be,applyFormatFromStyle:()=>Re,applyFormatToDom:()=>we,batch:()=>ee,buildEditorFromExtensions:()=>Ae,computed:()=>oe,configExtension:()=>zt,declarePeerDependency:()=>Bt,defineExtension:()=>x,effect:()=>y,getExtensionDependencyFromEditor:()=>Pe,getKnownTypesAndNodes:()=>De,getPeerDependencyFromEditor:()=>ge,getPeerDependencyFromEditorOrThrow:()=>Le,namedSignals:()=>F,registerClearEditor:()=>ae,registerTabIndentation:()=>xe,safeCast:()=>v,shallowMergeConfig:()=>L,signal:()=>M,untracked:()=>ot,watchedSignal:()=>lt});var ve=Symbol.for("preact-signals");function U(){if(S>1)return void S--;let e,t=!1;for(!(function(){let n=j;for(j=void 0;n!==void 0;)n.S.v===n.v&&(n.S.i=n.i),n=n.o})();I!==void 0;){let n=I;for(I=void 0,H++;n!==void 0;){let i=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ne(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=i}}if(H=0,S--,t)throw e}function ee(e){if(S>0)return e();st=++Se,S++;try{return e()}finally{U()}}var f,I;function ot(e){let t=f;f=void 0;try{return e()}finally{f=t}}var j,S=0,H=0,Se=0,st=0,K=0;function Jt(e){if(f===void 0)return;let t=e.n;return t===void 0||t.t!==f?(t={i:0,S:e,p:f.s,n:void 0,t:f,e:void 0,x:void 0,r:t},f.s!==void 0&&(f.s.n=t),f.s=t,e.n=t,32&f.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=f.s,t.n=void 0,f.s.n=t,f.s=t),t):void 0}function E(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function M(e,t){return new E(e,t)}function ne(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Xt(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function ie(e){let t,n=e.s;for(;n!==void 0;){let i=n.p;n.i===-1?(n.S.U(n),i!==void 0&&(i.n=n.n),n.n!==void 0&&(n.n.p=i)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=i}e.s=t}function b(e,t){E.call(this,void 0),this.x=e,this.s=void 0,this.g=K-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function oe(e,t){return new b(e,t)}function se(e){let t=e.m;if(e.m=void 0,typeof t=="function"){S++;let n=f;f=void 0;try{t()}catch(i){throw e.f&=-2,e.f|=8,dt(e),i}finally{f=n,U()}}}function dt(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,se(e)}function Ne(e){if(f!==this)throw new Error("Out-of-order effect");ie(this),f=e,this.f&=-2,8&this.f&&dt(this),U()}function T(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name}function y(e,t){let n=new T(e,t);try{n.c()}catch(o){throw n.d(),o}let i=n.d.bind(n);return i[Symbol.dispose]=i,i}function F(e,t={}){let n={};for(let i in e){let o=t[i],s=M(o===void 0?e[i]:o);n[i]=s}return n}E.prototype.brand=ve,E.prototype.h=function(){return!0},E.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t!==void 0?t.e=e:ot(()=>{var n;(n=this.W)==null||n.call(this)}))},E.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&ot(()=>{var i;(i=this.Z)==null||i.call(this)}))}},E.prototype.subscribe=function(e){return y(()=>{let t=this.value,n=f;f=void 0;try{e(t)}finally{f=n}},{name:"sub"})},E.prototype.valueOf=function(){return this.value},E.prototype.toString=function(){return this.value+""},E.prototype.toJSON=function(){return this.value},E.prototype.peek=function(){let e=f;f=void 0;try{return this.value}finally{f=e}},Object.defineProperty(E.prototype,"value",{get(){let e=Jt(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(H>100)throw new Error("Cycle detected");(function(t){S!==0&&H===0&&t.l!==st&&(t.l=st,j={S:t,v:t.v,i:t.i,o:j})})(this),this.v=e,this.i++,K++,S++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{U()}}}}),b.prototype=new E,b.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===K))return!0;if(this.g=K,this.f|=1,this.i>0&&!ne(this))return this.f&=-2,!0;let e=f;try{Xt(this),f=this;let t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return f=e,ie(this),this.f&=-2,!0},b.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}E.prototype.S.call(this,e)},b.prototype.U=function(e){if(this.t!==void 0&&(E.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}},b.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(b.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=Jt(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),T.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}},T.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,se(this),Xt(this),S++;let e=f;return f=this,Ne.bind(this,e)},T.prototype.N=function(){2&this.f||(this.f|=2,this.u=I,I=this)},T.prototype.d=function(){this.f|=8,1&this.f||dt(this)},T.prototype.dispose=function(){this.d()};var be=x({build:(e,t,n)=>F(t),config:v({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let i=n.getOutput();return y(()=>i.disabled.value?void 0:e.registerRootListener(o=>{e.focus(()=>{let s=document.activeElement;o===null||s!==null&&o.contains(s)||o.focus({preventScroll:!0})},{defaultSelection:i.defaultSelection.peek()})}))}});function re(){let e=W(),t=N(),n=G();e.clear(),e.append(n),t!==null&&n.select(),R(t)&&(t.format=0)}function ae(e,t=re){return e.registerCommand(Dt,n=>(e.update(t),!0),$)}var Oe=x({build:(e,t,n)=>F(t),config:v({$onClear:re}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:i}=n.getOutput();return y(()=>ae(e,i.value))}});function De(e){let t=new Set,n=new Set;for(let i of ce(e)){let o=typeof i=="function"?i:i.replace;t.add(o.getType()),n.add(o)}return{nodes:n,types:t}}function ce(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var Q=Ht("format",{parse:e=>typeof e=="number"?e:0}),A=class extends P{$config(){return this.config("decorator-text",{extends:P,stateConfigs:[{flat:!0,stateConfig:Q}]})}getFormat(){return yt(this,Q)}getFormatFlags(t,n){return q(this.getFormat(),t,n)}hasFormat(t){let n=Pt[t];return(this.getFormat()&n)!==0}setFormat(t){return Ot(this,Q,t)}toggleFormat(t){let n=this.getFormat(),i=q(n,t,null);return this.setFormat(i)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function de(e){return e instanceof A}function Re(e,t,n){let i=t.fontWeight,o=t.textDecoration.split(" "),s=i==="700"||i==="bold",r=o.includes("line-through"),a=t.fontStyle==="italic",d=o.includes("underline"),l=t.verticalAlign;return s&&!e.hasFormat("bold")&&e.toggleFormat("bold"),r&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),a&&!e.hasFormat("italic")&&e.toggleFormat("italic"),d&&!e.hasFormat("underline")&&e.toggleFormat("underline"),l!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),l!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e}function we(e,t,n=Te){for(let[i,o]of Object.entries(n))e.hasFormat(o)&&(t=Ce(t,i));return t}function Ce(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Te={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},Me=x({name:"@lexical/extension/DecoratorText",nodes:()=>[A],register:(e,t,n)=>e.registerCommand(Ct,i=>{let o=N();if(Y(o)||R(o))for(let s of o.getNodes())de(s)&&s.toggleFormat(i);return!1},V)});function lt(e,t){let n;return M(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var B=x({build:e=>lt(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function h(e,...t){let n=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",e);for(let o of t)i.append("v",o);throw n.search=i.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function le(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){let n=e,i=t;for(let o in i)n[o]=le(n[o],i[o]);return e}return t}var ut=0,rt=1,ue=2,tt=3,k=4,C=5,et=6,_=7;function nt(e){return e.id===ut}function fe(e){return e.id===ue}function Fe(e){return(function(t){return t.id===rt})(e)||h(305,String(e.id),String(rt)),Object.assign(e,{id:ue})}var _e=new Set,at=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:ut}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):L;for(let i of this.configs)t=n(t,i);return t}init(t){let n=this.state;fe(n)||h(306,String(n.id));let i={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},o={...i,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},s=(function(a,d,l){return Object.assign(a,{config:d,id:tt,registerState:l})})(n,this.mergeConfigs(),i),r;this.state=s,this.extension.init&&(r=this.extension.init(t,s.config,i)),this.state=(function(a,d,l){return Object.assign(a,{id:k,initResult:d,registerState:l})})(s,r,o)}build(t){let n=this.state,i;n.id!==k&&h(307,String(n.id),String(C)),this.extension.build&&(i=this.extension.build(t,n.config,n.registerState));let o={...n.registerState,getOutput:()=>i,getSignal:this.getSignal.bind(this)};this.state=(function(s,r,a){return Object.assign(s,{id:C,output:r,registerState:a})})(n,i,o)}register(t,n){this._signal=n;let i=this.state;i.id!==C&&h(308,String(i.id),String(C));let o=this.extension.register&&this.extension.register(t,i.config,i.registerState);return this.state=(function(s){return Object.assign(s,{id:et})})(i),()=>{let s=this.state;s.id!==_&&h(309,String(i.id),String(_)),this.state=(function(r){return Object.assign(r,{id:C})})(s),o&&o()}}afterRegistration(t){let n=this.state,i;return n.id!==et&&h(310,String(n.id),String(et)),this.extension.afterRegistration&&(i=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(o){return Object.assign(o,{id:_})})(n),i}getSignal(){return this._signal===void 0&&h(311),this._signal}getInitResult(){this.extension.init===void 0&&h(312,this.extension.name);let t=this.state;return(function(n){return n.id>=k})(t)||h(313,String(t.id),String(k)),t.initResult}getInitPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(n){return n.id>=tt})(t)||h(314,String(t.id),String(tt)),{config:t.config}}getPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}getInitDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&h(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&h(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=_})(t)||h(316,String(t.id),String(_)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||_e}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(n){return n.id>=C})(t)||h(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},qt={tag:Tt};function Ie(){let e=W();e.isEmpty()&&e.append(G())}var he=x({config:v({setOptions:qt,updateOptions:qt}),init:({$initialEditorState:e=Ie})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},i){let o=i.getInitResult();if(!o.initialized){o.initialized=!0;let{$initialEditorState:s}=o;if(St(s))e.setEditorState(s,n);else if(typeof s=="function")e.update(()=>{s(e)},t);else if(s&&(typeof s=="string"||typeof s=="object")){let r=e.parseEditorState(s);e.setEditorState(r,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[$t,kt,_t,Lt,At]}),Qt=Symbol.for("@lexical/extension/LexicalBuilder");function Ae(...e){return O.fromExtensions(e).buildEditor()}function te(){}function $e(e){throw e}function z(e){return Array.isArray(e)?e:[e]}var it="0.43.0+prod.esm",O=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=it,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[z(he)];for(let i of t)n.push(z(i));return new e(n)}static maybeFromEditor(t){let n=t[Qt];return n&&(n.PACKAGE_VERSION!==it&&h(292,n.PACKAGE_VERSION,it),n instanceof e||h(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&h(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...i}=this.buildCreateEditorArgs(),o=Object.assign(jt({...i,...n?{onError:s=>{n(s,o)}}:{}}),{[Qt]:this});for(let s of this.sortedExtensionReps())s.build(o);return o}buildEditor(){let t=te;function n(){try{t()}finally{t=te}}let i=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=w(this.registerEditor(i),()=>i.setRootElement(null)),i}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let n=this.extensionNameMap.get(t.name);if(n)return n.extension!==t&&h(295,t.name),n}addEdge(t,n,i){let o=this.outgoingConfigEdges.get(t);o?o.set(n,i):this.outgoingConfigEdges.set(t,new Map([[n,i]]));let s=this.incomingEdges.get(n);s?s.add(t):this.incomingEdges.set(n,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&h(296);let n=z(t),[i]=n;typeof i.name!="string"&&h(297,typeof i.name);let o=this.extensionNameMap.get(i.name);if(o!==void 0&&o.extension!==i&&h(298,i.name),!o){o=new at(this,i),this.extensionNameMap.set(i.name,o);let s=this.conflicts.get(i.name);typeof s=="string"&&h(299,i.name,s);for(let r of i.conflictsWith||[])this.extensionNameMap.has(r)&&h(299,i.name,r),this.conflicts.set(r,i.name);for(let r of i.dependencies||[]){let a=z(r);this.addEdge(i.name,a[0].name,a.slice(1)),this.addExtension(a)}for(let[r,a]of i.peerDependencies||[])this.addEdge(i.name,r,a?[a]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],n=(i,o)=>{let s=i.state;if(fe(s))return;let r=i.extension.name;var a;nt(s)||h(300,r,o||"[unknown]"),nt(a=s)||h(304,String(a.id),String(ut)),s=Object.assign(a,{id:rt}),i.state=s;let d=this.outgoingConfigEdges.get(r);if(d)for(let l of d.keys()){let g=this.extensionNameMap.get(l);g&&n(g,r)}s=Fe(s),i.state=s,t.push(i)};for(let i of this.extensionNameMap.values())nt(i.state)&&n(i);for(let i of t)for(let[o,s]of this.outgoingConfigEdges.get(i.extension.name)||[])if(s.length>0){let r=this.extensionNameMap.get(o);if(r)for(let a of s)r.configs.add(a)}for(let[i,...o]of this.roots)if(o.length>0){let s=this.extensionNameMap.get(i.name);s===void 0&&h(301,i.name);for(let r of o)s.configs.add(r)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let n=this.sortedExtensionReps(),i=new AbortController,o=[()=>i.abort()],s=i.signal;for(let r of n){let a=r.register(t,s);a&&o.push(a)}for(let r of n){let a=r.afterRegistration(t);a&&o.push(a)}return w(...o)}buildCreateEditorArgs(){let t={},n=new Set,i=new Map,o=new Map,s={},r={},a=this.sortedExtensionReps();for(let g of a){let{extension:u}=g;if(u.onError!==void 0&&(t.onError=u.onError),u.disableEvents!==void 0&&(t.disableEvents=u.disableEvents),u.parentEditor!==void 0&&(t.parentEditor=u.parentEditor),u.editable!==void 0&&(t.editable=u.editable),u.namespace!==void 0&&(t.namespace=u.namespace),u.$initialEditorState!==void 0&&(t.$initialEditorState=u.$initialEditorState),u.nodes)for(let p of ce(u)){if(typeof p!="function"){let m=i.get(p.replace);m&&h(302,u.name,p.replace.name,m.extension.name),i.set(p.replace,g)}n.add(p)}if(u.html){if(u.html.export)for(let[p,m]of u.html.export.entries())o.set(p,m);u.html.import&&Object.assign(s,u.html.import)}u.theme&&le(r,u.theme)}Object.keys(r).length>0&&(t.theme=r),n.size&&(t.nodes=[...n]);let d=Object.keys(s).length>0,l=o.size>0;(d||l)&&(t.html={},d&&(t.html.import=s),l&&(t.html.export=o));for(let g of a)g.init(t);return t.onError||(t.onError=$e),t}};function Pe(e,t){let n=O.fromEditor(e).getExtensionRep(t);return n===void 0&&h(303,t.name),n.getExtensionDependency()}function ge(e,t){let n=O.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function Le(e,t){let n=ge(e,t);return n===void 0&&h(291,t),n}var ke=new Set,ct=x({build(e,t,n){let i=n.getDependency(B).output,o=M({watchedNodeKeys:new Map}),s=lt(()=>{},()=>y(()=>{let r=s.peek(),{watchedNodeKeys:a}=o.value,d,l=!1;i.value.read(()=>{if(N())for(let[g,u]of a.entries()){if(u.size===0){a.delete(g);continue}let p=Et(g),m=p&&p.isSelected()||!1;l=l||m!==(!!r&&r.has(g)),m&&(d=d||new Set,d.add(g))}}),!l&&d&&r&&d.size===r.size||(s.value=d)}));return{watchNodeKey:function(r){let a=oe(()=>(s.value||ke).has(r)),{watchedNodeKeys:d}=o.peek(),l=d.get(r),g=l!==void 0;return l=l||new Set,l.add(a),g||(d.set(r,l),o.value={watchedNodeKeys:d}),a}}},dependencies:[B],name:"@lexical/extension/NodeSelection"}),pe=Kt("INSERT_HORIZONTAL_RULE_COMMAND"),D=class e extends P{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return Z().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:ze,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return X(n,t.theme.hr),n}getTextContent(){return`
|
|
2
|
+
`}isInline(){return!1}updateDOM(){return!1}};function ze(){return{node:Z()}}function Z(){return ht(D)}function me(e){return e instanceof D}var Ke=x({dependencies:[B,ct],name:"@lexical/extension/HorizontalRule",nodes:()=>[D],register(e,t,n){let{watchNodeKey:i}=n.getDependency(ct).output,o=M({nodeSelections:new Map}),s=e._config.theme.hrSelected??"selected";return w(e.registerCommand(pe,r=>{let a=N();if(!R(a))return!1;if(a.focus.getNode()!==null){let d=Z();Yt(d)}return!0},$),e.registerCommand(Rt,r=>{if(Ut(r.target)){let a=xt(r.target);if(me(a))return(function(d,l=!1){let g=N(),u=d.isSelected(),p=d.getKey(),m;l&&Y(g)?m=g:(m=gt(),bt(m)),u?m.delete(p):m.add(p)})(a,r.shiftKey),!0}return!1},V),e.registerMutationListener(D,(r,a)=>{ee(()=>{let d=!1,{nodeSelections:l}=o.peek();for(let[g,u]of r.entries())if(u==="destroyed")l.delete(g),d=!0;else{let p=l.get(g),m=e.getElementByKey(g);p?p.domNode.value=m:(d=!0,l.set(g,{domNode:M(m),selectedSignal:i(g)}))}d&&(o.value={nodeSelections:l})})}),y(()=>{let r=[];for(let{domNode:a,selectedSignal:d}of o.value.nodeSelections.values())r.push(y(()=>{let l=a.value;l&&(d.value?X(l,s):Zt(l,s))}));return w(...r)}))}}),je=x({build:(e,t)=>F({inheritEditableFromParent:t.inheritEditableFromParent}),config:v({$getParentEditor:function(){let e=mt();return O.fromEditor(e),e},inheritEditableFromParent:!1}),init:(e,t,n)=>{let i=t.$getParentEditor();e.parentEditor=i,e.theme=e.theme||i._config.theme},name:"@lexical/extension/NestedEditor",register:(e,t,n)=>y(()=>{let i=e._parentEditor;if(i&&n.getOutput().inheritEditableFromParent.value)return e.setEditable(i.isEditable()),i.registerEditableListener(e.setEditable.bind(e))})}),He=x({build:(e,t,n)=>F(t),config:v({disabled:!1,onReposition:void 0}),name:"@lexical/utils/SelectionAlwaysOnDisplay",register:(e,t,n)=>{let i=n.getOutput();return y(()=>{if(!i.disabled.value)return Vt(e,i.onReposition.value)})}});function Ee(e){return e.canBeEmpty()}function xe(e,t,n=Ee){return w(e.registerCommand(Ft,i=>{let o=N();if(!R(o))return!1;i.preventDefault();let s=(function(r){if(r.getNodes().filter(p=>vt(p)&&p.canIndent()).length>0)return!0;let a=r.anchor,d=r.focus,l=d.isBefore(a)?d:a,g=l.getNode(),u=Gt(g);if(u.canIndent()){let p=u.getKey(),m=pt();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=Nt(m),m.anchor.is(l))return!0}return!1})(o)?i.shiftKey?It:J:Mt;return e.dispatchCommand(s,void 0)},$),e.registerCommand(J,()=>{let i=typeof t=="number"?t:t?t.peek():null,o=N();if(!R(o))return!1;let s=typeof n=="function"?n:n.peek();return Wt(r=>{if(s(r)){let a=r.getIndent()+1;(!i||a<i)&&r.setIndent(a)}})},wt))}var Be=x({build:(e,t,n)=>F(t),config:v({$canIndent:Ee,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:i,maxIndent:o,$canIndent:s}=n.getOutput();return y(()=>{if(!i.value)return xe(e,o,s)})}});var c=ft,We=c.$createHorizontalRuleNode,Ye=c.$isDecoratorTextNode,Ve=c.$isHorizontalRuleNode,Je=c.AutoFocusExtension,Xe=c.ClearEditorExtension,qe=c.DecoratorTextExtension,Qe=c.DecoratorTextNode,tn=c.EditorStateExtension,en=c.HorizontalRuleExtension,nn=c.HorizontalRuleNode,on=c.INSERT_HORIZONTAL_RULE_COMMAND,sn=c.InitialStateExtension,rn=c.LexicalBuilder,an=c.NestedEditorExtension,cn=c.NodeSelectionExtension,dn=c.SelectionAlwaysOnDisplayExtension,ln=c.TabIndentationExtension,un=c.applyFormatFromStyle,fn=c.applyFormatToDom,hn=c.batch,gn=c.buildEditorFromExtensions,pn=c.computed,mn=c.configExtension,En=c.declarePeerDependency,xn=c.defineExtension,yn=c.effect,vn=c.getExtensionDependencyFromEditor,Sn=c.getKnownTypesAndNodes,Nn=c.getPeerDependencyFromEditor,bn=c.getPeerDependencyFromEditorOrThrow,On=c.namedSignals,Dn=c.registerClearEditor,Rn=c.registerTabIndentation,wn=c.safeCast,Cn=c.shallowMergeConfig,Tn=c.signal,Mn=c.untracked,Fn=c.watchedSignal;export{hn as a,yn as b,Nn as c,On as d,Tn as e};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{Ab as F,C as q,Ea as ne,Ha as I,J as G,M as J,P as k,R as K,_ as Q,b as ye,ca as Y,da as Z,f as j,fa as S,g as V,ga as ee,h as W,i as U,ia as te,na as C,oa as B,pa as N,q as H,sa as x,t as O,u as X,v,va as A}from"/kempo/vendor/lexical/chunks/chunk-ZMJQPFLE.js";var _={};ye(_,{$addNodeStyle:()=>Te,$cloneWithProperties:()=>W,$copyBlockFormatIndent:()=>de,$ensureForwardRangeSelection:()=>fe,$forEachSelectedTextNode:()=>ae,$getComputedStyleForElement:()=>L,$getComputedStyleForParent:()=>M,$getSelectionStyleValueForProperty:()=>Oe,$isAtNodeEnd:()=>Ce,$isParentElementRTL:()=>z,$isParentRTL:()=>$e,$moveCaretSelection:()=>pe,$moveCharacter:()=>Re,$patchStyleText:()=>Ne,$selectAll:()=>ne,$setBlocksType:()=>Fe,$shouldOverrideDefaultCharacterSelection:()=>Ee,$sliceSelectedTextNodeContent:()=>xe,$trimTextContentFromAnchor:()=>ce,$wrapNodes:()=>ve,createDOMRange:()=>me,createRectsFromDOMRange:()=>Se,getCSSFromStyleObject:()=>ie,getStyleObjectFromCSS:()=>w,trimTextContentFromAnchor:()=>ke});function D(t,...e){let l=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let s of e)n.append("v",s);throw l.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${l.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var R=new Map;function oe(t){let e=t;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function re(t){let e=t.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(t)]}function me(t,e,l,n,s){let o=e.getKey(),a=n.getKey(),r=document.createRange(),i=t.getElementByKey(o),c=t.getElementByKey(a),u=l,g=s;if(x(e)&&(i=oe(i)),x(n)&&(c=oe(c)),e===void 0||n===void 0||i===null||c===null)return null;i.nodeName==="BR"&&([i,u]=re(i)),c.nodeName==="BR"&&([c,g]=re(c));let p=i.firstChild;i===c&&p!=null&&p.nodeName==="BR"&&u===0&&g===0&&(g=1);try{r.setStart(i,u),r.setEnd(c,g)}catch{return null}return!r.collapsed||u===g&&o===a||(r.setStart(c,g),r.setEnd(i,u)),r}function Se(t,e){let l=t.getRootElement();if(l===null)return[];let n=l.getBoundingClientRect(),s=getComputedStyle(l),o=parseFloat(s.paddingLeft)+parseFloat(s.paddingRight),a=Array.from(e.getClientRects()),r,i=a.length;a.sort((c,u)=>{let g=c.top-u.top;return Math.abs(g)<=3?c.left-u.left:g});for(let c=0;c<i;c++){let u=a[c],g=r&&r.top<=u.top&&r.top+r.height>u.top&&r.left+r.width>u.left,p=u.width+o===n.width;g||p?(a.splice(c--,1),i--):r=u}return a}function le(t){let e={};if(!t)return e;let l=t.split(";");for(let n of l)if(n!==""){let[s,o]=n.split(/:([^]+)/);s&&o&&(e[s.trim()]=o.trim())}return e}function w(t){let e=R.get(t);return e===void 0&&(e=le(t),R.set(t,e)),e}function ie(t){let e="";for(let l in t)l&&(e+=`${l}: ${t[l]};`);return e}function L(t){let e=G().getElementByKey(t.getKey());if(e===null)return null;let l=e.ownerDocument.defaultView;return l===null?null:l.getComputedStyle(e)}function M(t){return L(B(t)?t:t.getParentOrThrow())}function $e(t){let e=M(t);return e!==null&&e.direction==="rtl"}function xe(t,e,l="self"){let n=t.getStartEndPoints();if(e.isSelected(t)&&!A(e)&&n!==null){let[s,o]=n,a=t.isBackward(),r=s.getNode(),i=o.getNode(),c=e.is(r),u=e.is(i);if(c||u){let[g,p]=q(t),h=r.is(i),f=e.is(a?i:r),d=e.is(a?r:i),m,$=0;h?($=g>p?p:g,m=g>p?g:p):f?($=a?p:g,m=void 0):d&&($=0,m=a?g:p);let T=e.__text.slice($,m);T!==e.__text&&(l==="clone"&&(e=U(e)),e.__text=T)}}return e}function Ce(t){if(t.type==="text")return t.offset===t.getNode().getTextContentSize();let e=t.getNode();return S(e)||D(177),t.offset===e.getChildrenSize()}function ce(t,e,l){let n=e.getNode(),s=l;if(S(n)){let o=n.getDescendantByIndex(e.offset);o!==null&&(n=o)}for(;s>0&&n!==null;){if(S(n)){let c=n.getLastDescendant();c!==null&&(n=c)}let o=n.getPreviousSibling(),a=0;if(o===null){let c=n.getParentOrThrow(),u=c.getPreviousSibling();for(;u===null;){if(c=c.getParent(),c===null){o=null;break}u=c.getPreviousSibling()}c!==null&&(a=c.isInline()?0:2,o=u)}let r=n.getTextContent();r===""&&S(n)&&!n.isInline()&&(r=`
|
|
2
|
+
|
|
3
|
+
`);let i=r.length;if(!x(n)||s>=i){let c=n.getParent();n.remove(),c==null||c.getChildrenSize()!==0||B(c)||c.remove(),s-=i+a,n=o}else{let c=n.getKey(),u=t.getEditorState().read(()=>{let h=J(c);return x(h)&&h.isSimpleText()?h.getTextContent():null}),g=i-s,p=r.slice(0,g);if(u!==null&&u!==r){let h=k(),f=n;if(n.isSimpleText())n.setTextContent(u);else{let d=O(u);n.replace(d),f=d}if(C(h)&&h.isCollapsed()){let d=h.anchor.offset;f.select(d,d)}}else if(n.isSimpleText()){let h=e.key===c,f=e.offset;f<s&&(f=i);let d=h?f-s:0,m=h?f:g;if(h&&d===0){let[$]=n.splitText(d,m);$.remove()}else{let[,$]=n.splitText(d,m);$.remove()}}else{let h=O(p);n.replace(h)}s=0}}}function Te(t){let e=t.getStyle(),l=le(e);R.set(e,l)}function E(t,e){(C(t)?t.isCollapsed():x(t)||S(t))||D(280);let l=w(C(t)?t.style:x(t)?t.getStyle():t.getTextStyle()),n=Object.entries(e).reduce((o,[a,r])=>(typeof r=="function"?o[a]=r(l[a],t):r===null?delete o[a]:o[a]=r,o),{...l}),s=ie(n);C(t)||x(t)?t.setStyle(s):t.setTextStyle(s),R.set(s,n)}function Ne(t,e){if(C(t)&&t.isCollapsed()){E(t,e);let n=t.anchor.getNode();S(n)&&n.isEmpty()&&E(n,e)}ae(n=>{E(n,e)});let l=t.getNodes();if(l.length>0){let n=new Set;for(let s of l){if(!S(s)||!s.canBeEmpty()||s.getChildrenSize()!==0)continue;let o=s.getKey();n.has(o)||(n.add(o),E(s,e))}}}function ae(t){let e=K();if(!e)return;let l=new Map,n=o=>l.get(o.getKey())||[0,o.getTextContentSize()];if(C(e))for(let o of V(e).getTextSlices())o&&l.set(o.caret.origin.getKey(),o.getSliceIndices());let s=e.getNodes();for(let o of s){if(!x(o)||!o.canHaveFormat())continue;let[a,r]=n(o);r!==a&&(A(o)||a===0&&r===o.getTextContentSize()?t(o):t(o.splitText(a,r)[a===0?0:1]))}C(e)&&e.anchor.type==="text"&&e.focus.type==="text"&&e.anchor.key===e.focus.key&&fe(e)}function fe(t){if(t.isBackward()){let{anchor:e,focus:l}=t,{key:n,offset:s,type:o}=e;e.set(l.key,l.offset,l.type),l.set(n,s,o)}}function de(t,e){let l=t.getFormatType(),n=t.getIndent();l!==e.getFormatType()&&e.setFormat(l),n!==e.getIndent()&&e.setIndent(n)}function Fe(t,e,l=de){if(t===null)return;let n=t.getStartEndPoints(),s=new Map,o=null;if(n){let[a,r]=n;o=H(),o.anchor.set(a.key,a.offset,a.type),o.focus.set(r.key,r.offset,r.type);let i=v(a.getNode(),F),c=v(r.getNode(),F);S(i)&&s.set(i.getKey(),i),S(c)&&s.set(c.getKey(),c)}for(let a of t.getNodes())if(S(a)&&F(a))s.set(a.getKey(),a);else if(n===null){let r=v(a,F);S(r)&&s.set(r.getKey(),r)}for(let[a,r]of s){let i=e();l(r,i),r.replace(i,!0),o&&(a===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,o.anchor.type),a===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,o.focus.type))}o&&t.is(K())&&I(o)}function se(t){return t.getNode().isAttached()}function Pe(t){let e=t;for(;e!==null&&!N(e);){let l=e.getLatest(),n=e.getParent();l.getChildrenSize()===0&&e.remove(!0),e=n}}function ve(t,e,l=null){let n=t.getStartEndPoints(),s=n?n[0]:null,o=t.getNodes(),a=o.length;if(s!==null&&(a===0||a===1&&s.type==="element"&&s.getNode().getChildrenSize()===0)){let c=s.type==="text"?s.getNode().getParentOrThrow():s.getNode(),u=c.getChildren(),g=e();return g.setFormat(c.getFormatType()),g.setIndent(c.getIndent()),u.forEach(p=>g.append(p)),l&&(g=l.append(g)),void c.replace(g)}let r=null,i=[];for(let c=0;c<a;c++){let u=o[c];N(u)?(b(t,i,i.length,e,l),i=[],r=u):r===null||r!==null&&Q(u,r)?i.push(u):(b(t,i,i.length,e,l),i=[u])}b(t,i,i.length,e,l)}function b(t,e,l,n,s=null){if(e.length===0)return;let o=e[0],a=new Map,r=[],i=S(o)?o:o.getParentOrThrow();i.isInline()&&(i=i.getParentOrThrow());let c=!1;for(;i!==null;){let f=i.getPreviousSibling();if(f!==null){i=f,c=!0;break}if(i=i.getParentOrThrow(),N(i))break}let u=new Set;for(let f=0;f<l;f++){let d=e[f];S(d)&&d.getChildrenSize()===0&&u.add(d.getKey())}let g=new Set;for(let f=0;f<l;f++){let d=e[f],m=d.getParent();if(m!==null&&m.isInline()&&(m=m.getParent()),m!==null&&te(d)&&!g.has(d.getKey())){let $=m.getKey();if(a.get($)===void 0){let T=n();T.setFormat(m.getFormatType()),T.setIndent(m.getIndent()),r.push(T),a.set($,T),m.getChildren().forEach(P=>{T.append(P),g.add(P.getKey()),S(P)&&P.getChildrenKeys().forEach(he=>g.add(he))}),Pe(m)}}else if(u.has(d.getKey())){S(d)||D(179);let $=n();$.setFormat(d.getFormatType()),$.setIndent(d.getIndent()),r.push($),d.remove(!0)}}if(s!==null)for(let f=0;f<r.length;f++){let d=r[f];s.append(d)}let p=null;if(N(i))if(c)if(s!==null)i.insertAfter(s);else for(let f=r.length-1;f>=0;f--){let d=r[f];i.insertAfter(d)}else{let f=i.getFirstChild();if(S(f)&&(i=f),f===null)if(s)i.append(s);else for(let d=0;d<r.length;d++){let m=r[d];i.append(m),p=m}else if(s!==null)f.insertBefore(s);else for(let d=0;d<r.length;d++){let m=r[d];f.insertBefore(m),p=m}}else if(s)i.insertAfter(s);else for(let f=r.length-1;f>=0;f--){let d=r[f];i.insertAfter(d),p=d}let h=k();C(h)&&se(h.anchor)&&se(h.focus)?I(h.clone()):p!==null?p.selectEnd():t.dirty=!0}function ue(t){let e=ge(t);return e!==null&&e.writingMode==="vertical-rl"}function ge(t){let e=t.anchor.getNode();return S(e)?L(e):M(e)}function Ee(t,e){let l=ue(t)?!e:e;z(t)&&(l=!l);let n=j(t.focus,l?"previous":"next");if(ee(n))return!1;for(let s of X(n)){if(Y(s))return!s.origin.isInline();if(!S(s.origin)){if(Z(s.origin))return!0;break}}return!1}function pe(t,e,l,n){t.modify(e?"extend":"move",l,n)}function z(t){let e=ge(t);return e!==null&&e.direction==="rtl"}function Re(t,e,l){let n=z(t),s;s=ue(t)||n?!l:l,pe(t,e,s,"character")}function we(t,e,l){let n=w(t.getStyle());return n!==null&&n[e]||l}function Oe(t,e,l=""){let n=null,s=t.getNodes(),o=t.anchor,a=t.focus,r=t.isBackward(),i=r?a.getNode():o.getNode(),c=r?o.getNode():a.getNode(),u=r?a.offset:o.offset,g=r?o.offset:a.offset;if(C(t)&&t.isCollapsed()&&t.style!==""){let p=w(t.style);if(p!==null&&e in p)return p[e]}for(let p=0;p<s.length;p++){let h=s[p];if((p!==0||!h.is(i)||!x(h)||u!==h.getTextContentSize())&&(p===0||!h.is(c)||g!==0)&&x(h)){let f=we(h,e,l);if(n===null)n=f;else if(n!==f){n="";break}}}return n===null?l:n}var ke=ce;var y=_,Ae=y.$addNodeStyle,Ie=y.$cloneWithProperties,be=y.$copyBlockFormatIndent,De=y.$ensureForwardRangeSelection,Le=y.$forEachSelectedTextNode,Me=y.$getComputedStyleForElement,ze=y.$getComputedStyleForParent,_e=y.$getSelectionStyleValueForProperty,je=y.$isAtNodeEnd,Ve=y.$isParentElementRTL,We=y.$isParentRTL,Ue=y.$moveCaretSelection,He=y.$moveCharacter,Xe=y.$patchStyleText,qe=y.$selectAll,Ge=y.$setBlocksType,Je=y.$shouldOverrideDefaultCharacterSelection,Qe=y.$sliceSelectedTextNodeContent,Ye=y.$trimTextContentFromAnchor,Ze=y.$wrapNodes,et=y.createDOMRange,tt=y.createRectsFromDOMRange,nt=y.getCSSFromStyleObject,ot=y.getStyleObjectFromCSS,rt=y.trimTextContentFromAnchor;export{Ae as a,Ie as b,be as c,De as d,Le as e,Me as f,ze as g,_e as h,je as i,Ve as j,We as k,Ue as l,He as m,Xe as n,qe as o,Ge as p,Je as q,Qe as r,Ye as s,Ze as t,et as u,tt as v,nt as w,ot as x,rt as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as v,o as _}from"/kempo/vendor/lexical/chunks/chunk-PZQA5MC4.js";import{r as H}from"/kempo/vendor/lexical/chunks/chunk-FYATIV3K.js";import{Gc as T,Na as $,Nc as A,Q as M,Rc as y,Vc as S,b as W,ba as D,fa as N,m as w,o as b,pa as O,sa as E}from"/kempo/vendor/lexical/chunks/chunk-ZMJQPFLE.js";var C={};W(C,{$generateHtmlFromNodes:()=>J,$generateNodesFromDOM:()=>z});function z(r,o){let c=A(o)?o.body.childNodes:o.childNodes,l=[],s=[];for(let i of c)if(!R.has(i.nodeName)){let e=k(i,r,s,!1);e!==null&&(l=l.concat(e))}return(function(i){for(let e of i)e.getNextSibling()instanceof $&&e.insertAfter(w());for(let e of i){let t=e.getChildren();for(let d of t)e.insertBefore(d);e.remove()}})(s),l}function J(r,o){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let c=document.createElement("div"),l=M().getChildren();for(let s=0;s<l.length;s++)L(r,l[s],c,o);return c.innerHTML}function L(r,o,c,l=null){let s=l===null||o.isSelected(l),i=N(o)&&o.excludeFromCopy("html"),e=o;l!==null&&E(o)&&(e=H(l,o,"clone"));let t=N(e)?e.getChildren():[],d=T(r,e.getType()),u;u=d&&d.exportDOM!==void 0?d.exportDOM(r,e):e.exportDOM(r);let{element:a,after:p}=u;if(!a)return!1;let m=document.createDocumentFragment();for(let f=0;f<t.length;f++){let n=t[f],h=L(r,n,m,l);!s&&N(o)&&h&&o.extractWithChild(n,l,"html")&&(s=!0)}if(s&&!i){if((_(a)||y(a))&&a.append(m),c.append(a),p){let f=p.call(e,a);f&&(y(a)?a.replaceChildren(f):a.replaceWith(f))}}else c.append(m);return s}var R=new Set(["STYLE","SCRIPT"]);function k(r,o,c,l,s=new Map,i){let e=[];if(R.has(r.nodeName))return e;let t=null,d=(function(n,h){let{nodeName:P}=n,F=h._htmlConversions.get(P.toLowerCase()),g=null;if(F!==void 0)for(let I of F){let x=I(n);x!==null&&(g===null||(g.priority||0)<=(x.priority||0))&&(g=x)}return g!==null?g.conversion:null})(r,o),u=d?d(r):null,a=null;if(u!==null){a=u.after;let n=u.node;if(t=Array.isArray(n)?n[n.length-1]:n,t!==null){for(let[,h]of s)if(t=h(t,i),!t)break;t&&e.push(...Array.isArray(n)?n:[t])}u.forChild!=null&&s.set(r.nodeName,u.forChild)}let p=r.childNodes,m=[],f=(t==null||!O(t))&&(t!=null&&D(t)||l);for(let n=0;n<p.length;n++)m.push(...k(p[n],o,c,f,new Map(s),t));return a!=null&&(m=a(m)),v(r)&&(m=U(r,m,f?()=>{let n=new $;return c.push(n),n}:b)),t==null?m.length>0?e=e.concat(m):v(r)&&(function(n){return n.nextSibling==null||n.previousSibling==null?!1:S(n.nextSibling)&&S(n.previousSibling)})(r)&&(e=e.concat(w())):N(t)&&t.append(...m),e}function U(r,o,c){let l=r.style.textAlign,s=[],i=[];for(let e=0;e<o.length;e++){let t=o[e];if(D(t))l&&!t.getFormat()&&t.setFormat(l),s.push(t);else if(i.push(t),e===o.length-1||e<o.length-1&&D(o[e+1])){let d=c();d.setFormat(l),d.append(...i),s.push(d),i=[]}}return s}var B=C,q=B.$generateHtmlFromNodes,G=B.$generateNodesFromDOM;export{q as a,G as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{v as Ie}from"/kempo/vendor/lexical/chunks/chunk-FYATIV3K.js";import{$c as b,A as re,B as se,Ca as ue,D as y,Da as ge,Dc as Ne,F as U,G as ie,Ha as fe,Ia as V,Ja as pe,Ka as X,La as me,Lc as he,P as ae,Q as W,R as T,S as I,T as le,Tc as Se,Uc as L,Vc as Ee,_c as Z,b as We,bd as xe,ca as z,f as te,fa as C,g as ne,h as oe,na as D,o as H,qa as ce,qc as $e,ta as q,v as P,w as j,y as O,ya as de,z as K}from"/kempo/vendor/lexical/chunks/chunk-ZMJQPFLE.js";var ee={};We(ee,{$descendantsMatching:()=>wt,$dfs:()=>dt,$dfsIterator:()=>Pe,$filter:()=>At,$findMatchingParent:()=>P,$firstToLastIterator:()=>yt,$getAdjacentCaret:()=>ut,$getAdjacentSiblingOrParentSiblingCaret:()=>O,$getDepth:()=>De,$getNearestBlockElementAncestorOrThrow:()=>$t,$getNearestNodeOfType:()=>mt,$getNextRightPreorderNode:()=>pt,$getNextSiblingOrParentSibling:()=>ft,$handleIndentAndOutdent:()=>Ct,$insertFirst:()=>Rt,$insertNodeIntoLeaf:()=>Et,$insertNodeToNearestRoot:()=>St,$insertNodeToNearestRootAtCaret:()=>Fe,$isEditorIsNestedEditor:()=>_t,$lastToFirstIterator:()=>Y,$restoreEditorState:()=>ht,$reverseDfs:()=>gt,$reverseDfsIterator:()=>Me,$splitNode:()=>me,$unwrapAndFilterDescendants:()=>Ot,$unwrapNode:()=>Pt,$wrapNodeInElement:()=>xt,CAN_USE_BEFORE_INPUT:()=>tt,CAN_USE_DOM:()=>Oe,IS_ANDROID:()=>nt,IS_ANDROID_CHROME:()=>ot,IS_APPLE:()=>rt,IS_APPLE_WEBKIT:()=>st,IS_CHROME:()=>it,IS_FIREFOX:()=>we,IS_IOS:()=>at,IS_SAFARI:()=>lt,addClassNamesToElement:()=>$e,calculateZoomLevel:()=>vt,isBlockDomNode:()=>he,isHTMLAnchorElement:()=>Se,isHTMLElement:()=>L,isInlineDomNode:()=>Ee,isMimeType:()=>ye,makeStateWrapper:()=>Tt,markSelection:()=>_e,mediaFileReader:()=>ct,mergeRegister:()=>b,objectKlassEquals:()=>It,positionNodeOnRange:()=>ve,registerNestedElementResolver:()=>Nt,removeClassNamesFromElement:()=>xe,selectionAlwaysOnDisplay:()=>et});function B(e,...n){let t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(let o of n)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var h=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ze=h&&"documentMode"in document?document.documentMode:null,Re=h&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),qe=h&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Ve=!(!h||!("InputEvent"in window)||ze)&&"getTargetRanges"in new window.InputEvent("input"),Xe=h&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,J=h&&/Android/.test(navigator.userAgent),Ze=h&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!J,Q=h&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ge=h&&J&&Q,Je=h&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Re&&!Q;function E(e){return`${e}px`}var Qe={attributes:!0,characterData:!0,childList:!0,subtree:!0};function ve(e,n,t){let r=null,o=null,i=null,c=[],a=document.createElement("div");function d(){r===null&&B(182),o===null&&B(183);let{left:g,top:f}=o.getBoundingClientRect(),$=Ie(e,n);var A,x;a.isConnected||(x=a,(A=o).insertBefore(x,A.firstChild));let p=!1;for(let N=0;N<$.length;N++){let R=$[N],S=c[N]||document.createElement("div"),m=S.style;m.position!=="absolute"&&(m.position="absolute",p=!0);let v=E(R.left-g);m.left!==v&&(m.left=v,p=!0);let M=E(R.top-f);m.top!==M&&(S.style.top=M,p=!0);let F=E(R.width);m.width!==F&&(S.style.width=F,p=!0);let _=E(R.height);m.height!==_&&(S.style.height=_,p=!0),S.parentNode!==a&&(a.append(S),p=!0),c[N]=S}for(;c.length>$.length;)c.pop();p&&t(c)}function l(){o=null,r=null,i!==null&&i.disconnect(),i=null,a.remove();for(let g of c)g.remove();c=[]}a.style.position="relative";let u=e.registerRootListener(function g(){let f=e.getRootElement();if(f===null)return l();let $=f.parentElement;if(!L($))return l();l(),r=f,o=$,i=new MutationObserver(A=>{let x=e.getRootElement(),p=x&&x.parentElement;if(x!==r||p!==o)return g();for(let N of A)if(!a.contains(N.target))return d()}),i.observe($,Qe),d()});return()=>{u(),l()}}function Ae(e,n,t){if(e.type!=="text"&&C(n)){let r=n.getDOMSlot(t);return[r.element,r.getFirstChildOffset()+e.offset]}return[Ne(t)||t,e.offset]}function Ye(e){for(let n of e){let t=n.style;t.background!=="Highlight"&&(t.background="Highlight"),t.color!=="HighlightText"&&(t.color="HighlightText"),t.marginTop!==E(-1.5)&&(t.marginTop=E(-1.5)),t.paddingTop!==E(4)&&(t.paddingTop=E(4)),t.paddingBottom!==E(0)&&(t.paddingBottom=E(0))}}function _e(e,n=Ye){let t=null,r=null,o=null,i=null,c=null,a=null,d=()=>{};function l(u){u.read(()=>{let g=T();if(!D(g))return t=null,o=null,i=null,a=null,d(),void(d=()=>{});let[f,$]=(function(_){let w=_.getStartEndPoints();return _.isBackward()?[w[1],w[0]]:w})(g),A=f.getNode(),x=A.getKey(),p=f.offset,N=$.getNode(),R=N.getKey(),S=$.offset,m=e.getElementByKey(x),v=e.getElementByKey(R),M=t===null||m!==r||p!==o||x!==t.getKey(),F=i===null||v!==c||S!==a||R!==i.getKey();if((M||F)&&m!==null&&v!==null){let _=(function(w,Be,ke,He,je,Ke,Ue){let k=(w._window?w._window.document:document).createRange();return k.setStart(...Ae(Be,ke,He)),k.setEnd(...Ae(je,Ke,Ue)),k})(e,f,A,m,$,N,v);d(),d=ve(e,_,n)}t=A,r=m,o=p,i=N,c=v,a=S})}return l(e.getEditorState()),b(e.registerUpdateListener(({editorState:u})=>l(u)),()=>{d()})}function et(e,n){let t=null,r=()=>{let o=getSelection(),i=o&&o.anchorNode,c=e.getRootElement();i!==null&&c!==null&&c.contains(i)?t!==null&&(t(),t=null):t===null&&(t=_e(e,n))};return e.registerRootListener(o=>{if(o){let i=o.ownerDocument;return i.addEventListener("selectionchange",r),r(),()=>{t!==null&&t(),i.removeEventListener("selectionchange",r)}}})}var tt=Ve,Oe=h,nt=J,ot=Ge,rt=Re,st=Je,it=Q,we=qe,at=Xe,lt=Ze;function ye(e,n){for(let t of n)if(e.type.startsWith(t))return!0;return!1}function ct(e,n){let t=e[Symbol.iterator]();return new Promise((r,o)=>{let i=[],c=()=>{let{done:a,value:d}=t.next();if(a)return r(i);let l=new FileReader;l.addEventListener("error",o),l.addEventListener("load",()=>{let u=l.result;typeof u=="string"&&i.push({file:d,result:u}),c()}),ye(d,n)?l.readAsDataURL(d):c()};c()})}function dt(e,n){return Array.from(Pe(e,n))}function ut(e){return e?e.getAdjacentCaret():null}function gt(e,n){return Array.from(Me(e,n))}function Pe(e,n){return Te("next",e,n)}function Ce(e,n){let t=O(I(e,n));return t&&t[0]}function Te(e,n,t){let r=W(),o=n||r,i=C(o)?y(o,e):I(o,e),c=De(o),a=t?j(U(I(t,e)))||Ce(t,e):Ce(o,e),d=c;return Z({hasNext:l=>l!==null,initial:i,map:l=>({depth:d,node:l.origin}),step:l=>{if(l.isSameNodeCaret(a))return null;z(l)&&d++;let u=O(l);return!u||u[0].isSameNodeCaret(a)?null:(d+=u[1],u[0])}})}function ft(e){let n=O(I(e,"next"));return n&&[n[0].origin,n[1]]}function De(e){let n=-1;for(let t=e;t!==null;t=t.getParent())n++;return n}function pt(e){let n=U(I(e,"previous")),t=O(n,"root");return t&&t[0].origin}function Me(e,n){return Te("previous",e,n)}function mt(e,n){let t=e;for(;t!=null;){if(t instanceof n)return t;t=t.getParent()}return null}function $t(e){let n=P(e,t=>C(t)&&!t.isInline());return C(n)||B(4,e.__key),n}function Nt(e,n,t,r){let o=i=>i instanceof n;return e.registerNodeTransform(n,i=>{let c=(a=>{let d=a.getChildren();for(let g=0;g<d.length;g++){let f=d[g];if(o(f))return null}let l=a,u=a;for(;l!==null;)if(u=l,l=l.getParent(),o(l))return{child:u,parent:l};return null})(i);if(c!==null){let{child:a,parent:d}=c;if(a.is(i)){r(d,i);let l=a.getNextSiblings(),u=l.length;if(d.insertAfter(a),u!==0){let g=t(d);a.insertAfter(g);for(let f=0;f<u;f++)g.append(l[f])}d.canBeEmpty()||d.getChildrenSize()!==0||d.remove()}}})}function ht(e,n){let t=new Map,r=e._pendingEditorState;for(let[i,c]of n._nodeMap)t.set(i,oe(c));r&&(r._nodeMap=t),e._dirtyType=2;let o=n._selection;fe(o===null?null:o.clone())}function St(e){let n=T()||ae(),t;if(D(n))t=te(n.focus,"next");else{if(n!=null){let c=n.getNodes(),a=c[c.length-1];a&&(t=I(a,"next"))}t=t||y(W(),"previous").getFlipped().insert(H())}let r=Fe(e,t),o=j(r),i=z(o)?de(o):r;return V(ie(i)),e.getLatest()}function Fe(e,n,t){let r=K(n,"next");for(let o=r;o;o=X(o,t))r=o;return q(r)&&B(283),r.insert(e.isInline()?H().append(e):e),K(I(e.getLatest(),"next"),n.direction)}function Et(e){let n=T();if(!D(n))return void(n&&n.insertNodes([e]));let t=ne(n),r=se(ue(t),"next").anchor;if(q(r)){let i=X(r);if(!i)return;r=i}let o=r.getFlipped();o.insert(e),V(re(o,o))}function xt(e,n){let t=n();return e.replace(t),t.append(e),t}function It(e,n){return e!==null&&Object.getPrototypeOf(e).constructor.name===n.name}function At(e,n){let t=[];for(let r=0;r<e.length;r++){let o=n(e[r]);o!==null&&t.push(o)}return t}function Ct(e){let n=T();if(!D(n))return!1;let t=new Set,r=n.getNodes();for(let o=0;o<r.length;o++){let i=r[o],c=i.getKey();if(t.has(c))continue;let a=P(i,l=>C(l)&&!l.isInline());if(a===null)continue;let d=a.getKey();a.canIndent()&&!t.has(d)&&(t.add(d),e(a))}return t.size>0}function Rt(e,n){y(e,"next").insert(n)}var G=!(we||!Oe)&&void 0;function vt(e,n=!1){let t=1;if((function(){if(G===void 0){let r=document.createElement("div");r.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(r);let o=r.getBoundingClientRect();r.style.setProperty("zoom","2"),G=r.getBoundingClientRect().width===o.width,document.body.removeChild(r)}return G})()||n)for(;e;)t*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return t}function _t(e){return e._parentEditor!==null}function Ot(e,n){return Le(e,n,null)}function Le(e,n,t){let r=!1;for(let o of Y(e))n(o)?t!==null&&t(o):(r=!0,C(o)&&Le(o,n,t||(i=>o.insertAfter(i))),o.remove());return r}function wt(e,n){let t=[],r=Array.from(e).reverse();for(let o=r.pop();o!==void 0;o=r.pop())if(n(o))t.push(o);else if(C(o))for(let i of Y(o))r.push(i);return t}function yt(e){return be(y(e,"next"))}function Y(e){return be(y(e,"previous"))}function be(e){return Z({hasNext:ce,initial:e.getAdjacentCaret(),map:n=>n.origin.getLatest(),step:n=>n.getAdjacentCaret()})}function Pt(e){ge(I(e,"next")).splice(1,e.getChildren())}function Tt(e){let n=r=>le(r,e),t=(r,o)=>pe(r,e,o);return{$get:n,$set:t,accessors:[n,t],makeGetterMethod:()=>function(){return n(this)},makeSetterMethod:()=>function(r){return t(this,r)},stateConfig:e}}var s=ee,Lt=s.$descendantsMatching,bt=s.$dfs,Bt=s.$dfsIterator,kt=s.$filter,Ht=s.$findMatchingParent,jt=s.$firstToLastIterator,Kt=s.$getAdjacentCaret,Ut=s.$getAdjacentSiblingOrParentSiblingCaret,Wt=s.$getDepth,zt=s.$getNearestBlockElementAncestorOrThrow,qt=s.$getNearestNodeOfType,Vt=s.$getNextRightPreorderNode,Xt=s.$getNextSiblingOrParentSibling,Zt=s.$handleIndentAndOutdent,Gt=s.$insertFirst,Jt=s.$insertNodeIntoLeaf,Qt=s.$insertNodeToNearestRoot,Yt=s.$insertNodeToNearestRootAtCaret,en=s.$isEditorIsNestedEditor,tn=s.$lastToFirstIterator,nn=s.$restoreEditorState,on=s.$reverseDfs,rn=s.$reverseDfsIterator,sn=s.$splitNode,an=s.$unwrapAndFilterDescendants,ln=s.$unwrapNode,cn=s.$wrapNodeInElement,dn=s.CAN_USE_BEFORE_INPUT,un=s.CAN_USE_DOM,gn=s.IS_ANDROID,fn=s.IS_ANDROID_CHROME,pn=s.IS_APPLE,mn=s.IS_APPLE_WEBKIT,$n=s.IS_CHROME,Nn=s.IS_FIREFOX,hn=s.IS_IOS,Sn=s.IS_SAFARI,En=s.addClassNamesToElement,xn=s.calculateZoomLevel,In=s.isBlockDomNode,An=s.isHTMLAnchorElement,Cn=s.isHTMLElement,Rn=s.isInlineDomNode,vn=s.isMimeType,_n=s.makeStateWrapper,On=s.markSelection,wn=s.mediaFileReader,yn=s.mergeRegister,Pn=s.objectKlassEquals,Tn=s.positionNodeOnRange,Dn=s.registerNestedElementResolver,Mn=s.removeClassNamesFromElement,Fn=s.selectionAlwaysOnDisplay;export{Lt as a,bt as b,Ht as c,zt as d,qt as e,Zt as f,Gt as g,Qt as h,Yt as i,an as j,En as k,xn as l,In as m,An as n,Cn as o,yn as p,Pn as q,Mn as r,Fn as s};
|