"use strict";var T=Object.defineProperty;var v=(o,e,t)=>e in o?T(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var l=(o,e,t)=>(v(o,typeof e!="symbol"?e+"":e,t),t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("../../../../parchment@3.0.0/node_modules/parchment/dist/parchment.js"),g=require("./text.js"),i=class i extends m.EmbedBlot{static value(){}constructor(e,t,s){super(e,t),this.selection=s,this.textNode=document.createTextNode(i.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){this.parent!=null&&this.parent.removeChild(this)}format(e,t){if(this.savedLength!==0){super.format(e,t);return}let s=this,n=0;for(;s!=null&&s.statics.scope!==m.Scope.BLOCK_BLOT;)n+=s.offset(s.parent),s=s.parent;s!=null&&(this.savedLength=i.CONTENTS.length,s.optimize(),s.formatAt(n,i.CONTENTS.length,e,t),this.savedLength=0)}index(e,t){return e===this.textNode?0:super.index(e,t)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||this.parent==null)return null;const e=this.selection.getNativeRange();for(;this.domNode.lastChild!=null&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);const t=this.prev instanceof g.default?this.prev:null,s=t?t.length():0,n=this.next instanceof g.default?this.next:null,x=n?n.text:"",{textNode:h}=this,a=h.data.split(i.CONTENTS).join("");h.data=i.CONTENTS;let r;if(t)r=t,(a||n)&&(t.insertAt(t.length(),a+x),n&&n.remove());else if(n)r=n,n.insertAt(0,a);else{const d=document.createTextNode(a);r=this.scroll.create(d),this.parent.insertBefore(r,this)}if(this.remove(),e){const d=(u,c)=>t&&u===t.domNode?c:u===h?s+c-1:n&&u===n.domNode?s+a.length+c:null,f=d(e.start.node,e.start.offset),p=d(e.end.node,e.end.offset);if(f!==null&&p!==null)return{startNode:r.domNode,startOffset:f,endNode:r.domNode,endOffset:p}}return null}update(e,t){if(e.some(s=>s.type==="characterData"&&s.target===this.textNode)){const s=this.restore();s&&(t.range=s)}}optimize(e){super.optimize(e);let{parent:t}=this;for(;t;){if(t.domNode.tagName==="A"){this.savedLength=i.CONTENTS.length,t.isolate(this.offset(t),this.length()).unwrap(),this.savedLength=0;break}t=t.parent}}value(){return""}};l(i,"blotName","cursor"),l(i,"className","ql-cursor"),l(i,"tagName","span"),l(i,"CONTENTS","\uFEFF");let N=i;exports.default=N;
