bible-note 0.6.0 → 0.6.4

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.
Files changed (25) hide show
  1. package/dist/bible-note.cjs +154 -112
  2. package/dist/bible-note.css +1 -1
  3. package/dist/bible-note.mjs +7574 -7236
  4. package/dist/chunks/{ContentEditable-C_wyHFh1.mjs → ContentEditable-BaXBKC3m.mjs} +1 -1
  5. package/dist/chunks/{ContentEditable-DgthEFHJ.cjs → ContentEditable-Ce294XLd.cjs} +2 -2
  6. package/dist/chunks/{ExcalidrawComponent-bEqDGYRW.cjs → ExcalidrawComponent-DdmtbuXc.cjs} +1 -1
  7. package/dist/chunks/{ExcalidrawComponent-iTobN_Hf.mjs → ExcalidrawComponent-OMjYgJCL.mjs} +2 -2
  8. package/dist/chunks/{ExcalidrawModal-DAEdxIBk.mjs → ExcalidrawModal-DSotOBGc.mjs} +2 -2
  9. package/dist/chunks/{ExcalidrawModal-Bbez9U5x.cjs → ExcalidrawModal-Db1LI01l.cjs} +2 -2
  10. package/dist/chunks/LexicalUtils.prod-CYv8J7Gq.cjs +3 -0
  11. package/dist/chunks/{LexicalUtils.prod-5zbJxaQa.mjs → LexicalUtils.prod-D2Igim2c.mjs} +28 -32
  12. package/dist/chunks/{MediaComponent-BTaaADsV.mjs → MediaComponent-CSawoM2p.mjs} +3 -3
  13. package/dist/chunks/{MediaComponent-BhjGu3D-.cjs → MediaComponent-qZBSiJiq.cjs} +1 -1
  14. package/dist/chunks/{MediaResizer-C7UGQ3Kl.mjs → MediaResizer-C_ZJbHAU.mjs} +1 -1
  15. package/dist/chunks/{MediaResizer-DGw5LvDR.cjs → MediaResizer-Dzro5TVg.cjs} +1 -1
  16. package/dist/chunks/{StickyComponent-B8skHBRs.mjs → StickyComponent-Ce5jkV0z.mjs} +13 -13
  17. package/dist/chunks/{StickyComponent-C6xBrvrK.cjs → StickyComponent-CoU6Bu8d.cjs} +1 -1
  18. package/dist/chunks/{StickyNode-B2B6di-N.mjs → StickyNode-CN3WkBD3.mjs} +11 -11
  19. package/dist/chunks/{StickyNode-GgIn3-zY.cjs → StickyNode-Dm3H0XUa.cjs} +1 -1
  20. package/dist/chunks/{TreeViewPlugin-B0UnxNiM.mjs → TreeViewPlugin-BV40YjJ0.mjs} +948 -887
  21. package/dist/chunks/{TreeViewPlugin-DkUjU27t.cjs → TreeViewPlugin-BlY6n0zI.cjs} +10 -10
  22. package/knowledge/development.md +8 -4
  23. package/knowledge/ui-rag.md +248 -140
  24. package/package.json +2 -2
  25. package/dist/chunks/LexicalUtils.prod-W-Xb5dGB.cjs +0 -3
@@ -496,11 +496,7 @@ function Xe(e) {
496
496
  for (let n = e; n !== null; n = n.getParent() ?? ve(n)) t++;
497
497
  return t;
498
498
  }
499
- function Ze(e) {
500
- let t = y(d(D(e, "previous")), "root");
501
- return t && t[0].origin;
502
- }
503
- function Qe(e, t) {
499
+ function Ze(e, t) {
504
500
  let n = e;
505
501
  for (; n != null;) {
506
502
  if (n instanceof t) return n;
@@ -508,11 +504,11 @@ function Qe(e, t) {
508
504
  }
509
505
  return null;
510
506
  }
511
- function $e(e) {
507
+ function Qe(e) {
512
508
  let t = i(e, (e) => P(e) && !e.isInline());
513
509
  return P(t) || K(4, e.__key), t;
514
510
  }
515
- function et(e, t, n, r) {
511
+ function $e(e, t, n, r) {
516
512
  let i = (e) => e instanceof t;
517
513
  return e.registerNodeTransform(t, (e) => {
518
514
  let t = ((e) => {
@@ -543,14 +539,14 @@ function et(e, t, n, r) {
543
539
  }
544
540
  });
545
541
  }
546
- function tt(e, t) {
542
+ function et(e, t) {
547
543
  let n = /* @__PURE__ */ new Map(), r = e._pendingEditorState;
548
544
  for (let [e, r] of t._nodeMap) n.set(e, pe(r));
549
545
  r && (r._nodeMap = n), ie();
550
546
  let i = t._selection;
551
547
  c(i === null ? null : i.clone());
552
548
  }
553
- function nt(e) {
549
+ function tt(e) {
554
550
  let t = M() || S(), n;
555
551
  if (E(t)) n = f(t.focus, "next");
556
552
  else {
@@ -563,14 +559,14 @@ function nt(e) {
563
559
  let i = oe(e, n), a = O(i);
564
560
  return ce(ge(T(a) ? _e(a) : i)), e.getLatest();
565
561
  }
566
- function rt(e, t) {
562
+ function nt(e, t) {
567
563
  let n = t();
568
564
  return e.replace(n), n.append(e), n;
569
565
  }
570
566
  function Q(e, t) {
571
567
  return e !== null && Object.getPrototypeOf(e).constructor.name === t.name;
572
568
  }
573
- function it(e) {
569
+ function rt(e) {
574
570
  let t = null;
575
571
  if (Q(e, DragEvent) ? t = e.dataTransfer : Q(e, ClipboardEvent) && (t = e.clipboardData), t === null) return [
576
572
  !1,
@@ -584,7 +580,7 @@ function it(e) {
584
580
  i
585
581
  ];
586
582
  }
587
- function at(e) {
583
+ function it(e) {
588
584
  let t = M();
589
585
  if (!E(t)) return !1;
590
586
  let n = /* @__PURE__ */ new Set(), r = t.getNodes();
@@ -598,11 +594,11 @@ function at(e) {
598
594
  }
599
595
  return n.size > 0;
600
596
  }
601
- function ot(e, t) {
597
+ function at(e, t) {
602
598
  w(e, "next").insert(t);
603
599
  }
604
600
  var $ = !(ne || !ae) && void 0;
605
- function st(e, t = !1) {
601
+ function ot(e, t = !1) {
606
602
  let n = 1;
607
603
  if (function() {
608
604
  if ($ === void 0) {
@@ -618,27 +614,27 @@ function st(e, t = !1) {
618
614
  }
619
615
  return n;
620
616
  }
621
- function ct(e) {
617
+ function st(e) {
622
618
  return e._parentEditor !== null;
623
619
  }
624
- function lt(e, t) {
625
- return ut(e, t, null);
620
+ function ct(e, t) {
621
+ return lt(e, t, null);
626
622
  }
627
- function ut(e, t, n) {
623
+ function lt(e, t, n) {
628
624
  let r = !1;
629
- for (let i of ft(e)) t(i) ? n !== null && n(i) : (r = !0, P(i) && ut(i, t, n || ((e) => i.insertAfter(e))), i.remove());
625
+ for (let i of dt(e)) t(i) ? n !== null && n(i) : (r = !0, P(i) && lt(i, t, n || ((e) => i.insertAfter(e))), i.remove());
630
626
  return r;
631
627
  }
632
- function dt(e, t) {
628
+ function ut(e, t) {
633
629
  let n = [], r = Array.from(e).reverse();
634
630
  for (let e = r.pop(); e !== void 0; e = r.pop()) if (t(e)) n.push(e);
635
- else if (P(e)) for (let t of ft(e)) r.push(t);
631
+ else if (P(e)) for (let t of dt(e)) r.push(t);
636
632
  return n;
637
633
  }
638
- function ft(e) {
639
- return pt(w(e, "previous"));
634
+ function dt(e) {
635
+ return ft(w(e, "previous"));
640
636
  }
641
- function pt(e) {
637
+ function ft(e) {
642
638
  return be({
643
639
  hasNext: p,
644
640
  initial: e.getAdjacentCaret(),
@@ -646,36 +642,36 @@ function pt(e) {
646
642
  step: (e) => e.getAdjacentCaret()
647
643
  });
648
644
  }
649
- function mt(e) {
645
+ function pt(e) {
650
646
  se(D(e, "next")).splice(1, e.getChildren());
651
647
  }
652
- function ht(e, t) {
648
+ function mt(e, t) {
653
649
  let n = M();
654
650
  if (E(n) && n.isCollapsed()) {
655
651
  let a = i(n.anchor.getNode(), e);
656
652
  if (a) {
657
653
  let e = a.getParent();
658
- if (e !== null && e.getFirstChild() === a && _t(n.anchor, a)) return a.insertBefore(r()).selectEnd(), t && t.preventDefault(), !0;
654
+ if (e !== null && e.getFirstChild() === a && gt(n.anchor, a)) return a.insertBefore(r()).selectEnd(), t && t.preventDefault(), !0;
659
655
  }
660
656
  }
661
657
  return !1;
662
658
  }
663
- function gt(e, t) {
659
+ function ht(e, t) {
664
660
  let n = M();
665
661
  if (E(n) && n.isCollapsed()) {
666
662
  let a = i(n.anchor.getNode(), e);
667
663
  if (a) {
668
664
  let e = a.getParent();
669
- if (e !== null && e.getLastChild() === a && vt(n.anchor, a)) return a.insertAfter(r()).selectEnd(), t && t.preventDefault(), !0;
665
+ if (e !== null && e.getLastChild() === a && _t(n.anchor, a)) return a.insertAfter(r()).selectEnd(), t && t.preventDefault(), !0;
670
666
  }
671
667
  }
672
668
  return !1;
673
669
  }
674
- function _t(e, t) {
670
+ function gt(e, t) {
675
671
  return H(e, t, "previous");
676
672
  }
677
- function vt(e, t) {
673
+ function _t(e, t) {
678
674
  return H(e, t, "next");
679
675
  }
680
676
  //#endregion
681
- export { xe as A, Ue as C, we as D, Ee as E, je as F, Me as I, R as L, De as M, Pe as N, Te as O, G as P, He as S, lt as T, We as _, ot as a, X as b, et as c, st as d, dt as f, Ge as g, Y as h, it as i, Ie as j, Ce as k, ht as l, Qe as m, nt as n, $e as o, gt as p, tt as r, Q as s, at as t, rt as u, Ke as v, Ze as w, mt as x, ct as y };
677
+ export { Ie as A, Ue as C, Te as D, we as E, Me as F, R as I, Pe as M, G as N, Ce as O, je as P, He as S, Ee as T, We as _, at as a, X as b, $e as c, ot as d, ut as f, Ge as g, Y as h, rt as i, De as j, xe as k, mt as l, Ze as m, tt as n, Qe as o, ht as p, et as r, Q as s, it as t, nt as u, Ke as v, ct as w, pt as x, st as y };
@@ -1,7 +1,7 @@
1
1
  import { Dr as e, En as t, F as n, Fr as r, Ht as i, K as a, Nr as o, Yn as s, at as c, bn as l, jn as ee, oi as u, qr as te, tt as d, wn as ne, x as f, yn as re } from "./Lexical.prod-DYDuARMX.mjs";
2
- import { N as ie, a as ae, o as oe, t as se } from "./ContentEditable-C_wyHFh1.mjs";
3
- import { r as ce, t as le } from "./MediaResizer-C7UGQ3Kl.mjs";
4
- import { E as p, T as m, c as ue, f as de, n as fe, o as pe, q as me, r as he, s as ge, t as _e, u as ve, yt as ye } from "./TreeViewPlugin-B0UnxNiM.mjs";
2
+ import { N as ie, a as ae, o as oe, t as se } from "./ContentEditable-BaXBKC3m.mjs";
3
+ import { r as ce, t as le } from "./MediaResizer-C_ZJbHAU.mjs";
4
+ import { E as p, T as m, c as ue, f as de, n as fe, o as pe, q as me, r as he, s as ge, t as _e, u as ve, yt as ye } from "./TreeViewPlugin-BV40YjJ0.mjs";
5
5
  import { t as be } from "./useLexicalNodeSelection.prod-CEfV63CR.mjs";
6
6
  import { t as xe } from "./useLexicalEditable.prod-CgMasHPY.mjs";
7
7
  import { t as Se } from "./LexicalNestedComposer.prod-C96XUwM-.mjs";
@@ -1 +1 @@
1
- const e=require("./rolldown-runtime-D_FWMvbo.cjs"),t=require("./Lexical.prod-C9Xekspf.cjs"),n=require("./ContentEditable-DgthEFHJ.cjs"),r=require("./MediaResizer-DGw5LvDR.cjs"),i=require("./TreeViewPlugin-DkUjU27t.cjs"),a=require("./useLexicalNodeSelection.prod-DXhTEgoC.cjs"),o=require("./useLexicalEditable.prod-B2XnDcjV.cjs"),s=require("./LexicalNestedComposer.prod-DBJWbgz2.cjs");let c=require("react");c=e.a(c,1);let l=require("react/jsx-runtime");var u=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M22%203H2v18h20v-2h-2v-2h2v-2h-2v-2h2v-2h-2V9h2V7h-2V5h2V3zm-2%204v2h-2v2h2v2h-2v2h2v2h-2v2H4V5h14v2h2zm-6%202h-2v2h-2v2H8v2H6v2h2v-2h2v-2h2v-2h2v2h2v-2h-2V9zM6%207h2v2H6V7z'%20fill='%23000000'/%3e%3c/svg%3e`,d=new Map,f=2,p=t.x(`RIGHT_CLICK_MEDIA_COMMAND`);function m({setShowCaption:e}){let[n]=t.oi();return(0,c.useEffect)(()=>n.registerCommand(t.at,()=>(i.T()&&e(!1),!1),0)),null}function h(e){let t=d.get(e);if(t&&`error`in t&&typeof t.error==`boolean`)return t;throw t||(t=new Promise(t=>{let n=new Image;n.src=e,n.onload=()=>t({error:!1,height:n.naturalHeight,width:n.naturalWidth}),n.onerror=()=>t({error:!0})}).then(t=>(d.set(e,t),t)),d.set(e,t),t)}function g(e){return e.toLowerCase().endsWith(`.svg`)}function ee({altText:e,className:t,mediaRef:n,src:r,width:i,height:a,maxWidth:o,onError:s}){let u=g(r),d=h(r);if((0,c.useEffect)(()=>{d.error&&s()},[d.error,s]),d.error)return(0,l.jsx)(v,{});let f=(()=>{if(!u||!(`width`in d)||!(`height`in d))return{height:a,maxWidth:o,width:i};let e=d.width,t=d.height,n=e,r=t;if(n>o){let e=o/n;n=o,r=Math.round(r*e)}let s=o;if(r>s){let e=s/r;r=s,n=Math.round(n*e)}return{height:r,maxWidth:o,width:n}})();return(0,l.jsx)(`img`,{className:t||void 0,src:r,alt:e,ref:n,style:f,onError:s,draggable:`false`})}function _({altText:e,className:t,height:n,maxWidth:r,mediaRef:i,onError:a,src:o,width:s}){return(0,l.jsx)(`video`,{className:t||void 0,src:o,title:e,ref:i,style:{height:n,maxWidth:r,width:s},onError:a,controls:!0,draggable:`false`})}function te({altText:e,className:t,height:n,maxWidth:r,mediaRef:i,onError:a,src:o,width:s}){return(0,l.jsx)(`audio`,{className:t||void 0,src:o,title:e,ref:i,style:{height:n===`inherit`?void 0:n,maxWidth:r,width:s===`inherit`?r:s},onError:a,controls:!0,draggable:`false`})}function ne({altText:e,className:t,defaultWidth:n,height:r,maxWidth:i,mediaRef:a,src:o,width:s}){return(0,l.jsx)(`iframe`,{className:t||void 0,src:o,title:e||`PDF`,ref:a,style:{height:r===`inherit`?500:r,maxWidth:i,width:s===`inherit`?n:s}})}function v(){return(0,l.jsx)(`img`,{src:u,style:{height:200,opacity:.2,width:200},draggable:`false`,alt:`Broken image`})}function y(){}var b={audio:`mp3`,image:`png`,pdf:`pdf`,video:`mp4`};function x(e,t,n){let r=e.trim().split(/[?#]/)[0];if(r!==``&&!/^(?:blob|data):/i.test(r)){let e=r.split(/[\\/]/).pop();if(e!==void 0&&e.trim()!==``)return e}let i=t.trim();return i===``?`media.${b[n]}`:i}function S({src:e,mediaType:u,previewSrc:d,altText:h,nodeKey:g,width:b,height:S,maxWidth:C,resizable:re,showCaption:w,caption:T,captionsEnabled:ie}){let E=(0,c.useRef)(null),D=(0,c.useRef)(null),[O,k,A]=a.t(g),[j,M]=(0,c.useState)(!1),[N,P]=(0,c.useState)(),{revealFile:F}=i.yt(),[I]=t.oi(),L=(0,c.useRef)(null),[R,z]=(0,c.useState)(!1),B=o.t(),V=(0,c.useMemo)(()=>O&&I.getEditorState().read(()=>{let e=t.tt();return t.Fr(e)&&e.has(g)}),[I,O,g]),H=(0,c.useCallback)(e=>{let n=t.tt(),r=D.current;if(t.Fr(n)&&n.has(g)&&n.getNodes().length===1){if(w)return t.En(null),e.preventDefault(),T.focus(),!0;if(r!==null&&r!==document.activeElement)return e.preventDefault(),r.focus(),!0}return!1},[T,g,w]),U=(0,c.useCallback)(e=>L.current===T||D.current===e.target?(t.En(null),I.update(()=>{k(!0);let e=I.getRootElement();e!==null&&e.focus()}),!0):!1,[T,I,k]),W=(0,c.useCallback)(e=>{let n=t.tt();if(!t.Fr(n)||!n.has(g))return!1;let r=!1;for(let e of n.getNodes())i.E(e)&&(e.remove(),r=!0);return r&&e.preventDefault(),r},[g]),G=(0,c.useCallback)(e=>{let t=e;return j?!0:t.target===E.current?((u===`video`||u===`audio`)&&t.preventDefault(),t.shiftKey?k(!O):(A(),k(!0)),!0):!1},[j,O,u,k,A]),K=(0,c.useCallback)(e=>{I.getEditorState().read(()=>{let n=t.tt();e.target===E.current&&t.bn(n)&&n.getNodes().length===1&&I.dispatchCommand(p,e)})},[I]);(0,c.useEffect)(()=>t.Yn(I.registerCommand(t.F,(e,t)=>(L.current=t,!1),1),I.registerCommand(t.qr,e=>e.target===E.current?(e.preventDefault(),!0):!1,1)),[I]),(0,c.useEffect)(()=>{z(!1)},[u,d,e,N]),(0,c.useEffect)(()=>{let t=!0,n;return P(void 0),u===`image`||d?()=>{t=!1}:(i.f(e).then(e=>{if(e){if(!t){typeof URL.revokeObjectURL==`function`&&URL.revokeObjectURL(e);return}n=e,P(e)}}),()=>{t=!1,n&&typeof URL.revokeObjectURL==`function`&&URL.revokeObjectURL(n)})},[u,d,e]),(0,c.useEffect)(()=>{let e=y;return t.Yn(I.registerCommand(t.K,G,1),I.registerCommand(p,G,1),I.registerCommand(t.yn,H,1),I.registerCommand(t.wn,W,1),I.registerCommand(t.Nr,W,1),I.registerCommand(t.jn,U,1),I.registerRootListener(t=>{e(),e=y,t&&(t.addEventListener(`contextmenu`,K),e=()=>t.removeEventListener(`contextmenu`,K))}),()=>e())},[I,W,H,U,G,K]);let q=e=>{I.update(()=>{let n=t.Ht(g);i.E(n)&&(n.setShowCaption(e),e&&n.__caption.update(()=>{t.tt()||t.Dr().selectEnd()}))})},ae=(e,n)=>{setTimeout(()=>{M(!1)},200),I.update(()=>{let r=t.Ht(g);i.E(r)&&r.setWidthAndHeight(e,n)})},oe=()=>{M(!0)},{historyState:se}=n.a(),{settings:{showNestedEditorTreeView:ce}}=r.r(),le=V&&!j,J=(O||j)&&B,Y=J?`focused ${V?`draggable`:``}`:null,ue=u===`image`||u===`video`||u===`pdf`,X=C*f,Z=(0,c.useCallback)(e=>{E.current=e},[]),Q=d||N||e,de=x(e,h,u),$=F!==void 0&&i.u(e)?F:null;return(0,l.jsx)(c.Suspense,{fallback:null,children:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{draggable:le,children:R&&u===`image`?(0,l.jsx)(v,{}):u===`video`?(0,l.jsx)(_,{className:Y,src:Q,altText:h,mediaRef:Z,width:b,height:S,maxWidth:X,onError:()=>z(!0)}):u===`audio`?(0,l.jsx)(te,{className:Y,src:Q,altText:h,mediaRef:Z,width:b,height:S,maxWidth:C,onError:()=>z(!0)}):u===`pdf`?(0,l.jsx)(ne,{className:Y,src:Q,altText:h,mediaRef:Z,width:b,height:S,defaultWidth:C,maxWidth:X}):(0,l.jsx)(ee,{className:Y,src:e,altText:h,mediaRef:Z,width:b,height:S,maxWidth:X,onError:()=>z(!0)})}),V&&!j?(0,l.jsxs)(`div`,{className:`media-floating-actions`,role:`toolbar`,"aria-label":`Media options`,children:[(0,l.jsx)(`a`,{className:`media-action-button`,href:Q,download:de,title:`Download media`,"aria-label":`Download media`,onClick:e=>{e.stopPropagation()},children:(0,l.jsx)(`i`,{className:`bi bi-download`,"aria-hidden":`true`})}),$===null?null:(0,l.jsx)(`button`,{className:`media-action-button`,type:`button`,title:`Reveal media file`,"aria-label":`Reveal media file`,onClick:t=>{t.preventDefault(),t.stopPropagation(),$(e)},children:(0,l.jsx)(`i`,{className:`bi bi-folder2-open`,"aria-hidden":`true`})})]}):null,w&&(0,l.jsx)(`div`,{className:`media-caption-container`,children:(0,l.jsxs)(s.t,{initialEditor:T,children:[(0,l.jsx)(m,{setShowCaption:q}),(0,l.jsx)(i.n,{}),(0,l.jsx)(i.r,{}),(0,l.jsx)(i.o,{}),(0,l.jsx)(i.c,{}),(0,l.jsx)(i.s,{}),(0,l.jsx)(n.o,{externalHistoryState:se}),(0,l.jsx)(i.q,{contentEditable:(0,l.jsx)(n.t,{placeholder:`Enter a caption...`,placeholderClassName:`MediaNode__placeholder`,className:`MediaNode__contentEditable`}),ErrorBoundary:n.N}),ce===!0?(0,l.jsx)(i.t,{}):null]})}),re&&ue&&V&&J&&(0,l.jsx)(r.t,{showCaption:w,setShowCaption:q,editor:I,buttonRef:D,mediaRef:E,maxWidth:X,onResizeStart:oe,onResizeEnd:ae,captionsEnabled:!R&&ie})]})})}exports.RIGHT_CLICK_MEDIA_COMMAND=p,exports.default=S;
1
+ const e=require("./rolldown-runtime-D_FWMvbo.cjs"),t=require("./Lexical.prod-C9Xekspf.cjs"),n=require("./ContentEditable-Ce294XLd.cjs"),r=require("./MediaResizer-Dzro5TVg.cjs"),i=require("./TreeViewPlugin-BlY6n0zI.cjs"),a=require("./useLexicalNodeSelection.prod-DXhTEgoC.cjs"),o=require("./useLexicalEditable.prod-B2XnDcjV.cjs"),s=require("./LexicalNestedComposer.prod-DBJWbgz2.cjs");let c=require("react");c=e.a(c,1);let l=require("react/jsx-runtime");var u=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M22%203H2v18h20v-2h-2v-2h2v-2h-2v-2h2v-2h-2V9h2V7h-2V5h2V3zm-2%204v2h-2v2h2v2h-2v2h2v2h-2v2H4V5h14v2h2zm-6%202h-2v2h-2v2H8v2H6v2h2v-2h2v-2h2v-2h2v2h2v-2h-2V9zM6%207h2v2H6V7z'%20fill='%23000000'/%3e%3c/svg%3e`,d=new Map,f=2,p=t.x(`RIGHT_CLICK_MEDIA_COMMAND`);function m({setShowCaption:e}){let[n]=t.oi();return(0,c.useEffect)(()=>n.registerCommand(t.at,()=>(i.T()&&e(!1),!1),0)),null}function h(e){let t=d.get(e);if(t&&`error`in t&&typeof t.error==`boolean`)return t;throw t||(t=new Promise(t=>{let n=new Image;n.src=e,n.onload=()=>t({error:!1,height:n.naturalHeight,width:n.naturalWidth}),n.onerror=()=>t({error:!0})}).then(t=>(d.set(e,t),t)),d.set(e,t),t)}function g(e){return e.toLowerCase().endsWith(`.svg`)}function ee({altText:e,className:t,mediaRef:n,src:r,width:i,height:a,maxWidth:o,onError:s}){let u=g(r),d=h(r);if((0,c.useEffect)(()=>{d.error&&s()},[d.error,s]),d.error)return(0,l.jsx)(v,{});let f=(()=>{if(!u||!(`width`in d)||!(`height`in d))return{height:a,maxWidth:o,width:i};let e=d.width,t=d.height,n=e,r=t;if(n>o){let e=o/n;n=o,r=Math.round(r*e)}let s=o;if(r>s){let e=s/r;r=s,n=Math.round(n*e)}return{height:r,maxWidth:o,width:n}})();return(0,l.jsx)(`img`,{className:t||void 0,src:r,alt:e,ref:n,style:f,onError:s,draggable:`false`})}function _({altText:e,className:t,height:n,maxWidth:r,mediaRef:i,onError:a,src:o,width:s}){return(0,l.jsx)(`video`,{className:t||void 0,src:o,title:e,ref:i,style:{height:n,maxWidth:r,width:s},onError:a,controls:!0,draggable:`false`})}function te({altText:e,className:t,height:n,maxWidth:r,mediaRef:i,onError:a,src:o,width:s}){return(0,l.jsx)(`audio`,{className:t||void 0,src:o,title:e,ref:i,style:{height:n===`inherit`?void 0:n,maxWidth:r,width:s===`inherit`?r:s},onError:a,controls:!0,draggable:`false`})}function ne({altText:e,className:t,defaultWidth:n,height:r,maxWidth:i,mediaRef:a,src:o,width:s}){return(0,l.jsx)(`iframe`,{className:t||void 0,src:o,title:e||`PDF`,ref:a,style:{height:r===`inherit`?500:r,maxWidth:i,width:s===`inherit`?n:s}})}function v(){return(0,l.jsx)(`img`,{src:u,style:{height:200,opacity:.2,width:200},draggable:`false`,alt:`Broken image`})}function y(){}var b={audio:`mp3`,image:`png`,pdf:`pdf`,video:`mp4`};function x(e,t,n){let r=e.trim().split(/[?#]/)[0];if(r!==``&&!/^(?:blob|data):/i.test(r)){let e=r.split(/[\\/]/).pop();if(e!==void 0&&e.trim()!==``)return e}let i=t.trim();return i===``?`media.${b[n]}`:i}function S({src:e,mediaType:u,previewSrc:d,altText:h,nodeKey:g,width:b,height:S,maxWidth:C,resizable:re,showCaption:w,caption:T,captionsEnabled:ie}){let E=(0,c.useRef)(null),D=(0,c.useRef)(null),[O,k,A]=a.t(g),[j,M]=(0,c.useState)(!1),[N,P]=(0,c.useState)(),{revealFile:F}=i.yt(),[I]=t.oi(),L=(0,c.useRef)(null),[R,z]=(0,c.useState)(!1),B=o.t(),V=(0,c.useMemo)(()=>O&&I.getEditorState().read(()=>{let e=t.tt();return t.Fr(e)&&e.has(g)}),[I,O,g]),H=(0,c.useCallback)(e=>{let n=t.tt(),r=D.current;if(t.Fr(n)&&n.has(g)&&n.getNodes().length===1){if(w)return t.En(null),e.preventDefault(),T.focus(),!0;if(r!==null&&r!==document.activeElement)return e.preventDefault(),r.focus(),!0}return!1},[T,g,w]),U=(0,c.useCallback)(e=>L.current===T||D.current===e.target?(t.En(null),I.update(()=>{k(!0);let e=I.getRootElement();e!==null&&e.focus()}),!0):!1,[T,I,k]),W=(0,c.useCallback)(e=>{let n=t.tt();if(!t.Fr(n)||!n.has(g))return!1;let r=!1;for(let e of n.getNodes())i.E(e)&&(e.remove(),r=!0);return r&&e.preventDefault(),r},[g]),G=(0,c.useCallback)(e=>{let t=e;return j?!0:t.target===E.current?((u===`video`||u===`audio`)&&t.preventDefault(),t.shiftKey?k(!O):(A(),k(!0)),!0):!1},[j,O,u,k,A]),K=(0,c.useCallback)(e=>{I.getEditorState().read(()=>{let n=t.tt();e.target===E.current&&t.bn(n)&&n.getNodes().length===1&&I.dispatchCommand(p,e)})},[I]);(0,c.useEffect)(()=>t.Yn(I.registerCommand(t.F,(e,t)=>(L.current=t,!1),1),I.registerCommand(t.qr,e=>e.target===E.current?(e.preventDefault(),!0):!1,1)),[I]),(0,c.useEffect)(()=>{z(!1)},[u,d,e,N]),(0,c.useEffect)(()=>{let t=!0,n;return P(void 0),u===`image`||d?()=>{t=!1}:(i.f(e).then(e=>{if(e){if(!t){typeof URL.revokeObjectURL==`function`&&URL.revokeObjectURL(e);return}n=e,P(e)}}),()=>{t=!1,n&&typeof URL.revokeObjectURL==`function`&&URL.revokeObjectURL(n)})},[u,d,e]),(0,c.useEffect)(()=>{let e=y;return t.Yn(I.registerCommand(t.K,G,1),I.registerCommand(p,G,1),I.registerCommand(t.yn,H,1),I.registerCommand(t.wn,W,1),I.registerCommand(t.Nr,W,1),I.registerCommand(t.jn,U,1),I.registerRootListener(t=>{e(),e=y,t&&(t.addEventListener(`contextmenu`,K),e=()=>t.removeEventListener(`contextmenu`,K))}),()=>e())},[I,W,H,U,G,K]);let q=e=>{I.update(()=>{let n=t.Ht(g);i.E(n)&&(n.setShowCaption(e),e&&n.__caption.update(()=>{t.tt()||t.Dr().selectEnd()}))})},ae=(e,n)=>{setTimeout(()=>{M(!1)},200),I.update(()=>{let r=t.Ht(g);i.E(r)&&r.setWidthAndHeight(e,n)})},oe=()=>{M(!0)},{historyState:se}=n.a(),{settings:{showNestedEditorTreeView:ce}}=r.r(),le=V&&!j,J=(O||j)&&B,Y=J?`focused ${V?`draggable`:``}`:null,ue=u===`image`||u===`video`||u===`pdf`,X=C*f,Z=(0,c.useCallback)(e=>{E.current=e},[]),Q=d||N||e,de=x(e,h,u),$=F!==void 0&&i.u(e)?F:null;return(0,l.jsx)(c.Suspense,{fallback:null,children:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{draggable:le,children:R&&u===`image`?(0,l.jsx)(v,{}):u===`video`?(0,l.jsx)(_,{className:Y,src:Q,altText:h,mediaRef:Z,width:b,height:S,maxWidth:X,onError:()=>z(!0)}):u===`audio`?(0,l.jsx)(te,{className:Y,src:Q,altText:h,mediaRef:Z,width:b,height:S,maxWidth:C,onError:()=>z(!0)}):u===`pdf`?(0,l.jsx)(ne,{className:Y,src:Q,altText:h,mediaRef:Z,width:b,height:S,defaultWidth:C,maxWidth:X}):(0,l.jsx)(ee,{className:Y,src:e,altText:h,mediaRef:Z,width:b,height:S,maxWidth:X,onError:()=>z(!0)})}),V&&!j?(0,l.jsxs)(`div`,{className:`media-floating-actions`,role:`toolbar`,"aria-label":`Media options`,children:[(0,l.jsx)(`a`,{className:`media-action-button`,href:Q,download:de,title:`Download media`,"aria-label":`Download media`,onClick:e=>{e.stopPropagation()},children:(0,l.jsx)(`i`,{className:`bi bi-download`,"aria-hidden":`true`})}),$===null?null:(0,l.jsx)(`button`,{className:`media-action-button`,type:`button`,title:`Reveal media file`,"aria-label":`Reveal media file`,onClick:t=>{t.preventDefault(),t.stopPropagation(),$(e)},children:(0,l.jsx)(`i`,{className:`bi bi-folder2-open`,"aria-hidden":`true`})})]}):null,w&&(0,l.jsx)(`div`,{className:`media-caption-container`,children:(0,l.jsxs)(s.t,{initialEditor:T,children:[(0,l.jsx)(m,{setShowCaption:q}),(0,l.jsx)(i.n,{}),(0,l.jsx)(i.r,{}),(0,l.jsx)(i.o,{}),(0,l.jsx)(i.c,{}),(0,l.jsx)(i.s,{}),(0,l.jsx)(n.o,{externalHistoryState:se}),(0,l.jsx)(i.q,{contentEditable:(0,l.jsx)(n.t,{placeholder:`Enter a caption...`,placeholderClassName:`MediaNode__placeholder`,className:`MediaNode__contentEditable`}),ErrorBoundary:n.N}),ce===!0?(0,l.jsx)(i.t,{}):null]})}),re&&ue&&V&&J&&(0,l.jsx)(r.t,{showCaption:w,setShowCaption:q,editor:I,buttonRef:D,mediaRef:E,maxWidth:X,onResizeStart:oe,onResizeEnd:ae,captionsEnabled:!R&&ie})]})})}exports.RIGHT_CLICK_MEDIA_COMMAND=p,exports.default=S;
@@ -1,4 +1,4 @@
1
- import { d as e } from "./LexicalUtils.prod-5zbJxaQa.mjs";
1
+ import { d as e } from "./LexicalUtils.prod-D2Igim2c.mjs";
2
2
  import { createContext as t, useCallback as n, useContext as r, useMemo as i, useRef as a, useState as o } from "react";
3
3
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
4
4
  //#region src/utils/pageSizes.ts
@@ -1 +1 @@
1
- const e=require("./rolldown-runtime-D_FWMvbo.cjs"),t=require("./LexicalUtils.prod-W-Xb5dGB.cjs");let n=require("react");n=e.a(n,1);let r=require("react/jsx-runtime");var i={key:`web`,label:`Web view`};function a(e){return{...e,orientation:`portrait`}}function o(e,t){return{cssSize:`${e.cssSize} landscape`,heightIn:e.widthIn,heightTwips:e.widthTwips,key:t,label:`${e.label} landscape`,orientation:`landscape`,widthIn:e.heightIn,widthTwips:e.heightTwips}}var s=a({cssSize:`A4`,heightIn:11.69,heightTwips:16838,key:`a4`,label:`A4`,widthIn:8.27,widthTwips:11906}),c=a({cssSize:`A5`,heightIn:8.27,heightTwips:11906,key:`a5`,label:`A5`,widthIn:5.83,widthTwips:8391}),l=a({cssSize:`A3`,heightIn:16.54,heightTwips:23811,key:`a3`,label:`A3`,widthIn:11.69,widthTwips:16838}),u=a({cssSize:`Letter`,heightIn:11,heightTwips:15840,key:`letter`,label:`Letter`,widthIn:8.5,widthTwips:12240}),d=a({cssSize:`Legal`,heightIn:14,heightTwips:20160,key:`legal`,label:`Legal`,widthIn:8.5,widthTwips:12240}),f=a({cssSize:`Tabloid`,heightIn:17,heightTwips:24480,key:`tabloid`,label:`Tabloid`,widthIn:11,widthTwips:15840}),p={a4:s,a4Landscape:o(s,`a4Landscape`),a5:c,a5Landscape:o(c,`a5Landscape`),a3:l,a3Landscape:o(l,`a3Landscape`),letter:u,letterLandscape:o(u,`letterLandscape`),legal:d,legalLandscape:o(d,`legalLandscape`),tabloid:f,tabloidLandscape:o(f,`tabloidLandscape`),size1024x768:{cssSize:`10.6667in 8in`,heightIn:8,heightTwips:11520,key:`size1024x768`,label:`1024x768`,orientation:`landscape`,widthIn:10.6667,widthTwips:15360},size1280x720:{cssSize:`13.3333in 7.5in`,heightIn:7.5,heightTwips:10800,key:`size1280x720`,label:`1280x720`,orientation:`landscape`,widthIn:13.3333,widthTwips:19200}},m=[i,p.a4,p.a4Landscape,p.a5,p.a5Landscape,p.a3,p.a3Landscape,p.letter,p.letterLandscape,p.legal,p.legalLandscape,p.tabloid,p.tabloidLandscape,p.size1024x768,p.size1280x720];function h(e){return e===`web`?null:p[e]}function g(){return m}function _(e){return typeof e==`string`&&m.some(t=>t.key===e)}var v=[`lexical-playground-settings`,`lexical-playground-editor-state`,`lexical-playground-comments`,`lexical-playground-comments-panel-open`,`lexical-playground-block-text-links`,`lexical-playground-read-only-mode`,`lexical-playground-insert-character-picker`,`lexical-playground-editor-zoom-percent`],y=null,b=0,x=new Map,S={getItem(e){return x.get(e)??null},removeItem(e){x.delete(e);let t=y;t!==null&&t.deleteSetting(e).catch(()=>{})},setItem(e,t){x.set(e,t);let n=y;n!==null&&n.setSetting(e,t).catch(()=>{})}};function C(e){y!==(e??null)&&(y=e??null,b+=1,x.clear())}async function w(e){let t=y;if(t===null)return;let n=b,r=await Promise.all(e.map(async e=>{try{return[e,D(await t.getSetting(e))]}catch{return[e,null]}}));if(!(y!==t||b!==n)){x.clear();for(let[e,t]of r)t!==null&&x.set(e,t)}}function T(){return y===null?O():S}function E(){return{async deleteSetting(e){O()?.removeItem(e)},async getSetting(e){return O()?.getItem(e)??null},async setSetting(e,t){let n=D(t);n!==null&&O()?.setItem(e,n)}}}function D(e){if(e==null)return null;if(typeof e==`string`)return e;try{return JSON.stringify(e)??null}catch{return null}}function O(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var k=`lexical-playground-settings`,A={disableBeforeInput:!1,emptyEditor:!1,hasLinkAttributes:!1,hasNestedTables:!1,isAutocomplete:!0,isCharLimit:!1,isCharLimitUtf8:!1,isCodeHighlighted:!0,isCodeShiki:!1,isDarkMode:!1,isMaxLength:!1,isRichText:!0,listStrictIndent:!1,measureTypingPerf:!1,pageSize:`web`,selectionAlwaysOnDisplay:!1,shouldAllowHighlightingWithBrackets:!1,shouldPreserveNewLinesInMarkdown:!1,shouldUseLexicalContextMenu:!1,showInvisibleCharacters:!1,showNestedEditorTreeView:!1,showTableOfContents:!1,showTreeView:!1,tableCellBackgroundColor:!0,tableCellMerge:!0,tableHorizontalScroll:!0},j=Object.keys(A),M={...A};function N(e){return{...A,...P(),...F(window.location.search,e)}}function P(){let e=R();if(e===null)return{};let t=e.getItem(k);if(t==null)return{};try{let e=JSON.parse(t);if(typeof e!=`object`||!e||Array.isArray(e))return{};let n={};for(let t of j){let r=e[t];if(typeof A[t]==`boolean`&&typeof r==`boolean`){n[t]=r;continue}t===`pageSize`&&_(r)&&(n[t]=r)}return n}catch{return{}}}function F(e,t){if(typeof window>`u`)return{};let n=new URLSearchParams(e),r={};for(let e of j)if(n.has(e))try{let i=A[e],a=n.get(e);if(e===`pageSize`){_(a)?r[e]=a:t?.onParseError?.(e);continue}typeof i==`boolean`&&(r[e]=!!JSON.parse(a??`true`))}catch{t?.onParseError?.(e)}return r}function I(e){return j.some(t=>e[t]!==A[t])}function L(e){let t=R();if(t===null)return;let n={};for(let t of j)e[t]!==A[t]&&(n[t]=e[t]);if(Object.keys(n).length===0){t.removeItem(k);return}t.setItem(k,JSON.stringify(n))}function R(){return T()}var z=(0,n.createContext)({resetOptions:()=>{},setOption:(e,t)=>{},settings:N()}),B=({children:e})=>{let[t,i]=(0,n.useState)(()=>N()),a=(0,n.useRef)(t);a.current=t;let o=(0,n.useCallback)(e=>{a.current=e,i(e),L(e),H(e)},[]),s=(0,n.useCallback)((e,t)=>{let n=a.current;n[e]!==t&&o({...n,[e]:t})},[o]),c=(0,n.useCallback)(()=>{let e=a.current;I(e)&&o({...A})},[o]),l=(0,n.useMemo)(()=>({resetOptions:c,setOption:s,settings:t}),[c,s,t]);return(0,r.jsx)(z.Provider,{value:l,children:e})},V=()=>(0,n.useContext)(z);function H(e){let t=new URL(window.location.href),n=new URLSearchParams(t.search);for(let t of j)e[t]===A[t]?n.delete(t):n.set(t,String(e[t]));t.search=n.toString(),window.history.pushState(null,``,t.toString())}function U(e,t,n){return Math.min(Math.max(e,t),n)}var W={east:1,north:8,south:2,west:4};function G({onResizeStart:e,onResizeEnd:i,buttonRef:a,mediaRef:o,maxWidth:s,editor:c,showCaption:l,setShowCaption:u,captionsEnabled:d}){let f=(0,n.useRef)(null),p=(0,n.useRef)({priority:``,value:`default`}),m=(0,n.useRef)({currentHeight:0,currentWidth:0,direction:0,isResizing:!1,ratio:0,startHeight:0,startWidth:0,startX:0,startY:0}),h=c.getRootElement(),g=s||(h===null?100:h.getBoundingClientRect().width-20),_=h===null?100:h.getBoundingClientRect().height-20,v=e=>{let t=e===W.east||e===W.west,n=e===W.north||e===W.south,r=e&W.north&&e&W.west||e&W.south&&e&W.east,i=t?`ew`:n?`ns`:r?`nwse`:`nesw`;h!==null&&h.style.setProperty(`cursor`,`${i}-resize`,`important`),document.body!==null&&(document.body.style.setProperty(`cursor`,`${i}-resize`,`important`),p.current.value=document.body.style.getPropertyValue(`-webkit-user-select`),p.current.priority=document.body.style.getPropertyPriority(`-webkit-user-select`),document.body.style.setProperty(`-webkit-user-select`,`none`,`important`))},y=()=>{h!==null&&h.style.setProperty(`cursor`,`text`),document.body!==null&&(document.body.style.setProperty(`cursor`,`default`),document.body.style.setProperty(`-webkit-user-select`,p.current.value,p.current.priority))},b=(n,r)=>{if(!c.isEditable())return;let i=o.current,a=f.current;if(i!==null&&a!==null){n.preventDefault(),n.stopPropagation();let{width:o,height:s}=i.getBoundingClientRect(),c=t.d(i),l=m.current;l.startWidth=o,l.startHeight=s,l.ratio=o/s,l.currentWidth=o,l.currentHeight=s,l.startX=n.clientX/c,l.startY=n.clientY/c,l.isResizing=!0,l.direction=r,v(r),e(),a.classList.add(`media-control-wrapper--resizing`),i.style.height=`${s}px`,i.style.width=`${o}px`,document.addEventListener(`pointermove`,x),document.addEventListener(`pointerup`,S)}},x=e=>{let n=o.current,r=m.current,i=r.direction&(W.east|W.west),a=r.direction&(W.south|W.north);if(n!==null&&r.isResizing){let o=t.d(n);if(i&&a){let t=Math.floor(r.startX-e.clientX/o);t=r.direction&W.east?-t:t;let i=U(r.startWidth+t,100,g),a=i/r.ratio;n.style.width=`${i}px`,n.style.height=`${a}px`,r.currentHeight=a,r.currentWidth=i}else if(a){let t=Math.floor(r.startY-e.clientY/o);t=r.direction&W.south?-t:t;let i=U(r.startHeight+t,100,_);n.style.height=`${i}px`,r.currentHeight=i}else{let t=Math.floor(r.startX-e.clientX/o);t=r.direction&W.east?-t:t;let i=U(r.startWidth+t,100,g);n.style.width=`${i}px`,r.currentWidth=i}}},S=()=>{let e=o.current,t=m.current,n=f.current;if(e!==null&&n!==null&&t.isResizing){let e=t.currentWidth,r=t.currentHeight;t.startWidth=0,t.startHeight=0,t.ratio=0,t.startX=0,t.startY=0,t.currentWidth=0,t.currentHeight=0,t.isResizing=!1,n.classList.remove(`media-control-wrapper--resizing`),y(),i(e,r),document.removeEventListener(`pointermove`,x),document.removeEventListener(`pointerup`,S)}};return(0,r.jsxs)(`div`,{ref:f,children:[!l&&d&&(0,r.jsx)(`button`,{className:`media-caption-button`,ref:a,onClick:()=>{u(!l)},children:`Add Caption`}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-n`,onPointerDown:e=>{b(e,W.north)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-ne`,onPointerDown:e=>{b(e,W.north|W.east)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-e`,onPointerDown:e=>{b(e,W.east)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-se`,onPointerDown:e=>{b(e,W.south|W.east)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-s`,onPointerDown:e=>{b(e,W.south)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-sw`,onPointerDown:e=>{b(e,W.south|W.west)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-w`,onPointerDown:e=>{b(e,W.west)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-nw`,onPointerDown:e=>{b(e,W.north|W.west)}})]})}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return E}});
1
+ const e=require("./rolldown-runtime-D_FWMvbo.cjs"),t=require("./LexicalUtils.prod-CYv8J7Gq.cjs");let n=require("react");n=e.a(n,1);let r=require("react/jsx-runtime");var i={key:`web`,label:`Web view`};function a(e){return{...e,orientation:`portrait`}}function o(e,t){return{cssSize:`${e.cssSize} landscape`,heightIn:e.widthIn,heightTwips:e.widthTwips,key:t,label:`${e.label} landscape`,orientation:`landscape`,widthIn:e.heightIn,widthTwips:e.heightTwips}}var s=a({cssSize:`A4`,heightIn:11.69,heightTwips:16838,key:`a4`,label:`A4`,widthIn:8.27,widthTwips:11906}),c=a({cssSize:`A5`,heightIn:8.27,heightTwips:11906,key:`a5`,label:`A5`,widthIn:5.83,widthTwips:8391}),l=a({cssSize:`A3`,heightIn:16.54,heightTwips:23811,key:`a3`,label:`A3`,widthIn:11.69,widthTwips:16838}),u=a({cssSize:`Letter`,heightIn:11,heightTwips:15840,key:`letter`,label:`Letter`,widthIn:8.5,widthTwips:12240}),d=a({cssSize:`Legal`,heightIn:14,heightTwips:20160,key:`legal`,label:`Legal`,widthIn:8.5,widthTwips:12240}),f=a({cssSize:`Tabloid`,heightIn:17,heightTwips:24480,key:`tabloid`,label:`Tabloid`,widthIn:11,widthTwips:15840}),p={a4:s,a4Landscape:o(s,`a4Landscape`),a5:c,a5Landscape:o(c,`a5Landscape`),a3:l,a3Landscape:o(l,`a3Landscape`),letter:u,letterLandscape:o(u,`letterLandscape`),legal:d,legalLandscape:o(d,`legalLandscape`),tabloid:f,tabloidLandscape:o(f,`tabloidLandscape`),size1024x768:{cssSize:`10.6667in 8in`,heightIn:8,heightTwips:11520,key:`size1024x768`,label:`1024x768`,orientation:`landscape`,widthIn:10.6667,widthTwips:15360},size1280x720:{cssSize:`13.3333in 7.5in`,heightIn:7.5,heightTwips:10800,key:`size1280x720`,label:`1280x720`,orientation:`landscape`,widthIn:13.3333,widthTwips:19200}},m=[i,p.a4,p.a4Landscape,p.a5,p.a5Landscape,p.a3,p.a3Landscape,p.letter,p.letterLandscape,p.legal,p.legalLandscape,p.tabloid,p.tabloidLandscape,p.size1024x768,p.size1280x720];function h(e){return e===`web`?null:p[e]}function g(){return m}function _(e){return typeof e==`string`&&m.some(t=>t.key===e)}var v=[`lexical-playground-settings`,`lexical-playground-editor-state`,`lexical-playground-comments`,`lexical-playground-comments-panel-open`,`lexical-playground-block-text-links`,`lexical-playground-read-only-mode`,`lexical-playground-insert-character-picker`,`lexical-playground-editor-zoom-percent`],y=null,b=0,x=new Map,S={getItem(e){return x.get(e)??null},removeItem(e){x.delete(e);let t=y;t!==null&&t.deleteSetting(e).catch(()=>{})},setItem(e,t){x.set(e,t);let n=y;n!==null&&n.setSetting(e,t).catch(()=>{})}};function C(e){y!==(e??null)&&(y=e??null,b+=1,x.clear())}async function w(e){let t=y;if(t===null)return;let n=b,r=await Promise.all(e.map(async e=>{try{return[e,D(await t.getSetting(e))]}catch{return[e,null]}}));if(!(y!==t||b!==n)){x.clear();for(let[e,t]of r)t!==null&&x.set(e,t)}}function T(){return y===null?O():S}function E(){return{async deleteSetting(e){O()?.removeItem(e)},async getSetting(e){return O()?.getItem(e)??null},async setSetting(e,t){let n=D(t);n!==null&&O()?.setItem(e,n)}}}function D(e){if(e==null)return null;if(typeof e==`string`)return e;try{return JSON.stringify(e)??null}catch{return null}}function O(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var k=`lexical-playground-settings`,A={disableBeforeInput:!1,emptyEditor:!1,hasLinkAttributes:!1,hasNestedTables:!1,isAutocomplete:!0,isCharLimit:!1,isCharLimitUtf8:!1,isCodeHighlighted:!0,isCodeShiki:!1,isDarkMode:!1,isMaxLength:!1,isRichText:!0,listStrictIndent:!1,measureTypingPerf:!1,pageSize:`web`,selectionAlwaysOnDisplay:!1,shouldAllowHighlightingWithBrackets:!1,shouldPreserveNewLinesInMarkdown:!1,shouldUseLexicalContextMenu:!1,showInvisibleCharacters:!1,showNestedEditorTreeView:!1,showTableOfContents:!1,showTreeView:!1,tableCellBackgroundColor:!0,tableCellMerge:!0,tableHorizontalScroll:!0},j=Object.keys(A),M={...A};function N(e){return{...A,...P(),...F(window.location.search,e)}}function P(){let e=R();if(e===null)return{};let t=e.getItem(k);if(t==null)return{};try{let e=JSON.parse(t);if(typeof e!=`object`||!e||Array.isArray(e))return{};let n={};for(let t of j){let r=e[t];if(typeof A[t]==`boolean`&&typeof r==`boolean`){n[t]=r;continue}t===`pageSize`&&_(r)&&(n[t]=r)}return n}catch{return{}}}function F(e,t){if(typeof window>`u`)return{};let n=new URLSearchParams(e),r={};for(let e of j)if(n.has(e))try{let i=A[e],a=n.get(e);if(e===`pageSize`){_(a)?r[e]=a:t?.onParseError?.(e);continue}typeof i==`boolean`&&(r[e]=!!JSON.parse(a??`true`))}catch{t?.onParseError?.(e)}return r}function I(e){return j.some(t=>e[t]!==A[t])}function L(e){let t=R();if(t===null)return;let n={};for(let t of j)e[t]!==A[t]&&(n[t]=e[t]);if(Object.keys(n).length===0){t.removeItem(k);return}t.setItem(k,JSON.stringify(n))}function R(){return T()}var z=(0,n.createContext)({resetOptions:()=>{},setOption:(e,t)=>{},settings:N()}),B=({children:e})=>{let[t,i]=(0,n.useState)(()=>N()),a=(0,n.useRef)(t);a.current=t;let o=(0,n.useCallback)(e=>{a.current=e,i(e),L(e),H(e)},[]),s=(0,n.useCallback)((e,t)=>{let n=a.current;n[e]!==t&&o({...n,[e]:t})},[o]),c=(0,n.useCallback)(()=>{let e=a.current;I(e)&&o({...A})},[o]),l=(0,n.useMemo)(()=>({resetOptions:c,setOption:s,settings:t}),[c,s,t]);return(0,r.jsx)(z.Provider,{value:l,children:e})},V=()=>(0,n.useContext)(z);function H(e){let t=new URL(window.location.href),n=new URLSearchParams(t.search);for(let t of j)e[t]===A[t]?n.delete(t):n.set(t,String(e[t]));t.search=n.toString(),window.history.pushState(null,``,t.toString())}function U(e,t,n){return Math.min(Math.max(e,t),n)}var W={east:1,north:8,south:2,west:4};function G({onResizeStart:e,onResizeEnd:i,buttonRef:a,mediaRef:o,maxWidth:s,editor:c,showCaption:l,setShowCaption:u,captionsEnabled:d}){let f=(0,n.useRef)(null),p=(0,n.useRef)({priority:``,value:`default`}),m=(0,n.useRef)({currentHeight:0,currentWidth:0,direction:0,isResizing:!1,ratio:0,startHeight:0,startWidth:0,startX:0,startY:0}),h=c.getRootElement(),g=s||(h===null?100:h.getBoundingClientRect().width-20),_=h===null?100:h.getBoundingClientRect().height-20,v=e=>{let t=e===W.east||e===W.west,n=e===W.north||e===W.south,r=e&W.north&&e&W.west||e&W.south&&e&W.east,i=t?`ew`:n?`ns`:r?`nwse`:`nesw`;h!==null&&h.style.setProperty(`cursor`,`${i}-resize`,`important`),document.body!==null&&(document.body.style.setProperty(`cursor`,`${i}-resize`,`important`),p.current.value=document.body.style.getPropertyValue(`-webkit-user-select`),p.current.priority=document.body.style.getPropertyPriority(`-webkit-user-select`),document.body.style.setProperty(`-webkit-user-select`,`none`,`important`))},y=()=>{h!==null&&h.style.setProperty(`cursor`,`text`),document.body!==null&&(document.body.style.setProperty(`cursor`,`default`),document.body.style.setProperty(`-webkit-user-select`,p.current.value,p.current.priority))},b=(n,r)=>{if(!c.isEditable())return;let i=o.current,a=f.current;if(i!==null&&a!==null){n.preventDefault(),n.stopPropagation();let{width:o,height:s}=i.getBoundingClientRect(),c=t.d(i),l=m.current;l.startWidth=o,l.startHeight=s,l.ratio=o/s,l.currentWidth=o,l.currentHeight=s,l.startX=n.clientX/c,l.startY=n.clientY/c,l.isResizing=!0,l.direction=r,v(r),e(),a.classList.add(`media-control-wrapper--resizing`),i.style.height=`${s}px`,i.style.width=`${o}px`,document.addEventListener(`pointermove`,x),document.addEventListener(`pointerup`,S)}},x=e=>{let n=o.current,r=m.current,i=r.direction&(W.east|W.west),a=r.direction&(W.south|W.north);if(n!==null&&r.isResizing){let o=t.d(n);if(i&&a){let t=Math.floor(r.startX-e.clientX/o);t=r.direction&W.east?-t:t;let i=U(r.startWidth+t,100,g),a=i/r.ratio;n.style.width=`${i}px`,n.style.height=`${a}px`,r.currentHeight=a,r.currentWidth=i}else if(a){let t=Math.floor(r.startY-e.clientY/o);t=r.direction&W.south?-t:t;let i=U(r.startHeight+t,100,_);n.style.height=`${i}px`,r.currentHeight=i}else{let t=Math.floor(r.startX-e.clientX/o);t=r.direction&W.east?-t:t;let i=U(r.startWidth+t,100,g);n.style.width=`${i}px`,r.currentWidth=i}}},S=()=>{let e=o.current,t=m.current,n=f.current;if(e!==null&&n!==null&&t.isResizing){let e=t.currentWidth,r=t.currentHeight;t.startWidth=0,t.startHeight=0,t.ratio=0,t.startX=0,t.startY=0,t.currentWidth=0,t.currentHeight=0,t.isResizing=!1,n.classList.remove(`media-control-wrapper--resizing`),y(),i(e,r),document.removeEventListener(`pointermove`,x),document.removeEventListener(`pointerup`,S)}};return(0,r.jsxs)(`div`,{ref:f,children:[!l&&d&&(0,r.jsx)(`button`,{className:`media-caption-button`,ref:a,onClick:()=>{u(!l)},children:`Add Caption`}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-n`,onPointerDown:e=>{b(e,W.north)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-ne`,onPointerDown:e=>{b(e,W.north|W.east)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-e`,onPointerDown:e=>{b(e,W.east)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-se`,onPointerDown:e=>{b(e,W.south|W.east)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-s`,onPointerDown:e=>{b(e,W.south)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-sw`,onPointerDown:e=>{b(e,W.south|W.west)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-w`,onPointerDown:e=>{b(e,W.west)}}),(0,r.jsx)(`div`,{className:`media-resizer media-resizer-nw`,onPointerDown:e=>{b(e,W.north|W.west)}})]})}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return E}});
@@ -1,13 +1,13 @@
1
1
  import { En as e, Ht as t, ft as n, oi as r, pt as i } from "./Lexical.prod-DYDuARMX.mjs";
2
- import { N as a, a as o, n as s, o as c, r as l, t as u } from "./ContentEditable-C_wyHFh1.mjs";
3
- import { a as d, i as f, n as p, s as m } from "./StickyNode-B2B6di-N.mjs";
2
+ import { N as a, a as o, n as s, o as c, r as l, t as u } from "./ContentEditable-BaXBKC3m.mjs";
3
+ import { a as d, c as f, i as p, n as m } from "./StickyNode-CN3WkBD3.mjs";
4
4
  import { t as h } from "./useLexicalEditable.prod-CgMasHPY.mjs";
5
5
  import { t as g } from "./LexicalNestedComposer.prod-C96XUwM-.mjs";
6
6
  import { useCallback as _, useEffect as v, useLayoutEffect as y, useRef as b, useState as x } from "react";
7
7
  import { jsx as S, jsxs as C } from "react/jsx-runtime";
8
8
  //#region src/themes/StickyEditorTheme.ts
9
9
  var w = {
10
- ...f,
10
+ ...p,
11
11
  paragraph: "StickyEditorTheme__paragraph"
12
12
  }, T = 4;
13
13
  function E(e, t, n) {
@@ -55,8 +55,8 @@ function ee(e) {
55
55
  let t = e.parentElement ?? document.body;
56
56
  return Array.from(t.querySelectorAll(".sticky-note-container")).reduce((e, t) => Math.max(e, j(t)), 9) + 1;
57
57
  }
58
- function M({ x: s, y: f, nodeKey: E, color: O, caption: j, width: M, height: N, extraFontFamilies: P, layer: F = 0 }) {
59
- let [I] = r(), L = h(), R = m(), z = P ?? R, [B, V] = x(null), H = b(null), U = b(null), W = b({
58
+ function M({ x: s, y: p, nodeKey: E, color: O, caption: j, width: M, height: N, extraFontFamilies: P, layer: F = 0 }) {
59
+ let [I] = r(), L = h(), R = f(), z = P ?? R, [B, V] = x(null), H = b(null), U = b(null), W = b({
60
60
  hasMoved: !1,
61
61
  isDragging: !1,
62
62
  pointerId: null,
@@ -86,7 +86,7 @@ function M({ x: s, y: f, nodeKey: E, color: O, caption: j, width: M, height: N,
86
86
  I.update(() => {
87
87
  i(n), e(null);
88
88
  let r = t(E);
89
- p(r) && r.bringToFront();
89
+ m(r) && r.bringToFront();
90
90
  });
91
91
  }, [
92
92
  I,
@@ -98,7 +98,7 @@ function M({ x: s, y: f, nodeKey: E, color: O, caption: j, width: M, height: N,
98
98
  }, [L, F]), v(() => j.registerUpdateListener(() => {
99
99
  I.update(() => {
100
100
  let e = t(E);
101
- p(e) && e.markCaptionChanged();
101
+ m(e) && e.markCaptionChanged();
102
102
  });
103
103
  }), [
104
104
  j,
@@ -106,10 +106,10 @@ function M({ x: s, y: f, nodeKey: E, color: O, caption: j, width: M, height: N,
106
106
  E
107
107
  ]), y(() => {
108
108
  let e = W.current;
109
- e.x = s, e.y = f;
109
+ e.x = s, e.y = p;
110
110
  let t = H.current;
111
111
  t !== null && D(t, e);
112
- }, [s, f]), v(() => {
112
+ }, [s, p]), v(() => {
113
113
  let e = G.current;
114
114
  e.width = M, e.height = N;
115
115
  }, [M, N]);
@@ -119,7 +119,7 @@ function M({ x: s, y: f, nodeKey: E, color: O, caption: j, width: M, height: N,
119
119
  }, [I]), J = (e, n) => {
120
120
  I.update(() => {
121
121
  let r = t(E);
122
- p(r) && r.setSize(e, n);
122
+ m(r) && r.setSize(e, n);
123
123
  });
124
124
  }, Y = (e, t) => {
125
125
  let n = H.current, r = U.current, i = W.current;
@@ -174,7 +174,7 @@ function M({ x: s, y: f, nodeKey: E, color: O, caption: j, width: M, height: N,
174
174
  let n = H.current, r = W.current;
175
175
  r.pointerId === e.pointerId && (n !== null && (r.isDragging = !1, r.pointerId = null, r.hasMoved = !1, n.classList.remove("dragging"), I.update(() => {
176
176
  let e = t(E);
177
- p(e) && e.setPosition(r.x, r.y);
177
+ m(e) && e.setPosition(r.x, r.y);
178
178
  })), e.preventDefault(), document.removeEventListener("pointermove", X), document.removeEventListener("pointerup", Z), document.removeEventListener("pointercancel", Z));
179
179
  }, Q = (e) => {
180
180
  let t = H.current, n = U.current, r = G.current, i = l(n);
@@ -201,12 +201,12 @@ function M({ x: s, y: f, nodeKey: E, color: O, caption: j, width: M, height: N,
201
201
  }, ne = () => {
202
202
  I.update(() => {
203
203
  let e = t(E);
204
- p(e) && e.remove();
204
+ m(e) && e.remove();
205
205
  });
206
206
  }, re = () => {
207
207
  I.update(() => {
208
208
  let e = t(E);
209
- p(e) && e.toggleColor();
209
+ m(e) && e.toggleColor();
210
210
  });
211
211
  }, { historyState: ie } = o();
212
212
  return /* @__PURE__ */ S("div", {
@@ -1 +1 @@
1
- require("./rolldown-runtime-D_FWMvbo.cjs");const e=require("./Lexical.prod-C9Xekspf.cjs"),t=require("./ContentEditable-DgthEFHJ.cjs"),n=require("./StickyNode-GgIn3-zY.cjs"),r=require("./useLexicalEditable.prod-B2XnDcjV.cjs"),i=require("./LexicalNestedComposer.prod-DBJWbgz2.cjs");let a=require("react"),o=require("react/jsx-runtime");var s={...n.i,paragraph:`StickyEditorTheme__paragraph`},c=4;function l(e,t,n){return Math.min(Math.max(e,t),n)}function u(e,t){let n=e.style,r=d(e,t,t.x,t.y);t.x=r.x,t.y=r.y,n.top=t.y+`px`,n.left=t.x+`px`}function d(e,n,r,i){let a=n.positioningFrameRect;if(a===null)return{x:r,y:i};let o=t.n(e),s=e.getBoundingClientRect(),c=a.width/o,u=a.height/o,d=s.width/o,f=s.height/o;return{x:l(r,0,Math.max(0,c-d)),y:l(i,0,Math.max(0,u-f))}}function f(e,n,r,i,a){let o=r.positioningFrameRect;if(o===null)return{height:Math.round(Math.max(80,a)),width:Math.round(Math.max(120,i))};let s=t.n(n),c=e.getBoundingClientRect(),u=n.getBoundingClientRect(),d=o.width/s,f=o.height/s,p=Math.max(0,(c.width-u.width)/s),m=Math.max(0,(c.height-u.height)/s),h=Math.max(120,d-r.x-p),g=Math.max(80,f-r.y-m);return{height:Math.round(l(a,80,g)),width:Math.round(l(i,120,h))}}function p(e){let t=e.getRootElement();return t===null?null:t.closest(`.editor-scroller`)??t}function m(e){let t=Number.parseInt(e.style.zIndex,10);if(Number.isFinite(t))return t;let n=Number.parseInt(window.getComputedStyle(e).zIndex,10);return Number.isFinite(n)?n:9}function h(e){let t=e.parentElement??document.body;return Array.from(t.querySelectorAll(`.sticky-note-container`)).reduce((e,t)=>Math.max(e,m(t)),9)+1}function g({x:l,y:d,nodeKey:m,color:g,caption:_,width:v,height:y,extraFontFamilies:b,layer:x=0}){let[S]=e.oi(),C=r.t(),w=n.s(),T=b??w,[E,D]=(0,a.useState)(null),O=(0,a.useRef)(null),k=(0,a.useRef)(null),A=(0,a.useRef)({hasMoved:!1,isDragging:!1,pointerId:null,positioningFrameRect:null,startLocalX:0,startLocalY:0,startX:0,startY:0,x:0,y:0}),j=(0,a.useRef)({hasMoved:!1,height:y,isResizing:!1,pointerId:null,startClientX:0,startClientY:0,startHeight:y,startWidth:v,width:v}),M=(0,a.useCallback)(()=>{if(!C){let e=O.current;e!==null&&D(h(e));return}S.update(()=>{e.pt(e.ft),e.En(null);let t=e.Ht(m);n.n(t)&&t.bringToFront()})},[S,C,m]);(0,a.useEffect)(()=>{C&&D(null)},[C,x]),(0,a.useEffect)(()=>_.registerUpdateListener(()=>{S.update(()=>{let t=e.Ht(m);n.n(t)&&t.markCaptionChanged()})}),[_,S,m]),(0,a.useLayoutEffect)(()=>{let e=A.current;e.x=l,e.y=d;let t=O.current;t!==null&&u(t,e)},[l,d]),(0,a.useEffect)(()=>{let e=j.current;e.width=v,e.height=y},[v,y]);let N=(0,a.useCallback)(()=>{let e=p(S),t=A.current;return e!==null&&(t.positioningFrameRect=e.getBoundingClientRect()),t.positioningFrameRect},[S]),P=(t,r)=>{S.update(()=>{let i=e.Ht(m);n.n(i)&&i.setSize(t,r)})},F=(e,t)=>{let n=O.current,r=k.current,i=A.current;if(n===null||r===null)return null;let a=f(n,r,i,e,t),o=j.current;return r.style.width=`${a.width}px`,r.style.height=`${a.height}px`,o.width=a.width,o.height=a.height,u(n,i),a};(0,a.useLayoutEffect)(()=>{let e=A.current,t=null,n=new ResizeObserver(t=>{for(let n=0;n<t.length;n++){let{target:r}=t[n];e.positioningFrameRect=r.getBoundingClientRect();let i=O.current;i!==null&&u(i,e)}}),r=()=>{t!==null&&n.unobserve(t);let r=p(S);t=r,r===null?e.positioningFrameRect=null:(e.positioningFrameRect=r.getBoundingClientRect(),n.observe(r));let i=O.current;i!==null&&u(i,e)},i=S.registerRootListener(e=>{if(e!==null){r();return}t!==null&&(n.unobserve(t),t=null)}),a=()=>{let t=S.getRootElement(),n=O.current;t!==null&&n!==null&&(N(),u(n,e))};return window.addEventListener(`resize`,a),()=>{window.removeEventListener(`resize`,a),i()}},[S,N]),(0,a.useEffect)(()=>{let e=O.current;e!==null&&setTimeout(()=>{e.style.setProperty(`transition`,`top 0.3s ease 0s, left 0.3s ease 0s`)},500)},[]);let I=e=>{let n=O.current,r=A.current,i=r.positioningFrameRect,a=t.r(n);if(r.pointerId===e.pointerId&&n!==null&&r.isDragging&&i!==null){let t=e.clientX-r.startX,i=e.clientY-r.startY;if(!r.hasMoved){if(Math.abs(t)+Math.abs(i)<c)return;r.hasMoved=!0,n.classList.add(`dragging`)}r.x=r.startLocalX+t/a,r.y=r.startLocalY+i/a,u(n,r),e.preventDefault()}},L=t=>{let r=O.current,i=A.current;i.pointerId===t.pointerId&&(r!==null&&(i.isDragging=!1,i.pointerId=null,i.hasMoved=!1,r.classList.remove(`dragging`),S.update(()=>{let t=e.Ht(m);n.n(t)&&t.setPosition(i.x,i.y)})),t.preventDefault(),document.removeEventListener(`pointermove`,I),document.removeEventListener(`pointerup`,L),document.removeEventListener(`pointercancel`,L))},R=e=>{let n=O.current,r=k.current,i=j.current,a=t.r(r);if(i.pointerId===e.pointerId&&n!==null&&r!==null&&i.isResizing){let t=e.clientX-i.startClientX,n=e.clientY-i.startClientY;if(!i.hasMoved){if(Math.abs(t)+Math.abs(n)<c)return;i.hasMoved=!0,r.classList.add(`resizing`)}F(i.startWidth+t/a,i.startHeight+n/a),e.preventDefault()}},z=()=>{let e=j.current,t=F(e.width*1.12,e.height*1.12);t!==null&&P(t.width,t.height)},B=e=>{let t=k.current,n=j.current;if(n.pointerId!==e.pointerId)return;let r=n.hasMoved;if(t!==null&&(n.isResizing=!1,n.pointerId=null,n.hasMoved=!1,t.classList.remove(`resizing`)),e.preventDefault(),document.removeEventListener(`pointermove`,R),document.removeEventListener(`pointerup`,B),document.removeEventListener(`pointercancel`,B),!r){z();return}P(n.width,n.height)},V=()=>{S.update(()=>{let t=e.Ht(m);n.n(t)&&t.remove()})},H=()=>{S.update(()=>{let t=e.Ht(m);n.n(t)&&t.toggleColor()})},{historyState:U}=t.a();return(0,o.jsx)(`div`,{ref:O,className:`sticky-note-container`,style:{zIndex:E??9+x},children:(0,o.jsxs)(`div`,{ref:k,className:`sticky-note ${g}`,style:{height:y,width:v,fontFamily:[`"Indie Flower"`,...T,`cursive`].join(`, `)},onFocus:M,onPointerDownCapture:M,onPointerDown:e=>{let t=O.current;if(t==null||e.button===2||e.target!==t.firstChild)return;let n=t,r=A.current;n!==null&&(N(),r.startLocalX=r.x,r.startLocalY=r.y,r.pointerId=e.pointerId,r.startX=e.clientX,r.startY=e.clientY,r.hasMoved=!1,r.isDragging=!0,document.addEventListener(`pointermove`,I),document.addEventListener(`pointerup`,L),document.addEventListener(`pointercancel`,L),e.preventDefault())},children:[(0,o.jsxs)(`div`,{className:`top-right-buttons`,children:[(0,o.jsx)(`button`,{onClick:H,"aria-label":`Change sticky note color`,title:`Color`,children:(0,o.jsx)(`i`,{className:`bi bi-paint-bucket`})}),(0,o.jsx)(`button`,{onClick:V,"aria-label":`Delete sticky note`,title:`Delete`,children:(0,o.jsx)(`i`,{className:`bi bi-x-lg`,style:{color:`red`}})})]}),(0,o.jsx)(`button`,{className:`resize`,"aria-label":`Resize sticky note`,title:`Resize`,onPointerDown:e=>{if(k.current===null||e.button===2)return;N();let t=j.current;t.isResizing=!0,t.pointerId=e.pointerId,t.hasMoved=!1,t.startClientX=e.clientX,t.startClientY=e.clientY,t.startWidth=t.width,t.startHeight=t.height,document.addEventListener(`pointermove`,R),document.addEventListener(`pointerup`,B),document.addEventListener(`pointercancel`,B),e.preventDefault(),e.stopPropagation()},children:(0,o.jsx)(`i`,{className:`bi bi-arrow-down-right`})}),(0,o.jsxs)(i.t,{initialEditor:_,initialTheme:s,children:[(0,o.jsx)(t.o,{externalHistoryState:U}),(0,o.jsx)(n.a,{contentEditable:(0,o.jsx)(t.t,{placeholder:`What's up?`,placeholderClassName:`StickyNode__placeholder`,className:`StickyNode__contentEditable`}),ErrorBoundary:t.N})]})]})})}exports.default=g;
1
+ require("./rolldown-runtime-D_FWMvbo.cjs");const e=require("./Lexical.prod-C9Xekspf.cjs"),t=require("./ContentEditable-Ce294XLd.cjs"),n=require("./StickyNode-Dm3H0XUa.cjs"),r=require("./useLexicalEditable.prod-B2XnDcjV.cjs"),i=require("./LexicalNestedComposer.prod-DBJWbgz2.cjs");let a=require("react"),o=require("react/jsx-runtime");var s={...n.i,paragraph:`StickyEditorTheme__paragraph`},c=4;function l(e,t,n){return Math.min(Math.max(e,t),n)}function u(e,t){let n=e.style,r=d(e,t,t.x,t.y);t.x=r.x,t.y=r.y,n.top=t.y+`px`,n.left=t.x+`px`}function d(e,n,r,i){let a=n.positioningFrameRect;if(a===null)return{x:r,y:i};let o=t.n(e),s=e.getBoundingClientRect(),c=a.width/o,u=a.height/o,d=s.width/o,f=s.height/o;return{x:l(r,0,Math.max(0,c-d)),y:l(i,0,Math.max(0,u-f))}}function f(e,n,r,i,a){let o=r.positioningFrameRect;if(o===null)return{height:Math.round(Math.max(80,a)),width:Math.round(Math.max(120,i))};let s=t.n(n),c=e.getBoundingClientRect(),u=n.getBoundingClientRect(),d=o.width/s,f=o.height/s,p=Math.max(0,(c.width-u.width)/s),m=Math.max(0,(c.height-u.height)/s),h=Math.max(120,d-r.x-p),g=Math.max(80,f-r.y-m);return{height:Math.round(l(a,80,g)),width:Math.round(l(i,120,h))}}function p(e){let t=e.getRootElement();return t===null?null:t.closest(`.editor-scroller`)??t}function m(e){let t=Number.parseInt(e.style.zIndex,10);if(Number.isFinite(t))return t;let n=Number.parseInt(window.getComputedStyle(e).zIndex,10);return Number.isFinite(n)?n:9}function h(e){let t=e.parentElement??document.body;return Array.from(t.querySelectorAll(`.sticky-note-container`)).reduce((e,t)=>Math.max(e,m(t)),9)+1}function g({x:l,y:d,nodeKey:m,color:g,caption:_,width:v,height:y,extraFontFamilies:b,layer:x=0}){let[S]=e.oi(),C=r.t(),w=n.c(),T=b??w,[E,D]=(0,a.useState)(null),O=(0,a.useRef)(null),k=(0,a.useRef)(null),A=(0,a.useRef)({hasMoved:!1,isDragging:!1,pointerId:null,positioningFrameRect:null,startLocalX:0,startLocalY:0,startX:0,startY:0,x:0,y:0}),j=(0,a.useRef)({hasMoved:!1,height:y,isResizing:!1,pointerId:null,startClientX:0,startClientY:0,startHeight:y,startWidth:v,width:v}),M=(0,a.useCallback)(()=>{if(!C){let e=O.current;e!==null&&D(h(e));return}S.update(()=>{e.pt(e.ft),e.En(null);let t=e.Ht(m);n.n(t)&&t.bringToFront()})},[S,C,m]);(0,a.useEffect)(()=>{C&&D(null)},[C,x]),(0,a.useEffect)(()=>_.registerUpdateListener(()=>{S.update(()=>{let t=e.Ht(m);n.n(t)&&t.markCaptionChanged()})}),[_,S,m]),(0,a.useLayoutEffect)(()=>{let e=A.current;e.x=l,e.y=d;let t=O.current;t!==null&&u(t,e)},[l,d]),(0,a.useEffect)(()=>{let e=j.current;e.width=v,e.height=y},[v,y]);let N=(0,a.useCallback)(()=>{let e=p(S),t=A.current;return e!==null&&(t.positioningFrameRect=e.getBoundingClientRect()),t.positioningFrameRect},[S]),P=(t,r)=>{S.update(()=>{let i=e.Ht(m);n.n(i)&&i.setSize(t,r)})},F=(e,t)=>{let n=O.current,r=k.current,i=A.current;if(n===null||r===null)return null;let a=f(n,r,i,e,t),o=j.current;return r.style.width=`${a.width}px`,r.style.height=`${a.height}px`,o.width=a.width,o.height=a.height,u(n,i),a};(0,a.useLayoutEffect)(()=>{let e=A.current,t=null,n=new ResizeObserver(t=>{for(let n=0;n<t.length;n++){let{target:r}=t[n];e.positioningFrameRect=r.getBoundingClientRect();let i=O.current;i!==null&&u(i,e)}}),r=()=>{t!==null&&n.unobserve(t);let r=p(S);t=r,r===null?e.positioningFrameRect=null:(e.positioningFrameRect=r.getBoundingClientRect(),n.observe(r));let i=O.current;i!==null&&u(i,e)},i=S.registerRootListener(e=>{if(e!==null){r();return}t!==null&&(n.unobserve(t),t=null)}),a=()=>{let t=S.getRootElement(),n=O.current;t!==null&&n!==null&&(N(),u(n,e))};return window.addEventListener(`resize`,a),()=>{window.removeEventListener(`resize`,a),i()}},[S,N]),(0,a.useEffect)(()=>{let e=O.current;e!==null&&setTimeout(()=>{e.style.setProperty(`transition`,`top 0.3s ease 0s, left 0.3s ease 0s`)},500)},[]);let I=e=>{let n=O.current,r=A.current,i=r.positioningFrameRect,a=t.r(n);if(r.pointerId===e.pointerId&&n!==null&&r.isDragging&&i!==null){let t=e.clientX-r.startX,i=e.clientY-r.startY;if(!r.hasMoved){if(Math.abs(t)+Math.abs(i)<c)return;r.hasMoved=!0,n.classList.add(`dragging`)}r.x=r.startLocalX+t/a,r.y=r.startLocalY+i/a,u(n,r),e.preventDefault()}},L=t=>{let r=O.current,i=A.current;i.pointerId===t.pointerId&&(r!==null&&(i.isDragging=!1,i.pointerId=null,i.hasMoved=!1,r.classList.remove(`dragging`),S.update(()=>{let t=e.Ht(m);n.n(t)&&t.setPosition(i.x,i.y)})),t.preventDefault(),document.removeEventListener(`pointermove`,I),document.removeEventListener(`pointerup`,L),document.removeEventListener(`pointercancel`,L))},R=e=>{let n=O.current,r=k.current,i=j.current,a=t.r(r);if(i.pointerId===e.pointerId&&n!==null&&r!==null&&i.isResizing){let t=e.clientX-i.startClientX,n=e.clientY-i.startClientY;if(!i.hasMoved){if(Math.abs(t)+Math.abs(n)<c)return;i.hasMoved=!0,r.classList.add(`resizing`)}F(i.startWidth+t/a,i.startHeight+n/a),e.preventDefault()}},z=()=>{let e=j.current,t=F(e.width*1.12,e.height*1.12);t!==null&&P(t.width,t.height)},B=e=>{let t=k.current,n=j.current;if(n.pointerId!==e.pointerId)return;let r=n.hasMoved;if(t!==null&&(n.isResizing=!1,n.pointerId=null,n.hasMoved=!1,t.classList.remove(`resizing`)),e.preventDefault(),document.removeEventListener(`pointermove`,R),document.removeEventListener(`pointerup`,B),document.removeEventListener(`pointercancel`,B),!r){z();return}P(n.width,n.height)},V=()=>{S.update(()=>{let t=e.Ht(m);n.n(t)&&t.remove()})},H=()=>{S.update(()=>{let t=e.Ht(m);n.n(t)&&t.toggleColor()})},{historyState:U}=t.a();return(0,o.jsx)(`div`,{ref:O,className:`sticky-note-container`,style:{zIndex:E??9+x},children:(0,o.jsxs)(`div`,{ref:k,className:`sticky-note ${g}`,style:{height:y,width:v,fontFamily:[`"Indie Flower"`,...T,`cursive`].join(`, `)},onFocus:M,onPointerDownCapture:M,onPointerDown:e=>{let t=O.current;if(t==null||e.button===2||e.target!==t.firstChild)return;let n=t,r=A.current;n!==null&&(N(),r.startLocalX=r.x,r.startLocalY=r.y,r.pointerId=e.pointerId,r.startX=e.clientX,r.startY=e.clientY,r.hasMoved=!1,r.isDragging=!0,document.addEventListener(`pointermove`,I),document.addEventListener(`pointerup`,L),document.addEventListener(`pointercancel`,L),e.preventDefault())},children:[(0,o.jsxs)(`div`,{className:`top-right-buttons`,children:[(0,o.jsx)(`button`,{onClick:H,"aria-label":`Change sticky note color`,title:`Color`,children:(0,o.jsx)(`i`,{className:`bi bi-paint-bucket`})}),(0,o.jsx)(`button`,{onClick:V,"aria-label":`Delete sticky note`,title:`Delete`,children:(0,o.jsx)(`i`,{className:`bi bi-x-lg`,style:{color:`red`}})})]}),(0,o.jsx)(`button`,{className:`resize`,"aria-label":`Resize sticky note`,title:`Resize`,onPointerDown:e=>{if(k.current===null||e.button===2)return;N();let t=j.current;t.isResizing=!0,t.pointerId=e.pointerId,t.hasMoved=!1,t.startClientX=e.clientX,t.startClientY=e.clientY,t.startWidth=t.width,t.startHeight=t.height,document.addEventListener(`pointermove`,R),document.addEventListener(`pointerup`,B),document.addEventListener(`pointercancel`,B),e.preventDefault(),e.stopPropagation()},children:(0,o.jsx)(`i`,{className:`bi bi-arrow-down-right`})}),(0,o.jsxs)(i.t,{initialEditor:_,initialTheme:s,children:[(0,o.jsx)(t.o,{externalHistoryState:U}),(0,o.jsx)(n.a,{contentEditable:(0,o.jsx)(t.t,{placeholder:`What's up?`,placeholderClassName:`StickyNode__placeholder`,className:`StickyNode__contentEditable`}),ErrorBoundary:t.N})]})]})})}exports.default=g;
@@ -1,6 +1,6 @@
1
- import { A as e, Dn as t, En as n, I as r, It as i, Nr as a, Nt as o, Qr as s, Rr as c, Tr as l, V as ee, Wn as te, Xn as u, Yn as d, Zr as f, Zt as ne, ar as re, bn as p, c as m, gr as ie, ln as ae, mr as oe, n as h, oi as g, qn as se, qr as _, tt as v, ur as ce, wn as le, xn as y, xr as b, yn as x, zt as ue } from "./Lexical.prod-DYDuARMX.mjs";
2
- import { I as S, N as C, s as w } from "./LexicalUtils.prod-5zbJxaQa.mjs";
3
- import { I as de, K as fe, M as pe, _ as T, g as E, p as D, s as O, v as k } from "./ContentEditable-C_wyHFh1.mjs";
1
+ import { A as e, Dn as t, En as n, I as r, It as i, Nr as a, Nt as o, Qr as s, Rr as c, Tr as l, V as ee, Wn as te, Xn as u, Yn as d, Zr as f, Zt as ne, ar as re, bn as p, c as m, gr as ie, ln as ae, mr as oe, n as h, oi as g, qn as se, qr as _, tt as v, ur as ce, wn as le, xn as ue, xr as y, yn as b, zt as x } from "./Lexical.prod-DYDuARMX.mjs";
2
+ import { F as S, M as C, s as w } from "./LexicalUtils.prod-D2Igim2c.mjs";
3
+ import { I as de, K as fe, M as pe, _ as T, g as E, p as D, s as O, v as k } from "./ContentEditable-BaXBKC3m.mjs";
4
4
  import { t as A } from "./useLexicalEditable.prod-CgMasHPY.mjs";
5
5
  import * as j from "react";
6
6
  import { Suspense as M, createContext as N, useCallback as P, useContext as F, useEffect as I, useLayoutEffect as L, useMemo as R, useState as z } from "react";
@@ -69,7 +69,7 @@ function ye(n) {
69
69
  }
70
70
  }
71
71
  return !0;
72
- }, 0), n.registerCommand(ue, () => {
72
+ }, 0), n.registerCommand(x, () => {
73
73
  let e = v();
74
74
  return !!p(e) && (e.removeText(), !0);
75
75
  }, 0), n.registerCommand(h, (e) => {
@@ -88,10 +88,10 @@ function ye(n) {
88
88
  if (!p(t)) return !1;
89
89
  let n = e, r = n.shiftKey;
90
90
  return !!S(t, !1) && (n.preventDefault(), C(t, r, !1), !0);
91
- }, 0), n.registerCommand(a, (e) => !!p(v()) && (!u || !b) && (e.preventDefault(), n.dispatchCommand(i, !0)), 0), n.registerCommand(le, (e) => !!p(v()) && (e.preventDefault(), n.dispatchCommand(i, !1)), 0), n.registerCommand(x, (e) => {
91
+ }, 0), n.registerCommand(a, (e) => !!p(v()) && (!u || !y) && (e.preventDefault(), n.dispatchCommand(i, !0)), 0), n.registerCommand(le, (e) => !!p(v()) && (e.preventDefault(), n.dispatchCommand(i, !1)), 0), n.registerCommand(b, (e) => {
92
92
  if (!p(v())) return !1;
93
93
  if (e !== null) {
94
- if ((u || ae || y) && b) return !1;
94
+ if ((u || ae || ue) && y) return !1;
95
95
  e.preventDefault();
96
96
  }
97
97
  return n.dispatchCommand(h, !1);
@@ -167,20 +167,20 @@ function Se({ editor: e, ErrorBoundary: t }) {
167
167
  function q(e) {
168
168
  return e.read("latest", de(e.isComposing()));
169
169
  }
170
- function J({ contentEditable: e, placeholder: t = null, ErrorBoundary: n }) {
170
+ function Ce({ contentEditable: e, placeholder: t = null, ErrorBoundary: n }) {
171
171
  let [r] = g();
172
172
  return function(e) {
173
173
  K(() => d(ye(e), O(e)), [e]);
174
174
  }(r), /*#__PURE__*/ me(B, { children: [
175
175
  e,
176
- /*#__PURE__*/ V(Ce, { content: t }),
176
+ /*#__PURE__*/ V(J, { content: t }),
177
177
  /*#__PURE__*/ V(Se, {
178
178
  editor: r,
179
179
  ErrorBoundary: n
180
180
  })
181
181
  ] });
182
182
  }
183
- function Ce({ content: e }) {
183
+ function J({ content: e }) {
184
184
  let [t] = g(), n = function(e) {
185
185
  let [t, n] = z(() => q(e));
186
186
  return K(() => {
@@ -310,7 +310,7 @@ var we = {
310
310
  underlineStrikethrough: "PlaygroundEditorTheme__textUnderlineStrikethrough",
311
311
  uppercase: "PlaygroundEditorTheme__textUppercase"
312
312
  }
313
- }, Te = j.lazy(() => import("./StickyComponent-B8skHBRs.mjs"));
313
+ }, Te = j.lazy(() => import("./StickyComponent-Ce5jkV0z.mjs"));
314
314
  function Ee(e) {
315
315
  let t = e.getRootElement();
316
316
  if (t === null) return document.body;
@@ -446,4 +446,4 @@ function Ae(e, t) {
446
446
  return new $(e, t, "yellow", void 0, void 0, void 0, void 0, Oe());
447
447
  }
448
448
  //#endregion
449
- export { J as a, _e as c, we as i, ke as n, ge as o, $ as r, ve as s, Ae as t };
449
+ export { Ce as a, ve as c, we as i, _e as l, ke as n, U as o, $ as r, ge as s, Ae as t };
@@ -1 +1 @@
1
- const e=require("./rolldown-runtime-D_FWMvbo.cjs"),t=require("./Lexical.prod-C9Xekspf.cjs"),n=require("./LexicalUtils.prod-W-Xb5dGB.cjs"),r=require("./ContentEditable-DgthEFHJ.cjs"),i=require("./useLexicalEditable.prod-B2XnDcjV.cjs");let a=require("react");a=e.a(a,1);let o=require("react/jsx-runtime"),s=require("react-dom");var c=`playground-sticky-notes-hidden`,l=(0,a.createContext)({extraFontFamilies:[],showStickyNotes:!0,toggleStickyNotesVisibility:()=>{}}),u=({children:e,extraFontFamilies:t=[]})=>{let[n,r]=(0,a.useState)(!0),i=(0,a.useCallback)(()=>{r(e=>!e)},[]);(0,a.useEffect)(()=>(document.body.classList.toggle(c,!n),()=>{document.body.classList.remove(c)}),[n]);let s=(0,a.useMemo)(()=>({extraFontFamilies:t,showStickyNotes:n,toggleStickyNotesVisibility:i}),[t,n,i]);return(0,o.jsx)(l.Provider,{value:s,children:e})},d=()=>(0,a.useContext)(l),f=()=>(0,a.useContext)(l).extraFontFamilies;function p(e,i){i.update(()=>{if(e!==null){let a=n.s(e,KeyboardEvent)?null:e.clipboardData,o=t.tt();if(o!==null&&!o.isCollapsed()&&a!=null){e.preventDefault();let t=r._(i);t!==null&&a.setData(`text/html`,t),a.setData(`text/plain`,o.getTextContent())}}})}function m(e){return t.Yn(e.registerCommand(t.It,e=>{let n=t.tt();return!!t.bn(n)&&(n.deleteCharacter(e),!0)},0),e.registerCommand(t.gr,e=>{let n=t.tt();return!!t.bn(n)&&(n.deleteWord(e),!0)},0),e.registerCommand(t.Zt,e=>{let n=t.tt();return!!t.bn(n)&&(n.deleteLine(e),!0)},0),e.registerCommand(t.V,e=>{let n=t.tt();if(!t.bn(n))return!1;if(typeof e==`string`)n.insertText(e);else{let t=e.dataTransfer;if(t!=null)r.g(t,n);else{let t=e.data;t&&n.insertText(t)}}return!0},0),e.registerCommand(t.zt,()=>{let e=t.tt();return!!t.bn(e)&&(e.removeText(),!0)},0),e.registerCommand(t.n,e=>{let n=t.tt();return!!t.bn(n)&&(n.insertLineBreak(e),!0)},0),e.registerCommand(t.A,()=>{let e=t.tt();return!!t.bn(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(t.ur,e=>{let r=t.tt();if(!t.bn(r))return!1;let i=e,a=i.shiftKey;return!!n.I(r,!0)&&(i.preventDefault(),n.N(r,a,!0),!0)},0),e.registerCommand(t.Dn,e=>{let r=t.tt();if(!t.bn(r))return!1;let i=e,a=i.shiftKey;return!!n.I(r,!1)&&(i.preventDefault(),n.N(r,a,!1),!0)},0),e.registerCommand(t.Nr,n=>!!t.bn(t.tt())&&(!t.Xn||!t.xr)&&(n.preventDefault(),e.dispatchCommand(t.It,!0)),0),e.registerCommand(t.wn,n=>!!t.bn(t.tt())&&(n.preventDefault(),e.dispatchCommand(t.It,!1)),0),e.registerCommand(t.yn,n=>{if(!t.bn(t.tt()))return!1;if(n!==null){if((t.Xn||t.ln||t.xn)&&t.xr)return!1;n.preventDefault()}return e.dispatchCommand(t.n,!1)},0),e.registerCommand(t.qn,()=>{let e=t.tt();return t.Zr(t.bn(e)&&t.Tr(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(t.Rr,n=>!!t.bn(t.tt())&&(p(n,e),!0),0),e.registerCommand(t.Nt,n=>!!t.bn(t.tt())&&(function(e,n){p(e,n),n.update(()=>{let e=t.tt();t.bn(e)&&e.removeText()},{tag:`cut`})}(n,e),!0),0),e.registerCommand(t.Wn,i=>!!t.bn(t.tt())&&(function(e,i){e.preventDefault(),i.update(()=>{let i=t.tt(),a=n.s(e,ClipboardEvent)?e.clipboardData:null;a!=null&&t.bn(i)&&r.g(a,i)},{tag:`paste`})}(i,e),!0),0),e.registerCommand(t.Qr,t=>r.p(t,e),0),e.registerCommand(t.qr,n=>{let i=t.tt();return!!t.bn(i)&&(i.isCollapsed()||n.dataTransfer===null||r.v(n.dataTransfer,e),!0)},0))}function h(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.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.`)}var g=t.ar?a.useLayoutEffect:a.useEffect;function _({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,a.useState)(()=>e.getDecorators());return g(()=>e.registerDecoratorListener(e=>{(0,s.flushSync)(()=>{r(e)})}),[e]),(0,a.useEffect)(()=>{r(e.getDecorators())},[e]),(0,a.useMemo)(()=>{let r=[],i=Object.keys(n);for(let c=0;c<i.length;c++){let l=i[c],u=(0,o.jsx)(t,{onError:t=>e._onError(t),children:(0,o.jsx)(a.Suspense,{fallback:null,children:n[l]})}),d=e.getElementByKey(l);d!==null&&r.push((0,s.createPortal)(u,d,l))}return r},[t,n,e])}(e,t)}function v({editor:e,ErrorBoundary:t}){return function(e){let t=r.K.maybeFromEditor(e);if(t&&t.hasExtensionByName(r.M.name)){for(let e of[`@lexical/plain-text`,`@lexical/rich-text`])t.hasExtensionByName(e)&&h(320,e);return!0}return!1}(e)?null:(0,o.jsx)(_,{editor:e,ErrorBoundary:t})}function y(e){return e.read(`latest`,r.I(e.isComposing()))}function b({contentEditable:e,placeholder:n=null,ErrorBoundary:i}){let[a]=t.oi();return function(e){g(()=>t.Yn(m(e),r.s(e)),[e])}(a),(0,o.jsxs)(o.Fragment,{children:[e,(0,o.jsx)(x,{content:n}),(0,o.jsx)(v,{editor:a,ErrorBoundary:i})]})}function x({content:e}){let[n]=t.oi(),r=function(e){let[n,r]=(0,a.useState)(()=>y(e));return g(()=>{function n(){let t=y(e);r(t)}return n(),t.Yn(e.registerUpdateListener(()=>{n()}),e.registerEditableListener(()=>{n()}))},[e]),n}(n),o=i.t();return r?typeof e==`function`?e(o):e:null}var S={autocomplete:`PlaygroundEditorTheme__autocomplete`,blockCursor:`PlaygroundEditorTheme__blockCursor`,characterLimit:`PlaygroundEditorTheme__characterLimit`,code:`PlaygroundEditorTheme__code pt-2 my-2`,codeHighlight:{atrule:`PlaygroundEditorTheme__tokenAttr`,attr:`PlaygroundEditorTheme__tokenAttr`,boolean:`PlaygroundEditorTheme__tokenProperty`,builtin:`PlaygroundEditorTheme__tokenSelector`,cdata:`PlaygroundEditorTheme__tokenComment`,char:`PlaygroundEditorTheme__tokenSelector`,class:`PlaygroundEditorTheme__tokenFunction`,"class-name":`PlaygroundEditorTheme__tokenFunction`,comment:`PlaygroundEditorTheme__tokenComment`,constant:`PlaygroundEditorTheme__tokenProperty`,deleted:`PlaygroundEditorTheme__tokenDeleted`,doctype:`PlaygroundEditorTheme__tokenComment`,entity:`PlaygroundEditorTheme__tokenOperator`,function:`PlaygroundEditorTheme__tokenFunction`,important:`PlaygroundEditorTheme__tokenVariable`,inserted:`PlaygroundEditorTheme__tokenInserted`,keyword:`PlaygroundEditorTheme__tokenAttr`,namespace:`PlaygroundEditorTheme__tokenVariable`,number:`PlaygroundEditorTheme__tokenProperty`,operator:`PlaygroundEditorTheme__tokenOperator`,prolog:`PlaygroundEditorTheme__tokenComment`,property:`PlaygroundEditorTheme__tokenProperty`,punctuation:`PlaygroundEditorTheme__tokenPunctuation`,regex:`PlaygroundEditorTheme__tokenVariable`,selector:`PlaygroundEditorTheme__tokenSelector`,string:`PlaygroundEditorTheme__tokenSelector`,symbol:`PlaygroundEditorTheme__tokenProperty`,tag:`PlaygroundEditorTheme__tokenProperty`,unchanged:`PlaygroundEditorTheme__tokenUnchanged`,url:`PlaygroundEditorTheme__tokenOperator`,variable:`PlaygroundEditorTheme__tokenVariable`},embedBlock:{base:`PlaygroundEditorTheme__embedBlock`,focus:`PlaygroundEditorTheme__embedBlockFocus`},heading:{h1:`PlaygroundEditorTheme__h1`,h2:`PlaygroundEditorTheme__h2`,h3:`PlaygroundEditorTheme__h3`,h4:`PlaygroundEditorTheme__h4`,h5:`PlaygroundEditorTheme__h5`,h6:`PlaygroundEditorTheme__h6`},hr:`PlaygroundEditorTheme__hr my-3`,hrSelected:`PlaygroundEditorTheme__hrSelected`,image:`editor-media`,indent:`PlaygroundEditorTheme__indent`,layoutContainer:`PlaygroundEditorTheme__layoutContainer my-2`,layoutItem:`PlaygroundEditorTheme__layoutItem py-2 px-3`,link:`PlaygroundEditorTheme__link`,list:{checklist:`PlaygroundEditorTheme__checklist`,listitem:`PlaygroundEditorTheme__listItem`,listitemChecked:`PlaygroundEditorTheme__listItemChecked`,listitemUnchecked:`PlaygroundEditorTheme__listItemUnchecked`,nested:{listitem:`PlaygroundEditorTheme__nestedListItem`},olDepth:[`PlaygroundEditorTheme__ol1`,`PlaygroundEditorTheme__ol2`,`PlaygroundEditorTheme__ol3`,`PlaygroundEditorTheme__ol4`,`PlaygroundEditorTheme__ol5`],ul:`PlaygroundEditorTheme__ul`},mark:`PlaygroundEditorTheme__mark`,markOverlap:`PlaygroundEditorTheme__markOverlap`,paragraph:`PlaygroundEditorTheme__paragraph`,quote:`PlaygroundEditorTheme__quote`,specialText:`PlaygroundEditorTheme__specialText`,tab:`PlaygroundEditorTheme__tabNode`,table:`PlaygroundEditorTheme__table my-4`,tableAddColumns:`PlaygroundEditorTheme__tableAddColumns`,tableAddRows:`PlaygroundEditorTheme__tableAddRows`,tableAlignment:{center:`PlaygroundEditorTheme__tableAlignmentCenter`,right:`PlaygroundEditorTheme__tableAlignmentRight`},tableCell:`PlaygroundEditorTheme__tableCell`,tableCellActionButton:`PlaygroundEditorTheme__tableCellActionButton`,tableCellActionButtonContainer:`PlaygroundEditorTheme__tableCellActionButtonContainer`,tableCellHeader:`PlaygroundEditorTheme__tableCellHeader`,tableCellResizer:`PlaygroundEditorTheme__tableCellResizer`,tableCellSelected:`PlaygroundEditorTheme__tableCellSelected`,tableFrozenColumn:`PlaygroundEditorTheme__tableFrozenColumn`,tableFrozenRow:`PlaygroundEditorTheme__tableFrozenRow`,tableRowStriping:`PlaygroundEditorTheme__tableRowStriping`,tableScrollableWrapper:`PlaygroundEditorTheme__tableScrollableWrapper me-4 mb-4`,tableSelected:`PlaygroundEditorTheme__tableSelected`,tableSelection:`PlaygroundEditorTheme__tableSelection`,text:{bold:`PlaygroundEditorTheme__textBold`,capitalize:`PlaygroundEditorTheme__textCapitalize`,code:`PlaygroundEditorTheme__textCode`,highlight:`PlaygroundEditorTheme__textHighlight`,italic:`PlaygroundEditorTheme__textItalic`,lowercase:`PlaygroundEditorTheme__textLowercase`,strikethrough:`PlaygroundEditorTheme__textStrikethrough`,subscript:`PlaygroundEditorTheme__textSubscript`,superscript:`PlaygroundEditorTheme__textSuperscript`,underline:`PlaygroundEditorTheme__textUnderline`,underlineStrikethrough:`PlaygroundEditorTheme__textUnderlineStrikethrough`,uppercase:`PlaygroundEditorTheme__textUppercase`}},C=a.lazy(()=>Promise.resolve().then(()=>require("./StickyComponent-C6xBrvrK.cjs")));function w(e){let t=e.getRootElement();if(t===null)return document.body;let n=t.closest(`.editor-scroller`);if(n!==null)return n;let r=t;for(;r.parentElement!==null&&r.parentElement!==document.body;)r=r.parentElement;return r}var T=[`yellow`,`pink`,`blue`,`mint`,`lavender`,`peach`,`sage`];function E(e,t,n){return typeof e==`number`&&Number.isFinite(e)?Math.max(t,e):n}function D(e){return T[(T.indexOf(e)+1)%T.length]}function O(e){return typeof e==`number`&&Number.isFinite(e)?Math.round(e):0}function k(){let e=t.c(j).filter(e=>e.isAttached());return e.length===0?0:Math.max(...e.map(e=>e.__layer))+1}function A(e,t){return e.__layer-t.__layer||e.getIndexWithinParent()-t.getIndexWithinParent()}var j=class e extends t.I{__x;__y;__width;__height;__layer;__color;__caption;static getType(){return`sticky`}static clone(t){return new e(t.__x,t.__y,t.__color,t.__caption,t.__key,t.__width,t.__height,t.__layer)}static importJSON(t){return new e(t.xOffset,t.yOffset,t.color,void 0,void 0,t.width,t.height,t.layer).updateFromJSON(t)}updateFromJSON(e){let t=super.updateFromJSON(e);t.__width=E(e.width,120,120),t.__height=E(e.height,80,80),t.__layer=O(e.layer);let n=e.caption,r=t.__caption,i=r.parseEditorState(n.editorState);return i.isEmpty()||r.setEditorState(i),t}constructor(e,n,r,i,a,o,s,c){super(a),this.__x=e,this.__y=n,this.__width=E(o,120,120),this.__height=E(s,80,80),this.__caption=i||t.mr(),this.__color=r,this.__layer=O(c)}exportJSON(){return{...super.exportJSON(),caption:this.__caption.toJSON(),color:this.__color,height:this.__height,layer:this.__layer,width:this.__width,xOffset:this.__x,yOffset:this.__y}}createDOM(e){let t=document.createElement(`div`);return t.style.display=`contents`,t}updateDOM(){return!1}setPosition(e,n){let r=this.getWritable();r.__x=e,r.__y=n,t.En(null)}setSize(e,n){let r=this.getWritable();r.__width=E(e,120,120),r.__height=E(n,80,80),t.En(null)}toggleColor(){let e=this.getWritable();e.__color=D(e.__color)}markCaptionChanged(){let e=this.getWritable();e.__caption=this.__caption}bringToFront(){let n=t.c(e).filter(e=>e.isAttached());n.length<2||([...n.filter(e=>!e.is(this)).sort(A),this].forEach((e,t)=>{e.getWritable().__layer=t}),t.En(null))}sendToBack(){let n=t.c(e).filter(e=>e.isAttached());if(n.length<2)return;let r=n.filter(e=>!e.is(this)).sort(A);[this,...r].forEach((e,t)=>{e.getWritable().__layer=t}),t.En(null)}decorate(e,t){return(0,s.createPortal)((0,o.jsx)(C,{color:this.__color,height:this.__height,layer:this.__layer,x:this.__x,y:this.__y,width:this.__width,nodeKey:this.getKey(),caption:this.__caption}),w(e))}isIsolated(){return!0}isInline(){return!1}};function M(e){return e instanceof j}function N(e,t){return new j(e,t,`yellow`,void 0,void 0,void 0,void 0,k())}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return N}});
1
+ const e=require("./rolldown-runtime-D_FWMvbo.cjs"),t=require("./Lexical.prod-C9Xekspf.cjs"),n=require("./LexicalUtils.prod-CYv8J7Gq.cjs"),r=require("./ContentEditable-Ce294XLd.cjs"),i=require("./useLexicalEditable.prod-B2XnDcjV.cjs");let a=require("react");a=e.a(a,1);let o=require("react/jsx-runtime"),s=require("react-dom");var c=`playground-sticky-notes-hidden`,l=(0,a.createContext)({extraFontFamilies:[],showStickyNotes:!0,toggleStickyNotesVisibility:()=>{}}),u=({children:e,extraFontFamilies:t=[]})=>{let[n,r]=(0,a.useState)(!0),i=(0,a.useCallback)(()=>{r(e=>!e)},[]);(0,a.useEffect)(()=>(document.body.classList.toggle(c,!n),()=>{document.body.classList.remove(c)}),[n]);let s=(0,a.useMemo)(()=>({extraFontFamilies:t,showStickyNotes:n,toggleStickyNotesVisibility:i}),[t,n,i]);return(0,o.jsx)(l.Provider,{value:s,children:e})},d=()=>(0,a.useContext)(l),f=()=>(0,a.useContext)(l).extraFontFamilies;function p(e,i){i.update(()=>{if(e!==null){let a=n.s(e,KeyboardEvent)?null:e.clipboardData,o=t.tt();if(o!==null&&!o.isCollapsed()&&a!=null){e.preventDefault();let t=r._(i);t!==null&&a.setData(`text/html`,t),a.setData(`text/plain`,o.getTextContent())}}})}function m(e){return t.Yn(e.registerCommand(t.It,e=>{let n=t.tt();return!!t.bn(n)&&(n.deleteCharacter(e),!0)},0),e.registerCommand(t.gr,e=>{let n=t.tt();return!!t.bn(n)&&(n.deleteWord(e),!0)},0),e.registerCommand(t.Zt,e=>{let n=t.tt();return!!t.bn(n)&&(n.deleteLine(e),!0)},0),e.registerCommand(t.V,e=>{let n=t.tt();if(!t.bn(n))return!1;if(typeof e==`string`)n.insertText(e);else{let t=e.dataTransfer;if(t!=null)r.g(t,n);else{let t=e.data;t&&n.insertText(t)}}return!0},0),e.registerCommand(t.zt,()=>{let e=t.tt();return!!t.bn(e)&&(e.removeText(),!0)},0),e.registerCommand(t.n,e=>{let n=t.tt();return!!t.bn(n)&&(n.insertLineBreak(e),!0)},0),e.registerCommand(t.A,()=>{let e=t.tt();return!!t.bn(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(t.ur,e=>{let r=t.tt();if(!t.bn(r))return!1;let i=e,a=i.shiftKey;return!!n.F(r,!0)&&(i.preventDefault(),n.M(r,a,!0),!0)},0),e.registerCommand(t.Dn,e=>{let r=t.tt();if(!t.bn(r))return!1;let i=e,a=i.shiftKey;return!!n.F(r,!1)&&(i.preventDefault(),n.M(r,a,!1),!0)},0),e.registerCommand(t.Nr,n=>!!t.bn(t.tt())&&(!t.Xn||!t.xr)&&(n.preventDefault(),e.dispatchCommand(t.It,!0)),0),e.registerCommand(t.wn,n=>!!t.bn(t.tt())&&(n.preventDefault(),e.dispatchCommand(t.It,!1)),0),e.registerCommand(t.yn,n=>{if(!t.bn(t.tt()))return!1;if(n!==null){if((t.Xn||t.ln||t.xn)&&t.xr)return!1;n.preventDefault()}return e.dispatchCommand(t.n,!1)},0),e.registerCommand(t.qn,()=>{let e=t.tt();return t.Zr(t.bn(e)&&t.Tr(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(t.Rr,n=>!!t.bn(t.tt())&&(p(n,e),!0),0),e.registerCommand(t.Nt,n=>!!t.bn(t.tt())&&(function(e,n){p(e,n),n.update(()=>{let e=t.tt();t.bn(e)&&e.removeText()},{tag:`cut`})}(n,e),!0),0),e.registerCommand(t.Wn,i=>!!t.bn(t.tt())&&(function(e,i){e.preventDefault(),i.update(()=>{let i=t.tt(),a=n.s(e,ClipboardEvent)?e.clipboardData:null;a!=null&&t.bn(i)&&r.g(a,i)},{tag:`paste`})}(i,e),!0),0),e.registerCommand(t.Qr,t=>r.p(t,e),0),e.registerCommand(t.qr,n=>{let i=t.tt();return!!t.bn(i)&&(i.isCollapsed()||n.dataTransfer===null||r.v(n.dataTransfer,e),!0)},0))}function h(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.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.`)}var g=t.ar?a.useLayoutEffect:a.useEffect;function _({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,a.useState)(()=>e.getDecorators());return g(()=>e.registerDecoratorListener(e=>{(0,s.flushSync)(()=>{r(e)})}),[e]),(0,a.useEffect)(()=>{r(e.getDecorators())},[e]),(0,a.useMemo)(()=>{let r=[],i=Object.keys(n);for(let c=0;c<i.length;c++){let l=i[c],u=(0,o.jsx)(t,{onError:t=>e._onError(t),children:(0,o.jsx)(a.Suspense,{fallback:null,children:n[l]})}),d=e.getElementByKey(l);d!==null&&r.push((0,s.createPortal)(u,d,l))}return r},[t,n,e])}(e,t)}function v({editor:e,ErrorBoundary:t}){return function(e){let t=r.K.maybeFromEditor(e);if(t&&t.hasExtensionByName(r.M.name)){for(let e of[`@lexical/plain-text`,`@lexical/rich-text`])t.hasExtensionByName(e)&&h(320,e);return!0}return!1}(e)?null:(0,o.jsx)(_,{editor:e,ErrorBoundary:t})}function y(e){return e.read(`latest`,r.I(e.isComposing()))}function b({contentEditable:e,placeholder:n=null,ErrorBoundary:i}){let[a]=t.oi();return function(e){g(()=>t.Yn(m(e),r.s(e)),[e])}(a),(0,o.jsxs)(o.Fragment,{children:[e,(0,o.jsx)(x,{content:n}),(0,o.jsx)(v,{editor:a,ErrorBoundary:i})]})}function x({content:e}){let[n]=t.oi(),r=function(e){let[n,r]=(0,a.useState)(()=>y(e));return g(()=>{function n(){let t=y(e);r(t)}return n(),t.Yn(e.registerUpdateListener(()=>{n()}),e.registerEditableListener(()=>{n()}))},[e]),n}(n),o=i.t();return r?typeof e==`function`?e(o):e:null}var S={autocomplete:`PlaygroundEditorTheme__autocomplete`,blockCursor:`PlaygroundEditorTheme__blockCursor`,characterLimit:`PlaygroundEditorTheme__characterLimit`,code:`PlaygroundEditorTheme__code pt-2 my-2`,codeHighlight:{atrule:`PlaygroundEditorTheme__tokenAttr`,attr:`PlaygroundEditorTheme__tokenAttr`,boolean:`PlaygroundEditorTheme__tokenProperty`,builtin:`PlaygroundEditorTheme__tokenSelector`,cdata:`PlaygroundEditorTheme__tokenComment`,char:`PlaygroundEditorTheme__tokenSelector`,class:`PlaygroundEditorTheme__tokenFunction`,"class-name":`PlaygroundEditorTheme__tokenFunction`,comment:`PlaygroundEditorTheme__tokenComment`,constant:`PlaygroundEditorTheme__tokenProperty`,deleted:`PlaygroundEditorTheme__tokenDeleted`,doctype:`PlaygroundEditorTheme__tokenComment`,entity:`PlaygroundEditorTheme__tokenOperator`,function:`PlaygroundEditorTheme__tokenFunction`,important:`PlaygroundEditorTheme__tokenVariable`,inserted:`PlaygroundEditorTheme__tokenInserted`,keyword:`PlaygroundEditorTheme__tokenAttr`,namespace:`PlaygroundEditorTheme__tokenVariable`,number:`PlaygroundEditorTheme__tokenProperty`,operator:`PlaygroundEditorTheme__tokenOperator`,prolog:`PlaygroundEditorTheme__tokenComment`,property:`PlaygroundEditorTheme__tokenProperty`,punctuation:`PlaygroundEditorTheme__tokenPunctuation`,regex:`PlaygroundEditorTheme__tokenVariable`,selector:`PlaygroundEditorTheme__tokenSelector`,string:`PlaygroundEditorTheme__tokenSelector`,symbol:`PlaygroundEditorTheme__tokenProperty`,tag:`PlaygroundEditorTheme__tokenProperty`,unchanged:`PlaygroundEditorTheme__tokenUnchanged`,url:`PlaygroundEditorTheme__tokenOperator`,variable:`PlaygroundEditorTheme__tokenVariable`},embedBlock:{base:`PlaygroundEditorTheme__embedBlock`,focus:`PlaygroundEditorTheme__embedBlockFocus`},heading:{h1:`PlaygroundEditorTheme__h1`,h2:`PlaygroundEditorTheme__h2`,h3:`PlaygroundEditorTheme__h3`,h4:`PlaygroundEditorTheme__h4`,h5:`PlaygroundEditorTheme__h5`,h6:`PlaygroundEditorTheme__h6`},hr:`PlaygroundEditorTheme__hr my-3`,hrSelected:`PlaygroundEditorTheme__hrSelected`,image:`editor-media`,indent:`PlaygroundEditorTheme__indent`,layoutContainer:`PlaygroundEditorTheme__layoutContainer my-2`,layoutItem:`PlaygroundEditorTheme__layoutItem py-2 px-3`,link:`PlaygroundEditorTheme__link`,list:{checklist:`PlaygroundEditorTheme__checklist`,listitem:`PlaygroundEditorTheme__listItem`,listitemChecked:`PlaygroundEditorTheme__listItemChecked`,listitemUnchecked:`PlaygroundEditorTheme__listItemUnchecked`,nested:{listitem:`PlaygroundEditorTheme__nestedListItem`},olDepth:[`PlaygroundEditorTheme__ol1`,`PlaygroundEditorTheme__ol2`,`PlaygroundEditorTheme__ol3`,`PlaygroundEditorTheme__ol4`,`PlaygroundEditorTheme__ol5`],ul:`PlaygroundEditorTheme__ul`},mark:`PlaygroundEditorTheme__mark`,markOverlap:`PlaygroundEditorTheme__markOverlap`,paragraph:`PlaygroundEditorTheme__paragraph`,quote:`PlaygroundEditorTheme__quote`,specialText:`PlaygroundEditorTheme__specialText`,tab:`PlaygroundEditorTheme__tabNode`,table:`PlaygroundEditorTheme__table my-4`,tableAddColumns:`PlaygroundEditorTheme__tableAddColumns`,tableAddRows:`PlaygroundEditorTheme__tableAddRows`,tableAlignment:{center:`PlaygroundEditorTheme__tableAlignmentCenter`,right:`PlaygroundEditorTheme__tableAlignmentRight`},tableCell:`PlaygroundEditorTheme__tableCell`,tableCellActionButton:`PlaygroundEditorTheme__tableCellActionButton`,tableCellActionButtonContainer:`PlaygroundEditorTheme__tableCellActionButtonContainer`,tableCellHeader:`PlaygroundEditorTheme__tableCellHeader`,tableCellResizer:`PlaygroundEditorTheme__tableCellResizer`,tableCellSelected:`PlaygroundEditorTheme__tableCellSelected`,tableFrozenColumn:`PlaygroundEditorTheme__tableFrozenColumn`,tableFrozenRow:`PlaygroundEditorTheme__tableFrozenRow`,tableRowStriping:`PlaygroundEditorTheme__tableRowStriping`,tableScrollableWrapper:`PlaygroundEditorTheme__tableScrollableWrapper me-4 mb-4`,tableSelected:`PlaygroundEditorTheme__tableSelected`,tableSelection:`PlaygroundEditorTheme__tableSelection`,text:{bold:`PlaygroundEditorTheme__textBold`,capitalize:`PlaygroundEditorTheme__textCapitalize`,code:`PlaygroundEditorTheme__textCode`,highlight:`PlaygroundEditorTheme__textHighlight`,italic:`PlaygroundEditorTheme__textItalic`,lowercase:`PlaygroundEditorTheme__textLowercase`,strikethrough:`PlaygroundEditorTheme__textStrikethrough`,subscript:`PlaygroundEditorTheme__textSubscript`,superscript:`PlaygroundEditorTheme__textSuperscript`,underline:`PlaygroundEditorTheme__textUnderline`,underlineStrikethrough:`PlaygroundEditorTheme__textUnderlineStrikethrough`,uppercase:`PlaygroundEditorTheme__textUppercase`}},C=a.lazy(()=>Promise.resolve().then(()=>require("./StickyComponent-CoU6Bu8d.cjs")));function w(e){let t=e.getRootElement();if(t===null)return document.body;let n=t.closest(`.editor-scroller`);if(n!==null)return n;let r=t;for(;r.parentElement!==null&&r.parentElement!==document.body;)r=r.parentElement;return r}var T=[`yellow`,`pink`,`blue`,`mint`,`lavender`,`peach`,`sage`];function E(e,t,n){return typeof e==`number`&&Number.isFinite(e)?Math.max(t,e):n}function D(e){return T[(T.indexOf(e)+1)%T.length]}function O(e){return typeof e==`number`&&Number.isFinite(e)?Math.round(e):0}function k(){let e=t.c(j).filter(e=>e.isAttached());return e.length===0?0:Math.max(...e.map(e=>e.__layer))+1}function A(e,t){return e.__layer-t.__layer||e.getIndexWithinParent()-t.getIndexWithinParent()}var j=class e extends t.I{__x;__y;__width;__height;__layer;__color;__caption;static getType(){return`sticky`}static clone(t){return new e(t.__x,t.__y,t.__color,t.__caption,t.__key,t.__width,t.__height,t.__layer)}static importJSON(t){return new e(t.xOffset,t.yOffset,t.color,void 0,void 0,t.width,t.height,t.layer).updateFromJSON(t)}updateFromJSON(e){let t=super.updateFromJSON(e);t.__width=E(e.width,120,120),t.__height=E(e.height,80,80),t.__layer=O(e.layer);let n=e.caption,r=t.__caption,i=r.parseEditorState(n.editorState);return i.isEmpty()||r.setEditorState(i),t}constructor(e,n,r,i,a,o,s,c){super(a),this.__x=e,this.__y=n,this.__width=E(o,120,120),this.__height=E(s,80,80),this.__caption=i||t.mr(),this.__color=r,this.__layer=O(c)}exportJSON(){return{...super.exportJSON(),caption:this.__caption.toJSON(),color:this.__color,height:this.__height,layer:this.__layer,width:this.__width,xOffset:this.__x,yOffset:this.__y}}createDOM(e){let t=document.createElement(`div`);return t.style.display=`contents`,t}updateDOM(){return!1}setPosition(e,n){let r=this.getWritable();r.__x=e,r.__y=n,t.En(null)}setSize(e,n){let r=this.getWritable();r.__width=E(e,120,120),r.__height=E(n,80,80),t.En(null)}toggleColor(){let e=this.getWritable();e.__color=D(e.__color)}markCaptionChanged(){let e=this.getWritable();e.__caption=this.__caption}bringToFront(){let n=t.c(e).filter(e=>e.isAttached());n.length<2||([...n.filter(e=>!e.is(this)).sort(A),this].forEach((e,t)=>{e.getWritable().__layer=t}),t.En(null))}sendToBack(){let n=t.c(e).filter(e=>e.isAttached());if(n.length<2)return;let r=n.filter(e=>!e.is(this)).sort(A);[this,...r].forEach((e,t)=>{e.getWritable().__layer=t}),t.En(null)}decorate(e,t){return(0,s.createPortal)((0,o.jsx)(C,{color:this.__color,height:this.__height,layer:this.__layer,x:this.__x,y:this.__y,width:this.__width,nodeKey:this.getKey(),caption:this.__caption}),w(e))}isIsolated(){return!0}isInline(){return!1}};function M(e){return e instanceof j}function N(e,t){return new j(e,t,`yellow`,void 0,void 0,void 0,void 0,k())}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return N}});