var Yt=(function(){var X,te,G,Be,Ke,ct,dt,Je,Re,ft,Mt,yt,It,pe="leader-line",Oe=1,Me=2,Pe=3,Le=4,$e={top:Oe,right:Me,bottom:Pe,left:Le},Ct=1,Lt=2,mt=3,St=4,At=5,Vt={straight:Ct,arc:Lt,fluid:mt,magnet:St,grid:At},Ie="behind",Xt=pe+"-defs",qt='',et={disc:{elmId:"leader-line-disc",noRotate:!0,bBox:{left:-5,top:-5,width:10,height:10,right:5,bottom:5},widthR:2.5,heightR:2.5,bCircle:5,sideLen:5,backLen:5,overhead:0,outlineBase:1,outlineMax:4},square:{elmId:"leader-line-square",noRotate:!0,bBox:{left:-5,top:-5,width:10,height:10,right:5,bottom:5},widthR:2.5,heightR:2.5,bCircle:5,sideLen:5,backLen:5,overhead:0,outlineBase:1,outlineMax:4},arrow1:{elmId:"leader-line-arrow1",bBox:{left:-8,top:-8,width:16,height:16,right:8,bottom:8},widthR:4,heightR:4,bCircle:8,sideLen:8,backLen:8,overhead:8,outlineBase:2,outlineMax:1.5},arrow2:{elmId:"leader-line-arrow2",bBox:{left:-7,top:-8,width:11,height:16,right:4,bottom:8},widthR:2.75,heightR:4,bCircle:8,sideLen:8,backLen:7,overhead:4,outlineBase:1,outlineMax:1.75},arrow3:{elmId:"leader-line-arrow3",bBox:{left:-4,top:-5,width:12,height:10,right:8,bottom:5},widthR:3,heightR:2.5,bCircle:8,sideLen:5,backLen:4,overhead:8,outlineBase:1,outlineMax:2.5},hand:{elmId:"leader-line-hand",bBox:{left:-3,top:-12,width:40,height:24,right:37,bottom:12},widthR:10,heightR:6,bCircle:37,sideLen:12,backLen:3,overhead:37},crosshair:{elmId:"leader-line-crosshair",noRotate:!0,bBox:{left:-96,top:-96,width:192,height:192,right:96,bottom:96},widthR:48,heightR:48,bCircle:96,sideLen:96,backLen:96,overhead:0}},gt={behind:Ie,disc:"disc",square:"square",arrow1:"arrow1",arrow2:"arrow2",arrow3:"arrow3",hand:"hand",crosshair:"crosshair"},tt={disc:"disc",square:"square",arrow1:"arrow1",arrow2:"arrow2",arrow3:"arrow3",hand:"hand",crosshair:"crosshair"},_t=[Oe,Me,Pe,Le],Ne="auto",Pt={x:"left",y:"top",width:"width",height:"height"},Qt=80,Nt=4,Kt=5,Jt=120,Tt=8,$t=3.75,Fe=10,ke=30,nt=.5522847,en=.25*Math.PI,Wt=/^\s*(\-?[\d\.]+)\s*(\%)?\s*$/,D="http://www.w3.org/2000/svg",at="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style&&!window.navigator.msPointerEnabled,_e=!at&&!!document.uniqueID,Ge="MozAppearance"in document.documentElement.style,it=!(at||Ge||!window.chrome||!window.CSS),le=!at&&!_e&&!Ge&&!it&&!window.chrome&&"WebkitAppearance"in document.documentElement.style,Bt=_e||at?.2:.1,ge={path:mt,lineColor:"coral",lineSize:4,plugSE:[Ie,"arrow1"],plugSizeSE:[1,1],lineOutlineEnabled:!1,lineOutlineColor:"indianred",lineOutlineSize:.25,plugOutlineEnabledSE:[!1,!1],plugOutlineSizeSE:[1,1]},Ae=(Mt={}.toString,yt={}.hasOwnProperty.toString,It=yt.call(Object),function(e){var t,n;return e&&Mt.call(e)==="[object Object]"&&(!(t=Object.getPrototypeOf(e))||(n=t.hasOwnProperty("constructor")&&t.constructor)&&typeof n=="function"&&yt.call(n)===It)}),Se=Number.isFinite||function(e){return typeof e=="number"&&window.isFinite(e)},he=(function(){var e,t={ease:[.25,.1,.25,1],linear:[0,0,1,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]},n=1e3/60/2,a=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(p){setTimeout(p,n)},i=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||function(p){clearTimeout(p)},o=Number.isFinite||function(p){return typeof p=="number"&&window.isFinite(p)},g=[],d=0;function S(){var p=Date.now(),x=!1;e&&(i.call(window,e),e=null),g.forEach(function(s){var u,h,m;if(s.framesStart){if((u=p-s.framesStart)>=s.duration&&s.count&&s.loopsLeft<=1)return m=s.frames[s.lastFrame=s.reverse?0:s.frames.length-1],s.frameCallback(m.value,!0,m.timeRatio,m.outputRatio),void(s.framesStart=null);if(u>s.duration){if(h=Math.floor(u/s.duration),s.count){if(h>=s.loopsLeft)return m=s.frames[s.lastFrame=s.reverse?0:s.frames.length-1],s.frameCallback(m.value,!0,m.timeRatio,m.outputRatio),void(s.framesStart=null);s.loopsLeft-=h}s.framesStart+=s.duration*h,u=p-s.framesStart}s.reverse&&(u=s.duration-u),m=s.frames[s.lastFrame=Math.round(u/n)],s.frameCallback(m.value,!1,m.timeRatio,m.outputRatio)!==!1?x=!0:s.framesStart=null}}),x&&(e=a.call(window,S))}function r(p,x){p.framesStart=Date.now(),x!=null&&(p.framesStart-=p.duration*(p.reverse?1-x:x)),p.loopsLeft=p.count,p.lastFrame=null,S()}return{add:function(p,x,s,u,h,m,E){var w,M,O,v,c,y,f,L,P,C,l,k,I,W=++d;function R(V,_){return{value:p(_),timeRatio:V,outputRatio:_}}if(typeof h=="string"&&(h=t[h]),p=p||function(){},s=this._endIndex||this._string[this._currentIndex]<"0"||"9"=this._endIndex||this._string[this._currentIndex]<"0"||"9"=this._endIndex)return null;var s=null,u=this._string[this._currentIndex];if(this._currentIndex+=1,u==="0")s=0;else{if(u!=="1")return null;s=1}return this._skipOptionalSpacesOrDelimiter(),s}};var i=function(s){if(!s||s.length===0)return[];var u=new n(s),h=[];if(u.initialCommandIsMoveTo())for(;u.hasMoreData();){var m=u.parseSegment();if(m===null)break;h.push(m)}return h},o=e.SVGPathElement.prototype.setAttribute,g=e.SVGPathElement.prototype.removeAttribute,d=e.Symbol?e.Symbol():"__cachedPathData",S=e.Symbol?e.Symbol():"__cachedNormalizedPathData",r=function(s,u,h,m,E,w,M,O,v,c){var y,f,L,P,C,l=function(ee,q,oe){return{x:ee*Math.cos(oe)-q*Math.sin(oe),y:ee*Math.sin(oe)+q*Math.cos(oe)}},k=(y=M,Math.PI*y/180),I=[];if(c)f=c[0],L=c[1],P=c[2],C=c[3];else{var W=l(s,u,-k);s=W.x,u=W.y;var R=l(h,m,-k),V=(s-(h=R.x))/2,_=(u-(m=R.y))/2,z=V*V/(E*E)+_*_/(w*w);1120*Math.PI/180){var ye=L,He=h,U=m;L=v&&f=Math.abs(I)?0<=k?Me:Le:0<=I?Pe:Oe))})),c.position_path!==y.position_path||c.position_lineStrokeWidth!==y.position_lineStrokeWidth||[0,1].some(function(l){return c.position_plugOverheadSE[l]!==y.position_plugOverheadSE[l]||(R=f[l],V=y.position_socketXYSE[l],R.x!==V.x||R.y!==V.y||R.socketId!==V.socketId)||(k=t[l],I=y.position_socketGravitySE[l],(W=k==null?"auto":Array.isArray(k)?"array":"number")!=(I==null?"auto":Array.isArray(I)?"array":"number")||(W==="array"?k[0]!==I[0]||k[1]!==I[1]:k!==I));var k,I,W,R,V})){switch(e.pathList.baseVal=a=[],e.pathList.animVal=null,c.position_path){case Ct:a.push([C(f[0]),C(f[1])]);break;case Lt:s=typeof t[0]=="number"&&0Nt?(c.position_lineStrokeWidth-Nt)*Kt:0),l.socketId===Oe?((_=(l.y-W.y)/2)=B.x:B.dirId===W?U.y>=B.y:U.x<=B.x}function ne(U,B){return B.dirId===k||B.dirId===W?U.x===B.x:U.y===B.y}function ae(U){return U[0]?{contain:0,notContain:1}:{contain:1,notContain:0}}function K(U,B,N){return Math.abs(B[N]-U[N])}function ye(U,B,N){return N==="x"?U.x=ke?ye(_[B.notContain],_[B.contain],Y[B.contain]):_[B.contain].dirId)):(Z=[{x:_[0].x,y:_[0].y},{x:_[1].x,y:_[1].y}],V.forEach(function(re,$){var xe=$===0?1:0,be=K(Z[$],Z[xe],Y[$]);beFe&&(S[W]-lFe&&(S[W]-lq.outlineMax&&(j=q.outlineMax),j*=2*q.outlineBase,v=A(w,O.plugOutline_strokeWidthSE,b,j)||v,v=A(w,O.plugOutline_inStrokeWidthSE,b,O.plugOutline_colorTraSE[b]?j-Bt/(O.line_strokeWidth/ge.lineSize)/M.plugSizeSE[b]*2:j/2)||v)}),v)),(t.faces||J.line||J.plug||J.lineOutline||J.plugOutline)&&(J.faces=(f=(c=e).curStats,L=c.aplStats,P=c.events,C=!1,!f.line_altColor&&A(c,L,"line_color",y=f.line_color,P.apl_line_color)&&(c.lineFace.style.stroke=y,C=!0),A(c,L,"line_strokeWidth",y=f.line_strokeWidth,P.apl_line_strokeWidth)&&(c.lineShape.style.strokeWidth=y+"px",C=!0,(Ge||_e)&&(ie(c,c.lineShape),_e&&(ie(c,c.lineFace),ie(c,c.lineMaskCaps)))),A(c,L,"lineOutline_enabled",y=f.lineOutline_enabled,P.apl_lineOutline_enabled)&&(c.lineOutlineFace.style.display=y?"inline":"none",C=!0),f.lineOutline_enabled&&(A(c,L,"lineOutline_color",y=f.lineOutline_color,P.apl_lineOutline_color)&&(c.lineOutlineFace.style.stroke=y,C=!0),A(c,L,"lineOutline_strokeWidth",y=f.lineOutline_strokeWidth,P.apl_lineOutline_strokeWidth)&&(c.lineOutlineMaskShape.style.strokeWidth=y+"px",C=!0,_e&&(ie(c,c.lineOutlineMaskCaps),ie(c,c.lineOutlineFace))),A(c,L,"lineOutline_inStrokeWidth",y=f.lineOutline_inStrokeWidth,P.apl_lineOutline_inStrokeWidth)&&(c.lineMaskShape.style.strokeWidth=y+"px",C=!0,_e&&(ie(c,c.lineOutlineMaskCaps),ie(c,c.lineOutlineFace)))),A(c,L,"plug_enabled",y=f.plug_enabled,P.apl_plug_enabled)&&(c.plugsFace.style.display=y?"inline":"none",C=!0),f.plug_enabled&&[0,1].forEach(function(b){var j=f.plug_plugSE[b],ee=j!==Ie?et[tt[j]]:null,q=jt(b,ee);A(c,L.plug_enabledSE,b,y=f.plug_enabledSE[b],P.apl_plug_enabledSE)&&(c.plugsFace.style[q.prop]=y?"url(#"+c.plugMarkerIdSE[b]+")":"none",C=!0),f.plug_enabledSE[b]&&(A(c,L.plug_plugSE,b,j,P.apl_plug_plugSE)&&(c.plugFaceSE[b].href.baseVal="#"+ee.elmId,zt(c,c.plugMarkerSE[b],q.orient,ee.bBox,c.svg,c.plugMarkerShapeSE[b],c.plugsFace),C=!0,Ge&&ie(c,c.plugsFace)),A(c,L.plug_colorSE,b,y=f.plug_colorSE[b],P.apl_plug_colorSE)&&(c.plugFaceSE[b].style.fill=y,C=!0,(it||le||_e)&&!f.line_colorTra&&ie(c,_e?c.lineMaskCaps:c.capsMaskLine)),["markerWidth","markerHeight"].forEach(function(oe){var Ce="plug_"+oe+"SE";A(c,L[Ce],b,y=f[Ce][b],P["apl_"+Ce])&&(c.plugMarkerSE[b][oe].baseVal.value=y,C=!0)}),A(c,L.plugOutline_enabledSE,b,y=f.plugOutline_enabledSE[b],P.apl_plugOutline_enabledSE)&&(y?(c.plugFaceSE[b].style.mask="url(#"+c.plugMaskIdSE[b]+")",c.plugOutlineFaceSE[b].style.display="inline"):(c.plugFaceSE[b].style.mask="none",c.plugOutlineFaceSE[b].style.display="none"),C=!0),f.plugOutline_enabledSE[b]&&(A(c,L.plugOutline_plugSE,b,j,P.apl_plugOutline_plugSE)&&(c.plugOutlineFaceSE[b].href.baseVal=c.plugMaskShapeSE[b].href.baseVal=c.plugOutlineMaskShapeSE[b].href.baseVal="#"+ee.elmId,[c.plugMaskSE[b],c.plugOutlineMaskSE[b]].forEach(function(oe){oe.x.baseVal.value=ee.bBox.left,oe.y.baseVal.value=ee.bBox.top,oe.width.baseVal.value=ee.bBox.width,oe.height.baseVal.value=ee.bBox.height}),C=!0),A(c,L.plugOutline_colorSE,b,y=f.plugOutline_colorSE[b],P.apl_plugOutline_colorSE)&&(c.plugOutlineFaceSE[b].style.fill=y,C=!0,_e&&(ie(c,c.lineMaskCaps),ie(c,c.lineOutlineMaskCaps))),A(c,L.plugOutline_strokeWidthSE,b,y=f.plugOutline_strokeWidthSE[b],P.apl_plugOutline_strokeWidthSE)&&(c.plugOutlineMaskShapeSE[b].style.strokeWidth=y+"px",C=!0),A(c,L.plugOutline_inStrokeWidthSE,b,y=f.plugOutline_inStrokeWidthSE[b],P.apl_plugOutline_inStrokeWidthSE)&&(c.plugMaskShapeSE[b].style.strokeWidth=y+"px",C=!0)))}),C)),(t.position||J.line||J.plug)&&(J.position=rn(e)),(t.path||J.position)&&(J.path=(I=(l=e).curStats,W=l.aplStats,R=l.pathList.animVal||l.pathList.baseVal,V=I.path_edge,_=!1,R&&(V.x1=V.x2=R[0][0].x,V.y1=V.y2=R[0][0].y,I.path_pathData=k=kt(R,function(b){b.xV.x2&&(V.x2=b.x),b.y>V.y2&&(V.y2=b.y)}),lt(k,W.path_pathData)&&(l.linePath.setPathData(k),W.path_pathData=k,_=!0,_e?(ie(l,l.plugsFace),ie(l,l.lineMaskCaps)):Ge&&ie(l,l.linePath),l.events.apl_path&&l.events.apl_path.forEach(function(b){b(l,k)}))),_)),J.viewBox=(H=(z=e).curStats,ne=z.aplStats,ae=H.path_edge,K=H.viewBox_bBox,ye=ne.viewBox_bBox,He=z.svg.viewBox.baseVal,U=z.svg.style,B=!1,Q=Math.max(H.line_strokeWidth/2,H.viewBox_plugBCircleSE[0]||0,H.viewBox_plugBCircleSE[1]||0),F={x1:ae.x1-Q,y1:ae.y1-Q,x2:ae.x2+Q,y2:ae.y2+Q},z.events.new_edge4viewBox&&z.events.new_edge4viewBox.forEach(function(b){b(z,F)}),K.x=H.lineMask_x=H.lineOutlineMask_x=H.maskBGRect_x=F.x1,K.y=H.lineMask_y=H.lineOutlineMask_y=H.maskBGRect_y=F.y1,K.width=F.x2-F.x1,K.height=F.y2-F.y1,["x","y","width","height"].forEach(function(b){var j;(j=K[b])!==ye[b]&&(He[b]=ye[b]=j,U[Pt[b]]=j+(b==="x"||b==="y"?z.bodyOffset[b]:0)+"px",B=!0)}),B),J.mask=(T=(N=e).curStats,Y=N.aplStats,re=!1,T.plug_enabled?[0,1].forEach(function(b){T.capsMaskMarker_enabledSE[b]=T.plug_enabledSE[b]&&T.plug_colorTraSE[b]||T.plugOutline_enabledSE[b]&&T.plugOutline_colorTraSE[b]}):T.capsMaskMarker_enabledSE[0]=T.capsMaskMarker_enabledSE[1]=!1,T.capsMaskMarker_enabled=T.capsMaskMarker_enabledSE[0]||T.capsMaskMarker_enabledSE[1],T.lineMask_outlineMode=T.lineOutline_enabled,T.caps_enabled=T.capsMaskMarker_enabled||T.capsMaskAnchor_enabledSE[0]||T.capsMaskAnchor_enabledSE[1],T.lineMask_enabled=T.caps_enabled||T.lineMask_outlineMode,(T.lineMask_enabled&&!T.lineMask_outlineMode||T.lineOutline_enabled)&&["x","y"].forEach(function(b){var j="maskBGRect_"+b;A(N,Y,j,Z=T[j])&&(N.maskBGRect[b].baseVal.value=Z,re=!0)}),A(N,Y,"lineMask_enabled",Z=T.lineMask_enabled)&&(N.lineFace.style.mask=Z?"url(#"+N.lineMaskId+")":"none",re=!0,le&&ie(N,N.lineMask)),T.lineMask_enabled&&(A(N,Y,"lineMask_outlineMode",Z=T.lineMask_outlineMode)&&(Z?(N.lineMaskBG.style.display="none",N.lineMaskShape.style.display="inline"):(N.lineMaskBG.style.display="inline",N.lineMaskShape.style.display="none"),re=!0),["x","y"].forEach(function(b){var j="lineMask_"+b;A(N,Y,j,Z=T[j])&&(N.lineMask[b].baseVal.value=Z,re=!0)}),A(N,Y,"caps_enabled",Z=T.caps_enabled)&&(N.lineMaskCaps.style.display=N.lineOutlineMaskCaps.style.display=Z?"inline":"none",re=!0,le&&ie(N,N.capsMaskLine)),T.caps_enabled&&([0,1].forEach(function(b){var j;A(N,Y.capsMaskAnchor_enabledSE,b,Z=T.capsMaskAnchor_enabledSE[b])&&(N.capsMaskAnchorSE[b].style.display=Z?"inline":"none",re=!0,le&&ie(N,N.lineMask)),T.capsMaskAnchor_enabledSE[b]&&(lt(j=T.capsMaskAnchor_pathDataSE[b],Y.capsMaskAnchor_pathDataSE[b])&&(N.capsMaskAnchorSE[b].setPathData(j),Y.capsMaskAnchor_pathDataSE[b]=j,re=!0),A(N,Y.capsMaskAnchor_strokeWidthSE,b,Z=T.capsMaskAnchor_strokeWidthSE[b])&&(N.capsMaskAnchorSE[b].style.strokeWidth=Z+"px",re=!0))}),A(N,Y,"capsMaskMarker_enabled",Z=T.capsMaskMarker_enabled)&&(N.capsMaskLine.style.display=Z?"inline":"none",re=!0),T.capsMaskMarker_enabled&&[0,1].forEach(function(b){var j=T.capsMaskMarker_plugSE[b],ee=j!==Ie?et[tt[j]]:null,q=jt(b,ee);A(N,Y.capsMaskMarker_enabledSE,b,Z=T.capsMaskMarker_enabledSE[b])&&(N.capsMaskLine.style[q.prop]=Z?"url(#"+N.lineMaskMarkerIdSE[b]+")":"none",re=!0),T.capsMaskMarker_enabledSE[b]&&(A(N,Y.capsMaskMarker_plugSE,b,j)&&(N.capsMaskMarkerShapeSE[b].href.baseVal="#"+ee.elmId,zt(N,N.capsMaskMarkerSE[b],q.orient,ee.bBox,N.svg,N.capsMaskMarkerShapeSE[b],N.capsMaskLine),re=!0,Ge&&(ie(N,N.capsMaskLine),ie(N,N.lineFace))),["markerWidth","markerHeight"].forEach(function(oe){var Ce="capsMaskMarker_"+oe+"SE";A(N,Y[Ce],b,Z=T[Ce][b])&&(N.capsMaskMarkerSE[b][oe].baseVal.value=Z,re=!0)}))}))),T.lineOutline_enabled&&["x","y"].forEach(function(b){var j="lineOutlineMask_"+b;A(N,Y,j,Z=T[j])&&(N.lineOutlineMask[b].baseVal.value=Z,re=!0)}),re),t.effect&&(be=($=e).curStats,Ve=$.aplStats,Object.keys(X).forEach(function(b){var j=X[b],ee=b+"_enabled",q=b+"_options",oe=be[q];A($,Ve,ee,xe=be[ee])?(xe&&(Ve[q]=me(oe)),j[xe?"init":"remove"]($)):xe&&Te(oe,Ve[q])&&(j.remove($),Ve[ee]=!0,Ve[q]=me(oe),j.init($))})),(it||le)&&J.line&&!J.path&&ie(e,e.lineShape),it&&J.plug&&!J.line&&ie(e,e.plugsFace),Dt(e)}function st(e,t){return{duration:Se(e.duration)&&0t.x2&&(t.x2=a.x2),a.y2>t.y2&&(t.y2=a.y2),["x","y"].forEach(function(g){var d,S="dropShadow_"+g;i[S]=d=t[g+"1"],A(e,o,S,d)&&(e.efc_dropShadow_elmFilter[g].baseVal.value=d)}))}}},Object.keys(X).forEach(function(e){var t=X[e],n=t.stats;n[e+"_enabled"]={iniValue:!1},n[e+"_options"]={hasProps:!0},t.anim&&(n[e+"_animOptions"]={},n[e+"_animId"]={})}),te={none:{defaultAnimOptions:{},init:function(e,t){var n=e.curStats;n.show_animId&&(he.remove(n.show_animId),n.show_animId=null),te.none.start(e,t)},start:function(e,t){te.none.stop(e,!0)},stop:function(e,t,n){var a=e.curStats;return n=n!=null?n:e.aplStats.show_on,a.show_inAnim=!1,t&&je(e,n),n?1:0}},fade:{defaultAnimOptions:{duration:300,timing:"linear"},init:function(e,t){var n=e.curStats,a=e.aplStats;n.show_animId&&he.remove(n.show_animId),n.show_animId=he.add(function(i){return i},function(i,o){o?te.fade.stop(e,!0):(e.svg.style.opacity=i+"",_e&&(ie(e,e.svg),Dt(e)))},a.show_animOptions.duration,1,a.show_animOptions.timing,null,!1),te.fade.start(e,t)},start:function(e,t){var n,a=e.curStats;a.show_inAnim&&(n=he.stop(a.show_animId)),je(e,1),a.show_inAnim=!0,he.start(a.show_animId,!e.aplStats.show_on,t!=null?t:n)},stop:function(e,t,n){var a,i=e.curStats;return n=n!=null?n:e.aplStats.show_on,a=i.show_inAnim?he.stop(i.show_animId):n?1:0,i.show_inAnim=!1,t&&(e.svg.style.opacity=n?"":"0",je(e,n)),a}},draw:{defaultAnimOptions:{duration:500,timing:[.58,0,.42,1]},init:function(e,t){var n=e.curStats,a=e.aplStats,i=e.pathList.baseVal,o=Gt(i),g=o.segsLen,d=o.lenAll;n.show_animId&&he.remove(n.show_animId),n.show_animId=he.add(function(S){var r,p,x,s,u=-1;if(S===0)p=[[i[0][0],i[0][0]]];else if(S===1)p=i;else{for(r=d*S,p=[];r>=g[++u];)p.push(i[u]),r-=g[u];r&&((x=i[u]).length===2?p.push([x[0],Xe(x[0],x[1],r/g[u])]):(s=De(x[0],x[1],x[2],x[3],bt(x[0],x[1],x[2],x[3],r)),p.push([x[0],s.fromP1,s.fromP2,s])))}return p},function(S,r){r?te.draw.stop(e,!0):(e.pathList.animVal=S,ve(e,{path:!0}))},a.show_animOptions.duration,1,a.show_animOptions.timing,null,!1),te.draw.start(e,t)},start:function(e,t){var n,a=e.curStats;a.show_inAnim&&(n=he.stop(a.show_animId)),je(e,1),a.show_inAnim=!0,se(e,"apl_position",te.draw.update),he.start(a.show_animId,!e.aplStats.show_on,t!=null?t:n)},stop:function(e,t,n){var a,i=e.curStats;return n=n!=null?n:e.aplStats.show_on,a=i.show_inAnim?he.stop(i.show_animId):n?1:0,i.show_inAnim=!1,t&&(e.pathList.animVal=n?null:[[e.pathList.baseVal[0][0],e.pathList.baseVal[0][0]]],ve(e,{path:!0}),je(e,n)),a},update:function(e){ue(e,"apl_position",te.draw.update),e.curStats.show_inAnim?te.draw.init(e,te.draw.stop(e)):e.aplStats.show_animOptions={}}}},(function(){function e(t){return function(n){var a={};a[t]=n,this.setOptions(a)}}[["start","anchorSE",0],["end","anchorSE",1],["color","lineColor"],["size","lineSize"],["startSocketGravity","socketGravitySE",0],["endSocketGravity","socketGravitySE",1],["startPlugColor","plugColorSE",0],["endPlugColor","plugColorSE",1],["startPlugSize","plugSizeSE",0],["endPlugSize","plugSizeSE",1],["outline","lineOutlineEnabled"],["outlineColor","lineOutlineColor"],["outlineSize","lineOutlineSize"],["startPlugOutline","plugOutlineEnabledSE",0],["endPlugOutline","plugOutlineEnabledSE",1],["startPlugOutlineColor","plugOutlineColorSE",0],["endPlugOutlineColor","plugOutlineColorSE",1],["startPlugOutlineSize","plugOutlineSizeSE",0],["endPlugOutlineSize","plugOutlineSizeSE",1]].forEach(function(t){var n=t[0],a=t[1],i=t[2];Object.defineProperty(Ee.prototype,n,{get:function(){var o=i!=null?fe[this._id].options[a][i]:a?fe[this._id].options[a]:fe[this._id].options[n];return o==null?Ne:me(o)},set:e(n),enumerable:!0})}),[["path",Vt],["startSocket",$e,"socketSE",0],["endSocket",$e,"socketSE",1],["startPlug",gt,"plugSE",0],["endPlug",gt,"plugSE",1]].forEach(function(t){var n=t[0],a=t[1],i=t[2],o=t[3];Object.defineProperty(Ee.prototype,n,{get:function(){var g,d=o!=null?fe[this._id].options[i][o]:i?fe[this._id].options[i]:fe[this._id].options[n];return d?Object.keys(a).some(function(S){return a[S]===d&&(g=S,!0)})?g:new Error("It's broken"):Ne},set:e(n),enumerable:!0})}),Object.keys(X).forEach(function(t){var n=X[t];Object.defineProperty(Ee.prototype,t,{get:function(){var a,i,o=fe[this._id].options[t];return Ae(o)?(a=o,i=n.optionsConf.reduce(function(g,d){var S,r=d[0],p=d[1],x=d[2],s=d[3],u=d[4],h=u!=null?a[s][u]:s?a[s]:a[p];return g[p]=r==="id"?h?Object.keys(x).some(function(m){return x[m]===h&&(S=m,!0)})?S:new Error("It's broken"):Ne:h==null?Ne:me(h),g},{}),n.anim&&(i.animation=me(a.animation)),i):o},set:e(t),enumerable:!0})}),["startLabel","endLabel","middleLabel"].forEach(function(t,n){Object.defineProperty(Ee.prototype,t,{get:function(){var a=fe[this._id],i=a.options;return i.labelSEM[n]&&!a.optionIsAttach.labelSEM[n]?ce[i.labelSEM[n]._id].text:i.labelSEM[n]||""},set:e(t),enumerable:!0})})})(),Ee.prototype.setOptions=function(e){return pt(fe[this._id],e),this},Ee.prototype.position=function(){return ve(fe[this._id],{position:!0}),this},Ee.prototype.remove=function(){var e=fe[this._id],t=e.curStats;Object.keys(X).forEach(function(n){var a=n+"_animId";t[a]&&he.remove(t[a])}),t.show_animId&&he.remove(t.show_animId),e.attachments.slice().forEach(function(n){ht(e,n)}),e.baseWindow&&e.svg&&e.baseWindow.document.body.removeChild(e.svg),delete fe[this._id]},Ee.prototype.show=function(e,t){return ut(fe[this._id],!0,e,t),this},Ee.prototype.hide=function(e,t){return ut(fe[this._id],!1,e,t),this},ct=function(e){e&&ce[e._id]&&(e.boundTargets.slice().forEach(function(t){ht(t.props,e,!0)}),e.conf.remove&&e.conf.remove(e),delete ce[e._id])},Be=(function(){function e(t,n){var a,i={conf:t,curStats:{},aplStats:{},boundTargets:[]},o={};t.argOptions.every(function(g){return!(!n.length||(typeof g.type=="string"?typeof n[0]!==g.type:typeof g.type!="function"||!g.type(n[0])))&&(o[g.optionName]=n.shift(),!0)}),a=n.length&&Ae(n[0])?me(n[0]):{},Object.keys(o).forEach(function(g){a[g]=o[g]}),t.stats&&(de(i.curStats,t.stats),de(i.aplStats,t.stats)),Object.defineProperty(this,"_id",{value:++on}),Object.defineProperty(this,"isRemoved",{get:function(){return!ce[this._id]}}),i._id=this._id,t.init&&!t.init(i,a)||(ce[this._id]=i)}return e.prototype.remove=function(){var t=this,n=ce[t._id];n&&(n.boundTargets.slice().forEach(function(a){n.conf.removeOption(n,a)}),ze(function(){var a=ce[t._id];a&&(console.error("LeaderLineAttachment was not removed by removeOption"),ct(a))}))},e})(),window.LeaderLineAttachment=Be,Ke=function(e,t){return e instanceof Be&&(!(e.isRemoved||t&&ce[e._id].conf.type!==t)||null)},G={pointAnchor:{type:"anchor",argOptions:[{optionName:"element",type:Ze}],init:function(e,t){return e.element=G.pointAnchor.checkElement(t.element),e.x=G.pointAnchor.parsePercent(t.x,!0)||[.5,!0],e.y=G.pointAnchor.parsePercent(t.y,!0)||[.5,!0],!0},removeOption:function(e,t){var n=t.props,a={},i=e.element,o=n.options.anchorSE[t.optionName==="start"?1:0];i===o&&(i=o===document.body?new Be(G.pointAnchor,[i]):document.body),a[t.optionName]=i,pt(n,a)},getBBoxNest:function(e,t){var n=Ye(e.element,t.baseWindow),a=n.width,i=n.height;return n.width=n.height=0,n.left=n.right=n.left+e.x[0]*(e.x[1]?a:1),n.top=n.bottom=n.top+e.y[0]*(e.y[1]?i:1),n},parsePercent:function(e,t){var n,a,i=!1;return Se(e)?a=e:typeof e=="string"&&(n=Wt.exec(e))&&n[2]&&(i=(a=parseFloat(n[1])/100)!==0),a!=null&&(t||0<=a)?[a,i]:null},checkElement:function(e){if(e==null)e=document.body;else if(!Ze(e))throw new Error("`element` must be Element");return e}},areaAnchor:{type:"anchor",argOptions:[{optionName:"element",type:Ze},{optionName:"shape",type:"string"}],stats:{color:{},strokeWidth:{},elementWidth:{},elementHeight:{},elementLeft:{},elementTop:{},pathListRel:{},bBoxRel:{},pathData:{},viewBoxBBox:{hasProps:!0},dashLen:{},dashGap:{}},init:function(e,t){var n,a,i,o=[];return e.element=G.pointAnchor.checkElement(t.element),typeof t.color=="string"&&(e.color=t.color.trim()),typeof t.fillColor=="string"&&(e.fill=t.fillColor.trim()),Se(t.size)&&0<=t.size&&(e.size=t.size),t.dash&&(e.dash=!0,Se(t.dash.len)&&0a.right&&(a.right=ne),aea.bottom&&(a.bottom=ae)):a={left:ne,right:ne,top:ae,bottom:ae},i?_.pathListRel.push([i,{x:ne,y:ae}]):_.pathListRel=[],i={x:ne,y:ae}}),_.pathListRel.push([]),o=_.strokeWidth/2,g=[{x:a.left-o,y:a.top-o},{x:a.right+o,y:a.bottom+o}],_.bBoxRel={left:g[0].x,top:g[0].y,right:g[1].x,bottom:g[1].y,width:g[1].x-g[0].x,height:g[1].y-g[0].y}}F.pathListRel=F.bBoxRel=!0}return(F.pathListRel||F.elementLeft||F.elementTop)&&(_.pathData=kt(_.pathListRel,function(H){H.x+=t.left,H.y+=t.top})),A(e,z,"strokeWidth",n=_.strokeWidth)&&(e.path.style.strokeWidth=n+"px"),lt(n=_.pathData,z.pathData)&&(e.path.setPathData(n),z.pathData=n,F.pathData=!0),e.dash&&(!F.pathData&&(!F.strokeWidth||e.dashLen&&e.dashGap)||(_.dashLen=e.dashLen||2*_.strokeWidth,_.dashGap=e.dashGap||_.strokeWidth),F.dash=A(e,z,"dashLen",_.dashLen)||F.dash,F.dash=A(e,z,"dashGap",_.dashGap)||F.dash,F.dash&&(e.path.style.strokeDasharray=z.dashLen+","+z.dashGap)),I=_.viewBoxBBox,W=z.viewBoxBBox,R=e.svg.viewBox.baseVal,V=e.svg.style,I.x=_.bBoxRel.left+t.left,I.y=_.bBoxRel.top+t.top,I.width=_.bBoxRel.width,I.height=_.bBoxRel.height,["x","y","width","height"].forEach(function(H){(n=I[H])!==W[H]&&(R[H]=W[H]=n,V[Pt[H]]=n+(H==="x"||H==="y"?e.bodyOffset[H]:0)+"px")}),F.strokeWidth||F.pathListRel||F.bBoxRel}},mouseHoverAnchor:{type:"anchor",argOptions:[{optionName:"element",type:Ze},{optionName:"showEffectName",type:"string"}],style:{backgroundImage:"url('data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cG9seWdvbiBwb2ludHM9IjI0LDAgMCw4IDgsMTEgMCwxOSA1LDI0IDEzLDE2IDE2LDI0IiBmaWxsPSJjb3JhbCIvPjwvc3ZnPg==')",backgroundSize:"",backgroundRepeat:"no-repeat",backgroundColor:"#f8f881",cursor:"default"},hoverStyle:{backgroundImage:"none",backgroundColor:"#fadf8f"},padding:{top:1,right:15,bottom:1,left:2},minHeight:15,backgroundPosition:{right:2,top:2},backgroundSize:{width:12,height:12},dirKeys:[["top","Top"],["right","Right"],["bottom","Bottom"],["left","Left"]],init:function(e,t){var n,a,i,o,g,d,S,r,p,x,s,u=G.mouseHoverAnchor,h={};if(e.element=G.pointAnchor.checkElement(t.element),r=e.element,!((x=r.ownerDocument)&&(p=x.defaultView)&&p.HTMLElement&&r instanceof p.HTMLElement))throw new Error("`element` must be HTML element");return u.style.backgroundSize=u.backgroundSize.width+"px "+u.backgroundSize.height+"px",["style","hoverStyle"].forEach(function(m){var E=u[m];e[m]=Object.keys(E).reduce(function(w,M){return w[M]=E[M],w},{})}),(n=e.element.ownerDocument.defaultView.getComputedStyle(e.element,"")).display==="inline"?e.style.display="inline-block":n.display==="none"&&(e.style.display="block"),G.mouseHoverAnchor.dirKeys.forEach(function(m){var E=m[0],w="padding"+m[1];parseFloat(n[w])e.x2&&(e.x2=a.x2),a.y2>e.y2&&(e.y2=a.y2)},newText:function(e,t,n,a,i){var o,g,d,S,r,p;return(o=t.createElementNS(D,"text")).textContent=e,[o.x,o.y].forEach(function(x){var s=n.createSVGLength();s.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX,0),x.baseVal.initialize(s)}),typeof Re!="boolean"&&(Re="paintOrder"in o.style),i&&!Re?(d=t.createElementNS(D,"defs"),o.id=a,d.appendChild(o),(r=(g=t.createElementNS(D,"g")).appendChild(t.createElementNS(D,"use"))).href.baseVal="#"+a,(S=g.appendChild(t.createElementNS(D,"use"))).href.baseVal="#"+a,(p=r.style).strokeLinejoin="round",{elmPosition:o,styleText:o.style,styleFill:S.style,styleStroke:p,styleShow:g.style,elmsAppend:[d,g]}):(p=o.style,i&&(p.strokeLinejoin="round",p.paintOrder="stroke"),{elmPosition:o,styleText:p,styleFill:p,styleStroke:i?p:null,styleShow:p,elmsAppend:[o]})},getMidPoint:function(e,t){var n,a,i,o=Gt(e),g=o.segsLen,d=o.lenAll,S=-1;if((n=d/2+(t||0))<=0)return(a=e[0]).length===2?Xe(a[0],a[1],0):De(a[0],a[1],a[2],a[3],0);if(d<=n)return(a=e[e.length-1]).length===2?Xe(a[0],a[1],1):De(a[0],a[1],a[2],a[3],1);for(i=[];n>g[++S];)i.push(e[S]),n-=g[S];return(a=e[S]).length===2?Xe(a[0],a[1],n/g[S]):De(a[0],a[1],a[2],a[3],bt(a[0],a[1],a[2],a[3],n))},initSvg:function(e,t){var n,a,i=G.captionLabel.newText(e.text,t.baseWindow.document,t.svg,pe+"-captionLabel-"+e._id,e.outlineColor);["elmPosition","styleFill","styleShow","elmsAppend"].forEach(function(o){e[o]=i[o]}),e.isShown=!1,e.styleShow.visibility="hidden",G.captionLabel.textStyleProps.forEach(function(o){e[o]!=null&&(i.styleText[o]=e[o])}),i.elmsAppend.forEach(function(o){t.svg.appendChild(o)}),n=i.elmPosition.getBBox(),e.width=n.width,e.height=n.height,e.outlineColor&&(a=10<(a=n.height/9)?10:a<2?2:a,i.styleStroke.strokeWidth=a+"px",i.styleStroke.stroke=e.outlineColor),e.strokeWidth=a||0,de(e.aplStats,G.captionLabel.stats),e.updateColor(t),e.refSocketXY?e.updateSocketXY(t):e.updatePath(t),le&&ve(t,{}),e.updateShow(t)},bind:function(e,t){var n=t.props;return e.color||se(n,"cur_line_color",e.updateColor),(e.refSocketXY=t.optionName==="startLabel"||t.optionName==="endLabel")?(e.socketIndex=t.optionName==="startLabel"?0:1,se(n,"apl_position",e.updateSocketXY),e.offset||(se(n,"cur_attach_plugSideLenSE",e.updateSocketXY),se(n,"cur_line_strokeWidth",e.updateSocketXY))):se(n,"apl_path",e.updatePath),se(n,"svgShow",e.updateShow),le&&se(n,"new_edge4viewBox",e.adjustEdge),G.captionLabel.initSvg(e,n),!0},unbind:function(e,t){var n=t.props;e.elmsAppend&&(e.elmsAppend.forEach(function(a){n.svg.removeChild(a)}),e.elmPosition=e.styleFill=e.styleShow=e.elmsAppend=null),de(e.curStats,G.captionLabel.stats),de(e.aplStats,G.captionLabel.stats),e.color||ue(n,"cur_line_color",e.updateColor),e.refSocketXY?(ue(n,"apl_position",e.updateSocketXY),e.offset||(ue(n,"cur_attach_plugSideLenSE",e.updateSocketXY),ue(n,"cur_line_strokeWidth",e.updateSocketXY))):ue(n,"apl_path",e.updatePath),ue(n,"svgShow",e.updateShow),le&&(ue(n,"new_edge4viewBox",e.adjustEdge),ve(n,{}))},removeOption:function(e,t){var n=t.props,a={};a[t.optionName]="",pt(n,a)},remove:function(e){e.boundTargets.length&&(console.error("LeaderLineAttachment was not unbound by remove"),e.boundTargets.forEach(function(t){G.captionLabel.unbind(e,t)}))}},pathLabel:{type:"label",argOptions:[{optionName:"text",type:"string"}],stats:{color:{},startOffset:{},pathData:{}},init:function(e,t){return typeof t.text=="string"&&(e.text=t.text.trim()),!!e.text&&(typeof t.color=="string"&&(e.color=t.color.trim()),e.outlineColor=typeof t.outlineColor=="string"?t.outlineColor.trim():"#fff",Se(t.lineOffset)&&(e.lineOffset=t.lineOffset),G.captionLabel.textStyleProps.forEach(function(n){t[n]!=null&&(e[n]=t[n])}),e.updateColor=function(n){G.captionLabel.updateColor(e,n)},e.updatePath=function(n){var a,i=e.curStats,o=e.aplStats,g=n.curStats,d=n.pathList.animVal||n.pathList.baseVal;d&&(i.pathData=a=G.pathLabel.getOffsetPathData(d,g.line_strokeWidth/2+e.strokeWidth/2+e.height/4,1.25*e.height),lt(a,o.pathData)&&(e.elmPath.setPathData(a),o.pathData=a,e.bBox=e.elmPosition.getBBox(),e.updateStartOffset(n)))},e.updateStartOffset=function(n){var a,i,o,g,d=e.curStats,S=e.aplStats,r=n.curStats;d.pathData&&(e.semIndex!==2||e.lineOffset)&&(a=d.pathData.reduce(function(p,x){var s,u=x.values;switch(x.type){case"M":g={x:u[0],y:u[1]};break;case"L":s={x:u[0],y:u[1]},g&&(p+=we(g,s)),g=s;break;case"C":s={x:u[4],y:u[5]},g&&(p+=qe(g,{x:u[0],y:u[1]},{x:u[2],y:u[3]},s)),g=s}return p},0),o=e.semIndex===0?0:e.semIndex===1?a:a/2,e.semIndex!==2&&(i=Math.max(r.attach_plugBackLenSE[e.semIndex]||0,r.line_strokeWidth/2)+e.strokeWidth/2+e.height/4,o=(o+=e.semIndex===0?i:-i)<0?0:at?((r=a.points)[1]=rt(r[0],r[1],-t),a.len=we(r[0],r[1])):(a.points=null,a.len=0),S.len>t+n?((r=S.points)[0]=rt(r[1],r[0],-(t+n)),S.len=we(r[0],r[1])):(S.points=null,S.len=0)),a=S):a=null}),g.reduce(function(S,r){var p=r.points;return p&&(i&&d(p[0],i)||S.push({type:"M",values:[p[0].x,p[0].y]}),r.type==="line"?S.push({type:"L",values:[p[1].x,p[1].y]}):(p.shift(),p.forEach(function(x){S.push({type:"L",values:[x.x,x.y]})})),i=p[p.length-1]),S},[])},newText:function(e,t,n,a){var i,o,g,d,S,r,p,x,s,u;return(d=(g=t.createElementNS(D,"defs")).appendChild(t.createElementNS(D,"path"))).id=i=n+"-path",(r=(S=t.createElementNS(D,"text")).appendChild(t.createElementNS(D,"textPath"))).href.baseVal="#"+i,r.startOffset.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX,0),r.textContent=e,typeof Re!="boolean"&&(Re="paintOrder"in S.style),a&&!Re?(S.id=o=n+"-text",g.appendChild(S),(s=(p=t.createElementNS(D,"g")).appendChild(t.createElementNS(D,"use"))).href.baseVal="#"+o,(x=p.appendChild(t.createElementNS(D,"use"))).href.baseVal="#"+o,(u=s.style).strokeLinejoin="round",{elmPosition:S,elmPath:d,elmOffset:r,styleText:S.style,styleFill:x.style,styleStroke:u,styleShow:p.style,elmsAppend:[g,p]}):(u=S.style,a&&(u.strokeLinejoin="round",u.paintOrder="stroke"),{elmPosition:S,elmPath:d,elmOffset:r,styleText:u,styleFill:u,styleStroke:a?u:null,styleShow:u,elmsAppend:[g,S]})},initSvg:function(e,t){var n,a,i=G.pathLabel.newText(e.text,t.baseWindow.document,pe+"-pathLabel-"+e._id,e.outlineColor);["elmPosition","elmPath","elmOffset","styleFill","styleShow","elmsAppend"].forEach(function(o){e[o]=i[o]}),e.isShown=!1,e.styleShow.visibility="hidden",G.captionLabel.textStyleProps.forEach(function(o){e[o]!=null&&(i.styleText[o]=e[o])}),i.elmsAppend.forEach(function(o){t.svg.appendChild(o)}),i.elmPath.setPathData([{type:"M",values:[0,100]},{type:"h",values:[100]}]),n=i.elmPosition.getBBox(),i.styleText.textAnchor=["start","end","middle"][e.semIndex],e.semIndex!==2||e.lineOffset||i.elmOffset.startOffset.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE,50),e.height=n.height,e.outlineColor&&(a=10<(a=n.height/9)?10:a<2?2:a,i.styleStroke.strokeWidth=a+"px",i.styleStroke.stroke=e.outlineColor),e.strokeWidth=a||0,de(e.aplStats,G.pathLabel.stats),e.updateColor(t),e.updatePath(t),e.updateStartOffset(t),le&&ve(t,{}),e.updateShow(t)},bind:function(e,t){var n=t.props;return e.color||se(n,"cur_line_color",e.updateColor),se(n,"cur_line_strokeWidth",e.updatePath),se(n,"apl_path",e.updatePath),e.semIndex=t.optionName==="startLabel"?0:t.optionName==="endLabel"?1:2,(e.semIndex!==2||e.lineOffset)&&se(n,"cur_attach_plugBackLenSE",e.updateStartOffset),se(n,"svgShow",e.updateShow),le&&se(n,"new_edge4viewBox",e.adjustEdge),G.pathLabel.initSvg(e,n),!0},unbind:function(e,t){var n=t.props;e.elmsAppend&&(e.elmsAppend.forEach(function(a){n.svg.removeChild(a)}),e.elmPosition=e.elmPath=e.elmOffset=e.styleFill=e.styleShow=e.elmsAppend=null),de(e.curStats,G.pathLabel.stats),de(e.aplStats,G.pathLabel.stats),e.color||ue(n,"cur_line_color",e.updateColor),ue(n,"cur_line_strokeWidth",e.updatePath),ue(n,"apl_path",e.updatePath),(e.semIndex!==2||e.lineOffset)&&ue(n,"cur_attach_plugBackLenSE",e.updateStartOffset),ue(n,"svgShow",e.updateShow),le&&(ue(n,"new_edge4viewBox",e.adjustEdge),ve(n,{}))},removeOption:function(e,t){var n=t.props,a={};a[t.optionName]="",pt(n,a)},remove:function(e){e.boundTargets.length&&(console.error("LeaderLineAttachment was not unbound by remove"),e.boundTargets.forEach(function(t){G.pathLabel.unbind(e,t)}))}}},Object.keys(G).forEach(function(e){Ee[e]=function(){return new Be(G[e],Array.prototype.slice.call(arguments))}}),Ee.positionByWindowResize=!0,window.addEventListener("resize",nn.add(function(){Ee.positionByWindowResize&&Object.keys(fe).forEach(function(e){ve(fe[e],{position:!0})})}),!1),Ee})();const ln={setLine:function(X,te,G={}){return new Yt(X,te,G)},obj:Yt};export{ln as L};