noteloom 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +251 -219
- package/dist/noteloom.cjs +1820 -8
- package/dist/noteloom.cjs.map +1 -1
- package/dist/noteloom.es.js +5824 -3720
- package/dist/noteloom.es.js.map +1 -1
- package/dist/style.css +1812 -0
- package/package.json +67 -63
package/dist/noteloom.cjs
CHANGED
|
@@ -1,9 +1,1821 @@
|
|
|
1
|
-
"use strict";var os=Object.defineProperty;var ss=(e,t,n)=>t in e?os(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Jt=(e,t,n)=>ss(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),p=require("react"),Fe=require("react-dom"),K={INSERT_BLOCK:"insertBlock",REMOVE_BLOCK:"removeBlock",MOVE_BLOCK:"moveBlock",UPDATE_BLOCK_PROPS:"updateBlockProps",UPDATE_RUN:"updateRun",SET_BLOCK_CONTENT_IDS:"setBlockContentIds",REPLACE_RUN_SPAN:"replaceRunSpan",SET_BLOCK_RUNS:"setBlockRuns",ADD_FIELD_TYPE:"addFieldType",UPDATE_FIELD_TYPE:"updateFieldType",REMOVE_FIELD_TYPE:"removeFieldType"};function V(e,t,n,o){return{type:K.INSERT_BLOCK,block:e,parentId:t,index:n,subtree:o}}function $(e){return{type:K.REMOVE_BLOCK,id:e}}function be(e,t,n){return{type:K.MOVE_BLOCK,id:e,toParentId:t,toIndex:n}}function F(e,t){return{type:K.UPDATE_BLOCK_PROPS,id:e,patch:t}}function J(e,t){return{type:K.UPDATE_RUN,id:e,patch:t}}function Re(e,t){return{type:K.SET_BLOCK_CONTENT_IDS,blockId:e,contentIds:t}}function Ke(e,t,n){return{type:K.REPLACE_RUN_SPAN,blockId:e,oldRunIds:t,newRuns:n}}function se(e,t){return{type:K.SET_BLOCK_RUNS,blockId:e,runs:t}}function Ct(e){return{type:K.ADD_FIELD_TYPE,fieldType:e}}function Bt(e,t){return{type:K.UPDATE_FIELD_TYPE,id:e,patch:t}}function wt(e){return{type:K.REMOVE_FIELD_TYPE,id:e}}const ls=Object.freeze(Object.defineProperty({__proto__:null,OP:K,addFieldType:Ct,insertBlock:V,moveBlock:be,removeBlock:$,removeFieldType:wt,replaceRunSpan:Ke,setBlockContentIds:Re,setBlockRuns:se,updateBlockProps:F,updateFieldType:Bt,updateRun:J},Symbol.toStringTag,{value:"Module"})),ft="$fieldTypes";class Rt{constructor(t){this.blocks=new Map(((t==null?void 0:t.blocks)??[]).map(n=>[n.id,n])),this.runs=new Map(((t==null?void 0:t.runs)??[]).map(n=>[n.id,n])),this.rootId=(t==null?void 0:t.rootId)??null,this.fieldTypes=new Map(((t==null?void 0:t.fieldTypes)??[]).map(n=>[n.id,n])),this._fieldTypesSnapshot=null,this._listeners=new Map}getBlock(t){return this.blocks.get(t)}getRun(t){return this.runs.get(t)}getFieldTypes(){return this._fieldTypesSnapshot||(this._fieldTypesSnapshot=[...this.fieldTypes.values()]),this._fieldTypesSnapshot}getFieldType(t){return this.fieldTypes.get(t)}getRootId(){return this.rootId}subscribe(t,n){let o=this._listeners.get(t);return o||(o=new Set,this._listeners.set(t,o)),o.add(n),()=>{o.delete(n),o.size===0&&this._listeners.delete(t)}}_notify(t){for(const n of t){const o=this._listeners.get(n);if(o)for(const s of[...o])s()}}_captureSubtree(t){const n=[],o=[],s=l=>{var c;if(this.runs.has(l)){o.push(this.runs.get(l));return}const r=this.blocks.get(l);if(r){n.push(r);for(const i of r.contentIds)s(i);for(const i of((c=r.props)==null?void 0:c.titleRunIds)??[])s(i)}};return s(t),{blocks:n,runs:o}}_deleteSubtree(t){const n=o=>{var l;if(this.runs.has(o)){this.runs.delete(o);return}const s=this.blocks.get(o);if(s){for(const r of s.contentIds)n(r);for(const r of((l=s.props)==null?void 0:l.titleRunIds)??[])n(r);this.blocks.delete(o)}};n(t)}applyOperation(t){var n;switch(t.type){case K.UPDATE_RUN:{const o=this.runs.get(t.id),s={};for(const l of Object.keys(t.patch))s[l]=o[l];return this.runs.set(t.id,{...o,...t.patch}),this._notify([t.id]),J(t.id,s)}case K.UPDATE_BLOCK_PROPS:{const o=this.blocks.get(t.id),s={};for(const l of Object.keys(t.patch))s[l]=o.props[l];return this.blocks.set(t.id,{...o,props:{...o.props,...t.patch}}),this._notify([t.id]),F(t.id,s)}case K.INSERT_BLOCK:{if(t.subtree){for(const r of t.subtree.blocks)this.blocks.set(r.id,r);for(const r of t.subtree.runs)this.runs.set(r.id,r)}else this.blocks.set(t.block.id,t.block);const o=this.blocks.get(t.parentId),s=[...o.contentIds],l=t.index??s.length;return s.splice(l,0,t.block.id),this.blocks.set(t.parentId,{...o,contentIds:s}),this._notify([t.block.id,t.parentId]),$(t.block.id)}case K.REMOVE_BLOCK:{const o=this.blocks.get(t.id),s=o.parentId,l=this.blocks.get(s),r=l.contentIds.indexOf(t.id),c=this._captureSubtree(t.id);this._deleteSubtree(t.id);const i=l.contentIds.filter(u=>u!==t.id);return this.blocks.set(s,{...l,contentIds:i}),this._notify([s]),{type:K.INSERT_BLOCK,block:o,parentId:s,index:r,subtree:c}}case K.MOVE_BLOCK:{const s=this.blocks.get(t.id).parentId,l=this.blocks.get(s),r=l.contentIds.indexOf(t.id),c=l.contentIds.filter(f=>f!==t.id);this.blocks.set(s,{...l,contentIds:c});const i=t.toParentId===s?this.blocks.get(s):this.blocks.get(t.toParentId),u=[...i.contentIds];u.splice(t.toIndex??u.length,0,t.id),this.blocks.set(t.toParentId,{...i,contentIds:u}),this.blocks.set(t.id,{...this.blocks.get(t.id),parentId:t.toParentId});const d=new Set([t.id,s,t.toParentId]);return this._notify(d),be(t.id,s,r)}case K.SET_BLOCK_CONTENT_IDS:{const o=this.blocks.get(t.blockId),s=o.contentIds;return this.blocks.set(t.blockId,{...o,contentIds:t.contentIds}),this._notify([t.blockId]),Re(t.blockId,s)}case K.REPLACE_RUN_SPAN:{const o=this.blocks.get(t.blockId),s=o.contentIds.indexOf(t.oldRunIds[0])!==-1,l=s?o.contentIds:((n=o.props)==null?void 0:n.titleRunIds)??[],r=l.indexOf(t.oldRunIds[0]),c=t.oldRunIds.map(u=>this.runs.get(u));for(const u of t.oldRunIds)this.runs.delete(u);for(const u of t.newRuns)this.runs.set(u.id,u);const i=[...l];return i.splice(r,t.oldRunIds.length,...t.newRuns.map(u=>u.id)),s?this.blocks.set(t.blockId,{...o,contentIds:i}):this.blocks.set(t.blockId,{...o,props:{...o.props,titleRunIds:i}}),this._notify([t.blockId,...t.oldRunIds,...t.newRuns.map(u=>u.id)]),Ke(t.blockId,t.newRuns.map(u=>u.id),c)}case K.SET_BLOCK_RUNS:{const o=this.blocks.get(t.blockId),s=o.props&&"titleRunIds"in o.props,l=s?o.props.titleRunIds:o.contentIds,r=l.map(i=>this.runs.get(i)).filter(Boolean);for(const i of l)this.runs.delete(i);for(const i of t.runs)this.runs.set(i.id,i);const c=t.runs.map(i=>i.id);return s?this.blocks.set(t.blockId,{...o,props:{...o.props,titleRunIds:c}}):this.blocks.set(t.blockId,{...o,contentIds:c}),this._notify([t.blockId,...l,...c]),se(t.blockId,r)}case K.ADD_FIELD_TYPE:return this.fieldTypes.set(t.fieldType.id,t.fieldType),this._fieldTypesSnapshot=null,this._notify([ft]),wt(t.fieldType.id);case K.UPDATE_FIELD_TYPE:{const o=this.fieldTypes.get(t.id),s={};for(const l of Object.keys(t.patch))s[l]=o[l];return this.fieldTypes.set(t.id,{...o,...t.patch}),this._fieldTypesSnapshot=null,this._notify([ft]),Bt(t.id,s)}case K.REMOVE_FIELD_TYPE:{const o=this.fieldTypes.get(t.id);return this.fieldTypes.delete(t.id),this._fieldTypesSnapshot=null,this._notify([ft]),Ct(o)}default:throw new Error(`Unknown operation type: ${t.type}`)}}applyOperations(t){return t.map(n=>this.applyOperation(n))}toJSON(){return{blocks:[...this.blocks.values()],runs:[...this.runs.values()],rootId:this.rootId,fieldTypes:[...this.fieldTypes.values()]}}static fromJSON(t){return new Rt(t)}}const rs=500;class cs{constructor(t,{idleMs:n=rs}={}){this.store=t,this.idleMs=n,this.undoStack=[],this.redoStack=[],this.currentBatch=null,this.idleTimer=null,this.historyLog=[],this._listeners=new Set,this._undoRedoSnapshot={canUndo:!1,canRedo:!1}}getUndoRedoSnapshot(){const t=this.canUndo(),n=this.canRedo();return(this._undoRedoSnapshot.canUndo!==t||this._undoRedoSnapshot.canRedo!==n)&&(this._undoRedoSnapshot={canUndo:t,canRedo:n}),this._undoRedoSnapshot}getBlock(t){return this.store.getBlock(t)}getRun(t){return this.store.getRun(t)}getRootId(){return this.store.getRootId()}getFieldTypes(){return this.store.getFieldTypes()}getFieldType(t){return this.store.getFieldType(t)}subscribe(t,n){return this.store.subscribe(t,n)}toJSON(){return this.store.toJSON()}applyOperation(t,n={}){return this.perform(t,n)}applyOperations(t,n={}){return t.map(o=>this.perform(o,n))}performBatch(t,n={}){var r;const o=n.actorId??null,s=n.timestamp??Date.now();this._commitCurrentBatch();const l=[];for(const c of t)l.unshift(this.store.applyOperation(c)),this.historyLog.push({opType:c.type,id:c.id??c.blockId??((r=c.block)==null?void 0:r.id),actorId:o,timestamp:s});this.redoStack=[],this.undoStack.push({ops:[...t],inverses:l,batchKey:null,actorId:o,timestamp:s,lastTimestamp:s,boundaryHit:!0}),this._notify()}perform(t,n={}){const o=n.actorId??null,s=n.timestamp??Date.now(),l=this.store.applyOperation(t);return this._record(t,l,{actorId:o,timestamp:s}),l}_batchKeyFor(t){return t.type==="updateRun"?`run:${t.id}`:null}_isWordBoundary(t){var o;if(t.type!=="updateRun")return!1;const n=(o=t.patch)==null?void 0:o.value;return typeof n!="string"||n.length===0?!1:/\s/.test(n[n.length-1])}_record(t,n,o){var c;this.redoStack=[];const s=this._batchKeyFor(t),l=this.currentBatch&&o.timestamp-this.currentBatch.lastTimestamp<=this.idleMs;this.currentBatch&&s!==null&&this.currentBatch.batchKey===s&&l&&!this.currentBatch.boundaryHit?(this.currentBatch.ops.push(t),this.currentBatch.inverses.unshift(n),this.currentBatch.lastTimestamp=o.timestamp,this._isWordBoundary(t)&&(this.currentBatch.boundaryHit=!0)):(this._commitCurrentBatch(),this.currentBatch={ops:[t],inverses:[n],batchKey:s,actorId:o.actorId,timestamp:o.timestamp,lastTimestamp:o.timestamp,boundaryHit:this._isWordBoundary(t)}),this._resetIdleTimer(),this.historyLog.push({opType:t.type,id:t.id??((c=t.block)==null?void 0:c.id),actorId:o.actorId,timestamp:o.timestamp}),this._notify()}_resetIdleTimer(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{this._commitCurrentBatch(),this._notify()},this.idleMs)}_commitCurrentBatch(){this.currentBatch&&(this.undoStack.push(this.currentBatch),this.currentBatch=null,this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null))}flush(){this._commitCurrentBatch(),this._notify()}undo(){this._commitCurrentBatch();const t=this.undoStack.pop();if(!t)return!1;for(const n of t.inverses)this.store.applyOperation(n);return this.redoStack.push(t),this._notify(),!0}redo(){const t=this.redoStack.pop();if(!t)return!1;for(const n of t.ops)this.store.applyOperation(n);return this.undoStack.push(t),this._notify(),!0}canUndo(){return this.undoStack.length>0||this.currentBatch!==null}canRedo(){return this.redoStack.length>0}getHistoryLog(){return[...this.historyLog]}subscribeToHistory(t){return this._listeners.add(t),()=>this._listeners.delete(t)}_notify(){for(const t of this._listeners)t()}}class mn{constructor(){this._types=new Map}register(t,n){this._types.set(t,n)}get(t){return this._types.get(t)}isLeaf(t){var n;return!!((n=this._types.get(t))!=null&&n.isLeaf)}listSlashCommands(){const t=[];for(const n of this._types.values())n.slashCommand&&t.push(n.slashCommand),n.slashCommands&&t.push(...n.slashCommands);return t}listHtmlMatchers(){return[...this._types.values()].filter(t=>t.fromHTML)}}function as(){return new mn}class gn{constructor(){this._types=new Map}register(t,n){this._types.set(t,n)}unregister(t){this._types.delete(t)}get(t){return this._types.get(t)}listHtmlMatchers(){return[...this._types.values()].filter(t=>t.fromHTML)}listSlashCommands(){const t=[];for(const n of this._types.values())n.slashCommand&&t.push(n.slashCommand),n.slashCommands&&t.push(...n.slashCommands);return t}listAtCommands(){const t=[];for(const n of this._types.values())n.atCommand&&t.push(n.atCommand),n.atCommands&&t.push(...n.atCommands);return t}}function is(){return new gn}const bn=p.createContext(null);function us({store:e,registry:t,inlineRegistry:n=null,history:o=null,children:s}){const[l,r]=p.useState(!1),[c,i]=p.useState([]),[u,d]=p.useState(!1),[f,m]=p.useState(null),h=p.useCallback(()=>m("new"),[]),g=p.useCallback(E=>m(E),[]),b=p.useCallback(()=>m(null),[]),k=p.useRef(null),y=p.useCallback(()=>k.current,[]),C=p.useCallback(E=>{var S,T;const w=k.current;w!==E&&(w&&((S=document.querySelector(`[data-block-id="${w}"]`))==null||S.classList.remove("be-block-selected")),k.current=E,E&&((T=document.querySelector(`[data-block-id="${E}"]`))==null||T.classList.add("be-block-selected")))},[]),x=p.useMemo(()=>({store:e,registry:t,inlineRegistry:n,history:o,isWholeDocumentSelected:l,setIsWholeDocumentSelected:r,selectedBlockRange:c,setSelectedBlockRange:i,getSelectedBlockId:y,setSelectedBlockId:C,isPreviewMode:u,setIsPreviewMode:d,fieldTypeEditorTarget:f,openCreateFieldType:h,openEditFieldType:g,closeFieldTypeEditor:b}),[e,t,n,o,l,c,y,C,u,f,h,g,b]);return a.jsx(bn.Provider,{value:x,children:s})}function fe(){const e=p.useContext(bn);if(!e)throw new Error("Editor hooks must be used within an <EditorProvider>");return e}function A(){return fe().store}function ze(){return fe().registry}function ke(){return fe().inlineRegistry}function Tt(){const{isWholeDocumentSelected:e,setIsWholeDocumentSelected:t}=fe();return[e,t]}function qe(){const{selectedBlockRange:e,setSelectedBlockRange:t}=fe();return[e,t]}function pe(){const{getSelectedBlockId:e,setSelectedBlockId:t}=fe();return{getSelectedBlockId:e,setSelectedBlockId:t}}function jt(){const{isPreviewMode:e,setIsPreviewMode:t}=fe();return[e,t]}function St(){const{fieldTypeEditorTarget:e,openCreateFieldType:t,openEditFieldType:n,closeFieldTypeEditor:o}=fe();return{target:e,openCreate:t,openEdit:n,close:o}}function ne(e){const t=A(),n=p.useCallback(s=>t.subscribe(e,s),[t,e]),o=p.useCallback(()=>t.getBlock(e),[t,e]);return p.useSyncExternalStore(n,o)}function ye(e){const t=A(),n=p.useCallback(s=>t.subscribe(e,s),[t,e]),o=p.useCallback(()=>t.getRun(e),[t,e]);return p.useSyncExternalStore(n,o)}function B(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`id-${Date.now()}-${Math.random().toString(36).slice(2)}`}const kn="",ds=//g;function de(e){return(e??"").replace(ds,"")}function Qt(e){return de(e.textContent)}function fs(e,t){var c;const n=new Map(t.map(i=>[i.id,i])),o=new Set,s=[];let l=!0;for(const i of e.childNodes){const u=i.nodeType===1?(c=i.dataset)==null?void 0:c.runId:void 0;if(u&&n.has(u)){o.add(u);const f=n.get(u);if(f.type!=="text"){s.push(f);continue}const m=Qt(i);s.push(m===f.value?f:{...f,value:m});continue}l=!1;const d=Qt(i);d&&s.push({id:B(),type:"text",value:d,marks:{}})}if(t.some(i=>!o.has(i.id))&&(l=!1),s.length!==t.length&&(l=!1),l){for(let i=0;i<s.length;i+=1)if(s[i].id!==t[i].id){l=!1;break}}const r=!l||s.some((i,u)=>i!==t[u]);return{runs:s,changed:r,onlyValueChanges:l}}function yn(e){return e?e.type!=="text"?!1:(e.value??"")==="":!0}function le(e,t){return!t||t.length===0?!0:t.every(n=>yn(e.getRun(n)))}function Se(e,t){var s,l;if(!t)return!1;const n=t.contentIds.length>0,o=(((l=(s=t.props)==null?void 0:s.titleRunIds)==null?void 0:l.length)??0)>0;return!n&&!o}function xn(e,t){requestAnimationFrame(()=>{const n=document.querySelector(`[data-run-id="${e}"]`);if(!n)return;n.focus();const o=document.createRange();o.selectNodeContents(n),o.collapse(t);const s=window.getSelection();s==null||s.removeAllRanges(),s==null||s.addRange(o)})}function Y(e){xn(e,!1)}function Et(e){xn(e,!0)}function ue(e,t){requestAnimationFrame(()=>{const n=document.querySelector(`[data-run-id="${e}"]`);if(!n)return;n.focus();const o=n.firstChild,s=document.createRange();if(o&&o.nodeType===3){const r=Math.max(0,Math.min(t,o.length));s.setStart(o,r),s.setEnd(o,r)}else s.selectNodeContents(n),s.collapse(t<=0);const l=window.getSelection();l==null||l.removeAllRanges(),l==null||l.addRange(s)})}function Zt(e,t){const n=e==null?void 0:e.parentElement;if(!n||!n.hasAttribute("data-placeholder"))return;t.length===0||t.every(yn)?n.setAttribute("data-empty",""):n.removeAttribute("data-empty")}function ps(e={}){return{fontWeight:e.bold?"bold":void 0,fontStyle:e.italic?"italic":void 0,textDecoration:[e.underline&&"underline",e.strike&&"line-through"].filter(Boolean).join(" ")||void 0,verticalAlign:e.subscript?"sub":e.superscript?"super":void 0,fontSize:e.subscript||e.superscript?"smaller":void 0,color:e.color||void 0,backgroundColor:e.highlight||void 0}}function hs({id:e,host:t,onValueSynced:n}){const o=ye(e);return p.useLayoutEffect(()=>{if(!t||!o)return;const s=o.value??"";(de(t.textContent)!==s||s===""&&t.textContent==="")&&(t.textContent=s===""?kn:s);const c=ps(o.marks);t.style.fontWeight=c.fontWeight??"",t.style.fontStyle=c.fontStyle??"",t.style.textDecoration=c.textDecoration??"",t.style.verticalAlign=c.verticalAlign??"",t.style.fontSize=c.fontSize??"",t.style.color=c.color??"",t.style.backgroundColor=c.backgroundColor??"",n==null||n()},[t,o,n]),null}function en(e,t,n,o){var f,m,h;const s=(f=window.getSelection)==null?void 0:f.call(window);if(!s||!s.isCollapsed||s.rangeCount===0)return null;const{anchorNode:l,anchorOffset:r}=s;if(!l||!e.contains(l))return null;const c=g=>{const b=t.indexOf(g);if(b===-1)return null;const k=o?t[b-1]:t[b+1];if(!k)return null;const y=n(k);return y&&y.type!=="text"?k:null};if(l===e){const g=o?r-1:r,b=e.childNodes[g],k=(b==null?void 0:b.nodeType)===1?(m=b.dataset)==null?void 0:m.runId:void 0;if(!k||t.indexOf(k)===-1)return null;const y=n(k);return y&&y.type!=="text"?k:null}const i=l.nodeType===1?l:l.parentElement,u=(h=i==null?void 0:i.closest)==null?void 0:h.call(i,"[data-run-id]");return!u||!e.contains(u)||!(o?r===0:r===(l.textContent??"").length)?null:c(u.getAttribute("data-run-id"))}function tn(e,t,n){var i,u;const o=(i=window.getSelection)==null?void 0:i.call(window);if(!o||o.isCollapsed||o.rangeCount===0)return null;const s=o.getRangeAt(0);if(s.startContainer!==s.endContainer||!e.contains(s.startContainer)||s.endOffset!==s.startOffset+1)return null;const l=s.startContainer.childNodes[s.startOffset],r=(l==null?void 0:l.nodeType)===1?(u=l.dataset)==null?void 0:u.runId:void 0;if(!r||t.indexOf(r)===-1)return null;const c=n(r);return c&&c.type!=="text"?r:null}function nn(e,t,n){var c;if(t===e)return{childIndex:n,charOffset:null};const o=t.nodeType===1?t:t.parentElement,s=(c=o==null?void 0:o.closest)==null?void 0:c.call(o,"[data-run-id]");if(!s||!e.contains(s))return null;const l=Array.prototype.indexOf.call(e.childNodes,s),r=t===s?n===0?0:(s.textContent??"").length:n;return{childIndex:l,charOffset:r}}function ms(e,t,n,o){const s=nn(e,o.startContainer,o.startOffset),l=nn(e,o.endContainer,o.endOffset);if(!s||!l)return null;const r=Array.from(e.childNodes).filter(d=>{var f;return d.nodeType===1&&((f=d.dataset)==null?void 0:f.runId)&&t.indexOf(d.dataset.runId)!==-1});let c=!1;const i=[];let u=null;return r.forEach((d,f)=>{const m=d.dataset.runId,h=n(m);if(!h)return;const g=f<s.childIndex,b=l.charOffset===null?f>=l.childIndex:f>l.childIndex;if(g||b){i.push(h);return}const k=s.charOffset!==null&&f===s.childIndex,y=l.charOffset!==null&&f===l.childIndex;if(h.type!=="text"){c=!0,u===null&&(u=i.length);return}const C=h.value??"";if(k&&y){const x=C.slice(0,s.charOffset)+C.slice(l.charOffset);x&&i.push({...h,value:x}),u=i.length}else if(k){const x=C.slice(0,s.charOffset);x&&i.push({...h,value:x}),u===null&&(u=i.length)}else if(y){const x=C.slice(l.charOffset);x&&i.push({id:B(),type:"text",value:x,marks:h.marks})}}),c?{nextRuns:i,insertionIndex:u??i.length}:null}function gs(e){var l;const t=(l=window.getSelection)==null?void 0:l.call(window);if(!t||!t.isCollapsed)return!1;const n=e.firstChild;if(!n)return!0;if(t.anchorNode===e)return t.anchorOffset===0;let o=n;for(;o&&o.firstChild;)o=o.firstChild;if(t.anchorNode!==o&&t.anchorNode!==n)return!1;const s=o.nodeType===3&&o.textContent===kn?1:0;return t.anchorOffset<=s}function bs(e){var l;const t=(l=window.getSelection)==null?void 0:l.call(window);if(!t||!t.isCollapsed)return!1;const n=e.lastChild;if(!n)return!0;if(t.anchorNode===e)return t.anchorOffset>=e.childNodes.length;let o=n;for(;o&&o.lastChild;)o=o.lastChild;if(t.anchorNode!==o&&t.anchorNode!==n)return!1;const s=o.nodeType===3?(o.textContent??"").length:0;return t.anchorOffset>=s}function on(e,t,n){const o=e.getBlock(t),s=e.getBlock(o==null?void 0:o.parentId);if(!s)return null;const l=s.contentIds.indexOf(t),r=n==="backward"?l-1:l+1;if(r<0||r>=s.contentIds.length)return null;const c=s.contentIds[r];return Se(e,e.getBlock(c))?c:null}function ks({id:e,blockId:t,host:n,inlineRegistry:o,onValueSynced:s}){const l=ye(e);if(!l)return null;if(l.type==="text")return a.jsx(hs,{id:e,host:n,onValueSynced:s});const r=o==null?void 0:o.get(l.type);if(!r)return process.env.NODE_ENV!=="production"&&console.warn(`[block-editor] No inline type registered for "${l.type}" (run: ${e})`),null;const c=r.component;return a.jsx(c,{id:e,blockId:t})}function ys(e,t,n){let o=e.get(n);if(!o){o=document.createElement("span"),o.dataset.runId=n;const s=t.getRun(n);s&&s.type!=="text"&&o.setAttribute("contenteditable","false"),e.set(n,o)}return o}function he({blockId:e,runIds:t,onEnter:n,onBackspaceAtStart:o,onDeleteAtEnd:s,onArrowUp:l,onArrowDown:r,onTab:c,onShiftTab:i,onAutoformat:u}){const d=A(),f=ke(),{getSelectedBlockId:m,setSelectedBlockId:h}=pe(),g=p.useRef(null),b=p.useRef(!1),k=p.useRef(new Map);p.useLayoutEffect(()=>{const I=g.current;if(!I)return;const v=new Set(t);for(const[L,N]of k.current)v.has(L)||(N.remove(),k.current.delete(L));let R=null;for(const L of t){const N=k.current.get(L);if(!N)continue;const M=R?R.nextSibling:I.firstChild;M!==N&&I.insertBefore(N,M),R=N}},[t]);const y=p.useCallback(()=>{if(b.current)return;const I=g.current;if(!I)return;const v=t.map(M=>d.getRun(M)).filter(Boolean),{runs:R,changed:L,onlyValueChanges:N}=fs(I,v);if(L){if(N){if(R.forEach((M,z)=>{M!==v[z]&&d.applyOperation(J(M.id,{value:M.value}))}),u!=null&&u(R))return}else d.applyOperation(se(e,R.length?R:[{id:B(),type:"text",value:"",marks:{}}]));Zt(I,R)}},[d,e,t,u]),C=p.useCallback(()=>{Zt(g.current,t.map(I=>d.getRun(I)).filter(Boolean))},[d,t]),x=p.useCallback(()=>{b.current=!0},[]),E=p.useCallback(()=>{b.current=!1,y()},[y]),w=p.useCallback(I=>{const R=t.map(L=>d.getRun(L)).filter(Boolean).filter(L=>L.id!==I);d.applyOperation(se(e,R.length?R:[{id:B(),type:"text",value:"",marks:{}}]))},[d,e,t]),S=p.useCallback(I=>{m()===I?(d.applyOperation($(I)),h(null)):h(I)},[d,m,h]),T=p.useCallback(I=>{var Q,ie,O;if(b.current)return;const v=I.inputType??"",R=v.startsWith("delete"),L=v==="insertText"||v==="insertReplacementText";if(!R&&!L)return;const N=g.current;if(!N)return;const M=(Q=I.getTargetRanges)==null?void 0:Q.call(I),z=(ie=window.getSelection)==null?void 0:ie.call(window),U=(M==null?void 0:M[0])??(z!=null&&z.rangeCount?z.getRangeAt(0):null);if(!U||!N.contains(U.startContainer)||!N.contains(U.endContainer))return;const q=ms(N,t,H=>d.getRun(H),U);if(!q)return;I.preventDefault();let{nextRuns:_,insertionIndex:W}=q,G=null,me=!1;if(L&&I.data){const H={id:B(),type:"text",value:I.data,marks:{}};_=[..._.slice(0,W),H,..._.slice(W)],G=H.id,me=!1}else W>0?(G=(O=_[W-1])==null?void 0:O.id,me=!1):_.length>0&&(G=_[0].id,me=!0);const ge=_.length?_:[{id:B(),type:"text",value:"",marks:{}}];d.applyOperation(se(e,ge));const oe=G??ge[0].id;me?Et(oe):Y(oe)},[d,e,t]);p.useEffect(()=>{const I=g.current;if(I)return I.addEventListener("beforeinput",T),()=>I.removeEventListener("beforeinput",T)},[T]);const j=p.useCallback(I=>{if(!b.current){if(I.key==="Enter"&&n){I.preventDefault(),n(I);return}if(I.key==="Backspace"){const v=g.current,R=v&&tn(v,t,d.getRun.bind(d));if(R){I.preventDefault(),w(R);return}const L=v&&en(v,t,d.getRun.bind(d),!0);if(L){I.preventDefault(),w(L);return}if(v&&gs(v)){if(!le(d,t)){const M=on(d,e,"backward");if(M){I.preventDefault(),S(M);return}}I.preventDefault(),o&&o(I)}return}if(I.key==="Delete"){const v=g.current,R=v&&tn(v,t,d.getRun.bind(d));if(R){I.preventDefault(),w(R);return}const L=v&&en(v,t,d.getRun.bind(d),!1);if(L){I.preventDefault(),w(L);return}if(v&&bs(v)){const N=on(d,e,"forward");if(N){I.preventDefault(),S(N);return}s&&s(I)}return}if(I.key==="ArrowUp"&&l){I.preventDefault(),l(I);return}if(I.key==="ArrowDown"&&r){I.preventDefault(),r(I);return}I.key==="Tab"&&(I.shiftKey&&i?(I.preventDefault(),i(I)):!I.shiftKey&&c&&(I.preventDefault(),c(I)))}},[n,o,s,l,r,c,i,w,S,t,e,d]);return a.jsx("span",{ref:g,className:"be-editable",contentEditable:!0,suppressContentEditableWarning:!0,onInput:y,onCompositionStart:x,onCompositionEnd:E,onKeyDown:j,children:t.map(I=>{const v=ys(k.current,d,I);return Fe.createPortal(a.jsx(ks,{id:I,blockId:e,host:v,inlineRegistry:f,onValueSynced:C},I),v)})})}function xs(e,t,n){const o=e.getBlock(t),s=o&&e.getBlock(o.parentId);if(!s)return null;const l=s.contentIds.indexOf(t),r=n==="up"?l-1:l+1;return r<0||r>=s.contentIds.length?null:s.contentIds[r]}function In(e,t,n){let o=t;for(;;){const s=xs(e,o,n);if(!s)return null;const l=n==="up"?Lt(e,s):Ot(e,s);if(l)return l;o=s}}function ee(e,t,n){const o=In(e,t,n);o&&Y(o)}function Ot(e,t){var l;const n=e.getBlock(t);if(!n)return null;const o=((l=n.props)==null?void 0:l.titleRunIds)??n.contentIds;if(!o||o.length===0)return null;const s=o[0];return e.getRun(s)?s:Ot(e,s)}function te(e,t){const n=Ot(e,t);n&&Y(n)}function Lt(e,t){var l;const n=e.getBlock(t);if(!n)return null;const o=((l=n.props)==null?void 0:l.titleRunIds)??n.contentIds;if(!o||o.length===0)return null;const s=o[o.length-1];return e.getRun(s)?s:Lt(e,s)}function sn(e,t){const n=Lt(e,t);n&&Y(n)}function Is(){var c,i;const e=(c=window.getSelection)==null?void 0:c.call(window);if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0);if(t.collapsed||t.startContainer!==t.endContainer)return null;const n=t.startContainer,o=n.nodeType===1?n:n.parentElement,s=(i=o==null?void 0:o.closest)==null?void 0:i.call(o,"[data-run-id]");if(!s)return null;const l=s.closest("[data-block-id]");if(!l)return null;const r=n.textContent??"";return{runId:s.getAttribute("data-run-id"),blockId:l.getAttribute("data-block-id"),startOffset:de(r.slice(0,t.startOffset)).length,endOffset:de(r.slice(0,t.endOffset)).length}}function vs(e,t){var c,i;if((e==null?void 0:e.nodeType)!==1||((c=e.getAttribute)==null?void 0:c.call(e,"contenteditable"))!=="true")return null;const n=e.childNodes;if(n.length===0)return null;const o=t>=n.length,s=n[o?n.length-1:Math.max(0,t)],l=(s==null?void 0:s.nodeType)===1?(i=s.dataset)==null?void 0:i.runId:void 0;if(!l)return null;const r=s.closest("[data-block-id]");return r?{runId:l,blockId:r.getAttribute("data-block-id"),offset:o?de(s.textContent??"").length:0}:null}function $e(e,t){var c;const n=vs(e,t);if(n)return n;let o=(e==null?void 0:e.nodeType)===1?e:e==null?void 0:e.parentElement;const s=(c=o==null?void 0:o.closest)==null?void 0:c.call(o,"[data-run-id]");if(!s)return null;const l=s.closest("[data-block-id]");if(!l)return null;let r=de((e.textContent??"").slice(0,t)).length;if(e===s){r=0;for(let i=0;i<t&&i<s.childNodes.length;i+=1)r+=de(s.childNodes[i].textContent??"").length}return{runId:s.getAttribute("data-run-id"),blockId:l.getAttribute("data-block-id"),offset:r}}function We(){var t;const e=(t=window.getSelection)==null?void 0:t.call(window);return!e||e.rangeCount===0||!e.isCollapsed?null:$e(e.anchorNode,e.anchorOffset)}function Ve(){var o;const e=(o=window.getSelection)==null?void 0:o.call(window);if(!e||e.rangeCount===0||e.isCollapsed)return null;const t=$e(e.anchorNode,e.anchorOffset),n=$e(e.focusNode,e.focusOffset);return!t||!n||t.blockId!==n.blockId?null:{blockId:t.blockId,startRunId:t.runId,startOffset:t.offset,endRunId:n.runId,endOffset:n.offset}}function Pe(e){var f;const t=(f=window.getSelection)==null?void 0:f.call(window);if(!t||t.rangeCount===0||t.isCollapsed)return null;const n=$e(t.anchorNode,t.anchorOffset),o=$e(t.focusNode,t.focusOffset);if(!n||!o||n.blockId===o.blockId)return null;const s=e.getBlock(n.blockId),l=s&&e.getBlock(s.parentId);if(!l)return null;const r=l.contentIds,c=r.indexOf(n.blockId),i=r.indexOf(o.blockId);if(c===-1||i===-1)return null;const[u,d]=c<=i?[c,i]:[i,c];return{blockIds:r.slice(u,d+1),startBlockId:n.blockId,startRunId:n.runId,startOffset:n.offset,endBlockId:o.blockId,endRunId:o.runId,endOffset:o.offset}}function Nt(e,t,n){const s=e.getBlock(t).parentId,r=e.getBlock(s).contentIds.indexOf(t)+1,{block:c,runs:i=[],subtreeBlocks:u=[]}=n(s);return e.applyOperation(V(c,s,r,{blocks:[c,...u],runs:i})),c.id}function xe(e,t,n){const o=Nt(e,t,n);return te(e,o),o}function Cs(e,t,n){const{block:o,runs:s=[],subtreeBlocks:l=[]}=n(t);return e.applyOperation(V(o,t,0,{blocks:[o,...l],runs:s})),te(e,o.id),o.id}function vn(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function Bs(e,t,n){const o=e.findIndex(u=>u.id===t);if(o===-1)return null;const s=e[o],l=e.slice(0,o),r=e.slice(o+1);if(s.type==="text"){const u=s.value??"",d=u.slice(0,n),f=u.slice(n);d&&f?(l.push({...s,value:d}),r.unshift({...s,id:B(),value:f})):f?r.unshift(s):l.push(s)}else n>0?l.push(s):r.unshift(s);const c=l.length?l:[{id:B(),type:"text",value:"",marks:{}}],i=r.length?r:[{id:B(),type:"text",value:"",marks:{}}];return{leftRuns:c,rightRuns:i}}function Ee(e,t,n,o){const s=e.getBlock(t),l=e.getBlock(s.parentId),r=l.contentIds.indexOf(t)+1;return Bn(e,t,n,o,{insertParentId:l.id,insertIndex:r,fallback:()=>xe(e,t,o)})}function Cn(e,t,n,o){return Bn(e,t,n,o,{insertParentId:t,insertIndex:0,fallback:()=>Cs(e,t,o)})}function Bn(e,t,n,o,{insertParentId:s,insertIndex:l,fallback:r}){const c=We();if(!c||c.blockId!==t)return r();const i=n.map(k=>e.getRun(k)).filter(Boolean),u=Bs(i,c.runId,c.offset);if(!u)return r();const{leftRuns:d,rightRuns:f}=u,{block:m,runs:h=f,subtreeBlocks:g=[]}=o(s,f),b=d.length?d:[{id:B(),type:"text",value:"",marks:{}}];return vn(e,[se(t,b),V(m,s,l,{blocks:[m,...g],runs:h})]),te(e,m.id),m.id}function ws(e){var t;return((t=e==null?void 0:e.props)==null?void 0:t.titleRunIds)??(e==null?void 0:e.contentIds)??[]}function Rs(e){var t,n;return!!((t=e==null?void 0:e.props)!=null&&t.titleRunIds)&&(((n=e.contentIds)==null?void 0:n.length)??0)>0}function Ts(e,t,n){const s=e.getBlock(t).parentId,r=e.getBlock(s).contentIds.indexOf(t),{block:c,runs:i=[],subtreeBlocks:u=[]}=n(s);return vn(e,[$(t),V(c,s,r,{blocks:[c,...u],runs:i})]),te(e,c.id),c.id}function Z(e,{blockId:t,runId:n,sliceStart:o,sliceEnd:s},l){const r=e.getRun(n),c=(r==null?void 0:r.value)??"",i=c.slice(0,o)+c.slice(s),u=e.getBlock(t),d=ws(u);return d.length===1&&d[0]===n&&i===""&&!Rs(u)?Ts(e,t,l):(e.applyOperation(J(n,{value:i})),xe(e,t,l))}function P(e,t={}){return function(o,s){const l=B(),r=s!=null&&s.length?s:[{id:B(),type:"text",value:"",marks:{}}];return{block:{id:l,type:e,parentId:o,contentIds:r.map(c=>c.id),props:t},runs:r}}}function Oe(e){const t=e.getRootId(),n=e.getBlock(t);if(!n||n.contentIds.length>0)return null;const{block:o,runs:s}=P("paragraph")(t);return e.applyOperation(V(o,t,0,{blocks:[o],runs:s})),o.id}const js=new Set(["callout"]),ln=new Set(["paragraph","heading","blockquote"]);function wn(e,t){return e===t||ln.has(e)&&ln.has(t)}function Ye(e,t){const n=e.getBlock(t);if(!n)return null;const o=e.getBlock(n.parentId),s=o.contentIds.indexOf(t),l=n.contentIds.length===0||n.contentIds.length===1&&Ss(e,n.contentIds[0]);if(s<=0){if(!l)return null;if(o.contentIds.length>1)return we(e,[$(t)]),e.getBlock(o.id).contentIds[0];if(js.has(o.type))return Es(e,o);if(n.type==="paragraph")return null;const{block:u,runs:d}=P("paragraph")(o.id);return we(e,[V(u,o.id,s,{blocks:[u],runs:d}),$(t)]),u.id}const r=o.contentIds[s-1],c=e.getBlock(r);if(l)return we(e,[$(t)]),r;if(Se(e,c))return we(e,[$(r)]),t;if(!c||!wn(c.type,n.type))return null;const i=[...c.contentIds,...n.contentIds];return we(e,[Re(r,i),Re(t,[]),$(t)]),r}function Ss(e,t){const n=e.getRun(t);return!n||(n.value??"")===""}function Es(e,t){const n=e.getBlock(t.parentId);if(!n)return null;const o=n.contentIds.indexOf(t.id),s=o>0?n.contentIds[o-1]:null,l=o!==-1&&o<n.contentIds.length-1?n.contentIds[o+1]:null;we(e,[$(t.id)]);const r=Oe(e);return s??l??r}function we(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function Le(e,t,n,o){var r,c,i;if(!t||t===n)return;const s=e.getBlock(t);if(Se(e,s)){o(t),requestAnimationFrame(()=>{var u;(u=document.querySelector(`[data-block-id="${t}"]`))==null||u.focus()});return}const l=((r=s==null?void 0:s.contentIds)==null?void 0:r[s.contentIds.length-1])??((i=(c=s==null?void 0:s.props)==null?void 0:c.titleRunIds)==null?void 0:i[s.props.titleRunIds.length-1]);l&&Y(l)}function Os(e,t,n,o,s){const l=e.getBlock(t),c=e.getBlock(l.parentId).contentIds.indexOf(t),i="titleRunIds"in o,u="titleRunIds"in(l.props??{}),d={id:B(),type:n,parentId:l.parentId,contentIds:[],props:o},f=i?F(d.id,{titleRunIds:s}):Re(d.id,s),m=u?F(t,{titleRunIds:[]}):Re(t,[]);return{newBlockId:d.id,ops:[V(d,l.parentId,c,{blocks:[d],runs:[]}),f,m,$(t)]}}function Ls(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}const Ns=[{re:/^(#{1,3})[ ]$/,type:"heading",props:e=>({level:e[1].length})},{re:/^[-*][ ]$/,type:"listItem",props:()=>({ordered:!1,titleRunIds:[]})},{re:/^\d+\.[ ]$/,type:"listItem",props:()=>({ordered:!0,titleRunIds:[]})},{re:/^\[\][ ]$/,type:"listItem",props:()=>({ordered:!1,checked:!1,titleRunIds:[]})},{re:/^>[ ]$/,type:"blockquote",props:()=>({})},{re:/^```$/,type:"code",props:()=>({language:"plaintext"})}];function Ms(e,t,n){if(n.length!==1||n[0].type!=="text")return!1;const o=n[0].value??"";for(const s of Ns){const l=s.re.exec(o);if(!l)continue;const r=o.slice(l[0].length),{ops:c}=Os(e,t,s.type,s.props(l),[n[0].id]);return Ls(e,[J(n[0].id,{value:r}),...c]),Et(n[0].id),!0}return!1}const As=new Set(["callout","toggleHeading"]);function Ds({id:e}){const t=A(),n=ne(e),{setSelectedBlockId:o}=pe(),s=p.useCallback(()=>{const d=t.getBlock(n==null?void 0:n.parentId),f=le(t,(n==null?void 0:n.contentIds)??[]),m=!!d&&d.contentIds[d.contentIds.length-1]===e;if(f&&m&&As.has(d==null?void 0:d.type)){xe(t,d.id,P("paragraph"));return}Ee(t,e,(n==null?void 0:n.contentIds)??[],P("paragraph"))},[t,e,n]),l=p.useCallback(()=>{var g,b;const d=t.getBlock(n==null?void 0:n.parentId),f=le(t,(n==null?void 0:n.contentIds)??[]),m=((g=d==null?void 0:d.contentIds)==null?void 0:g.length)===1&&d.contentIds[0]===e;if(f&&m&&(d==null?void 0:d.type)==="toggleHeading"){const k=((b=d.props)==null?void 0:b.titleRunIds)??[],y=k[k.length-1];y&&Y(y);return}const h=Ye(t,e);Le(t,h,e,o)},[t,e,n,o]),r=p.useCallback(()=>ee(t,e,"up"),[t,e]),c=p.useCallback(()=>ee(t,e,"down"),[t,e]),i=p.useCallback(d=>Ms(t,e,d),[t,e]);if(!n)return null;const u=le(t,n.contentIds);return a.jsx("div",{className:"be-paragraph","data-block-id":e,"data-empty":u?"":void 0,"data-placeholder":"Type '/' for commands",children:a.jsx(he,{blockId:e,runIds:n.contentIds,onEnter:s,onBackspaceAtStart:l,onArrowUp:r,onArrowDown:c,onAutoformat:i})})}function Te(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function re(e){return Te(e).replace(/"/g,""")}function Ie(e,t){var s,l;if(!e)return"";if(e.type!=="text"){const r=(s=t==null?void 0:t.inlineRegistry)==null?void 0:s.get(e.type);return r?r.toHTML(e,t):Te(e.value??"")}const n=e.marks??{};let o=Te(e.value??"");return n.code&&(o=`<code>${o}</code>`),n.bold&&(o=`<strong>${o}</strong>`),n.italic&&(o=`<em>${o}</em>`),n.underline&&(o=`<u>${o}</u>`),n.strike&&(o=`<s>${o}</s>`),n.subscript&&(o=`<sub>${o}</sub>`),n.superscript&&(o=`<sup>${o}</sup>`),n.color&&(o=`<span style="color:${re(n.color)}">${o}</span>`),n.highlight&&(o=`<span style="background-color:${re(n.highlight)}">${o}</span>`),(l=n.link)!=null&&l.href&&(o=`<a href="${re(n.link.href)}">${o}</a>`),o}function ve(e,t){var n;if(!e)return"";if(e.type!=="text"){const o=(n=t==null?void 0:t.inlineRegistry)==null?void 0:n.get(e.type);return o?o.toPlainText(e,t):e.value??""}return e.value??""}const _s={STRONG:"bold",B:"bold",EM:"italic",I:"italic",U:"underline",S:"strike",STRIKE:"strike",DEL:"strike",CODE:"code",SUB:"subscript",SUP:"superscript"};function ae(e,t,n={}){const o=[],s=(l,r)=>{var u,d;if(l.nodeType===3){const f=l.textContent;f&&o.push({id:B(),type:"text",value:f,marks:{...r}});return}if(l.nodeType!==1)return;if(t!=null&&t.inlineRegistry)for(const f of t.inlineRegistry.listHtmlMatchers()){const m=f.fromHTML(l,t);if(m){o.push(m);return}}let c=r;const i=_s[l.tagName];i&&(c={...c,[i]:!0}),l.tagName==="A"&&l.getAttribute("href")&&(c={...c,link:{href:l.getAttribute("href")}}),(u=l.style)!=null&&u.color&&(c={...c,color:l.style.color}),(d=l.style)!=null&&d.backgroundColor&&(c={...c,highlight:l.style.backgroundColor});for(const f of l.childNodes)s(f,c)};return s(e,n),o.length?o:[{id:B(),type:"text",value:"",marks:{}}]}function D({children:e,size:t=16,strokeWidth:n=2,...o}){return a.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...o,children:e})}function rt(e){return a.jsx(D,{...e,children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Mt(e){return a.jsx(D,{...e,children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})}function ct(e){return a.jsxs(D,{...e,children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Rn(e){return a.jsx(D,{...e,children:a.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}function Tn(e){return a.jsxs(D,{...e,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function $s(e){return a.jsxs(D,{...e,children:[a.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),a.jsx("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function Ps(e){return a.jsxs(D,{...e,children:[a.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),a.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),a.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]})}function Hs(e){return a.jsxs(D,{...e,children:[a.jsx("path",{d:"M6 3v7a6 6 0 0 0 12 0V3"}),a.jsx("line",{x1:"4",y1:"21",x2:"20",y2:"21"})]})}function Us(e){return a.jsxs(D,{...e,children:[a.jsx("path",{d:"M16 4H9a3 3 0 0 0-2.83 4"}),a.jsx("path",{d:"M14 12a4 4 0 0 1 0 8H6"}),a.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})]})}function Fs(e){return a.jsxs(D,{...e,children:[a.jsx("line",{x1:"21",y1:"6",x2:"3",y2:"6"}),a.jsx("line",{x1:"17",y1:"10",x2:"3",y2:"10"}),a.jsx("line",{x1:"21",y1:"14",x2:"3",y2:"14"}),a.jsx("line",{x1:"17",y1:"18",x2:"3",y2:"18"})]})}function Ks(e){return a.jsxs(D,{...e,children:[a.jsx("line",{x1:"21",y1:"6",x2:"3",y2:"6"}),a.jsx("line",{x1:"18",y1:"10",x2:"6",y2:"10"}),a.jsx("line",{x1:"21",y1:"14",x2:"3",y2:"14"}),a.jsx("line",{x1:"18",y1:"18",x2:"6",y2:"18"})]})}function zs(e){return a.jsxs(D,{...e,children:[a.jsx("line",{x1:"21",y1:"6",x2:"3",y2:"6"}),a.jsx("line",{x1:"21",y1:"10",x2:"7",y2:"10"}),a.jsx("line",{x1:"21",y1:"14",x2:"3",y2:"14"}),a.jsx("line",{x1:"21",y1:"18",x2:"7",y2:"18"})]})}function qs(e){return a.jsx(D,{...e,children:[5,12,19].flatMap(t=>[9,15].map(n=>a.jsx("circle",{cx:n,cy:t,r:"1.3",fill:"currentColor",stroke:"none"},`${n}-${t}`)))})}function jn(e){return a.jsxs(D,{...e,children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),a.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),a.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function Sn(e){return a.jsxs(D,{...e,children:[a.jsx("rect",{x:"9",y:"9",width:"12",height:"12",rx:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function En(e){return a.jsxs(D,{...e,children:[a.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),a.jsx("polyline",{points:"5 12 12 5 19 12"})]})}function On(e){return a.jsxs(D,{...e,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("polyline",{points:"19 12 12 19 5 12"})]})}function Ws(e){return a.jsxs(D,{...e,children:[a.jsx("circle",{cx:"6",cy:"6",r:"3"}),a.jsx("circle",{cx:"6",cy:"18",r:"3"}),a.jsx("line",{x1:"20",y1:"4",x2:"8.12",y2:"15.88"}),a.jsx("line",{x1:"14.47",y1:"14.48",x2:"20",y2:"20"}),a.jsx("line",{x1:"8.12",y1:"8.12",x2:"12",y2:"12"})]})}function Vs(e){return a.jsxs(D,{...e,children:[a.jsx("line",{x1:"17",y1:"6",x2:"3",y2:"6"}),a.jsx("line",{x1:"21",y1:"12",x2:"3",y2:"12"}),a.jsx("line",{x1:"15",y1:"18",x2:"3",y2:"18"})]})}function At({level:e=1,size:t=16,...n}){return a.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",...n,children:a.jsxs("text",{x:"2",y:"18",fontSize:"14",fontWeight:"700",fill:"currentColor",fontFamily:"inherit",children:["H",e]})})}function Ys(e){return a.jsx(At,{level:1,...e})}function Gs(e){return a.jsx(At,{level:2,...e})}function Xs(e){return a.jsx(At,{level:3,...e})}function Js(e){return a.jsxs(D,{...e,children:[a.jsx("path",{d:"M7 7a3 3 0 0 0-3 3v3a2 2 0 0 0 2 2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1H6a3 3 0 0 1 3-3z"}),a.jsx("path",{d:"M17 7a3 3 0 0 0-3 3v3a2 2 0 0 0 2 2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2a3 3 0 0 1 3-3z"})]})}function Qs(e){return a.jsxs(D,{...e,children:[a.jsx("polyline",{points:"9 8 4 12 9 16"}),a.jsx("polyline",{points:"15 8 20 12 15 16"})]})}function Zs(e){return a.jsx(D,{...e,children:a.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})})}function el(e){return a.jsxs(D,{...e,children:[a.jsx("path",{d:"M4 5h16a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H9l-4 4v-4H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z"}),a.jsx("line",{x1:"7",y1:"9",x2:"17",y2:"9"}),a.jsx("line",{x1:"7",y1:"12.5",x2:"13",y2:"12.5"})]})}function tl(e){return a.jsxs(D,{...e,children:[a.jsx("rect",{x:"3",y:"8",width:"18",height:"8",rx:"3"}),a.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})}function nl(e){return a.jsxs(D,{...e,children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),a.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"}),a.jsx("line",{x1:"3",y1:"16",x2:"21",y2:"16"}),a.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),a.jsx("line",{x1:"15",y1:"4",x2:"15",y2:"20"})]})}function ol(e){return a.jsxs(D,{...e,children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),a.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),a.jsx("line",{x1:"15",y1:"4",x2:"15",y2:"20"})]})}function sl(e){return a.jsxs(D,{...e,children:[a.jsx("circle",{cx:"4.5",cy:"6",r:"1.2",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"4.5",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"4.5",cy:"18",r:"1.2",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"9",y1:"6",x2:"21",y2:"6"}),a.jsx("line",{x1:"9",y1:"12",x2:"21",y2:"12"}),a.jsx("line",{x1:"9",y1:"18",x2:"21",y2:"18"})]})}function ll(e){return a.jsxs(D,{...e,children:[a.jsx("line",{x1:"10",y1:"6",x2:"21",y2:"6"}),a.jsx("line",{x1:"10",y1:"12",x2:"21",y2:"12"}),a.jsx("line",{x1:"10",y1:"18",x2:"21",y2:"18"}),a.jsx("text",{x:"2",y:"8.5",fontSize:"7",fontWeight:"700",fill:"currentColor",stroke:"none",children:"1"}),a.jsx("text",{x:"2",y:"14.5",fontSize:"7",fontWeight:"700",fill:"currentColor",stroke:"none",children:"2"}),a.jsx("text",{x:"2",y:"20.5",fontSize:"7",fontWeight:"700",fill:"currentColor",stroke:"none",children:"3"})]})}function Ln(e){return a.jsxs(D,{...e,children:[a.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"}),a.jsx("polyline",{points:"8 12 11 15 16 9"})]})}function rl(e){return a.jsxs(D,{...e,children:[a.jsx("rect",{x:"3",y:"5",width:"18",height:"16",rx:"2"}),a.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"}),a.jsx("line",{x1:"8",y1:"3",x2:"8",y2:"7"}),a.jsx("line",{x1:"16",y1:"3",x2:"16",y2:"7"})]})}function cl(e){return a.jsxs(D,{...e,children:[a.jsx("path",{d:"M12 3h7a2 2 0 0 1 2 2v7a2 2 0 0 1-.59 1.41l-8 8a2 2 0 0 1-2.82 0l-7-7a2 2 0 0 1 0-2.82l8-8A2 2 0 0 1 12 3z"}),a.jsx("circle",{cx:"15.5",cy:"8.5",r:"1.2",fill:"currentColor",stroke:"none"})]})}function al(e){return a.jsxs(D,{...e,children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),a.jsx("circle",{cx:"9",cy:"10",r:"1.5",fill:"currentColor",stroke:"none"}),a.jsx("path",{d:"M4 17l5-5 4 4 4-5 4 6"})]})}function il(e){return a.jsxs(D,{...e,children:[a.jsx("rect",{x:"3",y:"5",width:"14",height:"14",rx:"2"}),a.jsx("path",{d:"M17 10l4-2.5v9L17 14"})]})}function Nn(e){return a.jsxs(D,{...e,children:[a.jsx("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Mn(e){return a.jsxs(D,{...e,children:[a.jsx("path",{d:"M17.94 17.94A10.94 10.94 0 0 1 12 19c-6.5 0-10-7-10-7a18.5 18.5 0 0 1 5.06-5.94M9.9 4.24A10.94 10.94 0 0 1 12 4c6.5 0 10 7 10 7a18.5 18.5 0 0 1-2.16 3.19"}),a.jsx("path",{d:"M14.12 14.12a3 3 0 1 1-4.24-4.24"}),a.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}function ul(e){return a.jsxs(D,{...e,children:[a.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"14"}),a.jsx("line",{x1:"8",y1:"7",x2:"8",y2:"17"}),a.jsx("line",{x1:"12",y1:"4",x2:"12",y2:"20"}),a.jsx("line",{x1:"16",y1:"7",x2:"16",y2:"17"}),a.jsx("line",{x1:"20",y1:"10",x2:"20",y2:"14"})]})}function dl(e,t){return`<p>${e.contentIds.map(o=>t.store.getRun(o)).map(o=>Ie(o,t)).join("")}</p>`}function fl(e,t){return e.contentIds.map(n=>ve(t.store.getRun(n),t)).join("")}function pl(e,t){if(e.tagName!=="P")return null;const n=ae(e,t);return{block:{id:B(),type:"paragraph",parentId:null,contentIds:n.map(s=>s.id),props:{}},runs:n}}const An={component:Ds,isLeaf:!0,defaultProps:{},toHTML:dl,toPlainText:fl,fromHTML:pl,slashCommand:{label:"Text",icon:Vs,keywords:["paragraph","text","p"],run:(e,t)=>Z(e,t,P("paragraph"))}};function hl({id:e}){var f;const t=A(),n=ne(e),{setSelectedBlockId:o}=pe(),s=p.useCallback(()=>{Ee(t,e,(n==null?void 0:n.contentIds)??[],P("paragraph"))},[t,e,n]),l=p.useCallback(()=>{const m=Ye(t,e);Le(t,m,e,o)},[t,e,o]),r=p.useCallback(()=>ee(t,e,"up"),[t,e]),c=p.useCallback(()=>ee(t,e,"down"),[t,e]);if(!n)return null;const i=((f=n.props)==null?void 0:f.level)??3,u=`h${i}`,d=le(t,n.contentIds);return a.jsx(u,{className:"be-heading","data-block-id":e,"data-empty":d?"":void 0,"data-placeholder":`Heading ${i}`,children:a.jsx(he,{blockId:e,runIds:n.contentIds,onEnter:s,onBackspaceAtStart:l,onArrowUp:r,onArrowDown:c})})}const pt={1:Ys,2:Gs,3:Xs},ml={H1:1,H2:2,H3:3};function gl(e,t){var s;const n=((s=e.props)==null?void 0:s.level)??3,o=e.contentIds.map(l=>t.store.getRun(l));return`<h${n}>${o.map(l=>Ie(l,t)).join("")}</h${n}>`}function bl(e,t){return e.contentIds.map(n=>ve(t.store.getRun(n),t)).join("")}function kl(e,t){const n=ml[e.tagName];if(!n)return null;const o=ae(e,t);return{block:{id:B(),type:"heading",parentId:null,contentIds:o.map(l=>l.id),props:{level:n}},runs:o}}const Dn={component:hl,isLeaf:!0,defaultProps:{level:3},toHTML:gl,toPlainText:bl,fromHTML:kl,slashCommands:[{label:"Heading 1",icon:pt[1],keywords:["heading","h1","title"],run:(e,t)=>Z(e,t,P("heading",{level:1}))},{label:"Heading 2",icon:pt[2],keywords:["heading","h2","subtitle"],run:(e,t)=>Z(e,t,P("heading",{level:2}))},{label:"Heading 3",icon:pt[3],keywords:["heading","h3","title"],run:(e,t)=>Z(e,t,P("heading",{level:3}))}]},yl=[];function Dt(e){const t=A(),n=p.useCallback(s=>t.subscribe(e,s),[t,e]),o=p.useCallback(()=>{const s=t.getBlock(e);return s?s.contentIds:yl},[t,e]);return p.useSyncExternalStore(n,o)}class _n extends p.Component{constructor(){super(...arguments);Jt(this,"state",{hasError:!1,nonce:0})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n,o){var s,l;process.env.NODE_ENV!=="production"&&console.error("[block-editor] a block failed to render; recovering by remounting it:",n,o),(l=(s=this.props).onError)==null||l.call(s,n,o),queueMicrotask(()=>this.setState(r=>({hasError:!1,nonce:r.nonce+1})))}render(){return this.state.hasError?null:a.jsx(p.Fragment,{children:this.props.children},this.state.nonce)}}const _t=p.memo(function({id:t}){const n=ne(t),o=ze();if(!n)return null;const s=o.get(n.type);if(!s)return process.env.NODE_ENV!=="production"&&console.warn(`[block-editor] No block type registered for "${n.type}" (id: ${t})`),null;const l=s.component;return a.jsx(_n,{children:a.jsx(l,{id:t})})});function $t(e,t,n){p.useEffect(()=>{if(!t)return;const o=Array.isArray(e)?e:[e],s=r=>{o.some(i=>i.current&&i.current.contains(r.target))||n()},l=r=>{r.key==="Escape"&&n()};return document.addEventListener("mousedown",s),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",l)}},[t,n,e])}function Pt(e,t,n,o){const s={store:e,registry:t,inlineRegistry:o};return{html:xl(e,t,n,s),text:n.map(l=>{const r=e.getBlock(l);return t.get(r.type).toPlainText(r,s)}).join(`
|
|
2
|
-
`),json:JSON.stringify({version:1,blocks:n.map(l=>$n(e,l))})}}function xl(e,t,n,o){let s="",l=0;for(;l<n.length;){const r=e.getBlock(n[l]);if(r.type==="listItem"){const c=!!r.props.ordered;let i="",u=l;for(;u<n.length;){const f=e.getBlock(n[u]);if(f.type!=="listItem"||!!f.props.ordered!==c)break;i+=t.get("listItem").toHTML(f,o),u+=1}const d=c?"ol":"ul";s+=`<${d}>${i}</${d}>`,l=u}else if(r.type==="blockquote"){let c="",i=l;for(;i<n.length;){const u=e.getBlock(n[i]);if(u.type!=="blockquote")break;c+=t.get("blockquote").toHTML(u,o),i+=1}s+=`<blockquote>${c}</blockquote>`,l=i}else s+=t.get(r.type).toHTML(r,o),l+=1}return s}function $n(e,t){const n=[],o=[],s=l=>{var i;const r=e.getRun(l);if(r){o.push(r);return}const c=e.getBlock(l);if(c){n.push(c);for(const u of c.contentIds)s(u);for(const u of((i=c.props)==null?void 0:i.titleRunIds)??[])s(u)}};return s(t),{rootId:t,blocks:n,runs:o}}function Ht({rootId:e,blocks:t,runs:n}){const o=new Map;for(const i of t)o.set(i.id,B());for(const i of n)o.set(i.id,B());const s=i=>o.get(i)??i,l=t.map(i=>{var u;return{...i,id:s(i.id),parentId:i.parentId?s(i.parentId):i.parentId,contentIds:i.contentIds.map(s),props:{...i.props,...(u=i.props)!=null&&u.titleRunIds?{titleRunIds:i.props.titleRunIds.map(s)}:{}}}}),r=n.map(i=>({...i,id:s(i.id)})),c=s(e);return{block:l.find(i=>i.id===c),runs:r,subtreeBlocks:l.filter(i=>i.id!==c)}}function Pn(e,t){const n=e.getBlock(t);if(!n)return null;const o=e.getBlock(n.parentId),s=o.contentIds.indexOf(t),l=$n(e,t),{block:r,runs:c,subtreeBlocks:i}=Ht(l);return e.applyOperation(V(r,o.id,s+1,{blocks:[r,...i],runs:c})),te(e,r.id),r.id}function Hn(e,t){const n=e.getBlock(t),o=n&&e.getBlock(n.parentId);if(!o)return!1;const s=o.contentIds.indexOf(t);return s<=0?!1:(e.applyOperation(be(t,o.id,s-1)),!0)}function Un(e,t){const n=e.getBlock(t),o=n&&e.getBlock(n.parentId);if(!o)return!1;const s=o.contentIds.indexOf(t);return s===-1||s>=o.contentIds.length-1?!1:(e.applyOperation(be(t,o.id,s+1)),!0)}function Fn(e,t){const n=e.getBlock(t);if(!n)return null;const o=e.getBlock(n.parentId),s=o.contentIds.indexOf(t),l=s>0?o.contentIds[s-1]:null,r=s!==-1&&s<o.contentIds.length-1?o.contentIds[s+1]:null;e.applyOperation($(t));const c=Oe(e),i=l??r??c;return i&&te(e,i),i??null}function Kn({id:e}){var w;const t=A(),n=ne(e),[o,s]=p.useState(!1),[l,r]=p.useState(null),c=p.useRef(null),i=p.useRef(null),u=p.useMemo(()=>[c,i],[]),[d]=qe(),f=d.includes(e),m=p.useCallback(()=>s(!1),[]);$t(u,o,m);const h=p.useCallback(()=>{var S;r(((S=c.current)==null?void 0:S.getBoundingClientRect())??null),s(!0)},[]),g=p.useCallback(()=>{xe(t,e,P("paragraph"))},[t,e]),b=p.useCallback(()=>{Pn(t,e),m()},[t,e,m]),k=p.useCallback(()=>{Hn(t,e),m()},[t,e,m]),y=p.useCallback(()=>{Un(t,e),m()},[t,e,m]),C=p.useCallback(()=>{Fn(t,e),m()},[t,e,m]),x=!!((w=n==null?void 0:n.props)!=null&&w.hidden),E=p.useCallback(()=>{t.applyOperation(F(e,{hidden:!x})),m()},[t,e,x,m]);return n?a.jsxs("div",{className:`be-block-row${x?" be-block-row-hidden":""}${f?" be-block-row-range-selected":""}`,"data-block-row-id":e,children:[a.jsxs("div",{className:`be-block-gutter${o?" be-block-gutter-active":""}`,contentEditable:!1,children:[a.jsx("button",{type:"button",className:"be-block-gutter-btn",onClick:g,"aria-label":"Add block below",children:a.jsx(Tn,{size:16})}),a.jsx("button",{ref:c,type:"button",className:"be-block-gutter-btn","aria-label":"More options","aria-haspopup":"menu","aria-expanded":o,onClick:()=>o?m():h(),children:a.jsx(qs,{size:16})})]}),a.jsx("div",{className:"be-block-row-content",children:a.jsx(_t,{id:e})}),o&&l&&Fe.createPortal(a.jsxs("div",{ref:i,role:"menu","aria-label":"Block options",className:"be-block-gutter-menu",style:{position:"fixed",top:l.bottom+4,left:l.left},children:[a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:b,children:[a.jsx(Sn,{size:15})," Duplicate"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:k,children:[a.jsx(En,{size:15})," Move up"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:y,children:[a.jsx(On,{size:15})," Move down"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:E,children:[x?a.jsx(Nn,{size:15}):a.jsx(Mn,{size:15}),x?"Show in preview":"Hide in preview"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item be-block-gutter-menu-item-danger",onClick:C,children:[a.jsx(jn,{size:15})," Delete"]})]}),document.body)]}):null}function Ce({parentId:e,isTopLevel:t=!1}){const n=Dt(e),o=A(),[s]=jt(),l=s?n.filter(r=>{var c,i;return!((i=(c=o.getBlock(r))==null?void 0:c.props)!=null&&i.hidden)}):n;return t&&!s?l.map(r=>a.jsx(Kn,{id:r},r)):l.map(r=>a.jsx(_t,{id:r},r))}const Il=97,vl=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];function Cl(e){let t="";for(;e>0;)e-=1,t=String.fromCharCode(Il+e%26)+t,e=Math.floor(e/26);return t}function Bl(e){let t="",n=e;for(const[o,s]of vl)for(;n>=o;)t+=s,n-=o;return t}function wl(e){var t,n;return(e==null?void 0:e.type)==="listItem"&&((t=e.props)==null?void 0:t.checked)===void 0&&((n=e.props)==null?void 0:n.collapsed)===void 0}function rn(e,t){let n=0,o=t;for(;o;){const s=e.getBlock(o.parentId);if(!s||s.type!=="listItem")break;n+=1,o=s}return n}function Rl(e,t,n){const o=n.indexOf(t.id);let s=1;for(let l=o-1;l>=0;l-=1){const r=e.getBlock(n[l]);if(!wl(r)||!r.props.ordered)break;s+=1}return s}function Tl(e,t){const n=(e%3+3)%3;return n===0?`${t}.`:n===1?`${Cl(t)}.`:`${Bl(t)}.`}const jl=["•","◦","▪"];function Sl(e){const t=(e%3+3)%3;return jl[t]}function De({ordered:e=!1,checked:t,collapsed:n}={}){return function(s,l){const r=B(),c=l!=null&&l.length?l:[{id:B(),type:"text",value:"",marks:{}}],i={ordered:e,titleRunIds:c.map(m=>m.id)};t!==void 0&&(i.checked=t);let u=[],d=[],f=c;if(n!==void 0){i.collapsed=n;const{block:m,runs:h}=P("paragraph")(r);u=[m.id],d=[m],f=[...c,...h]}return{block:{id:r,type:"listItem",parentId:s,contentIds:u,props:i},runs:f,subtreeBlocks:d}}}function El(e,t){const n=e.getBlock(t),o=e.getBlock(n.parentId),s=o.contentIds.indexOf(t),l=s>0?o.contentIds[s-1]:null,r=l?e.getBlock(l):null;if(!r||r.type!=="listItem"){ee(e,t,"down");return}e.applyOperation(be(t,l,r.contentIds.length)),te(e,t)}function gt(e,t){const n=e.getBlock(t),o=e.getBlock(n.parentId);if(!o||o.type!=="listItem")return;const s=o.parentId,r=e.getBlock(s).contentIds.indexOf(o.id);e.applyOperation(be(t,s,r+1)),te(e,t)}function Me(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function zn(e,t){var n;return t.length===0||t.length===1&&(((n=e.getRun(t[0]))==null?void 0:n.value)??"")===""}function Ol(e,t){const n=t.contentIds??[];if(n.length===0)return!0;if(n.length>1)return!1;const o=e.getBlock(n[0]);return!!o&&o.type==="paragraph"&&le(e,o.contentIds)}function Ll(e,t){const n=e.getBlock(t);if(!n)return null;const o=e.getBlock(n.parentId),s=o.contentIds.indexOf(t),l=n.props.titleRunIds??[],c=zn(e,l)&&Ol(e,n);if(s>0){const d=o.contentIds[s-1],f=e.getBlock(d);if(c)return Me(e,[$(t)]),{focusBlockId:d,needsRefocus:!0};if(Se(e,f))return Me(e,[$(d)]),{focusBlockId:t,needsRefocus:!1};if((f==null?void 0:f.type)==="listItem"&&n.contentIds.length===0){const m=[...f.props.titleRunIds??[],...l];return Me(e,[F(d,{titleRunIds:m}),F(t,{titleRunIds:[]}),$(t)]),{focusBlockId:d,needsRefocus:!0}}return null}if(o.type==="listItem")return gt(e,t),{focusBlockId:t,needsRefocus:!0};if(!c)return null;if(o.contentIds.length>1)return Me(e,[$(t)]),{focusBlockId:e.getBlock(o.id).contentIds[0],needsRefocus:!0};const{block:i,runs:u}=P("paragraph")(o.id);return Me(e,[V(i,o.id,s,{blocks:[i],runs:u}),$(t)]),{focusBlockId:i.id,needsRefocus:!0}}function Nl(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function Ml(e,t){const o=e.getBlock(t).parentId,l=e.getBlock(o).contentIds.indexOf(t),{block:r,runs:c}=P("paragraph")(o);return Nl(e,[V(r,o,l,{blocks:[r],runs:c}),F(t,{titleRunIds:[]}),$(t)]),te(e,r.id),r.id}function Al(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function Dl({id:e}){var w,S;const t=A(),n=ne(e),{setSelectedBlockId:o}=pe(),s=Dt(n==null?void 0:n.parentId),l=p.useCallback(()=>{var M,z,U,q,_;const T=((M=n==null?void 0:n.props)==null?void 0:M.titleRunIds)??[],j=t.getBlock(n==null?void 0:n.parentId),I=zn(t,T);if(I&&(j==null?void 0:j.type)==="listItem"){gt(t,e);return}const v=(((z=n==null?void 0:n.contentIds)==null?void 0:z.length)??0)>0;if(I&&(j==null?void 0:j.type)!=="listItem"&&!v){Ml(t,e);return}const R=((U=n==null?void 0:n.props)==null?void 0:U.checked)!==void 0,L=((q=n==null?void 0:n.props)==null?void 0:q.collapsed)!==void 0,N=De({ordered:(_=n==null?void 0:n.props)==null?void 0:_.ordered,checked:R?!1:void 0,collapsed:L?!1:void 0});v&&!L?Cn(t,e,T,N):Ee(t,e,T,N)},[t,e,n]),r=p.useCallback(()=>El(t,e),[t,e]),c=p.useCallback(()=>gt(t,e),[t,e]),i=p.useCallback(()=>{const T=Ll(t,e);!T||!T.needsRefocus||Le(t,T.focusBlockId,e,o)},[t,e,o]),u=p.useCallback(()=>ee(t,e,"up"),[t,e]),d=p.useCallback(()=>ee(t,e,"down"),[t,e]),f=p.useCallback(()=>{var T;t.applyOperation(F(e,{checked:!((T=n==null?void 0:n.props)!=null&&T.checked)}))},[t,e,(w=n==null?void 0:n.props)==null?void 0:w.checked]),m=p.useCallback(()=>{var j,I;if(!((((j=n==null?void 0:n.contentIds)==null?void 0:j.length)??0)>0)){const{block:v,runs:R}=P("paragraph")(e);Al(t,[V(v,e,0,{blocks:[v],runs:R}),F(e,{collapsed:!1})]),Y(v.contentIds[0]);return}t.applyOperation(F(e,{collapsed:!((I=n==null?void 0:n.props)!=null&&I.collapsed)}))},[t,e,n==null?void 0:n.contentIds,(S=n==null?void 0:n.props)==null?void 0:S.collapsed]);if(!n)return null;const{ordered:h,checked:g,collapsed:b,titleRunIds:k=[]}=n.props,y=g!==void 0,C=!y&&b!==void 0,x=n.contentIds.length>0,E=k.map(T=>t.getRun(T)).filter(T=>(T==null?void 0:T.type)==="text").map(T=>T.value).join("").trim();return a.jsxs("div",{className:"be-list-item","data-block-id":e,children:[a.jsxs("div",{className:"be-list-item-row",children:[y?a.jsx("input",{type:"checkbox",className:"be-list-checkbox",checked:!!g,onChange:f,"aria-label":E||"To-do item"}):C?a.jsx("button",{type:"button",className:"be-list-toggle-marker",onClick:m,"aria-expanded":!b,"aria-label":x?b?"Expand toggle":"Collapse toggle":"Add content to toggle",children:b?a.jsx(rt,{}):a.jsx(Mt,{})}):a.jsx("span",{className:"be-list-marker","aria-hidden":"true",children:h?Tl(rn(t,n),Rl(t,n,s)):Sl(rn(t,n))}),a.jsx("div",{className:"be-list-item-title","data-empty":le(t,k)?"":void 0,"data-placeholder":y?"To-do":C?"Toggle":"List item",style:g?{textDecoration:"line-through",opacity:.6}:void 0,children:a.jsx(he,{blockId:e,runIds:k,onEnter:l,onTab:r,onShiftTab:c,onBackspaceAtStart:i,onArrowUp:u,onArrowDown:d})})]}),(!C||!b)&&a.jsx("div",{className:"be-list-item-children",children:a.jsx(Ce,{parentId:e})})]})}function _l(e,t){const{titleRunIds:n=[],ordered:o}=e.props,s=n.map(c=>Ie(t.store.getRun(c),t)).join(""),l=e.contentIds.map(c=>t.registry.get(t.store.getBlock(c).type).toHTML(t.store.getBlock(c),t)).join(""),r=l?`<${o?"ol":"ul"}>${l}</${o?"ol":"ul"}>`:"";return`<li>${s}${r}</li>`}function $l(e,t){const{titleRunIds:n=[]}=e.props;return n.map(o=>ve(t.store.getRun(o),t)).join("")}function qn(e,t){const n=[],o=[];for(const f of e.childNodes)f.nodeType===1&&(f.tagName==="UL"||f.tagName==="OL")?o.push(f):n.push(f);const s=e.ownerDocument.createElement("span");for(const f of n)s.appendChild(f.cloneNode(!0));const l=ae(s,t),r=B(),c=[...l],i=[],u=[];for(const f of o){const m=f.tagName==="OL";for(const h of f.children){if(h.tagName!=="LI")continue;const g=qn(h,t);g.block.parentId=r,g.block.props.ordered=m,i.push(g.block,...g.childBlocks),c.push(...g.runs),u.push(g.block.id)}}return{block:{id:r,type:"listItem",parentId:null,contentIds:u,props:{ordered:!1,titleRunIds:l.map(f=>f.id)}},runs:c,childBlocks:i}}function Pl(e,t){if(e.tagName!=="LI")return null;const{block:n,runs:o,childBlocks:s}=qn(e,t);return{block:n,runs:o,subtreeBlocks:s}}const Wn={component:Dl,isLeaf:!1,defaultProps:{ordered:!1,titleRunIds:[]},toHTML:_l,toPlainText:$l,fromHTML:Pl,slashCommands:[{label:"Bulleted list",icon:sl,keywords:["list","bullet","ul"],run:(e,t)=>Z(e,t,De({ordered:!1}))},{label:"Numbered list",icon:ll,keywords:["list","number","ordered","ol"],run:(e,t)=>Z(e,t,De({ordered:!0}))},{label:"To-do list",icon:Ln,keywords:["todo","checkbox","task","checklist"],run:(e,t)=>Z(e,t,De({ordered:!1,checked:!1}))},{label:"Toggle list",icon:rt,keywords:["toggle","collapse","expand","dropdown","accordion"],run:(e,t)=>Z(e,t,De({ordered:!1,collapsed:!1}))}]},Vn=["text","date","checkbox","select"],at="text",it=160,ot=80;function Hl(e){return`Column ${e+1}`}function Ut(e){return Array.from({length:e},(t,n)=>({id:B(),label:Hl(n),type:at,width:it}))}function ce(e,t){var o;const n=(o=e.props)==null?void 0:o.columns;return!Array.isArray(n)||n.length!==t?Ut(t):n.map(s=>{const l=s.type??at,r=s.width??it;return l===s.type&&r===s.width?s:{...s,type:l,width:r}})}function Yn(e){switch(e){case"date":return{id:B(),type:"date",value:"",marks:{},data:{isoDate:""}};case"checkbox":return{id:B(),type:"checkbox",value:"",marks:{},data:{checked:!1,label:""}};case"select":return{id:B(),type:"tableSelect",value:"",marks:{},data:{selectedValue:"",selectedLabel:""}};default:return{id:B(),type:"text",value:"",marks:{}}}}function ut(e,t){const n=Yn(t==null?void 0:t.type);return{block:{id:B(),type:"tableCell",parentId:e,contentIds:[n.id],props:{}},run:n}}function Gn(e,t,n){if(e.type===t)return e;let o;if(e.type==="text")o=e.value??"";else{const s=n==null?void 0:n.get(e.type);o=s!=null&&s.toPlainText?s.toPlainText(e):""}if(t==="date"){const s=o?new Date(o):null,l=s&&!Number.isNaN(s.getTime())?s.toISOString().slice(0,10):"";return{id:B(),type:"date",value:"",marks:{},data:{isoDate:l}}}return t==="checkbox"?{id:B(),type:"checkbox",value:"",marks:{},data:{checked:!1,label:o}}:{id:B(),type:"text",value:o,marks:{}}}function Be(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function Xn(e,t){const o=e.getBlock(t.parentId).contentIds.indexOf(t.id);Be(e,[$(t.id)]);const s=Oe(e);if(s)return te(e,s),null;const l=e.getBlock(t.parentId),r=l.contentIds[o]??l.contentIds[o-1];return r&&te(e,r),null}function Jn(e,t){const n=e.getBlock(t),o=e.getBlock(n.parentId),s=o.contentIds.indexOf(t),l=ce(o,n.contentIds.length),r=B(),c=[],i=[],u=[];for(const f of l){const m=ut(r,f);c.push(m.block),i.push(m.run),u.push(m.block.id)}const d={id:r,type:"tableRow",parentId:o.id,contentIds:u,props:{}};return e.applyOperation(V(d,o.id,s+1,{blocks:[d,...c],runs:i})),te(e,r),r}function Qn(e,t){const n=e.getBlock(t),o=e.getBlock(n.parentId);if(o.contentIds.length<=1)return Xn(e,o);const s=o.contentIds.indexOf(t);Be(e,[$(t)]);const l=e.getBlock(o.id),r=Math.min(s,l.contentIds.length-1),c=l.contentIds[r];return c&&te(e,c),c??null}function bt(e,t,n){const o=e.getBlock(t),s=ce(o,o.contentIds[0]?e.getBlock(o.contentIds[0]).contentIds.length:0),l={id:B(),label:"New Column",type:at,width:it},r=[];let c=null;for(const u of o.contentIds){const d=ut(u,l);c===null&&(c=d.block.id),r.push(V(d.block,u,n+1,{blocks:[d.block],runs:[d.run]}))}const i=[...s];return i.splice(n+1,0,l),r.push(F(t,{columns:i})),Be(e,r),c&&te(e,c),c}function Zn(e,t,n){const o=e.getBlock(t),s=e.getBlock(o.contentIds[0]);if(!s||s.contentIds.length<=1)return Xn(e,o);const l=ce(o,s.contentIds.length),r=o.contentIds.map(f=>{const m=e.getBlock(f);return $(m.contentIds[n])}),c=l.filter((f,m)=>m!==n);r.push(F(t,{columns:c})),Be(e,r);const i=e.getBlock(o.contentIds[0]),u=Math.min(n,i.contentIds.length-1),d=i.contentIds[u];return d&&te(e,d),d??null}function eo(e,t,n,o){const s=e.getBlock(t),l=e.getBlock(s.contentIds[0]),r=ce(s,l?l.contentIds.length:0);if(!r[n])return;const c=[...r];c[n]={...r[n],width:Math.max(ot,Math.round(o))},e.applyOperation(F(t,{columns:c}))}function to(e,t,n,o){const s=e.getBlock(t),l=e.getBlock(s.contentIds[0]),c=[...ce(s,l?l.contentIds.length:0)];c[n]&&(c[n]={...c[n],label:o},e.applyOperation(F(t,{columns:c})))}function Ft(e,t,n){return t.contentIds.map(o=>{const l=e.getBlock(o).contentIds[n],r=e.getBlock(l);return{cellId:l,run:e.getRun(r.contentIds[0])}})}function cn(e,t){if(!e)return"";if(e.type==="text")return e.value??"";const n=t==null?void 0:t.get(e.type);return n!=null&&n.toPlainText?n.toPlainText(e):""}function Ul(e,t,n,o){const s=Ft(e,t,n),l=[],r=new Map;for(const{run:i}of s){const u=cn(i,o).trim();if(!u||r.has(u))continue;const d={value:B(),label:u};r.set(u,d),l.push(d)}const c=s.map(({cellId:i,run:u})=>{const d=cn(u,o).trim(),f=r.get(d);return{cellId:i,run:{id:B(),type:"tableSelect",value:"",marks:{},data:{selectedValue:(f==null?void 0:f.value)??"",selectedLabel:(f==null?void 0:f.label)??""}}}});return{options:l,newRuns:c}}function no(e,t,n,o,s){const l=e.getBlock(t),r=e.getBlock(l.contentIds[0]),c=ce(l,r?r.contentIds.length:0),i=c[n];if(!i||i.type===o)return;const u=[...c];if(o==="select"){const{options:f,newRuns:m}=Ul(e,l,n,s);u[n]={...i,type:o,options:f};const h=[F(t,{columns:u})];for(const{cellId:g,run:b}of m)h.push(se(g,[b]));Be(e,h);return}u[n]={...i,type:o};const d=[F(t,{columns:u})];for(const{cellId:f,run:m}of Ft(e,l,n)){if(!m)continue;const h=Gn(m,o,s);d.push(se(f,[h]))}Be(e,d)}function tt(e,t,n,o){var f,m;const s=e.getBlock(t),l=e.getBlock(s.contentIds[0]),r=ce(s,l?l.contentIds.length:0),c=r[n];if(!c)return;const i=[...r];i[n]={...c,options:o};const u=[F(t,{columns:i})],d=new Map(o.map(h=>[h.value,h]));for(const{run:h}of Ft(e,s,n)){if(!h||h.type!=="tableSelect")continue;const g=((f=h.data)==null?void 0:f.selectedValue)??"",b=d.get(g),k=b?g:"",y=b?b.label:"";(k!==g||y!==(((m=h.data)==null?void 0:m.selectedLabel)??""))&&u.push(J(h.id,{data:{selectedValue:k,selectedLabel:y}}))}Be(e,u)}function Fl(e,t){return t?e.label.toLowerCase().includes(t.toLowerCase()):!0}function Ne({value:e,options:t,onChange:n,placeholder:o="Select…",ariaLabel:s,className:l="",variant:r="default",selectedLabel:c,selectedColor:i,onManageOptions:u,manageOptionsLabel:d="Manage options…"}){var Q,ie;const[f,m]=p.useState(!1),[h,g]=p.useState(""),[b,k]=p.useState(0),[y,C]=p.useState(null),[x,E]=p.useState([]),[w,S]=p.useState(!1),[T,j]=p.useState(!1),I=p.useRef(null),v=p.useRef(null),R=p.useRef(null),L=p.useRef(null),N=p.useRef(null),M=p.useMemo(()=>[I,R],[]),z=r==="tag",U=typeof t=="function",q=U?void 0:t.find(O=>O.value===e),_=e?q??(c?{label:c,color:i}:void 0):void 0,W=p.useMemo(()=>U?x:t.filter(O=>Fl(O,h)),[U,x,t,h]);p.useEffect(()=>{if(!U||!f)return;let O=!1;S(!0),j(!1);const H=setTimeout(()=>{Promise.resolve(t(h)).then(X=>{O||(E(X??[]),S(!1))}).catch(()=>{O||(E([]),S(!1),j(!0))})},250);return()=>{O=!0,clearTimeout(H)}},[U,f,t,h]);const G=p.useCallback(()=>m(!1),[]);$t(M,f,G);const me=p.useCallback(()=>{var O;C(((O=v.current)==null?void 0:O.getBoundingClientRect())??null),g(""),k(0),m(!0)},[]);p.useEffect(()=>{var O;f&&((O=L.current)==null||O.focus())},[f]),p.useEffect(()=>{var O,H;(H=(O=N.current)==null?void 0:O.scrollIntoView)==null||H.call(O,{block:"nearest"})},[b]);const ge=p.useCallback(O=>{var H;n(O.value,O),G(),(H=v.current)==null||H.focus()},[n,G]),oe=p.useCallback(O=>{var H;O.key==="ArrowDown"?(O.preventDefault(),k(X=>Math.min(X+1,Math.max(W.length-1,0)))):O.key==="ArrowUp"?(O.preventDefault(),k(X=>Math.max(X-1,0))):O.key==="Enter"?(O.preventDefault(),W[b]&&ge(W[b])):O.key==="Escape"&&(O.preventDefault(),G(),(H=v.current)==null||H.focus())},[W,b,ge,G]);return a.jsxs("span",{className:`be-select ${l}`.trim(),ref:I,children:[a.jsx("button",{type:"button",ref:v,className:`be-select-trigger${z?" be-select-trigger-tag":""}`,"aria-haspopup":"listbox","aria-expanded":f,"aria-label":s,onClick:()=>f?G():me(),children:z?_?a.jsx("span",{className:"be-select-tag",style:{background:(Q=_.color)==null?void 0:Q.bg,color:(ie=_.color)==null?void 0:ie.text},children:_.label}):a.jsx("span",{className:"be-select-value be-select-value-placeholder",children:o}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"be-select-value",children:_?_.label:o}),a.jsx(Mt,{size:14,className:"be-select-chevron"})]})}),f&&y&&Fe.createPortal(a.jsxs("div",{ref:R,className:"be-select-popover",style:{position:"fixed",top:y.bottom+4,left:y.left,minWidth:y.width},children:[a.jsx("input",{ref:L,type:"text",className:"be-select-search",value:h,onChange:O=>{g(O.target.value),k(0)},onKeyDown:oe,placeholder:"Search…","aria-label":s?`Search ${s}`:"Search options"}),a.jsxs("div",{className:"be-select-options",role:"listbox",children:[U&&w&&a.jsx("div",{className:"be-select-empty",children:"Loading…"}),U&&!w&&T&&a.jsx("div",{className:"be-select-empty be-select-error",children:"Couldn't load options"}),!w&&!T&&W.length===0&&a.jsx("div",{className:"be-select-empty",children:"No results"}),!w&&!T&&W.map((O,H)=>{var X,Xe;return a.jsx("div",{ref:H===b?N:void 0,role:"option","aria-selected":O.value===e,className:`be-select-option${H===b?" be-select-option-active":""}${O.value===e?" be-select-option-selected":""}`,onMouseDown:ns=>{ns.preventDefault(),ge(O)},onMouseEnter:()=>k(H),children:z?a.jsx("span",{className:"be-select-tag",style:{background:(X=O.color)==null?void 0:X.bg,color:(Xe=O.color)==null?void 0:Xe.text},children:O.label}):O.label},O.value)})]}),u&&a.jsx("button",{type:"button",className:"be-select-manage-options",onMouseDown:O=>{O.preventDefault(),G(),u()},children:d})]}),document.body)]})}const Je=[{bg:"#e9e9e7",text:"#32302c"},{bg:"#eee0da",text:"#64473a"},{bg:"#fadec9",text:"#8a4b23"},{bg:"#fdecc8",text:"#8a6116"},{bg:"#dbeddb",text:"#256029"},{bg:"#d3e5ef",text:"#1a5f8a"},{bg:"#e8deee",text:"#5b3a8a"},{bg:"#f5e0e9",text:"#8a3a5f"},{bg:"#ffe2dd",text:"#a13a2f"}];function He(e){return Je[(e%Je.length+Je.length)%Je.length]}const Kl={text:"Text",date:"Date",checkbox:"Checkbox",select:"Select"},zl=Vn.map(e=>({value:e,label:Kl[e]}));function ql({tableId:e,colIndex:t,options:n}){const o=A(),[s,l]=p.useState(""),r=p.useCallback((u,d)=>{tt(o,e,t,n.map(f=>f.value===u?{...f,label:d}:f))},[o,e,t,n]),c=p.useCallback(u=>tt(o,e,t,n.filter(d=>d.value!==u)),[o,e,t,n]),i=p.useCallback(()=>{const u=s.trim();l(""),u&&tt(o,e,t,[...n,{value:B(),label:u,color:He(n.length)}])},[o,e,t,n,s]);return a.jsxs("div",{className:"be-table-header-menu-options",children:[a.jsx("div",{className:"be-table-header-menu-options-label",children:"Options"}),n.map((u,d)=>a.jsxs("div",{className:"be-table-header-menu-option-row",children:[a.jsx("span",{className:"be-table-header-menu-option-swatch",style:{background:(u.color??He(d)).bg},"aria-hidden":"true"}),a.jsx("input",{className:"be-table-header-menu-option-input",value:u.label,onChange:f=>r(u.value,f.target.value),"aria-label":`Rename option ${u.label}`}),a.jsx("button",{type:"button",className:"be-table-header-menu-option-remove",onClick:()=>c(u.value),"aria-label":`Remove option ${u.label}`,children:a.jsx(ct,{size:14})})]},u.value)),a.jsxs("div",{className:"be-table-header-menu-option-row",children:[a.jsx("input",{className:"be-table-header-menu-option-input",value:s,onChange:u=>l(u.target.value),placeholder:"New option…",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),i())}}),a.jsx("button",{type:"button",className:"be-table-header-menu-option-add",onClick:i,"aria-label":"Add option",children:"+"})]})]})}function Wl({tableId:e,column:t,colIndex:n,colCount:o}){const s=A(),l=ke(),[r,c]=p.useState(!1),[i,u]=p.useState(null),[d,f]=p.useState(null),m=p.useRef(null),h=p.useRef(null),g=p.useRef(null),b=p.useMemo(()=>[m,h],[]),k=p.useCallback(()=>c(!1),[]);$t(b,r,k);const y=p.useCallback(()=>{var j;u(((j=m.current)==null?void 0:j.getBoundingClientRect())??null),c(!0)},[]),C=p.useCallback(j=>to(s,e,n,j.target.value),[s,e,n]),x=p.useCallback(()=>{bt(s,e,n-1),k()},[s,e,n,k]),E=p.useCallback(()=>{bt(s,e,n),k()},[s,e,n,k]),w=p.useCallback(()=>{Zn(s,e,n),k()},[s,e,n,k]),S=p.useCallback(j=>no(s,e,n,j,l),[s,e,n,l]),T=p.useCallback(j=>{var U;j.preventDefault();const I=(U=g.current)==null?void 0:U.closest("table"),v=I==null?void 0:I.querySelector(`col[data-col-index="${n}"]`);if(!v)return;const R=g.current.getBoundingClientRect().width,L=j.clientX,N=q=>Math.max(ot,Math.round(R+(q.clientX-L))),M=q=>{const _=N(q);v.style.width=`${_}px`,f(_)},z=q=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",z),eo(s,e,n,N(q)),f(null)};document.addEventListener("mousemove",M),document.addEventListener("mouseup",z)},[s,e,n]);return a.jsxs("th",{ref:g,className:"be-table-header-cell",contentEditable:!1,children:[a.jsx("input",{className:"be-table-header-label",value:t.label,onChange:C,"aria-label":`Column ${n+1} name`}),a.jsx("button",{ref:m,type:"button",className:"be-table-header-menu-trigger","aria-label":`Column ${n+1} options`,"aria-haspopup":"menu","aria-expanded":r,onClick:()=>r?k():y(),children:"⋮"}),a.jsx("div",{className:"be-table-col-resize-handle",onMouseDown:T,role:"slider","aria-label":`Resize column ${n+1}`,"aria-valuemin":ot,"aria-valuenow":d??t.width}),r&&i&&Fe.createPortal(a.jsxs("div",{ref:h,role:"menu",className:"be-table-header-menu",style:{position:"fixed",top:i.bottom+4,left:i.right,transform:"translateX(-100%)"},children:[a.jsxs("div",{className:"be-table-header-menu-type",children:[a.jsx("span",{id:`be-table-col-type-${t.id}`,children:"Type"}),a.jsx(Ne,{value:t.type,options:zl,onChange:S,ariaLabel:"Column type",className:"be-table-header-type-select"})]}),t.type==="select"&&a.jsx(ql,{tableId:e,colIndex:n,options:t.options??[]}),a.jsx("button",{type:"button",role:"menuitem",className:"be-table-header-menu-item",onClick:x,children:"Insert column left"}),a.jsx("button",{type:"button",role:"menuitem",className:"be-table-header-menu-item",onClick:E,children:"Insert column right"}),a.jsx("button",{type:"button",role:"menuitem",className:"be-table-header-menu-item be-table-header-menu-item-danger",onClick:w,disabled:o<=1,children:"Delete column"})]}),document.body)]})}function oo({tableId:e,columns:t}){return a.jsx("thead",{children:a.jsxs("tr",{className:"be-table-header-row",children:[t.map((n,o)=>a.jsx(Wl,{tableId:e,column:n,colIndex:o,colCount:t.length},n.id)),a.jsx("th",{className:"be-table-header-spacer","aria-hidden":"true"})]})})}function Vl({id:e}){var r;const t=A(),n=ne(e),o=p.useCallback(()=>{var i;const c=(i=n==null?void 0:n.contentIds)==null?void 0:i[n.contentIds.length-1];c&&Jn(t,c)},[t,n]);if(!n)return null;const s=t.getBlock(n.contentIds[0]),l=ce(n,((r=s==null?void 0:s.contentIds)==null?void 0:r.length)??0);return a.jsxs("div",{className:"be-table-wrapper","data-block-id":e,children:[a.jsxs("table",{className:"be-table",children:[a.jsxs("colgroup",{children:[l.map((c,i)=>a.jsx("col",{"data-col-index":i,style:{width:c.width}},c.id)),a.jsx("col",{className:"be-table-header-spacer-col"})]}),a.jsx(oo,{tableId:e,columns:l}),a.jsx("tbody",{children:a.jsx(Ce,{parentId:e})})]}),a.jsxs("button",{type:"button",className:"be-table-add-row",contentEditable:!1,onClick:o,children:[a.jsx(Tn,{size:14})," Add row"]})]})}function Yl({id:e}){const t=A(),n=p.useCallback(()=>Qn(t,e),[t,e]);return a.jsxs("tr",{className:"be-table-row","data-block-id":e,children:[a.jsx(Ce,{parentId:e}),a.jsx("td",{className:"be-table-row-actions",contentEditable:!1,children:a.jsx("button",{type:"button",className:"be-table-delete-row",onClick:n,"aria-label":"Delete row",title:"Delete row",children:a.jsx(ct,{size:14})})})]})}function so(e,t){const n=e.getBlock(t),o=e.getBlock(n.parentId),s=e.getBlock(o.parentId);return{table:s,row:o,rowIndex:s.contentIds.indexOf(o.id),colIndex:o.contentIds.indexOf(t)}}function Gl(e,t,n){const{table:o,row:s,rowIndex:l,colIndex:r}=so(e,t);if(n==="left"||n==="right"){const d=n==="right"?1:-1,f=r+d;if(f>=0&&f<s.contentIds.length)return s.contentIds[f];const m=l+d;if(m<0||m>=o.contentIds.length)return null;const h=e.getBlock(o.contentIds[m]),g=n==="right"?0:h.contentIds.length-1;return h.contentIds[g]}const i=l+(n==="down"?1:-1);if(i<0||i>=o.contentIds.length)return null;const u=e.getBlock(o.contentIds[i]);return u.contentIds[r]??u.contentIds[u.contentIds.length-1]??null}function Xl(e,t){const n=In(e,t,"down");if(n){Y(n);return}xe(e,t,P("paragraph"))}function Ae(e,t,n){var s;const o=Gl(e,t,n);if(o){const l=e.getBlock(o),r=(s=l==null?void 0:l.contentIds)==null?void 0:s[0];r&&Y(r);return}if(n==="right"){const{table:l}=so(e,t);Xl(e,l.id)}}function Jl({id:e}){const t=A(),n=ne(e),o=p.useCallback(()=>Ae(t,e,"right"),[t,e]),s=p.useCallback(()=>Ae(t,e,"left"),[t,e]),l=p.useCallback(()=>Ae(t,e,"up"),[t,e]),r=p.useCallback(()=>Ae(t,e,"down"),[t,e]),c=p.useCallback(()=>Ae(t,e,"down"),[t,e]);return n?a.jsx("td",{className:"be-table-cell","data-block-id":e,children:a.jsx(he,{blockId:e,runIds:n.contentIds,onTab:o,onShiftTab:s,onArrowUp:l,onArrowDown:r,onEnter:c})}):null}function Ql(e,t){const n=B(),o=[],s=[],l=[];for(const r of t){const c=ut(n,r);o.push(c.block),s.push(c.run),l.push(c.block.id)}return{block:{id:n,type:"tableRow",parentId:e,contentIds:l,props:{}},blocks:o,runs:s}}function Zl({rows:e=2,cols:t=2}={}){return function(o){const s=B(),l=Ut(t),r=[],c=[],i=[];for(let d=0;d<e;d+=1){const f=Ql(s,l);r.push(f.block,...f.blocks),c.push(...f.runs),i.push(f.block.id)}return{block:{id:s,type:"table",parentId:o,contentIds:i,props:{columns:l}},runs:c,subtreeBlocks:r}}}function er(e,t){return`<td>${e.contentIds.map(o=>t.store.getRun(o)).map(o=>Ie(o,t)).join("")}</td>`}function tr(e,t){return e.contentIds.map(n=>ve(t.store.getRun(n),t)).join("")}function nr(e,t){if(e.tagName!=="TD"&&e.tagName!=="TH")return null;const n=ae(e,t);return{block:{id:B(),type:"tableCell",parentId:null,contentIds:n.map(s=>s.id),props:{}},runs:n}}function or(e,t){return`<tr>${e.contentIds.map(o=>{const s=t.store.getBlock(o);return t.registry.get(s.type).toHTML(s,t)}).join("")}</tr>`}function sr(e,t){return e.contentIds.map(n=>{const o=t.store.getBlock(n);return t.registry.get(o.type).toPlainText(o,t)}).join(" ")}function lr(e,t){if(e.tagName!=="TR")return null;const n=[...e.children].filter(i=>i.tagName==="TD"||i.tagName==="TH"),o=B(),s=[],l=[],r=[];for(const i of n){const u=t.registry.get("tableCell").fromHTML(i,t);u&&(u.block.parentId=o,s.push(u.block),l.push(...u.runs),r.push(u.block.id))}return{block:{id:o,type:"tableRow",parentId:null,contentIds:r,props:{}},runs:l,subtreeBlocks:s}}function rr(e,t){var r;const n=e.contentIds[0]&&t.store.getBlock(e.contentIds[0]),o=ce(e,((r=n==null?void 0:n.contentIds)==null?void 0:r.length)??0),s=o.length?`<thead><tr>${o.map(c=>`<th>${Te(c.label??"")}</th>`).join("")}</tr></thead>`:"",l=e.contentIds.map(c=>{const i=t.store.getBlock(c);return t.registry.get(i.type).toHTML(i,t)}).join("");return`<table>${s}<tbody>${l}</tbody></table>`}function cr(e,t){return e.contentIds.map(n=>{const o=t.store.getBlock(n);return t.registry.get(o.type).toPlainText(o,t)}).join(`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
${s}`:o}function Hr(e,t){if(e.tagName!=="DETAILS")return null;const n=[...e.children].find(f=>f.tagName==="SUMMARY"),o=n==null?void 0:n.querySelector("h1,h2,h3,h4,h5,h6"),s=o?Math.min(6,Math.max(1,Number(o.tagName[1]))):2,l=o?ae(o,t):[{id:B(),type:"text",value:"",marks:{}}],r=B(),c=[],i=[],u=[];for(const f of e.children){if(f===n||f.tagName!=="P")continue;const m=ae(f,t),h={id:B(),type:"paragraph",parentId:r,contentIds:m.map(g=>g.id),props:{}};c.push(h),i.push(...m),u.push(h.id)}if(u.length===0){const{block:f,runs:m}=P("paragraph")(r);c.push(f),i.push(...m),u.push(f.id)}return{block:{id:r,type:"toggleHeading",parentId:null,contentIds:u,props:{level:s,collapsed:!e.hasAttribute("open"),titleRunIds:l.map(f=>f.id)}},runs:[...l,...i],subtreeBlocks:c}}const bo={component:Dr,isLeaf:!1,defaultProps:{level:2,collapsed:!1,titleRunIds:[]},toHTML:$r,toPlainText:Pr,fromHTML:Hr,slashCommands:[1,2,3].map(e=>({label:`Toggle heading ${e}`,icon:rt,keywords:["toggle","heading","collapse","section"],run:(t,n)=>Z(t,n,_r({level:e}))}))};function Kt({isOpen:e,onClose:t,title:n,children:o}){return p.useEffect(()=>{if(!e)return;const s=l=>{l.key==="Escape"&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),e?a.jsx("div",{className:"be-modal-overlay",onMouseDown:s=>{s.target===s.currentTarget&&t()},children:a.jsxs("div",{className:"be-modal",role:"dialog","aria-modal":"true","aria-label":n,children:[n&&a.jsx("div",{className:"be-modal-title",children:n}),o]})}):null}const ht=[{label:"Blue",value:"#2b6fd6"},{label:"Green",value:"#2f9e44"},{label:"Red",value:"#e03131"},{label:"Purple",value:"#9c36b5"},{label:"Gray",value:"#495057"},{label:"Black",value:"#1a1a1a"}];function Ur(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function Fr({isOpen:e,onClose:t,store:n,blockId:o}){const[s,l]=p.useState(""),[r,c]=p.useState(""),[i,u]=p.useState(ht[0].value),[d,f]=p.useState([{key:"",value:""}]);p.useEffect(()=>{var C,x,E;if(!e)return;const b=n.getBlock(o);if(!b)return;const k=b.contentIds.map(w=>{var S;return((S=n.getRun(w))==null?void 0:S.value)??""}).join(""),y=((C=b.props)==null?void 0:C.customAttrs)??[];l(k),c(((x=b.props)==null?void 0:x.href)??""),u(((E=b.props)==null?void 0:E.color)??ht[0].value),f([...y,{key:"",value:""}])},[e,o,n]);const m=p.useCallback((b,k)=>{f(y=>{const C=y.map((E,w)=>w===b?{...E,...k}:E),x=C[C.length-1];return(x.key.trim()||x.value.trim())&&C.push({key:"",value:""}),C})},[]),h=p.useCallback(b=>{f(k=>k.filter((y,C)=>C!==b))},[]),g=p.useCallback(()=>{const b={id:B(),type:"text",value:s,marks:{}},k=d.filter(y=>y.key.trim());Ur(n,[se(o,[b]),F(o,{href:r.trim(),color:i,customAttrs:k})]),t()},[n,o,s,r,i,d,t]);return a.jsxs(Kt,{isOpen:e,onClose:t,title:"Edit button",children:[a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"Label"}),a.jsx("input",{type:"text",value:s,onChange:b=>l(b.target.value),placeholder:"Button"})]}),a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"Link URL"}),a.jsx("input",{type:"url",value:r,onChange:b=>c(b.target.value),placeholder:"https://example.com"})]}),a.jsxs("div",{className:"be-modal-field",children:[a.jsx("span",{children:"Color"}),a.jsx("div",{className:"be-modal-color-row",children:ht.map(b=>a.jsx("button",{type:"button",className:`be-modal-color-swatch${i===b.value?" be-modal-color-swatch-active":""}`,style:{backgroundColor:b.value},title:b.label,"aria-label":b.label,onClick:()=>u(b.value)},b.value))})]}),a.jsxs("div",{className:"be-modal-field",children:[a.jsx("span",{children:"Custom attributes"}),d.map((b,k)=>a.jsxs("div",{className:"be-modal-attr-row",children:[a.jsx("input",{type:"text",placeholder:"name",value:b.key,onChange:y=>m(k,{key:y.target.value})}),a.jsx("input",{type:"text",placeholder:"value",value:b.value,onChange:y=>m(k,{value:y.target.value})}),(b.key||b.value)&&a.jsx("button",{type:"button",className:"be-modal-attr-remove",onClick:()=>h(k),"aria-label":"Remove attribute",children:a.jsx(ct,{size:14})})]},k))]}),a.jsxs("div",{className:"be-modal-actions",children:[a.jsx("button",{type:"button",className:"be-modal-cancel",onClick:t,children:"Cancel"}),a.jsx("button",{type:"button",className:"be-modal-save",onClick:g,children:"Save"})]})]})}const Kr="#2b6fd6";function zr({id:e}){var k,y,C,x;const t=A(),n=ne(e),{setSelectedBlockId:o}=pe(),[s,l]=p.useState(!1),r=p.useCallback(()=>{Ee(t,e,(n==null?void 0:n.contentIds)??[],P("paragraph"))},[t,e,n]),c=p.useCallback(()=>{const E=Ye(t,e);Le(t,E,e,o)},[t,e,o]),i=p.useCallback(()=>ee(t,e,"up"),[t,e]),u=p.useCallback(()=>ee(t,e,"down"),[t,e]),d=p.useCallback(()=>{var w;const E=(w=n==null?void 0:n.props)==null?void 0:w.href;E&&window.open(E,"_blank","noopener,noreferrer")},[(k=n==null?void 0:n.props)==null?void 0:k.href]);if(!n)return null;const f=((y=n.props)==null?void 0:y.href)??"",m=((C=n.props)==null?void 0:C.color)??Kr,h=((x=n.props)==null?void 0:x.customAttrs)??[],g=le(t,n.contentIds),b={};for(const{key:E,value:w}of h)E.trim()&&(b[`data-${E.trim()}`]=w);return a.jsxs("div",{className:"be-button-block","data-block-id":e,children:[a.jsxs("div",{className:"be-button-block-pill",style:{backgroundColor:m},...b,children:[a.jsx("span",{className:"be-button-block-label","data-empty":g?"":void 0,"data-placeholder":"Button",children:a.jsx(he,{blockId:e,runIds:n.contentIds,onEnter:r,onBackspaceAtStart:c,onArrowUp:i,onArrowDown:u})}),a.jsx("button",{type:"button",className:"be-button-block-open",onClick:d,disabled:!f,title:f||"No link set","aria-label":"Open link",children:"↗"}),a.jsx("button",{type:"button",className:"be-button-block-settings",onClick:()=>l(!0),"aria-label":"Edit button",title:"Edit label, link, color…",children:"⚙"})]}),a.jsx(Fr,{isOpen:s,onClose:()=>l(!1),store:t,blockId:e})]})}function qr({href:e="",label:t="Button",color:n="",customAttrs:o=[]}={}){return function(l,r){const c=B(),i=r!=null&&r.length?r:[{id:B(),type:"text",value:t,marks:{}}];return{block:{id:c,type:"button",parentId:l,contentIds:i.map(u=>u.id),props:{href:e,color:n,customAttrs:o}},runs:i}}}const ko="be-button-block-link";function Wr(e,t){var i,u,d;const n=e.contentIds.map(f=>t.store.getRun(f)),o=((i=e.props)==null?void 0:i.href)??"",s=(u=e.props)==null?void 0:u.color,l=s?` style="background-color:${re(s)}"`:"",c=(((d=e.props)==null?void 0:d.customAttrs)??[]).filter(f=>{var m;return(m=f.key)==null?void 0:m.trim()}).map(f=>` data-${re(f.key.trim())}="${re(f.value??"")}"`).join("");return`<a class="${ko}" href="${re(o)}"${l}${c}>${n.map(f=>Ie(f,t)).join("")}</a>`}function Vr(e,t){return e.contentIds.map(n=>ve(t.store.getRun(n),t)).join("")}function Yr(e,t){var l;if(e.tagName!=="A"||!e.classList.contains(ko))return null;const n=ae(e,t),o=[];for(const r of e.attributes)r.name.startsWith("data-")&&o.push({key:r.name.slice(5),value:r.value});return{block:{id:B(),type:"button",parentId:null,contentIds:n.map(r=>r.id),props:{href:e.getAttribute("href")??"",color:((l=e.style)==null?void 0:l.backgroundColor)||void 0,customAttrs:o}},runs:n}}const yo={component:zr,isLeaf:!0,defaultProps:{href:"",color:"",customAttrs:[]},toHTML:Wr,toPlainText:Vr,fromHTML:Yr,slashCommand:{label:"Button",icon:tl,keywords:["button","link","cta","action"],run:(e,t)=>Z(e,t,qr())}};function un(e){return new Promise((t,n)=>{const o=new FileReader;o.onload=()=>t(o.result),o.onerror=()=>n(o.error),o.readAsDataURL(e)})}const Ze={image:"image",video:"video",audio:"audio",file:"file"},Gr={image:"image/*",video:"video/*",audio:"audio/*",file:"*/*"},xo=20,Io=100,Xr=[{value:"left",Icon:Fs,label:"Align left"},{value:"center",Icon:Ks,label:"Align center"},{value:"right",Icon:zs,label:"Align right"}];function Jr(e){return Math.min(Io,Math.max(xo,Math.round(e)))}function Qr({kind:e,src:t,name:n}){return e==="image"?a.jsx("img",{className:"be-embed-image",src:t,alt:n||""}):e==="video"?a.jsx("video",{className:"be-embed-video",src:t,controls:!0}):e==="audio"?a.jsx("audio",{className:"be-embed-audio",src:t,controls:!0}):a.jsxs("a",{className:"be-embed-file-link",href:t,download:n||void 0,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Rn,{size:14})," ",n||t]})}function Zr({id:e}){const t=A(),n=ne(e),[o,s]=p.useState(""),[l,r]=p.useState(!1),[c,i]=p.useState(null),u=p.useRef(null),d=p.useRef(null),f=p.useCallback(v=>t.applyOperation(F(e,v)),[t,e]),m=p.useCallback(async v=>{var N;const R=(N=v.target.files)==null?void 0:N[0];if(!R)return;const L=await un(R);f({src:L,name:R.name,mimeType:R.type})},[f]),h=p.useCallback(async v=>{var N;v.preventDefault(),r(!1);const R=(N=v.dataTransfer.files)==null?void 0:N[0];if(!R)return;const L=await un(R);f({src:L,name:R.name,mimeType:R.type})},[f]),g=p.useCallback(v=>{v.preventDefault(),r(!0)},[]),b=p.useCallback(()=>r(!1),[]),k=p.useCallback(()=>{const v=o.trim();v&&(f({src:v,name:v}),s(""))},[o,f]),y=p.useCallback(()=>f({src:"",name:"",mimeType:""}),[f]),C=p.useCallback(v=>{v.preventDefault();const R=u.current,L=d.current;if(!R||!L)return;const N=R.getBoundingClientRect().width,M=L.getBoundingClientRect().width,z=v.clientX,U=W=>Jr((M+(W.clientX-z))/N*100),q=W=>i(U(W)),_=W=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",_),f({width:U(W)}),i(null)};document.addEventListener("mousemove",q),document.addEventListener("mouseup",_)},[f]);if(!n)return null;const{kind:x="file",src:E,name:w,align:S="left",width:T=100}=n.props,j=x==="image"||x==="video",I=c??T;return a.jsx("div",{className:"be-embed","data-block-id":e,"data-kind":x,contentEditable:!1,tabIndex:-1,children:E?a.jsx("div",{ref:u,className:`be-embed-preview be-embed-align-${S}`,children:a.jsxs("div",{ref:d,className:"be-embed-frame",style:j?{width:`${I}%`}:void 0,children:[a.jsxs("div",{className:"be-embed-toolbar",contentEditable:!1,children:[Xr.map(({value:v,Icon:R,label:L})=>a.jsx("button",{type:"button",className:`be-embed-toolbar-btn${S===v?" be-embed-toolbar-btn-active":""}`,title:L,"aria-label":L,"aria-pressed":S===v,onClick:()=>f({align:v}),children:a.jsx(R,{size:14})},v)),a.jsx("button",{type:"button",className:"be-embed-remove",onClick:y,"aria-label":`Remove ${Ze[x]}`,children:"Remove"})]}),a.jsx(Qr,{kind:x,src:E,name:w}),j&&a.jsx("div",{className:"be-embed-resize-handle",onMouseDown:C,role:"slider","aria-label":`Resize ${Ze[x]}`,"aria-valuemin":xo,"aria-valuemax":Io,"aria-valuenow":I})]})}):a.jsxs("div",{className:`be-embed-dropzone${l?" be-embed-dropzone-active":""}`,onDrop:h,onDragOver:g,onDragLeave:b,children:[a.jsxs("label",{className:"be-embed-upload-btn",children:["Upload ",Ze[x],a.jsx("input",{type:"file",accept:Gr[x],onChange:m,hidden:!0})]}),a.jsx("span",{className:"be-embed-dropzone-hint",children:"or drop a file, or paste a URL below"}),a.jsxs("div",{className:"be-embed-url-row",children:[a.jsx("input",{type:"text",className:"be-embed-url-input",placeholder:`https://... ${Ze[x]} URL`,value:o,onChange:v=>s(v.target.value),onKeyDown:v=>v.key==="Enter"&&k()}),a.jsx("button",{type:"button",className:"be-embed-url-commit",onClick:k,children:"Embed"})]})]})})}function ec({kind:e="file",src:t="",name:n="",mimeType:o="",align:s="left",width:l=100}={}){return function(c){return{block:{id:B(),type:"embed",parentId:c,contentIds:[],props:{kind:e,src:t,name:n,mimeType:o,align:s,width:l}},runs:[]}}}const tc={image:al,video:il,audio:ul,file:Rn},vo="be-embed-file-link";function nc(e,t,n){if(e!=="image"&&e!=="video")return"";const o=[];return n!==100&&o.push(`width:${n}%`),t==="center"?o.push("display:block","margin-left:auto","margin-right:auto"):t==="right"&&o.push("display:block","margin-left:auto"),o.length?` style="${o.join(";")}"`:""}function dn(e){var s,l,r,c;const t=(s=e.style)==null?void 0:s.width,n=t&&t.endsWith("%")?parseInt(t,10):100;let o="left";return((l=e.style)==null?void 0:l.marginLeft)==="auto"&&((r=e.style)==null?void 0:r.marginRight)==="auto"?o="center":((c=e.style)==null?void 0:c.marginLeft)==="auto"&&(o="right"),{align:o,width:Number.isFinite(n)?n:100}}function oc(e){const{kind:t,src:n,name:o,align:s="left",width:l=100}=e.props;if(!n)return"<p></p>";const r=nc(t,s,l);return t==="image"?`<img src="${re(n)}" alt="${re(o||"")}"${r}>`:t==="video"?`<video src="${re(n)}" controls${r}></video>`:t==="audio"?`<audio src="${re(n)}" controls></audio>`:`<a class="${vo}" href="${re(n)}">${Te(o||n)}</a>`}function sc(e){const{kind:t,src:n,name:o}=e.props;return n?`[${t}: ${o||n}]`:""}function lc(e){return e.tagName==="IMG"?et("image",e.getAttribute("src")??"",e.getAttribute("alt")??"",dn(e)):e.tagName==="VIDEO"?et("video",e.getAttribute("src")??"","",dn(e)):e.tagName==="AUDIO"?et("audio",e.getAttribute("src")??"",""):e.tagName==="A"&&e.classList.contains(vo)?et("file",e.getAttribute("href")??"",e.textContent??""):null}function et(e,t,n,{align:o="left",width:s=100}={}){return{block:{id:B(),type:"embed",parentId:null,contentIds:[],props:{kind:e,src:t,name:n,align:o,width:s}},runs:[]}}function rc(e){return(t,{blockId:n,runId:o,sliceStart:s,sliceEnd:l})=>{const r=t.getRun(o),c=(r==null?void 0:r.value)??"";t.applyOperation(J(o,{value:c.slice(0,s)+c.slice(l)}));const i=Nt(t,n,ec({kind:e}));return xe(t,i,P("paragraph")),i}}const Co={component:Zr,isLeaf:!0,defaultProps:{kind:"file",src:"",name:"",mimeType:"",align:"left",width:100},toHTML:oc,toPlainText:sc,fromHTML:lc,slashCommands:["image","video","audio","file"].map(e=>({label:e.charAt(0).toUpperCase()+e.slice(1),icon:tc[e],keywords:["embed","upload","insert",e],run:rc(e)}))};function cc(e){Bo(e,{paragraph:An,heading:Dn,listItem:Wn,...wo,...Ro,divider:po,callout:ho,blockquote:mo,code:go,toggleHeading:bo,button:yo,embed:Co})}function Bo(e,t){for(const[n,o]of Object.entries(t))e.register(n,o)}const wo={table:co,tableRow:ro,tableCell:lo},Ro={layout:fo,layoutColumn:uo};function ac({id:e}){const t=A(),n=ye(e),o=p.useCallback(c=>{t.applyOperation(J(e,{data:{...n==null?void 0:n.data,selectedValue:c}}))},[t,e,n==null?void 0:n.data]);if(!n)return null;const{options:s=[],selectedValue:l="",placeholder:r="Select…"}=n.data??{};return a.jsx("span",{className:"be-inline-select",onMouseDown:c=>{c.preventDefault(),c.stopPropagation()},onKeyDown:c=>c.stopPropagation(),children:a.jsx(Ne,{value:l,options:s,onChange:o,placeholder:r,ariaLabel:"Select an option"})})}function dt(e,{blockId:t,runId:n,sliceStart:o,sliceEnd:s},l){const r=e.getRun(n),c=(r==null?void 0:r.value)??"",i=c.slice(0,o),u=c.slice(s),d=l(),f={...r,value:i},m={id:B(),type:"text",value:u,marks:{...r==null?void 0:r.marks}};e.applyOperation(Ke(t,[n],[f,d,m])),Y(m.id)}function ic(e){return String(e).replace(/&/g,"&").replace(/"/g,""")}function To(e){var o;const{options:t=[],selectedValue:n=""}=e.data??{};return((o=t.find(s=>s.value===n))==null?void 0:o.label)??""}function uc(e){var n,o;const t=To(e)||((n=e.data)==null?void 0:n.placeholder)||"";return`<span data-inline-type="select" data-selected-value="${ic(((o=e.data)==null?void 0:o.selectedValue)??"")}">${t}</span>`}function dc(e){return To(e)}function fc(e){var t;return((t=e.getAttribute)==null?void 0:t.call(e,"data-inline-type"))!=="select"?null:{id:B(),type:"select",value:"",marks:{},data:{options:[],selectedValue:e.getAttribute("data-selected-value")??""}}}const jo={component:ac,isAtomic:!0,toHTML:uc,toPlainText:dc,fromHTML:fc,slashCommand:{label:"Select",icon:cl,keywords:["select","dropdown","choice","picker"],run:(e,{blockId:t,runId:n,sliceStart:o,sliceEnd:s})=>dt(e,{blockId:t,runId:n,sliceStart:o,sliceEnd:s},()=>({id:B(),type:"select",value:"",marks:{},data:{options:[],selectedValue:"",placeholder:"Select…"}}))}};function pc({id:e}){const t=A(),n=ye(e),o=p.useCallback(l=>{t.applyOperation(J(e,{data:{...n==null?void 0:n.data,isoDate:l.target.value}}))},[t,e,n==null?void 0:n.data]);if(!n)return null;const{isoDate:s=""}=n.data??{};return a.jsx("span",{className:"be-inline-date",onMouseDown:l=>l.stopPropagation(),onKeyDown:l=>l.stopPropagation(),children:a.jsx("input",{type:"date",value:s,onChange:o})})}function hc(e){return String(e).replace(/&/g,"&").replace(/"/g,""")}function So(e){if(!e)return"";const t=new Date(`${e}T00:00:00`);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function mc(e){var n;const t=((n=e.data)==null?void 0:n.isoDate)??"";return`<span data-inline-type="date" data-iso-date="${hc(t)}">${So(t)}</span>`}function gc(e){var t;return So(((t=e.data)==null?void 0:t.isoDate)??"")}function bc(e){var t;return((t=e.getAttribute)==null?void 0:t.call(e,"data-inline-type"))!=="date"?null:{id:B(),type:"date",value:"",marks:{},data:{isoDate:e.getAttribute("data-iso-date")??""}}}function kc(){return new Date().toISOString().slice(0,10)}const Eo={component:pc,isAtomic:!0,toHTML:mc,toPlainText:gc,fromHTML:bc,slashCommand:{label:"Date",icon:rl,keywords:["date","when","schedule","calendar"],run:(e,{blockId:t,runId:n,sliceStart:o,sliceEnd:s})=>dt(e,{blockId:t,runId:n,sliceStart:o,sliceEnd:s},()=>({id:B(),type:"date",value:"",marks:{},data:{isoDate:kc()}}))}};function yc({id:e}){const t=A(),n=ye(e),o=p.useCallback(c=>{t.applyOperation(J(e,{data:{...n==null?void 0:n.data,checked:c.target.checked}}))},[t,e,n==null?void 0:n.data]),s=p.useCallback(c=>{t.applyOperation(J(e,{data:{...n==null?void 0:n.data,label:c.target.value}}))},[t,e,n==null?void 0:n.data]);if(!n)return null;const{checked:l=!1,label:r=""}=n.data??{};return a.jsxs("span",{className:"be-inline-checkbox",onMouseDown:c=>c.stopPropagation(),onKeyDown:c=>c.stopPropagation(),children:[a.jsx("input",{type:"checkbox",checked:l,onChange:o}),a.jsx("input",{type:"text",className:"be-inline-checkbox-label",value:r,onChange:s,placeholder:"Label…"})]})}function xc(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Ic(e){const{checked:t=!1,label:n=""}=e.data??{};return`<span data-inline-type="checkbox" data-checked="${t}">${t?"☑":"☐"} ${xc(n)}</span>`}function vc(e){const{checked:t=!1,label:n=""}=e.data??{};return`${t?"[x]":"[ ]"} ${n}`.trim()}function Cc(e){var t;return((t=e.getAttribute)==null?void 0:t.call(e,"data-inline-type"))!=="checkbox"?null:{id:B(),type:"checkbox",value:"",marks:{},data:{checked:e.getAttribute("data-checked")==="true",label:(e.textContent??"").replace(/^[☑☐]\s*/,"")}}}const Oo={component:yc,isAtomic:!0,toHTML:Ic,toPlainText:vc,fromHTML:Cc,slashCommand:{label:"Checkbox",icon:Ln,keywords:["checkbox","todo","check","toggle"],run:(e,{blockId:t,runId:n,sliceStart:o,sliceEnd:s})=>dt(e,{blockId:t,runId:n,sliceStart:o,sliceEnd:s},()=>({id:B(),type:"checkbox",value:"",marks:{},data:{checked:!1,label:""}}))}};function Bc({id:e,blockId:t}){var h;const n=A(),o=ye(e),s=t?n.getBlock(t):null,l=s?n.getBlock(s.parentId):null,r=(l==null?void 0:l.parentId)??null,c=ne(r),i=l?l.contentIds.indexOf(t):-1,d=(((h=(c&&l?ce(c,l.contentIds.length):[])[i])==null?void 0:h.options)??[]).map((g,b)=>({...g,color:g.color??He(b)})),f=p.useCallback((g,b)=>{n.applyOperation(J(e,{data:{selectedValue:g,selectedLabel:(b==null?void 0:b.label)??""}}))},[n,e]);if(!o)return null;const{selectedValue:m=""}=o.data??{};return a.jsx("span",{className:"be-inline-table-select",onMouseDown:g=>{g.preventDefault(),g.stopPropagation()},onKeyDown:g=>g.stopPropagation(),children:a.jsx(Ne,{value:m,options:d,onChange:f,placeholder:"Select…",ariaLabel:"Select an option",variant:"tag"})})}function Lo(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function wc(e){return Lo(e).replace(/"/g,""")}function Rc(e){const{selectedValue:t="",selectedLabel:n=""}=e.data??{};return`<span data-inline-type="tableSelect" data-selected-value="${wc(t)}">${Lo(n)}</span>`}function Tc(e){var t;return((t=e.data)==null?void 0:t.selectedLabel)??""}function jc(e){var t;return((t=e.getAttribute)==null?void 0:t.call(e,"data-inline-type"))!=="tableSelect"?null:{id:B(),type:"tableSelect",value:"",marks:{},data:{selectedValue:e.getAttribute("data-selected-value")??"",selectedLabel:e.textContent??""}}}const No={component:Bc,isAtomic:!0,toHTML:Rc,toPlainText:Tc,fromHTML:jc},Mo={};function Sc(e){Ao(e,{select:jo,date:Eo,checkbox:Oo,...Do,emoji:Mo})}function Ao(e,t){for(const[n,o]of Object.entries(t))e.register(n,o)}const Do={tableSelect:No},Ec="$fieldTypes";function _o(){const e=A(),t=p.useCallback(o=>e.subscribe(Ec,o),[e]),n=p.useCallback(()=>e.getFieldTypes(),[e]);return p.useSyncExternalStore(t,n)}const Oc={canUndo:!1,canRedo:!1};function Lc(){const{history:e}=fe(),t=p.useCallback(s=>e?e.subscribeToHistory(s):()=>{},[e]),n=p.useCallback(()=>e?e.getUndoRedoSnapshot():Oc,[e]),o=p.useSyncExternalStore(t,n);return e?{...o,undo:()=>e.undo(),redo:()=>e.redo(),getHistoryLog:()=>e.getHistoryLog()}:null}const st="application/x-block-editor-blocks+json";function zt(e){return e.split(/\r\n|\r|\n/).filter(t=>t.length>0).map(t=>{const n=B();return{block:{id:B(),type:"paragraph",parentId:null,contentIds:[n],props:{}},runs:[{id:n,type:"text",value:t,marks:{}}]}})}function $o(e,t,n){const o=new DOMParser().parseFromString(e,"text/html"),s={registry:t,inlineRegistry:n},l=t.listHtmlMatchers(),r=[],c=u=>{var m;const d=u.tagName==="OL",f=[];for(const h of u.children){if(h.tagName!=="LI")continue;const g=(m=t.get("listItem"))==null?void 0:m.fromHTML(h,s);g&&(g.block.props.ordered=d,f.push(g))}return f},i=u=>{var f;const d=Array.from(u.children).filter(m=>m.tagName==="P");if(d.length===0){const m=(f=t.get("blockquote"))==null?void 0:f.fromHTML(u,s);return m?[m]:[]}return d.map(m=>{const h=ae(m,s);return{block:{id:B(),type:"blockquote",parentId:null,contentIds:h.map(g=>g.id),props:{}},runs:h}})};for(const u of o.body.childNodes){if(u.nodeType===3){const f=u.textContent.trim();f&&r.push(...zt(f));continue}if(u.nodeType!==1)continue;if(u.tagName==="UL"||u.tagName==="OL"){r.push(...c(u));continue}if(u.tagName==="BLOCKQUOTE"){r.push(...i(u));continue}let d=null;for(const f of l){const m=f.fromHTML(u,s);if(m){d=m;break}}if(d)r.push(d);else if(u.textContent.trim()){const f=ae(u,s);r.push({block:{id:B(),type:"paragraph",parentId:null,contentIds:f.map(m=>m.id),props:{}},runs:f})}}return r}function Po(e,t,n){const o=e.types??[];if(o.includes(st)){const l=e.getData(st);if(l)return Nc(l)}if(o.includes("text/html")){const l=e.getData("text/html");if(l)return $o(l,t,n)}const s=e.getData("text/plain")??"";return zt(s)}function Nc(e){return JSON.parse(e).blocks.map(n=>Ht(n))}function kt(e,t){var o;const n=e.getBlock(t);return((o=n.props)==null?void 0:o.titleRunIds)??n.contentIds}function nt(){return{id:B(),type:"text",value:"",marks:{}}}function yt(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function qt(e,t,n){const{startRunId:o,startOffset:s,endRunId:l,endOffset:r}=n,c=kt(e,t),i=c.indexOf(o),u=c.indexOf(l);if(i===-1||u===-1)return null;const[d,f]=i<=u?[i,u]:[u,i],m=i<=u?s:r,h=i<=u?r:s,g=c.slice(0,d).map(w=>e.getRun(w)),b=c.slice(f+1).map(w=>e.getRun(w)),k=c.slice(d,f+1).map(w=>e.getRun(w)),y=[];let C=null,x=0;if(d===f){const w=k[0];if(w.type==="text"){const S=Math.max(0,Math.min(m,h)),T=Math.min(w.value.length,Math.max(m,h)),j={...w,value:w.value.slice(0,S)+w.value.slice(T)};y.push(j),C=j.id,x=S}}else k.forEach((w,S)=>{if(w.type!=="text")return;const T=S===0,j=S===k.length-1,I=T?w.value.slice(0,m):"";if(T&&I){const v={...w,value:I};y.push(v),C=v.id,x=I.length}if(j&&!T){const v=w.value.slice(h);if(v){const R={id:B(),type:"text",value:v,marks:w.marks};y.push(R),C===null&&(C=R.id,x=0)}}});let E=[...g,...y,...b];if(E.length===0){const w=nt();E=[w],C=w.id,x=0}else if(C===null){const w=g[g.length-1];w?(C=w.id,x=w.type==="text"?w.value.length:0):b[0]&&(C=b[0].id,x=0)}return e.applyOperation(se(t,E)),{blockId:t,runId:C,offset:x}}function Wt(e,t){const{blockIds:n,startBlockId:o,startRunId:s,startOffset:l,endBlockId:r,endRunId:c,endOffset:i}=t;if(!n||n.length===0)return null;const u=n.indexOf(o),d=n.indexOf(r);if(u===-1||d===-1)return null;const[f,m]=u<=d?[u,d]:[d,u],h=u<=d,g=h?s:c,b=h?l:i,k=h?c:s,y=h?i:l;if(f===m)return qt(e,n[f],{startRunId:g,startOffset:b,endRunId:k,endOffset:y});const C=n[f],x=n[m],E=e.getBlock(C),w=e.getBlock(x),S=kt(e,C),T=S.indexOf(g),j=S.slice(0,T).map(O=>e.getRun(O)),I=e.getRun(g),v=I.type==="text"&&b>0?{...I,value:I.value.slice(0,b)}:null,R=kt(e,x),L=R.indexOf(k),N=R.slice(L+1).map(O=>e.getRun(O)),M=e.getRun(k),z=M.type==="text"&&y<M.value.length?{id:B(),type:"text",value:M.value.slice(y),marks:M.marks}:null,U=[...j,...v?[v]:[]],q=[...z?[z]:[],...N],_=[];for(let O=f+1;O<m;O+=1)_.push($(n[O]));const W=wn(E.type,w.type),G=e.getBlock(E.parentId),me=m-f-1+(W?1:0),ge=G&&G.contentIds.length-me===1;let oe,Q,ie;if(W){const O=[...U,...q];if(O.length===0&&ge&&E.type!=="paragraph"){const{block:X,runs:Xe}=P("paragraph")(G.id);return _.push({type:"insertBlock",block:X,parentId:G.id,index:0,subtree:{blocks:[X],runs:Xe}}),_.push($(C)),_.push($(x)),yt(e,_),{blockId:X.id,runId:X.contentIds[0],offset:0}}const H=O.length?O:[nt()];if(_.push(se(C,H)),_.push($(x)),ie=C,v)oe=v.id,Q=v.value.length;else if(j.length){const X=j[j.length-1];oe=X.id,Q=X.type==="text"?X.value.length:0}else z?(oe=z.id,Q=0):N.length?(oe=N[0].id,Q=0):(oe=H[0].id,Q=0)}else{const O=U.length?U:[nt()];if(_.push(se(C,O)),_.push(se(x,q.length?q:[nt()])),ie=C,v)oe=v.id,Q=v.value.length;else if(j.length){const H=j[j.length-1];oe=H.id,Q=H.type==="text"?H.value.length:0}else oe=O[0].id,Q=0}return yt(e,_),{blockId:ie,runId:oe,offset:Q}}function lt(e,t=""){var c;const n=e.getRootId(),o=((c=e.getBlock(n))==null?void 0:c.contentIds)??[];if(o.length===0)return null;const s=o.map(i=>$(i)),{block:l,runs:r}=P("paragraph")(n);return t&&(r[0].value=t),s.push(V(l,n,0,{blocks:[l],runs:r})),yt(e,s),{blockId:l.id,runId:l.contentIds[0],offset:t.length}}function Ho(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function _e(e,t){t.length!==0&&Ho(e,t.map(n=>$(n)))}function Uo(e,t){if(t.length===0)return!1;const n=e.getBlock(t[0]);if(!n)return!1;const o=e.getBlock(n.parentId);if(!o)return!1;const s=o.contentIds.indexOf(t[0]),l=o.contentIds.indexOf(t[t.length-1]);if(s<=0)return!1;const r=o.contentIds[s-1];return e.applyOperation(be(r,n.parentId,l)),!0}function Fo(e,t){if(t.length===0)return!1;const n=e.getBlock(t[0]);if(!n)return!1;const o=e.getBlock(n.parentId);if(!o)return!1;const s=o.contentIds.indexOf(t[0]),l=o.contentIds.indexOf(t[t.length-1]);if(l===-1||l>=o.contentIds.length-1)return!1;const r=o.contentIds[l+1];return e.applyOperation(be(r,n.parentId,s)),!0}function Ko(e,t){return t.length>0&&t.every(n=>{var o,s;return!!((s=(o=e.getBlock(n))==null?void 0:o.props)!=null&&s.hidden)})}function zo(e,t,n){t.length!==0&&Ho(e,t.map(o=>F(o,{hidden:n})))}function xt(e,t){if(t.length===0)return[];const n=e.getBlock(t[0]),o=n&&e.getBlock(n.parentId);if(!o)return t;const s=new Set(t);return o.contentIds.filter(l=>s.has(l))}function It(e){var n;let t=(e==null?void 0:e.nodeType)===1?e:e==null?void 0:e.parentElement;for(;t&&typeof t.hasAttribute=="function"&&!t.hasAttribute("data-block-id");)t=t.parentElement;return((n=t==null?void 0:t.getAttribute)==null?void 0:n.call(t,"data-block-id"))??null}function Mc(e){var f;const t=(f=window.getSelection)==null?void 0:f.call(window);if(!t||t.rangeCount===0)return[];const n=It(t.anchorNode),o=It(t.focusNode);if(!n)return[];if(!o||n===o)return[n];const s=e.getBlock(n),l=s&&e.getBlock(s.parentId);if(!l)return[n];const r=l.contentIds,c=r.indexOf(n),i=r.indexOf(o);if(c===-1||i===-1)return[n];const[u,d]=c<=i?[c,i]:[i,c];return r.slice(u,d+1)}function fn(e){const t=Ve();if(t)return qt(e,t.blockId,t);const n=Pe(e);return n?Wt(e,n):null}function Ac(e,t,n){const o=e.getRun(t.runId);if(!o||o.type!=="text")return null;const s=o.value??"",l=s.slice(0,t.offset)+n+s.slice(t.offset);return e.applyOperation(J(o.id,{value:l})),{blockId:t.blockId,runId:o.id,offset:t.offset+n.length}}function mt(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function Dc(){const e=A(),t=ze(),n=ke(),[o,s]=Tt(),[l,r]=qe(),c=p.useCallback(d=>{var b;const f=o?((b=e.getBlock(e.getRootId()))==null?void 0:b.contentIds)??[]:l.length>0?l:Mc(e);if(f.length===0)return;const{html:m,text:h,json:g}=Pt(e,t,f,n);d.clipboardData.setData("text/plain",h),d.clipboardData.setData("text/html",m),d.clipboardData.setData(st,g),d.preventDefault()},[e,t,n,o,l]),i=p.useCallback(d=>{if(c(d),o){const m=lt(e);s(!1),m!=null&&m.runId&&ue(m.runId,m.offset);return}if(l.length>0){_e(e,l),r([]);return}const f=fn(e);f!=null&&f.runId&&ue(f.runId,f.offset)},[c,e,o,s,l,r]),u=p.useCallback(d=>{var x,E,w;const f=Po(d.clipboardData,t,n);if(f.length===0)return;if(o){const S=e.getRootId(),j=(((x=e.getBlock(S))==null?void 0:x.contentIds)??[]).map(v=>$(v));let I=0;for(const{block:v,runs:R,subtreeBlocks:L=[]}of f)v.parentId=S,j.push(V(v,S,I,{blocks:[v,...L],runs:R})),I+=1;mt(e,j),s(!1),d.preventDefault();return}if(l.length>0){const S=e.getBlock(l[0]),T=(S==null?void 0:S.parentId)??null,j=T&&e.getBlock(T);let I=j?j.contentIds.indexOf(l[0]):0;const v=l.map(R=>$(R));for(const{block:R,runs:L,subtreeBlocks:N=[]}of f)R.parentId=T,v.push(V(R,T,I,{blocks:[R,...N],runs:L})),I+=1;mt(e,v),r([]),d.preventDefault();return}const m=fn(e);if(f.length===1&&f[0].runs.every(S=>S.type==="text")&&(f[0].subtreeBlocks??[]).length===0){const S=m?{blockId:m.blockId,runId:m.runId,offset:m.offset}:We();if(S){const T=f[0].runs.map(I=>I.value).join(""),j=Ac(e,S,T);if(j){ue(j.runId,j.offset),d.preventDefault();return}}}const g=(m==null?void 0:m.blockId)??It((w=(E=window.getSelection)==null?void 0:E.call(window))==null?void 0:w.anchorNode);if(!g)return;const b=e.getBlock(g);if(!b)return;let y=e.getBlock(b.parentId).contentIds.indexOf(g)+1;const C=[];for(const{block:S,runs:T,subtreeBlocks:j=[]}of f)S.parentId=b.parentId,C.push(V(S,b.parentId,y,{blocks:[S,...j],runs:T})),y+=1;mt(e,C),d.preventDefault()},[e,t,n,o,s,l,r]);return{onCopy:c,onCut:i,onPaste:u}}const _c=["bold","italic","underline","strike","subscript","superscript","code"],$c=["color","highlight"];function je(e,t){var o;const n=e.getBlock(t);return((o=n.props)==null?void 0:o.titleRunIds)??n.contentIds}function qo(e){var n;const t={};if(e.length===0)return t;for(const o of _c)t[o]=e.every(s=>{var l;return(l=s.marks)==null?void 0:l[o]});for(const o of $c){const s=((n=e[0].marks)==null?void 0:n[o])??null;t[o]=e.every(l=>{var r;return(((r=l.marks)==null?void 0:r[o])??null)===s})?s:null}return t}function Wo(e,t,n){const{startRunId:o,startOffset:s,endRunId:l,endOffset:r}=n,c=je(e,t),i=c.indexOf(o),u=c.indexOf(l);if(i===-1||u===-1)return{};const[d,f]=i<=u?[i,u]:[u,i],m=c.slice(d,f+1).map(h=>e.getRun(h)).filter(h=>h&&h.type==="text");return qo(m)}function Vo(e,t){const{blockIds:n,startBlockId:o,endBlockId:s}=t,l=n.indexOf(o),r=n.indexOf(s);if(l===-1||r===-1)return{};const[c,i]=l<=r?[l,r]:[r,l],u=[];for(let d=c;d<=i;d+=1)for(const f of je(e,n[d])){const m=e.getRun(f);m&&m.type==="text"&&u.push(m)}return qo(u)}function Yo(e,t){const n={...e};for(const[o,s]of Object.entries(t))s!=null?n[o]=s:delete n[o];return n}function Go(e,t,n,o,s,l){const r=Yo(n.marks,l);if(o===0&&s===n.value.length)return e.applyOperation({type:"updateRun",id:n.id,patch:{marks:r}}),n.id;const c=n.value.slice(0,o),i=n.value.slice(o,s),u=n.value.slice(s),d=[];c&&d.push({id:B(),type:"text",value:c,marks:{...n.marks}});const f={id:B(),type:"text",value:i,marks:r};return d.push(f),u&&d.push({id:B(),type:"text",value:u,marks:{...n.marks}}),e.applyOperation(Ke(t,[n.id],d)),f.id}function Pc(e,t,n,o){const{startRunId:s,startOffset:l,endRunId:r,endOffset:c}=n,i=je(e,t),u=i.indexOf(s),d=i.indexOf(r);if(u===-1||d===-1)return null;const[f,m]=u<=d?[u,d]:[d,u],h=u<=d?l:c,g=u<=d?c:l,b=i.slice(f,m+1),k=b.map(x=>e.getRun(x));if(f===m){const x=k[0];if(x.type!=="text")return x.id;const E=Math.max(0,Math.min(h,g)),w=Math.min(x.value.length,Math.max(h,g));return E===w?x.id:Go(e,t,x,E,w,o)}const y=[];let C=null;return k.forEach((x,E)=>{if(x.type!=="text"){y.push(x),C=x.id;return}const w=E===0,S=E===k.length-1,T=w?h:0,j=S?g:x.value.length,I=x.value.slice(0,T),v=x.value.slice(T,j),R=x.value.slice(j);I&&y.push({id:B(),type:"text",value:I,marks:{...x.marks}});const L={id:B(),type:"text",value:v,marks:Yo(x.marks,o)};y.push(L),C=L.id,R&&y.push({id:B(),type:"text",value:R,marks:{...x.marks}})}),e.applyOperation(Ke(t,b,y)),C}function Hc(e,t,n,o){var g;const{startRunId:s,startOffset:l,endRunId:r,endOffset:c}=n,i=je(e,t),u=i.indexOf(s),d=i.indexOf(r);if(u===-1||d===-1)return!0;const[f,m]=u<=d?[u,d]:[d,u],h=i.slice(f,m+1).map(b=>e.getRun(b)).filter(b=>b.type==="text");if(h.length===0)return!0;if(f===m){const b=Math.max(0,Math.min(l,c)),k=Math.min(h[0].value.length,Math.max(l,c));if(b===k)return!((g=h[0].marks)!=null&&g[o])}return!h.every(b=>{var k;return(k=b.marks)==null?void 0:k[o]})}function Uc(e,t,n,o,s,l){var f;const r=e.getRun(n),c=r.value??"",i=Math.max(0,Math.min(o,s)),u=Math.min(c.length,Math.max(o,s));if(i===u)return n;const d=!((f=r.marks)!=null&&f[l]);return Go(e,t,r,i,u,{[l]:d?!0:null})}function Ue(e,t,n,o){return Pc(e,t,n,o)}function Vt(e,t,n,o){const s=Hc(e,t,n,o);return Ue(e,t,n,{[o]:s?!0:null})}function Yt(e,t,n){return Gt(e,t,o=>({[n]:o?null:!0}),n)}function Gt(e,t,n,o){var S;const{blockIds:s,startBlockId:l,startRunId:r,startOffset:c,endBlockId:i,endRunId:u,endOffset:d}=t;if(!s||s.length===0)return null;const f=s.indexOf(l),m=s.indexOf(i);if(f===-1||m===-1)return null;const[h,g]=f<=m?[f,m]:[m,f],b=f<=m,k=b?r:u,y=b?c:d,C=b?u:r,x=b?d:c;let E=n;if(typeof n=="function"){let T=!1,j=!0;for(let I=h;I<=g;I+=1){const v=je(e,s[I]).map(R=>e.getRun(R)).filter(R=>R.type==="text");v.length!==0&&(T=!0,v.every(R=>{var L;return(L=R.marks)==null?void 0:L[o]})||(j=!1))}E=n(T&&j)}if(h===g)return Ue(e,s[h],{startRunId:k,startOffset:y,endRunId:C,endOffset:x},E);let w=null;for(let T=h;T<=g;T+=1){const j=s[T],I=je(e,j),v=I[0],R=I[I.length-1],L=e.getRun(R),N=((S=L==null?void 0:L.value)==null?void 0:S.length)??0;let M;T===h&&T===g?M={startRunId:k,startOffset:y,endRunId:C,endOffset:x}:T===h?M={startRunId:k,startOffset:y,endRunId:R,endOffset:N}:T===g?M={startRunId:v,startOffset:0,endRunId:C,endOffset:x}:M={startRunId:v,startOffset:0,endRunId:R,endOffset:N},w=Ue(e,j,M,E)}return w}function Xo(e,t){var o;const n=e.getBlock(t);return((o=n==null?void 0:n.props)==null?void 0:o.titleRunIds)??(n==null?void 0:n.contentIds)??[]}function Jo(e){const t=Ve();if(!t)return!1;const{blockId:n,startRunId:o,startOffset:s,endRunId:l,endOffset:r}=t,c=Xo(e,n);if(c.length===0)return!1;const i=c.indexOf(o),u=c.indexOf(l);if(i===-1||u===-1)return!1;const[d,f]=i<=u?[i,u]:[u,i],m=i<=u?s:r,h=i<=u?r:s;if(d!==0||f!==c.length-1||m!==0)return!1;const g=e.getRun(c[c.length-1]),b=(g==null?void 0:g.type)==="text"?(g.value??"").length:1;return h===b}function Fc(e){const t=We();return t?le(e,Xo(e,t.blockId)):!1}function Kc(e,t,n){var h,g;const o=e.getBlock(t);if(!o){n(null);return}const s=e.getBlock(o.parentId),l=s?s.contentIds.indexOf(t):-1,r=l>0?s.contentIds[l-1]:null,c=l!==-1&&l<s.contentIds.length-1?s.contentIds[l+1]:null;e.applyOperation($(t)),n(null);const i=Oe(e),u=r??c??i;if(!u)return;const d=e.getBlock(u);if(Se(e,d)){n(u),requestAnimationFrame(()=>{var b;return(b=document.querySelector(`[data-block-id="${u}"]`))==null?void 0:b.focus()});return}const f=(h=d==null?void 0:d.props)==null?void 0:h.titleRunIds,m=((g=d==null?void 0:d.contentIds)==null?void 0:g[d.contentIds.length-1])??(f==null?void 0:f[f.length-1]);m&&Y(m)}const pn={b:"bold",i:"italic",u:"underline"};function zc(e){const t=A(),[n,o]=Tt(),{getSelectedBlockId:s,setSelectedBlockId:l}=pe();p.useEffect(()=>{const r=e.current;if(!r)return;const c=u=>{var f,m;if(s()&&(u.key==="Backspace"||u.key==="Delete")&&!u.defaultPrevented){u.preventDefault(),u.stopPropagation(),Kc(t,s(),l);return}if(s()&&u.key!=="Backspace"&&u.key!=="Delete"&&l(null),u.metaKey||u.ctrlKey){const h=u.key.toLowerCase();if(h==="z"&&!u.shiftKey){u.preventDefault(),(f=t.undo)==null||f.call(t);return}if(h==="z"&&u.shiftKey||h==="y"){u.preventDefault(),(m=t.redo)==null||m.call(t);return}if(h==="a"){if(n)return;(Jo(t)||Fc(t))&&(u.preventDefault(),o(!0));return}if(pn[h]){if(n)return;u.preventDefault();const g=pn[h],b=Ve();if(b){const y=Vt(t,b.blockId,b,g);y&&Y(y);return}const k=Pe(t);if(k){const y=Yt(t,k,g);y&&Y(y)}}return}if(n){if(u.key==="Backspace"||u.key==="Delete"){u.preventDefault(),u.stopPropagation();const h=lt(t);o(!1),h!=null&&h.runId&&ue(h.runId,h.offset);return}if(u.key.length===1){u.preventDefault(),u.stopPropagation();const h=lt(t,u.key);o(!1),h!=null&&h.runId&&ue(h.runId,h.offset);return}if(o(!1),u.key==="Escape")return}if(u.key==="Backspace"||u.key==="Delete"){const h=Pe(t);if(!h)return;u.preventDefault(),u.stopPropagation();const g=Wt(t,h);g!=null&&g.runId&&ue(g.runId,g.offset)}},i=()=>{n&&o(!1),s()&&l(null)};return r.addEventListener("keydown",c),r.addEventListener("mousedown",i),()=>{r.removeEventListener("keydown",c),r.removeEventListener("mousedown",i)}},[e,t,n,o,s,l])}async function vt(e,t,n,o){var r,c,i;const{html:s,text:l}=Pt(e,t,o,n);if(typeof ClipboardItem<"u"&&((r=navigator.clipboard)!=null&&r.write)){await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([l],{type:"text/plain"}),"text/html":new Blob([s],{type:"text/html"})})]);return}await((i=(c=navigator.clipboard)==null?void 0:c.writeText)==null?void 0:i.call(c,l))}function qc(){const e=A(),t=ze(),n=ke(),[o,s]=qe(),[l,r]=p.useState(null),c=p.useRef(null),i=o.length>0,u=p.useCallback(()=>s([]),[s]);p.useEffect(()=>{if(!i){r(null);return}const y=o[o.length-1],C=document.querySelector(`[data-block-row-id="${y}"]`);r((C==null?void 0:C.getBoundingClientRect())??null)},[i,o]),p.useEffect(()=>{if(!i)return;const y=x=>{var E,w,S;(E=c.current)!=null&&E.contains(x.target)||(S=(w=x.target).closest)!=null&&S.call(w,".be-block-gutter")||u()},C=x=>{x.key==="Escape"?u():(x.key==="Delete"||x.key==="Backspace")&&(x.preventDefault(),_e(e,o),u())};return document.addEventListener("mousedown",y),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",C)}},[i,e,o,u]);const d=p.useCallback(()=>{vt(e,t,n,o)},[e,t,n,o]),f=p.useCallback(async()=>{await vt(e,t,n,o),_e(e,o),u()},[e,t,n,o,u]),m=p.useCallback(()=>{_e(e,o),u()},[e,o,u]),h=p.useCallback(()=>{Uo(e,o)&&s(xt(e,o))},[e,o,s]),g=p.useCallback(()=>{Fo(e,o)&&s(xt(e,o))},[e,o,s]),b=Ko(e,o),k=p.useCallback(()=>{zo(e,o,!b),s(y=>[...y])},[e,o,b,s]);return!i||!l?null:Fe.createPortal(a.jsxs("div",{ref:c,role:"menu","aria-label":"Selected blocks options",className:"be-block-range-menu",style:{position:"fixed",top:l.bottom+4,left:l.left},children:[a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:d,children:[a.jsx(Sn,{size:15})," Copy"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:f,children:[a.jsx(Ws,{size:15})," Cut"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:h,children:[a.jsx(En,{size:15})," Move up"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:g,children:[a.jsx(On,{size:15})," Move down"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:k,children:[b?a.jsx(Nn,{size:15}):a.jsx(Mn,{size:15}),b?"Show in preview":"Hide in preview"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item be-block-range-menu-item-danger",onClick:m,children:[a.jsx(jn,{size:15})," Delete"]})]}),document.body)}const Wc=4;function Vc(e,t,n){const o=e.getBlock(t);if(!o)return[];const s=e.getBlock(o.parentId);if(!s)return[t];const l=s.contentIds,r=l.indexOf(t),c=n?l.indexOf(n):r;if(r===-1)return[t];const[i,u]=c===-1?[r,r]:[Math.min(r,c),Math.max(r,c)];return l.slice(i,u+1)}function Yc(){var e,t;return typeof window<"u"&&((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)"))==null?void 0:t.matches)===!0}function Gc(e){const t=A(),[,n]=qe(),o=p.useRef(null),s=p.useRef(!1),l=p.useRef(null),r=p.useCallback(d=>{var h,g,b,k,y;if(!o.current)return;if(!s.current){const{x:C,y:x}=l.current??{x:d.clientX,y:d.clientY};if(Math.hypot(d.clientX-C,d.clientY-x)<Wc)return;s.current=!0,document.documentElement.classList.add("be-block-range-dragging"),(g=(h=window.getSelection)==null?void 0:h.call(window))==null||g.removeAllRanges()}(k=(b=window.getSelection)==null?void 0:b.call(window))==null||k.removeAllRanges(),d.preventDefault();const f=(y=document.elementFromPoint(d.clientX,d.clientY))==null?void 0:y.closest("[data-block-row-id]"),m=(f==null?void 0:f.getAttribute("data-block-row-id"))??null;n(Vc(t,o.current,m))},[t,n]),c=p.useCallback(()=>{o.current=null,s.current=!1,l.current=null,document.documentElement.classList.remove("be-block-range-dragging")},[]),i=p.useCallback((d,f)=>{o.current=d,s.current=!1,l.current={x:f.clientX,y:f.clientY}},[]),u=p.useCallback(d=>{var b,k;if(d.button!==0||Yc()||(k=(b=d.target).closest)!=null&&k.call(b,"button, input, textarea, select"))return;const f=d.target.closest("[data-block-row-id]");if(f){const y=f.querySelector(".be-block-row-content"),C=y==null?void 0:y.getBoundingClientRect();if(C&&d.clientX>=C.left&&d.clientX<=C.right)return;i(f.getAttribute("data-block-row-id"),d);return}const m=e==null?void 0:e.current;if(!m)return;const g=[...m.querySelectorAll("[data-block-row-id]")].find(y=>{const C=y.getBoundingClientRect();return d.clientY>=C.top&&d.clientY<=C.bottom});g&&i(g.getAttribute("data-block-row-id"),d)},[e,i]);p.useEffect(()=>(document.addEventListener("mousedown",u),document.addEventListener("mousemove",r),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",c),document.documentElement.classList.remove("be-block-range-dragging")}),[u,r,c])}function Xc({minHeight:e=180,className:t="be-trailing-space"}){const n=A(),[o]=jt(),s=p.useCallback(()=>{var u;if(o)return;const l=n.getRootId(),r=n.getBlock(l),c=(u=r==null?void 0:r.contentIds)==null?void 0:u[r.contentIds.length-1];if(!c){const d=Oe(n);d&&sn(n,d);return}const i=n.getBlock(c);(i==null?void 0:i.type)==="paragraph"?sn(n,c):xe(n,c,P("paragraph"))},[n,o]);return a.jsx("div",{className:t,style:{minHeight:e},onClick:s})}function Jc(e,t,n,o){p.useEffect(()=>{if(!e||!t)return;const s=document.querySelector(`[data-run-id="${t}"]`);if(s)return s.setAttribute("aria-expanded","true"),s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-controls",o),n&&s.setAttribute("aria-activedescendant",n),()=>{s.removeAttribute("aria-expanded"),s.removeAttribute("aria-haspopup"),s.removeAttribute("aria-controls"),s.removeAttribute("aria-activedescendant")}},[e,t,n,o])}function Qc({isOpen:e,rect:t,commands:n,runId:o,onSelect:s,onClose:l,menuId:r="be-slash-menu",ariaLabel:c="Slash commands"}){const[i,u]=p.useState(0),d=p.useRef(null);p.useEffect(()=>{u(0)},[n.length]),p.useEffect(()=>{var h,g;(g=(h=d.current)==null?void 0:h.scrollIntoView)==null||g.call(h,{block:"nearest"})},[i]),p.useEffect(()=>{if(!e)return;const h=g=>{g.key==="ArrowDown"?(g.preventDefault(),g.stopPropagation(),u(b=>Math.min(b+1,Math.max(n.length-1,0)))):g.key==="ArrowUp"?(g.preventDefault(),g.stopPropagation(),u(b=>Math.max(b-1,0))):g.key==="Enter"?(g.preventDefault(),g.stopPropagation(),n[i]&&s(n[i])):g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),l())};return document.addEventListener("keydown",h,!0),()=>document.removeEventListener("keydown",h,!0)},[e,n,i,s,l]);const m=n[i]?`${r}-option-${i}`:null;return Jc(e,o,m,r),!e||n.length===0||!t?null:a.jsx("div",{id:r,role:"listbox","aria-label":c,className:"be-slash-menu",style:{position:"fixed",top:t.bottom+4,left:t.left,zIndex:1e3},children:n.map((h,g)=>{const b=h.icon;return a.jsxs("div",{ref:g===i?d:void 0,id:`${r}-option-${g}`,role:"option","aria-selected":g===i,className:`be-slash-menu-item${g===i?" be-slash-menu-item-active":""}`,onMouseDown:k=>{k.preventDefault(),s(h)},onMouseEnter:()=>u(g),children:[b&&a.jsx("span",{className:"be-slash-menu-item-icon",children:a.jsx(b,{size:16})}),a.jsx("span",{className:"be-slash-menu-item-label",children:h.label})]},h.label)})})}function Zc(e,t){var o;if(!t)return!0;const n=t.toLowerCase();return e.label.toLowerCase().includes(n)||((o=e.keywords)==null?void 0:o.some(s=>s.toLowerCase().includes(n)))}function ea(e,t){const n=t.anchorNode,o=t.anchorOffset;let s;if(n===e){s="";for(let l=0;l<o&&l<e.childNodes.length;l+=1)s+=e.childNodes[l].textContent??""}else n&&n.parentElement===e?s=(n.textContent??"").slice(0,o):s=e.textContent??"";return de(s).length}function Xt(e,t,n){const o=A(),[s,l]=p.useState(null);p.useEffect(()=>{const u=e.current;if(!u)return;const d=()=>{var w,S,T,j;const m=(w=window.getSelection)==null?void 0:w.call(window),h=m==null?void 0:m.anchorNode;let g=(h==null?void 0:h.nodeType)===1?h:h==null?void 0:h.parentElement;for(;g&&typeof g.hasAttribute=="function"&&!g.hasAttribute("data-run-id");)g=g.parentElement;const b=(S=g==null?void 0:g.getAttribute)==null?void 0:S.call(g,"data-run-id");if(!b||!m){l(null);return}const k=ea(g,m),y=de(g.textContent).slice(0,k),C=t.exec(y);if(!C){l(null);return}const x=(j=(T=g.closest)==null?void 0:T.call(g,"[data-block-id]"))==null?void 0:j.getAttribute("data-block-id");if(!x){l(null);return}const E=C.index+C[1].length;l({query:C[2],blockId:x,runId:b,sliceStart:E,sliceEnd:k,rect:g.getBoundingClientRect()})},f=m=>{m.key==="Escape"&&l(null)};return u.addEventListener("input",d),u.addEventListener("keydown",f),()=>{u.removeEventListener("input",d),u.removeEventListener("keydown",f)}},[e,t]);const r=s?n().filter(u=>Zc(u,s.query)):[],c=p.useCallback(u=>{s&&(u.run(o,{blockId:s.blockId,runId:s.runId,sliceStart:s.sliceStart,sliceEnd:s.sliceEnd}),l(null))},[s,o]),i=p.useCallback(()=>l(null),[]);return{isOpen:!!s,query:(s==null?void 0:s.query)??"",rect:(s==null?void 0:s.rect)??null,runId:(s==null?void 0:s.runId)??null,commands:r,selectCommand:c,close:i}}const ta=/(^|\s)\/(\w*)$/;function na(e){const t=ze(),n=ke(),o=p.useCallback(()=>[...t.listSlashCommands(),...(n==null?void 0:n.listSlashCommands())??[]],[t,n]);return Xt(e,ta,o)}const oa=[{char:"😀",name:"grinning face",keywords:["smile","happy"]},{char:"😂",name:"face with tears of joy",keywords:["laugh","lol"]},{char:"😍",name:"heart eyes",keywords:["love","crush"]},{char:"😎",name:"cool",keywords:["sunglasses"]},{char:"🤔",name:"thinking face",keywords:["hmm"]},{char:"😉",name:"winking face",keywords:["wink"]},{char:"😢",name:"crying face",keywords:["sad","tear"]},{char:"😡",name:"angry face",keywords:["mad","rage"]},{char:"😱",name:"screaming face",keywords:["shock","scared"]},{char:"🥳",name:"party face",keywords:["celebrate","birthday"]},{char:"🙏",name:"folded hands",keywords:["please","pray","thanks"]},{char:"👍",name:"thumbs up",keywords:["approve","yes","like"]},{char:"👎",name:"thumbs down",keywords:["disapprove","no"]},{char:"👏",name:"clapping hands",keywords:["applause","congrats"]},{char:"🙌",name:"raised hands",keywords:["hooray","yay"]},{char:"👋",name:"waving hand",keywords:["hello","bye"]},{char:"✌️",name:"victory hand",keywords:["peace"]},{char:"💪",name:"flexed biceps",keywords:["strong","muscle"]},{char:"🤝",name:"handshake",keywords:["deal","agree"]},{char:"❤️",name:"red heart",keywords:["love"]},{char:"🔥",name:"fire",keywords:["hot","lit"]},{char:"⭐",name:"star",keywords:["favorite"]},{char:"✨",name:"sparkles",keywords:["shiny","magic"]},{char:"🎉",name:"party popper",keywords:["celebrate","congrats"]},{char:"🎊",name:"confetti ball",keywords:["celebrate"]},{char:"💡",name:"light bulb",keywords:["idea","tip"]},{char:"✅",name:"check mark",keywords:["done","yes","complete"]},{char:"❌",name:"cross mark",keywords:["no","wrong","delete"]},{char:"⚠️",name:"warning",keywords:["caution","alert"]},{char:"❓",name:"question mark",keywords:["question","help"]},{char:"❗",name:"exclamation mark",keywords:["important","alert"]},{char:"🚀",name:"rocket",keywords:["launch","fast","ship"]},{char:"🐛",name:"bug",keywords:["bug","issue"]},{char:"🔧",name:"wrench",keywords:["fix","tool","settings"]},{char:"📌",name:"pushpin",keywords:["pin","note"]},{char:"📎",name:"paperclip",keywords:["attachment","clip"]},{char:"📅",name:"calendar",keywords:["date","schedule"]},{char:"⏰",name:"alarm clock",keywords:["time","reminder"]},{char:"📈",name:"chart increasing",keywords:["growth","stats"]},{char:"📉",name:"chart decreasing",keywords:["decline","stats"]},{char:"💰",name:"money bag",keywords:["money","cash"]},{char:"💬",name:"speech balloon",keywords:["comment","chat"]},{char:"📝",name:"memo",keywords:["note","write"]},{char:"📚",name:"books",keywords:["reading","docs"]},{char:"🔗",name:"link",keywords:["url","chain"]},{char:"🔒",name:"locked",keywords:["private","secure"]},{char:"🔑",name:"key",keywords:["password","access"]},{char:"☕",name:"coffee",keywords:["coffee","break"]},{char:"🍕",name:"pizza",keywords:["food"]},{char:"🎂",name:"birthday cake",keywords:["birthday","cake"]},{char:"🎁",name:"gift",keywords:["present"]},{char:"🌟",name:"glowing star",keywords:["star","shiny"]},{char:"🌈",name:"rainbow",keywords:["colorful"]},{char:"☀️",name:"sun",keywords:["sunny","weather"]},{char:"🌧️",name:"rain cloud",keywords:["rainy","weather"]},{char:"🐶",name:"dog face",keywords:["dog","pet"]},{char:"🐱",name:"cat face",keywords:["cat","pet"]},{char:"🌍",name:"globe",keywords:["world","earth"]},{char:"🎯",name:"direct hit",keywords:["target","goal"]},{char:"🏆",name:"trophy",keywords:["win","award"]},{char:"🕐",name:"clock",keywords:["time"]},{char:"📣",name:"megaphone",keywords:["announce","shout"]},{char:"🧠",name:"brain",keywords:["smart","idea","mind"]},{char:"👀",name:"eyes",keywords:["look","watching"]}];function sa(e,{runId:t,sliceStart:n,sliceEnd:o},s){const l=e.getRun(t),r=(l==null?void 0:l.value)??"",c=r.slice(0,n)+s+r.slice(o);e.applyOperation(J(t,{value:c})),ue(t,n+s.length)}const la=oa.map(({char:e,name:t,keywords:n})=>({label:`${e} ${t}`,keywords:n,run:(o,s)=>sa(o,s,e)})),ra=/(^|\s):(\w*)$/,ca=()=>la;function aa(e){return Xt(e,ra,ca)}const ia=/(^|\s)@(\w*)$/;function ua(e){const t=ke(),n=p.useCallback(()=>(t==null?void 0:t.listAtCommands())??[],[t]);return Xt(e,ia,n)}const da=[{markName:"bold",Icon:$s,title:"Bold (Ctrl+B)"},{markName:"italic",Icon:Ps,title:"Italic (Ctrl+I)"},{markName:"underline",Icon:Hs,title:"Underline (Ctrl+U)"},{markName:"strike",Icon:Us,title:"Strikethrough"}],fa=[{label:"Default",value:null},{label:"Red",value:"#e03131"},{label:"Orange",value:"#e8590c"},{label:"Green",value:"#2f9e44"},{label:"Blue",value:"#1971c2"},{label:"Purple",value:"#9c36b5"}],pa=[{label:"None",value:null},{label:"Yellow",value:"#fff3bf"},{label:"Green",value:"#d3f9d8"},{label:"Blue",value:"#d0ebff"},{label:"Pink",value:"#ffdeeb"},{label:"Gray",value:"#e9ecef"}];function ha({isOpen:e,rect:t,kind:n,selection:o,crossSelection:s,marks:l,store:r}){const[c,i]=p.useState(null),u=p.useRef(null);p.useEffect(()=>{if(!c)return;const h=b=>{u.current&&!u.current.contains(b.target)&&i(null)},g=b=>{b.key==="Escape"&&i(null)};return document.addEventListener("mousedown",h),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",g)}},[c]),p.useEffect(()=>{i(null)},[t,n]);const d=p.useCallback(h=>{const g=n==="same-block"?Ue(r,o.blockId,o,h):Gt(r,s,h);g&&Y(g),i(null)},[r,n,o,s]),f=p.useCallback(h=>{const g=n==="same-block"?Vt(r,o.blockId,o,h):Yt(r,s,h);g&&Y(g)},[r,n,o,s]),m=p.useCallback(h=>{const g=h==="subscript"?"superscript":"subscript",b=!l[h];d({[h]:b?!0:null,[g]:null})},[l,d]);return!e||!t?null:a.jsxs("div",{ref:u,className:"be-floating-toolbar",role:"toolbar","aria-label":"Text formatting",style:{position:"fixed",top:t.top-44,left:t.left+t.width/2,transform:"translateX(-50%)"},onMouseDown:h=>h.preventDefault(),children:[da.map(({markName:h,Icon:g,title:b})=>a.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l[h]?" be-floating-toolbar-btn-active":""}`,title:b,"aria-label":b,"aria-pressed":!!l[h],onClick:()=>f(h),children:a.jsx(g,{})},h)),a.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l.subscript?" be-floating-toolbar-btn-active":""}`,title:"Subscript","aria-pressed":!!l.subscript,onClick:()=>m("subscript"),children:"X₂"}),a.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l.superscript?" be-floating-toolbar-btn-active":""}`,title:"Superscript","aria-pressed":!!l.superscript,onClick:()=>m("superscript"),children:"X²"}),a.jsx("span",{className:"be-floating-toolbar-divider"}),a.jsxs("div",{className:"be-floating-toolbar-picker-wrap",children:[a.jsx("button",{type:"button",className:"be-floating-toolbar-btn",title:"Text color","aria-haspopup":"true","aria-expanded":c==="color",onClick:()=>i(h=>h==="color"?null:"color"),children:a.jsx("span",{style:{color:l.color||"inherit",fontWeight:700},children:"A"})}),c==="color"&&a.jsx("div",{className:"be-floating-toolbar-picker",role:"menu","aria-label":"Text color",children:fa.map(h=>a.jsx("button",{type:"button",role:"menuitem",className:"be-floating-toolbar-swatch",title:h.label,onClick:()=>d({color:h.value}),children:a.jsx("span",{style:{color:h.value||"#1a1a1a",fontWeight:700},children:"A"})},h.label))})]}),a.jsxs("div",{className:"be-floating-toolbar-picker-wrap",children:[a.jsx("button",{type:"button",className:"be-floating-toolbar-btn",title:"Highlight","aria-haspopup":"true","aria-expanded":c==="highlight",onClick:()=>i(h=>h==="highlight"?null:"highlight"),children:a.jsx("span",{style:{backgroundColor:l.highlight||"transparent",padding:"0 2px",borderRadius:2},children:"H"})}),c==="highlight"&&a.jsx("div",{className:"be-floating-toolbar-picker",role:"menu","aria-label":"Highlight color",children:pa.map(h=>a.jsx("button",{type:"button",role:"menuitem",className:"be-floating-toolbar-swatch",style:{backgroundColor:h.value||"transparent"},title:h.label,onClick:()=>d({highlight:h.value})},h.label))})]})]})}function ma(e){const t=A(),[n,o]=p.useState(null);return p.useEffect(()=>{const s=e.current;if(!s)return;const l=()=>{var d,f,m;const r=(d=window.getSelection)==null?void 0:d.call(window);if(!r||r.rangeCount===0||r.isCollapsed){o(null);return}if(!s.contains(r.anchorNode)||!s.contains(r.focusNode)){o(null);return}const c=((m=(f=r.getRangeAt(0)).getBoundingClientRect)==null?void 0:m.call(f))??{top:0,left:0,right:0,bottom:0,width:0,height:0},i=Ve();if(i){o({kind:"same-block",rect:c,selection:i,marks:Wo(t,i.blockId,i)});return}const u=Pe(t);if(u){o({kind:"cross-block",rect:c,crossSelection:u,marks:Vo(t,u)});return}o(null)};return document.addEventListener("selectionchange",l),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),()=>{document.removeEventListener("selectionchange",l),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)}},[e,t]),{isOpen:!!n,rect:(n==null?void 0:n.rect)??null,kind:(n==null?void 0:n.kind)??null,selection:(n==null?void 0:n.selection)??null,crossSelection:(n==null?void 0:n.crossSelection)??null,marks:(n==null?void 0:n.marks)??{},close:()=>o(null)}}function ga({id:e,label:t,placeholder:n,variant:o,options:s,onManage:l}){const r=A(),c=ye(e),i=p.useCallback((m,h)=>{r.applyOperation(J(e,{data:{selectedValue:m,selectedLabel:(h==null?void 0:h.label)??"",selectedColor:h==null?void 0:h.color}}))},[r,e]);if(!c)return null;const{selectedValue:u="",selectedLabel:d="",selectedColor:f}=c.data??{};return a.jsx("span",{className:"be-inline-select",onMouseDown:m=>{m.preventDefault(),m.stopPropagation()},onKeyDown:m=>m.stopPropagation(),children:a.jsx(Ne,{value:u,selectedLabel:d,selectedColor:f,options:s,onChange:i,placeholder:n,variant:o,ariaLabel:t,onManageOptions:l})})}function Qo(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function hn(e){return Qo(e).replace(/"/g,""")}function Zo({type:e,label:t,placeholder:n="Select…",variant:o="default",icon:s,options:l,onManage:r,triggers:c=["slash"]}){function i(h){var b,k;const g=((b=h.data)==null?void 0:b.selectedLabel)||"";return`<span data-inline-type="${hn(e)}" data-selected-value="${hn(((k=h.data)==null?void 0:k.selectedValue)??"")}">${Qo(g)}</span>`}function u(h){var g;return((g=h.data)==null?void 0:g.selectedLabel)??""}function d(h){var g;return((g=h.getAttribute)==null?void 0:g.call(h,"data-inline-type"))!==e?null:{id:B(),type:e,value:"",marks:{},data:{selectedValue:h.getAttribute("data-selected-value")??"",selectedLabel:h.textContent??""}}}function f({id:h}){return a.jsx(ga,{id:h,label:t,placeholder:n,variant:o,options:l,onManage:r})}const m={label:t,icon:s,keywords:[t.toLowerCase(),"select","field"],run:(h,{blockId:g,runId:b,sliceStart:k,sliceEnd:y})=>dt(h,{blockId:g,runId:b,sliceStart:k,sliceEnd:y},()=>({id:B(),type:e,value:"",marks:{},data:{selectedValue:"",selectedLabel:"",selectedColor:void 0}}))};return{component:f,isAtomic:!0,toHTML:i,toPlainText:u,fromHTML:d,slashCommand:c.includes("slash")?m:void 0,atCommand:c.includes("at")?m:void 0}}function es(e,t,{onManage:n}={}){for(const o of e.getFieldTypes())t.register(o.id,Zo({type:o.id,label:o.label,placeholder:o.placeholder,variant:o.variant,options:o.options??[],onManage:n?()=>n(o.id):void 0}))}function ts(){const e=A(),t=ke(),n=_o(),{openEdit:o}=St(),s=p.useRef([]);p.useEffect(()=>{if(!t)return;const l=new Set(n.map(r=>r.id));for(const r of s.current)l.has(r)||t.unregister(r);es(e,t,{onManage:o}),s.current=[...l]},[e,t,n,o])}function ba(){ts();const e=A(),{target:t,close:n}=St(),o=t!==null,s=o&&t!=="new",[l,r]=p.useState(""),[c,i]=p.useState([]),[u,d]=p.useState("");p.useEffect(()=>{if(o){if(s){const k=e.getFieldType(t);r((k==null?void 0:k.label)??""),i((k==null?void 0:k.options)??[])}else r(""),i([]);d("")}},[o,s,t,e]);const f=p.useCallback((k,y)=>{i(C=>C.map(x=>x.value===k?{...x,label:y}:x))},[]),m=p.useCallback(k=>{i(y=>y.filter(C=>C.value!==k))},[]),h=p.useCallback(()=>{const k=u.trim();d(""),k&&i(y=>[...y,{value:B(),label:k,color:He(y.length)}])},[u]),g=p.useCallback(()=>{const k=l.trim();k&&(s?e.applyOperation(Bt(t,{label:k,options:c})):e.applyOperation(Ct({id:B(),label:k,placeholder:"Select…",variant:"tag",options:c})),n())},[e,s,t,l,c,n]),b=p.useCallback(()=>{s&&e.applyOperation(wt(t)),n()},[e,s,t,n]);return a.jsxs(Kt,{isOpen:o,onClose:n,title:s?"Edit field type":"New field type",children:[a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"Name"}),a.jsx("input",{type:"text",value:l,onChange:k=>r(k.target.value),placeholder:"e.g. Priority, Status…",autoFocus:!0})]}),a.jsxs("div",{className:"be-modal-field",children:[a.jsx("span",{children:"Options"}),c.map((k,y)=>a.jsxs("div",{className:"be-table-header-menu-option-row",children:[a.jsx("span",{className:"be-table-header-menu-option-swatch",style:{background:(k.color??He(y)).bg},"aria-hidden":"true"}),a.jsx("input",{className:"be-table-header-menu-option-input",value:k.label,onChange:C=>f(k.value,C.target.value),"aria-label":`Rename option ${k.label}`}),a.jsx("button",{type:"button",className:"be-table-header-menu-option-remove",onClick:()=>m(k.value),"aria-label":`Remove option ${k.label}`,children:a.jsx(ct,{size:14})})]},k.value)),a.jsxs("div",{className:"be-table-header-menu-option-row",children:[a.jsx("input",{className:"be-table-header-menu-option-input",value:u,onChange:k=>d(k.target.value),placeholder:"New option…",onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),h())}}),a.jsx("button",{type:"button",className:"be-table-header-menu-option-add",onClick:h,"aria-label":"Add option",children:"+"})]})]}),a.jsxs("div",{className:"be-modal-actions",children:[s&&a.jsx("button",{type:"button",className:"be-modal-delete",onClick:b,children:"Delete field type"}),a.jsx("button",{type:"button",className:"be-modal-cancel",onClick:n,children:"Cancel"}),a.jsx("button",{type:"button",className:"be-modal-save",onClick:g,children:"Save"})]})]})}exports.APP_MIME=st;exports.BlockChildren=Ce;exports.BlockErrorBoundary=_n;exports.BlockGutterRow=Kn;exports.BlockRangeActionMenu=qc;exports.BlockRegistry=mn;exports.BlockRenderer=_t;exports.COLUMN_TYPES=Vn;exports.DEFAULT_COLUMN_TYPE=at;exports.DEFAULT_COLUMN_WIDTH=it;exports.EditableBlockContent=he;exports.EditorProvider=us;exports.EditorStore=Rt;exports.EditorTrailingSpace=Xc;exports.FieldTypeEditorModal=ba;exports.FloatingToolbar=ha;exports.History=cs;exports.InlineRegistry=gn;exports.LAYOUT_BLOCKS=Ro;exports.MIN_COLUMN_WIDTH=ot;exports.Modal=Kt;exports.Select=Ne;exports.SlashMenu=Qc;exports.TABLE_BLOCKS=wo;exports.TABLE_SELECT_INLINE_TYPES=Do;exports.TableHeaderRow=oo;exports.blankRunForType=Yn;exports.blockquoteBlockType=mo;exports.buttonBlockType=yo;exports.calloutBlockType=ho;exports.checkboxInlineType=Oo;exports.codeBlockType=go;exports.convertRunToType=Gn;exports.copyBlockRangeToClipboard=vt;exports.createBlockRegistry=as;exports.createCellForColumn=ut;exports.createDefaultColumns=Ut;exports.createInlineRegistry=is;exports.createSelectFieldType=Zo;exports.dateInlineType=Eo;exports.deleteBlockAndFocusSibling=Fn;exports.deleteBlockRange=_e;exports.deleteColumn=Zn;exports.deleteEntireDocument=lt;exports.deleteOverBlockRange=Wt;exports.deleteRow=Qn;exports.deleteRunRangeInBlock=qt;exports.deserializeClipboard=Po;exports.dividerBlockType=po;exports.duplicateBlock=Pn;exports.embedBlockType=Co;exports.emojiInlineType=Mo;exports.ensureRootNonEmpty=Oe;exports.focusRunAtOffset=ue;exports.focusRunEnd=Y;exports.focusRunStart=Et;exports.getMarksSummaryOverBlockRange=Vo;exports.getMarksSummaryOverSelection=Wo;exports.headingBlockType=Dn;exports.insertColumnAfter=bt;exports.insertRowAfter=Jn;exports.isEntireBlockRangeHidden=Ko;exports.isEntireBlockSelected=Jo;exports.layoutBlockType=fo;exports.layoutColumnBlockType=uo;exports.listItemBlockType=Wn;exports.moveBlockDown=Un;exports.moveBlockRangeDown=Fo;exports.moveBlockRangeUp=Uo;exports.moveBlockUp=Hn;exports.operations=ls;exports.paragraphBlockType=An;exports.registerBlocks=Bo;exports.registerBuiltInBlocks=cc;exports.registerBuiltInInlineTypes=Sc;exports.registerInlineTypes=Ao;exports.registerStoredFieldTypes=es;exports.remapSubtreeIds=Ht;exports.renameColumn=to;exports.reorderBlockRangeFromStore=xt;exports.resolveCollapsedCaret=We;exports.resolveColumns=ce;exports.resolveCrossBlockSelection=Pe;exports.resolveMultiRunSelection=Ve;exports.resolveRunSelection=Is;exports.selectInlineType=jo;exports.serializeBlockRange=Pt;exports.setBlockRangeHidden=zo;exports.setColumnOptions=tt;exports.setColumnType=no;exports.setColumnWidth=eo;exports.setMarksOverBlockRange=Gt;exports.setMarksOverSelection=Ue;exports.tableBlockType=co;exports.tableCellBlockType=lo;exports.tableRowBlockType=ro;exports.tableSelectInlineType=No;exports.textToParagraphs=zt;exports.toggleHeadingBlockType=bo;exports.toggleMarkOnRunRange=Uc;exports.toggleMarkOverBlockRange=Yt;exports.toggleMarkOverSelection=Vt;exports.useAtMenuTrigger=ua;exports.useBlock=ne;exports.useBlockChildren=Dt;exports.useBlockRangeDrag=Gc;exports.useBlockRangeSelection=qe;exports.useBlockRegistry=ze;exports.useClipboardHandlers=Dc;exports.useEditorKeyboardShortcuts=zc;exports.useEditorStore=A;exports.useEmojiMenuTrigger=aa;exports.useFieldTypeEditor=St;exports.useFieldTypes=_o;exports.useFloatingToolbarTrigger=ma;exports.useHistory=Lc;exports.useInlineRegistry=ke;exports.usePreviewMode=jt;exports.useRegisterFieldTypes=ts;exports.useRun=ye;exports.useSelectedBlock=pe;exports.useSlashMenuTrigger=na;exports.useWholeDocumentSelection=Tt;exports.walkDomToBlocks=$o;
|
|
1
|
+
"use strict";var cr=Object.defineProperty;var ir=(e,n,t)=>n in e?cr(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var nt=(e,n,t)=>ir(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),f=require("react"),Oe=require("react-dom"),U={INSERT_BLOCK:"insertBlock",REMOVE_BLOCK:"removeBlock",MOVE_BLOCK:"moveBlock",UPDATE_BLOCK_PROPS:"updateBlockProps",UPDATE_RUN:"updateRun",SET_BLOCK_CONTENT_IDS:"setBlockContentIds",REPLACE_RUN_SPAN:"replaceRunSpan",SET_BLOCK_RUNS:"setBlockRuns",ADD_FIELD_TYPE:"addFieldType",UPDATE_FIELD_TYPE:"updateFieldType",REMOVE_FIELD_TYPE:"removeFieldType"};function Y(e,n,t,o){return{type:U.INSERT_BLOCK,block:e,parentId:n,index:t,subtree:o}}function _(e){return{type:U.REMOVE_BLOCK,id:e}}function ge(e,n,t){return{type:U.MOVE_BLOCK,id:e,toParentId:n,toIndex:t}}function z(e,n){return{type:U.UPDATE_BLOCK_PROPS,id:e,patch:n}}function X(e,n){return{type:U.UPDATE_RUN,id:e,patch:n}}function Te(e,n){return{type:U.SET_BLOCK_CONTENT_IDS,blockId:e,contentIds:n}}function Fe(e,n,t){return{type:U.REPLACE_RUN_SPAN,blockId:e,oldRunIds:n,newRuns:t}}function le(e,n){return{type:U.SET_BLOCK_RUNS,blockId:e,runs:n}}function jn(e){return{type:U.ADD_FIELD_TYPE,fieldType:e}}function Sn(e,n){return{type:U.UPDATE_FIELD_TYPE,id:e,patch:n}}function En(e){return{type:U.REMOVE_FIELD_TYPE,id:e}}const ur=Object.freeze(Object.defineProperty({__proto__:null,OP:U,addFieldType:jn,insertBlock:Y,moveBlock:ge,removeBlock:_,removeFieldType:En,replaceRunSpan:Fe,setBlockContentIds:Te,setBlockRuns:le,updateBlockProps:z,updateFieldType:Sn,updateRun:X},Symbol.toStringTag,{value:"Module"})),gn="$fieldTypes";class On{constructor(n){this.blocks=new Map(((n==null?void 0:n.blocks)??[]).map(t=>[t.id,t])),this.runs=new Map(((n==null?void 0:n.runs)??[]).map(t=>[t.id,t])),this.rootId=(n==null?void 0:n.rootId)??null,this.fieldTypes=new Map(((n==null?void 0:n.fieldTypes)??[]).map(t=>[t.id,t])),this._fieldTypesSnapshot=null,this._listeners=new Map}getBlock(n){return this.blocks.get(n)}getRun(n){return this.runs.get(n)}getFieldTypes(){return this._fieldTypesSnapshot||(this._fieldTypesSnapshot=[...this.fieldTypes.values()]),this._fieldTypesSnapshot}getFieldType(n){return this.fieldTypes.get(n)}getRootId(){return this.rootId}subscribe(n,t){let o=this._listeners.get(n);return o||(o=new Set,this._listeners.set(n,o)),o.add(t),()=>{o.delete(t),o.size===0&&this._listeners.delete(n)}}_notify(n){for(const t of n){const o=this._listeners.get(t);if(o)for(const r of[...o])r()}}_captureSubtree(n){const t=[],o=[],r=l=>{var c;if(this.runs.has(l)){o.push(this.runs.get(l));return}const s=this.blocks.get(l);if(s){t.push(s);for(const i of s.contentIds)r(i);for(const i of((c=s.props)==null?void 0:c.titleRunIds)??[])r(i)}};return r(n),{blocks:t,runs:o}}_deleteSubtree(n){const t=o=>{var l;if(this.runs.has(o)){this.runs.delete(o);return}const r=this.blocks.get(o);if(r){for(const s of r.contentIds)t(s);for(const s of((l=r.props)==null?void 0:l.titleRunIds)??[])t(s);this.blocks.delete(o)}};t(n)}applyOperation(n){var t;switch(n.type){case U.UPDATE_RUN:{const o=this.runs.get(n.id),r={};for(const l of Object.keys(n.patch))r[l]=o[l];return this.runs.set(n.id,{...o,...n.patch}),this._notify([n.id]),X(n.id,r)}case U.UPDATE_BLOCK_PROPS:{const o=this.blocks.get(n.id),r={};for(const l of Object.keys(n.patch))r[l]=o.props[l];return this.blocks.set(n.id,{...o,props:{...o.props,...n.patch}}),this._notify([n.id]),z(n.id,r)}case U.INSERT_BLOCK:{if(n.subtree){for(const s of n.subtree.blocks)this.blocks.set(s.id,s);for(const s of n.subtree.runs)this.runs.set(s.id,s)}else this.blocks.set(n.block.id,n.block);const o=this.blocks.get(n.parentId),r=[...o.contentIds],l=n.index??r.length;return r.splice(l,0,n.block.id),this.blocks.set(n.parentId,{...o,contentIds:r}),this._notify([n.block.id,n.parentId]),_(n.block.id)}case U.REMOVE_BLOCK:{const o=this.blocks.get(n.id),r=o.parentId,l=this.blocks.get(r),s=l.contentIds.indexOf(n.id),c=this._captureSubtree(n.id);this._deleteSubtree(n.id);const i=l.contentIds.filter(u=>u!==n.id);return this.blocks.set(r,{...l,contentIds:i}),this._notify([r]),{type:U.INSERT_BLOCK,block:o,parentId:r,index:s,subtree:c}}case U.MOVE_BLOCK:{const r=this.blocks.get(n.id).parentId,l=this.blocks.get(r),s=l.contentIds.indexOf(n.id),c=l.contentIds.filter(p=>p!==n.id);this.blocks.set(r,{...l,contentIds:c});const i=n.toParentId===r?this.blocks.get(r):this.blocks.get(n.toParentId),u=[...i.contentIds];u.splice(n.toIndex??u.length,0,n.id),this.blocks.set(n.toParentId,{...i,contentIds:u}),this.blocks.set(n.id,{...this.blocks.get(n.id),parentId:n.toParentId});const d=new Set([n.id,r,n.toParentId]);return this._notify(d),ge(n.id,r,s)}case U.SET_BLOCK_CONTENT_IDS:{const o=this.blocks.get(n.blockId),r=o.contentIds;return this.blocks.set(n.blockId,{...o,contentIds:n.contentIds}),this._notify([n.blockId]),Te(n.blockId,r)}case U.REPLACE_RUN_SPAN:{const o=this.blocks.get(n.blockId),r=o.contentIds.indexOf(n.oldRunIds[0])!==-1,l=r?o.contentIds:((t=o.props)==null?void 0:t.titleRunIds)??[],s=l.indexOf(n.oldRunIds[0]),c=n.oldRunIds.map(u=>this.runs.get(u));for(const u of n.oldRunIds)this.runs.delete(u);for(const u of n.newRuns)this.runs.set(u.id,u);const i=[...l];return i.splice(s,n.oldRunIds.length,...n.newRuns.map(u=>u.id)),r?this.blocks.set(n.blockId,{...o,contentIds:i}):this.blocks.set(n.blockId,{...o,props:{...o.props,titleRunIds:i}}),this._notify([n.blockId,...n.oldRunIds,...n.newRuns.map(u=>u.id)]),Fe(n.blockId,n.newRuns.map(u=>u.id),c)}case U.SET_BLOCK_RUNS:{const o=this.blocks.get(n.blockId),r=o.props&&"titleRunIds"in o.props,l=r?o.props.titleRunIds:o.contentIds,s=l.map(i=>this.runs.get(i)).filter(Boolean);for(const i of l)this.runs.delete(i);for(const i of n.runs)this.runs.set(i.id,i);const c=n.runs.map(i=>i.id);return r?this.blocks.set(n.blockId,{...o,props:{...o.props,titleRunIds:c}}):this.blocks.set(n.blockId,{...o,contentIds:c}),this._notify([n.blockId,...l,...c]),le(n.blockId,s)}case U.ADD_FIELD_TYPE:return this.fieldTypes.set(n.fieldType.id,n.fieldType),this._fieldTypesSnapshot=null,this._notify([gn]),En(n.fieldType.id);case U.UPDATE_FIELD_TYPE:{const o=this.fieldTypes.get(n.id),r={};for(const l of Object.keys(n.patch))r[l]=o[l];return this.fieldTypes.set(n.id,{...o,...n.patch}),this._fieldTypesSnapshot=null,this._notify([gn]),Sn(n.id,r)}case U.REMOVE_FIELD_TYPE:{const o=this.fieldTypes.get(n.id);return this.fieldTypes.delete(n.id),this._fieldTypesSnapshot=null,this._notify([gn]),jn(o)}default:throw new Error(`Unknown operation type: ${n.type}`)}}applyOperations(n){return n.map(t=>this.applyOperation(t))}toJSON(){return{blocks:[...this.blocks.values()],runs:[...this.runs.values()],rootId:this.rootId,fieldTypes:[...this.fieldTypes.values()]}}static fromJSON(n){return new On(n)}}const dr=500;class pr{constructor(n,{idleMs:t=dr}={}){this.store=n,this.idleMs=t,this.undoStack=[],this.redoStack=[],this.currentBatch=null,this.idleTimer=null,this.historyLog=[],this._listeners=new Set,this._undoRedoSnapshot={canUndo:!1,canRedo:!1}}getUndoRedoSnapshot(){const n=this.canUndo(),t=this.canRedo();return(this._undoRedoSnapshot.canUndo!==n||this._undoRedoSnapshot.canRedo!==t)&&(this._undoRedoSnapshot={canUndo:n,canRedo:t}),this._undoRedoSnapshot}getBlock(n){return this.store.getBlock(n)}getRun(n){return this.store.getRun(n)}getRootId(){return this.store.getRootId()}getFieldTypes(){return this.store.getFieldTypes()}getFieldType(n){return this.store.getFieldType(n)}subscribe(n,t){return this.store.subscribe(n,t)}toJSON(){return this.store.toJSON()}applyOperation(n,t={}){return this.perform(n,t)}applyOperations(n,t={}){return n.map(o=>this.perform(o,t))}performBatch(n,t={}){var s;const o=t.actorId??null,r=t.timestamp??Date.now();this._commitCurrentBatch();const l=[];for(const c of n)l.unshift(this.store.applyOperation(c)),this.historyLog.push({opType:c.type,id:c.id??c.blockId??((s=c.block)==null?void 0:s.id),actorId:o,timestamp:r});this.redoStack=[],this.undoStack.push({ops:[...n],inverses:l,batchKey:null,actorId:o,timestamp:r,lastTimestamp:r,boundaryHit:!0}),this._notify()}perform(n,t={}){const o=t.actorId??null,r=t.timestamp??Date.now(),l=this.store.applyOperation(n);return this._record(n,l,{actorId:o,timestamp:r}),l}_batchKeyFor(n){return n.type==="updateRun"?`run:${n.id}`:null}_isWordBoundary(n){var o;if(n.type!=="updateRun")return!1;const t=(o=n.patch)==null?void 0:o.value;return typeof t!="string"||t.length===0?!1:/\s/.test(t[t.length-1])}_record(n,t,o){var c;this.redoStack=[];const r=this._batchKeyFor(n),l=this.currentBatch&&o.timestamp-this.currentBatch.lastTimestamp<=this.idleMs;this.currentBatch&&r!==null&&this.currentBatch.batchKey===r&&l&&!this.currentBatch.boundaryHit?(this.currentBatch.ops.push(n),this.currentBatch.inverses.unshift(t),this.currentBatch.lastTimestamp=o.timestamp,this._isWordBoundary(n)&&(this.currentBatch.boundaryHit=!0)):(this._commitCurrentBatch(),this.currentBatch={ops:[n],inverses:[t],batchKey:r,actorId:o.actorId,timestamp:o.timestamp,lastTimestamp:o.timestamp,boundaryHit:this._isWordBoundary(n)}),this._resetIdleTimer(),this.historyLog.push({opType:n.type,id:n.id??((c=n.block)==null?void 0:c.id),actorId:o.actorId,timestamp:o.timestamp}),this._notify()}_resetIdleTimer(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{this._commitCurrentBatch(),this._notify()},this.idleMs)}_commitCurrentBatch(){this.currentBatch&&(this.undoStack.push(this.currentBatch),this.currentBatch=null,this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null))}flush(){this._commitCurrentBatch(),this._notify()}undo(){this._commitCurrentBatch();const n=this.undoStack.pop();if(!n)return!1;for(const t of n.inverses)this.store.applyOperation(t);return this.redoStack.push(n),this._notify(),!0}redo(){const n=this.redoStack.pop();if(!n)return!1;for(const t of n.ops)this.store.applyOperation(t);return this.undoStack.push(n),this._notify(),!0}canUndo(){return this.undoStack.length>0||this.currentBatch!==null}canRedo(){return this.redoStack.length>0}getHistoryLog(){return[...this.historyLog]}subscribeToHistory(n){return this._listeners.add(n),()=>this._listeners.delete(n)}_notify(){for(const n of this._listeners)n()}}class xt{constructor(){this._types=new Map}register(n,t){this._types.set(n,t)}get(n){return this._types.get(n)}isLeaf(n){var t;return!!((t=this._types.get(n))!=null&&t.isLeaf)}listSlashCommands(){const n=[];for(const t of this._types.values())t.slashCommand&&n.push(t.slashCommand),t.slashCommands&&n.push(...t.slashCommands);return n}listHtmlMatchers(){return[...this._types.values()].filter(n=>n.fromHTML)}}function fr(){return new xt}class yt{constructor(){this._types=new Map}register(n,t){this._types.set(n,t)}unregister(n){this._types.delete(n)}get(n){return this._types.get(n)}listHtmlMatchers(){return[...this._types.values()].filter(n=>n.fromHTML)}listSlashCommands(){const n=[];for(const t of this._types.values())t.slashCommand&&n.push(t.slashCommand),t.slashCommands&&n.push(...t.slashCommands);return n}listAtCommands(){const n=[];for(const t of this._types.values())t.atCommand&&n.push(t.atCommand),t.atCommands&&n.push(...t.atCommands);return n}}function br(){return new yt}const hr=`/*
|
|
2
|
+
* noteloom's default theme — minimal, clean, Notion/Linear-adjacent.
|
|
3
|
+
*
|
|
4
|
+
* Ships as plain CSS custom properties on :root (not scoped to a wrapper
|
|
5
|
+
* element) deliberately: several of this package's own pieces — Select's
|
|
6
|
+
* popover, SlashMenu, FloatingToolbar, the table header menu, the block
|
|
7
|
+
* gutter/range menus, Modal — are portaled to document.body, so they are
|
|
8
|
+
* NOT DOM descendants of whatever element renders the editor itself.
|
|
9
|
+
* Scoping variables to a wrapper class would silently fail to reach any
|
|
10
|
+
* of those. \`--noteloom-*\` is a distinctive enough prefix that defining
|
|
11
|
+
* these on :root won't collide with a host app's own custom properties.
|
|
12
|
+
*
|
|
13
|
+
* This file is auto-injected at runtime by <EditorProvider> (see
|
|
14
|
+
* react/injectDefaultStyles.js) — you do NOT need to import this
|
|
15
|
+
* yourself. It's still published standalone at \`noteloom/style.css\` for:
|
|
16
|
+
* - passing \`theme="none"\` to <EditorProvider> and importing this
|
|
17
|
+
* explicitly instead (e.g. to control load order, or for SSR/CSP
|
|
18
|
+
* setups where runtime <style> injection isn't allowed)
|
|
19
|
+
* - copying as a starting point for your own from-scratch theme
|
|
20
|
+
*
|
|
21
|
+
* Retheme by overriding these variables in your own CSS (after the
|
|
22
|
+
* default theme loads) — every rule below reads from them, nothing is
|
|
23
|
+
* hardcoded. Override individual \`.be-*\` classes too, same as any other
|
|
24
|
+
* library's default styles.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
:root {
|
|
28
|
+
--noteloom-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
|
|
29
|
+
--noteloom-text: #0f172a;
|
|
30
|
+
--noteloom-text-muted: #64748b;
|
|
31
|
+
--noteloom-text-faint: #94a3b8;
|
|
32
|
+
--noteloom-bg: #ffffff;
|
|
33
|
+
--noteloom-bg-subtle: #f8fafc;
|
|
34
|
+
--noteloom-bg-hover: #f1f5f9;
|
|
35
|
+
--noteloom-border: #e2e8f0;
|
|
36
|
+
--noteloom-accent: #6366f1;
|
|
37
|
+
--noteloom-accent-text: #ffffff;
|
|
38
|
+
--noteloom-accent-soft: rgba(99, 102, 241, 0.1);
|
|
39
|
+
--noteloom-accent-soft-hover: rgba(99, 102, 241, 0.16);
|
|
40
|
+
--noteloom-danger: #dc2626;
|
|
41
|
+
--noteloom-danger-soft: #fef2f2;
|
|
42
|
+
--noteloom-radius-sm: 6px;
|
|
43
|
+
--noteloom-radius-md: 8px;
|
|
44
|
+
--noteloom-radius-lg: 12px;
|
|
45
|
+
--noteloom-radius-xl: 16px;
|
|
46
|
+
--noteloom-shadow: 0 12px 24px -8px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.06);
|
|
47
|
+
--noteloom-code-bg: #0f172a;
|
|
48
|
+
--noteloom-code-text: #e2e8f0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@media (prefers-color-scheme: dark) {
|
|
52
|
+
:root {
|
|
53
|
+
--noteloom-text: #f1f5f9;
|
|
54
|
+
--noteloom-text-muted: #94a3b8;
|
|
55
|
+
--noteloom-text-faint: #64748b;
|
|
56
|
+
--noteloom-bg: #1c1932;
|
|
57
|
+
--noteloom-bg-subtle: rgba(255, 255, 255, 0.03);
|
|
58
|
+
--noteloom-bg-hover: rgba(255, 255, 255, 0.06);
|
|
59
|
+
--noteloom-border: rgba(255, 255, 255, 0.1);
|
|
60
|
+
--noteloom-accent-soft: rgba(99, 102, 241, 0.18);
|
|
61
|
+
--noteloom-accent-soft-hover: rgba(99, 102, 241, 0.26);
|
|
62
|
+
--noteloom-danger-soft: rgba(220, 38, 38, 0.15);
|
|
63
|
+
--noteloom-code-bg: #13111f;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Explicit overrides win either direction — a host toggling dark mode via
|
|
68
|
+
a class rather than the OS setting can set [data-theme="dark"/"light"]
|
|
69
|
+
on any ancestor (e.g. <html>), overriding the media query above. */
|
|
70
|
+
[data-theme='dark'] {
|
|
71
|
+
--noteloom-text: #f1f5f9;
|
|
72
|
+
--noteloom-text-muted: #94a3b8;
|
|
73
|
+
--noteloom-text-faint: #64748b;
|
|
74
|
+
--noteloom-bg: #1c1932;
|
|
75
|
+
--noteloom-bg-subtle: rgba(255, 255, 255, 0.03);
|
|
76
|
+
--noteloom-bg-hover: rgba(255, 255, 255, 0.06);
|
|
77
|
+
--noteloom-border: rgba(255, 255, 255, 0.1);
|
|
78
|
+
--noteloom-accent-soft: rgba(99, 102, 241, 0.18);
|
|
79
|
+
--noteloom-accent-soft-hover: rgba(99, 102, 241, 0.26);
|
|
80
|
+
--noteloom-danger-soft: rgba(220, 38, 38, 0.15);
|
|
81
|
+
--noteloom-code-bg: #13111f;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
[data-theme='light'] {
|
|
85
|
+
--noteloom-text: #0f172a;
|
|
86
|
+
--noteloom-text-muted: #64748b;
|
|
87
|
+
--noteloom-text-faint: #94a3b8;
|
|
88
|
+
--noteloom-bg: #ffffff;
|
|
89
|
+
--noteloom-bg-subtle: #f8fafc;
|
|
90
|
+
--noteloom-bg-hover: #f1f5f9;
|
|
91
|
+
--noteloom-border: #e2e8f0;
|
|
92
|
+
--noteloom-accent-soft: rgba(99, 102, 241, 0.1);
|
|
93
|
+
--noteloom-accent-soft-hover: rgba(99, 102, 241, 0.16);
|
|
94
|
+
--noteloom-danger-soft: #fef2f2;
|
|
95
|
+
--noteloom-code-bg: #0f172a;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.be-root {
|
|
99
|
+
font-family: var(--noteloom-font);
|
|
100
|
+
color: var(--noteloom-text);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.be-editable {
|
|
104
|
+
outline: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* --- basic leaf blocks --- */
|
|
108
|
+
|
|
109
|
+
.be-paragraph {
|
|
110
|
+
position: relative;
|
|
111
|
+
margin: 0.25rem 0;
|
|
112
|
+
line-height: 1.6;
|
|
113
|
+
outline: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.be-heading {
|
|
117
|
+
position: relative;
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
margin: 1.25rem 0 0.25rem;
|
|
120
|
+
outline: none;
|
|
121
|
+
letter-spacing: -0.01em;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.be-divider {
|
|
125
|
+
border: none;
|
|
126
|
+
border-top: 1px solid var(--noteloom-border);
|
|
127
|
+
margin: 1.5em 0;
|
|
128
|
+
cursor: default;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.be-blockquote {
|
|
132
|
+
position: relative;
|
|
133
|
+
margin: 0.5em 0;
|
|
134
|
+
padding-left: 0.9em;
|
|
135
|
+
border-left: 3px solid var(--noteloom-border);
|
|
136
|
+
color: var(--noteloom-text-muted);
|
|
137
|
+
outline: none;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* --- callout --- */
|
|
141
|
+
|
|
142
|
+
.be-callout {
|
|
143
|
+
position: relative;
|
|
144
|
+
display: flex;
|
|
145
|
+
gap: 0.7em;
|
|
146
|
+
align-items: flex-start;
|
|
147
|
+
background: var(--noteloom-bg-subtle);
|
|
148
|
+
border-radius: var(--noteloom-radius-lg);
|
|
149
|
+
padding: 0.9em 1em;
|
|
150
|
+
margin: 0.5em 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.be-callout[data-color='gray'] { background: rgba(148, 163, 184, 0.16); }
|
|
154
|
+
.be-callout[data-color='blue'] { background: rgba(99, 102, 241, 0.12); }
|
|
155
|
+
.be-callout[data-color='green'] { background: rgba(34, 197, 94, 0.14); }
|
|
156
|
+
.be-callout[data-color='yellow'] { background: rgba(234, 179, 8, 0.16); }
|
|
157
|
+
.be-callout[data-color='orange'] { background: rgba(249, 115, 22, 0.14); }
|
|
158
|
+
.be-callout[data-color='red'] { background: rgba(239, 68, 68, 0.13); }
|
|
159
|
+
.be-callout[data-color='purple'] { background: rgba(168, 85, 247, 0.13); }
|
|
160
|
+
.be-callout[data-color='pink'] { background: rgba(236, 72, 153, 0.13); }
|
|
161
|
+
|
|
162
|
+
.be-callout-icon-wrap {
|
|
163
|
+
flex: none;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.be-callout-icon-input,
|
|
167
|
+
.be-callout-icon {
|
|
168
|
+
width: 2em;
|
|
169
|
+
height: 2em;
|
|
170
|
+
border: none;
|
|
171
|
+
background: var(--noteloom-bg);
|
|
172
|
+
border-radius: var(--noteloom-radius-md);
|
|
173
|
+
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
|
|
174
|
+
font-size: 1.15em;
|
|
175
|
+
display: flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
justify-content: center;
|
|
178
|
+
padding: 0;
|
|
179
|
+
cursor: pointer;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.be-callout-icon-input {
|
|
183
|
+
outline: none;
|
|
184
|
+
text-align: center;
|
|
185
|
+
cursor: text;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.be-callout-content {
|
|
189
|
+
flex: 1;
|
|
190
|
+
min-width: 0;
|
|
191
|
+
padding-right: 1.6em; /* keeps text from running under the color-swatch trigger */
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* First child reads as the card's title; every child after it is the
|
|
195
|
+
description — see CalloutBlock.jsx's comment for why this is a CSS
|
|
196
|
+
convention over the content, not a separate title/description field. */
|
|
197
|
+
.be-callout-content > :first-child {
|
|
198
|
+
font-weight: 600;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.be-callout-content > :not(:first-child) {
|
|
202
|
+
color: var(--noteloom-text-muted);
|
|
203
|
+
font-size: 0.92em;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.be-callout-color-wrap {
|
|
207
|
+
position: absolute;
|
|
208
|
+
top: 0.6em;
|
|
209
|
+
right: 0.6em;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.be-callout-color-trigger {
|
|
213
|
+
border: none;
|
|
214
|
+
background: none;
|
|
215
|
+
padding: 3px;
|
|
216
|
+
border-radius: var(--noteloom-radius-sm);
|
|
217
|
+
cursor: pointer;
|
|
218
|
+
display: flex;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.be-callout-color-trigger:hover {
|
|
222
|
+
background: rgba(15, 23, 42, 0.06);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.be-callout-color-dot {
|
|
226
|
+
width: 12px;
|
|
227
|
+
height: 12px;
|
|
228
|
+
border-radius: 50%;
|
|
229
|
+
border: 1px solid rgba(15, 23, 42, 0.12);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.be-callout-color-dot-gray { background: #94a3b8; }
|
|
233
|
+
.be-callout-color-dot-blue { background: #6366f1; }
|
|
234
|
+
.be-callout-color-dot-green { background: #22c55e; }
|
|
235
|
+
.be-callout-color-dot-yellow { background: #eab308; }
|
|
236
|
+
.be-callout-color-dot-orange { background: #f97316; }
|
|
237
|
+
.be-callout-color-dot-red { background: #ef4444; }
|
|
238
|
+
.be-callout-color-dot-purple { background: #a855f7; }
|
|
239
|
+
.be-callout-color-dot-pink { background: #ec4899; }
|
|
240
|
+
|
|
241
|
+
.be-callout-color-picker {
|
|
242
|
+
position: absolute;
|
|
243
|
+
top: 100%;
|
|
244
|
+
right: 0;
|
|
245
|
+
margin-top: 4px;
|
|
246
|
+
z-index: 1000;
|
|
247
|
+
display: grid;
|
|
248
|
+
grid-template-columns: repeat(4, 1fr);
|
|
249
|
+
gap: 4px;
|
|
250
|
+
padding: 6px;
|
|
251
|
+
background: var(--noteloom-bg);
|
|
252
|
+
border: 1px solid var(--noteloom-border);
|
|
253
|
+
border-radius: var(--noteloom-radius-md);
|
|
254
|
+
box-shadow: var(--noteloom-shadow);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.be-callout-color-option {
|
|
258
|
+
width: 22px;
|
|
259
|
+
height: 22px;
|
|
260
|
+
border-radius: 50%;
|
|
261
|
+
border: 2px solid transparent;
|
|
262
|
+
cursor: pointer;
|
|
263
|
+
padding: 0;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.be-callout-color-option-gray { background: #94a3b8; }
|
|
267
|
+
.be-callout-color-option-blue { background: #6366f1; }
|
|
268
|
+
.be-callout-color-option-green { background: #22c55e; }
|
|
269
|
+
.be-callout-color-option-yellow { background: #eab308; }
|
|
270
|
+
.be-callout-color-option-orange { background: #f97316; }
|
|
271
|
+
.be-callout-color-option-red { background: #ef4444; }
|
|
272
|
+
.be-callout-color-option-purple { background: #a855f7; }
|
|
273
|
+
.be-callout-color-option-pink { background: #ec4899; }
|
|
274
|
+
|
|
275
|
+
.be-callout-color-option-active {
|
|
276
|
+
border-color: var(--noteloom-text);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/* --- code block --- */
|
|
280
|
+
|
|
281
|
+
.be-code-block {
|
|
282
|
+
margin: 0.6em 0;
|
|
283
|
+
border-radius: var(--noteloom-radius-lg);
|
|
284
|
+
overflow: hidden;
|
|
285
|
+
background: var(--noteloom-code-bg);
|
|
286
|
+
color: var(--noteloom-code-text);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.be-code-block-header {
|
|
290
|
+
display: flex;
|
|
291
|
+
align-items: center;
|
|
292
|
+
justify-content: flex-end;
|
|
293
|
+
gap: 4px;
|
|
294
|
+
padding: 6px 10px;
|
|
295
|
+
background: rgba(255, 255, 255, 0.04);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.be-code-block-delete {
|
|
299
|
+
appearance: none;
|
|
300
|
+
-webkit-appearance: none;
|
|
301
|
+
border: none;
|
|
302
|
+
outline: none;
|
|
303
|
+
background: transparent;
|
|
304
|
+
box-shadow: none;
|
|
305
|
+
color: var(--noteloom-text-faint);
|
|
306
|
+
width: 24px;
|
|
307
|
+
height: 24px;
|
|
308
|
+
margin: 0;
|
|
309
|
+
padding: 0;
|
|
310
|
+
display: flex;
|
|
311
|
+
align-items: center;
|
|
312
|
+
justify-content: center;
|
|
313
|
+
border-radius: var(--noteloom-radius-sm);
|
|
314
|
+
cursor: pointer;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.be-code-block-delete:hover {
|
|
318
|
+
background: rgba(255, 255, 255, 0.1);
|
|
319
|
+
color: #fca5a5;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.be-code-block-language {
|
|
323
|
+
background: transparent;
|
|
324
|
+
color: var(--noteloom-text-faint);
|
|
325
|
+
border: none;
|
|
326
|
+
font-size: 0.8rem;
|
|
327
|
+
cursor: pointer;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.be-code-block-pre {
|
|
331
|
+
margin: 0;
|
|
332
|
+
padding: 0.9em 1em;
|
|
333
|
+
overflow-x: auto;
|
|
334
|
+
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
|
|
335
|
+
font-size: 0.88rem;
|
|
336
|
+
outline: none;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.be-code-block-pre code {
|
|
340
|
+
position: relative;
|
|
341
|
+
display: block;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/* --- list items (bulleted / numbered / to-do / toggle) --- */
|
|
345
|
+
|
|
346
|
+
.be-list-item {
|
|
347
|
+
margin: 0.1rem 0;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.be-list-item-row {
|
|
351
|
+
display: flex;
|
|
352
|
+
align-items: flex-start;
|
|
353
|
+
gap: 0.4em;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.be-list-checkbox {
|
|
357
|
+
margin-top: 0.3em;
|
|
358
|
+
width: 16px;
|
|
359
|
+
height: 16px;
|
|
360
|
+
flex: none;
|
|
361
|
+
accent-color: var(--noteloom-accent);
|
|
362
|
+
cursor: pointer;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.be-list-toggle-marker {
|
|
366
|
+
border: none;
|
|
367
|
+
background: none;
|
|
368
|
+
cursor: pointer;
|
|
369
|
+
padding: 2px;
|
|
370
|
+
margin-top: 0.1em;
|
|
371
|
+
color: var(--noteloom-text-faint);
|
|
372
|
+
display: flex;
|
|
373
|
+
align-items: center;
|
|
374
|
+
justify-content: center;
|
|
375
|
+
height: 30px;
|
|
376
|
+
width: 30px;
|
|
377
|
+
border-radius: var(--noteloom-radius-sm);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.be-list-toggle-marker:hover {
|
|
381
|
+
background: var(--noteloom-bg-hover);
|
|
382
|
+
color: var(--noteloom-text-muted);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.be-list-marker {
|
|
386
|
+
min-width: 1.2em;
|
|
387
|
+
margin-top: 0.1em;
|
|
388
|
+
text-align: center;
|
|
389
|
+
color: var(--noteloom-text-faint);
|
|
390
|
+
user-select: none;
|
|
391
|
+
flex: none;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.be-list-item-title {
|
|
395
|
+
position: relative;
|
|
396
|
+
flex: 1;
|
|
397
|
+
min-width: 0;
|
|
398
|
+
outline: none;
|
|
399
|
+
line-height: 1.6;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.be-list-item-children {
|
|
403
|
+
margin-left: 2.1em;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/* --- toggle heading --- */
|
|
407
|
+
|
|
408
|
+
.be-toggle-heading {
|
|
409
|
+
margin: 1.25rem 0 0.25rem;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.be-toggle-heading-row {
|
|
413
|
+
display: flex;
|
|
414
|
+
align-items: center;
|
|
415
|
+
gap: 0.15em;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.be-toggle-heading-marker {
|
|
419
|
+
border: none;
|
|
420
|
+
background: none;
|
|
421
|
+
cursor: pointer;
|
|
422
|
+
color: var(--noteloom-text-faint);
|
|
423
|
+
display: flex;
|
|
424
|
+
align-items: center;
|
|
425
|
+
justify-content: center;
|
|
426
|
+
width: 30px;
|
|
427
|
+
height: 30px;
|
|
428
|
+
border-radius: var(--noteloom-radius-sm);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.be-toggle-heading-marker:hover {
|
|
432
|
+
background: var(--noteloom-bg-hover);
|
|
433
|
+
color: var(--noteloom-text-muted);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.be-toggle-heading-title {
|
|
437
|
+
flex: 1;
|
|
438
|
+
min-width: 0;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.be-toggle-heading-children {
|
|
442
|
+
margin-left: 2.1em;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/* --- layout (multi-column) --- */
|
|
446
|
+
|
|
447
|
+
.be-layout {
|
|
448
|
+
margin: 0.6em 0;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.be-layout-column {
|
|
452
|
+
flex: 1;
|
|
453
|
+
min-width: 0;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/* --- button block --- */
|
|
457
|
+
|
|
458
|
+
.be-button-block {
|
|
459
|
+
margin: 0.6em 0;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.be-button-block-pill {
|
|
463
|
+
display: inline-flex;
|
|
464
|
+
align-items: center;
|
|
465
|
+
gap: 0.4em;
|
|
466
|
+
border-radius: var(--noteloom-radius-md);
|
|
467
|
+
padding: 0.5em 1em;
|
|
468
|
+
color: var(--noteloom-accent-text);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.be-button-block-label {
|
|
472
|
+
position: relative;
|
|
473
|
+
outline: none;
|
|
474
|
+
min-width: 2em;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/* --- generic empty-state placeholder for editable leaf content ---
|
|
478
|
+
Note: this can't use :empty — an "empty" run still holds a zero-width
|
|
479
|
+
space text node (see EMPTY_RUN_PLACEHOLDER) inside its host span, so the
|
|
480
|
+
wrapper element is never actually childless. data-empty (kept in sync by
|
|
481
|
+
EditableBlockContent's syncEmptyAttr against the *logical* run content,
|
|
482
|
+
not the DOM) is the real signal. */
|
|
483
|
+
|
|
484
|
+
[data-placeholder][data-empty]:focus-within::before {
|
|
485
|
+
content: attr(data-placeholder);
|
|
486
|
+
position: absolute;
|
|
487
|
+
color: var(--noteloom-text-faint);
|
|
488
|
+
font-weight: 400;
|
|
489
|
+
font-style: normal;
|
|
490
|
+
opacity: 0.85;
|
|
491
|
+
pointer-events: none;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.be-button-block-open,
|
|
495
|
+
.be-button-block-settings {
|
|
496
|
+
flex: none;
|
|
497
|
+
border: none;
|
|
498
|
+
background: rgba(255, 255, 255, 0.16);
|
|
499
|
+
color: inherit;
|
|
500
|
+
border-radius: var(--noteloom-radius-sm);
|
|
501
|
+
width: 24px;
|
|
502
|
+
height: 24px;
|
|
503
|
+
display: flex;
|
|
504
|
+
align-items: center;
|
|
505
|
+
justify-content: center;
|
|
506
|
+
cursor: pointer;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.be-button-block-open:disabled {
|
|
510
|
+
opacity: 0.5;
|
|
511
|
+
cursor: not-allowed;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.be-button-block-open:hover:not(:disabled),
|
|
515
|
+
.be-button-block-settings:hover {
|
|
516
|
+
background: rgba(255, 255, 255, 0.28);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/* --- embed (image/video/audio/file) --- */
|
|
520
|
+
|
|
521
|
+
.be-embed {
|
|
522
|
+
margin: 0.6em 0;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
.be-embed-preview {
|
|
526
|
+
position: relative;
|
|
527
|
+
display: flex;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.be-embed-align-left {
|
|
531
|
+
justify-content: flex-start;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.be-embed-align-center {
|
|
535
|
+
justify-content: center;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.be-embed-align-right {
|
|
539
|
+
justify-content: flex-end;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.be-embed-frame {
|
|
543
|
+
position: relative;
|
|
544
|
+
max-width: 100%;
|
|
545
|
+
overflow: visible;
|
|
546
|
+
border-radius: var(--noteloom-radius-lg);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.be-embed-image,
|
|
550
|
+
.be-embed-video {
|
|
551
|
+
border: 1px solid var(--noteloom-border);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.be-embed-image,
|
|
555
|
+
.be-embed-video {
|
|
556
|
+
max-width: 100%;
|
|
557
|
+
display: block;
|
|
558
|
+
border-radius: var(--noteloom-radius-lg);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.be-embed-audio {
|
|
562
|
+
width: 100%;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.be-embed-file-link {
|
|
566
|
+
display: flex;
|
|
567
|
+
align-items: center;
|
|
568
|
+
gap: 0.5em;
|
|
569
|
+
padding: 0.75em 1em;
|
|
570
|
+
border: 1px solid var(--noteloom-border);
|
|
571
|
+
border-radius: var(--noteloom-radius-xl);
|
|
572
|
+
text-decoration: none;
|
|
573
|
+
color: var(--noteloom-accent);
|
|
574
|
+
font-weight: 500;
|
|
575
|
+
font-size: 0.9rem;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.be-embed-file-link:hover {
|
|
579
|
+
background: var(--noteloom-bg-subtle);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.be-embed-toolbar {
|
|
583
|
+
position: absolute;
|
|
584
|
+
top: 8px;
|
|
585
|
+
right: 8px;
|
|
586
|
+
z-index: 2;
|
|
587
|
+
display: flex;
|
|
588
|
+
align-items: center;
|
|
589
|
+
gap: 2px;
|
|
590
|
+
padding: 3px;
|
|
591
|
+
background: rgba(15, 23, 42, 0.72);
|
|
592
|
+
border-radius: var(--noteloom-radius-md);
|
|
593
|
+
opacity: 0;
|
|
594
|
+
transition: opacity 0.12s ease;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
.be-embed-preview:hover .be-embed-toolbar,
|
|
598
|
+
.be-embed-toolbar:focus-within {
|
|
599
|
+
opacity: 1;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
.be-embed-toolbar-btn {
|
|
603
|
+
border: none;
|
|
604
|
+
background: transparent;
|
|
605
|
+
width: 24px;
|
|
606
|
+
height: 24px;
|
|
607
|
+
display: flex;
|
|
608
|
+
align-items: center;
|
|
609
|
+
justify-content: center;
|
|
610
|
+
color: rgba(255, 255, 255, 0.8);
|
|
611
|
+
border-radius: var(--noteloom-radius-sm);
|
|
612
|
+
cursor: pointer;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.be-embed-toolbar-btn:hover {
|
|
616
|
+
background: rgba(255, 255, 255, 0.16);
|
|
617
|
+
color: #fff;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.be-embed-toolbar-btn-active {
|
|
621
|
+
background: var(--noteloom-accent);
|
|
622
|
+
color: #fff;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.be-embed-remove {
|
|
626
|
+
border: none;
|
|
627
|
+
background: transparent;
|
|
628
|
+
border-radius: var(--noteloom-radius-sm);
|
|
629
|
+
padding: 0 8px;
|
|
630
|
+
height: 24px;
|
|
631
|
+
color: rgba(255, 255, 255, 0.8);
|
|
632
|
+
font-size: 0.75rem;
|
|
633
|
+
cursor: pointer;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
.be-embed-remove:hover {
|
|
637
|
+
background: rgba(255, 255, 255, 0.16);
|
|
638
|
+
color: #fff;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.be-embed-resize-handle {
|
|
642
|
+
position: absolute;
|
|
643
|
+
bottom: 4px;
|
|
644
|
+
right: 4px;
|
|
645
|
+
width: 12px;
|
|
646
|
+
height: 12px;
|
|
647
|
+
cursor: nwse-resize;
|
|
648
|
+
border-radius: 2px;
|
|
649
|
+
border: 1px solid #fff;
|
|
650
|
+
background: var(--noteloom-accent);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
.be-embed-dropzone {
|
|
654
|
+
border: 1.5px dashed var(--noteloom-border);
|
|
655
|
+
border-radius: var(--noteloom-radius-xl);
|
|
656
|
+
padding: 2.2em;
|
|
657
|
+
display: flex;
|
|
658
|
+
flex-direction: column;
|
|
659
|
+
align-items: center;
|
|
660
|
+
gap: 0.6em;
|
|
661
|
+
text-align: center;
|
|
662
|
+
color: var(--noteloom-text-muted);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
.be-embed-dropzone-active {
|
|
666
|
+
border-color: var(--noteloom-accent);
|
|
667
|
+
background: var(--noteloom-accent-soft);
|
|
668
|
+
color: var(--noteloom-accent);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
.be-embed-upload-btn {
|
|
672
|
+
background: var(--noteloom-accent);
|
|
673
|
+
color: var(--noteloom-accent-text);
|
|
674
|
+
border-radius: var(--noteloom-radius-md);
|
|
675
|
+
padding: 0.5em 1.1em;
|
|
676
|
+
cursor: pointer;
|
|
677
|
+
font-size: 0.85rem;
|
|
678
|
+
font-weight: 500;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
.be-embed-upload-btn input {
|
|
682
|
+
display: none;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
.be-embed-dropzone-hint {
|
|
686
|
+
font-size: 0.8rem;
|
|
687
|
+
color: var(--noteloom-text-faint);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
.be-embed-url-row {
|
|
691
|
+
display: flex;
|
|
692
|
+
gap: 6px;
|
|
693
|
+
width: 100%;
|
|
694
|
+
max-width: 360px;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
.be-embed-url-input {
|
|
698
|
+
flex: 1;
|
|
699
|
+
min-width: 0;
|
|
700
|
+
border: 1px solid var(--noteloom-border);
|
|
701
|
+
border-radius: var(--noteloom-radius-md);
|
|
702
|
+
padding: 0.45em 0.7em;
|
|
703
|
+
background: transparent;
|
|
704
|
+
color: inherit;
|
|
705
|
+
font: inherit;
|
|
706
|
+
font-size: 0.85rem;
|
|
707
|
+
outline: none;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
.be-embed-url-input:focus {
|
|
711
|
+
border-color: var(--noteloom-accent);
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
.be-embed-url-commit {
|
|
715
|
+
border: none;
|
|
716
|
+
background: var(--noteloom-accent);
|
|
717
|
+
color: var(--noteloom-accent-text);
|
|
718
|
+
border-radius: var(--noteloom-radius-md);
|
|
719
|
+
padding: 0.45em 0.9em;
|
|
720
|
+
cursor: pointer;
|
|
721
|
+
font-size: 0.85rem;
|
|
722
|
+
font-weight: 500;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/* --- table --- */
|
|
726
|
+
|
|
727
|
+
.be-table-scroll {
|
|
728
|
+
max-width: 100%;
|
|
729
|
+
overflow-x: auto;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
.be-table-wrapper {
|
|
733
|
+
margin: 0.9em 0;
|
|
734
|
+
overflow-x: auto;
|
|
735
|
+
border: 1px solid var(--noteloom-border);
|
|
736
|
+
border-radius: var(--noteloom-radius-lg);
|
|
737
|
+
width: max-content;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
.be-table {
|
|
741
|
+
border-collapse: collapse;
|
|
742
|
+
table-layout: fixed;
|
|
743
|
+
/* Deliberately no width:100% — combined with table-layout:fixed and each
|
|
744
|
+
column's own <col> width, that would make the browser redistribute
|
|
745
|
+
leftover space proportionally across columns, fighting individual
|
|
746
|
+
column resize (see be-table-col-resize-handle). */
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
.be-table-header-row {
|
|
750
|
+
background: var(--noteloom-bg-subtle);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
.be-table-header-cell {
|
|
754
|
+
position: relative;
|
|
755
|
+
border-bottom: 1px solid var(--noteloom-border);
|
|
756
|
+
border-right: 1px solid var(--noteloom-border);
|
|
757
|
+
padding: 6px 10px;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
.be-table-header-label {
|
|
761
|
+
display: block;
|
|
762
|
+
width: 100%;
|
|
763
|
+
border: none;
|
|
764
|
+
background: none;
|
|
765
|
+
font: inherit;
|
|
766
|
+
font-weight: 600;
|
|
767
|
+
font-size: 0.78rem;
|
|
768
|
+
color: var(--noteloom-text-muted);
|
|
769
|
+
outline: none;
|
|
770
|
+
overflow: hidden;
|
|
771
|
+
text-overflow: ellipsis;
|
|
772
|
+
white-space: nowrap;
|
|
773
|
+
padding: 2px 0;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
.be-table-header-menu-trigger {
|
|
777
|
+
position: absolute;
|
|
778
|
+
right: 4px;
|
|
779
|
+
top: 50%;
|
|
780
|
+
transform: translateY(-50%);
|
|
781
|
+
visibility: hidden;
|
|
782
|
+
border: none;
|
|
783
|
+
background: transparent;
|
|
784
|
+
border-radius: var(--noteloom-radius-sm);
|
|
785
|
+
padding: 2px;
|
|
786
|
+
color: var(--noteloom-text-faint);
|
|
787
|
+
cursor: pointer;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
.be-table-header-cell:hover .be-table-header-menu-trigger {
|
|
791
|
+
visibility: visible;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
.be-table-header-menu-trigger:hover {
|
|
795
|
+
background: var(--noteloom-bg-hover);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
.be-table-col-resize-handle {
|
|
799
|
+
position: absolute;
|
|
800
|
+
top: 0;
|
|
801
|
+
right: -3px;
|
|
802
|
+
width: 6px;
|
|
803
|
+
height: 100%;
|
|
804
|
+
cursor: col-resize;
|
|
805
|
+
z-index: 1;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
.be-table-col-resize-handle:hover,
|
|
809
|
+
.be-table-col-resize-handle:active {
|
|
810
|
+
background: var(--noteloom-accent-soft-hover);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
.be-table-header-spacer {
|
|
814
|
+
border-bottom: 1px solid var(--noteloom-border);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
.be-table-header-spacer-col {
|
|
818
|
+
width: 32px;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
.be-table-header-menu {
|
|
822
|
+
z-index: 1000;
|
|
823
|
+
width: 224px;
|
|
824
|
+
border-radius: var(--noteloom-radius-lg);
|
|
825
|
+
border: 1px solid var(--noteloom-border);
|
|
826
|
+
background: var(--noteloom-bg);
|
|
827
|
+
padding: 4px;
|
|
828
|
+
font-size: 0.88rem;
|
|
829
|
+
box-shadow: var(--noteloom-shadow);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
.be-table-header-menu-options {
|
|
833
|
+
z-index: 1000;
|
|
834
|
+
padding: 4px;
|
|
835
|
+
font-size: 0.88rem;
|
|
836
|
+
border-bottom: 1px solid var(--noteloom-border);
|
|
837
|
+
margin-bottom: 4px;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
.be-table-header-menu-type {
|
|
841
|
+
display: flex;
|
|
842
|
+
flex-direction: row;
|
|
843
|
+
justify-content: space-between;
|
|
844
|
+
padding: 6px;
|
|
845
|
+
border-bottom: 1px solid var(--noteloom-border);
|
|
846
|
+
margin-bottom: 4px;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
.be-table-header-type-select {
|
|
850
|
+
width: 100%;
|
|
851
|
+
border: 1px solid var(--noteloom-border);
|
|
852
|
+
border-radius: var(--noteloom-radius-sm);
|
|
853
|
+
padding: 6px 8px;
|
|
854
|
+
background: transparent;
|
|
855
|
+
color: inherit;
|
|
856
|
+
font: inherit;
|
|
857
|
+
font-size: 0.85rem;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
.be-table-header-menu-item {
|
|
861
|
+
display: flex;
|
|
862
|
+
align-items: center;
|
|
863
|
+
gap: 8px;
|
|
864
|
+
width: 100%;
|
|
865
|
+
text-align: left;
|
|
866
|
+
border: none;
|
|
867
|
+
border-radius: var(--noteloom-radius-sm);
|
|
868
|
+
background: transparent;
|
|
869
|
+
padding: 6px 10px;
|
|
870
|
+
font: inherit;
|
|
871
|
+
font-size: 0.88rem;
|
|
872
|
+
color: var(--noteloom-text);
|
|
873
|
+
cursor: pointer;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
.be-table-header-menu-item:hover {
|
|
877
|
+
background: var(--noteloom-bg-hover);
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
.be-table-header-menu-item-danger {
|
|
881
|
+
color: var(--noteloom-danger);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
.be-table-header-menu-item-danger:hover {
|
|
885
|
+
background: var(--noteloom-danger-soft);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
.be-table-header-menu-options-label {
|
|
889
|
+
font-size: 0.68rem;
|
|
890
|
+
text-transform: uppercase;
|
|
891
|
+
letter-spacing: 0.04em;
|
|
892
|
+
font-weight: 600;
|
|
893
|
+
color: var(--noteloom-text-faint);
|
|
894
|
+
padding: 6px 8px 2px;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
.be-table-header-menu-option-row {
|
|
898
|
+
display: flex;
|
|
899
|
+
align-items: center;
|
|
900
|
+
gap: 6px;
|
|
901
|
+
padding: 2px 4px;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
.be-table-header-menu-option-swatch {
|
|
905
|
+
width: 14px;
|
|
906
|
+
height: 14px;
|
|
907
|
+
border-radius: 50%;
|
|
908
|
+
flex: none;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
.be-table-header-menu-option-input {
|
|
912
|
+
flex: 1;
|
|
913
|
+
min-width: 0;
|
|
914
|
+
border: none;
|
|
915
|
+
background: transparent;
|
|
916
|
+
color: inherit;
|
|
917
|
+
font: inherit;
|
|
918
|
+
font-size: 0.85rem;
|
|
919
|
+
padding: 4px 6px;
|
|
920
|
+
border-radius: var(--noteloom-radius-sm);
|
|
921
|
+
outline: none;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
.be-table-header-menu-option-input:focus {
|
|
925
|
+
background: var(--noteloom-bg-hover);
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
.be-table-header-menu-option-remove,
|
|
929
|
+
.be-table-header-menu-option-add {
|
|
930
|
+
flex: none;
|
|
931
|
+
border: none;
|
|
932
|
+
background: transparent;
|
|
933
|
+
color: var(--noteloom-text-faint);
|
|
934
|
+
cursor: pointer;
|
|
935
|
+
padding: 3px;
|
|
936
|
+
display: flex;
|
|
937
|
+
align-items: center;
|
|
938
|
+
justify-content: center;
|
|
939
|
+
border-radius: var(--noteloom-radius-sm);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
.be-table-header-menu-option-remove:hover {
|
|
943
|
+
background: var(--noteloom-danger-soft);
|
|
944
|
+
color: var(--noteloom-danger);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
.be-table-header-menu-option-add {
|
|
948
|
+
color: var(--noteloom-text-muted);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
.be-table-header-menu-option-add:hover {
|
|
952
|
+
background: var(--noteloom-bg-hover);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
.be-table-row:hover {
|
|
956
|
+
background: var(--noteloom-bg-subtle);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
.be-table-cell {
|
|
960
|
+
border-bottom: 1px solid var(--noteloom-border);
|
|
961
|
+
border-right: 1px solid var(--noteloom-border);
|
|
962
|
+
padding: 6px 10px;
|
|
963
|
+
vertical-align: top;
|
|
964
|
+
outline: none;
|
|
965
|
+
font-size: 0.92rem;
|
|
966
|
+
/* table-layout: fixed already keeps the COLUMN width from growing to fit
|
|
967
|
+
content — this is what stops a long unbroken string (a URL, one giant
|
|
968
|
+
word) from visually overflowing past that fixed width instead of
|
|
969
|
+
wrapping onto a new line within the cell. */
|
|
970
|
+
max-width: 0;
|
|
971
|
+
overflow-wrap: anywhere;
|
|
972
|
+
word-break: break-word;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
.be-table-cell:focus-within {
|
|
976
|
+
box-shadow: inset 0 0 0 2px var(--noteloom-accent);
|
|
977
|
+
border-radius: 2px;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
.be-table-row-actions {
|
|
981
|
+
width: 32px;
|
|
982
|
+
text-align: center;
|
|
983
|
+
vertical-align: middle;
|
|
984
|
+
border: none;
|
|
985
|
+
background: transparent;
|
|
986
|
+
padding: 0;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
.be-table-delete-row {
|
|
990
|
+
visibility: hidden;
|
|
991
|
+
border: none;
|
|
992
|
+
background: transparent;
|
|
993
|
+
color: var(--noteloom-text-faint);
|
|
994
|
+
cursor: pointer;
|
|
995
|
+
width: 24px;
|
|
996
|
+
height: 24px;
|
|
997
|
+
display: inline-flex;
|
|
998
|
+
align-items: center;
|
|
999
|
+
justify-content: center;
|
|
1000
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
tr.be-table-row:hover .be-table-delete-row {
|
|
1004
|
+
visibility: visible;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
.be-table-delete-row:hover {
|
|
1008
|
+
background: var(--noteloom-danger-soft);
|
|
1009
|
+
color: var(--noteloom-danger);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
.be-table-add-row {
|
|
1013
|
+
display: block;
|
|
1014
|
+
width: 100%;
|
|
1015
|
+
border: none;
|
|
1016
|
+
background: transparent;
|
|
1017
|
+
text-align: left;
|
|
1018
|
+
padding: 8px 12px;
|
|
1019
|
+
color: var(--noteloom-text-faint);
|
|
1020
|
+
cursor: pointer;
|
|
1021
|
+
font: inherit;
|
|
1022
|
+
font-size: 0.85rem;
|
|
1023
|
+
font-weight: 500;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
.be-table-add-row:hover {
|
|
1027
|
+
background: var(--noteloom-bg-subtle);
|
|
1028
|
+
color: var(--noteloom-accent);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
.be-inline-table-select {
|
|
1032
|
+
display: block;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
.be-inline-table-select .be-select {
|
|
1036
|
+
width: 100%;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
.be-inline-table-select .be-select .be-select-tag {
|
|
1040
|
+
width: -webkit-fill-available;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
.be-inline-table-select .be-select-trigger {
|
|
1044
|
+
display: flex;
|
|
1045
|
+
width: 100%;
|
|
1046
|
+
min-width: 0;
|
|
1047
|
+
min-height: 0;
|
|
1048
|
+
border: none;
|
|
1049
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1050
|
+
background: transparent;
|
|
1051
|
+
padding: 0;
|
|
1052
|
+
font: inherit;
|
|
1053
|
+
font-size: 0.92rem;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
.be-inline-table-select .be-select-trigger:hover,
|
|
1057
|
+
.be-inline-table-select .be-select-trigger[aria-expanded='true'] {
|
|
1058
|
+
background: var(--noteloom-bg-hover);
|
|
1059
|
+
box-shadow: none;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/* --- per-block hover gutter (+ / drag-handle / menu) --- */
|
|
1063
|
+
|
|
1064
|
+
.be-block-row {
|
|
1065
|
+
position: relative;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
.be-block-row-hidden {
|
|
1069
|
+
opacity: 0.4;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
.be-block-gutter {
|
|
1073
|
+
position: absolute;
|
|
1074
|
+
left: -56px;
|
|
1075
|
+
top: 0.15em;
|
|
1076
|
+
display: flex;
|
|
1077
|
+
gap: 2px;
|
|
1078
|
+
opacity: 0;
|
|
1079
|
+
transition: opacity 0.1s ease;
|
|
1080
|
+
user-select: none; /* it's a drag handle (see useBlockRangeDrag) — never let its own space become selectable text */
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
.be-block-row:hover .be-block-gutter,
|
|
1084
|
+
.be-block-gutter-active {
|
|
1085
|
+
opacity: 1;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
.be-block-gutter-btn {
|
|
1089
|
+
display: flex;
|
|
1090
|
+
align-items: center;
|
|
1091
|
+
justify-content: center;
|
|
1092
|
+
width: 24px;
|
|
1093
|
+
height: 24px;
|
|
1094
|
+
border: none;
|
|
1095
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1096
|
+
background: transparent;
|
|
1097
|
+
color: var(--noteloom-text-faint);
|
|
1098
|
+
cursor: pointer;
|
|
1099
|
+
transition: background-color 0.12s ease, color 0.12s ease;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
.be-block-gutter-btn:hover,
|
|
1103
|
+
.be-block-gutter-btn[aria-expanded='true'] {
|
|
1104
|
+
background: var(--noteloom-bg-hover);
|
|
1105
|
+
color: var(--noteloom-text);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
.be-block-gutter-menu,
|
|
1109
|
+
.be-block-range-menu {
|
|
1110
|
+
z-index: 1000;
|
|
1111
|
+
min-width: 200px;
|
|
1112
|
+
background: var(--noteloom-bg);
|
|
1113
|
+
border: 1px solid var(--noteloom-border);
|
|
1114
|
+
border-radius: var(--noteloom-radius-lg);
|
|
1115
|
+
box-shadow: var(--noteloom-shadow);
|
|
1116
|
+
padding: 4px;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
.be-block-gutter-menu-item,
|
|
1120
|
+
.be-block-range-menu-item {
|
|
1121
|
+
display: flex;
|
|
1122
|
+
align-items: center;
|
|
1123
|
+
gap: 8px;
|
|
1124
|
+
width: 100%;
|
|
1125
|
+
text-align: left;
|
|
1126
|
+
border: none;
|
|
1127
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1128
|
+
background: transparent;
|
|
1129
|
+
padding: 7px 10px;
|
|
1130
|
+
font: inherit;
|
|
1131
|
+
font-size: 0.88rem;
|
|
1132
|
+
color: var(--noteloom-text);
|
|
1133
|
+
cursor: pointer;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
.be-block-gutter-menu-item:hover,
|
|
1137
|
+
.be-block-range-menu-item:hover {
|
|
1138
|
+
background: var(--noteloom-bg-hover);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
.be-block-gutter-menu-item-danger,
|
|
1142
|
+
.be-block-range-menu-item-danger {
|
|
1143
|
+
color: var(--noteloom-danger);
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
.be-block-gutter-menu-item-danger:hover,
|
|
1147
|
+
.be-block-range-menu-item-danger:hover {
|
|
1148
|
+
background: var(--noteloom-danger-soft);
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
/* --- drag-in-the-margin block range selection --- */
|
|
1152
|
+
|
|
1153
|
+
.be-block-row-range-selected {
|
|
1154
|
+
background: var(--noteloom-accent-soft);
|
|
1155
|
+
border-radius: var(--noteloom-radius-md);
|
|
1156
|
+
margin: 0 -8px;
|
|
1157
|
+
padding: 0 8px;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
.be-block-range-dragging,
|
|
1161
|
+
.be-block-range-dragging * {
|
|
1162
|
+
user-select: none !important;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
/* --- whole-document select-all / single non-editable block selected --- */
|
|
1166
|
+
|
|
1167
|
+
.be-surface--all-selected .be-block-row-content > [data-block-id] {
|
|
1168
|
+
background: var(--noteloom-accent-soft);
|
|
1169
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
.be-block-selected {
|
|
1173
|
+
outline: 2px solid var(--noteloom-accent);
|
|
1174
|
+
outline-offset: 2px;
|
|
1175
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
/* --- trailing click-to-continue space --- */
|
|
1179
|
+
|
|
1180
|
+
.be-trailing-space {
|
|
1181
|
+
cursor: text;
|
|
1182
|
+
width: 100%;
|
|
1183
|
+
min-height: 180px;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
/* --- modal (button editor, field type editor) --- */
|
|
1187
|
+
|
|
1188
|
+
.be-modal-overlay {
|
|
1189
|
+
position: fixed;
|
|
1190
|
+
inset: 0;
|
|
1191
|
+
background: rgba(15, 23, 42, 0.45);
|
|
1192
|
+
display: flex;
|
|
1193
|
+
align-items: center;
|
|
1194
|
+
justify-content: center;
|
|
1195
|
+
z-index: 2000;
|
|
1196
|
+
padding: 1em;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
.be-modal {
|
|
1200
|
+
background: var(--noteloom-bg);
|
|
1201
|
+
color: var(--noteloom-text);
|
|
1202
|
+
border-radius: var(--noteloom-radius-xl);
|
|
1203
|
+
border: 1px solid var(--noteloom-border);
|
|
1204
|
+
padding: 1.4em;
|
|
1205
|
+
width: 100%;
|
|
1206
|
+
max-width: 380px;
|
|
1207
|
+
max-height: 85vh;
|
|
1208
|
+
overflow-y: auto;
|
|
1209
|
+
box-shadow: var(--noteloom-shadow);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
.be-modal-title {
|
|
1213
|
+
font-weight: 600;
|
|
1214
|
+
font-size: 1.05rem;
|
|
1215
|
+
margin-bottom: 1em;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
.be-modal-field {
|
|
1219
|
+
display: block;
|
|
1220
|
+
margin-bottom: 1em;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
.be-modal-field > span {
|
|
1224
|
+
display: block;
|
|
1225
|
+
font-size: 0.8rem;
|
|
1226
|
+
color: var(--noteloom-text-muted);
|
|
1227
|
+
margin-bottom: 5px;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
.be-modal-field input[type='text'],
|
|
1231
|
+
.be-modal-field input[type='url'] {
|
|
1232
|
+
width: 100%;
|
|
1233
|
+
box-sizing: border-box;
|
|
1234
|
+
border: 1px solid var(--noteloom-border);
|
|
1235
|
+
border-radius: var(--noteloom-radius-md);
|
|
1236
|
+
padding: 0.55em 0.75em;
|
|
1237
|
+
background: transparent;
|
|
1238
|
+
color: inherit;
|
|
1239
|
+
font: inherit;
|
|
1240
|
+
outline: none;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
.be-modal-field input[type='text']:focus,
|
|
1244
|
+
.be-modal-field input[type='url']:focus {
|
|
1245
|
+
border-color: var(--noteloom-accent);
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
.be-modal-field select {
|
|
1249
|
+
width: 100%;
|
|
1250
|
+
box-sizing: border-box;
|
|
1251
|
+
border: 1px solid var(--noteloom-border);
|
|
1252
|
+
border-radius: var(--noteloom-radius-md);
|
|
1253
|
+
padding: 0.55em 0.75em;
|
|
1254
|
+
background: transparent;
|
|
1255
|
+
color: inherit;
|
|
1256
|
+
font: inherit;
|
|
1257
|
+
font-size: 0.9rem;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
.be-modal-field select:focus {
|
|
1261
|
+
border-color: var(--noteloom-accent);
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
.be-modal-color-row {
|
|
1265
|
+
display: flex;
|
|
1266
|
+
gap: 8px;
|
|
1267
|
+
flex-wrap: wrap;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
.be-modal-color-swatch {
|
|
1271
|
+
width: 26px;
|
|
1272
|
+
height: 26px;
|
|
1273
|
+
border-radius: 50%;
|
|
1274
|
+
border: 2px solid transparent;
|
|
1275
|
+
cursor: pointer;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
.be-modal-color-swatch-active {
|
|
1279
|
+
border-color: var(--noteloom-accent);
|
|
1280
|
+
box-shadow: 0 0 0 2px var(--noteloom-bg), 0 0 0 4px var(--noteloom-accent-soft);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
.be-modal-attr-row {
|
|
1284
|
+
display: flex;
|
|
1285
|
+
gap: 6px;
|
|
1286
|
+
margin-bottom: 6px;
|
|
1287
|
+
align-items: center;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
.be-modal-attr-row input {
|
|
1291
|
+
flex: 1;
|
|
1292
|
+
min-width: 0;
|
|
1293
|
+
border: 1px solid var(--noteloom-border);
|
|
1294
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1295
|
+
padding: 0.4em 0.6em;
|
|
1296
|
+
background: transparent;
|
|
1297
|
+
color: inherit;
|
|
1298
|
+
font: inherit;
|
|
1299
|
+
font-size: 0.85rem;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
.be-modal-attr-remove {
|
|
1303
|
+
flex: none;
|
|
1304
|
+
border: none;
|
|
1305
|
+
background: none;
|
|
1306
|
+
color: var(--noteloom-text-faint);
|
|
1307
|
+
cursor: pointer;
|
|
1308
|
+
padding: 2px;
|
|
1309
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
.be-modal-attr-remove:hover {
|
|
1313
|
+
color: var(--noteloom-danger);
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
.be-modal-actions {
|
|
1317
|
+
display: flex;
|
|
1318
|
+
justify-content: flex-end;
|
|
1319
|
+
gap: 8px;
|
|
1320
|
+
margin-top: 20px;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
.be-modal-delete {
|
|
1324
|
+
margin-right: auto; /* pushes Cancel/Save to the right, Delete stays on its own at the left */
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
.be-modal-cancel,
|
|
1328
|
+
.be-modal-save,
|
|
1329
|
+
.be-modal-delete {
|
|
1330
|
+
border: none;
|
|
1331
|
+
border-radius: var(--noteloom-radius-md);
|
|
1332
|
+
padding: 7px 16px;
|
|
1333
|
+
font-size: 0.85rem;
|
|
1334
|
+
font-weight: 500;
|
|
1335
|
+
cursor: pointer;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
.be-modal-delete {
|
|
1339
|
+
background: var(--noteloom-danger-soft);
|
|
1340
|
+
color: var(--noteloom-danger);
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
.be-modal-cancel {
|
|
1344
|
+
background: var(--noteloom-bg-subtle);
|
|
1345
|
+
color: var(--noteloom-text);
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
.be-modal-cancel:hover {
|
|
1349
|
+
background: var(--noteloom-bg-hover);
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
.be-modal-save {
|
|
1353
|
+
background: var(--noteloom-accent);
|
|
1354
|
+
color: var(--noteloom-accent-text);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
.be-modal-save:hover {
|
|
1358
|
+
opacity: 0.9;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
.be-modal-save:disabled {
|
|
1362
|
+
opacity: 0.5;
|
|
1363
|
+
cursor: not-allowed;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
/* --- slash ("/") / emoji (":") / mention ("@") command menu --- */
|
|
1367
|
+
|
|
1368
|
+
.be-slash-menu {
|
|
1369
|
+
z-index: 1000;
|
|
1370
|
+
width: 260px;
|
|
1371
|
+
max-height: 320px;
|
|
1372
|
+
overflow-y: auto;
|
|
1373
|
+
background: var(--noteloom-bg);
|
|
1374
|
+
border: 1px solid var(--noteloom-border);
|
|
1375
|
+
border-radius: var(--noteloom-radius-lg);
|
|
1376
|
+
box-shadow: var(--noteloom-shadow);
|
|
1377
|
+
padding: 6px;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
.be-slash-menu-item {
|
|
1381
|
+
display: flex;
|
|
1382
|
+
align-items: center;
|
|
1383
|
+
gap: 10px;
|
|
1384
|
+
padding: 7px 8px;
|
|
1385
|
+
border-radius: var(--noteloom-radius-md);
|
|
1386
|
+
cursor: pointer;
|
|
1387
|
+
font-size: 0.9rem;
|
|
1388
|
+
color: var(--noteloom-text);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
.be-slash-menu-item-active,
|
|
1392
|
+
.be-slash-menu-item:hover {
|
|
1393
|
+
background: var(--noteloom-accent-soft);
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
.be-slash-menu-item-icon {
|
|
1397
|
+
flex: none;
|
|
1398
|
+
display: flex;
|
|
1399
|
+
align-items: center;
|
|
1400
|
+
justify-content: center;
|
|
1401
|
+
width: 28px;
|
|
1402
|
+
height: 28px;
|
|
1403
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1404
|
+
border: 1px solid var(--noteloom-border);
|
|
1405
|
+
color: var(--noteloom-text-muted);
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
.be-slash-menu-item-label {
|
|
1409
|
+
flex: 1;
|
|
1410
|
+
overflow: hidden;
|
|
1411
|
+
text-overflow: ellipsis;
|
|
1412
|
+
white-space: nowrap;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
/* --- searchable Select (inline select/date/checkbox widgets, custom field types, table column type) --- */
|
|
1416
|
+
|
|
1417
|
+
.be-select {
|
|
1418
|
+
display: inline-flex;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
.be-select-trigger {
|
|
1422
|
+
display: inline-flex;
|
|
1423
|
+
align-items: center;
|
|
1424
|
+
gap: 6px;
|
|
1425
|
+
min-height: 28px;
|
|
1426
|
+
min-width: 6em;
|
|
1427
|
+
border: 1px solid var(--noteloom-border);
|
|
1428
|
+
border-radius: var(--noteloom-radius-md);
|
|
1429
|
+
background: var(--noteloom-bg);
|
|
1430
|
+
color: var(--noteloom-text);
|
|
1431
|
+
font: inherit;
|
|
1432
|
+
font-size: 0.88rem;
|
|
1433
|
+
padding: 4px 8px;
|
|
1434
|
+
cursor: pointer;
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
.be-select-trigger:hover {
|
|
1438
|
+
border-color: var(--noteloom-accent);
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
.be-select-trigger[aria-expanded='true'] {
|
|
1442
|
+
border-color: var(--noteloom-accent);
|
|
1443
|
+
box-shadow: 0 0 0 2px var(--noteloom-accent-soft);
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
.be-select-trigger-tag {
|
|
1447
|
+
min-width: 0;
|
|
1448
|
+
min-height: 0;
|
|
1449
|
+
border: none;
|
|
1450
|
+
background: transparent;
|
|
1451
|
+
padding: 2px;
|
|
1452
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1453
|
+
outline: none;
|
|
1454
|
+
border: none;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
.be-select-trigger-tag:hover {
|
|
1458
|
+
background: var(--noteloom-bg-hover);
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
.be-select-trigger-tag[aria-expanded='true'] {
|
|
1462
|
+
background: var(--noteloom-bg-hover);
|
|
1463
|
+
box-shadow: none;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
.be-select-value-placeholder {
|
|
1467
|
+
color: var(--noteloom-text-faint);
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
.be-select-tag {
|
|
1471
|
+
display: inline-flex;
|
|
1472
|
+
flex: none;
|
|
1473
|
+
max-width: 100%;
|
|
1474
|
+
padding: 2px 9px;
|
|
1475
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1476
|
+
font-size: 0.82em;
|
|
1477
|
+
font-weight: 500;
|
|
1478
|
+
line-height: 1.4;
|
|
1479
|
+
/* Wraps rather than truncates — a fixed-width popover (see
|
|
1480
|
+
.be-select-popover) or table cell (see .be-table-cell) combined with
|
|
1481
|
+
nowrap+ellipsis let long option text silently overflow its box
|
|
1482
|
+
instead of actually being clipped; wrapping sidesteps that entirely. */
|
|
1483
|
+
white-space: normal;
|
|
1484
|
+
overflow-wrap: anywhere;
|
|
1485
|
+
word-break: break-word;
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
.be-select-value {
|
|
1489
|
+
flex: 1;
|
|
1490
|
+
text-align: left;
|
|
1491
|
+
overflow: hidden;
|
|
1492
|
+
text-overflow: ellipsis;
|
|
1493
|
+
white-space: nowrap;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
.be-select-chevron {
|
|
1497
|
+
flex: none;
|
|
1498
|
+
color: var(--noteloom-text-faint);
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
.be-select-popover {
|
|
1502
|
+
z-index: 1000;
|
|
1503
|
+
width: 224px;
|
|
1504
|
+
background: var(--noteloom-bg);
|
|
1505
|
+
border: 1px solid var(--noteloom-border);
|
|
1506
|
+
border-radius: var(--noteloom-radius-lg);
|
|
1507
|
+
box-shadow: var(--noteloom-shadow);
|
|
1508
|
+
overflow: hidden;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
.be-select-search {
|
|
1512
|
+
display: block;
|
|
1513
|
+
width: 100%;
|
|
1514
|
+
box-sizing: border-box;
|
|
1515
|
+
border: none;
|
|
1516
|
+
border-bottom: 1px solid var(--noteloom-border);
|
|
1517
|
+
background: transparent;
|
|
1518
|
+
color: inherit;
|
|
1519
|
+
padding: 10px 12px;
|
|
1520
|
+
font: inherit;
|
|
1521
|
+
font-size: 0.88rem;
|
|
1522
|
+
outline: none;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
.be-select-options {
|
|
1526
|
+
max-height: 220px;
|
|
1527
|
+
overflow-y: auto;
|
|
1528
|
+
overflow-x: hidden;
|
|
1529
|
+
padding: 4px;
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
.be-select-option {
|
|
1533
|
+
display: flex;
|
|
1534
|
+
align-items: center;
|
|
1535
|
+
min-width: 0;
|
|
1536
|
+
padding: 7px 8px;
|
|
1537
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1538
|
+
cursor: pointer;
|
|
1539
|
+
font-size: 0.88rem;
|
|
1540
|
+
color: var(--noteloom-text);
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
/* A tag-variant option list (colored pills — e.g. Priority/Assignee) must
|
|
1544
|
+
read at the exact same size/weight as a plain default-variant list
|
|
1545
|
+
(Diagnosis) — only the colored-chip background should differ between
|
|
1546
|
+
them, not the typography. .be-select-tag's own font-size/weight (sized
|
|
1547
|
+
down for when it's squeezed into a trigger button) would otherwise make
|
|
1548
|
+
tag-variant options look smaller/bolder than plain ones for no reason. */
|
|
1549
|
+
.be-select-option .be-select-tag {
|
|
1550
|
+
font-size: inherit;
|
|
1551
|
+
font-weight: inherit;
|
|
1552
|
+
line-height: inherit;
|
|
1553
|
+
width: -webkit-fill-available;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
.be-select-option-active {
|
|
1557
|
+
background: var(--noteloom-accent-soft);
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
.be-select-option-selected {
|
|
1561
|
+
font-weight: 600;
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
.be-select-option-selected:not(.be-select-option-active) {
|
|
1565
|
+
background: var(--noteloom-bg-subtle);
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
.be-select-option-selected .be-select-tag {
|
|
1569
|
+
font-weight: 500;
|
|
1570
|
+
box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.2);
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
.be-select-empty {
|
|
1574
|
+
padding: 10px 12px;
|
|
1575
|
+
color: var(--noteloom-text-faint);
|
|
1576
|
+
font-size: 0.85rem;
|
|
1577
|
+
text-align: center;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
.be-select-error {
|
|
1581
|
+
color: var(--noteloom-danger);
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
.be-select-manage-options {
|
|
1585
|
+
display: block;
|
|
1586
|
+
width: 100%;
|
|
1587
|
+
box-sizing: border-box;
|
|
1588
|
+
border: none;
|
|
1589
|
+
border-top: 1px solid var(--noteloom-border);
|
|
1590
|
+
background: transparent;
|
|
1591
|
+
padding: 9px 12px;
|
|
1592
|
+
font: inherit;
|
|
1593
|
+
font-size: 0.82rem;
|
|
1594
|
+
font-weight: 500;
|
|
1595
|
+
color: var(--noteloom-accent);
|
|
1596
|
+
text-align: left;
|
|
1597
|
+
cursor: pointer;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
.be-select-manage-options:hover {
|
|
1601
|
+
background: var(--noteloom-accent-soft);
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
.be-inline-select,
|
|
1605
|
+
.be-inline-date,
|
|
1606
|
+
.be-inline-checkbox {
|
|
1607
|
+
display: inline-flex;
|
|
1608
|
+
align-items: center;
|
|
1609
|
+
vertical-align: middle;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
/* Inline chips sit in running text — match the surrounding line's own font
|
|
1613
|
+
size instead of the smaller size used for the Select component elsewhere
|
|
1614
|
+
(menus, table column type dropdown), where a compact UI size is right. */
|
|
1615
|
+
.be-inline-select .be-select-trigger {
|
|
1616
|
+
min-height: 0;
|
|
1617
|
+
font-size: 1em;
|
|
1618
|
+
padding: 1px 8px;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
.be-inline-select .be-select-tag {
|
|
1622
|
+
font-size: 0.92em;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
/* A mention reads as highlighted text sitting inline in the paragraph, not
|
|
1626
|
+
a bulky standalone pill/button — minimal padding, small radius, no extra
|
|
1627
|
+
chrome from the trigger button wrapping it. */
|
|
1628
|
+
.be-inline-select .be-select-trigger-mention {
|
|
1629
|
+
padding: 0 !important;
|
|
1630
|
+
border-radius: 3px;
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
/* A mention chip always uses this one fixed color, not each option's own
|
|
1634
|
+
tag color — matches Notion/Slack/GitHub's "@mentions are one consistent
|
|
1635
|
+
color" convention rather than a per-person palette. */
|
|
1636
|
+
.be-select-tag-mention {
|
|
1637
|
+
background: var(--noteloom-accent-soft);
|
|
1638
|
+
color: var(--noteloom-accent);
|
|
1639
|
+
font-weight: 500;
|
|
1640
|
+
padding: 0 3px;
|
|
1641
|
+
border-radius: 3px;
|
|
1642
|
+
line-height: inherit;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
.be-inline-date input[type='date'] {
|
|
1646
|
+
border: 1px solid var(--noteloom-border);
|
|
1647
|
+
border-radius: var(--noteloom-radius-md);
|
|
1648
|
+
background: var(--noteloom-bg);
|
|
1649
|
+
color: inherit;
|
|
1650
|
+
padding: 4px 8px;
|
|
1651
|
+
font: inherit;
|
|
1652
|
+
font-size: 0.88rem;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
.be-inline-checkbox {
|
|
1656
|
+
gap: 6px;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
.be-inline-checkbox-input {
|
|
1660
|
+
flex: none;
|
|
1661
|
+
width: 16px;
|
|
1662
|
+
height: 16px;
|
|
1663
|
+
margin: 0;
|
|
1664
|
+
accent-color: var(--noteloom-accent);
|
|
1665
|
+
cursor: pointer;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
.be-inline-checkbox-label {
|
|
1669
|
+
min-width: 0;
|
|
1670
|
+
flex: 1;
|
|
1671
|
+
border: 1px solid var(--noteloom-border);
|
|
1672
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1673
|
+
background: transparent;
|
|
1674
|
+
color: inherit;
|
|
1675
|
+
font: inherit;
|
|
1676
|
+
padding: 2px 8px;
|
|
1677
|
+
outline: none;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
.be-inline-checkbox-label:focus {
|
|
1681
|
+
border-color: var(--noteloom-accent);
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
/* In a table cell (checkbox column), the browser's default text-input
|
|
1685
|
+
width (~170px+) is wider than most columns, forcing the input — and with
|
|
1686
|
+
it, the whole table — past the cell's own bounds. Constraining the
|
|
1687
|
+
inline-flex row to the cell's actual width lets the label's flex:1 +
|
|
1688
|
+
min-width:0 (above) do their job and shrink the input to fit instead. */
|
|
1689
|
+
.be-table-cell .be-inline-checkbox {
|
|
1690
|
+
display: flex;
|
|
1691
|
+
width: 100%;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
.be-inline-checkbox-label::placeholder {
|
|
1695
|
+
color: var(--noteloom-text-faint);
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
/* --- floating (selection) format toolbar --- */
|
|
1699
|
+
|
|
1700
|
+
.be-floating-toolbar {
|
|
1701
|
+
display: flex;
|
|
1702
|
+
align-items: center;
|
|
1703
|
+
gap: 2px;
|
|
1704
|
+
background: var(--noteloom-text);
|
|
1705
|
+
border-radius: var(--noteloom-radius-md);
|
|
1706
|
+
padding: 4px;
|
|
1707
|
+
box-shadow: var(--noteloom-shadow);
|
|
1708
|
+
z-index: 1000;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
.be-floating-toolbar-btn {
|
|
1712
|
+
border: none;
|
|
1713
|
+
background: transparent;
|
|
1714
|
+
color: rgba(255, 255, 255, 0.85);
|
|
1715
|
+
width: 30px;
|
|
1716
|
+
height: 30px;
|
|
1717
|
+
display: flex;
|
|
1718
|
+
align-items: center;
|
|
1719
|
+
justify-content: center;
|
|
1720
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1721
|
+
cursor: pointer;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
.be-floating-toolbar-btn:hover {
|
|
1725
|
+
background: rgba(255, 255, 255, 0.14);
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
.be-floating-toolbar-btn-active {
|
|
1729
|
+
background: var(--noteloom-accent);
|
|
1730
|
+
color: #fff;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
.be-floating-toolbar-divider {
|
|
1734
|
+
width: 1px;
|
|
1735
|
+
height: 20px;
|
|
1736
|
+
background: rgba(255, 255, 255, 0.2);
|
|
1737
|
+
margin: 0 4px;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
.be-floating-toolbar-picker-wrap {
|
|
1741
|
+
position: relative;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
.be-floating-toolbar-picker {
|
|
1745
|
+
position: absolute;
|
|
1746
|
+
top: 100%;
|
|
1747
|
+
left: 0;
|
|
1748
|
+
margin-top: 8px;
|
|
1749
|
+
display: flex;
|
|
1750
|
+
gap: 4px;
|
|
1751
|
+
background: var(--noteloom-bg);
|
|
1752
|
+
border-radius: var(--noteloom-radius-md);
|
|
1753
|
+
padding: 6px;
|
|
1754
|
+
box-shadow: var(--noteloom-shadow);
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
.be-floating-toolbar-swatch {
|
|
1758
|
+
width: 22px;
|
|
1759
|
+
height: 22px;
|
|
1760
|
+
border-radius: 50%;
|
|
1761
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
1762
|
+
cursor: pointer;
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
/* --- link hover card (edit/remove an existing link mark) --- */
|
|
1766
|
+
|
|
1767
|
+
.be-link-hover-card {
|
|
1768
|
+
z-index: 1000;
|
|
1769
|
+
display: flex;
|
|
1770
|
+
align-items: center;
|
|
1771
|
+
gap: 2px;
|
|
1772
|
+
max-width: 320px;
|
|
1773
|
+
background: var(--noteloom-bg);
|
|
1774
|
+
border: 1px solid var(--noteloom-border);
|
|
1775
|
+
border-radius: var(--noteloom-radius-md);
|
|
1776
|
+
padding: 5px 6px 5px 10px;
|
|
1777
|
+
box-shadow: var(--noteloom-shadow);
|
|
1778
|
+
font-size: 0.85rem;
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
.be-link-hover-card-url {
|
|
1782
|
+
flex: 1;
|
|
1783
|
+
min-width: 0;
|
|
1784
|
+
overflow: hidden;
|
|
1785
|
+
text-overflow: ellipsis;
|
|
1786
|
+
white-space: nowrap;
|
|
1787
|
+
color: var(--noteloom-accent);
|
|
1788
|
+
text-decoration: none;
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
.be-link-hover-card-url:hover {
|
|
1792
|
+
text-decoration: underline;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
.be-link-hover-card-btn {
|
|
1796
|
+
flex: none;
|
|
1797
|
+
width: 24px;
|
|
1798
|
+
height: 24px;
|
|
1799
|
+
border: none;
|
|
1800
|
+
background: transparent;
|
|
1801
|
+
color: var(--noteloom-text-muted);
|
|
1802
|
+
display: flex;
|
|
1803
|
+
align-items: center;
|
|
1804
|
+
justify-content: center;
|
|
1805
|
+
border-radius: var(--noteloom-radius-sm);
|
|
1806
|
+
cursor: pointer;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
.be-link-hover-card-btn:hover {
|
|
1810
|
+
background: var(--noteloom-bg-hover);
|
|
1811
|
+
color: var(--noteloom-text);
|
|
1812
|
+
}
|
|
1813
|
+
`,tt="noteloom-default-styles";function vt(){if(typeof document>"u"||document.getElementById(tt))return;const e=document.createElement("style");e.id=tt,e.textContent=hr,document.head.appendChild(e)}const It=f.createContext(null);function mr({store:e,registry:n,inlineRegistry:t=null,history:o=null,className:r,style:l,theme:s="default",children:c}){f.useEffect(()=>{s!=="none"&&vt()},[s]);const[i,u]=f.useState(!1),[d,p]=f.useState([]),[b,m]=f.useState(!1),[h,g]=f.useState(null),k=f.useCallback(()=>g("new"),[]),x=f.useCallback(B=>g(B),[]),y=f.useCallback(()=>g(null),[]),I=f.useRef(null),E=f.useCallback(()=>I.current,[]),T=f.useCallback(B=>{var C,j;const v=I.current;v!==B&&(v&&((C=document.querySelector(`[data-block-id="${v}"]`))==null||C.classList.remove("be-block-selected")),I.current=B,B&&((j=document.querySelector(`[data-block-id="${B}"]`))==null||j.classList.add("be-block-selected")))},[]),S=f.useMemo(()=>({store:e,registry:n,inlineRegistry:t,history:o,isWholeDocumentSelected:i,setIsWholeDocumentSelected:u,selectedBlockRange:d,setSelectedBlockRange:p,getSelectedBlockId:E,setSelectedBlockId:T,isPreviewMode:b,setIsPreviewMode:m,fieldTypeEditorTarget:h,openCreateFieldType:k,openEditFieldType:x,closeFieldTypeEditor:y}),[e,n,t,o,i,d,E,T,b,h,k,x,y]),w=r||l?a.jsx("div",{className:r?`be-root ${r}`:"be-root",style:l,children:c}):c;return a.jsx(It.Provider,{value:S,children:w})}function be(){const e=f.useContext(It);if(!e)throw new Error("Editor hooks must be used within an <EditorProvider>");return e}function D(){return be().store}function Ke(){return be().registry}function ke(){return be().inlineRegistry}function Ln(){const{isWholeDocumentSelected:e,setIsWholeDocumentSelected:n}=be();return[e,n]}function qe(){const{selectedBlockRange:e,setSelectedBlockRange:n}=be();return[e,n]}function he(){const{getSelectedBlockId:e,setSelectedBlockId:n}=be();return{getSelectedBlockId:e,setSelectedBlockId:n}}function Nn(){const{isPreviewMode:e,setIsPreviewMode:n}=be();return[e,n]}function Mn(){const{fieldTypeEditorTarget:e,openCreateFieldType:n,openEditFieldType:t,closeFieldTypeEditor:o}=be();return{target:e,openCreate:n,openEdit:t,close:o}}function te(e){const n=D(),t=f.useCallback(r=>n.subscribe(e,r),[n,e]),o=f.useCallback(()=>n.getBlock(e),[n,e]);return f.useSyncExternalStore(t,o)}function xe(e){const n=D(),t=f.useCallback(r=>n.subscribe(e,r),[n,e]),o=f.useCallback(()=>n.getRun(e),[n,e]);return f.useSyncExternalStore(t,o)}function R(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`id-${Date.now()}-${Math.random().toString(36).slice(2)}`}const wt="",gr=//g;function fe(e){return(e??"").replace(gr,"")}function ot(e){return fe(e.textContent)}function kr(e,n){var c;const t=new Map(n.map(i=>[i.id,i])),o=new Set,r=[];let l=!0;for(const i of e.childNodes){const u=i.nodeType===1?(c=i.dataset)==null?void 0:c.runId:void 0;if(u&&t.has(u)){o.add(u);const p=t.get(u);if(p.type!=="text"){r.push(p);continue}const b=ot(i);r.push(b===p.value?p:{...p,value:b});continue}l=!1;const d=ot(i);d&&r.push({id:R(),type:"text",value:d,marks:{}})}if(n.some(i=>!o.has(i.id))&&(l=!1),r.length!==n.length&&(l=!1),l){for(let i=0;i<r.length;i+=1)if(r[i].id!==n[i].id){l=!1;break}}const s=!l||r.some((i,u)=>i!==n[u]);return{runs:r,changed:s,onlyValueChanges:l}}function Ct(e){return e?e.type!=="text"?!1:(e.value??"")==="":!0}function se(e,n){return!n||n.length===0?!0:n.every(t=>Ct(e.getRun(t)))}function We(e,n){var r,l;if(!n)return!1;const t=n.contentIds.length>0,o=(((l=(r=n.props)==null?void 0:r.titleRunIds)==null?void 0:l.length)??0)>0;return!t&&!o}function Bt(e,n){requestAnimationFrame(()=>{const t=document.querySelector(`[data-run-id="${e}"]`);if(!t)return;t.focus();const o=document.createRange();o.selectNodeContents(t),o.collapse(n);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(o)})}function G(e){Bt(e,!1)}function An(e){Bt(e,!0)}function pe(e,n){requestAnimationFrame(()=>{const t=document.querySelector(`[data-run-id="${e}"]`);if(!t)return;t.focus();const o=t.firstChild,r=document.createRange();if(o&&o.nodeType===3){const s=Math.max(0,Math.min(n,o.length));r.setStart(o,s),r.setEnd(o,s)}else r.selectNodeContents(t),r.collapse(n<=0);const l=window.getSelection();l==null||l.removeAllRanges(),l==null||l.addRange(r)})}function cn({isOpen:e,onClose:n,title:t,children:o}){return f.useEffect(()=>{if(!e)return;const r=l=>{l.key==="Escape"&&n()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,n]),e?a.jsx("div",{className:"be-modal-overlay",onMouseDown:r=>{r.target===r.currentTarget&&n()},children:a.jsxs("div",{className:"be-modal",role:"dialog","aria-modal":"true","aria-label":t,children:[t&&a.jsx("div",{className:"be-modal-title",children:t}),o]})}):null}function Rt({isOpen:e,initialHref:n,initialTarget:t,hasExistingLink:o,onSave:r,onRemove:l,onClose:s}){const[c,i]=f.useState(""),[u,d]=f.useState("_self");f.useEffect(()=>{e&&(i(n),d(t))},[e]);const p=c.trim(),b=f.useCallback(m=>{m.preventDefault(),p&&r(p,u)},[p,u,r]);return a.jsx(cn,{isOpen:e,onClose:s,title:o?"Edit link":"Add link",children:a.jsxs("form",{onSubmit:b,children:[a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"URL"}),a.jsx("input",{type:"text",value:c,onChange:m=>i(m.target.value),placeholder:"https://example.com",autoFocus:!0})]}),a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"Open in"}),a.jsxs("select",{value:u,onChange:m=>d(m.target.value),children:[a.jsx("option",{value:"_self",children:"Same tab"}),a.jsx("option",{value:"_blank",children:"New tab"})]})]}),a.jsxs("div",{className:"be-modal-actions",children:[o&&a.jsx("button",{type:"button",className:"be-modal-delete",onClick:l,children:"Remove link"}),a.jsx("button",{type:"button",className:"be-modal-cancel",onClick:s,children:"Cancel"}),a.jsx("button",{type:"submit",className:"be-modal-save",disabled:!p,children:"Save"})]})]})})}function M({children:e,size:n=16,strokeWidth:t=2,...o}){return a.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...o,children:e})}function un(e){return a.jsx(M,{...e,children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Dn(e){return a.jsx(M,{...e,children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})}function Ve(e){return a.jsxs(M,{...e,children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Tt(e){return a.jsx(M,{...e,children:a.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}function jt(e){return a.jsxs(M,{...e,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function xr(e){return a.jsxs(M,{...e,children:[a.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),a.jsx("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function yr(e){return a.jsxs(M,{...e,children:[a.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),a.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),a.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]})}function vr(e){return a.jsxs(M,{...e,children:[a.jsx("path",{d:"M6 3v7a6 6 0 0 0 12 0V3"}),a.jsx("line",{x1:"4",y1:"21",x2:"20",y2:"21"})]})}function Ir(e){return a.jsxs(M,{...e,children:[a.jsx("path",{d:"M12 20h9"}),a.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}function wr(e){return a.jsxs(M,{...e,children:[a.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),a.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function Cr(e){return a.jsxs(M,{...e,children:[a.jsx("path",{d:"M16 4H9a3 3 0 0 0-2.83 4"}),a.jsx("path",{d:"M14 12a4 4 0 0 1 0 8H6"}),a.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})]})}function Br(e){return a.jsxs(M,{...e,children:[a.jsx("line",{x1:"21",y1:"6",x2:"3",y2:"6"}),a.jsx("line",{x1:"17",y1:"10",x2:"3",y2:"10"}),a.jsx("line",{x1:"21",y1:"14",x2:"3",y2:"14"}),a.jsx("line",{x1:"17",y1:"18",x2:"3",y2:"18"})]})}function Rr(e){return a.jsxs(M,{...e,children:[a.jsx("line",{x1:"21",y1:"6",x2:"3",y2:"6"}),a.jsx("line",{x1:"18",y1:"10",x2:"6",y2:"10"}),a.jsx("line",{x1:"21",y1:"14",x2:"3",y2:"14"}),a.jsx("line",{x1:"18",y1:"18",x2:"6",y2:"18"})]})}function Tr(e){return a.jsxs(M,{...e,children:[a.jsx("line",{x1:"21",y1:"6",x2:"3",y2:"6"}),a.jsx("line",{x1:"21",y1:"10",x2:"7",y2:"10"}),a.jsx("line",{x1:"21",y1:"14",x2:"3",y2:"14"}),a.jsx("line",{x1:"21",y1:"18",x2:"7",y2:"18"})]})}function jr(e){return a.jsx(M,{...e,children:[5,12,19].flatMap(n=>[9,15].map(t=>a.jsx("circle",{cx:t,cy:n,r:"1.3",fill:"currentColor",stroke:"none"},`${t}-${n}`)))})}function _n(e){return a.jsxs(M,{...e,children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),a.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),a.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function St(e){return a.jsxs(M,{...e,children:[a.jsx("rect",{x:"9",y:"9",width:"12",height:"12",rx:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function Et(e){return a.jsxs(M,{...e,children:[a.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),a.jsx("polyline",{points:"5 12 12 5 19 12"})]})}function Ot(e){return a.jsxs(M,{...e,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("polyline",{points:"19 12 12 19 5 12"})]})}function Sr(e){return a.jsxs(M,{...e,children:[a.jsx("circle",{cx:"6",cy:"6",r:"3"}),a.jsx("circle",{cx:"6",cy:"18",r:"3"}),a.jsx("line",{x1:"20",y1:"4",x2:"8.12",y2:"15.88"}),a.jsx("line",{x1:"14.47",y1:"14.48",x2:"20",y2:"20"}),a.jsx("line",{x1:"8.12",y1:"8.12",x2:"12",y2:"12"})]})}function Er(e){return a.jsxs(M,{...e,children:[a.jsx("line",{x1:"17",y1:"6",x2:"3",y2:"6"}),a.jsx("line",{x1:"21",y1:"12",x2:"3",y2:"12"}),a.jsx("line",{x1:"15",y1:"18",x2:"3",y2:"18"})]})}function Pn({level:e=1,size:n=16,...t}){return a.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",...t,children:a.jsxs("text",{x:"2",y:"18",fontSize:"14",fontWeight:"700",fill:"currentColor",fontFamily:"inherit",children:["H",e]})})}function Or(e){return a.jsx(Pn,{level:1,...e})}function Lr(e){return a.jsx(Pn,{level:2,...e})}function Nr(e){return a.jsx(Pn,{level:3,...e})}function Mr(e){return a.jsxs(M,{...e,children:[a.jsx("path",{d:"M7 7a3 3 0 0 0-3 3v3a2 2 0 0 0 2 2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1H6a3 3 0 0 1 3-3z"}),a.jsx("path",{d:"M17 7a3 3 0 0 0-3 3v3a2 2 0 0 0 2 2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2a3 3 0 0 1 3-3z"})]})}function Ar(e){return a.jsxs(M,{...e,children:[a.jsx("polyline",{points:"9 8 4 12 9 16"}),a.jsx("polyline",{points:"15 8 20 12 15 16"})]})}function Dr(e){return a.jsx(M,{...e,children:a.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})})}function _r(e){return a.jsxs(M,{...e,children:[a.jsx("path",{d:"M4 5h16a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H9l-4 4v-4H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z"}),a.jsx("line",{x1:"7",y1:"9",x2:"17",y2:"9"}),a.jsx("line",{x1:"7",y1:"12.5",x2:"13",y2:"12.5"})]})}function Pr(e){return a.jsxs(M,{...e,children:[a.jsx("rect",{x:"3",y:"8",width:"18",height:"8",rx:"3"}),a.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})}function $r(e){return a.jsxs(M,{...e,children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),a.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"}),a.jsx("line",{x1:"3",y1:"16",x2:"21",y2:"16"}),a.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),a.jsx("line",{x1:"15",y1:"4",x2:"15",y2:"20"})]})}function Hr(e){return a.jsxs(M,{...e,children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),a.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),a.jsx("line",{x1:"15",y1:"4",x2:"15",y2:"20"})]})}function zr(e){return a.jsxs(M,{...e,children:[a.jsx("circle",{cx:"4.5",cy:"6",r:"1.2",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"4.5",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"4.5",cy:"18",r:"1.2",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"9",y1:"6",x2:"21",y2:"6"}),a.jsx("line",{x1:"9",y1:"12",x2:"21",y2:"12"}),a.jsx("line",{x1:"9",y1:"18",x2:"21",y2:"18"})]})}function Ur(e){return a.jsxs(M,{...e,children:[a.jsx("line",{x1:"10",y1:"6",x2:"21",y2:"6"}),a.jsx("line",{x1:"10",y1:"12",x2:"21",y2:"12"}),a.jsx("line",{x1:"10",y1:"18",x2:"21",y2:"18"}),a.jsx("text",{x:"2",y:"8.5",fontSize:"7",fontWeight:"700",fill:"currentColor",stroke:"none",children:"1"}),a.jsx("text",{x:"2",y:"14.5",fontSize:"7",fontWeight:"700",fill:"currentColor",stroke:"none",children:"2"}),a.jsx("text",{x:"2",y:"20.5",fontSize:"7",fontWeight:"700",fill:"currentColor",stroke:"none",children:"3"})]})}function Lt(e){return a.jsxs(M,{...e,children:[a.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"}),a.jsx("polyline",{points:"8 12 11 15 16 9"})]})}function Fr(e){return a.jsxs(M,{...e,children:[a.jsx("rect",{x:"3",y:"5",width:"18",height:"16",rx:"2"}),a.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"}),a.jsx("line",{x1:"8",y1:"3",x2:"8",y2:"7"}),a.jsx("line",{x1:"16",y1:"3",x2:"16",y2:"7"})]})}function Kr(e){return a.jsxs(M,{...e,children:[a.jsx("path",{d:"M12 3h7a2 2 0 0 1 2 2v7a2 2 0 0 1-.59 1.41l-8 8a2 2 0 0 1-2.82 0l-7-7a2 2 0 0 1 0-2.82l8-8A2 2 0 0 1 12 3z"}),a.jsx("circle",{cx:"15.5",cy:"8.5",r:"1.2",fill:"currentColor",stroke:"none"})]})}function qr(e){return a.jsxs(M,{...e,children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),a.jsx("circle",{cx:"9",cy:"10",r:"1.5",fill:"currentColor",stroke:"none"}),a.jsx("path",{d:"M4 17l5-5 4 4 4-5 4 6"})]})}function Wr(e){return a.jsxs(M,{...e,children:[a.jsx("rect",{x:"3",y:"5",width:"14",height:"14",rx:"2"}),a.jsx("path",{d:"M17 10l4-2.5v9L17 14"})]})}function Nt(e){return a.jsxs(M,{...e,children:[a.jsx("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Mt(e){return a.jsxs(M,{...e,children:[a.jsx("path",{d:"M17.94 17.94A10.94 10.94 0 0 1 12 19c-6.5 0-10-7-10-7a18.5 18.5 0 0 1 5.06-5.94M9.9 4.24A10.94 10.94 0 0 1 12 4c6.5 0 10 7 10 7a18.5 18.5 0 0 1-2.16 3.19"}),a.jsx("path",{d:"M14.12 14.12a3 3 0 1 1-4.24-4.24"}),a.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}function Vr(e){return a.jsxs(M,{...e,children:[a.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"14"}),a.jsx("line",{x1:"8",y1:"7",x2:"8",y2:"17"}),a.jsx("line",{x1:"12",y1:"4",x2:"12",y2:"20"}),a.jsx("line",{x1:"16",y1:"7",x2:"16",y2:"17"}),a.jsx("line",{x1:"20",y1:"10",x2:"20",y2:"14"})]})}function Yr({containerRef:e,store:n}){var k;const[t,o]=f.useState(null),[r,l]=f.useState(!1),s=f.useRef(null),c=f.useRef(null),i=f.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]),u=f.useCallback(()=>{i(),s.current=setTimeout(()=>{o(x=>r?x:null)},250)},[i,r]);f.useEffect(()=>{const x=e.current;if(!x)return;const y=E=>{var B,v,C;const T=(v=(B=E.target).closest)==null?void 0:v.call(B,"[data-run-id]");if(!T||!x.contains(T))return;const S=T.dataset.runId,w=n.getRun(S);(C=w==null?void 0:w.marks)!=null&&C.link&&(i(),o(j=>(j==null?void 0:j.runId)===S?j:{runId:S,rect:T.getBoundingClientRect()}))},I=()=>u();return x.addEventListener("mouseover",y),x.addEventListener("mouseout",I),()=>{x.removeEventListener("mouseover",y),x.removeEventListener("mouseout",I)}},[e,n,i,u]),f.useEffect(()=>()=>i(),[i]);const d=f.useCallback(()=>l(!0),[]),p=f.useCallback(()=>{l(!1),o(null)},[]),b=f.useCallback((x,y)=>{if(!t)return;const I=n.getRun(t.runId);I&&(n.applyOperation(X(t.runId,{marks:{...I.marks,link:{href:x,target:y}}})),p())},[t,n,p]),m=f.useCallback(()=>{if(!t)return;const x=n.getRun(t.runId);if(!x)return;const y={...x.marks};delete y.link,n.applyOperation(X(t.runId,{marks:y})),p()},[t,n,p]),h=t&&n.getRun(t.runId),g=(k=h==null?void 0:h.marks)==null?void 0:k.link;return a.jsxs(a.Fragment,{children:[t&&g&&!r?Oe.createPortal(a.jsxs("div",{ref:c,className:"be-link-hover-card",contentEditable:!1,style:{position:"fixed",top:t.rect.bottom+6,left:t.rect.left},onMouseEnter:i,onMouseLeave:u,children:[a.jsx("a",{className:"be-link-hover-card-url",href:g.href,target:g.target==="_blank"?"_blank":"_self",rel:"noopener noreferrer",children:g.href}),a.jsx("button",{type:"button",className:"be-link-hover-card-btn",onClick:d,"aria-label":"Edit link",title:"Edit link",children:a.jsx(Ir,{size:13})}),a.jsx("button",{type:"button",className:"be-link-hover-card-btn",onClick:m,"aria-label":"Remove link",title:"Remove link",children:a.jsx(Ve,{size:13})})]}),document.body):null,a.jsx(Rt,{isOpen:r,initialHref:(g==null?void 0:g.href)??"",initialTarget:(g==null?void 0:g.target)??"_self",hasExistingLink:!!g,onSave:b,onRemove:m,onClose:p})]})}function rt(e,n){const t=e==null?void 0:e.parentElement;if(!t||!t.hasAttribute("data-placeholder"))return;n.length===0||n.every(Ct)?t.setAttribute("data-empty",""):t.removeAttribute("data-empty")}function Gr(e={}){return{fontWeight:e.bold?"bold":void 0,fontStyle:e.italic?"italic":void 0,textDecoration:[(e.underline||e.link)&&"underline",e.strike&&"line-through"].filter(Boolean).join(" ")||void 0,verticalAlign:e.subscript?"sub":e.superscript?"super":void 0,fontSize:e.subscript||e.superscript?"smaller":void 0,color:e.color||(e.link?"var(--noteloom-accent)":void 0),backgroundColor:e.highlight||void 0,cursor:e.link?"pointer":void 0}}function Xr({id:e,host:n,onValueSynced:t}){const o=xe(e);return f.useLayoutEffect(()=>{var u;if(!n||!o)return;const r=o.value??"";(fe(n.textContent)!==r||r===""&&n.textContent==="")&&(n.textContent=r===""?wt:r);const c=Gr(o.marks);n.style.fontWeight=c.fontWeight??"",n.style.fontStyle=c.fontStyle??"",n.style.textDecoration=c.textDecoration??"",n.style.verticalAlign=c.verticalAlign??"",n.style.fontSize=c.fontSize??"",n.style.color=c.color??"",n.style.backgroundColor=c.backgroundColor??"",n.style.cursor=c.cursor??"";const i=(u=o.marks)==null?void 0:u.link;n.title=i!=null&&i.href?`${i.href} — Ctrl+Click to open`:"",n.onclick=i!=null&&i.href?d=>{!d.ctrlKey&&!d.metaKey||(d.preventDefault(),window.open(i.href,i.target==="_blank"?"_blank":"_self","noopener,noreferrer"))}:null,t==null||t()},[n,o,t]),null}function lt(e,n,t,o){var p,b,m;const r=(p=window.getSelection)==null?void 0:p.call(window);if(!r||!r.isCollapsed||r.rangeCount===0)return null;const{anchorNode:l,anchorOffset:s}=r;if(!l||!e.contains(l))return null;const c=h=>{const g=n.indexOf(h);if(g===-1)return null;const k=o?n[g-1]:n[g+1];if(!k)return null;const x=t(k);return x&&x.type!=="text"?k:null};if(l===e){const h=o?s-1:s,g=e.childNodes[h],k=(g==null?void 0:g.nodeType)===1?(b=g.dataset)==null?void 0:b.runId:void 0;if(!k||n.indexOf(k)===-1)return null;const x=t(k);return x&&x.type!=="text"?k:null}const i=l.nodeType===1?l:l.parentElement,u=(m=i==null?void 0:i.closest)==null?void 0:m.call(i,"[data-run-id]");return!u||!e.contains(u)||!(o?s===0:s===(l.textContent??"").length)?null:c(u.getAttribute("data-run-id"))}function st(e,n,t){var i,u;const o=(i=window.getSelection)==null?void 0:i.call(window);if(!o||o.isCollapsed||o.rangeCount===0)return null;const r=o.getRangeAt(0);if(r.startContainer!==r.endContainer||!e.contains(r.startContainer)||r.endOffset!==r.startOffset+1)return null;const l=r.startContainer.childNodes[r.startOffset],s=(l==null?void 0:l.nodeType)===1?(u=l.dataset)==null?void 0:u.runId:void 0;if(!s||n.indexOf(s)===-1)return null;const c=t(s);return c&&c.type!=="text"?s:null}function at(e,n,t){var c;if(n===e)return{childIndex:t,charOffset:null};const o=n.nodeType===1?n:n.parentElement,r=(c=o==null?void 0:o.closest)==null?void 0:c.call(o,"[data-run-id]");if(!r||!e.contains(r))return null;const l=Array.prototype.indexOf.call(e.childNodes,r),s=n===r?t===0?0:(r.textContent??"").length:t;return{childIndex:l,charOffset:s}}function Jr(e,n,t,o){const r=at(e,o.startContainer,o.startOffset),l=at(e,o.endContainer,o.endOffset);if(!r||!l)return null;const s=Array.from(e.childNodes).filter(d=>{var p;return d.nodeType===1&&((p=d.dataset)==null?void 0:p.runId)&&n.indexOf(d.dataset.runId)!==-1});let c=!1;const i=[];let u=null;return s.forEach((d,p)=>{const b=d.dataset.runId,m=t(b);if(!m)return;const h=p<r.childIndex,g=l.charOffset===null?p>=l.childIndex:p>l.childIndex;if(h||g){i.push(m);return}const k=r.charOffset!==null&&p===r.childIndex,x=l.charOffset!==null&&p===l.childIndex;if(m.type!=="text"){c=!0,u===null&&(u=i.length);return}const y=m.value??"";if(k&&x){const I=y.slice(0,r.charOffset)+y.slice(l.charOffset);I&&i.push({...m,value:I}),u=i.length}else if(k){const I=y.slice(0,r.charOffset);I&&i.push({...m,value:I}),u===null&&(u=i.length)}else if(x){const I=y.slice(l.charOffset);I&&i.push({id:R(),type:"text",value:I,marks:m.marks})}}),c?{nextRuns:i,insertionIndex:u??i.length}:null}function Qr(e){var l;const n=(l=window.getSelection)==null?void 0:l.call(window);if(!n||!n.isCollapsed)return!1;const t=e.firstChild;if(!t)return!0;if(n.anchorNode===e)return n.anchorOffset===0;let o=t;for(;o&&o.firstChild;)o=o.firstChild;if(n.anchorNode!==o&&n.anchorNode!==t)return!1;const r=o.nodeType===3&&o.textContent===wt?1:0;return n.anchorOffset<=r}function Zr(e){var l;const n=(l=window.getSelection)==null?void 0:l.call(window);if(!n||!n.isCollapsed)return!1;const t=e.lastChild;if(!t)return!0;if(n.anchorNode===e)return n.anchorOffset>=e.childNodes.length;let o=t;for(;o&&o.lastChild;)o=o.lastChild;if(n.anchorNode!==o&&n.anchorNode!==t)return!1;const r=o.nodeType===3?(o.textContent??"").length:0;return n.anchorOffset>=r}function ct(e,n,t){const o=e.getBlock(n),r=e.getBlock(o==null?void 0:o.parentId);if(!r)return null;const l=r.contentIds.indexOf(n),s=t==="backward"?l-1:l+1;if(s<0||s>=r.contentIds.length)return null;const c=r.contentIds[s];return We(e,e.getBlock(c))?c:null}function el({id:e,blockId:n,host:t,inlineRegistry:o,onValueSynced:r}){const l=xe(e);if(!l)return null;if(l.type==="text")return a.jsx(Xr,{id:e,host:t,onValueSynced:r});const s=o==null?void 0:o.get(l.type);if(!s)return process.env.NODE_ENV!=="production"&&console.warn(`[block-editor] No inline type registered for "${l.type}" (run: ${e})`),null;const c=s.component;return a.jsx(c,{id:e,blockId:n})}function nl(e,n,t){let o=e.get(t);if(!o){o=document.createElement("span"),o.dataset.runId=t;const r=n.getRun(t);r&&r.type!=="text"&&o.setAttribute("contenteditable","false"),e.set(t,o)}return o}function me({blockId:e,runIds:n,onEnter:t,onBackspaceAtStart:o,onDeleteAtEnd:r,onArrowUp:l,onArrowDown:s,onTab:c,onShiftTab:i,onAutoformat:u}){const d=D(),p=ke(),{getSelectedBlockId:b,setSelectedBlockId:m}=he(),h=f.useRef(null),g=f.useRef(!1),k=f.useRef(new Map);f.useLayoutEffect(()=>{const v=h.current;if(!v)return;const C=new Set(n);for(const[L,N]of k.current)C.has(L)||(N.remove(),k.current.delete(L));let j=null;for(const L of n){const N=k.current.get(L);if(!N)continue;const A=j?j.nextSibling:v.firstChild;A!==N&&v.insertBefore(N,A),j=N}},[n]);const x=f.useCallback(()=>{if(g.current)return;const v=h.current;if(!v)return;const C=n.map(A=>d.getRun(A)).filter(Boolean),{runs:j,changed:L,onlyValueChanges:N}=kr(v,C);if(L){if(N){if(j.forEach((A,K)=>{A!==C[K]&&d.applyOperation(X(A.id,{value:A.value}))}),u!=null&&u(j))return}else d.applyOperation(le(e,j.length?j:[{id:R(),type:"text",value:"",marks:{}}]));rt(v,j)}},[d,e,n,u]),y=f.useCallback(()=>{rt(h.current,n.map(v=>d.getRun(v)).filter(Boolean))},[d,n]),I=f.useCallback(()=>{g.current=!0},[]),E=f.useCallback(()=>{g.current=!1,x()},[x]),T=f.useCallback(v=>{const j=n.map(L=>d.getRun(L)).filter(Boolean).filter(L=>L.id!==v);d.applyOperation(le(e,j.length?j:[{id:R(),type:"text",value:"",marks:{}}]))},[d,e,n]),S=f.useCallback(v=>{b()===v?(d.applyOperation(_(v)),m(null)):m(v)},[d,b,m]),w=f.useCallback(v=>{var re,de,V;if(g.current)return;const C=v.inputType??"",j=C.startsWith("delete"),L=C==="insertText"||C==="insertReplacementText";if(!j&&!L)return;const N=h.current;if(!N)return;const A=(re=v.getTargetRanges)==null?void 0:re.call(v),K=(de=window.getSelection)==null?void 0:de.call(window),q=(A==null?void 0:A[0])??(K!=null&&K.rangeCount?K.getRangeAt(0):null);if(!q||!N.contains(q.startContainer)||!N.contains(q.endContainer))return;const H=Jr(N,n,O=>d.getRun(O),q);if(!H)return;v.preventDefault();let{nextRuns:$,insertionIndex:W}=H,J=null,oe=!1;if(L&&v.data){const O={id:R(),type:"text",value:v.data,marks:{}};$=[...$.slice(0,W),O,...$.slice(W)],J=O.id,oe=!1}else W>0?(J=(V=$[W-1])==null?void 0:V.id,oe=!1):$.length>0&&(J=$[0].id,oe=!0);const Be=$.length?$:[{id:R(),type:"text",value:"",marks:{}}];d.applyOperation(le(e,Be));const Q=J??Be[0].id;oe?An(Q):G(Q)},[d,e,n]);f.useEffect(()=>{const v=h.current;if(v)return v.addEventListener("beforeinput",w),()=>v.removeEventListener("beforeinput",w)},[w]);const B=f.useCallback(v=>{if(!g.current){if(v.key==="Enter"&&t){v.preventDefault(),t(v);return}if(v.key==="Backspace"){const C=h.current,j=C&&st(C,n,d.getRun.bind(d));if(j){v.preventDefault(),T(j);return}const L=C&<(C,n,d.getRun.bind(d),!0);if(L){v.preventDefault(),T(L);return}if(C&&Qr(C)){if(!se(d,n)){const A=ct(d,e,"backward");if(A){v.preventDefault(),S(A);return}}v.preventDefault(),o&&o(v)}return}if(v.key==="Delete"){const C=h.current,j=C&&st(C,n,d.getRun.bind(d));if(j){v.preventDefault(),T(j);return}const L=C&<(C,n,d.getRun.bind(d),!1);if(L){v.preventDefault(),T(L);return}if(C&&Zr(C)){const N=ct(d,e,"forward");if(N){v.preventDefault(),S(N);return}r&&r(v)}return}if(v.key==="ArrowUp"&&l){v.preventDefault(),l(v);return}if(v.key==="ArrowDown"&&s){v.preventDefault(),s(v);return}v.key==="Tab"&&(v.shiftKey&&i?(v.preventDefault(),i(v)):!v.shiftKey&&c&&(v.preventDefault(),c(v)))}},[t,o,r,l,s,c,i,T,S,n,e,d]);return a.jsxs(a.Fragment,{children:[a.jsx("span",{ref:h,className:"be-editable",contentEditable:!0,suppressContentEditableWarning:!0,onInput:x,onCompositionStart:I,onCompositionEnd:E,onKeyDown:B,children:n.map(v=>{const C=nl(k.current,d,v);return Oe.createPortal(a.jsx(el,{id:v,blockId:e,host:C,inlineRegistry:p,onValueSynced:y},v),C)})}),a.jsx(Yr,{containerRef:h,store:d})]})}function tl(e,n,t){const o=e.getBlock(n),r=o&&e.getBlock(o.parentId);if(!r)return null;const l=r.contentIds.indexOf(n),s=t==="up"?l-1:l+1;return s<0||s>=r.contentIds.length?null:r.contentIds[s]}function At(e,n,t){let o=n;for(;;){const r=tl(e,o,t);if(!r)return null;const l=t==="up"?dn(e,r):$n(e,r);if(l)return l;o=r}}function ee(e,n,t){const o=At(e,n,t);o&&G(o)}function $n(e,n){var l;const t=e.getBlock(n);if(!t)return null;const o=((l=t.props)==null?void 0:l.titleRunIds)??t.contentIds;if(!o||o.length===0)return null;const r=o[0];return e.getRun(r)?r:$n(e,r)}function ne(e,n){const t=$n(e,n);t&&G(t)}function dn(e,n){var l;const t=e.getBlock(n);if(!t)return null;const o=((l=t.props)==null?void 0:l.titleRunIds)??t.contentIds;if(!o||o.length===0)return null;const r=o[o.length-1];return e.getRun(r)?r:dn(e,r)}function it(e,n){const t=dn(e,n);t&&G(t)}function ol(){var c,i;const e=(c=window.getSelection)==null?void 0:c.call(window);if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0);if(n.collapsed||n.startContainer!==n.endContainer)return null;const t=n.startContainer,o=t.nodeType===1?t:t.parentElement,r=(i=o==null?void 0:o.closest)==null?void 0:i.call(o,"[data-run-id]");if(!r)return null;const l=r.closest("[data-block-id]");if(!l)return null;const s=t.textContent??"";return{runId:r.getAttribute("data-run-id"),blockId:l.getAttribute("data-block-id"),startOffset:fe(s.slice(0,n.startOffset)).length,endOffset:fe(s.slice(0,n.endOffset)).length}}function rl(e,n){var c,i;if((e==null?void 0:e.nodeType)!==1||((c=e.getAttribute)==null?void 0:c.call(e,"contenteditable"))!=="true")return null;const t=e.childNodes;if(t.length===0)return null;const o=n>=t.length,r=t[o?t.length-1:Math.max(0,n)],l=(r==null?void 0:r.nodeType)===1?(i=r.dataset)==null?void 0:i.runId:void 0;if(!l)return null;const s=r.closest("[data-block-id]");return s?{runId:l,blockId:s.getAttribute("data-block-id"),offset:o?fe(r.textContent??"").length:0}:null}function He(e,n){var c;const t=rl(e,n);if(t)return t;let o=(e==null?void 0:e.nodeType)===1?e:e==null?void 0:e.parentElement;const r=(c=o==null?void 0:o.closest)==null?void 0:c.call(o,"[data-run-id]");if(!r)return null;const l=r.closest("[data-block-id]");if(!l)return null;let s=fe((e.textContent??"").slice(0,n)).length;if(e===r){s=0;for(let i=0;i<n&&i<r.childNodes.length;i+=1)s+=fe(r.childNodes[i].textContent??"").length}return{runId:r.getAttribute("data-run-id"),blockId:l.getAttribute("data-block-id"),offset:s}}function Ye(){var n;const e=(n=window.getSelection)==null?void 0:n.call(window);return!e||e.rangeCount===0||!e.isCollapsed?null:He(e.anchorNode,e.anchorOffset)}function Ge(){var o;const e=(o=window.getSelection)==null?void 0:o.call(window);if(!e||e.rangeCount===0||e.isCollapsed)return null;const n=He(e.anchorNode,e.anchorOffset),t=He(e.focusNode,e.focusOffset);return!n||!t||n.blockId!==t.blockId?null:{blockId:n.blockId,startRunId:n.runId,startOffset:n.offset,endRunId:t.runId,endOffset:t.offset}}function ze(e){var p;const n=(p=window.getSelection)==null?void 0:p.call(window);if(!n||n.rangeCount===0||n.isCollapsed)return null;const t=He(n.anchorNode,n.anchorOffset),o=He(n.focusNode,n.focusOffset);if(!t||!o||t.blockId===o.blockId)return null;const r=e.getBlock(t.blockId),l=r&&e.getBlock(r.parentId);if(!l)return null;const s=l.contentIds,c=s.indexOf(t.blockId),i=s.indexOf(o.blockId);if(c===-1||i===-1)return null;const[u,d]=c<=i?[c,i]:[i,c];return{blockIds:s.slice(u,d+1),startBlockId:t.blockId,startRunId:t.runId,startOffset:t.offset,endBlockId:o.blockId,endRunId:o.runId,endOffset:o.offset}}function Hn(e,n,t){const r=e.getBlock(n).parentId,s=e.getBlock(r).contentIds.indexOf(n)+1,{block:c,runs:i=[],subtreeBlocks:u=[]}=t(r);return e.applyOperation(Y(c,r,s,{blocks:[c,...u],runs:i})),c.id}function ye(e,n,t){const o=Hn(e,n,t);return ne(e,o),o}function ll(e,n,t){const{block:o,runs:r=[],subtreeBlocks:l=[]}=t(n);return e.applyOperation(Y(o,n,0,{blocks:[o,...l],runs:r})),ne(e,o.id),o.id}function Dt(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function sl(e,n,t){const o=e.findIndex(u=>u.id===n);if(o===-1)return null;const r=e[o],l=e.slice(0,o),s=e.slice(o+1);if(r.type==="text"){const u=r.value??"",d=u.slice(0,t),p=u.slice(t);d&&p?(l.push({...r,value:d}),s.unshift({...r,id:R(),value:p})):p?s.unshift(r):l.push(r)}else t>0?l.push(r):s.unshift(r);const c=l.length?l:[{id:R(),type:"text",value:"",marks:{}}],i=s.length?s:[{id:R(),type:"text",value:"",marks:{}}];return{leftRuns:c,rightRuns:i}}function Le(e,n,t,o){const r=e.getBlock(n),l=e.getBlock(r.parentId),s=l.contentIds.indexOf(n)+1;return Pt(e,n,t,o,{insertParentId:l.id,insertIndex:s,fallback:()=>ye(e,n,o)})}function _t(e,n,t,o){return Pt(e,n,t,o,{insertParentId:n,insertIndex:0,fallback:()=>ll(e,n,o)})}function Pt(e,n,t,o,{insertParentId:r,insertIndex:l,fallback:s}){const c=Ye();if(!c||c.blockId!==n)return s();const i=t.map(k=>e.getRun(k)).filter(Boolean),u=sl(i,c.runId,c.offset);if(!u)return s();const{leftRuns:d,rightRuns:p}=u,{block:b,runs:m=p,subtreeBlocks:h=[]}=o(r,p),g=d.length?d:[{id:R(),type:"text",value:"",marks:{}}];return Dt(e,[le(n,g),Y(b,r,l,{blocks:[b,...h],runs:m})]),ne(e,b.id),b.id}function al(e){var n;return((n=e==null?void 0:e.props)==null?void 0:n.titleRunIds)??(e==null?void 0:e.contentIds)??[]}function cl(e){var n,t;return!!((n=e==null?void 0:e.props)!=null&&n.titleRunIds)&&(((t=e.contentIds)==null?void 0:t.length)??0)>0}function il(e,n,t){const r=e.getBlock(n).parentId,s=e.getBlock(r).contentIds.indexOf(n),{block:c,runs:i=[],subtreeBlocks:u=[]}=t(r);return Dt(e,[_(n),Y(c,r,s,{blocks:[c,...u],runs:i})]),ne(e,c.id),c.id}function Z(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r},l){const s=e.getRun(t),c=(s==null?void 0:s.value)??"",i=c.slice(0,o)+c.slice(r),u=e.getBlock(n),d=al(u);return d.length===1&&d[0]===t&&i===""&&!cl(u)?il(e,n,l):(e.applyOperation(X(t,{value:i})),ye(e,n,l))}function P(e,n={}){return function(o,r){const l=R(),s=r!=null&&r.length?r:[{id:R(),type:"text",value:"",marks:{}}];return{block:{id:l,type:e,parentId:o,contentIds:s.map(c=>c.id),props:n},runs:s}}}function Ne(e){const n=e.getRootId(),t=e.getBlock(n);if(!t||t.contentIds.length>0)return null;const{block:o,runs:r}=P("paragraph")(n);return e.applyOperation(Y(o,n,0,{blocks:[o],runs:r})),o.id}const ul=new Set(["callout"]),ut=new Set(["paragraph","heading","blockquote"]);function $t(e,n){return e===n||ut.has(e)&&ut.has(n)}function Xe(e,n){const t=e.getBlock(n);if(!t)return null;const o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=t.contentIds.length===0||t.contentIds.length===1&&dl(e,t.contentIds[0]);if(r<=0){if(!l)return null;if(o.contentIds.length>1)return Re(e,[_(n)]),e.getBlock(o.id).contentIds[0];if(ul.has(o.type))return pl(e,o);if(t.type==="paragraph")return null;const{block:u,runs:d}=P("paragraph")(o.id);return Re(e,[Y(u,o.id,r,{blocks:[u],runs:d}),_(n)]),u.id}const s=o.contentIds[r-1],c=e.getBlock(s);if(l)return Re(e,[_(n)]),s;if(We(e,c))return Re(e,[_(s)]),n;if(!c||!$t(c.type,t.type))return null;const i=[...c.contentIds,...t.contentIds];return Re(e,[Te(s,i),Te(n,[]),_(n)]),s}function dl(e,n){const t=e.getRun(n);return!t||(t.value??"")===""}function pl(e,n){const t=e.getBlock(n.parentId);if(!t)return null;const o=t.contentIds.indexOf(n.id),r=o>0?t.contentIds[o-1]:null,l=o!==-1&&o<t.contentIds.length-1?t.contentIds[o+1]:null;Re(e,[_(n.id)]);const s=Ne(e);return r??l??s}function Re(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Me(e,n,t,o){if(!n||n===t)return;const r=dn(e,n);if(r){G(r);return}o(n),requestAnimationFrame(()=>{var l;(l=document.querySelector(`[data-block-id="${n}"]`))==null||l.focus()})}function fl(e,n,t,o,r){const l=e.getBlock(n),c=e.getBlock(l.parentId).contentIds.indexOf(n),i="titleRunIds"in o,u="titleRunIds"in(l.props??{}),d={id:R(),type:t,parentId:l.parentId,contentIds:[],props:o},p=i?z(d.id,{titleRunIds:r}):Te(d.id,r),b=u?z(n,{titleRunIds:[]}):Te(n,[]);return{newBlockId:d.id,ops:[Y(d,l.parentId,c,{blocks:[d],runs:[]}),p,b,_(n)]}}function bl(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}const hl=[{re:/^(#{1,3})[ ]$/,type:"heading",props:e=>({level:e[1].length})},{re:/^[-*][ ]$/,type:"listItem",props:()=>({ordered:!1,titleRunIds:[]})},{re:/^\d+\.[ ]$/,type:"listItem",props:()=>({ordered:!0,titleRunIds:[]})},{re:/^\[\][ ]$/,type:"listItem",props:()=>({ordered:!1,checked:!1,titleRunIds:[]})},{re:/^>[ ]$/,type:"blockquote",props:()=>({})},{re:/^```$/,type:"code",props:()=>({language:"plaintext"})}];function ml(e,n,t){if(t.length!==1||t[0].type!=="text")return!1;const o=t[0].value??"";for(const r of hl){const l=r.re.exec(o);if(!l)continue;const s=o.slice(l[0].length),{ops:c}=fl(e,n,r.type,r.props(l),[t[0].id]);return bl(e,[X(t[0].id,{value:s}),...c]),An(t[0].id),!0}return!1}const gl=new Set(["callout","toggleHeading"]);function kl({id:e}){const n=D(),t=te(e),{setSelectedBlockId:o}=he(),r=f.useCallback(()=>{const d=n.getBlock(t==null?void 0:t.parentId),p=se(n,(t==null?void 0:t.contentIds)??[]),b=!!d&&d.contentIds[d.contentIds.length-1]===e;if(p&&b&&gl.has(d==null?void 0:d.type)){ye(n,d.id,P("paragraph"));return}Le(n,e,(t==null?void 0:t.contentIds)??[],P("paragraph"))},[n,e,t]),l=f.useCallback(()=>{var h,g;const d=n.getBlock(t==null?void 0:t.parentId),p=se(n,(t==null?void 0:t.contentIds)??[]),b=((h=d==null?void 0:d.contentIds)==null?void 0:h.length)===1&&d.contentIds[0]===e;if(p&&b&&(d==null?void 0:d.type)==="toggleHeading"){const k=((g=d.props)==null?void 0:g.titleRunIds)??[],x=k[k.length-1];x&&G(x);return}const m=Xe(n,e);Me(n,m,e,o)},[n,e,t,o]),s=f.useCallback(()=>ee(n,e,"up"),[n,e]),c=f.useCallback(()=>ee(n,e,"down"),[n,e]),i=f.useCallback(d=>ml(n,e,d),[n,e]);if(!t)return null;const u=se(n,t.contentIds);return a.jsx("div",{className:"be-paragraph","data-block-id":e,"data-empty":u?"":void 0,"data-placeholder":"Type '/' for commands",children:a.jsx(me,{blockId:e,runIds:t.contentIds,onEnter:r,onBackspaceAtStart:l,onArrowUp:s,onArrowDown:c,onAutoformat:i})})}function je(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ae(e){return je(e).replace(/"/g,""")}function ve(e,n){var r,l;if(!e)return"";if(e.type!=="text"){const s=(r=n==null?void 0:n.inlineRegistry)==null?void 0:r.get(e.type);return s?s.toHTML(e,n):je(e.value??"")}const t=e.marks??{};let o=je(e.value??"");if(t.code&&(o=`<code>${o}</code>`),t.bold&&(o=`<strong>${o}</strong>`),t.italic&&(o=`<em>${o}</em>`),t.underline&&(o=`<u>${o}</u>`),t.strike&&(o=`<s>${o}</s>`),t.subscript&&(o=`<sub>${o}</sub>`),t.superscript&&(o=`<sup>${o}</sup>`),t.color&&(o=`<span style="color:${ae(t.color)}">${o}</span>`),t.highlight&&(o=`<span style="background-color:${ae(t.highlight)}">${o}</span>`),(l=t.link)!=null&&l.href){const s=t.link.target==="_blank"?' target="_blank" rel="noopener noreferrer"':"";o=`<a href="${ae(t.link.href)}"${s}>${o}</a>`}return o}function Ie(e,n){var t;if(!e)return"";if(e.type!=="text"){const o=(t=n==null?void 0:n.inlineRegistry)==null?void 0:t.get(e.type);return o?o.toPlainText(e,n):e.value??""}return e.value??""}const xl={STRONG:"bold",B:"bold",EM:"italic",I:"italic",U:"underline",S:"strike",STRIKE:"strike",DEL:"strike",CODE:"code",SUB:"subscript",SUP:"superscript"};function ue(e,n,t={}){const o=[],r=(l,s)=>{var u,d;if(l.nodeType===3){const p=l.textContent;p&&o.push({id:R(),type:"text",value:p,marks:{...s}});return}if(l.nodeType!==1)return;if(n!=null&&n.inlineRegistry)for(const p of n.inlineRegistry.listHtmlMatchers()){const b=p.fromHTML(l,n);if(b){o.push(b);return}}let c=s;const i=xl[l.tagName];i&&(c={...c,[i]:!0}),l.tagName==="A"&&l.getAttribute("href")&&(c={...c,link:{href:l.getAttribute("href"),target:l.getAttribute("target")==="_blank"?"_blank":"_self"}}),(u=l.style)!=null&&u.color&&(c={...c,color:l.style.color}),(d=l.style)!=null&&d.backgroundColor&&(c={...c,highlight:l.style.backgroundColor});for(const p of l.childNodes)r(p,c)};return r(e,t),o.length?o:[{id:R(),type:"text",value:"",marks:{}}]}function yl(e,n){return`<p>${e.contentIds.map(o=>n.store.getRun(o)).map(o=>ve(o,n)).join("")}</p>`}function vl(e,n){return e.contentIds.map(t=>Ie(n.store.getRun(t),n)).join("")}function Il(e,n){if(e.tagName!=="P")return null;const t=ue(e,n);return{block:{id:R(),type:"paragraph",parentId:null,contentIds:t.map(r=>r.id),props:{}},runs:t}}const Ht={component:kl,isLeaf:!0,defaultProps:{},toHTML:yl,toPlainText:vl,fromHTML:Il,slashCommand:{label:"Text",icon:Er,keywords:["paragraph","text","p"],run:(e,n)=>Z(e,n,P("paragraph"))}};function wl({id:e}){var p;const n=D(),t=te(e),{setSelectedBlockId:o}=he(),r=f.useCallback(()=>{Le(n,e,(t==null?void 0:t.contentIds)??[],P("paragraph"))},[n,e,t]),l=f.useCallback(()=>{const b=Xe(n,e);Me(n,b,e,o)},[n,e,o]),s=f.useCallback(()=>ee(n,e,"up"),[n,e]),c=f.useCallback(()=>ee(n,e,"down"),[n,e]);if(!t)return null;const i=((p=t.props)==null?void 0:p.level)??3,u=`h${i}`,d=se(n,t.contentIds);return a.jsx(u,{className:"be-heading","data-block-id":e,"data-empty":d?"":void 0,"data-placeholder":`Heading ${i}`,children:a.jsx(me,{blockId:e,runIds:t.contentIds,onEnter:r,onBackspaceAtStart:l,onArrowUp:s,onArrowDown:c})})}const kn={1:Or,2:Lr,3:Nr},Cl={H1:1,H2:2,H3:3};function Bl(e,n){var r;const t=((r=e.props)==null?void 0:r.level)??3,o=e.contentIds.map(l=>n.store.getRun(l));return`<h${t}>${o.map(l=>ve(l,n)).join("")}</h${t}>`}function Rl(e,n){return e.contentIds.map(t=>Ie(n.store.getRun(t),n)).join("")}function Tl(e,n){const t=Cl[e.tagName];if(!t)return null;const o=ue(e,n);return{block:{id:R(),type:"heading",parentId:null,contentIds:o.map(l=>l.id),props:{level:t}},runs:o}}const zt={component:wl,isLeaf:!0,defaultProps:{level:3},toHTML:Bl,toPlainText:Rl,fromHTML:Tl,slashCommands:[{label:"Heading 1",icon:kn[1],keywords:["heading","h1","title"],run:(e,n)=>Z(e,n,P("heading",{level:1}))},{label:"Heading 2",icon:kn[2],keywords:["heading","h2","subtitle"],run:(e,n)=>Z(e,n,P("heading",{level:2}))},{label:"Heading 3",icon:kn[3],keywords:["heading","h3","title"],run:(e,n)=>Z(e,n,P("heading",{level:3}))}]},jl=[];function zn(e){const n=D(),t=f.useCallback(r=>n.subscribe(e,r),[n,e]),o=f.useCallback(()=>{const r=n.getBlock(e);return r?r.contentIds:jl},[n,e]);return f.useSyncExternalStore(t,o)}class Ut extends f.Component{constructor(){super(...arguments);nt(this,"state",{hasError:!1,nonce:0})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,o){var r,l;process.env.NODE_ENV!=="production"&&console.error("[block-editor] a block failed to render; recovering by remounting it:",t,o),(l=(r=this.props).onError)==null||l.call(r,t,o),queueMicrotask(()=>this.setState(s=>({hasError:!1,nonce:s.nonce+1})))}render(){return this.state.hasError?null:a.jsx(f.Fragment,{children:this.props.children},this.state.nonce)}}const Un=f.memo(function({id:n}){const t=te(n),o=Ke();if(!t)return null;const r=o.get(t.type);if(!r)return process.env.NODE_ENV!=="production"&&console.warn(`[block-editor] No block type registered for "${t.type}" (id: ${n})`),null;const l=r.component;return a.jsx(Ut,{children:a.jsx(l,{id:n})})});function pn(e,n,t){f.useEffect(()=>{if(!n)return;const o=Array.isArray(e)?e:[e],r=s=>{o.some(i=>i.current&&i.current.contains(s.target))||t()},l=s=>{s.key==="Escape"&&t()};return document.addEventListener("mousedown",r),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",l)}},[n,t,e])}function Fn(e,n,t,o){const r={store:e,registry:n,inlineRegistry:o};return{html:Sl(e,n,t,r),text:t.map(l=>{const s=e.getBlock(l);return n.get(s.type).toPlainText(s,r)}).join(`
|
|
1814
|
+
`),json:JSON.stringify({version:1,blocks:t.map(l=>Ft(e,l))})}}function Sl(e,n,t,o){let r="",l=0;for(;l<t.length;){const s=e.getBlock(t[l]);if(s.type==="listItem"){const c=!!s.props.ordered;let i="",u=l;for(;u<t.length;){const p=e.getBlock(t[u]);if(p.type!=="listItem"||!!p.props.ordered!==c)break;i+=n.get("listItem").toHTML(p,o),u+=1}const d=c?"ol":"ul";r+=`<${d}>${i}</${d}>`,l=u}else if(s.type==="blockquote"){let c="",i=l;for(;i<t.length;){const u=e.getBlock(t[i]);if(u.type!=="blockquote")break;c+=n.get("blockquote").toHTML(u,o),i+=1}r+=`<blockquote>${c}</blockquote>`,l=i}else r+=n.get(s.type).toHTML(s,o),l+=1}return r}function Ft(e,n){const t=[],o=[],r=l=>{var i;const s=e.getRun(l);if(s){o.push(s);return}const c=e.getBlock(l);if(c){t.push(c);for(const u of c.contentIds)r(u);for(const u of((i=c.props)==null?void 0:i.titleRunIds)??[])r(u)}};return r(n),{rootId:n,blocks:t,runs:o}}function Kn({rootId:e,blocks:n,runs:t}){const o=new Map;for(const i of n)o.set(i.id,R());for(const i of t)o.set(i.id,R());const r=i=>o.get(i)??i,l=n.map(i=>{var u;return{...i,id:r(i.id),parentId:i.parentId?r(i.parentId):i.parentId,contentIds:i.contentIds.map(r),props:{...i.props,...(u=i.props)!=null&&u.titleRunIds?{titleRunIds:i.props.titleRunIds.map(r)}:{}}}}),s=t.map(i=>({...i,id:r(i.id)})),c=r(e);return{block:l.find(i=>i.id===c),runs:s,subtreeBlocks:l.filter(i=>i.id!==c)}}function Kt(e,n){const t=e.getBlock(n);if(!t)return null;const o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=Ft(e,n),{block:s,runs:c,subtreeBlocks:i}=Kn(l);return e.applyOperation(Y(s,o.id,r+1,{blocks:[s,...i],runs:c})),ne(e,s.id),s.id}function qt(e,n){const t=e.getBlock(n),o=t&&e.getBlock(t.parentId);if(!o)return!1;const r=o.contentIds.indexOf(n);return r<=0?!1:(e.applyOperation(ge(n,o.id,r-1)),!0)}function Wt(e,n){const t=e.getBlock(n),o=t&&e.getBlock(t.parentId);if(!o)return!1;const r=o.contentIds.indexOf(n);return r===-1||r>=o.contentIds.length-1?!1:(e.applyOperation(ge(n,o.id,r+1)),!0)}function qn(e,n){const t=e.getBlock(n);if(!t)return null;const o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=r>0?o.contentIds[r-1]:null,s=r!==-1&&r<o.contentIds.length-1?o.contentIds[r+1]:null;e.applyOperation(_(n));const c=Ne(e),i=l??s??c;return i&&ne(e,i),i??null}function Vt({id:e}){var T;const n=D(),t=te(e),[o,r]=f.useState(!1),[l,s]=f.useState(null),c=f.useRef(null),i=f.useRef(null),u=f.useMemo(()=>[c,i],[]),[d]=qe(),p=d.includes(e),b=f.useCallback(()=>r(!1),[]);pn(u,o,b);const m=f.useCallback(()=>{var S;s(((S=c.current)==null?void 0:S.getBoundingClientRect())??null),r(!0)},[]),h=f.useCallback(()=>{ye(n,e,P("paragraph"))},[n,e]),g=f.useCallback(()=>{Kt(n,e),b()},[n,e,b]),k=f.useCallback(()=>{qt(n,e),b()},[n,e,b]),x=f.useCallback(()=>{Wt(n,e),b()},[n,e,b]),y=f.useCallback(()=>{qn(n,e),b()},[n,e,b]),I=!!((T=t==null?void 0:t.props)!=null&&T.hidden),E=f.useCallback(()=>{n.applyOperation(z(e,{hidden:!I})),b()},[n,e,I,b]);return t?a.jsxs("div",{className:`be-block-row${I?" be-block-row-hidden":""}${p?" be-block-row-range-selected":""}`,"data-block-row-id":e,children:[a.jsxs("div",{className:`be-block-gutter${o?" be-block-gutter-active":""}`,contentEditable:!1,children:[a.jsx("button",{type:"button",className:"be-block-gutter-btn",onClick:h,"aria-label":"Add block below",children:a.jsx(jt,{size:16})}),a.jsx("button",{ref:c,type:"button",className:"be-block-gutter-btn","aria-label":"More options","aria-haspopup":"menu","aria-expanded":o,onClick:()=>o?b():m(),children:a.jsx(jr,{size:16})})]}),a.jsx("div",{className:"be-block-row-content",children:a.jsx(Un,{id:e})}),o&&l&&Oe.createPortal(a.jsxs("div",{ref:i,role:"menu","aria-label":"Block options",className:"be-block-gutter-menu",style:{position:"fixed",top:l.bottom+4,left:l.left},children:[a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:g,children:[a.jsx(St,{size:15})," Duplicate"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:k,children:[a.jsx(Et,{size:15})," Move up"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:x,children:[a.jsx(Ot,{size:15})," Move down"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:E,children:[I?a.jsx(Nt,{size:15}):a.jsx(Mt,{size:15}),I?"Show in preview":"Hide in preview"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item be-block-gutter-menu-item-danger",onClick:y,children:[a.jsx(_n,{size:15})," Delete"]})]}),document.body)]}):null}function we({parentId:e,isTopLevel:n=!1}){const t=zn(e),o=D(),[r]=Nn(),l=r?t.filter(s=>{var c,i;return!((i=(c=o.getBlock(s))==null?void 0:c.props)!=null&&i.hidden)}):t;return n&&!r?l.map(s=>a.jsx(Vt,{id:s},s)):l.map(s=>a.jsx(Un,{id:s},s))}const El=97,Ol=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];function Ll(e){let n="";for(;e>0;)e-=1,n=String.fromCharCode(El+e%26)+n,e=Math.floor(e/26);return n}function Nl(e){let n="",t=e;for(const[o,r]of Ol)for(;t>=o;)n+=r,t-=o;return n}function Ml(e){var n,t;return(e==null?void 0:e.type)==="listItem"&&((n=e.props)==null?void 0:n.checked)===void 0&&((t=e.props)==null?void 0:t.collapsed)===void 0}function dt(e,n){let t=0,o=n;for(;o;){const r=e.getBlock(o.parentId);if(!r||r.type!=="listItem")break;t+=1,o=r}return t}function Al(e,n,t){const o=t.indexOf(n.id);let r=1;for(let l=o-1;l>=0;l-=1){const s=e.getBlock(t[l]);if(!Ml(s)||!s.props.ordered)break;r+=1}return r}function Dl(e,n){const t=(e%3+3)%3;return t===0?`${n}.`:t===1?`${Ll(n)}.`:`${Nl(n)}.`}const _l=["•","◦","▪"];function Pl(e){const n=(e%3+3)%3;return _l[n]}function Pe({ordered:e=!1,checked:n,collapsed:t}={}){return function(r,l){const s=R(),c=l!=null&&l.length?l:[{id:R(),type:"text",value:"",marks:{}}],i={ordered:e,titleRunIds:c.map(b=>b.id)};n!==void 0&&(i.checked=n);let u=[],d=[],p=c;if(t!==void 0){i.collapsed=t;const{block:b,runs:m}=P("paragraph")(s);u=[b.id],d=[b],p=[...c,...m]}return{block:{id:s,type:"listItem",parentId:r,contentIds:u,props:i},runs:p,subtreeBlocks:d}}}function $l(e,n){const t=e.getBlock(n),o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=r>0?o.contentIds[r-1]:null,s=l?e.getBlock(l):null;if(!s||s.type!=="listItem"){ee(e,n,"down");return}e.applyOperation(ge(n,l,s.contentIds.length)),ne(e,n)}function vn(e,n){const t=e.getBlock(n),o=e.getBlock(t.parentId);if(!o||o.type!=="listItem")return;const r=o.parentId,s=e.getBlock(r).contentIds.indexOf(o.id);e.applyOperation(ge(n,r,s+1)),ne(e,n)}function De(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Yt(e,n){var t;return n.length===0||n.length===1&&(((t=e.getRun(n[0]))==null?void 0:t.value)??"")===""}function Hl(e,n){const t=n.contentIds??[];if(t.length===0)return!0;if(t.length>1)return!1;const o=e.getBlock(t[0]);return!!o&&o.type==="paragraph"&&se(e,o.contentIds)}function zl(e,n){const t=e.getBlock(n);if(!t)return null;const o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=t.props.titleRunIds??[],c=Yt(e,l)&&Hl(e,t);if(r>0){const d=o.contentIds[r-1],p=e.getBlock(d);if(c)return De(e,[_(n)]),{focusBlockId:d,needsRefocus:!0};if(We(e,p))return De(e,[_(d)]),{focusBlockId:n,needsRefocus:!1};if((p==null?void 0:p.type)==="listItem"&&t.contentIds.length===0){const b=[...p.props.titleRunIds??[],...l];return De(e,[z(d,{titleRunIds:b}),z(n,{titleRunIds:[]}),_(n)]),{focusBlockId:d,needsRefocus:!0}}return null}if(o.type==="listItem")return vn(e,n),{focusBlockId:n,needsRefocus:!0};if(!c)return null;if(o.contentIds.length>1)return De(e,[_(n)]),{focusBlockId:e.getBlock(o.id).contentIds[0],needsRefocus:!0};const{block:i,runs:u}=P("paragraph")(o.id);return De(e,[Y(i,o.id,r,{blocks:[i],runs:u}),_(n)]),{focusBlockId:i.id,needsRefocus:!0}}function Ul(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Fl(e,n){const o=e.getBlock(n).parentId,l=e.getBlock(o).contentIds.indexOf(n),{block:s,runs:c}=P("paragraph")(o);return Ul(e,[Y(s,o,l,{blocks:[s],runs:c}),z(n,{titleRunIds:[]}),_(n)]),ne(e,s.id),s.id}function Kl(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function ql({id:e}){var T,S;const n=D(),t=te(e),{setSelectedBlockId:o}=he(),r=zn(t==null?void 0:t.parentId),l=f.useCallback(()=>{var A,K,q,H,$;const w=((A=t==null?void 0:t.props)==null?void 0:A.titleRunIds)??[],B=n.getBlock(t==null?void 0:t.parentId),v=Yt(n,w);if(v&&(B==null?void 0:B.type)==="listItem"){vn(n,e);return}const C=(((K=t==null?void 0:t.contentIds)==null?void 0:K.length)??0)>0;if(v&&(B==null?void 0:B.type)!=="listItem"&&!C){Fl(n,e);return}const j=((q=t==null?void 0:t.props)==null?void 0:q.checked)!==void 0,L=((H=t==null?void 0:t.props)==null?void 0:H.collapsed)!==void 0,N=Pe({ordered:($=t==null?void 0:t.props)==null?void 0:$.ordered,checked:j?!1:void 0,collapsed:L?!1:void 0});C&&!L?_t(n,e,w,N):Le(n,e,w,N)},[n,e,t]),s=f.useCallback(()=>$l(n,e),[n,e]),c=f.useCallback(()=>vn(n,e),[n,e]),i=f.useCallback(()=>{const w=zl(n,e);!w||!w.needsRefocus||Me(n,w.focusBlockId,e,o)},[n,e,o]),u=f.useCallback(()=>ee(n,e,"up"),[n,e]),d=f.useCallback(()=>ee(n,e,"down"),[n,e]),p=f.useCallback(()=>{var w;n.applyOperation(z(e,{checked:!((w=t==null?void 0:t.props)!=null&&w.checked)}))},[n,e,(T=t==null?void 0:t.props)==null?void 0:T.checked]),b=f.useCallback(()=>{var B,v;if(!((((B=t==null?void 0:t.contentIds)==null?void 0:B.length)??0)>0)){const{block:C,runs:j}=P("paragraph")(e);Kl(n,[Y(C,e,0,{blocks:[C],runs:j}),z(e,{collapsed:!1})]),G(C.contentIds[0]);return}n.applyOperation(z(e,{collapsed:!((v=t==null?void 0:t.props)!=null&&v.collapsed)}))},[n,e,t==null?void 0:t.contentIds,(S=t==null?void 0:t.props)==null?void 0:S.collapsed]);if(!t)return null;const{ordered:m,checked:h,collapsed:g,titleRunIds:k=[]}=t.props,x=h!==void 0,y=!x&&g!==void 0,I=t.contentIds.length>0,E=k.map(w=>n.getRun(w)).filter(w=>(w==null?void 0:w.type)==="text").map(w=>w.value).join("").trim();return a.jsxs("div",{className:"be-list-item","data-block-id":e,children:[a.jsxs("div",{className:"be-list-item-row",children:[x?a.jsx("input",{type:"checkbox",className:"be-list-checkbox",checked:!!h,onChange:p,"aria-label":E||"To-do item"}):y?a.jsx("button",{type:"button",className:"be-list-toggle-marker",onClick:b,"aria-expanded":!g,"aria-label":I?g?"Expand toggle":"Collapse toggle":"Add content to toggle",children:g?a.jsx(un,{}):a.jsx(Dn,{})}):a.jsx("span",{className:"be-list-marker","aria-hidden":"true",children:m?Dl(dt(n,t),Al(n,t,r)):Pl(dt(n,t))}),a.jsx("div",{className:"be-list-item-title","data-empty":se(n,k)?"":void 0,"data-placeholder":x?"To-do":y?"Toggle":"List item",style:h?{textDecoration:"line-through",opacity:.6}:void 0,children:a.jsx(me,{blockId:e,runIds:k,onEnter:l,onTab:s,onShiftTab:c,onBackspaceAtStart:i,onArrowUp:u,onArrowDown:d})})]}),(!y||!g)&&a.jsx("div",{className:"be-list-item-children",children:a.jsx(we,{parentId:e})})]})}function Wl(e,n){const{titleRunIds:t=[],ordered:o}=e.props,r=t.map(c=>ve(n.store.getRun(c),n)).join(""),l=e.contentIds.map(c=>n.registry.get(n.store.getBlock(c).type).toHTML(n.store.getBlock(c),n)).join(""),s=l?`<${o?"ol":"ul"}>${l}</${o?"ol":"ul"}>`:"";return`<li>${r}${s}</li>`}function Vl(e,n){const{titleRunIds:t=[]}=e.props;return t.map(o=>Ie(n.store.getRun(o),n)).join("")}function Gt(e,n){const t=[],o=[];for(const p of e.childNodes)p.nodeType===1&&(p.tagName==="UL"||p.tagName==="OL")?o.push(p):t.push(p);const r=e.ownerDocument.createElement("span");for(const p of t)r.appendChild(p.cloneNode(!0));const l=ue(r,n),s=R(),c=[...l],i=[],u=[];for(const p of o){const b=p.tagName==="OL";for(const m of p.children){if(m.tagName!=="LI")continue;const h=Gt(m,n);h.block.parentId=s,h.block.props.ordered=b,i.push(h.block,...h.childBlocks),c.push(...h.runs),u.push(h.block.id)}}return{block:{id:s,type:"listItem",parentId:null,contentIds:u,props:{ordered:!1,titleRunIds:l.map(p=>p.id)}},runs:c,childBlocks:i}}function Yl(e,n){if(e.tagName!=="LI")return null;const{block:t,runs:o,childBlocks:r}=Gt(e,n);return{block:t,runs:o,subtreeBlocks:r}}const Xt={component:ql,isLeaf:!1,defaultProps:{ordered:!1,titleRunIds:[]},toHTML:Wl,toPlainText:Vl,fromHTML:Yl,slashCommands:[{label:"Bulleted list",icon:zr,keywords:["list","bullet","ul"],run:(e,n)=>Z(e,n,Pe({ordered:!1}))},{label:"Numbered list",icon:Ur,keywords:["list","number","ordered","ol"],run:(e,n)=>Z(e,n,Pe({ordered:!0}))},{label:"To-do list",icon:Lt,keywords:["todo","checkbox","task","checklist"],run:(e,n)=>Z(e,n,Pe({ordered:!1,checked:!1}))},{label:"Toggle list",icon:un,keywords:["toggle","collapse","expand","dropdown","accordion"],run:(e,n)=>Z(e,n,Pe({ordered:!1,collapsed:!1}))}]},Jt=["text","date","checkbox","select"],fn="text",bn=160,rn=80;function Gl(e){return`Column ${e+1}`}function Wn(e){return Array.from({length:e},(n,t)=>({id:R(),label:Gl(t),type:fn,width:bn}))}function ce(e,n){var o;const t=(o=e.props)==null?void 0:o.columns;return!Array.isArray(t)||t.length!==n?Wn(n):t.map(r=>{const l=r.type??fn,s=r.width??bn;return l===r.type&&s===r.width?r:{...r,type:l,width:s}})}function Qt(e){switch(e){case"date":return{id:R(),type:"date",value:"",marks:{},data:{isoDate:""}};case"checkbox":return{id:R(),type:"checkbox",value:"",marks:{},data:{checked:!1,label:""}};case"select":return{id:R(),type:"tableSelect",value:"",marks:{},data:{selectedValue:"",selectedLabel:""}};default:return{id:R(),type:"text",value:"",marks:{}}}}function hn(e,n){const t=Qt(n==null?void 0:n.type);return{block:{id:R(),type:"tableCell",parentId:e,contentIds:[t.id],props:{}},run:t}}function Zt(e,n,t){if(e.type===n)return e;let o;if(e.type==="text")o=e.value??"";else{const r=t==null?void 0:t.get(e.type);o=r!=null&&r.toPlainText?r.toPlainText(e):""}if(n==="date"){const r=o?new Date(o):null,l=r&&!Number.isNaN(r.getTime())?r.toISOString().slice(0,10):"";return{id:R(),type:"date",value:"",marks:{},data:{isoDate:l}}}return n==="checkbox"?{id:R(),type:"checkbox",value:"",marks:{},data:{checked:!1,label:o}}:{id:R(),type:"text",value:o,marks:{}}}function Ce(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function eo(e,n){const o=e.getBlock(n.parentId).contentIds.indexOf(n.id);Ce(e,[_(n.id)]);const r=Ne(e);if(r)return ne(e,r),null;const l=e.getBlock(n.parentId),s=l.contentIds[o]??l.contentIds[o-1];return s&&ne(e,s),null}function no(e,n){const t=e.getBlock(n),o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=ce(o,t.contentIds.length),s=R(),c=[],i=[],u=[];for(const p of l){const b=hn(s,p);c.push(b.block),i.push(b.run),u.push(b.block.id)}const d={id:s,type:"tableRow",parentId:o.id,contentIds:u,props:{}};return e.applyOperation(Y(d,o.id,r+1,{blocks:[d,...c],runs:i})),ne(e,s),s}function to(e,n){const t=e.getBlock(n),o=e.getBlock(t.parentId);if(o.contentIds.length<=1)return eo(e,o);const r=o.contentIds.indexOf(n);Ce(e,[_(n)]);const l=e.getBlock(o.id),s=Math.min(r,l.contentIds.length-1),c=l.contentIds[s];return c&&ne(e,c),c??null}function In(e,n,t){const o=e.getBlock(n),r=ce(o,o.contentIds[0]?e.getBlock(o.contentIds[0]).contentIds.length:0),l={id:R(),label:"New Column",type:fn,width:bn},s=[];let c=null;for(const u of o.contentIds){const d=hn(u,l);c===null&&(c=d.block.id),s.push(Y(d.block,u,t+1,{blocks:[d.block],runs:[d.run]}))}const i=[...r];return i.splice(t+1,0,l),s.push(z(n,{columns:i})),Ce(e,s),c&&ne(e,c),c}function oo(e,n,t){const o=e.getBlock(n),r=e.getBlock(o.contentIds[0]);if(!r||r.contentIds.length<=1)return eo(e,o);const l=ce(o,r.contentIds.length),s=o.contentIds.map(p=>{const b=e.getBlock(p);return _(b.contentIds[t])}),c=l.filter((p,b)=>b!==t);s.push(z(n,{columns:c})),Ce(e,s);const i=e.getBlock(o.contentIds[0]),u=Math.min(t,i.contentIds.length-1),d=i.contentIds[u];return d&&ne(e,d),d??null}function ro(e,n,t,o){const r=e.getBlock(n),l=e.getBlock(r.contentIds[0]),s=ce(r,l?l.contentIds.length:0);if(!s[t])return;const c=[...s];c[t]={...s[t],width:Math.max(rn,Math.round(o))},e.applyOperation(z(n,{columns:c}))}function lo(e,n,t,o){const r=e.getBlock(n),l=e.getBlock(r.contentIds[0]),c=[...ce(r,l?l.contentIds.length:0)];c[t]&&(c[t]={...c[t],label:o},e.applyOperation(z(n,{columns:c})))}function Vn(e,n,t){return n.contentIds.map(o=>{const l=e.getBlock(o).contentIds[t],s=e.getBlock(l);return{cellId:l,run:e.getRun(s.contentIds[0])}})}function pt(e,n){if(!e)return"";if(e.type==="text")return e.value??"";const t=n==null?void 0:n.get(e.type);return t!=null&&t.toPlainText?t.toPlainText(e):""}function Xl(e,n,t,o){const r=Vn(e,n,t),l=[],s=new Map;for(const{run:i}of r){const u=pt(i,o).trim();if(!u||s.has(u))continue;const d={value:R(),label:u};s.set(u,d),l.push(d)}const c=r.map(({cellId:i,run:u})=>{const d=pt(u,o).trim(),p=s.get(d);return{cellId:i,run:{id:R(),type:"tableSelect",value:"",marks:{},data:{selectedValue:(p==null?void 0:p.value)??"",selectedLabel:(p==null?void 0:p.label)??""}}}});return{options:l,newRuns:c}}function so(e,n,t,o,r){const l=e.getBlock(n),s=e.getBlock(l.contentIds[0]),c=ce(l,s?s.contentIds.length:0),i=c[t];if(!i||i.type===o)return;const u=[...c];if(o==="select"){const{options:p,newRuns:b}=Xl(e,l,t,r);u[t]={...i,type:o,options:p};const m=[z(n,{columns:u})];for(const{cellId:h,run:g}of b)m.push(le(h,[g]));Ce(e,m);return}u[t]={...i,type:o};const d=[z(n,{columns:u})];for(const{cellId:p,run:b}of Vn(e,l,t)){if(!b)continue;const m=Zt(b,o,r);d.push(le(p,[m]))}Ce(e,d)}function tn(e,n,t,o){var p,b;const r=e.getBlock(n),l=e.getBlock(r.contentIds[0]),s=ce(r,l?l.contentIds.length:0),c=s[t];if(!c)return;const i=[...s];i[t]={...c,options:o};const u=[z(n,{columns:i})],d=new Map(o.map(m=>[m.value,m]));for(const{run:m}of Vn(e,r,t)){if(!m||m.type!=="tableSelect")continue;const h=((p=m.data)==null?void 0:p.selectedValue)??"",g=d.get(h),k=g?h:"",x=g?g.label:"";(k!==h||x!==(((b=m.data)==null?void 0:b.selectedLabel)??""))&&u.push(X(m.id,{data:{selectedValue:k,selectedLabel:x}}))}Ce(e,u)}function Jl(e,n){return n?e.label.toLowerCase().includes(n.toLowerCase()):!0}function Ae({value:e,options:n,onChange:t,placeholder:o="Select…",ariaLabel:r,className:l="",variant:s="default",selectedLabel:c,selectedColor:i,onManageOptions:u,manageOptionsLabel:d="Manage options…",mention:p=!1}){var de,V;const[b,m]=f.useState(!1),[h,g]=f.useState(""),[k,x]=f.useState(0),[y,I]=f.useState(null),[E,T]=f.useState([]),[S,w]=f.useState(!1),[B,v]=f.useState(!1),C=f.useRef(null),j=f.useRef(null),L=f.useRef(null),N=f.useRef(null),A=f.useRef(null),K=f.useMemo(()=>[C,L],[]),q=s==="tag",H=typeof n=="function",$=H?void 0:n.find(O=>O.value===e),W=e?$??(c?{label:c,color:i}:void 0):void 0,J=f.useMemo(()=>H?E:n.filter(O=>Jl(O,h)),[H,E,n,h]);f.useEffect(()=>{if(!H||!b)return;let O=!1;w(!0),v(!1);const F=setTimeout(()=>{Promise.resolve(n(h)).then(ie=>{O||(T(ie??[]),w(!1))}).catch(()=>{O||(T([]),w(!1),v(!0))})},250);return()=>{O=!0,clearTimeout(F)}},[H,b,n,h]);const oe=f.useCallback(()=>m(!1),[]);pn(K,b,oe);const Be=f.useCallback(()=>{var O;I(((O=j.current)==null?void 0:O.getBoundingClientRect())??null),g(""),x(0),m(!0)},[]);f.useEffect(()=>{var O;b&&((O=N.current)==null||O.focus())},[b]),f.useEffect(()=>{var O,F;(F=(O=A.current)==null?void 0:O.scrollIntoView)==null||F.call(O,{block:"nearest"})},[k]);const Q=f.useCallback(O=>{var F;t(O.value,O),oe(),(F=j.current)==null||F.focus()},[t,oe]),re=f.useCallback(O=>{var F;O.key==="ArrowDown"?(O.preventDefault(),x(ie=>Math.min(ie+1,Math.max(J.length-1,0)))):O.key==="ArrowUp"?(O.preventDefault(),x(ie=>Math.max(ie-1,0))):O.key==="Enter"?(O.preventDefault(),J[k]&&Q(J[k])):O.key==="Escape"&&(O.preventDefault(),oe(),(F=j.current)==null||F.focus())},[J,k,Q,oe]);return a.jsxs("span",{className:`be-select ${l}`.trim(),ref:C,children:[a.jsx("button",{type:"button",ref:j,className:`be-select-trigger${q?" be-select-trigger-tag":""}${p?" be-select-trigger-mention":""}`,"aria-haspopup":"listbox","aria-expanded":b,"aria-label":r,onClick:()=>b?oe():Be(),children:q?W?a.jsx("span",{className:`be-select-tag${p?" be-select-tag-mention":""}`,style:p?void 0:{background:(de=W.color)==null?void 0:de.bg,color:(V=W.color)==null?void 0:V.text},children:p?`@${W.label}`:W.label}):a.jsx("span",{className:"be-select-value be-select-value-placeholder",children:o}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"be-select-value",children:W?W.label:o}),a.jsx(Dn,{size:14,className:"be-select-chevron"})]})}),b&&y&&Oe.createPortal(a.jsxs("div",{ref:L,className:"be-select-popover",style:{position:"fixed",top:y.bottom+4,left:y.left,minWidth:y.width},children:[a.jsx("input",{ref:N,type:"text",className:"be-select-search",value:h,onChange:O=>{g(O.target.value),x(0)},onKeyDown:re,placeholder:"Search…","aria-label":r?`Search ${r}`:"Search options"}),a.jsxs("div",{className:"be-select-options",role:"listbox",children:[H&&S&&a.jsx("div",{className:"be-select-empty",children:"Loading…"}),H&&!S&&B&&a.jsx("div",{className:"be-select-empty be-select-error",children:"Couldn't load options"}),!S&&!B&&J.length===0&&a.jsx("div",{className:"be-select-empty",children:"No results"}),!S&&!B&&J.map((O,F)=>{var ie,et;return a.jsx("div",{ref:F===k?A:void 0,role:"option","aria-selected":O.value===e,className:`be-select-option${F===k?" be-select-option-active":""}${O.value===e?" be-select-option-selected":""}`,onMouseDown:ar=>{ar.preventDefault(),Q(O)},onMouseEnter:()=>x(F),children:q?a.jsx("span",{className:"be-select-tag",style:{background:(ie=O.color)==null?void 0:ie.bg,color:(et=O.color)==null?void 0:et.text},children:O.label}):O.label},O.value)})]}),u&&a.jsx("button",{type:"button",className:"be-select-manage-options",onMouseDown:O=>{O.preventDefault(),oe(),u()},children:d})]}),document.body)]})}const Qe=[{bg:"#e9e9e7",text:"#32302c"},{bg:"#eee0da",text:"#64473a"},{bg:"#fadec9",text:"#8a4b23"},{bg:"#fdecc8",text:"#8a6116"},{bg:"#dbeddb",text:"#256029"},{bg:"#d3e5ef",text:"#1a5f8a"},{bg:"#e8deee",text:"#5b3a8a"},{bg:"#f5e0e9",text:"#8a3a5f"},{bg:"#ffe2dd",text:"#a13a2f"}];function Ue(e){return Qe[(e%Qe.length+Qe.length)%Qe.length]}const Ql={text:"Text",date:"Date",checkbox:"Checkbox",select:"Select"},Zl=Jt.map(e=>({value:e,label:Ql[e]}));function es({tableId:e,colIndex:n,options:t}){const o=D(),[r,l]=f.useState(""),s=f.useCallback((u,d)=>{tn(o,e,n,t.map(p=>p.value===u?{...p,label:d}:p))},[o,e,n,t]),c=f.useCallback(u=>tn(o,e,n,t.filter(d=>d.value!==u)),[o,e,n,t]),i=f.useCallback(()=>{const u=r.trim();l(""),u&&tn(o,e,n,[...t,{value:R(),label:u,color:Ue(t.length)}])},[o,e,n,t,r]);return a.jsxs("div",{className:"be-table-header-menu-options",children:[a.jsx("div",{className:"be-table-header-menu-options-label",children:"Options"}),t.map((u,d)=>a.jsxs("div",{className:"be-table-header-menu-option-row",children:[a.jsx("span",{className:"be-table-header-menu-option-swatch",style:{background:(u.color??Ue(d)).bg},"aria-hidden":"true"}),a.jsx("input",{className:"be-table-header-menu-option-input",value:u.label,onChange:p=>s(u.value,p.target.value),"aria-label":`Rename option ${u.label}`}),a.jsx("button",{type:"button",className:"be-table-header-menu-option-remove",onClick:()=>c(u.value),"aria-label":`Remove option ${u.label}`,children:a.jsx(Ve,{size:14})})]},u.value)),a.jsxs("div",{className:"be-table-header-menu-option-row",children:[a.jsx("input",{className:"be-table-header-menu-option-input",value:r,onChange:u=>l(u.target.value),placeholder:"New option…",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),i())}}),a.jsx("button",{type:"button",className:"be-table-header-menu-option-add",onClick:i,"aria-label":"Add option",children:"+"})]})]})}function ns({tableId:e,column:n,colIndex:t,colCount:o}){const r=D(),l=ke(),[s,c]=f.useState(!1),[i,u]=f.useState(null),[d,p]=f.useState(null),b=f.useRef(null),m=f.useRef(null),h=f.useRef(null),g=f.useMemo(()=>[b,m],[]),k=f.useCallback(()=>c(!1),[]);pn(g,s,k);const x=f.useCallback(()=>{var B;u(((B=h.current)==null?void 0:B.getBoundingClientRect())??null),c(!0)},[]),y=f.useCallback(B=>lo(r,e,t,B.target.value),[r,e,t]),I=f.useCallback(()=>{In(r,e,t-1),k()},[r,e,t,k]),E=f.useCallback(()=>{In(r,e,t),k()},[r,e,t,k]),T=f.useCallback(()=>{oo(r,e,t),k()},[r,e,t,k]),S=f.useCallback(B=>so(r,e,t,B,l),[r,e,t,l]),w=f.useCallback(B=>{var q;B.preventDefault();const v=(q=h.current)==null?void 0:q.closest("table"),C=v==null?void 0:v.querySelector(`col[data-col-index="${t}"]`);if(!C)return;const j=h.current.getBoundingClientRect().width,L=B.clientX,N=H=>Math.max(rn,Math.round(j+(H.clientX-L))),A=H=>{const $=N(H);C.style.width=`${$}px`,p($)},K=H=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",K),ro(r,e,t,N(H)),p(null)};document.addEventListener("mousemove",A),document.addEventListener("mouseup",K)},[r,e,t]);return a.jsxs("th",{ref:h,className:"be-table-header-cell",contentEditable:!1,children:[a.jsx("input",{className:"be-table-header-label",value:n.label,onChange:y,"aria-label":`Column ${t+1} name`}),a.jsx("button",{ref:b,type:"button",className:"be-table-header-menu-trigger","aria-label":`Column ${t+1} options`,"aria-haspopup":"menu","aria-expanded":s,onClick:()=>s?k():x(),children:"⋮"}),a.jsx("div",{className:"be-table-col-resize-handle",onMouseDown:w,role:"slider","aria-label":`Resize column ${t+1}`,"aria-valuemin":rn,"aria-valuenow":d??n.width}),s&&i&&Oe.createPortal(a.jsxs("div",{ref:m,role:"menu",className:"be-table-header-menu",style:{position:"fixed",top:i.bottom+4,left:i.right,transform:"translateX(-100%)"},children:[a.jsxs("div",{className:"be-table-header-menu-type",children:[a.jsx("span",{id:`be-table-col-type-${n.id}`,children:"Type"}),a.jsx(Ae,{value:n.type,options:Zl,onChange:S,ariaLabel:"Column type",className:""})]}),n.type==="select"&&a.jsx(es,{tableId:e,colIndex:t,options:n.options??[]}),a.jsx("button",{type:"button",role:"menuitem",className:"be-table-header-menu-item",onClick:I,children:"Insert column left"}),a.jsx("button",{type:"button",role:"menuitem",className:"be-table-header-menu-item",onClick:E,children:"Insert column right"}),a.jsx("button",{type:"button",role:"menuitem",className:"be-table-header-menu-item be-table-header-menu-item-danger",onClick:T,disabled:o<=1,children:"Delete column"})]}),document.body)]})}function ao({tableId:e,columns:n}){return a.jsx("thead",{children:a.jsxs("tr",{className:"be-table-header-row",children:[n.map((t,o)=>a.jsx(ns,{tableId:e,column:t,colIndex:o,colCount:n.length},t.id)),a.jsx("th",{className:"be-table-header-spacer","aria-hidden":"true"})]})})}function ts({id:e}){var s;const n=D(),t=te(e),o=f.useCallback(()=>{var i;const c=(i=t==null?void 0:t.contentIds)==null?void 0:i[t.contentIds.length-1];c&&no(n,c)},[n,t]);if(!t)return null;const r=n.getBlock(t.contentIds[0]),l=ce(t,((s=r==null?void 0:r.contentIds)==null?void 0:s.length)??0);return a.jsx("div",{className:"be-table-scroll",children:a.jsxs("div",{className:"be-table-wrapper","data-block-id":e,children:[a.jsxs("table",{className:"be-table",children:[a.jsxs("colgroup",{children:[l.map((c,i)=>a.jsx("col",{"data-col-index":i,style:{width:c.width}},c.id)),a.jsx("col",{className:"be-table-header-spacer-col"})]}),a.jsx(ao,{tableId:e,columns:l}),a.jsx("tbody",{children:a.jsx(we,{parentId:e})})]}),a.jsxs("button",{type:"button",className:"be-table-add-row",contentEditable:!1,onClick:o,children:[a.jsx(jt,{size:14})," Add row"]})]})})}function os({id:e}){const n=D(),t=f.useCallback(()=>to(n,e),[n,e]);return a.jsxs("tr",{className:"be-table-row","data-block-id":e,children:[a.jsx(we,{parentId:e}),a.jsx("td",{className:"be-table-row-actions",contentEditable:!1,children:a.jsx("button",{type:"button",className:"be-table-delete-row",onClick:t,"aria-label":"Delete row",title:"Delete row",children:a.jsx(Ve,{size:14})})})]})}function co(e,n){const t=e.getBlock(n),o=e.getBlock(t.parentId),r=e.getBlock(o.parentId);return{table:r,row:o,rowIndex:r.contentIds.indexOf(o.id),colIndex:o.contentIds.indexOf(n)}}function rs(e,n,t){const{table:o,row:r,rowIndex:l,colIndex:s}=co(e,n);if(t==="left"||t==="right"){const d=t==="right"?1:-1,p=s+d;if(p>=0&&p<r.contentIds.length)return r.contentIds[p];const b=l+d;if(b<0||b>=o.contentIds.length)return null;const m=e.getBlock(o.contentIds[b]),h=t==="right"?0:m.contentIds.length-1;return m.contentIds[h]}const i=l+(t==="down"?1:-1);if(i<0||i>=o.contentIds.length)return null;const u=e.getBlock(o.contentIds[i]);return u.contentIds[s]??u.contentIds[u.contentIds.length-1]??null}function ls(e,n){const t=At(e,n,"down");if(t){G(t);return}ye(e,n,P("paragraph"))}function _e(e,n,t){var r;const o=rs(e,n,t);if(o){const l=e.getBlock(o),s=(r=l==null?void 0:l.contentIds)==null?void 0:r[0];s&&G(s);return}if(t==="right"){const{table:l}=co(e,n);ls(e,l.id)}}function ss({id:e}){const n=D(),t=te(e),o=f.useCallback(()=>_e(n,e,"right"),[n,e]),r=f.useCallback(()=>_e(n,e,"left"),[n,e]),l=f.useCallback(()=>_e(n,e,"up"),[n,e]),s=f.useCallback(()=>_e(n,e,"down"),[n,e]),c=f.useCallback(()=>_e(n,e,"down"),[n,e]);return t?a.jsx("td",{className:"be-table-cell","data-block-id":e,children:a.jsx(me,{blockId:e,runIds:t.contentIds,onTab:o,onShiftTab:r,onArrowUp:l,onArrowDown:s,onEnter:c})}):null}function as(e,n){const t=R(),o=[],r=[],l=[];for(const s of n){const c=hn(t,s);o.push(c.block),r.push(c.run),l.push(c.block.id)}return{block:{id:t,type:"tableRow",parentId:e,contentIds:l,props:{}},blocks:o,runs:r}}function cs({rows:e=2,cols:n=2}={}){return function(o){const r=R(),l=Wn(n),s=[],c=[],i=[];for(let d=0;d<e;d+=1){const p=as(r,l);s.push(p.block,...p.blocks),c.push(...p.runs),i.push(p.block.id)}return{block:{id:r,type:"table",parentId:o,contentIds:i,props:{columns:l}},runs:c,subtreeBlocks:s}}}function is(e,n){return`<td>${e.contentIds.map(o=>n.store.getRun(o)).map(o=>ve(o,n)).join("")}</td>`}function us(e,n){return e.contentIds.map(t=>Ie(n.store.getRun(t),n)).join("")}function ds(e,n){if(e.tagName!=="TD"&&e.tagName!=="TH")return null;const t=ue(e,n);return{block:{id:R(),type:"tableCell",parentId:null,contentIds:t.map(r=>r.id),props:{}},runs:t}}function ps(e,n){return`<tr>${e.contentIds.map(o=>{const r=n.store.getBlock(o);return n.registry.get(r.type).toHTML(r,n)}).join("")}</tr>`}function fs(e,n){return e.contentIds.map(t=>{const o=n.store.getBlock(t);return n.registry.get(o.type).toPlainText(o,n)}).join(" ")}function bs(e,n){if(e.tagName!=="TR")return null;const t=[...e.children].filter(i=>i.tagName==="TD"||i.tagName==="TH"),o=R(),r=[],l=[],s=[];for(const i of t){const u=n.registry.get("tableCell").fromHTML(i,n);u&&(u.block.parentId=o,r.push(u.block),l.push(...u.runs),s.push(u.block.id))}return{block:{id:o,type:"tableRow",parentId:null,contentIds:s,props:{}},runs:l,subtreeBlocks:r}}function hs(e,n){var s;const t=e.contentIds[0]&&n.store.getBlock(e.contentIds[0]),o=ce(e,((s=t==null?void 0:t.contentIds)==null?void 0:s.length)??0),r=o.length?`<thead><tr>${o.map(c=>`<th>${je(c.label??"")}</th>`).join("")}</tr></thead>`:"",l=e.contentIds.map(c=>{const i=n.store.getBlock(c);return n.registry.get(i.type).toHTML(i,n)}).join("");return`<table>${r}<tbody>${l}</tbody></table>`}function ms(e,n){return e.contentIds.map(t=>{const o=n.store.getBlock(t);return n.registry.get(o.type).toPlainText(o,n)}).join(`
|
|
1815
|
+
`)}function gs(e,n){if(e.tagName!=="TABLE")return null;const t=e.querySelector("thead tr"),o=e.querySelector("tbody")?[...e.querySelectorAll("tbody tr")]:[...e.querySelectorAll("tr")].filter(d=>d!==t),r=R(),l=[],s=[],c=[];for(const d of o){const p=n.registry.get("tableRow").fromHTML(d,n);if(p){p.block.parentId=r;for(const b of p.subtreeBlocks)b.parentId=p.block.id;l.push(p.block,...p.subtreeBlocks),s.push(...p.runs),c.push(p.block.id)}}const i={};if(t){const d=[...t.children].filter(p=>p.tagName==="TH"||p.tagName==="TD");i.columns=d.map(p=>({id:R(),label:p.textContent??""}))}return{block:{id:r,type:"table",parentId:null,contentIds:c,props:i},runs:s,subtreeBlocks:l}}const io={component:ss,isLeaf:!0,defaultProps:{},toHTML:is,toPlainText:us,fromHTML:ds},uo={component:os,isLeaf:!1,defaultProps:{},toHTML:ps,toPlainText:fs,fromHTML:bs},po={component:ts,isLeaf:!1,defaultProps:{},toHTML:hs,toPlainText:ms,fromHTML:gs,slashCommand:{label:"Table",icon:$r,keywords:["table","grid"],run:(e,n)=>Z(e,n,cs({rows:2,cols:2}))}};function ks({id:e}){return a.jsx("div",{className:"be-layout","data-block-id":e,style:{display:"flex",gap:"1em"},children:a.jsx(we,{parentId:e})})}function xs({id:e}){return a.jsx("div",{className:"be-layout-column","data-block-id":e,children:a.jsx(we,{parentId:e})})}function ys({columns:e=2}={}){return function(t){const o=R(),r=[],l=[],s=[];for(let i=0;i<e;i+=1){const u=R(),{block:d,runs:p}=P("paragraph")(u),b={id:u,type:"layoutColumn",parentId:o,contentIds:[d.id],props:{}};r.push(b,d),l.push(...p),s.push(u)}return{block:{id:o,type:"layout",parentId:t,contentIds:s,props:{}},runs:l,subtreeBlocks:r}}}function fo(e,n){return(t,o)=>`${e}${t.contentIds.map(r=>{const l=o.store.getBlock(r);return o.registry.get(l.type).toHTML(l,o)}).join("")}${n}`}function bo(e,n){return e.contentIds.map(t=>{const o=n.store.getBlock(t);return n.registry.get(o.type).toPlainText(o,n)}).join(`
|
|
1816
|
+
`)}const ho={component:xs,isLeaf:!1,defaultProps:{},toHTML:fo("<div>","</div>"),toPlainText:bo},mo={component:ks,isLeaf:!1,defaultProps:{},toHTML:fo('<div style="display:flex;gap:1em">',"</div>"),toPlainText:bo,slashCommands:[2,3,4,5].map(e=>({label:`${e} columns`,icon:Hr,keywords:["layout","columns","column",String(e)],run:(n,t)=>Z(n,t,ys({columns:e}))}))};function vs({id:e}){return a.jsx("hr",{className:"be-divider","data-block-id":e,contentEditable:!1,tabIndex:-1})}function Is(){return function(n){return{block:{id:R(),type:"divider",parentId:n,contentIds:[],props:{}},runs:[]}}}function ws(){return"<hr />"}function Cs(){return"---"}function Bs(e){return e.tagName!=="HR"?null:{block:{id:R(),type:"divider",parentId:null,contentIds:[],props:{}},runs:[]}}const go={component:vs,isLeaf:!0,defaultProps:{},toHTML:ws,toPlainText:Cs,fromHTML:Bs,slashCommand:{label:"Divider",icon:Dr,keywords:["divider","hr","separator","line"],run:(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r})=>{const l=e.getRun(t),s=(l==null?void 0:l.value)??"";e.applyOperation(X(t,{value:s.slice(0,o)+s.slice(r)}));const c=Hn(e,n,Is());return ye(e,c,P("paragraph")),c}}},Je="💡",ko="gray";function Rs({icon:e=Je,color:n=ko}={}){return function(o){const r=R(),{block:l,runs:s}=P("paragraph")(r);return{block:{id:r,type:"callout",parentId:o,contentIds:[l.id],props:{icon:e,color:n}},runs:s,subtreeBlocks:[l]}}}const Ts=[{value:"gray",label:"Gray"},{value:"blue",label:"Blue"},{value:"green",label:"Green"},{value:"yellow",label:"Yellow"},{value:"orange",label:"Orange"},{value:"red",label:"Red"},{value:"purple",label:"Purple"},{value:"pink",label:"Pink"}];function js({id:e}){var k,x;const n=D(),t=te(e),[o,r]=f.useState(!1),[l,s]=f.useState(!1),c=f.useRef(null),i=f.useRef(null),u=f.useMemo(()=>[c,i],[]),d=f.useCallback(()=>s(!1),[]);pn(u,l,d);const p=((k=t==null?void 0:t.props)==null?void 0:k.icon)??Je,b=((x=t==null?void 0:t.props)==null?void 0:x.color)??ko,m=f.useCallback(y=>{const I=y.target.value.trim();I&&n.applyOperation(z(e,{icon:I})),r(!1)},[n,e]),h=f.useCallback(y=>{y.key==="Enter"&&y.currentTarget.blur(),y.key==="Escape"&&r(!1)},[]),g=f.useCallback(y=>{n.applyOperation(z(e,{color:y})),s(!1)},[n,e]);return t?a.jsxs("div",{className:"be-callout","data-block-id":e,"data-color":b,children:[a.jsx("div",{className:"be-callout-icon-wrap",children:o?a.jsx("input",{type:"text",className:"be-callout-icon-input",defaultValue:p,autoFocus:!0,onBlur:m,onKeyDown:h,"aria-label":"Callout icon (paste or type an emoji)"}):a.jsx("button",{type:"button",className:"be-callout-icon",onClick:()=>r(!0),"aria-label":"Change callout icon",title:"Change icon",children:p})}),a.jsx("div",{className:"be-callout-content",children:a.jsx(we,{parentId:e})}),a.jsxs("div",{className:"be-callout-color-wrap",contentEditable:!1,children:[a.jsx("button",{ref:c,type:"button",className:"be-callout-color-trigger","aria-label":"Callout color","aria-haspopup":"true","aria-expanded":l,title:"Callout color",onClick:()=>s(y=>!y),children:a.jsx("span",{className:`be-callout-color-dot be-callout-color-dot-${b}`})}),l&&a.jsx("div",{ref:i,className:"be-callout-color-picker",role:"menu","aria-label":"Callout color",children:Ts.map(y=>a.jsx("button",{type:"button",role:"menuitem",className:`be-callout-color-option be-callout-color-option-${y.value}${y.value===b?" be-callout-color-option-active":""}`,title:y.label,"aria-label":y.label,onClick:()=>g(y.value)},y.value))})]})]}):null}function Ss(e,n){return e.contentIds.map(t=>{const o=n.store.getBlock(t);return n.registry.get(o.type).toHTML(o,n)}).join("")}function Es(e,n){var o;const t=((o=e.props)==null?void 0:o.icon)??Je;return`<div class="callout" data-icon="${t}"><div class="callout-icon">${t}</div><div class="callout-content">${Ss(e,n)}</div></div>`}function Os(e,n){var r;const t=((r=e.props)==null?void 0:r.icon)??Je,o=e.contentIds.map(l=>{const s=n.store.getBlock(l);return n.registry.get(s.type).toPlainText(s,n)}).join(`
|
|
1817
|
+
`);return`${t} ${o}`}const xo={component:js,isLeaf:!1,defaultProps:{icon:Je},toHTML:Es,toPlainText:Os,slashCommand:{label:"Callout",icon:_r,keywords:["callout","aside","note","info","tip","warning"],run:(e,n)=>Z(e,n,Rs())}};function Ls({id:e}){const n=D(),t=te(e),{setSelectedBlockId:o}=he(),r=f.useCallback(()=>{Le(n,e,(t==null?void 0:t.contentIds)??[],P("paragraph"))},[n,e,t]),l=f.useCallback(()=>{const u=Xe(n,e);Me(n,u,e,o)},[n,e,o]),s=f.useCallback(()=>ee(n,e,"up"),[n,e]),c=f.useCallback(()=>ee(n,e,"down"),[n,e]);if(!t)return null;const i=se(n,t.contentIds);return a.jsx("blockquote",{className:"be-blockquote","data-block-id":e,"data-empty":i?"":void 0,"data-placeholder":"Empty quote",children:a.jsx(me,{blockId:e,runIds:t.contentIds,onEnter:r,onBackspaceAtStart:l,onArrowUp:s,onArrowDown:c})})}function Ns(e,n){return`<p>${e.contentIds.map(o=>n.store.getRun(o)).map(o=>ve(o,n)).join("")}</p>`}function Ms(e,n){return e.contentIds.map(t=>Ie(n.store.getRun(t),n)).join("")}function As(e,n){if(e.tagName!=="BLOCKQUOTE")return null;const t=ue(e,n);return{block:{id:R(),type:"blockquote",parentId:null,contentIds:t.map(r=>r.id),props:{}},runs:t}}const yo={component:Ls,isLeaf:!0,defaultProps:{},toHTML:Ns,toPlainText:Ms,fromHTML:As,slashCommand:{label:"Quote",icon:Mr,keywords:["quote","blockquote","citation"],run:(e,n)=>Z(e,n,P("blockquote"))}},Ds=["plaintext","javascript","python","html","css","json","bash","sql"],_s=Ds.map(e=>({value:e,label:e}));function ft(e,n,t){const o=Ye();if(!o||o.blockId!==n)return;const r=e.getRun(o.runId);if(!r||r.type!=="text")return;const l=r.value??"",s=l.slice(0,o.offset)+t+l.slice(o.offset);e.applyOperation(X(r.id,{value:s})),pe(r.id,o.offset+t.length)}function Ps({id:e}){var b;const n=D(),t=te(e),o=f.useCallback(()=>ft(n,e,`
|
|
1818
|
+
`),[n,e]),r=f.useCallback(()=>ft(n,e," "),[n,e]),l=f.useCallback(()=>{var k;const m=Xe(n,e);if(!m||m===e)return;const h=n.getBlock(m),g=(k=h==null?void 0:h.contentIds)==null?void 0:k[h.contentIds.length-1];g&&G(g)},[n,e]),s=f.useCallback(()=>ee(n,e,"up"),[n,e]),c=f.useCallback(()=>ee(n,e,"down"),[n,e]),i=f.useCallback(m=>n.applyOperation(z(e,{language:m})),[n,e]),u=f.useCallback(()=>qn(n,e),[n,e]);if(!t)return null;const d=((b=t.props)==null?void 0:b.language)??"plaintext",p=se(n,t.contentIds);return a.jsxs("div",{className:"be-code-block","data-block-id":e,children:[a.jsxs("div",{className:"be-code-block-header",contentEditable:!1,children:[a.jsx(Ae,{className:"be-code-block-language",value:d,options:_s,onChange:i,ariaLabel:"Code language"}),a.jsx("button",{type:"button",className:"be-code-block-delete",onClick:u,"aria-label":"Delete code block",title:"Delete code block",children:a.jsx(_n,{size:14})})]}),a.jsx("pre",{className:"be-code-block-pre",children:a.jsx("code",{"data-empty":p?"":void 0,"data-placeholder":"Empty code block",children:a.jsx(me,{blockId:e,runIds:t.contentIds,onEnter:o,onTab:r,onBackspaceAtStart:l,onArrowUp:s,onArrowDown:c})})})]})}function $s(e,n){var l;const t=e.contentIds.map(s=>n.store.getRun(s)),o=(l=e.props)==null?void 0:l.language;return`<pre><code${o&&o!=="plaintext"?` data-language="${je(o)}"`:""}>${t.map(s=>ve(s,n)).join("")}</code></pre>`}function Hs(e,n){return e.contentIds.map(t=>Ie(n.store.getRun(t),n)).join("")}function zs(e,n){var s;if(e.tagName!=="PRE")return null;const t=e.querySelector("code")??e,o=(s=t.getAttribute)==null?void 0:s.call(t,"data-language"),r=R();return{block:{id:R(),type:"code",parentId:null,contentIds:[r],props:o?{language:o}:{}},runs:[{id:r,type:"text",value:t.textContent??"",marks:{}}]}}const vo={component:Ps,isLeaf:!0,defaultProps:{language:"plaintext"},toHTML:$s,toPlainText:Hs,fromHTML:zs,slashCommand:{label:"Code",icon:Ar,keywords:["code","codeblock","snippet","pre"],run:(e,n)=>Z(e,n,P("code"))}};function Us(e,n){var t;return n.length===0||n.length===1&&(((t=e.getRun(n[0]))==null?void 0:t.value)??"")===""}function Fs(e,n){const t=n.contentIds??[];if(t.length===0)return!0;if(t.length>1)return!1;const o=e.getBlock(t[0]);return!!o&&o.type==="paragraph"&&se(e,o.contentIds)}function Ze(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Ks(e,n){const t=e.getBlock(n);if(!t)return null;const o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=t.props.titleRunIds??[],s=Us(e,l)&&Fs(e,t);if(r<=0){if(!s)return null;if(o.contentIds.length>1)return Ze(e,[_(n)]),{focusBlockId:e.getBlock(o.id).contentIds[0],needsRefocus:!0};const{block:u,runs:d}=P("paragraph")(o.id);return Ze(e,[Y(u,o.id,r,{blocks:[u],runs:d}),_(n)]),{focusBlockId:u.id,needsRefocus:!0}}const c=o.contentIds[r-1],i=e.getBlock(c);return s?(Ze(e,[_(n)]),{focusBlockId:c,needsRefocus:!0}):We(e,i)?(Ze(e,[_(c)]),{focusBlockId:n,needsRefocus:!1}):null}function qs(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Ws({id:e}){var h;const n=D(),t=te(e),{setSelectedBlockId:o}=he(),r=f.useCallback(()=>{var y,I;const g=((y=t==null?void 0:t.props)==null?void 0:y.titleRunIds)??[],k=(((I=t==null?void 0:t.contentIds)==null?void 0:I.length)??0)>0,x=P("paragraph");k?_t(n,e,g,x):Le(n,e,g,x)},[n,e,t]),l=f.useCallback(()=>{const g=Ks(n,e);!g||!g.needsRefocus||Me(n,g.focusBlockId,e,o)},[n,e,o]),s=f.useCallback(()=>ee(n,e,"up"),[n,e]),c=f.useCallback(()=>ee(n,e,"down"),[n,e]),i=f.useCallback(()=>{var k,x;if(!((((k=t==null?void 0:t.contentIds)==null?void 0:k.length)??0)>0)){const{block:y,runs:I}=P("paragraph")(e);qs(n,[Y(y,e,0,{blocks:[y],runs:I}),z(e,{collapsed:!1})]),G(y.contentIds[0]);return}n.applyOperation(z(e,{collapsed:!((x=t==null?void 0:t.props)!=null&&x.collapsed)}))},[n,e,t==null?void 0:t.contentIds,(h=t==null?void 0:t.props)==null?void 0:h.collapsed]);if(!t)return null;const{level:u=2,collapsed:d,titleRunIds:p=[]}=t.props,b=t.contentIds.length>0,m=`h${u}`;return a.jsxs("div",{className:"be-toggle-heading","data-block-id":e,children:[a.jsxs("div",{className:"be-toggle-heading-row",children:[a.jsx("button",{type:"button",className:"be-toggle-heading-marker",onClick:i,"aria-expanded":!d,"aria-label":b?d?"Expand section":"Collapse section":"Add content to section",children:d?a.jsx(un,{}):a.jsx(Dn,{})}),a.jsx(m,{className:"be-heading be-toggle-heading-title","data-empty":se(n,p)?"":void 0,"data-placeholder":`Toggle heading ${u}`,children:a.jsx(me,{blockId:e,runIds:p,onEnter:r,onBackspaceAtStart:l,onArrowUp:s,onArrowDown:c})})]}),!d&&a.jsx("div",{className:"be-toggle-heading-children",children:a.jsx(we,{parentId:e})})]})}function Vs({level:e=2,collapsed:n=!1}={}){return function(o,r){const l=R(),s=r!=null&&r.length?r:[{id:R(),type:"text",value:"",marks:{}}],{block:c,runs:i}=P("paragraph")(l);return{block:{id:l,type:"toggleHeading",parentId:o,contentIds:[c.id],props:{level:e,collapsed:n,titleRunIds:s.map(u=>u.id)}},runs:[...s,...i],subtreeBlocks:[c]}}}function Ys(e,n){const{titleRunIds:t=[],level:o=2,collapsed:r}=e.props,l=t.map(c=>ve(n.store.getRun(c),n)).join(""),s=e.contentIds.map(c=>{const i=n.store.getBlock(c);return n.registry.get(i.type).toHTML(i,n)}).join("");return`<details${r?"":" open"}><summary><h${o}>${l}</h${o}></summary>${s}</details>`}function Gs(e,n){const{titleRunIds:t=[]}=e.props,o=t.map(l=>Ie(n.store.getRun(l),n)).join(""),r=e.contentIds.map(l=>{const s=n.store.getBlock(l);return n.registry.get(s.type).toPlainText(s,n)}).join(`
|
|
1819
|
+
`);return r?`${o}
|
|
1820
|
+
${r}`:o}function Xs(e,n){if(e.tagName!=="DETAILS")return null;const t=[...e.children].find(p=>p.tagName==="SUMMARY"),o=t==null?void 0:t.querySelector("h1,h2,h3,h4,h5,h6"),r=o?Math.min(6,Math.max(1,Number(o.tagName[1]))):2,l=o?ue(o,n):[{id:R(),type:"text",value:"",marks:{}}],s=R(),c=[],i=[],u=[];for(const p of e.children){if(p===t||p.tagName!=="P")continue;const b=ue(p,n),m={id:R(),type:"paragraph",parentId:s,contentIds:b.map(h=>h.id),props:{}};c.push(m),i.push(...b),u.push(m.id)}if(u.length===0){const{block:p,runs:b}=P("paragraph")(s);c.push(p),i.push(...b),u.push(p.id)}return{block:{id:s,type:"toggleHeading",parentId:null,contentIds:u,props:{level:r,collapsed:!e.hasAttribute("open"),titleRunIds:l.map(p=>p.id)}},runs:[...l,...i],subtreeBlocks:c}}const Io={component:Ws,isLeaf:!1,defaultProps:{level:2,collapsed:!1,titleRunIds:[]},toHTML:Ys,toPlainText:Gs,fromHTML:Xs,slashCommands:[1,2,3].map(e=>({label:`Toggle heading ${e}`,icon:un,keywords:["toggle","heading","collapse","section"],run:(n,t)=>Z(n,t,Vs({level:e}))}))},xn=[{label:"Blue",value:"#2b6fd6"},{label:"Green",value:"#2f9e44"},{label:"Red",value:"#e03131"},{label:"Purple",value:"#9c36b5"},{label:"Gray",value:"#495057"},{label:"Black",value:"#1a1a1a"}];function Js(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Qs({isOpen:e,onClose:n,store:t,blockId:o}){const[r,l]=f.useState(""),[s,c]=f.useState(""),[i,u]=f.useState(xn[0].value),[d,p]=f.useState([{key:"",value:""}]);f.useEffect(()=>{var y,I,E;if(!e)return;const g=t.getBlock(o);if(!g)return;const k=g.contentIds.map(T=>{var S;return((S=t.getRun(T))==null?void 0:S.value)??""}).join(""),x=((y=g.props)==null?void 0:y.customAttrs)??[];l(k),c(((I=g.props)==null?void 0:I.href)??""),u(((E=g.props)==null?void 0:E.color)??xn[0].value),p([...x,{key:"",value:""}])},[e,o,t]);const b=f.useCallback((g,k)=>{p(x=>{const y=x.map((E,T)=>T===g?{...E,...k}:E),I=y[y.length-1];return(I.key.trim()||I.value.trim())&&y.push({key:"",value:""}),y})},[]),m=f.useCallback(g=>{p(k=>k.filter((x,y)=>y!==g))},[]),h=f.useCallback(()=>{const g={id:R(),type:"text",value:r,marks:{}},k=d.filter(x=>x.key.trim());Js(t,[le(o,[g]),z(o,{href:s.trim(),color:i,customAttrs:k})]),n()},[t,o,r,s,i,d,n]);return a.jsxs(cn,{isOpen:e,onClose:n,title:"Edit button",children:[a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"Label"}),a.jsx("input",{type:"text",value:r,onChange:g=>l(g.target.value),placeholder:"Button"})]}),a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"Link URL"}),a.jsx("input",{type:"url",value:s,onChange:g=>c(g.target.value),placeholder:"https://example.com"})]}),a.jsxs("div",{className:"be-modal-field",children:[a.jsx("span",{children:"Color"}),a.jsx("div",{className:"be-modal-color-row",children:xn.map(g=>a.jsx("button",{type:"button",className:`be-modal-color-swatch${i===g.value?" be-modal-color-swatch-active":""}`,style:{backgroundColor:g.value},title:g.label,"aria-label":g.label,onClick:()=>u(g.value)},g.value))})]}),a.jsxs("div",{className:"be-modal-field",children:[a.jsx("span",{children:"Custom attributes"}),d.map((g,k)=>a.jsxs("div",{className:"be-modal-attr-row",children:[a.jsx("input",{type:"text",placeholder:"name",value:g.key,onChange:x=>b(k,{key:x.target.value})}),a.jsx("input",{type:"text",placeholder:"value",value:g.value,onChange:x=>b(k,{value:x.target.value})}),(g.key||g.value)&&a.jsx("button",{type:"button",className:"be-modal-attr-remove",onClick:()=>m(k),"aria-label":"Remove attribute",children:a.jsx(Ve,{size:14})})]},k))]}),a.jsxs("div",{className:"be-modal-actions",children:[a.jsx("button",{type:"button",className:"be-modal-cancel",onClick:n,children:"Cancel"}),a.jsx("button",{type:"button",className:"be-modal-save",onClick:h,children:"Save"})]})]})}const Zs="#2b6fd6";function ea({id:e}){var k,x,y,I;const n=D(),t=te(e),{setSelectedBlockId:o}=he(),[r,l]=f.useState(!1),s=f.useCallback(()=>{Le(n,e,(t==null?void 0:t.contentIds)??[],P("paragraph"))},[n,e,t]),c=f.useCallback(()=>{const E=Xe(n,e);Me(n,E,e,o)},[n,e,o]),i=f.useCallback(()=>ee(n,e,"up"),[n,e]),u=f.useCallback(()=>ee(n,e,"down"),[n,e]),d=f.useCallback(()=>{var T;const E=(T=t==null?void 0:t.props)==null?void 0:T.href;E&&window.open(E,"_blank","noopener,noreferrer")},[(k=t==null?void 0:t.props)==null?void 0:k.href]);if(!t)return null;const p=((x=t.props)==null?void 0:x.href)??"",b=((y=t.props)==null?void 0:y.color)??Zs,m=((I=t.props)==null?void 0:I.customAttrs)??[],h=se(n,t.contentIds),g={};for(const{key:E,value:T}of m)E.trim()&&(g[`data-${E.trim()}`]=T);return a.jsxs("div",{className:"be-button-block","data-block-id":e,children:[a.jsxs("div",{className:"be-button-block-pill",style:{backgroundColor:b},...g,children:[a.jsx("span",{className:"be-button-block-label","data-empty":h?"":void 0,"data-placeholder":"Button",children:a.jsx(me,{blockId:e,runIds:t.contentIds,onEnter:s,onBackspaceAtStart:c,onArrowUp:i,onArrowDown:u})}),a.jsx("button",{type:"button",className:"be-button-block-open",onClick:d,disabled:!p,title:p||"No link set","aria-label":"Open link",children:"↗"}),a.jsx("button",{type:"button",className:"be-button-block-settings",onClick:()=>l(!0),"aria-label":"Edit button",title:"Edit label, link, color…",children:"⚙"})]}),a.jsx(Qs,{isOpen:r,onClose:()=>l(!1),store:n,blockId:e})]})}function na({href:e="",label:n="Button",color:t="",customAttrs:o=[]}={}){return function(l,s){const c=R(),i=s!=null&&s.length?s:[{id:R(),type:"text",value:n,marks:{}}];return{block:{id:c,type:"button",parentId:l,contentIds:i.map(u=>u.id),props:{href:e,color:t,customAttrs:o}},runs:i}}}const wo="be-button-block-link";function ta(e,n){var i,u,d;const t=e.contentIds.map(p=>n.store.getRun(p)),o=((i=e.props)==null?void 0:i.href)??"",r=(u=e.props)==null?void 0:u.color,l=r?` style="background-color:${ae(r)}"`:"",c=(((d=e.props)==null?void 0:d.customAttrs)??[]).filter(p=>{var b;return(b=p.key)==null?void 0:b.trim()}).map(p=>` data-${ae(p.key.trim())}="${ae(p.value??"")}"`).join("");return`<a class="${wo}" href="${ae(o)}"${l}${c}>${t.map(p=>ve(p,n)).join("")}</a>`}function oa(e,n){return e.contentIds.map(t=>Ie(n.store.getRun(t),n)).join("")}function ra(e,n){var l;if(e.tagName!=="A"||!e.classList.contains(wo))return null;const t=ue(e,n),o=[];for(const s of e.attributes)s.name.startsWith("data-")&&o.push({key:s.name.slice(5),value:s.value});return{block:{id:R(),type:"button",parentId:null,contentIds:t.map(s=>s.id),props:{href:e.getAttribute("href")??"",color:((l=e.style)==null?void 0:l.backgroundColor)||void 0,customAttrs:o}},runs:t}}const Co={component:ea,isLeaf:!0,defaultProps:{href:"",color:"",customAttrs:[]},toHTML:ta,toPlainText:oa,fromHTML:ra,slashCommand:{label:"Button",icon:Pr,keywords:["button","link","cta","action"],run:(e,n)=>Z(e,n,na())}};function bt(e){return new Promise((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=()=>t(o.error),o.readAsDataURL(e)})}const en={image:"image",video:"video",audio:"audio",file:"file"},la={image:"image/*",video:"video/*",audio:"audio/*",file:"*/*"},Bo=20,Ro=100,sa=[{value:"left",Icon:Br,label:"Align left"},{value:"center",Icon:Rr,label:"Align center"},{value:"right",Icon:Tr,label:"Align right"}];function aa(e){return Math.min(Ro,Math.max(Bo,Math.round(e)))}function ca({kind:e,src:n,name:t}){return e==="image"?a.jsx("img",{className:"be-embed-image",src:n,alt:t||""}):e==="video"?a.jsx("video",{className:"be-embed-video",src:n,controls:!0}):e==="audio"?a.jsx("audio",{className:"be-embed-audio",src:n,controls:!0}):a.jsxs("a",{className:"be-embed-file-link",href:n,download:t||void 0,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Tt,{size:14})," ",t||n]})}function ia({id:e}){const n=D(),t=te(e),[o,r]=f.useState(""),[l,s]=f.useState(!1),[c,i]=f.useState(null),u=f.useRef(null),d=f.useRef(null),p=f.useCallback(C=>n.applyOperation(z(e,C)),[n,e]),b=f.useCallback(async C=>{var N;const j=(N=C.target.files)==null?void 0:N[0];if(!j)return;const L=await bt(j);p({src:L,name:j.name,mimeType:j.type})},[p]),m=f.useCallback(async C=>{var N;C.preventDefault(),s(!1);const j=(N=C.dataTransfer.files)==null?void 0:N[0];if(!j)return;const L=await bt(j);p({src:L,name:j.name,mimeType:j.type})},[p]),h=f.useCallback(C=>{C.preventDefault(),s(!0)},[]),g=f.useCallback(()=>s(!1),[]),k=f.useCallback(()=>{const C=o.trim();C&&(p({src:C,name:C}),r(""))},[o,p]),x=f.useCallback(()=>p({src:"",name:"",mimeType:""}),[p]),y=f.useCallback(C=>{C.preventDefault();const j=u.current,L=d.current;if(!j||!L)return;const N=j.getBoundingClientRect().width,A=L.getBoundingClientRect().width,K=C.clientX,q=W=>aa((A+(W.clientX-K))/N*100),H=W=>i(q(W)),$=W=>{document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",$),p({width:q(W)}),i(null)};document.addEventListener("mousemove",H),document.addEventListener("mouseup",$)},[p]);if(!t)return null;const{kind:I="file",src:E,name:T,align:S="left",width:w=100}=t.props,B=I==="image"||I==="video",v=c??w;return a.jsx("div",{className:"be-embed","data-block-id":e,"data-kind":I,contentEditable:!1,tabIndex:-1,children:E?a.jsx("div",{ref:u,className:`be-embed-preview be-embed-align-${S}`,children:a.jsxs("div",{ref:d,className:"be-embed-frame",style:B?{width:`${v}%`}:void 0,children:[a.jsxs("div",{className:"be-embed-toolbar",contentEditable:!1,children:[sa.map(({value:C,Icon:j,label:L})=>a.jsx("button",{type:"button",className:`be-embed-toolbar-btn${S===C?" be-embed-toolbar-btn-active":""}`,title:L,"aria-label":L,"aria-pressed":S===C,onClick:()=>p({align:C}),children:a.jsx(j,{size:14})},C)),a.jsx("button",{type:"button",className:"be-embed-remove",onClick:x,"aria-label":`Remove ${en[I]}`,children:"Remove"})]}),a.jsx(ca,{kind:I,src:E,name:T}),B&&a.jsx("div",{className:"be-embed-resize-handle",onMouseDown:y,role:"slider","aria-label":`Resize ${en[I]}`,"aria-valuemin":Bo,"aria-valuemax":Ro,"aria-valuenow":v})]})}):a.jsxs("div",{className:`be-embed-dropzone${l?" be-embed-dropzone-active":""}`,onDrop:m,onDragOver:h,onDragLeave:g,children:[a.jsxs("label",{className:"be-embed-upload-btn",children:["Upload ",en[I],a.jsx("input",{type:"file",accept:la[I],onChange:b,hidden:!0})]}),a.jsx("span",{className:"be-embed-dropzone-hint",children:"or drop a file, or paste a URL below"}),a.jsxs("div",{className:"be-embed-url-row",children:[a.jsx("input",{type:"text",className:"be-embed-url-input",placeholder:`https://... ${en[I]} URL`,value:o,onChange:C=>r(C.target.value),onKeyDown:C=>C.key==="Enter"&&k()}),a.jsx("button",{type:"button",className:"be-embed-url-commit",onClick:k,children:"Embed"})]})]})})}function ua({kind:e="file",src:n="",name:t="",mimeType:o="",align:r="left",width:l=100}={}){return function(c){return{block:{id:R(),type:"embed",parentId:c,contentIds:[],props:{kind:e,src:n,name:t,mimeType:o,align:r,width:l}},runs:[]}}}const da={image:qr,video:Wr,audio:Vr,file:Tt},To="be-embed-file-link";function pa(e,n,t){if(e!=="image"&&e!=="video")return"";const o=[];return t!==100&&o.push(`width:${t}%`),n==="center"?o.push("display:block","margin-left:auto","margin-right:auto"):n==="right"&&o.push("display:block","margin-left:auto"),o.length?` style="${o.join(";")}"`:""}function ht(e){var r,l,s,c;const n=(r=e.style)==null?void 0:r.width,t=n&&n.endsWith("%")?parseInt(n,10):100;let o="left";return((l=e.style)==null?void 0:l.marginLeft)==="auto"&&((s=e.style)==null?void 0:s.marginRight)==="auto"?o="center":((c=e.style)==null?void 0:c.marginLeft)==="auto"&&(o="right"),{align:o,width:Number.isFinite(t)?t:100}}function fa(e){const{kind:n,src:t,name:o,align:r="left",width:l=100}=e.props;if(!t)return"<p></p>";const s=pa(n,r,l);return n==="image"?`<img src="${ae(t)}" alt="${ae(o||"")}"${s}>`:n==="video"?`<video src="${ae(t)}" controls${s}></video>`:n==="audio"?`<audio src="${ae(t)}" controls></audio>`:`<a class="${To}" href="${ae(t)}">${je(o||t)}</a>`}function ba(e){const{kind:n,src:t,name:o}=e.props;return t?`[${n}: ${o||t}]`:""}function ha(e){return e.tagName==="IMG"?nn("image",e.getAttribute("src")??"",e.getAttribute("alt")??"",ht(e)):e.tagName==="VIDEO"?nn("video",e.getAttribute("src")??"","",ht(e)):e.tagName==="AUDIO"?nn("audio",e.getAttribute("src")??"",""):e.tagName==="A"&&e.classList.contains(To)?nn("file",e.getAttribute("href")??"",e.textContent??""):null}function nn(e,n,t,{align:o="left",width:r=100}={}){return{block:{id:R(),type:"embed",parentId:null,contentIds:[],props:{kind:e,src:n,name:t,align:o,width:r}},runs:[]}}function ma(e){return(n,{blockId:t,runId:o,sliceStart:r,sliceEnd:l})=>{const s=n.getRun(o),c=(s==null?void 0:s.value)??"";n.applyOperation(X(o,{value:c.slice(0,r)+c.slice(l)}));const i=Hn(n,t,ua({kind:e}));return ye(n,i,P("paragraph")),i}}const jo={component:ia,isLeaf:!0,defaultProps:{kind:"file",src:"",name:"",mimeType:"",align:"left",width:100},toHTML:fa,toPlainText:ba,fromHTML:ha,slashCommands:["image","video","audio","file"].map(e=>({label:e.charAt(0).toUpperCase()+e.slice(1),icon:da[e],keywords:["embed","upload","insert",e],run:ma(e)}))};function ga(e){So(e,{paragraph:Ht,heading:zt,listItem:Xt,...Eo,...Oo,divider:go,callout:xo,blockquote:yo,code:vo,toggleHeading:Io,button:Co,embed:jo})}function So(e,n){for(const[t,o]of Object.entries(n))e.register(t,o)}const Eo={table:po,tableRow:uo,tableCell:io},Oo={layout:mo,layoutColumn:ho};function ka({id:e}){const n=D(),t=xe(e),o=f.useCallback(c=>{n.applyOperation(X(e,{data:{...t==null?void 0:t.data,selectedValue:c}}))},[n,e,t==null?void 0:t.data]);if(!t)return null;const{options:r=[],selectedValue:l="",placeholder:s="Select…"}=t.data??{};return a.jsx("span",{className:"be-inline-select",onMouseDown:c=>{c.preventDefault(),c.stopPropagation()},onKeyDown:c=>c.stopPropagation(),children:a.jsx(Ae,{value:l,options:r,onChange:o,placeholder:s,ariaLabel:"Select an option"})})}function mn(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r},l){const s=e.getRun(t),c=(s==null?void 0:s.value)??"",i=c.slice(0,o),u=c.slice(r),d=l(),p={...s,value:i},b={id:R(),type:"text",value:u,marks:{...s==null?void 0:s.marks}};e.applyOperation(Fe(n,[t],[p,d,b])),G(b.id)}function xa(e){return String(e).replace(/&/g,"&").replace(/"/g,""")}function Lo(e){var o;const{options:n=[],selectedValue:t=""}=e.data??{};return((o=n.find(r=>r.value===t))==null?void 0:o.label)??""}function ya(e){var t,o;const n=Lo(e)||((t=e.data)==null?void 0:t.placeholder)||"";return`<span data-inline-type="select" data-selected-value="${xa(((o=e.data)==null?void 0:o.selectedValue)??"")}">${n}</span>`}function va(e){return Lo(e)}function Ia(e){var n;return((n=e.getAttribute)==null?void 0:n.call(e,"data-inline-type"))!=="select"?null:{id:R(),type:"select",value:"",marks:{},data:{options:[],selectedValue:e.getAttribute("data-selected-value")??""}}}const No={component:ka,isAtomic:!0,toHTML:ya,toPlainText:va,fromHTML:Ia,slashCommand:{label:"Select",icon:Kr,keywords:["select","dropdown","choice","picker"],run:(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r})=>mn(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r},()=>({id:R(),type:"select",value:"",marks:{},data:{options:[],selectedValue:"",placeholder:"Select…"}}))}};function wa({id:e}){const n=D(),t=xe(e),o=f.useCallback(l=>{n.applyOperation(X(e,{data:{...t==null?void 0:t.data,isoDate:l.target.value}}))},[n,e,t==null?void 0:t.data]);if(!t)return null;const{isoDate:r=""}=t.data??{};return a.jsx("span",{className:"be-inline-date",onMouseDown:l=>l.stopPropagation(),onKeyDown:l=>l.stopPropagation(),children:a.jsx("input",{type:"date",value:r,onChange:o})})}function Ca(e){return String(e).replace(/&/g,"&").replace(/"/g,""")}function Mo(e){if(!e)return"";const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Ba(e){var t;const n=((t=e.data)==null?void 0:t.isoDate)??"";return`<span data-inline-type="date" data-iso-date="${Ca(n)}">${Mo(n)}</span>`}function Ra(e){var n;return Mo(((n=e.data)==null?void 0:n.isoDate)??"")}function Ta(e){var n;return((n=e.getAttribute)==null?void 0:n.call(e,"data-inline-type"))!=="date"?null:{id:R(),type:"date",value:"",marks:{},data:{isoDate:e.getAttribute("data-iso-date")??""}}}function ja(){return new Date().toISOString().slice(0,10)}const Ao={component:wa,isAtomic:!0,toHTML:Ba,toPlainText:Ra,fromHTML:Ta,slashCommand:{label:"Date",icon:Fr,keywords:["date","when","schedule","calendar"],run:(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r})=>mn(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r},()=>({id:R(),type:"date",value:"",marks:{},data:{isoDate:ja()}}))}};function Sa({id:e}){const n=D(),t=xe(e),o=f.useCallback(c=>{n.applyOperation(X(e,{data:{...t==null?void 0:t.data,checked:c.target.checked}}))},[n,e,t==null?void 0:t.data]),r=f.useCallback(c=>{n.applyOperation(X(e,{data:{...t==null?void 0:t.data,label:c.target.value}}))},[n,e,t==null?void 0:t.data]);if(!t)return null;const{checked:l=!1,label:s=""}=t.data??{};return a.jsxs("span",{className:"be-inline-checkbox",onMouseDown:c=>c.stopPropagation(),onKeyDown:c=>c.stopPropagation(),children:[a.jsx("input",{type:"checkbox",className:"be-inline-checkbox-input",checked:l,onChange:o}),a.jsx("input",{type:"text",className:"be-inline-checkbox-label",value:s,onChange:r,placeholder:"Label…"})]})}function Ea(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Oa(e){const{checked:n=!1,label:t=""}=e.data??{};return`<span data-inline-type="checkbox" data-checked="${n}">${n?"☑":"☐"} ${Ea(t)}</span>`}function La(e){const{checked:n=!1,label:t=""}=e.data??{};return`${n?"[x]":"[ ]"} ${t}`.trim()}function Na(e){var n;return((n=e.getAttribute)==null?void 0:n.call(e,"data-inline-type"))!=="checkbox"?null:{id:R(),type:"checkbox",value:"",marks:{},data:{checked:e.getAttribute("data-checked")==="true",label:(e.textContent??"").replace(/^[☑☐]\s*/,"")}}}const Do={component:Sa,isAtomic:!0,toHTML:Oa,toPlainText:La,fromHTML:Na,slashCommand:{label:"Checkbox",icon:Lt,keywords:["checkbox","todo","check","toggle"],run:(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r})=>mn(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r},()=>({id:R(),type:"checkbox",value:"",marks:{},data:{checked:!1,label:""}}))}};function Ma({id:e,blockId:n}){var m;const t=D(),o=xe(e),r=n?t.getBlock(n):null,l=r?t.getBlock(r.parentId):null,s=(l==null?void 0:l.parentId)??null,c=te(s),i=l?l.contentIds.indexOf(n):-1,d=(((m=(c&&l?ce(c,l.contentIds.length):[])[i])==null?void 0:m.options)??[]).map((h,g)=>({...h,color:h.color??Ue(g)})),p=f.useCallback((h,g)=>{t.applyOperation(X(e,{data:{selectedValue:h,selectedLabel:(g==null?void 0:g.label)??""}}))},[t,e]);if(!o)return null;const{selectedValue:b=""}=o.data??{};return a.jsx("span",{className:"be-inline-table-select",onMouseDown:h=>{h.preventDefault(),h.stopPropagation()},onKeyDown:h=>h.stopPropagation(),children:a.jsx(Ae,{value:b,options:d,onChange:p,placeholder:"Select…",ariaLabel:"Select an option",variant:"tag"})})}function _o(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Aa(e){return _o(e).replace(/"/g,""")}function Da(e){const{selectedValue:n="",selectedLabel:t=""}=e.data??{};return`<span data-inline-type="tableSelect" data-selected-value="${Aa(n)}">${_o(t)}</span>`}function _a(e){var n;return((n=e.data)==null?void 0:n.selectedLabel)??""}function Pa(e){var n;return((n=e.getAttribute)==null?void 0:n.call(e,"data-inline-type"))!=="tableSelect"?null:{id:R(),type:"tableSelect",value:"",marks:{},data:{selectedValue:e.getAttribute("data-selected-value")??"",selectedLabel:e.textContent??""}}}const Po={component:Ma,isAtomic:!0,toHTML:Da,toPlainText:_a,fromHTML:Pa},$o={};function $a(e){Ho(e,{select:No,date:Ao,checkbox:Do,...zo,emoji:$o})}function Ho(e,n){for(const[t,o]of Object.entries(n))e.register(t,o)}const zo={tableSelect:Po},Ha="$fieldTypes";function Uo(){const e=D(),n=f.useCallback(o=>e.subscribe(Ha,o),[e]),t=f.useCallback(()=>e.getFieldTypes(),[e]);return f.useSyncExternalStore(n,t)}const za={canUndo:!1,canRedo:!1};function Ua(){const{history:e}=be(),n=f.useCallback(r=>e?e.subscribeToHistory(r):()=>{},[e]),t=f.useCallback(()=>e?e.getUndoRedoSnapshot():za,[e]),o=f.useSyncExternalStore(n,t);return e?{...o,undo:()=>e.undo(),redo:()=>e.redo(),getHistoryLog:()=>e.getHistoryLog()}:null}const ln="application/x-block-editor-blocks+json";function Yn(e){return e.split(/\r\n|\r|\n/).filter(n=>n.length>0).map(n=>{const t=R();return{block:{id:R(),type:"paragraph",parentId:null,contentIds:[t],props:{}},runs:[{id:t,type:"text",value:n,marks:{}}]}})}function Fo(e,n,t){const o=new DOMParser().parseFromString(e,"text/html"),r={registry:n,inlineRegistry:t},l=n.listHtmlMatchers(),s=[],c=u=>{var b;const d=u.tagName==="OL",p=[];for(const m of u.children){if(m.tagName!=="LI")continue;const h=(b=n.get("listItem"))==null?void 0:b.fromHTML(m,r);h&&(h.block.props.ordered=d,p.push(h))}return p},i=u=>{var p;const d=Array.from(u.children).filter(b=>b.tagName==="P");if(d.length===0){const b=(p=n.get("blockquote"))==null?void 0:p.fromHTML(u,r);return b?[b]:[]}return d.map(b=>{const m=ue(b,r);return{block:{id:R(),type:"blockquote",parentId:null,contentIds:m.map(h=>h.id),props:{}},runs:m}})};for(const u of o.body.childNodes){if(u.nodeType===3){const p=u.textContent.trim();p&&s.push(...Yn(p));continue}if(u.nodeType!==1)continue;if(u.tagName==="UL"||u.tagName==="OL"){s.push(...c(u));continue}if(u.tagName==="BLOCKQUOTE"){s.push(...i(u));continue}let d=null;for(const p of l){const b=p.fromHTML(u,r);if(b){d=b;break}}if(d)s.push(d);else if(u.textContent.trim()){const p=ue(u,r);s.push({block:{id:R(),type:"paragraph",parentId:null,contentIds:p.map(b=>b.id),props:{}},runs:p})}}return s}function Ko(e,n,t){const o=e.types??[];if(o.includes(ln)){const l=e.getData(ln);if(l)return Fa(l)}if(o.includes("text/html")){const l=e.getData("text/html");if(l)return Fo(l,n,t)}const r=e.getData("text/plain")??"";return Yn(r)}function Fa(e){return JSON.parse(e).blocks.map(t=>Kn(t))}function wn(e,n){var o;const t=e.getBlock(n);return((o=t.props)==null?void 0:o.titleRunIds)??t.contentIds}function on(){return{id:R(),type:"text",value:"",marks:{}}}function Cn(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Gn(e,n,t){const{startRunId:o,startOffset:r,endRunId:l,endOffset:s}=t,c=wn(e,n),i=c.indexOf(o),u=c.indexOf(l);if(i===-1||u===-1)return null;const[d,p]=i<=u?[i,u]:[u,i],b=i<=u?r:s,m=i<=u?s:r,h=c.slice(0,d).map(T=>e.getRun(T)),g=c.slice(p+1).map(T=>e.getRun(T)),k=c.slice(d,p+1).map(T=>e.getRun(T)),x=[];let y=null,I=0;if(d===p){const T=k[0];if(T.type==="text"){const S=Math.max(0,Math.min(b,m)),w=Math.min(T.value.length,Math.max(b,m)),B={...T,value:T.value.slice(0,S)+T.value.slice(w)};x.push(B),y=B.id,I=S}}else k.forEach((T,S)=>{if(T.type!=="text")return;const w=S===0,B=S===k.length-1,v=w?T.value.slice(0,b):"";if(w&&v){const C={...T,value:v};x.push(C),y=C.id,I=v.length}if(B&&!w){const C=T.value.slice(m);if(C){const j={id:R(),type:"text",value:C,marks:T.marks};x.push(j),y===null&&(y=j.id,I=0)}}});let E=[...h,...x,...g];if(E.length===0){const T=on();E=[T],y=T.id,I=0}else if(y===null){const T=h[h.length-1];T?(y=T.id,I=T.type==="text"?T.value.length:0):g[0]&&(y=g[0].id,I=0)}return e.applyOperation(le(n,E)),{blockId:n,runId:y,offset:I}}function Xn(e,n){const{blockIds:t,startBlockId:o,startRunId:r,startOffset:l,endBlockId:s,endRunId:c,endOffset:i}=n;if(!t||t.length===0)return null;const u=t.indexOf(o),d=t.indexOf(s);if(u===-1||d===-1)return null;const[p,b]=u<=d?[u,d]:[d,u],m=u<=d,h=m?r:c,g=m?l:i,k=m?c:r,x=m?i:l;if(p===b)return Gn(e,t[p],{startRunId:h,startOffset:g,endRunId:k,endOffset:x});const y=t[p],I=t[b],E=e.getBlock(y),T=e.getBlock(I),S=wn(e,y),w=S.indexOf(h),B=S.slice(0,w).map(V=>e.getRun(V)),v=e.getRun(h),C=v.type==="text"&&g>0?{...v,value:v.value.slice(0,g)}:null,j=wn(e,I),L=j.indexOf(k),N=j.slice(L+1).map(V=>e.getRun(V)),A=e.getRun(k),K=A.type==="text"&&x<A.value.length?{id:R(),type:"text",value:A.value.slice(x),marks:A.marks}:null,q=[...B,...C?[C]:[]],H=[...K?[K]:[],...N],$=[];for(let V=p+1;V<b;V+=1)$.push(_(t[V]));const W=$t(E.type,T.type),J=e.getBlock(E.parentId),oe=b-p-1+(W?1:0),Be=J&&J.contentIds.length-oe===1;let Q,re,de;if(W){const V=[...q,...H];if(V.length===0&&Be&&E.type!=="paragraph"){const{block:F,runs:ie}=P("paragraph")(J.id);return $.push({type:"insertBlock",block:F,parentId:J.id,index:0,subtree:{blocks:[F],runs:ie}}),$.push(_(y)),$.push(_(I)),Cn(e,$),{blockId:F.id,runId:F.contentIds[0],offset:0}}const O=V.length?V:[on()];if($.push(le(y,O)),$.push(_(I)),de=y,C)Q=C.id,re=C.value.length;else if(B.length){const F=B[B.length-1];Q=F.id,re=F.type==="text"?F.value.length:0}else K?(Q=K.id,re=0):N.length?(Q=N[0].id,re=0):(Q=O[0].id,re=0)}else{const V=q.length?q:[on()];if($.push(le(y,V)),$.push(le(I,H.length?H:[on()])),de=y,C)Q=C.id,re=C.value.length;else if(B.length){const O=B[B.length-1];Q=O.id,re=O.type==="text"?O.value.length:0}else Q=V[0].id,re=0}return Cn(e,$),{blockId:de,runId:Q,offset:re}}function sn(e,n=""){var c;const t=e.getRootId(),o=((c=e.getBlock(t))==null?void 0:c.contentIds)??[];if(o.length===0)return null;const r=o.map(i=>_(i)),{block:l,runs:s}=P("paragraph")(t);return n&&(s[0].value=n),r.push(Y(l,t,0,{blocks:[l],runs:s})),Cn(e,r),{blockId:l.id,runId:l.contentIds[0],offset:n.length}}function qo(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function $e(e,n){n.length!==0&&qo(e,n.map(t=>_(t)))}function Wo(e,n){if(n.length===0)return!1;const t=e.getBlock(n[0]);if(!t)return!1;const o=e.getBlock(t.parentId);if(!o)return!1;const r=o.contentIds.indexOf(n[0]),l=o.contentIds.indexOf(n[n.length-1]);if(r<=0)return!1;const s=o.contentIds[r-1];return e.applyOperation(ge(s,t.parentId,l)),!0}function Vo(e,n){if(n.length===0)return!1;const t=e.getBlock(n[0]);if(!t)return!1;const o=e.getBlock(t.parentId);if(!o)return!1;const r=o.contentIds.indexOf(n[0]),l=o.contentIds.indexOf(n[n.length-1]);if(l===-1||l>=o.contentIds.length-1)return!1;const s=o.contentIds[l+1];return e.applyOperation(ge(s,t.parentId,r)),!0}function Yo(e,n){return n.length>0&&n.every(t=>{var o,r;return!!((r=(o=e.getBlock(t))==null?void 0:o.props)!=null&&r.hidden)})}function Go(e,n,t){n.length!==0&&qo(e,n.map(o=>z(o,{hidden:t})))}function Bn(e,n){if(n.length===0)return[];const t=e.getBlock(n[0]),o=t&&e.getBlock(t.parentId);if(!o)return n;const r=new Set(n);return o.contentIds.filter(l=>r.has(l))}function Rn(e){var t;let n=(e==null?void 0:e.nodeType)===1?e:e==null?void 0:e.parentElement;for(;n&&typeof n.hasAttribute=="function"&&!n.hasAttribute("data-block-id");)n=n.parentElement;return((t=n==null?void 0:n.getAttribute)==null?void 0:t.call(n,"data-block-id"))??null}function Ka(e){var p;const n=(p=window.getSelection)==null?void 0:p.call(window);if(!n||n.rangeCount===0)return[];const t=Rn(n.anchorNode),o=Rn(n.focusNode);if(!t)return[];if(!o||t===o)return[t];const r=e.getBlock(t),l=r&&e.getBlock(r.parentId);if(!l)return[t];const s=l.contentIds,c=s.indexOf(t),i=s.indexOf(o);if(c===-1||i===-1)return[t];const[u,d]=c<=i?[c,i]:[i,c];return s.slice(u,d+1)}function mt(e){const n=Ge();if(n)return Gn(e,n.blockId,n);const t=ze(e);return t?Xn(e,t):null}function qa(e,n,t){const o=e.getRun(n.runId);if(!o||o.type!=="text")return null;const r=o.value??"",l=r.slice(0,n.offset)+t+r.slice(n.offset);return e.applyOperation(X(o.id,{value:l})),{blockId:n.blockId,runId:o.id,offset:n.offset+t.length}}function yn(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Wa(){const e=D(),n=Ke(),t=ke(),[o,r]=Ln(),[l,s]=qe(),c=f.useCallback(d=>{var g;const p=o?((g=e.getBlock(e.getRootId()))==null?void 0:g.contentIds)??[]:l.length>0?l:Ka(e);if(p.length===0)return;const{html:b,text:m,json:h}=Fn(e,n,p,t);d.clipboardData.setData("text/plain",m),d.clipboardData.setData("text/html",b),d.clipboardData.setData(ln,h),d.preventDefault()},[e,n,t,o,l]),i=f.useCallback(d=>{if(c(d),o){const b=sn(e);r(!1),b!=null&&b.runId&&pe(b.runId,b.offset);return}if(l.length>0){$e(e,l),s([]);return}const p=mt(e);p!=null&&p.runId&&pe(p.runId,p.offset)},[c,e,o,r,l,s]),u=f.useCallback(d=>{var I,E,T;const p=Ko(d.clipboardData,n,t);if(p.length===0)return;if(o){const S=e.getRootId(),B=(((I=e.getBlock(S))==null?void 0:I.contentIds)??[]).map(C=>_(C));let v=0;for(const{block:C,runs:j,subtreeBlocks:L=[]}of p)C.parentId=S,B.push(Y(C,S,v,{blocks:[C,...L],runs:j})),v+=1;yn(e,B),r(!1),d.preventDefault();return}if(l.length>0){const S=e.getBlock(l[0]),w=(S==null?void 0:S.parentId)??null,B=w&&e.getBlock(w);let v=B?B.contentIds.indexOf(l[0]):0;const C=l.map(j=>_(j));for(const{block:j,runs:L,subtreeBlocks:N=[]}of p)j.parentId=w,C.push(Y(j,w,v,{blocks:[j,...N],runs:L})),v+=1;yn(e,C),s([]),d.preventDefault();return}const b=mt(e);if(p.length===1&&p[0].runs.every(S=>S.type==="text")&&(p[0].subtreeBlocks??[]).length===0){const S=b?{blockId:b.blockId,runId:b.runId,offset:b.offset}:Ye();if(S){const w=p[0].runs.map(v=>v.value).join(""),B=qa(e,S,w);if(B){pe(B.runId,B.offset),d.preventDefault();return}}}const h=(b==null?void 0:b.blockId)??Rn((T=(E=window.getSelection)==null?void 0:E.call(window))==null?void 0:T.anchorNode);if(!h)return;const g=e.getBlock(h);if(!g)return;let x=e.getBlock(g.parentId).contentIds.indexOf(h)+1;const y=[];for(const{block:S,runs:w,subtreeBlocks:B=[]}of p)S.parentId=g.parentId,y.push(Y(S,g.parentId,x,{blocks:[S,...B],runs:w})),x+=1;yn(e,y),d.preventDefault()},[e,n,t,o,r,l,s]);return{onCopy:c,onCut:i,onPaste:u}}const Va=["bold","italic","underline","strike","subscript","superscript","code"],Ya=["color","highlight","link"];function Se(e,n){var o;const t=e.getBlock(n);return((o=t.props)==null?void 0:o.titleRunIds)??t.contentIds}function Ga(e,n){return e===n?!0:e&&n&&typeof e=="object"?JSON.stringify(e)===JSON.stringify(n):!1}function Xo(e){var t;const n={};if(e.length===0)return n;for(const o of Va)n[o]=e.every(r=>{var l;return(l=r.marks)==null?void 0:l[o]});for(const o of Ya){const r=((t=e[0].marks)==null?void 0:t[o])??null;n[o]=e.every(l=>{var s;return Ga(((s=l.marks)==null?void 0:s[o])??null,r)})?r:null}return n}function Jo(e,n,t){const{startRunId:o,startOffset:r,endRunId:l,endOffset:s}=t,c=Se(e,n),i=c.indexOf(o),u=c.indexOf(l);if(i===-1||u===-1)return{};const[d,p]=i<=u?[i,u]:[u,i],b=c.slice(d,p+1).map(m=>e.getRun(m)).filter(m=>m&&m.type==="text");return Xo(b)}function Qo(e,n){const{blockIds:t,startBlockId:o,endBlockId:r}=n,l=t.indexOf(o),s=t.indexOf(r);if(l===-1||s===-1)return{};const[c,i]=l<=s?[l,s]:[s,l],u=[];for(let d=c;d<=i;d+=1)for(const p of Se(e,t[d])){const b=e.getRun(p);b&&b.type==="text"&&u.push(b)}return Xo(u)}function Zo(e,n){const t={...e};for(const[o,r]of Object.entries(n))r!=null?t[o]=r:delete t[o];return t}function er(e,n,t,o,r,l){const s=Zo(t.marks,l);if(o===0&&r===t.value.length)return e.applyOperation({type:"updateRun",id:t.id,patch:{marks:s}}),t.id;const c=t.value.slice(0,o),i=t.value.slice(o,r),u=t.value.slice(r),d=[];c&&d.push({id:R(),type:"text",value:c,marks:{...t.marks}});const p={id:R(),type:"text",value:i,marks:s};return d.push(p),u&&d.push({id:R(),type:"text",value:u,marks:{...t.marks}}),e.applyOperation(Fe(n,[t.id],d)),p.id}function Xa(e,n,t,o){const{startRunId:r,startOffset:l,endRunId:s,endOffset:c}=t,i=Se(e,n),u=i.indexOf(r),d=i.indexOf(s);if(u===-1||d===-1)return null;const[p,b]=u<=d?[u,d]:[d,u],m=u<=d?l:c,h=u<=d?c:l,g=i.slice(p,b+1),k=g.map(I=>e.getRun(I));if(p===b){const I=k[0];if(I.type!=="text")return I.id;const E=Math.max(0,Math.min(m,h)),T=Math.min(I.value.length,Math.max(m,h));return E===T?I.id:er(e,n,I,E,T,o)}const x=[];let y=null;return k.forEach((I,E)=>{if(I.type!=="text"){x.push(I),y=I.id;return}const T=E===0,S=E===k.length-1,w=T?m:0,B=S?h:I.value.length,v=I.value.slice(0,w),C=I.value.slice(w,B),j=I.value.slice(B);v&&x.push({id:R(),type:"text",value:v,marks:{...I.marks}});const L={id:R(),type:"text",value:C,marks:Zo(I.marks,o)};x.push(L),y=L.id,j&&x.push({id:R(),type:"text",value:j,marks:{...I.marks}})}),e.applyOperation(Fe(n,g,x)),y}function Ja(e,n,t,o){var h;const{startRunId:r,startOffset:l,endRunId:s,endOffset:c}=t,i=Se(e,n),u=i.indexOf(r),d=i.indexOf(s);if(u===-1||d===-1)return!0;const[p,b]=u<=d?[u,d]:[d,u],m=i.slice(p,b+1).map(g=>e.getRun(g)).filter(g=>g.type==="text");if(m.length===0)return!0;if(p===b){const g=Math.max(0,Math.min(l,c)),k=Math.min(m[0].value.length,Math.max(l,c));if(g===k)return!((h=m[0].marks)!=null&&h[o])}return!m.every(g=>{var k;return(k=g.marks)==null?void 0:k[o]})}function Qa(e,n,t,o,r,l){var p;const s=e.getRun(t),c=s.value??"",i=Math.max(0,Math.min(o,r)),u=Math.min(c.length,Math.max(o,r));if(i===u)return t;const d=!((p=s.marks)!=null&&p[l]);return er(e,n,s,i,u,{[l]:d?!0:null})}function Ee(e,n,t,o){return Xa(e,n,t,o)}function Jn(e,n,t,o){const r=Ja(e,n,t,o);return Ee(e,n,t,{[o]:r?!0:null})}function Qn(e,n,t){return an(e,n,o=>({[t]:o?null:!0}),t)}function an(e,n,t,o){var S;const{blockIds:r,startBlockId:l,startRunId:s,startOffset:c,endBlockId:i,endRunId:u,endOffset:d}=n;if(!r||r.length===0)return null;const p=r.indexOf(l),b=r.indexOf(i);if(p===-1||b===-1)return null;const[m,h]=p<=b?[p,b]:[b,p],g=p<=b,k=g?s:u,x=g?c:d,y=g?u:s,I=g?d:c;let E=t;if(typeof t=="function"){let w=!1,B=!0;for(let v=m;v<=h;v+=1){const C=Se(e,r[v]).map(j=>e.getRun(j)).filter(j=>j.type==="text");C.length!==0&&(w=!0,C.every(j=>{var L;return(L=j.marks)==null?void 0:L[o]})||(B=!1))}E=t(w&&B)}if(m===h)return Ee(e,r[m],{startRunId:k,startOffset:x,endRunId:y,endOffset:I},E);let T=null;for(let w=m;w<=h;w+=1){const B=r[w],v=Se(e,B),C=v[0],j=v[v.length-1],L=e.getRun(j),N=((S=L==null?void 0:L.value)==null?void 0:S.length)??0;let A;w===m&&w===h?A={startRunId:k,startOffset:x,endRunId:y,endOffset:I}:w===m?A={startRunId:k,startOffset:x,endRunId:j,endOffset:N}:w===h?A={startRunId:C,startOffset:0,endRunId:y,endOffset:I}:A={startRunId:C,startOffset:0,endRunId:j,endOffset:N},T=Ee(e,B,A,E)}return T}function nr(e,n){var o;const t=e.getBlock(n);return((o=t==null?void 0:t.props)==null?void 0:o.titleRunIds)??(t==null?void 0:t.contentIds)??[]}function tr(e){const n=Ge();if(!n)return!1;const{blockId:t,startRunId:o,startOffset:r,endRunId:l,endOffset:s}=n,c=nr(e,t);if(c.length===0)return!1;const i=c.indexOf(o),u=c.indexOf(l);if(i===-1||u===-1)return!1;const[d,p]=i<=u?[i,u]:[u,i],b=i<=u?r:s,m=i<=u?s:r;if(d!==0||p!==c.length-1||b!==0)return!1;const h=e.getRun(c[c.length-1]),g=(h==null?void 0:h.type)==="text"?(h.value??"").length:1;return m===g}function Za(e){const n=Ye();return n?se(e,nr(e,n.blockId)):!1}function ec(e,n,t){var m,h;const o=e.getBlock(n);if(!o){t(null);return}const r=e.getBlock(o.parentId),l=r?r.contentIds.indexOf(n):-1,s=l>0?r.contentIds[l-1]:null,c=l!==-1&&l<r.contentIds.length-1?r.contentIds[l+1]:null;e.applyOperation(_(n)),t(null);const i=Ne(e),u=s??c??i;if(!u)return;const d=e.getBlock(u);if(We(e,d)){t(u),requestAnimationFrame(()=>{var g;return(g=document.querySelector(`[data-block-id="${u}"]`))==null?void 0:g.focus()});return}const p=(m=d==null?void 0:d.props)==null?void 0:m.titleRunIds,b=((h=d==null?void 0:d.contentIds)==null?void 0:h[d.contentIds.length-1])??(p==null?void 0:p[p.length-1]);b&&G(b)}const gt={b:"bold",i:"italic",u:"underline"};function nc(e){const n=D(),[t,o]=Ln(),{getSelectedBlockId:r,setSelectedBlockId:l}=he();f.useEffect(()=>{const s=e.current;if(!s)return;const c=u=>{var p,b;if(r()&&(u.key==="Backspace"||u.key==="Delete")&&!u.defaultPrevented){u.preventDefault(),u.stopPropagation(),ec(n,r(),l);return}if(r()&&u.key!=="Backspace"&&u.key!=="Delete"&&l(null),u.metaKey||u.ctrlKey){const m=u.key.toLowerCase();if(m==="z"&&!u.shiftKey){u.preventDefault(),(p=n.undo)==null||p.call(n);return}if(m==="z"&&u.shiftKey||m==="y"){u.preventDefault(),(b=n.redo)==null||b.call(n);return}if(m==="a"){if(t)return;(tr(n)||Za(n))&&(u.preventDefault(),o(!0));return}if(gt[m]){if(t)return;u.preventDefault();const h=gt[m],g=Ge();if(g){const x=Jn(n,g.blockId,g,h);x&&G(x);return}const k=ze(n);if(k){const x=Qn(n,k,h);x&&G(x)}}return}if(t){if(u.key==="Backspace"||u.key==="Delete"){u.preventDefault(),u.stopPropagation();const m=sn(n);o(!1),m!=null&&m.runId&&pe(m.runId,m.offset);return}if(u.key.length===1){u.preventDefault(),u.stopPropagation();const m=sn(n,u.key);o(!1),m!=null&&m.runId&&pe(m.runId,m.offset);return}if(o(!1),u.key==="Escape")return}if(u.key==="Backspace"||u.key==="Delete"){const m=ze(n);if(!m)return;u.preventDefault(),u.stopPropagation();const h=Xn(n,m);h!=null&&h.runId&&pe(h.runId,h.offset)}},i=()=>{t&&o(!1),r()&&l(null)};return s.addEventListener("keydown",c),s.addEventListener("mousedown",i),()=>{s.removeEventListener("keydown",c),s.removeEventListener("mousedown",i)}},[e,n,t,o,r,l])}async function Tn(e,n,t,o){var s,c,i;const{html:r,text:l}=Fn(e,n,o,t);if(typeof ClipboardItem<"u"&&((s=navigator.clipboard)!=null&&s.write)){await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([l],{type:"text/plain"}),"text/html":new Blob([r],{type:"text/html"})})]);return}await((i=(c=navigator.clipboard)==null?void 0:c.writeText)==null?void 0:i.call(c,l))}function tc(){const e=D(),n=Ke(),t=ke(),[o,r]=qe(),[l,s]=f.useState(null),c=f.useRef(null),i=o.length>0,u=f.useCallback(()=>r([]),[r]);f.useEffect(()=>{if(!i){s(null);return}const x=o[o.length-1],y=document.querySelector(`[data-block-row-id="${x}"]`);s((y==null?void 0:y.getBoundingClientRect())??null)},[i,o]),f.useEffect(()=>{if(!i)return;const x=I=>{var E,T,S;(E=c.current)!=null&&E.contains(I.target)||(S=(T=I.target).closest)!=null&&S.call(T,".be-block-gutter")||u()},y=I=>{I.key==="Escape"?u():(I.key==="Delete"||I.key==="Backspace")&&(I.preventDefault(),$e(e,o),u())};return document.addEventListener("mousedown",x),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y)}},[i,e,o,u]);const d=f.useCallback(()=>{Tn(e,n,t,o)},[e,n,t,o]),p=f.useCallback(async()=>{await Tn(e,n,t,o),$e(e,o),u()},[e,n,t,o,u]),b=f.useCallback(()=>{$e(e,o),u()},[e,o,u]),m=f.useCallback(()=>{Wo(e,o)&&r(Bn(e,o))},[e,o,r]),h=f.useCallback(()=>{Vo(e,o)&&r(Bn(e,o))},[e,o,r]),g=Yo(e,o),k=f.useCallback(()=>{Go(e,o,!g),r(x=>[...x])},[e,o,g,r]);return!i||!l?null:Oe.createPortal(a.jsxs("div",{ref:c,role:"menu","aria-label":"Selected blocks options",className:"be-block-range-menu",style:{position:"fixed",top:l.bottom+4,left:l.left},children:[a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:d,children:[a.jsx(St,{size:15})," Copy"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:p,children:[a.jsx(Sr,{size:15})," Cut"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:m,children:[a.jsx(Et,{size:15})," Move up"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:h,children:[a.jsx(Ot,{size:15})," Move down"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:k,children:[g?a.jsx(Nt,{size:15}):a.jsx(Mt,{size:15}),g?"Show in preview":"Hide in preview"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item be-block-range-menu-item-danger",onClick:b,children:[a.jsx(_n,{size:15})," Delete"]})]}),document.body)}const oc=4;function rc(e,n,t){const o=e.getBlock(n);if(!o)return[];const r=e.getBlock(o.parentId);if(!r)return[n];const l=r.contentIds,s=l.indexOf(n),c=t?l.indexOf(t):s;if(s===-1)return[n];const[i,u]=c===-1?[s,s]:[Math.min(s,c),Math.max(s,c)];return l.slice(i,u+1)}function lc(){var e,n;return typeof window<"u"&&((n=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)"))==null?void 0:n.matches)===!0}function sc(e){const n=D(),[,t]=qe(),o=f.useRef(null),r=f.useRef(!1),l=f.useRef(null),s=f.useCallback(d=>{var m,h,g,k,x;if(!o.current)return;if(!r.current){const{x:y,y:I}=l.current??{x:d.clientX,y:d.clientY};if(Math.hypot(d.clientX-y,d.clientY-I)<oc)return;r.current=!0,document.documentElement.classList.add("be-block-range-dragging"),(h=(m=window.getSelection)==null?void 0:m.call(window))==null||h.removeAllRanges()}(k=(g=window.getSelection)==null?void 0:g.call(window))==null||k.removeAllRanges(),d.preventDefault();const p=(x=document.elementFromPoint(d.clientX,d.clientY))==null?void 0:x.closest("[data-block-row-id]"),b=(p==null?void 0:p.getAttribute("data-block-row-id"))??null;t(rc(n,o.current,b))},[n,t]),c=f.useCallback(()=>{o.current=null,r.current=!1,l.current=null,document.documentElement.classList.remove("be-block-range-dragging")},[]),i=f.useCallback((d,p)=>{o.current=d,r.current=!1,l.current={x:p.clientX,y:p.clientY}},[]),u=f.useCallback(d=>{var g,k;if(d.button!==0||lc()||(k=(g=d.target).closest)!=null&&k.call(g,"button, input, textarea, select"))return;const p=d.target.closest("[data-block-row-id]");if(p){if(d.target.closest(".be-block-row-content"))return;i(p.getAttribute("data-block-row-id"),d);return}const b=e==null?void 0:e.current;if(!b)return;const h=[...b.querySelectorAll("[data-block-row-id]")].find(x=>{const y=x.getBoundingClientRect();return d.clientY>=y.top&&d.clientY<=y.bottom});h&&i(h.getAttribute("data-block-row-id"),d)},[e,i]);f.useEffect(()=>(document.addEventListener("mousedown",u),document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),document.documentElement.classList.remove("be-block-range-dragging")}),[u,s,c])}function ac({minHeight:e=180,className:n="be-trailing-space"}){const t=D(),[o]=Nn(),r=f.useCallback(()=>{var u;if(o)return;const l=t.getRootId(),s=t.getBlock(l),c=(u=s==null?void 0:s.contentIds)==null?void 0:u[s.contentIds.length-1];if(!c){const d=Ne(t);d&&it(t,d);return}const i=t.getBlock(c);(i==null?void 0:i.type)==="paragraph"?it(t,c):ye(t,c,P("paragraph"))},[t,o]);return a.jsx("div",{className:n,style:{minHeight:e},onClick:r})}function cc(e,n,t,o){f.useEffect(()=>{if(!e||!n)return;const r=document.querySelector(`[data-run-id="${n}"]`);if(r)return r.setAttribute("aria-expanded","true"),r.setAttribute("aria-haspopup","listbox"),r.setAttribute("aria-controls",o),t&&r.setAttribute("aria-activedescendant",t),()=>{r.removeAttribute("aria-expanded"),r.removeAttribute("aria-haspopup"),r.removeAttribute("aria-controls"),r.removeAttribute("aria-activedescendant")}},[e,n,t,o])}function ic({isOpen:e,rect:n,commands:t,runId:o,onSelect:r,onClose:l,menuId:s="be-slash-menu",ariaLabel:c="Slash commands"}){const[i,u]=f.useState(0),d=f.useRef(null);f.useEffect(()=>{u(0)},[t.length]),f.useEffect(()=>{var m,h;(h=(m=d.current)==null?void 0:m.scrollIntoView)==null||h.call(m,{block:"nearest"})},[i]),f.useEffect(()=>{if(!e)return;const m=h=>{h.key==="ArrowDown"?(h.preventDefault(),h.stopPropagation(),u(g=>Math.min(g+1,Math.max(t.length-1,0)))):h.key==="ArrowUp"?(h.preventDefault(),h.stopPropagation(),u(g=>Math.max(g-1,0))):h.key==="Enter"?(h.preventDefault(),h.stopPropagation(),t[i]&&r(t[i])):h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),l())};return document.addEventListener("keydown",m,!0),()=>document.removeEventListener("keydown",m,!0)},[e,t,i,r,l]);const b=t[i]?`${s}-option-${i}`:null;return cc(e,o,b,s),!e||t.length===0||!n?null:a.jsx("div",{id:s,role:"listbox","aria-label":c,className:"be-slash-menu",style:{position:"fixed",top:n.bottom+4,left:n.left,zIndex:1e3},children:t.map((m,h)=>{const g=m.icon;return a.jsxs("div",{ref:h===i?d:void 0,id:`${s}-option-${h}`,role:"option","aria-selected":h===i,className:`be-slash-menu-item${h===i?" be-slash-menu-item-active":""}`,onMouseDown:k=>{k.preventDefault(),r(m)},onMouseEnter:()=>u(h),children:[g&&a.jsx("span",{className:"be-slash-menu-item-icon",children:a.jsx(g,{size:16})}),a.jsx("span",{className:"be-slash-menu-item-label",children:m.label})]},m.label)})})}function uc(e,n){var o;if(!n)return!0;const t=n.toLowerCase();return e.label.toLowerCase().includes(t)||((o=e.keywords)==null?void 0:o.some(r=>r.toLowerCase().includes(t)))}function dc(e,n){const t=n.anchorNode,o=n.anchorOffset;let r;if(t===e){r="";for(let l=0;l<o&&l<e.childNodes.length;l+=1)r+=e.childNodes[l].textContent??""}else t&&t.parentElement===e?r=(t.textContent??"").slice(0,o):r=e.textContent??"";return fe(r).length}function Zn(e,n,t){const o=D(),[r,l]=f.useState(null);f.useEffect(()=>{const u=e.current;if(!u)return;const d=()=>{var T,S,w,B;const b=(T=window.getSelection)==null?void 0:T.call(window),m=b==null?void 0:b.anchorNode;let h=(m==null?void 0:m.nodeType)===1?m:m==null?void 0:m.parentElement;for(;h&&typeof h.hasAttribute=="function"&&!h.hasAttribute("data-run-id");)h=h.parentElement;const g=(S=h==null?void 0:h.getAttribute)==null?void 0:S.call(h,"data-run-id");if(!g||!b){l(null);return}const k=dc(h,b),x=fe(h.textContent).slice(0,k),y=n.exec(x);if(!y){l(null);return}const I=(B=(w=h.closest)==null?void 0:w.call(h,"[data-block-id]"))==null?void 0:B.getAttribute("data-block-id");if(!I){l(null);return}const E=y.index+y[1].length;l({query:y[2],blockId:I,runId:g,sliceStart:E,sliceEnd:k,rect:h.getBoundingClientRect()})},p=b=>{b.key==="Escape"&&l(null)};return u.addEventListener("input",d),u.addEventListener("keydown",p),()=>{u.removeEventListener("input",d),u.removeEventListener("keydown",p)}},[e,n]);const s=r?t().filter(u=>uc(u,r.query)):[],c=f.useCallback(u=>{r&&(u.run(o,{blockId:r.blockId,runId:r.runId,sliceStart:r.sliceStart,sliceEnd:r.sliceEnd}),l(null))},[r,o]),i=f.useCallback(()=>l(null),[]);return{isOpen:!!r,query:(r==null?void 0:r.query)??"",rect:(r==null?void 0:r.rect)??null,runId:(r==null?void 0:r.runId)??null,commands:s,selectCommand:c,close:i}}const pc=/(^|\s)\/(\w*)$/;function fc(e){const n=Ke(),t=ke(),o=f.useCallback(()=>[...n.listSlashCommands(),...(t==null?void 0:t.listSlashCommands())??[]],[n,t]);return Zn(e,pc,o)}const bc=[{char:"😀",name:"grinning face",keywords:["smile","happy"]},{char:"😂",name:"face with tears of joy",keywords:["laugh","lol"]},{char:"😍",name:"heart eyes",keywords:["love","crush"]},{char:"😎",name:"cool",keywords:["sunglasses"]},{char:"🤔",name:"thinking face",keywords:["hmm"]},{char:"😉",name:"winking face",keywords:["wink"]},{char:"😢",name:"crying face",keywords:["sad","tear"]},{char:"😡",name:"angry face",keywords:["mad","rage"]},{char:"😱",name:"screaming face",keywords:["shock","scared"]},{char:"🥳",name:"party face",keywords:["celebrate","birthday"]},{char:"🙏",name:"folded hands",keywords:["please","pray","thanks"]},{char:"👍",name:"thumbs up",keywords:["approve","yes","like"]},{char:"👎",name:"thumbs down",keywords:["disapprove","no"]},{char:"👏",name:"clapping hands",keywords:["applause","congrats"]},{char:"🙌",name:"raised hands",keywords:["hooray","yay"]},{char:"👋",name:"waving hand",keywords:["hello","bye"]},{char:"✌️",name:"victory hand",keywords:["peace"]},{char:"💪",name:"flexed biceps",keywords:["strong","muscle"]},{char:"🤝",name:"handshake",keywords:["deal","agree"]},{char:"❤️",name:"red heart",keywords:["love"]},{char:"🔥",name:"fire",keywords:["hot","lit"]},{char:"⭐",name:"star",keywords:["favorite"]},{char:"✨",name:"sparkles",keywords:["shiny","magic"]},{char:"🎉",name:"party popper",keywords:["celebrate","congrats"]},{char:"🎊",name:"confetti ball",keywords:["celebrate"]},{char:"💡",name:"light bulb",keywords:["idea","tip"]},{char:"✅",name:"check mark",keywords:["done","yes","complete"]},{char:"❌",name:"cross mark",keywords:["no","wrong","delete"]},{char:"⚠️",name:"warning",keywords:["caution","alert"]},{char:"❓",name:"question mark",keywords:["question","help"]},{char:"❗",name:"exclamation mark",keywords:["important","alert"]},{char:"🚀",name:"rocket",keywords:["launch","fast","ship"]},{char:"🐛",name:"bug",keywords:["bug","issue"]},{char:"🔧",name:"wrench",keywords:["fix","tool","settings"]},{char:"📌",name:"pushpin",keywords:["pin","note"]},{char:"📎",name:"paperclip",keywords:["attachment","clip"]},{char:"📅",name:"calendar",keywords:["date","schedule"]},{char:"⏰",name:"alarm clock",keywords:["time","reminder"]},{char:"📈",name:"chart increasing",keywords:["growth","stats"]},{char:"📉",name:"chart decreasing",keywords:["decline","stats"]},{char:"💰",name:"money bag",keywords:["money","cash"]},{char:"💬",name:"speech balloon",keywords:["comment","chat"]},{char:"📝",name:"memo",keywords:["note","write"]},{char:"📚",name:"books",keywords:["reading","docs"]},{char:"🔗",name:"link",keywords:["url","chain"]},{char:"🔒",name:"locked",keywords:["private","secure"]},{char:"🔑",name:"key",keywords:["password","access"]},{char:"☕",name:"coffee",keywords:["coffee","break"]},{char:"🍕",name:"pizza",keywords:["food"]},{char:"🎂",name:"birthday cake",keywords:["birthday","cake"]},{char:"🎁",name:"gift",keywords:["present"]},{char:"🌟",name:"glowing star",keywords:["star","shiny"]},{char:"🌈",name:"rainbow",keywords:["colorful"]},{char:"☀️",name:"sun",keywords:["sunny","weather"]},{char:"🌧️",name:"rain cloud",keywords:["rainy","weather"]},{char:"🐶",name:"dog face",keywords:["dog","pet"]},{char:"🐱",name:"cat face",keywords:["cat","pet"]},{char:"🌍",name:"globe",keywords:["world","earth"]},{char:"🎯",name:"direct hit",keywords:["target","goal"]},{char:"🏆",name:"trophy",keywords:["win","award"]},{char:"🕐",name:"clock",keywords:["time"]},{char:"📣",name:"megaphone",keywords:["announce","shout"]},{char:"🧠",name:"brain",keywords:["smart","idea","mind"]},{char:"👀",name:"eyes",keywords:["look","watching"]}];function hc(e,{runId:n,sliceStart:t,sliceEnd:o},r){const l=e.getRun(n),s=(l==null?void 0:l.value)??"",c=s.slice(0,t)+r+s.slice(o);e.applyOperation(X(n,{value:c})),pe(n,t+r.length)}const mc=bc.map(({char:e,name:n,keywords:t})=>({label:`${e} ${n}`,keywords:t,run:(o,r)=>hc(o,r,e)})),gc=/(^|\s):(\w*)$/,kc=()=>mc;function xc(e){return Zn(e,gc,kc)}const yc=/(^|\s)@(\w*)$/;function vc(e){const n=ke(),t=f.useCallback(()=>(n==null?void 0:n.listAtCommands())??[],[n]);return Zn(e,yc,t)}const Ic=[{markName:"bold",Icon:xr,title:"Bold (Ctrl+B)"},{markName:"italic",Icon:yr,title:"Italic (Ctrl+I)"},{markName:"underline",Icon:vr,title:"Underline (Ctrl+U)"},{markName:"strike",Icon:Cr,title:"Strikethrough"}],wc=[{label:"Default",value:null},{label:"Red",value:"#e03131"},{label:"Orange",value:"#e8590c"},{label:"Green",value:"#2f9e44"},{label:"Blue",value:"#1971c2"},{label:"Purple",value:"#9c36b5"}],Cc=[{label:"None",value:null},{label:"Yellow",value:"#fff3bf"},{label:"Green",value:"#d3f9d8"},{label:"Blue",value:"#d0ebff"},{label:"Pink",value:"#ffdeeb"},{label:"Gray",value:"#e9ecef"}];function Bc({isOpen:e,rect:n,kind:t,selection:o,crossSelection:r,marks:l,store:s}){var T,S;const[c,i]=f.useState(null),[u,d]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>{if(!c)return;const w=v=>{p.current&&!p.current.contains(v.target)&&i(null)},B=v=>{v.key==="Escape"&&i(null)};return document.addEventListener("mousedown",w),document.addEventListener("keydown",B),()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",B)}},[c]),f.useEffect(()=>{i(null)},[n,t]);const b=f.useCallback(w=>{const B=t==="same-block"?Ee(s,o.blockId,o,w):an(s,r,w);B&&G(B),i(null)},[s,t,o,r]),m=f.useCallback(w=>{const B=t==="same-block"?Jn(s,o.blockId,o,w):Qn(s,r,w);B&&G(B)},[s,t,o,r]),h=f.useCallback(w=>{const B=w==="subscript"?"superscript":"subscript",v=!l[w];b({[w]:v?!0:null,[B]:null})},[l,b]),g=f.useRef(null),k=f.useCallback(()=>{g.current={kind:t,selection:o,crossSelection:r},d(!0)},[t,o,r]),x=f.useCallback(()=>d(!1),[]),y=f.useCallback(w=>{const B=g.current;if(!B)return;const v=B.kind==="same-block"?Ee(s,B.selection.blockId,B.selection,w):an(s,B.crossSelection,w);v&&G(v),d(!1)},[s]),I=f.useCallback((w,B)=>y({link:{href:w,target:B}}),[y]),E=f.useCallback(()=>y({link:null}),[y]);return(!e||!n)&&!u?null:a.jsxs(a.Fragment,{children:[e&&n&&a.jsxs("div",{ref:p,className:"be-floating-toolbar",role:"toolbar","aria-label":"Text formatting",style:{position:"fixed",top:n.top-44,left:n.left+n.width/2,transform:"translateX(-50%)"},onMouseDown:w=>w.preventDefault(),children:[Ic.map(({markName:w,Icon:B,title:v})=>a.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l[w]?" be-floating-toolbar-btn-active":""}`,title:v,"aria-label":v,"aria-pressed":!!l[w],onClick:()=>m(w),children:a.jsx(B,{})},w)),a.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l.subscript?" be-floating-toolbar-btn-active":""}`,title:"Subscript","aria-pressed":!!l.subscript,onClick:()=>h("subscript"),children:"X₂"}),a.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l.superscript?" be-floating-toolbar-btn-active":""}`,title:"Superscript","aria-pressed":!!l.superscript,onClick:()=>h("superscript"),children:"X²"}),a.jsx("span",{className:"be-floating-toolbar-divider"}),a.jsxs("div",{className:"be-floating-toolbar-picker-wrap",children:[a.jsx("button",{type:"button",className:"be-floating-toolbar-btn",title:"Text color","aria-haspopup":"true","aria-expanded":c==="color",onClick:()=>i(w=>w==="color"?null:"color"),children:a.jsx("span",{style:{color:l.color||"inherit",fontWeight:700},children:"A"})}),c==="color"&&a.jsx("div",{className:"be-floating-toolbar-picker",role:"menu","aria-label":"Text color",children:wc.map(w=>a.jsx("button",{type:"button",role:"menuitem",className:"be-floating-toolbar-swatch",title:w.label,onClick:()=>b({color:w.value}),children:a.jsx("span",{style:{color:w.value||"#1a1a1a",fontWeight:700},children:"A"})},w.label))})]}),a.jsxs("div",{className:"be-floating-toolbar-picker-wrap",children:[a.jsx("button",{type:"button",className:"be-floating-toolbar-btn",title:"Highlight","aria-haspopup":"true","aria-expanded":c==="highlight",onClick:()=>i(w=>w==="highlight"?null:"highlight"),children:a.jsx("span",{style:{backgroundColor:l.highlight||"transparent",padding:"0 2px",borderRadius:2},children:"H"})}),c==="highlight"&&a.jsx("div",{className:"be-floating-toolbar-picker",role:"menu","aria-label":"Highlight color",children:Cc.map(w=>a.jsx("button",{type:"button",role:"menuitem",className:"be-floating-toolbar-swatch",style:{backgroundColor:w.value||"transparent"},title:w.label,onClick:()=>b({highlight:w.value})},w.label))})]}),a.jsx("span",{className:"be-floating-toolbar-divider"}),a.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l.link?" be-floating-toolbar-btn-active":""}`,title:"Link","aria-label":"Link","aria-pressed":!!l.link,onClick:k,children:a.jsx(wr,{})})]}),a.jsx(Rt,{isOpen:u,initialHref:((T=l.link)==null?void 0:T.href)??"",initialTarget:((S=l.link)==null?void 0:S.target)??"_self",hasExistingLink:!!l.link,onSave:I,onRemove:E,onClose:x})]})}function Rc(e){const n=D(),[t,o]=f.useState(null);return f.useEffect(()=>{const r=e.current;if(!r)return;const l=()=>{var d,p,b;const s=(d=window.getSelection)==null?void 0:d.call(window);if(!s||s.rangeCount===0||s.isCollapsed){o(null);return}if(!r.contains(s.anchorNode)||!r.contains(s.focusNode)){o(null);return}const c=((b=(p=s.getRangeAt(0)).getBoundingClientRect)==null?void 0:b.call(p))??{top:0,left:0,right:0,bottom:0,width:0,height:0},i=Ge();if(i){o({kind:"same-block",rect:c,selection:i,marks:Jo(n,i.blockId,i)});return}const u=ze(n);if(u){o({kind:"cross-block",rect:c,crossSelection:u,marks:Qo(n,u)});return}o(null)};return document.addEventListener("selectionchange",l),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),()=>{document.removeEventListener("selectionchange",l),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)}},[e,n]),{isOpen:!!t,rect:(t==null?void 0:t.rect)??null,kind:(t==null?void 0:t.kind)??null,selection:(t==null?void 0:t.selection)??null,crossSelection:(t==null?void 0:t.crossSelection)??null,marks:(t==null?void 0:t.marks)??{},close:()=>o(null)}}function Tc({id:e,label:n,placeholder:t,variant:o,options:r,onManage:l,mention:s=!1}){const c=D(),i=xe(e),u=f.useCallback((m,h)=>{c.applyOperation(X(e,{data:{selectedValue:m,selectedLabel:(h==null?void 0:h.label)??"",selectedColor:h==null?void 0:h.color}}))},[c,e]);if(!i)return null;const{selectedValue:d="",selectedLabel:p="",selectedColor:b}=i.data??{};return a.jsx("span",{className:"be-inline-select",onMouseDown:m=>{m.preventDefault(),m.stopPropagation()},onKeyDown:m=>m.stopPropagation(),children:a.jsx(Ae,{value:d,selectedLabel:p,selectedColor:b,options:r,onChange:u,placeholder:t,variant:o,ariaLabel:n,onManageOptions:l,mention:s})})}function or(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function kt(e){return or(e).replace(/"/g,""")}function rr({type:e,label:n,placeholder:t="Select…",variant:o="default",icon:r,options:l,onManage:s,triggers:c=["slash"],mention:i=c.includes("at")}){function u(h){var x,y;const g=((x=h.data)==null?void 0:x.selectedLabel)||"",k=i&&g?`@${g}`:g;return`<span data-inline-type="${kt(e)}" data-selected-value="${kt(((y=h.data)==null?void 0:y.selectedValue)??"")}">${or(k)}</span>`}function d(h){var k;const g=((k=h.data)==null?void 0:k.selectedLabel)??"";return i&&g?`@${g}`:g}function p(h){var x;if(((x=h.getAttribute)==null?void 0:x.call(h,"data-inline-type"))!==e)return null;const g=h.textContent??"",k=i&&g.startsWith("@")?g.slice(1):g;return{id:R(),type:e,value:"",marks:{},data:{selectedValue:h.getAttribute("data-selected-value")??"",selectedLabel:k}}}function b({id:h}){return a.jsx(Tc,{id:h,label:n,placeholder:t,variant:o,options:l,onManage:s,mention:i})}const m={label:n,icon:r,keywords:[n.toLowerCase(),"select","field"],run:(h,{blockId:g,runId:k,sliceStart:x,sliceEnd:y})=>mn(h,{blockId:g,runId:k,sliceStart:x,sliceEnd:y},()=>({id:R(),type:e,value:"",marks:{},data:{selectedValue:"",selectedLabel:"",selectedColor:void 0}}))};return{component:b,isAtomic:!0,toHTML:u,toPlainText:d,fromHTML:p,slashCommand:c.includes("slash")?m:void 0,atCommand:c.includes("at")?m:void 0}}function lr(e,n,{onManage:t}={}){for(const o of e.getFieldTypes())n.register(o.id,rr({type:o.id,label:o.label,placeholder:o.placeholder,variant:o.variant,options:o.options??[],onManage:t?()=>t(o.id):void 0}))}function sr(){const e=D(),n=ke(),t=Uo(),{openEdit:o}=Mn(),r=f.useRef([]);f.useEffect(()=>{if(!n)return;const l=new Set(t.map(s=>s.id));for(const s of r.current)l.has(s)||n.unregister(s);lr(e,n,{onManage:o}),r.current=[...l]},[e,n,t,o])}function jc(){sr();const e=D(),{target:n,close:t}=Mn(),o=n!==null,r=o&&n!=="new",[l,s]=f.useState(""),[c,i]=f.useState([]),[u,d]=f.useState("");f.useEffect(()=>{if(o){if(r){const k=e.getFieldType(n);s((k==null?void 0:k.label)??""),i((k==null?void 0:k.options)??[])}else s(""),i([]);d("")}},[o,r,n,e]);const p=f.useCallback((k,x)=>{i(y=>y.map(I=>I.value===k?{...I,label:x}:I))},[]),b=f.useCallback(k=>{i(x=>x.filter(y=>y.value!==k))},[]),m=f.useCallback(()=>{const k=u.trim();d(""),k&&i(x=>[...x,{value:R(),label:k,color:Ue(x.length)}])},[u]),h=f.useCallback(()=>{const k=l.trim();k&&(r?e.applyOperation(Sn(n,{label:k,options:c})):e.applyOperation(jn({id:R(),label:k,placeholder:"Select…",variant:"tag",options:c})),t())},[e,r,n,l,c,t]),g=f.useCallback(()=>{r&&e.applyOperation(En(n)),t()},[e,r,n,t]);return a.jsxs(cn,{isOpen:o,onClose:t,title:r?"Edit field type":"New field type",children:[a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"Name"}),a.jsx("input",{type:"text",value:l,onChange:k=>s(k.target.value),placeholder:"e.g. Priority, Status…",autoFocus:!0})]}),a.jsxs("div",{className:"be-modal-field",children:[a.jsx("span",{children:"Options"}),c.map((k,x)=>a.jsxs("div",{className:"be-table-header-menu-option-row",children:[a.jsx("span",{className:"be-table-header-menu-option-swatch",style:{background:(k.color??Ue(x)).bg},"aria-hidden":"true"}),a.jsx("input",{className:"be-table-header-menu-option-input",value:k.label,onChange:y=>p(k.value,y.target.value),"aria-label":`Rename option ${k.label}`}),a.jsx("button",{type:"button",className:"be-table-header-menu-option-remove",onClick:()=>b(k.value),"aria-label":`Remove option ${k.label}`,children:a.jsx(Ve,{size:14})})]},k.value)),a.jsxs("div",{className:"be-table-header-menu-option-row",children:[a.jsx("input",{className:"be-table-header-menu-option-input",value:u,onChange:k=>d(k.target.value),placeholder:"New option…",onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),m())}}),a.jsx("button",{type:"button",className:"be-table-header-menu-option-add",onClick:m,"aria-label":"Add option",children:"+"})]})]}),a.jsxs("div",{className:"be-modal-actions",children:[r&&a.jsx("button",{type:"button",className:"be-modal-delete",onClick:g,children:"Delete field type"}),a.jsx("button",{type:"button",className:"be-modal-cancel",onClick:t,children:"Cancel"}),a.jsx("button",{type:"button",className:"be-modal-save",onClick:h,children:"Save"})]})]})}exports.APP_MIME=ln;exports.BlockChildren=we;exports.BlockErrorBoundary=Ut;exports.BlockGutterRow=Vt;exports.BlockRangeActionMenu=tc;exports.BlockRegistry=xt;exports.BlockRenderer=Un;exports.COLUMN_TYPES=Jt;exports.DEFAULT_COLUMN_TYPE=fn;exports.DEFAULT_COLUMN_WIDTH=bn;exports.EditableBlockContent=me;exports.EditorProvider=mr;exports.EditorStore=On;exports.EditorTrailingSpace=ac;exports.FieldTypeEditorModal=jc;exports.FloatingToolbar=Bc;exports.History=pr;exports.InlineRegistry=yt;exports.LAYOUT_BLOCKS=Oo;exports.MIN_COLUMN_WIDTH=rn;exports.Modal=cn;exports.Select=Ae;exports.SlashMenu=ic;exports.TABLE_BLOCKS=Eo;exports.TABLE_SELECT_INLINE_TYPES=zo;exports.TableHeaderRow=ao;exports.blankRunForType=Qt;exports.blockquoteBlockType=yo;exports.buttonBlockType=Co;exports.calloutBlockType=xo;exports.checkboxInlineType=Do;exports.codeBlockType=vo;exports.convertRunToType=Zt;exports.copyBlockRangeToClipboard=Tn;exports.createBlockRegistry=fr;exports.createCellForColumn=hn;exports.createDefaultColumns=Wn;exports.createInlineRegistry=br;exports.createSelectFieldType=rr;exports.dateInlineType=Ao;exports.deleteBlockAndFocusSibling=qn;exports.deleteBlockRange=$e;exports.deleteColumn=oo;exports.deleteEntireDocument=sn;exports.deleteOverBlockRange=Xn;exports.deleteRow=to;exports.deleteRunRangeInBlock=Gn;exports.deserializeClipboard=Ko;exports.dividerBlockType=go;exports.duplicateBlock=Kt;exports.embedBlockType=jo;exports.emojiInlineType=$o;exports.ensureRootNonEmpty=Ne;exports.focusRunAtOffset=pe;exports.focusRunEnd=G;exports.focusRunStart=An;exports.getMarksSummaryOverBlockRange=Qo;exports.getMarksSummaryOverSelection=Jo;exports.headingBlockType=zt;exports.injectDefaultStyles=vt;exports.insertColumnAfter=In;exports.insertRowAfter=no;exports.isEntireBlockRangeHidden=Yo;exports.isEntireBlockSelected=tr;exports.layoutBlockType=mo;exports.layoutColumnBlockType=ho;exports.listItemBlockType=Xt;exports.moveBlockDown=Wt;exports.moveBlockRangeDown=Vo;exports.moveBlockRangeUp=Wo;exports.moveBlockUp=qt;exports.operations=ur;exports.paragraphBlockType=Ht;exports.registerBlocks=So;exports.registerBuiltInBlocks=ga;exports.registerBuiltInInlineTypes=$a;exports.registerInlineTypes=Ho;exports.registerStoredFieldTypes=lr;exports.remapSubtreeIds=Kn;exports.renameColumn=lo;exports.reorderBlockRangeFromStore=Bn;exports.resolveCollapsedCaret=Ye;exports.resolveColumns=ce;exports.resolveCrossBlockSelection=ze;exports.resolveMultiRunSelection=Ge;exports.resolveRunSelection=ol;exports.selectInlineType=No;exports.serializeBlockRange=Fn;exports.setBlockRangeHidden=Go;exports.setColumnOptions=tn;exports.setColumnType=so;exports.setColumnWidth=ro;exports.setMarksOverBlockRange=an;exports.setMarksOverSelection=Ee;exports.tableBlockType=po;exports.tableCellBlockType=io;exports.tableRowBlockType=uo;exports.tableSelectInlineType=Po;exports.textToParagraphs=Yn;exports.toggleHeadingBlockType=Io;exports.toggleMarkOnRunRange=Qa;exports.toggleMarkOverBlockRange=Qn;exports.toggleMarkOverSelection=Jn;exports.useAtMenuTrigger=vc;exports.useBlock=te;exports.useBlockChildren=zn;exports.useBlockRangeDrag=sc;exports.useBlockRangeSelection=qe;exports.useBlockRegistry=Ke;exports.useClipboardHandlers=Wa;exports.useEditorKeyboardShortcuts=nc;exports.useEditorStore=D;exports.useEmojiMenuTrigger=xc;exports.useFieldTypeEditor=Mn;exports.useFieldTypes=Uo;exports.useFloatingToolbarTrigger=Rc;exports.useHistory=Ua;exports.useInlineRegistry=ke;exports.usePreviewMode=Nn;exports.useRegisterFieldTypes=sr;exports.useRun=xe;exports.useSelectedBlock=he;exports.useSlashMenuTrigger=fc;exports.useWholeDocumentSelection=Ln;exports.walkDomToBlocks=Fo;
|
|
9
1821
|
//# sourceMappingURL=noteloom.cjs.map
|