@solibo/solibo-ui 2.1.0 → 2.1.2

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 (72) hide show
  1. package/README.md +4 -4
  2. package/dist/assets/index.css +1 -1
  3. package/dist/assets/index12.css +1 -1
  4. package/dist/assets/index14.css +1 -1
  5. package/dist/assets/index29.css +1 -1
  6. package/dist/assets/index31.css +1 -1
  7. package/dist/assets/index41.css +1 -1
  8. package/dist/assets/index44.css +1 -1
  9. package/dist/assets/index45.css +1 -1
  10. package/dist/assets/index53.css +1 -1
  11. package/dist/assets/menu-popover.css +1 -1
  12. package/dist/components/banner/index.cjs +1 -1
  13. package/dist/components/banner/index.js +12 -12
  14. package/dist/components/button/index.cjs +1 -1
  15. package/dist/components/button/index.js +29 -29
  16. package/dist/components/checkbox/index.cjs +1 -1
  17. package/dist/components/checkbox/index.js +1 -1
  18. package/dist/components/controls/index.cjs +1 -1
  19. package/dist/components/controls/index.js +1 -1
  20. package/dist/components/dropdown/index.cjs +1 -1
  21. package/dist/components/dropdown/index.js +60 -60
  22. package/dist/components/editor/index.cjs +2 -2
  23. package/dist/components/editor/index.cjs.map +1 -1
  24. package/dist/components/editor/index.js +5 -4
  25. package/dist/components/editor/index.js.map +1 -1
  26. package/dist/components/empty-state/index.cjs +1 -1
  27. package/dist/components/empty-state/index.js +13 -13
  28. package/dist/components/fieldset/index.cjs +1 -1
  29. package/dist/components/fieldset/index.js +4 -4
  30. package/dist/components/icon/index.cjs +1 -1
  31. package/dist/components/icon/index.js +1 -1
  32. package/dist/components/input/index.cjs +1 -1
  33. package/dist/components/input/index.js +2 -2
  34. package/dist/components/menu/index.cjs +1 -1
  35. package/dist/components/menu/index.js +1 -1
  36. package/dist/components/messages/index.cjs +1 -1
  37. package/dist/components/messages/index.js +13 -13
  38. package/dist/components/nav/index.cjs +1 -1
  39. package/dist/components/nav/index.js +1 -1
  40. package/dist/components/object/index.cjs +1 -1
  41. package/dist/components/object/index.js +1 -1
  42. package/dist/components/popover/index.cjs +1 -1
  43. package/dist/components/popover/index.js +36 -36
  44. package/dist/components/search/index.cjs +1 -1
  45. package/dist/components/search/index.js +1 -1
  46. package/dist/components/select/index.cjs +1 -1
  47. package/dist/components/select/index.js +2 -2
  48. package/dist/icons-B3hIY9Bm.cjs +2 -0
  49. package/dist/icons-B3hIY9Bm.cjs.map +1 -0
  50. package/dist/{icons-CBbpxsJF.js → icons-CTtWkF6z.js} +18 -7
  51. package/dist/icons-CTtWkF6z.js.map +1 -0
  52. package/dist/{index-BuSfz4qx.js → index-BIpgkB-u.js} +2 -2
  53. package/dist/{index-BuSfz4qx.js.map → index-BIpgkB-u.js.map} +1 -1
  54. package/dist/{index-CeHwRKAg.cjs → index-Bbauu1No.cjs} +2 -2
  55. package/dist/{index-CeHwRKAg.cjs.map → index-Bbauu1No.cjs.map} +1 -1
  56. package/dist/{index-DBWgRXp9.js → index-CMPTHneU.js} +2 -2
  57. package/dist/{index-DBWgRXp9.js.map → index-CMPTHneU.js.map} +1 -1
  58. package/dist/{index-5qUTKX7P.cjs → index-DAjU2bTe.cjs} +2 -2
  59. package/dist/{index-5qUTKX7P.cjs.map → index-DAjU2bTe.cjs.map} +1 -1
  60. package/dist/index.cjs +1 -1
  61. package/dist/index.d.ts +11 -0
  62. package/dist/index.js +2 -2
  63. package/dist/{menu-popover-D-Ax5zzy.js → menu-popover-BV7nUXlb.js} +20 -20
  64. package/dist/{menu-popover-D-Ax5zzy.js.map → menu-popover-BV7nUXlb.js.map} +1 -1
  65. package/dist/menu-popover-fGpFDJTo.cjs +2 -0
  66. package/dist/{menu-popover-CdhAgSQb.cjs.map → menu-popover-fGpFDJTo.cjs.map} +1 -1
  67. package/dist/tokens.json +1 -1
  68. package/package.json +2 -1
  69. package/dist/icons-BTif0nDb.cjs +0 -2
  70. package/dist/icons-BTif0nDb.cjs.map +0 -1
  71. package/dist/icons-CBbpxsJF.js.map +0 -1
  72. package/dist/menu-popover-CdhAgSQb.cjs +0 -2
@@ -1,4 +1,4 @@
1
- "use strict";require('../../assets/index43.css');var nm=Object.defineProperty;var rm=(n,e,t)=>e in n?nm(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var M=(n,e,t)=>rm(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("react/jsx-runtime"),q=require("react"),Wd=require("react-dom"),hi=require("../../classix-5H4IWnMA.cjs"),im=require("../file/index.cjs"),yt=require("../button/index.cjs"),Lt=require("../icon/index.cjs"),oc=require("../../index-CeHwRKAg.cjs"),sm=require("../toolbar/index.cjs");function Hu(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);return t.search=r.toString(),new Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function P(n,...e){throw Hu(n,...e)}function Ga(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);t.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function om(){return typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0}const It=om();function um(){return It&&"documentMode"in document?document.documentMode:null}const am=um();function lm(n){return It&&n.test(navigator.platform)}function Hi(n){return It&&n.test(navigator.userAgent)}const Vn=lm(/Mac|iPod|iPhone|iPad/),rn=Hi(/^(?!.*Seamonkey)(?=.*Firefox).*/i);function cm(){return!(!It||!("InputEvent"in window)||am)&&"getTargetRanges"in new window.InputEvent("input")}const Ir=cm();function fm(){return It&&!window.MSStream&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&navigator.maxTouchPoints>1)}const Ct=fm(),Hd=Hi(/Android/),Vi=Hi(/Version\/[\d.]+.*Safari/)&&!Hd,Ja=Hi(/^(?=.*Chrome).*/i),Xs=It&&Hd&&Ja,Gi=Hi(/AppleWebKit\/[\d.]+/)&&Vn&&!Ja;function dm(){return 2047}const hm=dm(),Ci=Vi||Ct||Gi?" ":"​",$n=`
1
+ "use strict";require('../../assets/index43.css');var nm=Object.defineProperty;var rm=(n,e,t)=>e in n?nm(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var M=(n,e,t)=>rm(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("react/jsx-runtime"),q=require("react"),Wd=require("react-dom"),hi=require("../../classix-5H4IWnMA.cjs"),im=require("../file/index.cjs"),yt=require("../button/index.cjs"),Lt=require("../icon/index.cjs"),oc=require("../../index-Bbauu1No.cjs"),sm=require("../toolbar/index.cjs");function Hu(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);return t.search=r.toString(),new Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function P(n,...e){throw Hu(n,...e)}function Ga(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);t.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function om(){return typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0}const It=om();function um(){return It&&"documentMode"in document?document.documentMode:null}const am=um();function lm(n){return It&&n.test(navigator.platform)}function Hi(n){return It&&n.test(navigator.userAgent)}const Vn=lm(/Mac|iPod|iPhone|iPad/),rn=Hi(/^(?!.*Seamonkey)(?=.*Firefox).*/i);function cm(){return!(!It||!("InputEvent"in window)||am)&&"getTargetRanges"in new window.InputEvent("input")}const Ir=cm();function fm(){return It&&!window.MSStream&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&navigator.maxTouchPoints>1)}const Ct=fm(),Hd=Hi(/Android/),Vi=Hi(/Version\/[\d.]+.*Safari/)&&!Hd,Ja=Hi(/^(?=.*Chrome).*/i),Xs=It&&Hd&&Ja,Gi=Hi(/AppleWebKit\/[\d.]+/)&&Vn&&!Ja;function dm(){return 2047}const hm=dm(),Ci=Vi||Ct||Gi?" ":"​",$n=`
2
2
 
3
3
  `,Xa=rn?" ":Ci,Ke={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Vd={directionless:1,unmergeable:2},Pr={center:2,end:6,justify:4,left:1,right:3,start:5};function Gd(n){const e={};for(const t of Object.keys(n))e[n[t]]=t;return e}const Jd=Gd(Pr),Ya={normal:0,segmented:2,token:1},Xd=Gd(Ya),Qa="$",gm=Symbol.for("@lexical/ctrlOrOtherKey"),du="$config";function hu(){return Pe()._blockCursorElement}function gu(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-slot")}const pm=Gi||Ct||Vi;function uc(){const n=Ie().createElement("img");n.setAttribute("data-lexical-decorator-boundary","true"),n.alt="";for(const[e,t]of[["position","absolute"],["width","0px"],["height","0px"],["border","0px"],["margin","0px"],["padding","0px"]])n.style.setProperty(e,t,"important");return n}function Ys(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-decorator-boundary")}class Sr{constructor(e,t,r){M(this,"element");M(this,"before");M(this,"after");this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new Sr(this.element,e,this.after)}withAfter(e){return new Sr(this.element,this.before,e)}withElement(e){return this.element===e?this:new Sr(e,this.before,this.after)}insertChild(e){const t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&P(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&P(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&P(359),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,r){if(this.element===e)return t===e&&r===0?"before":"after";const i=ac(e,this.element);if(i===null)return"after";const s=Array.prototype.indexOf.call(e.childNodes,i);if(s<0)return"after";if(t===e)return r<=s?"before":"after";const o=ac(e,t);if(o===null)return"after";const u=Array.prototype.indexOf.call(e.childNodes,o);return u>=0&&u<=s?"before":"after"}getInsertionAnchor(){return this.before}}function ac(n,e){let t=e;for(;t!==null&&t.parentNode!==n;)t=t.parentNode;return t}let Yd=class Ps extends Sr{withBefore(e){return new Ps(this.element,e,this.after)}withAfter(e){return new Ps(this.element,this.before,e)}withElement(e){return this.element===e?this:new Ps(e,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()||this.getDecoratorBoundaryAnchor("trailing")}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;gu(t);)e=t,t=t.nextSibling;Ys(t)&&(e=t,t=t.nextSibling);const r=e?e.nextSibling:this.element.firstChild;return r!==null&&r===hu()?r:e}getDecoratorBoundaryAnchor(e){let t;if(e==="leading"){const r=super.getFirstChildAnchor();for(t=r?r.nextSibling:this.element.firstChild;gu(t);)t=t.nextSibling}else t=this.before?this.before.previousSibling:this.element.lastChild,t!==null&&t===hu()&&(t=t.previousSibling);return Ys(t)?t:null}setDecoratorBoundaryAnchor(e,t){const r=this.getDecoratorBoundaryAnchor(e);if(t!==(r!==null))if(r!==null)this.element.removeChild(r);else if(e==="leading"){const i=this.getFirstChildAnchor();this.element.insertBefore(uc(),i?i.nextSibling:this.element.firstChild)}else this.element.insertBefore(uc(),this.before)}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){const t=this.element,r=this.after===null?t.firstChild:this.after.nextSibling,i=e==="empty"&&gu(r)?null:e;if(t.__lexicalLastChildKind!==i)if(t.__lexicalLastChildKind=i,i===null)this.removeManagedLineBreak();else{const s=i==="decorator"&&pm;this.insertManagedLineBreak(s)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&t.removeChild(r),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,i=this.before||this.getDecoratorBoundaryAnchor("trailing"),s=Ie().createElement("br");if(s.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(s,i),e){const o=Ie().createElement("img");o.setAttribute("data-lexical-managed-linebreak","true"),o.style.setProperty("display","inline","important"),o.style.setProperty("border","0px","important"),o.style.setProperty("margin","0px","important"),o.alt="",r.insertBefore(o,s),r.__lexicalLineBreak=o}else r.__lexicalLineBreak=s}getFirstChildOffset(){const e=this.getFirstChild(),t=this.getInsertionAnchor();let r=0;for(let i=this.element.firstChild;i!==null&&i!==e&&i!==t;i=i.nextSibling)r++;return r}resolveChildIndex(e,t,r,i){if(r===this.element){const a=this.getFirstChildOffset(),l=hu(),c=this.element.childNodes,h=Math.min(i,c.length);let f=0;for(let d=a;d<h;d++)c[d]!==l&&f++;return[e,Math.min(f,e.getChildrenSize())]}const s=lc(t,r);s.push(i);const o=lc(t,this.element);let u=e.getIndexWithinParent();for(let a=0;a<o.length;a++){const l=s[a],c=o[a];if(l===void 0||l<c)break;if(l>c){u+=1;break}}return[e.getParentOrThrow(),u]}};function lc(n,e){const t=[];let r=e;for(;r!==n&&r!==null;r=r.parentNode){let i=0;for(let s=r.previousSibling;s!==null;s=s.previousSibling)i++;t.push(i)}return r!==n&&P(225),t.reverse()}function mm(){let n;try{n="0.52.0+prod.esm"}catch{}return n??'"<unknown>+source"'}const Qd=mm();let si=class{constructor(){M(this,"_front",new Set);M(this,"_back",new Set);M(this,"_cache")}get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){const e=Array.from(this._front).reverse();for(const t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};const Pn=null;function Zd(n,e=1e3){return n instanceof Vu?n.clone():n.size<e?new Map(n):new Vu().init(new Map(n),void 0,n.size)}let Vu=class e0{constructor(){M(this,"_mutable",!1);M(this,"_old");M(this,"_nursery");M(this,"_size",0)}clone(){return this._mutable=!1,new e0().init(this._old,this._nursery,this._size)}init(e,t,r){return this._old=e,this._nursery=t,this._size=r,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){const t=this._nursery&&this._nursery.get(e);return t!==void 0?t:this._old&&this._old.get(e)}get(e){const t=this.getWithTombstone(e);return t===Pn?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){const t=new Map(this._old);for(const[r,i]of this._nursery)i!==Pn?t.set(r,i):t.delete(r);this._old=t,this._nursery=void 0}return this._mutable=!1,this}set(e,t){const r=this.getWithTombstone(e);if(r===t)return this;const i=this.getNursery();return r!==Pn&&r!==void 0||(this._size++,r===Pn&&i.delete(e)),i.set(e,t),this}delete(e){const t=this.has(e);return t&&(this.getNursery().set(e,Pn),this._size--),t}getOrInsert(e,t){const r=this.get(e);return r!==void 0?r:(this.set(e,t),t)}getOrInsertComputed(e,t){const r=this.get(e);if(r!==void 0)return r;const i=t(e);return this.set(e,i),i}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const e of this.entries())yield e[0]}*values(){for(const e of this.entries())yield e[1]}*entries(){const e=this._nursery,t=this._old;if(e){if(t)for(const r of t){const i=r[0],s=e.get(i);s!==Pn&&(s!==void 0&&(r[1]=s),yield r)}for(const r of e)r[1]===Pn||t&&t.has(r[0])||(yield r)}else t&&(yield*t)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(const[r,i]of this.entries())e(i,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}},gi=!1;function bm(n,e,...t){const r=gi;let i;try{gi=n,i=e()}finally{gi=r}var s;return(s=i)===null||typeof s!="object"&&typeof s!="function"||typeof s.then!="function"||P(421),i}function ym(){return gi}function t0(n){const e=n.exportJSON(gi),t=n.constructor;return e.type!==t.getType()&&P(130,t.name),T(n)&&!Array.isArray(e.children)&&P(59,t.name),e}function Qs(n,e,t,r,i,s){if(T(n)){let o=n.getFirstChild();for(;o!==null;){const u=o.__key;o.__parent===e&&((T(o)||Kn(o)&&o.__slots!==null)&&Qs(o,u,t,r,i,s),t.has(u)||s.delete(u),i.push(u)),o=o.getNextSibling()}}for(const o of Kn(n)&&n.__slots!==null?n.__slots.values():[]){const u=r.get(o);u!==void 0&&er(u)&&u.__slotHost===e&&((T(u)||Kn(u)&&u.__slots!==null)&&Qs(u,o,t,r,i,s),t.has(o)||s.delete(o),i.push(o))}}let Gu=!1,Za=0;function _m(n){Za=n.timeStamp}function pu(n,e,t){const r=n.nodeName==="BR",i=e.__lexicalLineBreak;return i&&(n===i||r&&n.previousSibling===i)||r&&hr(n,t)!==void 0}function xm(n,e,t){const r=nt(dt(t)),i=r&&ct(r,t._rootElement);let s=null,o=null;i!==null&&i.anchorNode===n&&(s=i.anchorOffset,o=i.focusOffset);const u=n.nodeValue;u!==null&&xl(e,u,s,o,!1)}function vm(n,e,t){if(F(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return Tt(e)&&t.isAttached()}function Sm(n,e,t){for(let r=n;r&&!$h(r);r=nn(r)){const i=hr(r,e);if(i!==void 0){const s=he(i,t);if(s)return ie(s)||!ce(r)?void 0:[r,s]}}}function n0(n,e,t){Gu=!0;const r=performance.now()-Za>100;try{gt(n,()=>{const i=z()||function(h){return h.read("latest",()=>{const f=z();return f!==null?f.clone():null})}(n),s=new Map,o=n._editorState,u=n._blockCursorElement;let a=!1,l="";for(let h=0;h<e.length;h++){const f=e[h],d=f.type,g=f.target,b=Sm(g,n,o);if(!b)continue;const[m,p]=b;if(d==="characterData")r&&B(p)&&Tt(g)&&vm(i,g,p)&&xm(g,p,n);else if(d==="childList"){a=!0;const y=f.addedNodes;for(let S=0;S<y.length;S++){const C=y[S],A=Th(C),O=C.parentNode;if(!(O==null||C===u||A!==null||pu(C,O,n)||Ys(C)||n._slotsUsed&&ce(C)&&C.hasAttribute("data-lexical-slot")||$h(C))){if(rn){const D=(ce(C)?C.innerText:null)||C.nodeValue;D&&(l+=D)}O.removeChild(C)}}const _=f.removedNodes,x=_.length;if(x>0){let S=0;for(let C=0;C<x;C++){const A=_[C];pu(A,g,n)||u===A?(g.appendChild(A),S++):Ys(A)&&S++}x!==S&&s.set(m,p)}}}if(s.size>0)for(const[h,f]of s)f.reconcileObservedMutation(h,n);const c=t.takeRecords();if(c.length>0){for(let h=0;h<c.length;h++){const f=c[h],d=f.addedNodes,g=f.target;for(let b=0;b<d.length;b++){const m=d[b],p=m.parentNode;p==null||m.nodeName!=="BR"||pu(m,g,n)||p.removeChild(m)}}t.takeRecords()}i!==null&&(a&&Me(i),rn&&Dh(n)&&i.insertRawText(l))})}finally{Gu=!1}}function r0(n){const e=n._observer;e!==null&&n0(n,e.takeRecords(),e)}function i0(n){(function(e){Za===0&&dt(e).addEventListener("textInput",_m,!0)})(n),n._observer=new MutationObserver((e,t)=>{n0(n,e,t)})}function s0(n,e,t){const{isEqual:r}=n;return e===t||r!==void 0&&r(e,t)}function el(n,e){return s0(n,e,n.defaultValue)}function Cn(n){return typeof n=="object"&&n!==null}function An(n,e){const t=$o(n,e).getter;return Cn(t)&&t.getterTable!==void 0||P(405,e),tl(t.getterTable)}function ur(n,e){const t=$o(n,e).setter;return Cn(t)&&t.setterTable!==void 0||P(406,e),tl(t.setterTable)}function Zs(n,e,t){let{meta:r}=$o(n,e);for(let i=0;;){if(r.kind==="aliased")return tl(r.aliases);r.kind==="nullable"||r.kind==="optional"?r=r.inner.meta:r.kind==="array"?r=r.item.meta:P(407,e,String(t))}}function ar(n,e){const t=$o(n,e),{setter:r}=t;Cn(r)&&r.setterTable!==void 0||P(408,e);const i=String(t.defaultValue);return vn(r.setterTable,i)||P(409,e,i),r.setterTable[i]}function tl(n){return Object.assign(Object.create(null),n)}function $o(n,e){const t=n.get(e);return t===void 0&&P(410,e),t}function lr(n,e,t,r,i){i!==void 0&&wm.add(i);const s=t===void 0,o=s?n(void 0):t;return s&&u0(o),Object.assign(n,{accepts:i,defaultValue:o,isEqual:r,meta:e})}const wm=new WeakSet,o0=new WeakSet;function Cm(n){return n!==null&&typeof n=="object"&&o0.add(n),n}function u0(n){if(n!==null&&typeof n=="object"&&!Object.isFrozen(n)&&!o0.has(n)){Object.freeze(n);for(const e of Object.values(n))u0(e)}}function a0(n){const{isEqual:e}=n;return e===void 0?void 0:(t,r)=>t==null||r==null?t===r:e(t,r)}function l0(n,e){return t=>e(t)||nl(n,t)}function nl(n,e){const{accepts:t}=n;return t!==void 0?t.call(n,e):function(r,i){const{accepts:s}=r;if(s!==void 0)return nl(r,i)?{parsed:r(i)}:void 0;const o=r(i);return el(r,o)&&i!==r.defaultValue?void 0:{parsed:o}}(n,e)!==void 0}function vn(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function mn(n=""){return lr(e=>typeof e=="string"?e:n,{kind:"string"},void 0,void 0,e=>typeof e=="string")}const Tm=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Tn(n=0,e={}){const{integer:t,clamp:r}=e,i=t&&e.min!==void 0?Math.ceil(e.min):e.min,s=t&&e.max!==void 0?Math.floor(e.max):e.max,o=l=>typeof l=="string"&&Tm.test(l)?Number(l):l,u=l=>typeof l=="number"&&Number.isFinite(l)&&(!t||Number.isInteger(l)),a=l=>u(l)&&(i===void 0||l>=i)&&(s===void 0||l<=s);return lr(l=>{const c=o(l);return r&&u(c)?i!==void 0&&c<i?i:s!==void 0&&c>s?s:c:a(c)?c:n},{clamp:r,integer:t,kind:"number",max:s,min:i},void 0,void 0,l=>r?u(o(l)):a(o(l)))}function c0(n=!1){return lr(e=>typeof e=="boolean"?e:n,{kind:"boolean"},void 0,void 0,e=>typeof e=="boolean")}function Lr(n,...e){const t=Cm(e.length!==0?e[0]:n[0]),r=new Set(n);return lr(i=>i!==void 0&&r.has(i)?i:t,{kind:"enum",values:n},t,void 0,i=>r.has(i)&&(i!==void 0||t===void 0))}function mu(n,e={}){const{defaultAsNull:t}=e;return lr(r=>{if(r==null)return null;const i=n(r);return t&&el(n,i)?null:i},{defaultAsNull:t,inner:n,kind:"nullable"},void 0,a0(n),l0(n,r=>r==null))}function Em(n,e={}){const{omitDefault:t}=e;return lr(r=>{if(r===void 0)return;const i=n(r);return t&&el(n,i)?void 0:i},{inner:n,kind:"optional",omitDefault:t},void 0,a0(n),l0(n,r=>r===void 0))}function cr(){return n=>function(e){return{meta:{fields:e,kind:"node"}}}(n)}function Ju(n,e){const t=r=>typeof r=="string"&&vn(e,r);return lr(r=>t(r)?e[r]:n(r),{aliases:e,inner:n,kind:"aliased"},n.defaultValue,n.isEqual,r=>t(r)||nl(n,r))}function Ze(n,e){return f0(0,n,{getter:{field:e.field,getterTable:e.getterTable,method:e.getter,when:e.when},setter:{field:e.field,method:e.setter,setterTable:e.setterTable}})}function Sn(n,e){return f0(0,n,e)}function f0(n,e,t){return Object.assign(r=>e(r),{accepts:e.accepts,defaultValue:e.defaultValue,getter:t.getter,isEqual:e.isEqual,meta:e.meta,setter:t.setter})}const cc="latest";class Nm{constructor(e,t){M(this,"key");M(this,"parse");M(this,"unparse");M(this,"isEqual");M(this,"defaultValue");M(this,"resetOnCopyNode");M(this,"schema");this.key=e;const r="meta"in(i=t.parse)&&typeof i.meta=="object"&&i.meta!==null&&"kind"in i.meta&&typeof i.meta.kind=="string"&&"defaultValue"in i?t.parse:void 0;var i;this.schema=r,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Mm).bind(t),this.isEqual=t.isEqual?t.isEqual.bind(t):r!==void 0&&r.isEqual!==void 0?(s,o)=>s0(r,s,o):Object.is,this.defaultValue=r!==void 0?r.defaultValue:this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}}function km(n,e){return new Nm(n,e)}function Am(n,e,t=cc){const r=(t===cc?n.getLatest():n).__state;return r?r.getValue(e):e.defaultValue}function Om(n,e,t){let r;if(Be(),typeof t=="function"){const s=n.getLatest(),o=Am(s,e);if(r=t(o),e.isEqual(o,r))return s}else r=t;const i=n.getWritable();return d0(i).updateFromKnown(e,r),i}function Dm(n){const e=new Map,t=new Set;for(const{ownNodeConfig:r}of Zn(typeof n=="function"?n:n.replace))if(r&&r.stateConfigs)for(const i of r.stateConfigs){let s;"stateConfig"in i?(s=i.stateConfig,i.flat&&t.add(s.key)):s=i,e.set(s.key,s)}return{flatKeys:t,sharedConfigMap:e}}const fc=new Set(["__proto__","constructor","prototype"]);class rl{constructor(e,t,r=void 0,i=new Map,s=void 0){M(this,"node");M(this,"knownState");M(this,"unknownState");M(this,"sharedNodeState");M(this,"size");this.node=e,this.sharedNodeState=t,this.unknownState=r,this.knownState=i;const{sharedConfigMap:o}=this.sharedNodeState,u=s!==void 0?s:function(a,l,c){let h=c.size;if(l)for(const f in l){const d=a.get(f);d&&c.has(d)||h++}return h}(o,r,i);this.size=u}getValue(e){const t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let r=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const i=this.unknownState[e.key];i!==void 0&&(r=e.parse(i)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[r,i]of this.knownState)r.isEqual(i,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(i);for(const r of this.sharedNodeState.flatKeys)r in e&&(t[r]=e[r],delete e[r]);return dc(e)&&(t[Qa]=e),t}getWritable(e){if(this.node===e)return this;const{sharedNodeState:t,unknownState:r}=this,i=new Map(this.knownState);return new rl(e,t,function(s,o,u){let a;if(u)for(const[l,c]of Object.entries(u)){if(fc.has(l))continue;const h=s.get(l);h?o.has(h)||o.set(h,h.parse(c)):(a=a||{},a[l]=c)}return a}(t.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:i,unknownState:s}=this;i.has(e)||s&&r in s||(s&&(delete s[r],this.unknownState=dc(s)),this.size++),i.set(e,t)}updateFromUnknown(e,t){if(fc.has(e))return;const r=this.sharedNodeState.sharedConfigMap.get(e);r?this.updateFromKnown(r,r.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const r of t.keys())t.set(r,r.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[r,i]of Object.entries(e))this.updateFromUnknown(r,i)}}function d0(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new rl(e,function(r){return r.__state?r.__state.sharedNodeState:Sh(Pe(),r.getType()).sharedNodeState}(e));return e.__state=t,t}function h0(n,e){const t=n.getWritable(),r=e[Qa];return(t.__state||r)&&d0(n).updateFromJSON(r),t}function dc(n){if(n)for(const e in n)return n}function Mm(n){return n}function hc(n,e,t){for(const[r,i]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const s=t?t.getValue(r):r.defaultValue;if(s!==i&&!r.isEqual(s,i))return!0}return!1}function gc(n,e,t){const{unknownState:r}=e,i=t?t.unknownState:void 0;if(r){for(const[s,o]of Object.entries(r))if(!n.has(s)&&(n.add(s),o!==(i?i[s]:void 0)))return!0}return!1}function pc(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function mc(n,e){const t=n.__mode,r=n.__format,i=n.__style,s=e.__mode,o=e.__format,u=e.__style,a=n.__state,l=e.__state;return(t===null||t===s)&&(r===null||r===o)&&(i===null||i===u)&&(n.__state===null||a===l||function(c,h){if(c===h)return!0;const f=new Set;return!(c&&hc(f,c,h)||h&&hc(f,h,c)||c&&gc(f,c,h)||h&&gc(f,h,c))}(a,l))}function bc(n,e){const t=n.mergeWithSibling(e),r=de()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function yc(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&B(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(mc(e,r)){r=bc(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&B(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(mc(r,t)){r=bc(r,t);break}break}t.remove()}}else r.remove()}function Rr(n){return _c(n.anchor),_c(n.focus),n}function _c(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,i;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),i=!0):(r=e.getChildAtIndex(t),i=!1),B(r)){n.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!T(r))break;n.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}const eo=Symbol.for("@lexical/CachedTextSize");function xc(n,e){return Xu.read(()=>{let t=0,r=n;for(let i=0;i<e&&r!==null;i++){const s=At.get(r);if(s===void 0&&P(345,r),T(s)){const o=Se.get(r);if(o!==void 0&&T(o)&&o.__parent!==s.__parent)t+=s.getTextContentSize();else{const u=Gn.get(r),a=u&&u.__lexicalTextContent;typeof a!="string"&&P(346,s.getType()),t+=a.length}i<e-1&&!s.isInline()&&(t+=2)}else{const o=s[eo];o===void 0&&P(347,s.getType(),r),t+=o}r=s.__next}return t},{editor:le})}function g0(n){T(n)||n[eo]===void 0&&(n[eo]=B(n)?n.__text.length:n.getTextContentSize())}const Im=4;let Ti,le,Ei,se="",Oe=null,Ge=null,We=null;function Ft(){return{firstTextKey:We,format:Oe,style:Ge}}function xt(n){n.firstTextKey!==null&&(Oe=n.format,Ge=n.style,We=n.firstTextKey)}function bu(n){if(We!==null)return;const e=n.__lexicalFirstTextKey;if(e===void 0&&P(348),e===null)return;const t=Se.get(e);B(t)&&(Oe=t.getFormat(),Ge=t.getStyle(),We=e)}let Uo,pi,mi,At,Xu,Se,Gn,Yu,Ni,Jn,Xt=!1,Ls=!1;function bn(n,e){const t=At.get(n),r=Se.has(n);if(e!==null){const i=na(n);i.parentNode===e&&e.removeChild(i)}if(!r){if(le._keyToDOMMap.delete(n),T(t)){const i=wo(t,At);Qu(i,0,i.length-1,null)}if(t!==void 0){for(const i of _t(t).values()){const s=ea(i);bn(i,null),s!==null&&s.remove()}vl(Ni,Ei,Uo,t,"destroyed")}}}function Qu(n,e,t,r){for(let i=e;i<=t;++i){const s=n[i];s!==void 0&&bn(s,r)}}function Ln(n,e){n.setProperty("text-align",e)}const Pm="40px";function p0(n,e){const t=Ti.theme.indent;if(typeof t=="string"){const r=n.classList.contains(t);e>0&&!r?n.classList.add(t):e<1&&r&&n.classList.remove(t)}n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * var(--lexical-indent-base-value, ${Pm}))`),Mi(n,"class"),Mi(n,"style")}function m0(n,e){const t=n.style;e===0?Ln(t,""):e===1?Ln(t,"left"):e===2?Ln(t,"center"):e===3?Ln(t,"right"):e===4?Ln(t,"justify"):e===5?Ln(t,"start"):e===6&&Ln(t,"end"),Mi(n,"style")}function Zu(n,e){const t=function(r){const i=r.__dir;if(i!==null)return i;if(Ee(r))return null;const s=r.getParent();return s===null||pe(s)&&s.__dir===null?"auto":null}(e);t!==null?n.dir=t:n.removeAttribute("dir")}function b0(n){const e=Ie().createElement("div");return e.setAttribute("data-lexical-slot",n),e.style.display="none",e}function y0(n,e,t){e||n.contentEditable==="false"?Nb(t,le):t.removeAttribute("contenteditable")}function vc(n,e,t){const r=se,i=Ft();se="";let s="";const o=ie(n);for(const[u,a]of t){const l=b0(u);y0(e,o,l),e.appendChild(l),se="";const c=Ft();yn(a,ft(n,l,le)),xt(c),_0(n,u,e,l),s+=se}return xt(i),se=r,s}function _t(n){return Kn(n)&&n.__slots!==null?n.__slots:Kh}function _0(n,e,t,r){const i=Jn.$getSlotTargetElement(n,e,t,le);i!==null&&(r.parentElement!==i&&i.appendChild(r),r.style.display="")}function ea(n){const e=Gn.get(n);return e!==void 0?e.parentElement:null}function Sc(n,e,t){const r=_t(n),i=_t(e);for(const[c,h]of r)if(!i.has(c)){const f=ea(h);bn(h,null),f!==null&&f.remove()}const s=se,o=Ft();let u="",a=null;const l=ie(e);for(const[c,h]of i){const f=r.get(c);let d=f!==void 0?ea(f):null;se="";const g=Ft();if(d===null){d=b0(c);let b=null;for(const m of t.children)if(!m.hasAttribute("data-lexical-slot")){b=m;break}t.insertBefore(d,b),yn(h,ft(e,d,le))}else f===h?Qt(h,d):(f!==void 0&&bn(f,d),yn(h,ft(e,d,le)));if(xt(g),y0(t,l,d),_0(e,c,t,d),u+=se,d.parentElement===t){const b=a===null?t.firstChild:a.nextSibling;b!==d&&t.insertBefore(d,b),a=d}}return xt(o),se=s,u}function yn(n,e){const t=Se.get(n);if(t===void 0&&P(60),e!==null){const i=At.get(n);if(i!==void 0){const s=Gn.get(n);if(s!==void 0){const o=er(i)?i.__slotHost:null,u=er(t)?t.__slotHost:null,a=i.__parent!==t.__parent||o!==u,l=u!==null&&s.parentElement!==e.element;if(a||l)return e.insertChild(s),Qt(n,e.element)}}}const r=Jn.$createDOM(t,le);if(function(i,s,o){const u=o._keyToDOMMap;Eh(s,o,i),u.set(i,s)}(n,r,le),B(t)?r.setAttribute("data-lexical-text","true"):ie(t)&&(r.setAttribute("data-lexical-decorator","true"),Eb(r,{captureSelection:!0})),T(t)){const i=t.__indent,s=t.__size;Zu(r,t),i!==0&&p0(r,i);const o=_t(t),u=o.size>0?vc(t,r,o):"";if(s===0)r.__lexicalTextContent=u,r.__lexicalFirstTextKey=null,se+=u,o.size>0&&(r.__lexicalSlotTextLength=u.length);else{const l=se,c=s-1;if(ta(wo(t,Se),t,0,c,ft(t,r,le)),u!==""){const h=r.__lexicalTextContent||"";r.__lexicalTextContent=u+h,se=l+u+h}o.size>0&&(r.__lexicalSlotTextLength=u.length)}const a=t.__format;a!==0&&m0(r,a),t.isInline()||(v0(0,t,r),x0(t,r))}else{const i=t.getTextContent();if(ie(t)){const s=t.decorate(le,Ti);s!==null&&S0(n,s),r.contentEditable="false";const o=_t(t);o.size>0&&vc(t,r,o)}se+=i}return e!==null&&e.insertChild(r),Jn.$decorateDOM(t,null,r,le),g0(t),vl(Ni,Ei,Uo,t,"created"),r}function ta(n,e,t,r,i){const s=se,o=Ft();se="",Oe=null,Ge=null,We=null;let u=t;for(;u<=r;++u){const l=Ft();yn(n[u],i);const c=Se.get(n[u]);c!==null&&B(c)?Oe===null&&(Oe=c.getFormat(),Ge=c.getStyle(),We=c.__key):T(c)&&u<r&&!c.isInline()&&(se+=$n),xt(l)}const a=le._keyToDOMMap.get(e.__key);a===void 0&&P(349,e.__key),a.__lexicalTextContent=se,a.__lexicalFirstTextKey=We,se=s+se,xt(o)}function wc(n,e){if(!n)return!1;const t=e.get(n);return ie(t)&&!t.isInline()}function x0(n,e){const t=ft(n,e,le);t.setDecoratorBoundaryAnchor("leading",wc(n.__first,Se)),t.setDecoratorBoundaryAnchor("trailing",wc(n.__last,Se))}function v0(n,e,t){const r=ft(e,t,le),i=function(s,o){if(s){const u=s.__last;if(u){const a=o.get(u);if(a)return et(a)?"line-break":ie(a)&&a.isInline()?"decorator":null}return"empty"}return null}(e,Se);r.setManagedLineBreak(i)}function Cc(n,e,t){const r=e.__lexicalFirstTextKey;if(r!=null){const i=n.__key;let s=r;for(;s!==null;){const o=Se.get(s);if(o===void 0){s=null;break}if(o.__parent===i)break;s=o.__parent}if(s!==null&&!t.has(s)){const o=Se.get(r);if(B(o))return Oe=o.getFormat(),void(Ge=o.getStyle())}}e.__lexicalFirstTextKey=We}function Qt(n,e){const t=At.get(n);let r=Se.get(n);t!==void 0&&r!==void 0||P(61);const i=Xt||mi.has(n)||pi.has(n),s=Ar(le,n);if(t===r&&!i){let o;if(T(t)){const u=s.__lexicalTextContent;typeof u!="string"&&P(355,t.getType()),o=u,bu(s)}else o=t.getTextContent();return se+=o,s}if(t!==r&&i&&vl(Ni,Ei,Uo,r,"updated"),Jn.$updateDOM(r,t,s,le)){const o=yn(n,null);return e===null&&P(62),e.replaceChild(o,s),bn(n,null),o}if(T(t)){T(r)||P(334,n);const o=r.__indent;(Xt||o!==t.__indent)&&p0(s,o);const u=r.__format;(Xt||u!==t.__format)&&m0(s,u);const a=i&&(_t(r).size>0||_t(t).size>0)?Sc(t,r,s):"";if(i){const l=se;if(function(c,h,f){var d;Oe=null,Ge=null,We=null,function(g,b,m){const p=se,y=g.__size,_=b.__size;se="";const x=m.element,S=le._keyToDOMMap.get(b.__key);S===void 0&&P(351,b.__key);const C=_-y;if(!Xt&&Math.abs(C)<=1&&y>=Im&&g.__first===b.__first&&(C!==0||!le._cloneNotNeeded.has(g.__key))){const A=S.__lexicalTextContent,O=Yu.get(g.__key);if(!Xt&&typeof A=="string"&&O!==void 0){const D=function(k,v){const E=v.size;if(E===0||E>=k.__size)return null;let N=k.__last,R=null,w=0;for(;N!==null&&w<E;){if(!v.has(N))return null;R=N;const L=Se.get(N);if(L===void 0)return null;N=L.__prev,w++}return w!==E||N!==null&&v.has(N)?null:R}(b,O);if(D!==null){const k=O.size;if(C===0){const v=xc(D,k);let E=D,N=0;for(;E!==null&&N<k;){const U=Se.get(E);if(U===void 0)break;const H=Ft();Qt(E,x),B(U)&&Oe===null&&(Oe=U.getFormat(),Ge=U.getStyle(),We=U.__key),xt(H),E=U.__next,N++}let R="";for(E=D,N=0;E!==null&&N<k;){const U=Se.get(E);if(U===void 0)break;let H;if(T(U)){const V=le._keyToDOMMap.get(E),te=V&&V.__lexicalTextContent;typeof te!="string"&&P(352,U.getType()),H=te}else H=U.getTextContent();R+=H,N<k-1&&T(U)&&!U.isInline()&&(R+=$n),E=U.__next,N++}const w=S.__lexicalSlotTextLength||0,L=w>0?A.slice(w):A,I=L.slice(0,L.length-v)+R;return S.__lexicalTextContent=I,se=p+I,void Cc(b,S,O)}if(function(v,E,N,R,w,L,I,U){if(U!==1&&U!==-1||I!==(U===1?2:1))return!1;const H=I-U;let V=v.__last;for(let Q=0;Q<H-1;Q++){if(V===null)return!1;const be=At.get(V);if(be===void 0)return!1;V=be.__prev}if(V===null)return!1;const te=Se.get(L),ge=At.get(V);if(te===void 0||ge===void 0||te.__prev!==ge.__prev)return!1;const j=[];let $=L;for(let Q=0;Q<I;Q++){if($===null)return!1;j.push($);const be=Se.get($);$=be?be.__next:null}const G=[];$=V;for(let Q=0;Q<H;Q++){if($===null)return!1;G.push($);const be=At.get($);$=be?be.__next:null}const X=new Set(G),Z=new Set(j),Ce=[];let Ae=0,ve=0;for(;Ae<H&&ve<I;)if(j[ve]===G[Ae])Ce.push({key:j[ve],kind:"reconcile"}),Ae++,ve++;else if(Z.has(G[Ae])){if(X.has(j[ve]))return!1;Ce.push({key:j[ve],kind:"create",nextIndex:ve}),ve++}else Ce.push({key:G[Ae],kind:"destroy"}),Ae++;for(;Ae<H;)Ce.push({key:G[Ae++],kind:"destroy"});for(;ve<I;)Ce.push({key:j[ve],kind:"create",nextIndex:ve}),ve++;const ii=xc(V,H);for(const Q of Ce){const be=Ft();if(Q.kind==="reconcile")Qt(Q.key,N.element);else if(Q.kind==="destroy")bn(Q.key,N.element);else{let Le=null;for(let Fe=Q.nextIndex+1;Fe<I;Fe++){const it=le._keyToDOMMap.get(j[Fe]);if(it!==void 0){Le=it;break}}yn(Q.key,N.withBefore(Le??N.before))}if(Q.kind!=="destroy"){const Le=Se.get(Q.key);Le&&B(Le)&&Oe===null&&(Oe=Le.getFormat(),Ge=Le.getStyle(),We=Le.__key)}xt(be)}let dn="";for(let Q=0;Q<I;Q++){const be=Se.get(j[Q]);if(be===void 0)return!1;let Le;if(T(be)){const Fe=le._keyToDOMMap.get(j[Q]),it=Fe&&Fe.__lexicalTextContent;typeof it!="string"&&P(350,be.getType()),Le=it}else Le=be.getTextContent();dn+=Le,Q<I-1&&T(be)&&!be.isInline()&&(dn+=$n)}const hn=R.__lexicalSlotTextLength||0,W=hn>0?w.slice(hn):w;return R.__lexicalTextContent=W.slice(0,W.length-ii)+dn,!0}(g,0,m,S,A,D,k,C)){const v=S.__lexicalTextContent;return typeof v!="string"&&P(353),se=p+v,void Cc(b,S,O)}}}if(C===0){let D=g.__first,k=0;for(;D!==null;){const v=Se.get(D);if(v===void 0)break;const E=Xt||mi.has(D)||pi.has(D),N=Ft();if(E)Qt(D,x);else{let R,w;if(T(v)){w=Gn.get(D);const L=w&&w.__lexicalTextContent;typeof L!="string"&&P(354,v.getType()),R=L}else R=v.getTextContent();se+=R,w!==void 0&&bu(w)}B(v)?Oe===null&&(Oe=v.getFormat(),Ge=v.getStyle(),We=v.__key):T(v)&&k<_-1&&!v.isInline()&&(se+=$n),xt(N),D=v.__next,k++}return S.__lexicalTextContent=se,S.__lexicalFirstTextKey=We,void(se=p+se)}}if(y===1&&_===1){const A=g.__first,O=b.__first;if(A===O)Qt(A,x);else{const k=na(A),v=yn(O,null);try{k.parentNode===x?x.replaceChild(v,k):m.insertChild(v)}catch(E){if(typeof E=="object"&&E!=null){const N=`${E.toString()} Parent: ${x.tagName}, new child: {tag: ${v.tagName} key: ${O}}, old child: {tag: ${k.tagName}, key: ${A}}.`;throw new Error(N)}throw E}bn(A,null)}const D=Se.get(O);B(D)&&Oe===null&&(Oe=D.getFormat(),Ge=D.getStyle(),We=D.__key)}else{const A=wo(g,At),O=wo(b,Se);if(A.length!==y&&P(227),O.length!==_&&P(228),y===0)_!==0&&ta(O,b,0,_-1,m);else if(_===0){if(y!==0){const D=m.after==null&&m.before==null&&_t(b).size===0&&m.element.__lexicalLineBreak==null;Qu(A,0,y-1,D?null:x),D&&(x.textContent="")}}else(function(D,k,v,E,N,R){const w=E-1,L=N-1;let I,U,H=R.getFirstChild(),V=0,te=0;for(;V<=w&&te<=L;){const $=k[V],G=v[te],X=Ft();if($===G)H=yu(Qt(G,R.element)),V++,te++;else{if(U===void 0&&(U=Tc(v,te)),I===void 0)I=Tc(k,V);else if(!I.has($)){V++,xt(X);continue}if(!U.has($)){H=yu(na($)),bn($,R.element),V++,I.delete($),xt(X);continue}if(I.has(G)){const Ce=Ar(le,G);Ce!==H&&R.withBefore(H??R.before).insertChild(Ce),H=yu(Qt(G,R.element)),V++,te++}else yn(G,R.withBefore(H??R.before)),te++}const Z=Se.get(G);Z!==null&&B(Z)?Oe===null&&(Oe=Z.getFormat(),Ge=Z.getStyle(),We=Z.__key):T(Z)&&te<=L&&!Z.isInline()&&(se+=$n),xt(X)}const ge=V>w,j=te>L;if(ge&&!j){const $=v[L+1],G=$===void 0?null:le.getElementByKey($);ta(v,D,te,L,R.withBefore(G??R.before))}else j&&!ge&&Qu(k,V,w,R.element)})(b,A,O,y,_,m)}S.__lexicalTextContent=se,S.__lexicalFirstTextKey=We,se=p+se}(c,h,ft(h,f,le)),pe(h)||(d=h,Oe==null||Oe===d.__textFormat||Ls||d.setTextFormat(Oe),function(g){Ge==null||Ge===g.__textStyle||Ls||g.setTextStyle(Ge)}(h))}(t,r,s),r.isInline()||(Ee(r)||v0(0,r,s),x0(r,s)),a!==""){const c=s.__lexicalTextContent||"";s.__lexicalTextContent=a+c,se=l+a+c,s.__lexicalSlotTextLength=a.length}else(_t(r).size>0||_t(t).size>0)&&(s.__lexicalSlotTextLength=0)}else{const l=s.__lexicalTextContent;typeof l!="string"&&P(356,t.getType()),se+=l,bu(s)}if((Xt||r.__dir!==t.__dir||r.__parent!==t.__parent)&&(Zu(s,r),Ee(r)&&!Xt))for(const l of r.getChildren())T(l)&&Zu(Ar(le,l.getKey()),l)}else{const o=r.getTextContent();if(ie(r)){const u=r.decorate(le,Ti);u!==null&&S0(n,u),i&&(_t(r).size>0||_t(t).size>0)&&Sc(t,r,s)}se+=o}if(!Ls&&Ee(r)){const o=r.getLatest();if(o.__cachedText!==se){const u=o.getWritable();u.__cachedText=se,r=u}}return Jn.$decorateDOM(r,t,s,le),g0(r),s}function S0(n,e){let t=le._pendingDecorators;const r=le._decorators;if(t===null){if(r[n]===e)return;t=Nh(le)}t[n]=e}function yu(n){let e=n.nextSibling;return e!==null&&e===le._blockCursorElement&&(e=e.nextSibling),e}function Tc(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function Lm(n,e,t,r,i,s){se="",Oe=null,Ge=null,We=null,Xt=r===2,le=t,Ti=t._config,Jn=t._config.dom||po,Ei=t._nodes,Uo=le._listeners.mutation,pi=i,mi=s,At=n._nodeMap,Xu=n,Se=e._nodeMap,Ls=e._readOnly,Gn=Zd(t._keyToDOMMap),Yu=function(){const u=new Map,a=l=>{for(const c of l){const h=Se.get(c);if(h===void 0)continue;const f=h.__parent;if(f===null)continue;let d=u.get(f);d===void 0&&(d=new Set,u.set(f,d)),d.add(c)}};return a(pi.keys()),a(mi),u}();const o=new Map;return Ni=o,Qt("root",null),le=void 0,Ei=void 0,pi=void 0,mi=void 0,At=void 0,Xu=void 0,Se=void 0,Ti=void 0,Gn=void 0,Yu=void 0,Ni=void 0,Jn=po,o}function na(n){const e=Gn.get(n);return e===void 0&&P(75,n),e}function J(n){return{type:n}}const zo=J("SELECTION_CHANGE_COMMAND"),Rm=J("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),w0=J("CLICK_COMMAND"),C0=J("BEFORE_INPUT_COMMAND"),T0=J("INPUT_COMMAND"),E0=J("COMPOSITION_START_COMMAND"),N0=J("COMPOSITION_END_COMMAND"),zn=J("DELETE_CHARACTER_COMMAND"),wr=J("INSERT_LINE_BREAK_COMMAND"),ki=J("INSERT_PARAGRAPH_COMMAND"),Cr=J("CONTROLLED_TEXT_INSERTION_COMMAND"),Ji=J("PASTE_COMMAND"),Rs=J("REMOVE_TEXT_COMMAND"),Ai=J("DELETE_WORD_COMMAND"),Tr=J("DELETE_LINE_COMMAND"),Ot=J("FORMAT_TEXT_COMMAND"),Fm=J("SET_TEXT_FORMAT_COMMAND"),to=J("UNDO_COMMAND"),Oi=J("REDO_COMMAND"),k0=J("KEYDOWN_COMMAND"),A0=J("KEY_ARROW_RIGHT_COMMAND"),ra=J("MOVE_TO_END"),O0=J("KEY_ARROW_LEFT_COMMAND"),ia=J("MOVE_TO_START"),D0=J("KEY_ARROW_UP_COMMAND"),M0=J("KEY_ARROW_DOWN_COMMAND"),il=J("KEY_ENTER_COMMAND"),I0=J("KEY_SPACE_COMMAND"),sl=J("KEY_BACKSPACE_COMMAND"),P0=J("KEY_ESCAPE_COMMAND"),L0=J("KEY_DELETE_COMMAND"),R0=J("KEY_TAB_COMMAND"),Bm=J("INSERT_TAB_COMMAND"),jm=J("INDENT_CONTENT_COMMAND"),Ec=J("OUTDENT_CONTENT_COMMAND"),F0=J("DROP_COMMAND"),$m=J("FORMAT_ELEMENT_COMMAND"),B0=J("DRAGSTART_COMMAND"),j0=J("DRAGOVER_COMMAND"),Um=J("DRAGEND_COMMAND"),qo=J("COPY_COMMAND"),ol=J("CUT_COMMAND"),$0=J("SELECT_ALL_COMMAND"),zm=J("CLEAR_EDITOR_COMMAND"),qm=J("CLEAR_HISTORY_COMMAND"),ds=J("CAN_REDO_COMMAND"),hs=J("CAN_UNDO_COMMAND"),Km=J("FOCUS_COMMAND"),Wm=J("BLUR_COMMAND"),Hm=J("KEY_MODIFIER_COMMAND");function U0(n,e){return{...e,[gm]:n}}const Rn=U0("metaKey",{ctrlKey:!Vn,metaKey:Vn}),Nc=U0("altKey",{altKey:Vn,ctrlKey:!Vn}),kc=[["altKey",1],["ctrlKey",2],["metaKey",4],["shiftKey",8]];function _u(n,e,t){const r=n.get(e);r?r.push(t):n.set(e,[t])}class Vm{constructor(){M(this,"byKey",new Map);M(this,"byCode",new Map)}add(e){const{key:t,modifiers:r={}}=e;t.length>0||P(399);const i=t.toLowerCase();for(const s of function(o){let u=[0];for(const[a,l]of kc){const c=o[a]||!1;c==="any"?u=u.concat(u.map(h=>h|l)):c&&(u=u.map(h=>h|l))}return u}(r))_u(this.byKey,`${s}:${i}`,e),t.length===1&&(/[0-9]/.test(t)?_u(this.byCode,`${s}:Digit${t}`,e):/[a-z]/.test(i)&&_u(this.byCode,`${s}:Key${i.toUpperCase()}`,e));return this}matches(e){const t=e.key;if(!t)return[];const r=function(o){let u=0;for(const[a,l]of kc)o[a]&&(u|=l);return u}(e),i=this.byKey.get(`${r}:${t.toLowerCase()}`),s=i?i.slice():[];if(this.byCode.size>0&&!(t.length===1&&t.charCodeAt(0)<=127)){const o=this.byCode.get(`${r}:${e.code}`);o&&s.push(...o)}return s}match(e){return this.matches(e)[0]}}function Gm(n){const e=new Vm;for(const t of n)e.add(t);return e}function Jm(n){const e=new Map;return{dispose(){for(const t of e.values())t.dispose();e.clear()},register(t,r){let i=e.get(t);i===void 0&&(i={dispose:n(t,r),holders:new Set},e.set(t,i));const s=()=>{const o=e.get(t);o&&o.holders.delete(s)&&o.holders.size===0&&(e.delete(t),o.dispose())};return i.holders.add(s),s}}}function Xm(n,e,t,r){return n.addEventListener(e,t,r),n.removeEventListener.bind(n,e,t,r)}const Ht=Object.freeze({});let xu;const vu=new WeakMap,Fs=new WeakMap,Ym=Jm(n=>(n.addEventListener("selectionchange",Rc),()=>n.removeEventListener("selectionchange",Rc)));function z0(n,e,t,r,i,s){const o=n.anchor,u=n.focus,a=o.getNode(),l=de();let c;if(s!==void 0)c=s;else{const b=nt(dt(l));c=b!==null?ct(b,l._rootElement):null}const h=c!==null?c.anchorNode:null,f=o.key,d=l.getElementByKey(f),g=t.length;return f!==u.key||!B(a)||(!i&&(!Ir||l._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||a.isDirty()&&g<2||kh(t))&&o.offset!==u.offset&&!a.isComposing()||St(a)||a.isDirty()&&g>1||(i||!Ir)&&d!==null&&!a.isComposing()&&h!==wn(a,d,l)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||!a.isComposing()&&(a.getFormat()!==n.format||a.getStyle()!==n.style)||function(b,m){if(m.isSegmented())return!0;if(!b.isCollapsed())return!1;const p=b.anchor.offset,y=m.getParentOrThrow(),_=mo(m);return p===0?!m.canInsertTextBefore()||!y.canInsertTextBefore()&&!m.isComposing()||_||function(x){const S=x.getPreviousSibling();return(B(S)||T(S)&&S.isInline())&&!S.canInsertTextAfter()}(m):p===m.getTextContentSize()&&(!m.canInsertTextAfter()||!y.canInsertTextAfter()&&!m.isComposing()||_)}(n,a)}function Ac(n,e){return Tt(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function Oc(n,e,t){const{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}=ct(n,e._rootElement),u=e._inputState;if(u.isSelectionChangeFromDOMUpdate){u.isSelectionChangeFromDOMUpdate=!1;const a=u.selectionChangeFromDOMUpdatePoints;if(u.selectionChangeFromDOMUpdatePoints=null,Ac(r,i)&&Ac(s,o)&&!u.postDeleteSelectionToRestore&&(a===null||a.anchorNode===r&&a.anchorOffset===i&&a.focusNode===s&&a.focusOffset===o))return}gt(e,()=>{if(!t)return void Me(null);if(!es(e,r,s))return;let a=z();if(u.postDeleteSelectionToRestore&&F(a)&&a.isCollapsed()){const l=a.anchor,c=u.postDeleteSelectionToRestore.anchor;(l.key===c.key&&l.offset===c.offset+1||l.offset===1&&c.getNode().is(l.getNode().getPreviousSibling()))&&(a=u.postDeleteSelectionToRestore.clone(),Me(a))}if(u.postDeleteSelectionToRestore=null,F(a)){const l=a.anchor,c=l.getNode();if(a.isCollapsed()){n.type==="Range"&&r===s&&(a.dirty=!0);const h=dt(e).event,f=h?h.timeStamp:performance.now(),{format:d,style:g,offset:b,key:m,timeStamp:p}=u.collapsedSelectionFormat,y=we(),_=e.isComposing()===!1&&y.getTextContent()==="";if(f<p+200&&l.offset===b&&l.key===m)Bs(a,d,g);else if(l.type==="text")B(c)||P(141),q0(a,c);else if(l.type==="element"&&!_){T(c)||P(259);const x=l.getNode();x.isEmpty()?function(S,C){Bs(S,C.getTextFormat(),C.getTextStyle())}(a,x):Bs(a,a.format,"")}}else{const h=l.key,f=a.focus.key,d=a.getNodes(),g=d.length,b=a.isBackward(),m=b?o:i,p=b?i:o,y=b?f:h,_=b?h:f;let x=hm,S=!1;for(let C=0;C<g;C++){const A=d[C],O=A.getTextContentSize();if(B(A)&&O!==0&&!(C===0&&A.__key===y&&m===O||C===g-1&&A.__key===_&&p===0)&&(S=!0,x&=A.getFormat(),x===0))break}a.format=S?x:0}}(function(l,c,h=!1){(h||mh(l,c))&&l.dispatchCommand(zo)})(e,a,a!==null&&(a.dirty||!F(a)))})}function Bs(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function q0(n,e){Bs(n,e.getFormat(),e.getStyle())}function Qm(n,e){gt(e,()=>{const t=z(),r=nt(dt(e)),i=Yr();if(r){if(F(t)){const s=t.anchor,o=s.getNode();s.type==="element"&&s.offset===0&&t.isCollapsed()&&!Ee(o)&&we().getChildrenSize()===1&&o.getTopLevelElementOrThrow().isEmpty()&&i!==null&&t.is(i)&&(r.removeAllRanges(),t.dirty=!0)}else if(n.pointerType==="touch"||n.pointerType==="pen"){const s=ct(r,e._rootElement).anchorNode;(ce(s)||Tt(s))&&Me(uo(i,r,e,n))}}if(rn&&r!==null&&r.rangeCount===0){const s=e._rootElement;if(s!==null&&n.target===s){const o=n.clientY;let u=s.childNodes.length;for(let l=0;l<s.childNodes.length;l++){const c=s.childNodes[l];if(ce(c)){const h=c.getBoundingClientRect();if(o<=(h.top+h.bottom)/2){u=l;break}}}r.setBaseAndExtent(s,u,s,u);const a=uo(i,r,e,n);a!==null?Me(a):r.removeAllRanges()}}Y(e,w0,n)})}function Zm(n,e){const t=Rh(n),r=n.pointerType;Zr(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&gt(e,()=>{vo(t,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}function K0(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Dc(n){const{lastKeyCode:e}=de()._inputState;if(n==null||n.length<=1||e==null)return;const t=e.length===1?e:e==="Enter"?`
4
4
  `:e==="Tab"?" ":null;if(!t)return;const r=z();if(!F(r)||!r.isCollapsed())return;const i=r.anchor.getNode();if(!B(i))return;const{offset:s}=r.anchor;if(i.getTextContentSize()===s){const o=i.getNextSibling();if(t===`
@@ -52,5 +52,5 @@ vulnerable to XSS attacks. Please remove it from \`allowedTags\`.
52
52
  Or, to disable this warning, add the \`allowVulnerableTags\` option
53
53
  and ensure you are accounting for this risk.
54
54
 
55
- `)});const u=e.nonTextTags||["script","style","textarea","option"];let a,l;e.allowedAttributes&&(a={},l={},xr(e.allowedAttributes,function(w,L){a[L]=[];const I=[];w.forEach(function(U){typeof U=="string"&&U.indexOf("*")>=0?I.push(zd(U).replace(/\\\*/g,".*")):a[L].push(U)}),I.length&&(l[L]=new RegExp("^("+I.join("|")+")$"))}));const c={},h={},f={};xr(e.allowedClasses,function(w,L){if(a&&(Yt(a,L)||(a[L]=[]),a[L].push("class")),c[L]=w,Array.isArray(w)){const I=[];c[L]=[],f[L]=[],w.forEach(function(U){typeof U=="string"&&U.indexOf("*")>=0?I.push(zd(U).replace(/\\\*/g,".*")):U instanceof RegExp?f[L].push(U):c[L].push(U)}),I.length&&(h[L]=new RegExp("^("+I.join("|")+")$"))}});const d={};let g;xr(e.transformTags,function(w,L){let I;typeof w=="function"?I=w:typeof w=="string"&&(I=Wi.simpleTransform(w)),L==="*"?g=I:d[L]=I});let b,m,p,y,_,x,S=!1;A();const C=new C3.Parser({onopentag:function(w,L){if(e.onOpenTag&&e.onOpenTag(w,L),e.enforceHtmlBoundary&&w==="html"&&A(),_){x++;return}const I=new s(w,L);m.push(I);let U=!1;const H=!!I.text;let V;if(Yt(d,w)&&(V=d[w](w,L),I.attribs=L=V.attribs,V.text!==void 0&&(I.innerText=V.text),w!==V.tagName&&(I.name=w=V.tagName,y[b]=V.tagName)),g&&(V=g(w,L),I.attribs=L=V.attribs,w!==V.tagName&&(I.name=w=V.tagName,y[b]=V.tagName)),(!o(w)||e.disallowedTagsMode==="recursiveEscape"&&!O3(p)||e.nestingLimit!=null&&b>=e.nestingLimit)&&(U=!0,p[b]=!0,(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&u.indexOf(w)!==-1&&(_=!0,x=1)),b++,U){if(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){if(I.innerText&&!H){const j=O(I.innerText);e.textFilter?r+=e.textFilter(j,w):r+=j,S=!0}return}i=r,r=""}r+="<"+w,w==="script"&&(e.allowedScriptHostnames||e.allowedScriptDomains)&&(I.innerText=""),U&&(e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape")&&e.preserveEscapedAttributes?xr(L,function(j,$){r+=" "+$+'="'+O(j||"",!0)+'"'}):(!a||Yt(a,w)||a["*"])&&xr(L,function(j,$){if(!I3.test($)){delete I.attribs[$];return}if(j===""&&!e.allowedEmptyAttributes.includes($)&&(e.nonBooleanAttributes.includes($)||e.nonBooleanAttributes.includes("*"))){delete I.attribs[$];return}let G=!1;if(!a||Yt(a,w)&&a[w].indexOf($)!==-1||a["*"]&&a["*"].indexOf($)!==-1||Yt(l,w)&&l[w].test($)||l["*"]&&l["*"].test($))G=!0;else if(a&&a[w]){for(const X of a[w])if(T3(X)&&X.name&&X.name===$){G=!0;let Z="";if(X.multiple===!0){const Ce=j.split(" ");for(const Ae of Ce)X.values.indexOf(Ae)!==-1&&(Z===""?Z=Ae:Z+=" "+Ae)}else X.values.indexOf(j)>=0&&(Z=j);j=Z}}if(G){if(e.allowedSchemesAppliedToAttributes.indexOf($)!==-1&&D(w,j)){delete I.attribs[$];return}if(w==="script"&&$==="src"){let X=!0;try{const Z=k(j);if(e.allowedScriptHostnames||e.allowedScriptDomains){const Ce=(e.allowedScriptHostnames||[]).find(function(ve){return ve===Z.url.hostname}),Ae=(e.allowedScriptDomains||[]).find(function(ve){return Z.url.hostname===ve||Z.url.hostname.endsWith(`.${ve}`)});X=Ce||Ae}}catch{X=!1}if(!X){delete I.attribs[$];return}}if(w==="iframe"&&$==="src"){let X=!0;try{const Z=k(j);if(Z.isRelativeUrl)X=Yt(e,"allowIframeRelativeUrls")?e.allowIframeRelativeUrls:!e.allowedIframeHostnames&&!e.allowedIframeDomains;else if(e.allowedIframeHostnames||e.allowedIframeDomains){const Ce=(e.allowedIframeHostnames||[]).find(function(ve){return ve===Z.url.hostname}),Ae=(e.allowedIframeDomains||[]).find(function(ve){return Z.url.hostname===ve||Z.url.hostname.endsWith(`.${ve}`)});X=Ce||Ae}}catch{X=!1}if(!X){delete I.attribs[$];return}}if($==="srcset")try{let X=E3(j);if(X.forEach(function(Z){D("srcset",Z.url)&&(Z.evil=!0)}),X=Kd(X,function(Z){return!Z.evil}),X.length)j=D3(Kd(X,function(Z){return!Z.evil})),I.attribs[$]=j;else{delete I.attribs[$];return}}catch{delete I.attribs[$];return}if($==="class"){const X=c[w],Z=c["*"],Ce=h[w],Ae=f[w],ve=f["*"],ii=h["*"],dn=[Ce,ii].concat(Ae,ve).filter(function(hn){return hn});if(X&&Z?j=R(j,qd(X,Z),dn):j=R(j,X||Z,dn),!j.length){delete I.attribs[$];return}}if($==="style"){if(e.parseStyleAttributes)try{const X=N3(w+" {"+j+"}",{map:!1}),Z=v(X,e.allowedStyles);if(j=E(Z),j.length===0){delete I.attribs[$];return}}catch{typeof window<"u"&&console.warn('Failed to parse "'+w+" {"+j+`}", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547`),delete I.attribs[$];return}else if(e.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.")}r+=" "+$,j&&j.length?r+='="'+O(j,!0)+'"':e.allowedEmptyAttributes.includes($)&&(r+='=""')}else delete I.attribs[$]}),e.selfClosing.indexOf(w)!==-1?r+=" />":(r+=">",I.innerText&&!H&&!e.textFilter&&(r+=O(I.innerText),S=!0)),U&&(r=i+O(r),i=""),I.openingTagLength=r.length-I.tagPosition},ontext:function(w){if(_)return;const L=m[m.length-1];let I;if(L&&(I=L.tag,w=L.innerText!==void 0?L.innerText:w),e.disallowedTagsMode==="completelyDiscard"&&!o(I))w="";else if((e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&(I==="script"||I==="style"))r+=w;else if(!S){const U=O(w,!1);e.textFilter?r+=e.textFilter(U,I):r+=U}if(m.length){const U=m[m.length-1];U.text+=w}},onclosetag:function(w,L){if(e.onCloseTag&&e.onCloseTag(w,L),_)if(x--,!x)_=!1;else return;const I=m.pop();if(!I)return;if(I.tag!==w){m.push(I);return}_=e.enforceHtmlBoundary?w==="html":!1,b--;const U=p[b];if(U){if(delete p[b],e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){I.updateParentNodeText();return}i=r,r=""}if(y[b]&&(w=y[b],delete y[b]),e.exclusiveFilter){const H=e.exclusiveFilter(I);if(H==="excludeTag"){U&&(r=i,i=""),r=r.substring(0,I.tagPosition)+r.substring(I.tagPosition+I.openingTagLength);return}else if(H){r=r.substring(0,I.tagPosition);return}}if(I.updateParentNodeMediaChildren(),I.updateParentNodeText(),e.selfClosing.indexOf(w)!==-1||L&&!o(w)&&["escape","recursiveEscape"].indexOf(e.disallowedTagsMode)>=0){U&&(r=i,i="");return}r+="</"+w+">",U&&(r=i+O(r),i=""),S=!1}},e.parser);if(C.write(n),C.end(),e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape"){const w=C.endIndex;if(w!=null&&w>=0&&w<n.length){const L=n.substring(w);r+=O(L)}else(w==null||w<0)&&n.length>0&&r===""&&(r=O(n))}return r;function A(){r="",b=0,m=[],p={},y={},_=!1,x=0}function O(w,L){return typeof w!="string"&&(w=w+""),e.parser.decodeEntities&&(w=w.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),L&&(w=w.replace(/"/g,"&quot;"))),w=w.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),L&&(w=w.replace(/"/g,"&quot;")),w}function D(w,L){for(L=L.replace(/[\x00-\x20]+/g,"");;){const H=L.indexOf("<!--");if(H===-1)break;const V=L.indexOf("-->",H+4);if(V===-1)break;L=L.substring(0,H)+L.substring(V+3)}const I=L.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!I)return L.match(/^[/\\]{2}/)?!e.allowProtocolRelative:!1;const U=I[1].toLowerCase();return Yt(e.allowedSchemesByTag,w)?e.allowedSchemesByTag[w].indexOf(U)===-1:!e.allowedSchemes||e.allowedSchemes.indexOf(U)===-1}function k(w){if(w=w.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//"),w.startsWith("relative:"))throw new Error("relative: exploit attempt");let L="relative://relative-site";for(let H=0;H<100;H++)L+=`/${H}`;const I=new URL(w,L);return{isRelativeUrl:I&&I.hostname==="relative-site"&&I.protocol==="relative:",url:I}}function v(w,L){if(!L)return w;const I=w.nodes[0];let U;return L[I.selector]&&L["*"]?U=qd(L[I.selector],L["*"]):U=L[I.selector]||L["*"],U&&(w.nodes[0].nodes=I.nodes.reduce(N(U),[])),w}function E(w){return w.nodes[0].nodes.reduce(function(L,I){return L.push(`${I.prop}:${I.value}${I.important?" !important":""}`),L},[]).join(";")}function N(w){return function(L,I){return Yt(w,I.prop)&&w[I.prop].some(function(H){return H.test(I.value)})&&L.push(I),L}}function R(w,L,I){return L?(w=w.split(/\s+/),w.filter(function(U){return L.indexOf(U)!==-1||I.some(function(H){return H.test(U)})}).join(" ")):w}}const P3={decodeEntities:!0};Wi.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","menu","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0,preserveEscapedAttributes:!1};Wi.simpleTransform=function(n,e,t){return t=t===void 0?!0:t,e=e||{},function(r,i){let s;if(t)for(s in e)i[s]=e[s];else i=e;return{tagName:n,attribs:i}}};const Ku=c2(M3),tm=J();class fs extends cl{constructor(t,r,i,s,o,u,a){super(o);M(this,"__src");M(this,"__alt");M(this,"__width");M(this,"__height");M(this,"__soliboDocumentId");M(this,"__soliboDocumentSlot");this.__src=t,this.__alt=r,this.__width=i,this.__height=s,this.__soliboDocumentId=u,this.__soliboDocumentSlot=a}static getType(){return"image"}static clone(t){return new fs(t.__src,t.__alt,t.__width,t.__height,t.__key,t.__soliboDocumentId,t.__soliboDocumentSlot)}static importJSON(t){return jo({alt:t.alt,height:t.height,soliboDocumentId:t.soliboDocumentId,soliboDocumentSlot:t.soliboDocumentSlot,src:t.src,width:t.width})}exportJSON(){return{alt:this.__alt,height:this.__height,...this.__soliboDocumentId?{soliboDocumentId:this.__soliboDocumentId}:void 0,...this.__soliboDocumentSlot?{soliboDocumentSlot:this.__soliboDocumentSlot}:void 0,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:t=>({conversion:r=>{if(!(r instanceof HTMLImageElement))return null;const i=r.getAttribute("src")??"";if(!i)return null;const s=r.getAttribute("width"),o=r.getAttribute("height");return{node:jo({alt:r.getAttribute("alt")??"",height:o?Number(o):void 0,soliboDocumentId:r.getAttribute("data-solibo-document-id")??void 0,soliboDocumentSlot:r.getAttribute("data-solibo-document-slot")??void 0,src:i,width:s?Number(s):void 0})}},priority:0})}}exportDOM(){const t=document.createElement("img");return this.__soliboDocumentSlot||t.setAttribute("src",this.__src),this.__soliboDocumentId&&t.setAttribute("data-solibo-document-id",this.__soliboDocumentId),this.__soliboDocumentSlot&&t.setAttribute("data-solibo-document-slot",this.__soliboDocumentSlot),this.__alt&&t.setAttribute("alt",this.__alt),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),{element:t}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(t){const r=this.getWritable();return r.__src=t,r}setWidth(t){const r=this.getWritable();return r.__width=t,r.__height=void 0,r}decorate(t){return K.jsx("img",{alt:this.__alt,height:this.__height,"data-solibo-document-id":this.__soliboDocumentId,"data-solibo-document-slot":this.__soliboDocumentSlot,onClick:r=>{r.preventDefault(),t.dispatchCommand(tm,{key:this.getKey(),soliboDocumentSlot:this.__soliboDocumentSlot,src:this.__src,width:this.__width})},src:this.__src,width:this.__width})}}function jo({alt:n="",height:e,soliboDocumentId:t,soliboDocumentSlot:r,src:i,width:s}){return Kt(new fs(i,n,s,e,void 0,t,r))}function Wu(n){return n instanceof fs}const L3=({createImages:n})=>{const[e]=bt();return q.useEffect(()=>e.registerCommand(Ji,t=>{var o;if(!("clipboardData"in t))return!1;const r=t,i=Array.from(((o=r.clipboardData)==null?void 0:o.items)??[]).flatMap(u=>{if(u.kind!=="file"||!u.type.startsWith("image/"))return[];const a=u.getAsFile();return a?[a]:[]});if(i.length===0)return!1;r.preventDefault();const s=n(i);return e.update(()=>{Ho(s.map(u=>jo(u)))}),!0},Z1),[n,e]),null},R3=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,F3=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,B3=[n=>{const e=R3.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:`mailto:${e[0]}`}:null},n=>{const e=F3.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:e[0].startsWith("http")?e[0]:`https://${e[0]}`}:null}];function Va(n){try{const e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}const j3="_field_1mb0i_3",$3="_editor_1mb0i_8",U3="_invalid_1mb0i_46",z3="_error_1mb0i_50",q3="_dragging_1mb0i_56",K3="_content_1mb0i_60",W3="_files_1mb0i_66",H3="_placeholder_1mb0i_74",V3="_fill_1mb0i_82",G3="_meta_1mb0i_105",J3="_active_1mb0i_114",X3="_submit_1mb0i_133",Y3="_bold_1mb0i_137",Q3="_italic_1mb0i_141",Z3="_underline_1mb0i_145",e6="_link_1mb0i_149",t6="_list_1mb0i_155",n6="_paragraph_1mb0i_156",Ne={field:j3,editor:$3,"has-files":"_has-files_1mb0i_42",invalid:U3,error:z3,dragging:q3,content:K3,files:W3,placeholder:H3,fill:V3,"fill-editor":"_fill-editor_1mb0i_89",meta:G3,active:J3,"image-sizes":"_image-sizes_1mb0i_126",submit:X3,bold:Y3,italic:Q3,underline:Z3,link:e6,list:t6,paragraph:n6},r6=[{label:"Small",width:320},{label:"Medium",width:640},{label:"Large",width:960},{label:"Original",width:void 0}],i6=({disabled:n=!1,isSubmitting:e=!1,onFilesSelected:t,onInlineImageRemove:r,onSubmit:i,submitLabel:s="Submit"})=>{const[o]=bt(),[u,a]=q.useState(!1),[l,c]=q.useState(!1),[h,f]=q.useState(!1),[d,g]=q.useState(!1),[b,m]=q.useState(!1),[p,y]=q.useState(!1),[_,x]=q.useState(""),[S,C]=q.useState(null),[A,O]=q.useState(null),[D,k]=q.useState(void 0),[v,E]=q.useState(""),N=Va(v.trim()),R=q.useRef(null),w=q.useRef(null),L=q.useRef(null),I=q.useRef(null),U=q.useRef(!1),H=W=>W.preventDefault(),V=q.useCallback(W=>{I.current=F(W)?W.clone():null},[]),te=q.useCallback(W=>{o.update(()=>{I.current&&Me(I.current),W()}),I.current=null},[o]),ge=W=>{U.current=!0,W.preventDefault()},j=()=>{if(U.current){U.current=!1;return}Ae()},$=q.useCallback(()=>{c(!1),x(""),C(null),O(null),k(void 0)},[]),G=q.useCallback(()=>{m(!1),E("")},[]),X=q.useCallback(W=>{c(!0),x((W==null?void 0:W.src)??""),C((W==null?void 0:W.key)??null),O((W==null?void 0:W.soliboDocumentSlot)??null),k(W==null?void 0:W.width),G(),W!=null&&W.soliboDocumentSlot||setTimeout(()=>{var Q;return(Q=w.current)==null?void 0:Q.focus()},0)},[G]),Z=q.useCallback(W=>{o.getEditorState().read(()=>{V(z())}),m(!0),E(W),$(),setTimeout(()=>{var Q;return(Q=L.current)==null?void 0:Q.focus()},0)},[$,o,V]),Ce=q.useCallback(()=>{const W=v.trim();Va(W)&&(te(()=>{o.dispatchCommand(Dr,{url:W,target:"_blank"});const Q=z();if(!F(Q))return;const be=Q.getNodes().at(-1)??null,Le=(be==null?void 0:be.getParent())??null,Fe=Je(be)?be:Je(Le)?Le:null;if(Fe){const it=Fe.getLastChild();if(B(it)){const ic=it.getTextContent(),sc=ic.replace(/\s+$/,"");sc!==ic&&it.setTextContent(sc)}const mr=Fe.getNextSibling();if(B(mr)&&/^\s/.test(mr.getTextContent())){mr.select(1,1);return}const Nt=Xe(" ");Fe.insertAfter(Nt),Nt.selectEnd()}}),G())},[G,o,v,te]),Ae=q.useCallback(()=>{const W=_.trim();if(!W){$();return}o.update(()=>{if(S){const Q=he(S);Wu(Q)&&Q.setSrc(W);return}Ho([jo({src:W})])}),$()},[$,o,S,_]),ve=q.useCallback(()=>{if(!S){$();return}o.update(()=>{const W=he(S);if(Wu(W)){const Q=W.getParent();Zi(Q)&&Q.getChildrenSize()===1?Q.remove():W.remove(),A&&(r==null||r(A))}}),$()},[$,o,S,A,r]),ii=q.useCallback(W=>{S&&(o.update(()=>{const Q=he(S);Wu(Q)&&Q.setWidth(W)}),k(W))},[o,S]),dn=q.useCallback(()=>{te(()=>{o.dispatchCommand(Dr,null)}),G()},[G,o,te]),hn=q.useCallback(()=>{const W=z();if(!F(W)){if(_e(W)){const Le=W.getNodes(),Fe=Le[0]??null,it=(Fe==null?void 0:Fe.getParent())??null;a(Le.some(Nt=>B(Nt)&&Nt.hasFormat("bold"))),f(Le.some(Nt=>B(Nt)&&Nt.hasFormat("italic"))),g(Le.some(Nt=>B(Nt)&&Nt.hasFormat("underline"))),y(ne(it)||ue(it)||ne(Fe)||ue(Fe));const mr=Je(Fe)?Fe:Je(it)?it:null;if(mr){m(!0),E(mr.getURL());return}m(!1),E(""),I.current=null;return}a(!1),f(!1),g(!1),y(!1),m(!1),E(""),I.current=null;return}const[Q]=W.getNodes(),be=(Q==null?void 0:Q.getParent())??null;if(a(W.hasFormat("bold")),f(W.hasFormat("italic")),g(W.hasFormat("underline")),y(ne(be)||ue(be)),Je(be)){m(!0),E(be.getURL()),V(W);return}m(!1),E(""),I.current=null},[V]);return q.useEffect(()=>mt(o.registerUpdateListener(({editorState:W})=>{W.read(()=>{hn()})}),o.registerCommand(tm,W=>(X(W),!0),Zt),o.registerCommand(zo,()=>(o.getEditorState().read(()=>{hn()}),!1),Zt)),[o,X,hn]),K.jsxs(sm.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[K.jsx(yt.Button,{"aria-label":"Bold","data-active":u,onClick:()=>{o.dispatchCommand(Ot,"bold")},title:"Bold",variant:"tertiary",children:K.jsx(Lt.Icon,{name:"TextB"})}),K.jsx(yt.Button,{"aria-label":"Italic","data-active":h,onClick:()=>{o.dispatchCommand(Ot,"italic")},title:"Italic",variant:"tertiary",children:K.jsx(Lt.Icon,{name:"TextItalic"})}),K.jsx(yt.Button,{"aria-label":"Underline","data-active":d,onClick:()=>{o.dispatchCommand(Ot,"underline")},title:"Underline",variant:"tertiary",children:K.jsx(Lt.Icon,{name:"TextUnderline"})}),K.jsx(yt.Button,{"aria-label":"List","data-active":p,onClick:()=>{p?o.dispatchCommand(Dg,void 0):o.dispatchCommand(Og,void 0)},title:"List",variant:"tertiary",children:K.jsx(Lt.Icon,{name:"ListBullets"})}),K.jsx(yt.Button,{"aria-label":"Link","data-active":b,onClick:()=>{b?Z(v):(o.dispatchCommand(Dr,{url:"https://"}),Z("https://"))},title:"Link",variant:"tertiary",children:K.jsx(Lt.Icon,{name:"Link"})}),t&&K.jsxs(K.Fragment,{children:[K.jsx("input",{hidden:!0,multiple:!0,onChange:W=>{W.target.files&&t(W.target.files),W.target.value=""},ref:R,type:"file"}),K.jsx(yt.Button,{"aria-label":"Upload files",onClick:()=>{var W;return(W=R.current)==null?void 0:W.click()},title:"Upload files",variant:"tertiary",children:K.jsx(Lt.Icon,{name:"Paperclip"})})]}),i&&K.jsx(yt.Button,{"aria-label":s,className:Ne.submit,"data-cy":"toolbar-submit-button",disabled:n,icon:"PaperPlaneTilt",isLoading:e,onClick:()=>i(),variant:"primary",children:K.jsx("span",{children:s})}),K.jsxs("div",{className:hi.t(Ne.meta,b||l?Ne.active:""),children:[b&&K.jsxs(K.Fragment,{children:[K.jsx(oc.Input,{"aria-invalid":!N,onBlur:()=>Ce(),onChange:W=>E(W.target.value),onKeyDown:W=>{W.key==="Enter"&&(W.preventDefault(),Ce())},ref:L,value:v}),K.jsx(yt.Button,{"aria-label":"Apply link",disabled:!N,onClick:()=>{Ce()},onMouseDown:H,variant:"tertiary",children:K.jsx(Lt.Icon,{name:"Check"})}),K.jsx(yt.Button,{"aria-label":"Remove link",onClick:()=>dn(),onMouseDown:H,variant:"tertiary",children:K.jsx(Lt.Icon,{name:"Trash",variant:"danger"})})]}),l&&K.jsxs(K.Fragment,{children:[!A&&K.jsxs(K.Fragment,{children:[K.jsx(oc.Input,{className:hi.t(Ne.active),onBlur:j,onChange:W=>x(W.target.value),onKeyDown:W=>{W.key==="Enter"&&(W.preventDefault(),U.current=!0,Ae())},ref:w,value:_}),K.jsx(yt.Button,{"aria-label":"Apply image",onClick:()=>Ae(),onMouseDown:ge,variant:"tertiary",children:K.jsx(Lt.Icon,{name:"Check"})})]}),K.jsx("div",{className:Ne["image-sizes"],children:r6.map(({label:W,width:Q})=>K.jsx(yt.Button,{"aria-label":`${W} image`,"data-active":D===Q,onClick:()=>ii(Q),onMouseDown:H,variant:"tertiary",children:W},W))}),K.jsx(yt.Button,{"aria-label":"Remove image",onClick:()=>ve(),onMouseDown:ge,variant:"tertiary",children:K.jsx(Lt.Icon,{name:"Trash",variant:"danger"})})]})]})]})},s6={name:"solibo-editor",namespace:"Editor",nodes:[ru,rr,is,ni,fs],onError(n){throw n},theme:{link:Ne.link,list:{ol:Ne.list,ul:Ne.list},paragraph:Ne.paragraph,text:{bold:Ne.bold,italic:Ne.italic,underline:Ne.underline}}};function o6({autofocus:n,content:e="",lastEmittedContentRef:t}){const[r]=bt();return q.useEffect(()=>{t.current!==e&&r.update(()=>{const s=new DOMParser().parseFromString(e,"text/html"),o=pg(r,s),u=we();u.clear().select(),Ho(o),n?u.selectEnd():Me(null)})},[n,e,r,t]),null}const u6=({autofocus:n=!1,autolink:e=!1,content:t,disabled:r=!1,errorMessage:i,fill:s=!1,files:o,inline:u=!1,inlineImages:a,invalid:l=!1,isSubmitting:c=!1,maxRows:h=12,minRows:f=1,onChange:d,onFilesChange:g,onInlineImagesChange:b,onSubmit:m,onUpload:p,placeholder:y,required:_=!1,submitLabel:x})=>{const S=q.useId(),C=q.useRef(void 0),[A,O]=q.useState(!1),[D,k]=q.useState([]),[v,E]=q.useState([]),N=q.useRef(new Map),R=o??D,w=a??v,L=j=>{o===void 0&&k(j),g==null||g(j)},I=q.useCallback(j=>{a===void 0&&E(j),b==null||b(j)},[a,b]),U=q.useCallback(j=>{const $=j.map(G=>{const X=`pasted-${crypto.randomUUID()}`,Z=URL.createObjectURL(G);return N.current.set(X,Z),{image:{alt:G.name,soliboDocumentSlot:X,src:Z},pending:{file:G,slot:X}}});return I([...w,...$.map(({pending:G})=>G)]),$.map(({image:G})=>G)},[w,I]),H=q.useCallback(j=>{I(w.filter(G=>G.slot!==j));const $=N.current.get(j);$&&URL.revokeObjectURL($),N.current.delete(j)},[w,I]);q.useEffect(()=>()=>{N.current.forEach(j=>URL.revokeObjectURL(j)),N.current.clear()},[]),q.useEffect(()=>{const j=new Set(w.map($=>$.slot));N.current.forEach(($,G)=>{j.has(G)||(URL.revokeObjectURL($),N.current.delete(G))})},[w]);const V=j=>{if(typeof DataTransfer<"u"){const $=new DataTransfer;return j.forEach(G=>$.items.add(G)),$.files}return Object.assign([...j],{item:$=>j[$]??null})},te=async()=>{try{R.length>0&&await(p==null?void 0:p(V(R))),await(m==null?void 0:m()),R.length>0&&L([])}catch{return}},ge=j=>{j.preventDefault(),j.stopPropagation()};return K.jsxs("div",{className:hi.t(Ne.field,s&&Ne.fill),"data-component":"editor","data-max-rows":h,"data-min-rows":f,onDragEnter:j=>{ge(j),O(!!g)},onDragOver:j=>{ge(j),O(!!g)},onDragLeave:j=>{ge(j),O(!1)},onDrop:j=>{var G;j.preventDefault();const $=(G=j.dataTransfer)==null?void 0:G.files;$&&(g==null||g(Array.from($))),O(!1)},children:[K.jsx("div",{className:hi.t(Ne.editor,s&&Ne["fill-editor"],l&&Ne.invalid,R.length>0&&Ne["has-files"]),style:{"--editor-max-height":`calc(${h*1.25}em + (2 * var(--scale-8)))`,"--editor-min-height":`calc(${f*1.25}em + (2 * var(--scale-8)))`},children:K.jsxs(w_,{contentEditable:null,extension:s6,children:[!u&&K.jsx(i6,{disabled:r,isSubmitting:c,onInlineImageRemove:H,onFilesSelected:p||g?j=>{L([...R,...Array.from(j)])}:void 0,onSubmit:m?()=>void te():void 0,submitLabel:x}),K.jsx("div",{className:hi.t(Ne.content,A&&Ne.dragging),children:K.jsx(a2,{contentEditable:K.jsx(Pg,{"aria-placeholder":y??"",ariaErrorMessage:l&&i?S:void 0,ariaInvalid:l||void 0,ariaRequired:_||void 0,placeholder:()=>y?K.jsx("div",{className:Ne.placeholder,children:y}):null}),ErrorBoundary:Lg})}),R.length>0&&K.jsx("div",{"aria-label":"Files to upload",className:Ne.files,role:"region",children:R.map((j,$)=>K.jsx(im.File,{deleteAccessibleLabel:`Remove ${j.name} from upload queue`,name:j.name,onDelete:()=>L(R.filter((G,X)=>X!==$))},`${j.name}-${j.size}-${j.lastModified}-${$}`))}),n&&K.jsx(f_,{}),e&&K.jsx(d_,{matchers:B3}),K.jsx(N_,{}),b&&K.jsx(L3,{createImages:U}),t!==void 0&&K.jsx(o6,{autofocus:n,content:t,lastEmittedContentRef:C}),K.jsx(k_,{validateUrl:Va}),K.jsx(A_,{}),d&&K.jsx(D_,{onChange:(j,$)=>{j.read(()=>{const G=mg($,null),X=Ku(G,{allowedAttributes:{...Ku.defaults.allowedAttributes,img:[...Ku.defaults.allowedAttributes.img??[],"data-solibo-document-id","data-solibo-document-slot"]},allowedTags:["a","b","br","i","img","li","ol","p","u","ul"]});C.current=X,d(X)})}})]})}),l&&i&&K.jsx("div",{className:Ne.error,id:S,children:i})]})};exports.Editor=u6;
55
+ `)});const u=e.nonTextTags||["script","style","textarea","option"];let a,l;e.allowedAttributes&&(a={},l={},xr(e.allowedAttributes,function(w,L){a[L]=[];const I=[];w.forEach(function(U){typeof U=="string"&&U.indexOf("*")>=0?I.push(zd(U).replace(/\\\*/g,".*")):a[L].push(U)}),I.length&&(l[L]=new RegExp("^("+I.join("|")+")$"))}));const c={},h={},f={};xr(e.allowedClasses,function(w,L){if(a&&(Yt(a,L)||(a[L]=[]),a[L].push("class")),c[L]=w,Array.isArray(w)){const I=[];c[L]=[],f[L]=[],w.forEach(function(U){typeof U=="string"&&U.indexOf("*")>=0?I.push(zd(U).replace(/\\\*/g,".*")):U instanceof RegExp?f[L].push(U):c[L].push(U)}),I.length&&(h[L]=new RegExp("^("+I.join("|")+")$"))}});const d={};let g;xr(e.transformTags,function(w,L){let I;typeof w=="function"?I=w:typeof w=="string"&&(I=Wi.simpleTransform(w)),L==="*"?g=I:d[L]=I});let b,m,p,y,_,x,S=!1;A();const C=new C3.Parser({onopentag:function(w,L){if(e.onOpenTag&&e.onOpenTag(w,L),e.enforceHtmlBoundary&&w==="html"&&A(),_){x++;return}const I=new s(w,L);m.push(I);let U=!1;const H=!!I.text;let V;if(Yt(d,w)&&(V=d[w](w,L),I.attribs=L=V.attribs,V.text!==void 0&&(I.innerText=V.text),w!==V.tagName&&(I.name=w=V.tagName,y[b]=V.tagName)),g&&(V=g(w,L),I.attribs=L=V.attribs,w!==V.tagName&&(I.name=w=V.tagName,y[b]=V.tagName)),(!o(w)||e.disallowedTagsMode==="recursiveEscape"&&!O3(p)||e.nestingLimit!=null&&b>=e.nestingLimit)&&(U=!0,p[b]=!0,(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&u.indexOf(w)!==-1&&(_=!0,x=1)),b++,U){if(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){if(I.innerText&&!H){const j=O(I.innerText);e.textFilter?r+=e.textFilter(j,w):r+=j,S=!0}return}i=r,r=""}r+="<"+w,w==="script"&&(e.allowedScriptHostnames||e.allowedScriptDomains)&&(I.innerText=""),U&&(e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape")&&e.preserveEscapedAttributes?xr(L,function(j,$){r+=" "+$+'="'+O(j||"",!0)+'"'}):(!a||Yt(a,w)||a["*"])&&xr(L,function(j,$){if(!I3.test($)){delete I.attribs[$];return}if(j===""&&!e.allowedEmptyAttributes.includes($)&&(e.nonBooleanAttributes.includes($)||e.nonBooleanAttributes.includes("*"))){delete I.attribs[$];return}let G=!1;if(!a||Yt(a,w)&&a[w].indexOf($)!==-1||a["*"]&&a["*"].indexOf($)!==-1||Yt(l,w)&&l[w].test($)||l["*"]&&l["*"].test($))G=!0;else if(a&&a[w]){for(const X of a[w])if(T3(X)&&X.name&&X.name===$){G=!0;let Z="";if(X.multiple===!0){const Ce=j.split(" ");for(const Ae of Ce)X.values.indexOf(Ae)!==-1&&(Z===""?Z=Ae:Z+=" "+Ae)}else X.values.indexOf(j)>=0&&(Z=j);j=Z}}if(G){if(e.allowedSchemesAppliedToAttributes.indexOf($)!==-1&&D(w,j)){delete I.attribs[$];return}if(w==="script"&&$==="src"){let X=!0;try{const Z=k(j);if(e.allowedScriptHostnames||e.allowedScriptDomains){const Ce=(e.allowedScriptHostnames||[]).find(function(ve){return ve===Z.url.hostname}),Ae=(e.allowedScriptDomains||[]).find(function(ve){return Z.url.hostname===ve||Z.url.hostname.endsWith(`.${ve}`)});X=Ce||Ae}}catch{X=!1}if(!X){delete I.attribs[$];return}}if(w==="iframe"&&$==="src"){let X=!0;try{const Z=k(j);if(Z.isRelativeUrl)X=Yt(e,"allowIframeRelativeUrls")?e.allowIframeRelativeUrls:!e.allowedIframeHostnames&&!e.allowedIframeDomains;else if(e.allowedIframeHostnames||e.allowedIframeDomains){const Ce=(e.allowedIframeHostnames||[]).find(function(ve){return ve===Z.url.hostname}),Ae=(e.allowedIframeDomains||[]).find(function(ve){return Z.url.hostname===ve||Z.url.hostname.endsWith(`.${ve}`)});X=Ce||Ae}}catch{X=!1}if(!X){delete I.attribs[$];return}}if($==="srcset")try{let X=E3(j);if(X.forEach(function(Z){D("srcset",Z.url)&&(Z.evil=!0)}),X=Kd(X,function(Z){return!Z.evil}),X.length)j=D3(Kd(X,function(Z){return!Z.evil})),I.attribs[$]=j;else{delete I.attribs[$];return}}catch{delete I.attribs[$];return}if($==="class"){const X=c[w],Z=c["*"],Ce=h[w],Ae=f[w],ve=f["*"],ii=h["*"],dn=[Ce,ii].concat(Ae,ve).filter(function(hn){return hn});if(X&&Z?j=R(j,qd(X,Z),dn):j=R(j,X||Z,dn),!j.length){delete I.attribs[$];return}}if($==="style"){if(e.parseStyleAttributes)try{const X=N3(w+" {"+j+"}",{map:!1}),Z=v(X,e.allowedStyles);if(j=E(Z),j.length===0){delete I.attribs[$];return}}catch{typeof window<"u"&&console.warn('Failed to parse "'+w+" {"+j+`}", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547`),delete I.attribs[$];return}else if(e.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.")}r+=" "+$,j&&j.length?r+='="'+O(j,!0)+'"':e.allowedEmptyAttributes.includes($)&&(r+='=""')}else delete I.attribs[$]}),e.selfClosing.indexOf(w)!==-1?r+=" />":(r+=">",I.innerText&&!H&&!e.textFilter&&(r+=O(I.innerText),S=!0)),U&&(r=i+O(r),i=""),I.openingTagLength=r.length-I.tagPosition},ontext:function(w){if(_)return;const L=m[m.length-1];let I;if(L&&(I=L.tag,w=L.innerText!==void 0?L.innerText:w),e.disallowedTagsMode==="completelyDiscard"&&!o(I))w="";else if((e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&(I==="script"||I==="style"))r+=w;else if(!S){const U=O(w,!1);e.textFilter?r+=e.textFilter(U,I):r+=U}if(m.length){const U=m[m.length-1];U.text+=w}},onclosetag:function(w,L){if(e.onCloseTag&&e.onCloseTag(w,L),_)if(x--,!x)_=!1;else return;const I=m.pop();if(!I)return;if(I.tag!==w){m.push(I);return}_=e.enforceHtmlBoundary?w==="html":!1,b--;const U=p[b];if(U){if(delete p[b],e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){I.updateParentNodeText();return}i=r,r=""}if(y[b]&&(w=y[b],delete y[b]),e.exclusiveFilter){const H=e.exclusiveFilter(I);if(H==="excludeTag"){U&&(r=i,i=""),r=r.substring(0,I.tagPosition)+r.substring(I.tagPosition+I.openingTagLength);return}else if(H){r=r.substring(0,I.tagPosition);return}}if(I.updateParentNodeMediaChildren(),I.updateParentNodeText(),e.selfClosing.indexOf(w)!==-1||L&&!o(w)&&["escape","recursiveEscape"].indexOf(e.disallowedTagsMode)>=0){U&&(r=i,i="");return}r+="</"+w+">",U&&(r=i+O(r),i=""),S=!1}},e.parser);if(C.write(n),C.end(),e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape"){const w=C.endIndex;if(w!=null&&w>=0&&w<n.length){const L=n.substring(w);r+=O(L)}else(w==null||w<0)&&n.length>0&&r===""&&(r=O(n))}return r;function A(){r="",b=0,m=[],p={},y={},_=!1,x=0}function O(w,L){return typeof w!="string"&&(w=w+""),e.parser.decodeEntities&&(w=w.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),L&&(w=w.replace(/"/g,"&quot;"))),w=w.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),L&&(w=w.replace(/"/g,"&quot;")),w}function D(w,L){for(L=L.replace(/[\x00-\x20]+/g,"");;){const H=L.indexOf("<!--");if(H===-1)break;const V=L.indexOf("-->",H+4);if(V===-1)break;L=L.substring(0,H)+L.substring(V+3)}const I=L.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!I)return L.match(/^[/\\]{2}/)?!e.allowProtocolRelative:!1;const U=I[1].toLowerCase();return Yt(e.allowedSchemesByTag,w)?e.allowedSchemesByTag[w].indexOf(U)===-1:!e.allowedSchemes||e.allowedSchemes.indexOf(U)===-1}function k(w){if(w=w.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//"),w.startsWith("relative:"))throw new Error("relative: exploit attempt");let L="relative://relative-site";for(let H=0;H<100;H++)L+=`/${H}`;const I=new URL(w,L);return{isRelativeUrl:I&&I.hostname==="relative-site"&&I.protocol==="relative:",url:I}}function v(w,L){if(!L)return w;const I=w.nodes[0];let U;return L[I.selector]&&L["*"]?U=qd(L[I.selector],L["*"]):U=L[I.selector]||L["*"],U&&(w.nodes[0].nodes=I.nodes.reduce(N(U),[])),w}function E(w){return w.nodes[0].nodes.reduce(function(L,I){return L.push(`${I.prop}:${I.value}${I.important?" !important":""}`),L},[]).join(";")}function N(w){return function(L,I){return Yt(w,I.prop)&&w[I.prop].some(function(H){return H.test(I.value)})&&L.push(I),L}}function R(w,L,I){return L?(w=w.split(/\s+/),w.filter(function(U){return L.indexOf(U)!==-1||I.some(function(H){return H.test(U)})}).join(" ")):w}}const P3={decodeEntities:!0};Wi.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","menu","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0,preserveEscapedAttributes:!1};Wi.simpleTransform=function(n,e,t){return t=t===void 0?!0:t,e=e||{},function(r,i){let s;if(t)for(s in e)i[s]=e[s];else i=e;return{tagName:n,attribs:i}}};const Ku=c2(M3),tm=J();class fs extends cl{constructor(t,r,i,s,o,u,a){super(o);M(this,"__src");M(this,"__alt");M(this,"__width");M(this,"__height");M(this,"__soliboDocumentId");M(this,"__soliboDocumentSlot");this.__src=t,this.__alt=r,this.__width=i,this.__height=s,this.__soliboDocumentId=u,this.__soliboDocumentSlot=a}static getType(){return"image"}static clone(t){return new fs(t.__src,t.__alt,t.__width,t.__height,t.__key,t.__soliboDocumentId,t.__soliboDocumentSlot)}static importJSON(t){return jo({alt:t.alt,height:t.height,soliboDocumentId:t.soliboDocumentId,soliboDocumentSlot:t.soliboDocumentSlot,src:t.src,width:t.width})}exportJSON(){return{alt:this.__alt,height:this.__height,...this.__soliboDocumentId?{soliboDocumentId:this.__soliboDocumentId}:void 0,...this.__soliboDocumentSlot?{soliboDocumentSlot:this.__soliboDocumentSlot}:void 0,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:t=>({conversion:r=>{if(!(r instanceof HTMLImageElement))return null;const i=r.getAttribute("src")??"";if(!i)return null;const s=r.getAttribute("width"),o=r.getAttribute("height");return{node:jo({alt:r.getAttribute("alt")??"",height:o?Number(o):void 0,soliboDocumentId:r.getAttribute("data-solibo-document-id")??void 0,soliboDocumentSlot:r.getAttribute("data-solibo-document-slot")??void 0,src:i,width:s?Number(s):void 0})}},priority:0})}}exportDOM(){const t=document.createElement("img");return this.__soliboDocumentSlot||t.setAttribute("src",this.__src),this.__soliboDocumentId&&t.setAttribute("data-solibo-document-id",this.__soliboDocumentId),this.__soliboDocumentSlot&&t.setAttribute("data-solibo-document-slot",this.__soliboDocumentSlot),this.__alt&&t.setAttribute("alt",this.__alt),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),{element:t}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(t){const r=this.getWritable();return r.__src=t,r}setWidth(t){const r=this.getWritable();return r.__width=t,r.__height=void 0,r}decorate(t){return K.jsx("img",{alt:this.__alt,height:this.__height,"data-solibo-document-id":this.__soliboDocumentId,"data-solibo-document-slot":this.__soliboDocumentSlot,onClick:r=>{r.preventDefault(),t.dispatchCommand(tm,{key:this.getKey(),soliboDocumentSlot:this.__soliboDocumentSlot,src:this.__src,width:this.__width})},src:this.__src,width:this.__width})}}function jo({alt:n="",height:e,soliboDocumentId:t,soliboDocumentSlot:r,src:i,width:s}){return Kt(new fs(i,n,s,e,void 0,t,r))}function Wu(n){return n instanceof fs}const L3=({createImages:n})=>{const[e]=bt();return q.useEffect(()=>e.registerCommand(Ji,t=>{var o;if(!("clipboardData"in t))return!1;const r=t,i=Array.from(((o=r.clipboardData)==null?void 0:o.items)??[]).flatMap(u=>{if(u.kind!=="file"||!u.type.startsWith("image/"))return[];const a=u.getAsFile();return a?[a]:[]});if(i.length===0)return!1;r.preventDefault();const s=n(i);return e.update(()=>{Ho(s.map(u=>jo(u)))}),!0},Z1),[n,e]),null},R3=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,F3=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,B3=[n=>{const e=R3.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:`mailto:${e[0]}`}:null},n=>{const e=F3.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:e[0].startsWith("http")?e[0]:`https://${e[0]}`}:null}];function Va(n){try{const e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}const j3="_field_1mb0i_3",$3="_editor_1mb0i_8",U3="_invalid_1mb0i_46",z3="_error_1mb0i_50",q3="_dragging_1mb0i_56",K3="_content_1mb0i_60",W3="_files_1mb0i_66",H3="_placeholder_1mb0i_74",V3="_fill_1mb0i_82",G3="_meta_1mb0i_105",J3="_active_1mb0i_114",X3="_submit_1mb0i_133",Y3="_bold_1mb0i_137",Q3="_italic_1mb0i_141",Z3="_underline_1mb0i_145",e6="_link_1mb0i_149",t6="_list_1mb0i_155",n6="_paragraph_1mb0i_156",Ne={field:j3,editor:$3,"has-files":"_has-files_1mb0i_42",invalid:U3,error:z3,dragging:q3,content:K3,files:W3,placeholder:H3,fill:V3,"fill-editor":"_fill-editor_1mb0i_89",meta:G3,active:J3,"image-sizes":"_image-sizes_1mb0i_126",submit:X3,bold:Y3,italic:Q3,underline:Z3,link:e6,list:t6,paragraph:n6},r6=[{label:"Small",width:320},{label:"Medium",width:640},{label:"Large",width:960},{label:"Original",width:void 0}],i6=({disabled:n=!1,isSubmitting:e=!1,onFilesSelected:t,onInlineImageRemove:r,onSubmit:i,submitLabel:s="Submit"})=>{const[o]=bt(),[u,a]=q.useState(!1),[l,c]=q.useState(!1),[h,f]=q.useState(!1),[d,g]=q.useState(!1),[b,m]=q.useState(!1),[p,y]=q.useState(!1),[_,x]=q.useState(""),[S,C]=q.useState(null),[A,O]=q.useState(null),[D,k]=q.useState(void 0),[v,E]=q.useState(""),N=Va(v.trim()),R=q.useRef(null),w=q.useRef(null),L=q.useRef(null),I=q.useRef(null),U=q.useRef(!1),H=W=>W.preventDefault(),V=q.useCallback(W=>{I.current=F(W)?W.clone():null},[]),te=q.useCallback(W=>{o.update(()=>{I.current&&Me(I.current),W()}),I.current=null},[o]),ge=W=>{U.current=!0,W.preventDefault()},j=()=>{if(U.current){U.current=!1;return}Ae()},$=q.useCallback(()=>{c(!1),x(""),C(null),O(null),k(void 0)},[]),G=q.useCallback(()=>{m(!1),E("")},[]),X=q.useCallback(W=>{c(!0),x((W==null?void 0:W.src)??""),C((W==null?void 0:W.key)??null),O((W==null?void 0:W.soliboDocumentSlot)??null),k(W==null?void 0:W.width),G(),W!=null&&W.soliboDocumentSlot||setTimeout(()=>{var Q;return(Q=w.current)==null?void 0:Q.focus()},0)},[G]),Z=q.useCallback(W=>{o.getEditorState().read(()=>{V(z())}),m(!0),E(W),$(),setTimeout(()=>{var Q;return(Q=L.current)==null?void 0:Q.focus()},0)},[$,o,V]),Ce=q.useCallback(()=>{const W=v.trim();Va(W)&&(te(()=>{o.dispatchCommand(Dr,{url:W,target:"_blank"});const Q=z();if(!F(Q))return;const be=Q.getNodes().at(-1)??null,Le=(be==null?void 0:be.getParent())??null,Fe=Je(be)?be:Je(Le)?Le:null;if(Fe){const it=Fe.getLastChild();if(B(it)){const ic=it.getTextContent(),sc=ic.replace(/\s+$/,"");sc!==ic&&it.setTextContent(sc)}const mr=Fe.getNextSibling();if(B(mr)&&/^\s/.test(mr.getTextContent())){mr.select(1,1);return}const Nt=Xe(" ");Fe.insertAfter(Nt),Nt.selectEnd()}}),G())},[G,o,v,te]),Ae=q.useCallback(()=>{const W=_.trim();if(!W){$();return}o.update(()=>{if(S){const Q=he(S);Wu(Q)&&Q.setSrc(W);return}Ho([jo({src:W})])}),$()},[$,o,S,_]),ve=q.useCallback(()=>{if(!S){$();return}o.update(()=>{const W=he(S);if(Wu(W)){const Q=W.getParent();Zi(Q)&&Q.getChildrenSize()===1?Q.remove():W.remove(),A&&(r==null||r(A))}}),$()},[$,o,S,A,r]),ii=q.useCallback(W=>{S&&(o.update(()=>{const Q=he(S);Wu(Q)&&Q.setWidth(W)}),k(W))},[o,S]),dn=q.useCallback(()=>{te(()=>{o.dispatchCommand(Dr,null)}),G()},[G,o,te]),hn=q.useCallback(()=>{const W=z();if(!F(W)){if(_e(W)){const Le=W.getNodes(),Fe=Le[0]??null,it=(Fe==null?void 0:Fe.getParent())??null;a(Le.some(Nt=>B(Nt)&&Nt.hasFormat("bold"))),f(Le.some(Nt=>B(Nt)&&Nt.hasFormat("italic"))),g(Le.some(Nt=>B(Nt)&&Nt.hasFormat("underline"))),y(ne(it)||ue(it)||ne(Fe)||ue(Fe));const mr=Je(Fe)?Fe:Je(it)?it:null;if(mr){m(!0),E(mr.getURL());return}m(!1),E(""),I.current=null;return}a(!1),f(!1),g(!1),y(!1),m(!1),E(""),I.current=null;return}const[Q]=W.getNodes(),be=(Q==null?void 0:Q.getParent())??null;if(a(W.hasFormat("bold")),f(W.hasFormat("italic")),g(W.hasFormat("underline")),y(ne(be)||ue(be)),Je(be)){m(!0),E(be.getURL()),V(W);return}m(!1),E(""),I.current=null},[V]);return q.useEffect(()=>mt(o.registerUpdateListener(({editorState:W})=>{W.read(()=>{hn()})}),o.registerCommand(tm,W=>(X(W),!0),Zt),o.registerCommand(zo,()=>(o.getEditorState().read(()=>{hn()}),!1),Zt)),[o,X,hn]),K.jsxs(sm.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[K.jsx(yt.Button,{"aria-label":"Bold","data-active":u,onClick:()=>{o.dispatchCommand(Ot,"bold")},title:"Bold",variant:"tertiary",children:K.jsx(Lt.Icon,{name:"TextB"})}),K.jsx(yt.Button,{"aria-label":"Italic","data-active":h,onClick:()=>{o.dispatchCommand(Ot,"italic")},title:"Italic",variant:"tertiary",children:K.jsx(Lt.Icon,{name:"TextItalic"})}),K.jsx(yt.Button,{"aria-label":"Underline","data-active":d,onClick:()=>{o.dispatchCommand(Ot,"underline")},title:"Underline",variant:"tertiary",children:K.jsx(Lt.Icon,{name:"TextUnderline"})}),K.jsx(yt.Button,{"aria-label":"List","data-active":p,onClick:()=>{p?o.dispatchCommand(Dg,void 0):o.dispatchCommand(Og,void 0)},title:"List",variant:"tertiary",children:K.jsx(Lt.Icon,{name:"ListBullets"})}),K.jsx(yt.Button,{"aria-label":"Link","data-active":b,onClick:()=>{b?Z(v):(o.dispatchCommand(Dr,{url:"https://"}),Z("https://"))},title:"Link",variant:"tertiary",children:K.jsx(Lt.Icon,{name:"Link"})}),t&&K.jsxs(K.Fragment,{children:[K.jsx("input",{hidden:!0,multiple:!0,onChange:W=>{W.target.files&&t(W.target.files),W.target.value=""},ref:R,type:"file"}),K.jsx(yt.Button,{"aria-label":"Upload files",onClick:()=>{var W;return(W=R.current)==null?void 0:W.click()},title:"Upload files",variant:"tertiary",children:K.jsx(Lt.Icon,{name:"Paperclip"})})]}),i&&K.jsx(yt.Button,{"aria-label":s,className:Ne.submit,"data-cy":"toolbar-submit-button",disabled:n,icon:"PaperPlaneTilt",isLoading:e,onClick:()=>i(),variant:"primary",children:K.jsx("span",{children:s})}),K.jsxs("div",{className:hi.t(Ne.meta,b||l?Ne.active:""),children:[b&&K.jsxs(K.Fragment,{children:[K.jsx(oc.Input,{"aria-invalid":!N,onBlur:()=>Ce(),onChange:W=>E(W.target.value),onKeyDown:W=>{W.key==="Enter"&&(W.preventDefault(),Ce())},ref:L,value:v}),K.jsx(yt.Button,{"aria-label":"Apply link",disabled:!N,onClick:()=>{Ce()},onMouseDown:H,variant:"tertiary",children:K.jsx(Lt.Icon,{name:"Check"})}),K.jsx(yt.Button,{"aria-label":"Remove link",onClick:()=>dn(),onMouseDown:H,variant:"tertiary",children:K.jsx(Lt.Icon,{name:"Trash",variant:"danger"})})]}),l&&K.jsxs(K.Fragment,{children:[!A&&K.jsxs(K.Fragment,{children:[K.jsx(oc.Input,{className:hi.t(Ne.active),onBlur:j,onChange:W=>x(W.target.value),onKeyDown:W=>{W.key==="Enter"&&(W.preventDefault(),U.current=!0,Ae())},ref:w,value:_}),K.jsx(yt.Button,{"aria-label":"Apply image",onClick:()=>Ae(),onMouseDown:ge,variant:"tertiary",children:K.jsx(Lt.Icon,{name:"Check"})})]}),K.jsx("div",{className:Ne["image-sizes"],children:r6.map(({label:W,width:Q})=>K.jsx(yt.Button,{"aria-label":`${W} image`,"data-active":D===Q,onClick:()=>ii(Q),onMouseDown:H,variant:"tertiary",children:W},W))}),K.jsx(yt.Button,{"aria-label":"Remove image",onClick:()=>ve(),onMouseDown:ge,variant:"tertiary",children:K.jsx(Lt.Icon,{name:"Trash",variant:"danger"})})]})]})]})},s6={name:"solibo-editor",namespace:"Editor",nodes:[ru,rr,is,ni,fs],onError(n){throw n},theme:{link:Ne.link,list:{ol:Ne.list,ul:Ne.list},paragraph:Ne.paragraph,text:{bold:Ne.bold,italic:Ne.italic,underline:Ne.underline}}};function o6({autofocus:n,content:e="",lastEmittedContentRef:t}){const[r]=bt();return q.useEffect(()=>{t.current!==e&&r.update(()=>{const s=new DOMParser().parseFromString(e,"text/html"),o=pg(r,s),u=we();u.clear().select(),Ho(o),n?u.selectEnd():Me(null)})},[n,e,r,t]),null}const u6=({autofocus:n=!1,autolink:e=!1,content:t,disabled:r=!1,errorMessage:i,fill:s=!1,files:o,inline:u=!1,inlineImages:a,invalid:l=!1,isSubmitting:c=!1,maxRows:h=12,minRows:f=1,onChange:d,onFilesChange:g,onInlineImagesChange:b,onSubmit:m,onUpload:p,placeholder:y,required:_=!1,submitLabel:x})=>{const S=q.useId(),C=q.useRef(void 0),[A,O]=q.useState(!1),[D,k]=q.useState([]),[v,E]=q.useState([]),N=q.useRef(new Map),R=o??D,w=a??v,L=j=>{o===void 0&&k(j),g==null||g(j)},I=q.useCallback(j=>{a===void 0&&E(j),b==null||b(j)},[a,b]),U=q.useCallback(j=>{const $=j.map(G=>{const X=`pasted-${crypto.randomUUID()}`,Z=URL.createObjectURL(G);return N.current.set(X,Z),{image:{alt:G.name,soliboDocumentSlot:X,src:Z},pending:{file:G,slot:X}}});return I([...w,...$.map(({pending:G})=>G)]),$.map(({image:G})=>G)},[w,I]),H=q.useCallback(j=>{I(w.filter(G=>G.slot!==j));const $=N.current.get(j);$&&URL.revokeObjectURL($),N.current.delete(j)},[w,I]);q.useEffect(()=>()=>{N.current.forEach(j=>URL.revokeObjectURL(j)),N.current.clear()},[]),q.useEffect(()=>{const j=new Set(w.map($=>$.slot));N.current.forEach(($,G)=>{j.has(G)||(URL.revokeObjectURL($),N.current.delete(G))})},[w]);const V=j=>{if(typeof DataTransfer<"u"){const $=new DataTransfer;return j.forEach(G=>$.items.add(G)),$.files}return Object.assign([...j],{item:$=>j[$]??null})},te=async()=>{try{R.length>0&&await(p==null?void 0:p(V(R))),await(m==null?void 0:m()),R.length>0&&L([])}catch{return}},ge=j=>{j.preventDefault(),j.stopPropagation()};return K.jsxs("div",{className:hi.t(Ne.field,s&&Ne.fill),"data-component":"editor","data-max-rows":h,"data-min-rows":f,onDragEnter:j=>{ge(j),O(!!g)},onDragOver:j=>{ge(j),O(!!g)},onDragLeave:j=>{ge(j),O(!1)},onDropCapture:j=>{var G;const $=(G=j.dataTransfer)==null?void 0:G.files;$!=null&&$.length&&(ge(j),(g||p)&&L([...R,...Array.from($)]),O(!1))},onDrop:j=>{j.preventDefault(),O(!1)},children:[K.jsx("div",{className:hi.t(Ne.editor,s&&Ne["fill-editor"],l&&Ne.invalid,R.length>0&&Ne["has-files"]),style:{"--editor-max-height":`calc(${h*1.25}em + (2 * var(--scale-8)))`,"--editor-min-height":`calc(${f*1.25}em + (2 * var(--scale-8)))`},children:K.jsxs(w_,{contentEditable:null,extension:s6,children:[!u&&K.jsx(i6,{disabled:r,isSubmitting:c,onInlineImageRemove:H,onFilesSelected:p||g?j=>{L([...R,...Array.from(j)])}:void 0,onSubmit:m?()=>void te():void 0,submitLabel:x}),K.jsx("div",{className:hi.t(Ne.content,A&&Ne.dragging),children:K.jsx(a2,{contentEditable:K.jsx(Pg,{"aria-placeholder":y??"",ariaErrorMessage:l&&i?S:void 0,ariaInvalid:l||void 0,ariaRequired:_||void 0,placeholder:()=>y?K.jsx("div",{className:Ne.placeholder,children:y}):null}),ErrorBoundary:Lg})}),R.length>0&&K.jsx("div",{"aria-label":"Files to upload",className:Ne.files,role:"region",children:R.map((j,$)=>K.jsx(im.File,{deleteAccessibleLabel:`Remove ${j.name} from upload queue`,name:j.name,onDelete:()=>L(R.filter((G,X)=>X!==$))},`${j.name}-${j.size}-${j.lastModified}-${$}`))}),n&&K.jsx(f_,{}),e&&K.jsx(d_,{matchers:B3}),K.jsx(N_,{}),b&&K.jsx(L3,{createImages:U}),t!==void 0&&K.jsx(o6,{autofocus:n,content:t,lastEmittedContentRef:C}),K.jsx(k_,{validateUrl:Va}),K.jsx(A_,{}),d&&K.jsx(D_,{onChange:(j,$)=>{j.read(()=>{const G=mg($,null),X=Ku(G,{allowedAttributes:{...Ku.defaults.allowedAttributes,img:[...Ku.defaults.allowedAttributes.img??[],"data-solibo-document-id","data-solibo-document-slot"]},allowedTags:["a","b","br","i","img","li","ol","p","u","ul"]});C.current=X,d(X)})}})]})}),l&&i&&K.jsx("div",{className:Ne.error,id:S,children:i})]})};exports.Editor=u6;
56
56
  //# sourceMappingURL=index.cjs.map