define("local_treestudyplan/simpleline/simpleline",["exports","./css-calc"],(function(_exports,_cssCalc){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.SimpleLine=void0;constspecsCopy=(to,from)=>{for(constixinto)from.hasOwnProperty(ix)&&("object"==typeofto[ix]&&"object"==typeoffrom[ix]?Array.isArray(to[ix])?Array.isArray(from[ix])&&(to[ix]=Array.from(from[ix])):specsCopy(to[ix],from[ix]):to[ix]=from[ix])},debounce=(func,delay)=>{lettimer;returnfunction(){for(var_len=arguments.length,args=newArray(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];constcontext=this;clearTimeout(timer),timer=setTimeout((()=>{func.apply(context,args)}),delay)}},getElementPosition=(el,reference)=>{if(!(el&&elinstanceofHTMLElement))return{x:0,y:0};if(reference&&referenceinstanceofHTMLElement||(reference=document.querySelector("body")),el.offsetParent===reference)return{x:el.offsetLeft,y:el.offsetTop};{constelR=el.getBoundingClientRect(),refR=reference.getBoundingClientRect();return{x:elR.left-refR.left,y:elR.top-refR.top}}};classSimpleLine{constructor(start,end,config){if(this.svg=null,this.id=SimpleLine.idCounter++,this.setConfig(config),startinstanceofHTMLElement)this.start=start;else{if(!("string"==typeofstart||this.startinstanceofString))returnvoidconsole.error("Start element not string or dom element",start);if(this.startSelector=start,this.start=document.querySelector(start),!(this.startinstanceofHTMLElement))returnvoidconsole.error("Cannot find start element:",start)}if(endinstanceofHTMLElement)this.end=end;else{if(!("string"==typeofend||this.endinstanceofString))returnvoidconsole.error("End element not string or dom element",start);if(this.endSelector=end,this.end=document.querySelector(end),!(this.endinstanceofHTMLElement))returnvoidconsole.error("Cannot find end element:",end)}this.resizeObserver=newResizeObserver(debounce((()=>{this.update()}),20)),this.resizeObserver.observe(this.start),this.resizeObserver.observe(this.end),this.mutationObserver=newMutationObserver((function(mutations_list){mutations_list.forEach((function(mutation){mutation.removedNodes.forEach((function(removed_node){this&&(removed_node!=this.start&&removed_node!=this.end||(console.warning("Element removed",removed_node),this.remove()))}))}))})),this.mutationObserver.observe(this.start.parentElement,{subtree:!1,childList:!0}),this.mutationObserver.observe(this.end.parentElement,{subtree:!1,childList:!0}),this.positionCheck(),this.specs.autorefresh>0&&(this.refreshTimer=setInterval((()=>{this.positionCheck()}),this.specs.autorefresh)),this.active=!0,this.update()}setConfig(config){this.specs||(this.specs={autorefresh:10,class:"",color:"",anchors:{start:["middle","right"],end:["middle","left"]},gravity:{start:1,end:1},stroke:"4px"}),config&&"object"==typeofconfig&&specsCopy(this.specs,config),this.svg&&(clearInterval(this.refreshTimer),this.specs.autorefresh>0&&(this.refreshTimer=setInterval((()=>{this.positionCheck()}),this.specs.autorefresh)),this.update())}getcssClass(){returnthis.specs.class}setcssClass(cssClass){this.specs.class=cssClass,this.update()}positionCheck(){conststartPos={x:this.start.offsetLeft,y:this.start.offsetTop},endPos={x:this.end.offsetLeft,y:this.end.offsetTop};letneedUpdate=!1;this.startPos&&(needUpdate=needUpdate||this.startPos.x!=startPos.x||this.startPos.y!=startPos.y),this.startPos=startPos,this.endPos&&(needUpdate=needUpdate||this.endPos.x!=endPos.x||this.endPos.y!=endPos.y),this.endPos=endPos,needUpdate&&this.update()}getContainer(){letcontainer=this.start.offsetParent;returncontainer||("fixed"==getComputedStyle(this.start).position?container=document.querySelector("body"):console.error("Start element has no offsetParent. likely ")),container}getAnchorPoint(anchor){letx,dirX,y,dirY,el=this.start;return"start"!=anchor&&(anchor="end",el=this.end),this.specs.anchors[anchor].includes("left")?(x=0,dirX=-1):this.specs.anchors[anchor].includes("right")?(x=el.offsetWidth-1,dirX=1):(x=el.offsetWidth/2,dirX=0),this.specs.anchors[anchor].includes("top")?(y=0,dirY=-1):th