import{C as i}from"./codemirror-CVZ5hDL3.js";import"./index-Cq7z4i0o.js";import"./codemirror-DpyRu-EA.js";i.defineOption("info",!1,(e,t,n)=>{if(n&&n!==i.Init){const o=e.state.info.onMouseOver;i.off(e.getWrapperElement(),"mouseover",o),clearTimeout(e.state.info.hoverTimeout),delete e.state.info}if(t){const o=e.state.info=h(t);o.onMouseOver=y.bind(null,e),i.on(e.getWrapperElement(),"mouseover",o.onMouseOver)}});function h(e){return{options:e instanceof Function?{render:e}:e===!0?{}:e}}function M(e){const{options:t}=e.state.info;return t?.hoverTime||500}function y(e,t){const n=e.state.info,o=t.target||t.srcElement;if(!(o instanceof HTMLElement)||o.nodeName!=="SPAN"||n.hoverTimeout!==void 0)return;const r=o.getBoundingClientRect(),u=function(){clearTimeout(n.hoverTimeout),n.hoverTimeout=setTimeout(f,p)},s=function(){i.off(document,"mousemove",u),i.off(e.getWrapperElement(),"mouseout",s),clearTimeout(n.hoverTimeout),n.hoverTimeout=void 0},f=function(){i.off(document,"mousemove",u),i.off(e.getWrapperElement(),"mouseout",s),n.hoverTimeout=void 0,E(e,r)},p=M(e);n.hoverTimeout=setTimeout(f,p),i.on(document,"mousemove",u),i.on(e.getWrapperElement(),"mouseout",s)}function E(e,t){const n=e.coordsChar({left:(t.left+t.right)/2,top:(t.top+t.bottom)/2},"window"),o=e.state.info,{options:r}=o,u=r.render||e.getHelper(n,"info");if(u){const s=e.getTokenAt(n,!0);if(s){const f=u(s,r,e,n);f&&O(e,t,f)}}}function O(e,t,n){const o=document.createElement("div");o.className="CodeMirror-info",o.append(n),document.body.append(o);const r=o.getBoundingClientRect(),{marginLeft:u,marginRight:s,marginBottom:f,marginTop:p}=getComputedStyle(o),g=r.right-r.left+parseFloat(u)+parseFloat(s),d=r.bottom-r.top+parseFloat(p)+parseFloat(f);let m=t.bottom;d>window.innerHeight-t.bottom-15&&t.top>window.innerHeight-t.bottom&&(m=t.top-d),m<0&&(m=t.bottom);let l=Math.max(0,window.innerWidth-g-15);l>t.left&&(l=t.left),o.style.opacity="1",o.style.top=m+"px",o.style.left=l+"px";let c;const v=function(){clearTimeout(c)},a=function(){clearTimeout(c),c=setTimeout(T,200)},T=function(){i.off(o,"mouseover",v),i.off(o,"mouseout",a),i.off(e.getWrapperElement(),"mouseout",a),o.style.opacity?(o.style.opacity="0",setTimeout(()=>{o.parentNode&&o.remove()},600)):o.parentNode&&o.remove()};i.on(o,"mouseover",v),i.on(o,"mouseout",a),i.on(e.getWrapperElement(),"mouseout",a)}
//# sourceMappingURL=info-addon-BV_WI0ud.js.map
