@data_wise/hyper-markdown 1.5.4 → 1.5.6

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.
@@ -175633,7 +175633,14 @@ const U1r = {
175633
175633
  n.code,
175634
175634
  n.line
175635
175635
  );
175636
- i && t.push(i);
175636
+ i ? t.push(i) : n && n.message && t.push({
175637
+ line: typeof n.line == "number" && n.line > 0 ? n.line : -1,
175638
+ lineEnd: typeof n.line == "number" && n.line > 0 ? n.line : -1,
175639
+ type: n.type || "Unknown",
175640
+ message: n.message,
175641
+ code: n.code || "",
175642
+ severity: "error"
175643
+ });
175637
175644
  }), this.renderErrors = t, this.$emit("errors", t);
175638
175645
  },
175639
175646
  findErrorLocation(t, e, r = null, n = null, i = null) {
@@ -175877,7 +175884,7 @@ function H1r(t, e, r, n, i, a) {
175877
175884
  }, null, 8, ["visible", "content", "component-type", "onSave", "onClose"])
175878
175885
  ], 14, Q1r);
175879
175886
  }
175880
- const t$r = /* @__PURE__ */ Oue(U1r, [["render", H1r], ["__scopeId", "data-v-fccba39d"]]);
175887
+ const t$r = /* @__PURE__ */ Oue(U1r, [["render", H1r], ["__scopeId", "data-v-d65d3d55"]]);
175881
175888
  var q1r = "[object Symbol]";
175882
175889
  function vy(t) {
175883
175890
  return typeof t == "symbol" || ih(t) && Gg(t) == q1r;
@@ -1056,11 +1056,11 @@ Actual: `+Y.attribValue);else{var K=Y.tag,j=Y.tags[Y.tags.length-1]||Y;K.ns===j.
1056
1056
  }`,bAr=function(t){SAr(t,"."+Vae+yAr+xqe+`
1057
1057
  .`+Hae+_Ar+xqe)},SAr=function(t,e){var r=t.ownerDocument;if(r){var n=r.createElement("style");n.textContent=e,t.appendChild(n)}},Tqe=function(){function t(){}return t.getOrigin=function(e){var r=t._link;return r?(r.href=e,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},t.isSameOrigin=function(e){return t.getOrigin(e)===t._origin},t.setContext=function(e){t._link=e.document.createElement("a"),t._origin=t.getOrigin(e.location.href)},t._origin="about:blank",t}(),EAr=function(){function t(e,r){this.context=e,this._options=r,this._cache={}}return t.prototype.addImage=function(e){var r=Promise.resolve();return this.has(e)||(Yae(e)||OAr(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),r},t.prototype.match=function(e){return this._cache[e]},t.prototype.loadImage=function(e){return Gl(this,void 0,void 0,function(){var r,n,i,a,s=this;return Xo(this,function(o){switch(o.label){case 0:return r=Tqe.isSameOrigin(e),n=!qae(e)&&this._options.useCORS===!0&&po.SUPPORT_CORS_IMAGES&&!r,i=!qae(e)&&!r&&!Yae(e)&&typeof this._options.proxy=="string"&&po.SUPPORT_CORS_XHR&&!n,!r&&this._options.allowTaint===!1&&!qae(e)&&!Yae(e)&&!i&&!n?[2]:(a=e,i?[4,this.proxy(a)]:[3,2]);case 1:a=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(l,u){var h=new Image;h.onload=function(){return l(h)},h.onerror=u,(CAr(a)||n)&&(h.crossOrigin="anonymous"),h.src=a,h.complete===!0&&setTimeout(function(){return l(h)},500),s._options.imageTimeout>0&&setTimeout(function(){return u("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},t.prototype.has=function(e){return typeof this._cache[e]<"u"},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(e){var r=this,n=this._options.proxy;if(!n)throw new Error("No proxy defined");var i=e.substring(0,256);return new Promise(function(a,s){var o=po.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")a(l.response);else{var d=new FileReader;d.addEventListener("load",function(){return a(d.result)},!1),d.addEventListener("error",function(f){return s(f)},!1),d.readAsDataURL(l.response)}else s("Failed to proxy resource "+i+" with status code "+l.status)},l.onerror=s;var u=n.indexOf("?")>-1?"&":"?";if(l.open("GET",""+n+u+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),r._options.imageTimeout){var h=r._options.imageTimeout;l.timeout=h,l.ontimeout=function(){return s("Timed out ("+h+"ms) proxying "+i)}}l.send()})},t}(),wAr=/^data:image\/svg\+xml/i,xAr=/^data:image\/.*;base64,/i,TAr=/^data:image\/.*/i,OAr=function(t){return po.SUPPORT_SVG_DRAWING||!RAr(t)},qae=function(t){return TAr.test(t)},CAr=function(t){return xAr.test(t)},Yae=function(t){return t.substr(0,4)==="blob"},RAr=function(t){return t.substr(-3).toLowerCase()==="svg"||wAr.test(t)},Jt=function(){function t(e,r){this.type=0,this.x=e,this.y=r}return t.prototype.add=function(e,r){return new t(this.x+e,this.y+r)},t}(),IE=function(t,e,r){return new Jt(t.x+(e.x-t.x)*r,t.y+(e.y-t.y)*r)},X6=function(){function t(e,r,n,i){this.type=1,this.start=e,this.startControl=r,this.endControl=n,this.end=i}return t.prototype.subdivide=function(e,r){var n=IE(this.start,this.startControl,e),i=IE(this.startControl,this.endControl,e),a=IE(this.endControl,this.end,e),s=IE(n,i,e),o=IE(i,a,e),l=IE(s,o,e);return r?new t(this.start,n,s,l):new t(l,o,a,this.end)},t.prototype.add=function(e,r){return new t(this.start.add(e,r),this.startControl.add(e,r),this.endControl.add(e,r),this.end.add(e,r))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t}(),eh=function(t){return t.type===1},kAr=function(){function t(e){var r=e.styles,n=e.bounds,i=sk(r.borderTopLeftRadius,n.width,n.height),a=i[0],s=i[1],o=sk(r.borderTopRightRadius,n.width,n.height),l=o[0],u=o[1],h=sk(r.borderBottomRightRadius,n.width,n.height),d=h[0],f=h[1],p=sk(r.borderBottomLeftRadius,n.width,n.height),g=p[0],m=p[1],A=[];A.push((a+l)/n.width),A.push((g+d)/n.width),A.push((s+m)/n.height),A.push((u+f)/n.height);var v=Math.max.apply(Math,A);v>1&&(a/=v,s/=v,l/=v,u/=v,d/=v,f/=v,g/=v,m/=v);var y=n.width-l,_=n.height-f,b=n.width-d,S=n.height-m,E=r.borderTopWidth,w=r.borderRightWidth,O=r.borderBottomWidth,x=r.borderLeftWidth,R=Di(r.paddingTop,e.bounds.width),C=Di(r.paddingRight,e.bounds.width),k=Di(r.paddingBottom,e.bounds.width),D=Di(r.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=a>0||s>0?Ki(n.left+x/3,n.top+E/3,a-x/3,s-E/3,ri.TOP_LEFT):new Jt(n.left+x/3,n.top+E/3),this.topRightBorderDoubleOuterBox=a>0||s>0?Ki(n.left+y,n.top+E/3,l-w/3,u-E/3,ri.TOP_RIGHT):new Jt(n.left+n.width-w/3,n.top+E/3),this.bottomRightBorderDoubleOuterBox=d>0||f>0?Ki(n.left+b,n.top+_,d-w/3,f-O/3,ri.BOTTOM_RIGHT):new Jt(n.left+n.width-w/3,n.top+n.height-O/3),this.bottomLeftBorderDoubleOuterBox=g>0||m>0?Ki(n.left+x/3,n.top+S,g-x/3,m-O/3,ri.BOTTOM_LEFT):new Jt(n.left+x/3,n.top+n.height-O/3),this.topLeftBorderDoubleInnerBox=a>0||s>0?Ki(n.left+x*2/3,n.top+E*2/3,a-x*2/3,s-E*2/3,ri.TOP_LEFT):new Jt(n.left+x*2/3,n.top+E*2/3),this.topRightBorderDoubleInnerBox=a>0||s>0?Ki(n.left+y,n.top+E*2/3,l-w*2/3,u-E*2/3,ri.TOP_RIGHT):new Jt(n.left+n.width-w*2/3,n.top+E*2/3),this.bottomRightBorderDoubleInnerBox=d>0||f>0?Ki(n.left+b,n.top+_,d-w*2/3,f-O*2/3,ri.BOTTOM_RIGHT):new Jt(n.left+n.width-w*2/3,n.top+n.height-O*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||m>0?Ki(n.left+x*2/3,n.top+S,g-x*2/3,m-O*2/3,ri.BOTTOM_LEFT):new Jt(n.left+x*2/3,n.top+n.height-O*2/3),this.topLeftBorderStroke=a>0||s>0?Ki(n.left+x/2,n.top+E/2,a-x/2,s-E/2,ri.TOP_LEFT):new Jt(n.left+x/2,n.top+E/2),this.topRightBorderStroke=a>0||s>0?Ki(n.left+y,n.top+E/2,l-w/2,u-E/2,ri.TOP_RIGHT):new Jt(n.left+n.width-w/2,n.top+E/2),this.bottomRightBorderStroke=d>0||f>0?Ki(n.left+b,n.top+_,d-w/2,f-O/2,ri.BOTTOM_RIGHT):new Jt(n.left+n.width-w/2,n.top+n.height-O/2),this.bottomLeftBorderStroke=g>0||m>0?Ki(n.left+x/2,n.top+S,g-x/2,m-O/2,ri.BOTTOM_LEFT):new Jt(n.left+x/2,n.top+n.height-O/2),this.topLeftBorderBox=a>0||s>0?Ki(n.left,n.top,a,s,ri.TOP_LEFT):new Jt(n.left,n.top),this.topRightBorderBox=l>0||u>0?Ki(n.left+y,n.top,l,u,ri.TOP_RIGHT):new Jt(n.left+n.width,n.top),this.bottomRightBorderBox=d>0||f>0?Ki(n.left+b,n.top+_,d,f,ri.BOTTOM_RIGHT):new Jt(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=g>0||m>0?Ki(n.left,n.top+S,g,m,ri.BOTTOM_LEFT):new Jt(n.left,n.top+n.height),this.topLeftPaddingBox=a>0||s>0?Ki(n.left+x,n.top+E,Math.max(0,a-x),Math.max(0,s-E),ri.TOP_LEFT):new Jt(n.left+x,n.top+E),this.topRightPaddingBox=l>0||u>0?Ki(n.left+Math.min(y,n.width-w),n.top+E,y>n.width+w?0:Math.max(0,l-w),Math.max(0,u-E),ri.TOP_RIGHT):new Jt(n.left+n.width-w,n.top+E),this.bottomRightPaddingBox=d>0||f>0?Ki(n.left+Math.min(b,n.width-x),n.top+Math.min(_,n.height-O),Math.max(0,d-w),Math.max(0,f-O),ri.BOTTOM_RIGHT):new Jt(n.left+n.width-w,n.top+n.height-O),this.bottomLeftPaddingBox=g>0||m>0?Ki(n.left+x,n.top+Math.min(S,n.height-O),Math.max(0,g-x),Math.max(0,m-O),ri.BOTTOM_LEFT):new Jt(n.left+x,n.top+n.height-O),this.topLeftContentBox=a>0||s>0?Ki(n.left+x+D,n.top+E+R,Math.max(0,a-(x+D)),Math.max(0,s-(E+R)),ri.TOP_LEFT):new Jt(n.left+x+D,n.top+E+R),this.topRightContentBox=l>0||u>0?Ki(n.left+Math.min(y,n.width+x+D),n.top+E+R,y>n.width+x+D?0:l-x+D,u-(E+R),ri.TOP_RIGHT):new Jt(n.left+n.width-(w+C),n.top+E+R),this.bottomRightContentBox=d>0||f>0?Ki(n.left+Math.min(b,n.width-(x+D)),n.top+Math.min(_,n.height+E+R),Math.max(0,d-(w+C)),f-(O+k),ri.BOTTOM_RIGHT):new Jt(n.left+n.width-(w+C),n.top+n.height-(O+k)),this.bottomLeftContentBox=g>0||m>0?Ki(n.left+x+D,n.top+S,Math.max(0,g-(x+D)),m-(O+k),ri.BOTTOM_LEFT):new Jt(n.left+x+D,n.top+n.height-(O+k))}return t}(),ri;(function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(ri||(ri={}));var Ki=function(t,e,r,n,i){var a=4*((Math.sqrt(2)-1)/3),s=r*a,o=n*a,l=t+r,u=e+n;switch(i){case ri.TOP_LEFT:return new X6(new Jt(t,u),new Jt(t,u-o),new Jt(l-s,e),new Jt(l,e));case ri.TOP_RIGHT:return new X6(new Jt(t,e),new Jt(t+s,e),new Jt(l,u-o),new Jt(l,u));case ri.BOTTOM_RIGHT:return new X6(new Jt(l,e),new Jt(l,e+o),new Jt(t+s,u),new Jt(t,u));case ri.BOTTOM_LEFT:default:return new X6(new Jt(l,u),new Jt(l-s,u),new Jt(t,e+o),new Jt(t,e))}},K6=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},IAr=function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]},Z6=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},NAr=function(){function t(e,r,n){this.offsetX=e,this.offsetY=r,this.matrix=n,this.type=0,this.target=6}return t}(),j6=function(){function t(e,r){this.path=e,this.target=r,this.type=1}return t}(),DAr=function(){function t(e){this.opacity=e,this.type=2,this.target=6}return t}(),LAr=function(t){return t.type===0},Oqe=function(t){return t.type===1},MAr=function(t){return t.type===2},Cqe=function(t,e){return t.length===e.length?t.some(function(r,n){return r===e[n]}):!1},BAr=function(t,e,r,n,i){return t.map(function(a,s){switch(s){case 0:return a.add(e,r);case 1:return a.add(e+n,r);case 2:return a.add(e+n,r+i);case 3:return a.add(e,r+i)}return a})},Rqe=function(){function t(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return t}(),kqe=function(){function t(e,r){if(this.container=e,this.parent=r,this.effects=[],this.curves=new kAr(this.container),this.container.styles.opacity<1&&this.effects.push(new DAr(this.container.styles.opacity)),this.container.styles.transform!==null){var n=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,a=this.container.styles.transform;this.effects.push(new NAr(n,i,a))}if(this.container.styles.overflowX!==0){var s=K6(this.curves),o=Z6(this.curves);Cqe(s,o)?this.effects.push(new j6(s,6)):(this.effects.push(new j6(s,2)),this.effects.push(new j6(o,4)))}}return t.prototype.getEffects=function(e){for(var r=[2,3].indexOf(this.container.styles.position)===-1,n=this.parent,i=this.effects.slice(0);n;){var a=n.effects.filter(function(l){return!Oqe(l)});if(r||n.container.styles.position!==0||!n.parent){if(i.unshift.apply(i,a),r=[2,3].indexOf(n.container.styles.position)===-1,n.container.styles.overflowX!==0){var s=K6(n.curves),o=Z6(n.curves);Cqe(s,o)||i.unshift(new j6(o,6))}}else i.unshift.apply(i,a);n=n.parent}return i.filter(function(l){return _s(l.target,e)})},t}(),Wae=function(t,e,r,n){t.container.elements.forEach(function(i){var a=_s(i.flags,4),s=_s(i.flags,2),o=new kqe(i,t);_s(i.styles.display,2048)&&n.push(o);var l=_s(i.flags,8)?[]:n;if(a||s){var u=a||i.styles.isPositioned()?r:e,h=new Rqe(o);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var d=i.styles.zIndex.order;if(d<0){var f=0;u.negativeZIndex.some(function(g,m){return d>g.element.container.styles.zIndex.order?(f=m,!1):f>0}),u.negativeZIndex.splice(f,0,h)}else if(d>0){var p=0;u.positiveZIndex.some(function(g,m){return d>=g.element.container.styles.zIndex.order?(p=m+1,!1):p>0}),u.positiveZIndex.splice(p,0,h)}else u.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else i.styles.isFloating()?u.nonPositionedFloats.push(h):u.nonPositionedInlineLevel.push(h);Wae(o,h,a?h:r,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),Wae(o,e,r,l);_s(i.flags,8)&&Iqe(i,l)})},Iqe=function(t,e){for(var r=t instanceof Pae?t.start:1,n=t instanceof Pae?t.reversed:!1,i=0;i<e.length;i++){var a=e[i];a.container instanceof rqe&&typeof a.container.value=="number"&&a.container.value!==0&&(r=a.container.value),a.listValue=dk(r,a.container.styles.listStyleType,!0),r+=n?-1:1}},PAr=function(t){var e=new kqe(t,null),r=new Rqe(e),n=[];return Wae(e,r,r,n),Iqe(e.container,n),r},Nqe=function(t,e){switch(e){case 0:return th(t.topLeftBorderBox,t.topLeftPaddingBox,t.topRightBorderBox,t.topRightPaddingBox);case 1:return th(t.topRightBorderBox,t.topRightPaddingBox,t.bottomRightBorderBox,t.bottomRightPaddingBox);case 2:return th(t.bottomRightBorderBox,t.bottomRightPaddingBox,t.bottomLeftBorderBox,t.bottomLeftPaddingBox);case 3:default:return th(t.bottomLeftBorderBox,t.bottomLeftPaddingBox,t.topLeftBorderBox,t.topLeftPaddingBox)}},FAr=function(t,e){switch(e){case 0:return th(t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox,t.topRightBorderBox,t.topRightBorderDoubleOuterBox);case 1:return th(t.topRightBorderBox,t.topRightBorderDoubleOuterBox,t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox);case 2:return th(t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox,t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox);case 3:default:return th(t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox,t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox)}},UAr=function(t,e){switch(e){case 0:return th(t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox,t.topRightBorderDoubleInnerBox,t.topRightPaddingBox);case 1:return th(t.topRightBorderDoubleInnerBox,t.topRightPaddingBox,t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox);case 2:return th(t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox,t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox);case 3:default:return th(t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox,t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox)}},QAr=function(t,e){switch(e){case 0:return J6(t.topLeftBorderStroke,t.topRightBorderStroke);case 1:return J6(t.topRightBorderStroke,t.bottomRightBorderStroke);case 2:return J6(t.bottomRightBorderStroke,t.bottomLeftBorderStroke);case 3:default:return J6(t.bottomLeftBorderStroke,t.topLeftBorderStroke)}},J6=function(t,e){var r=[];return eh(t)?r.push(t.subdivide(.5,!1)):r.push(t),eh(e)?r.push(e.subdivide(.5,!0)):r.push(e),r},th=function(t,e,r,n){var i=[];return eh(t)?i.push(t.subdivide(.5,!1)):i.push(t),eh(r)?i.push(r.subdivide(.5,!0)):i.push(r),eh(n)?i.push(n.subdivide(.5,!0).reverse()):i.push(n),eh(e)?i.push(e.subdivide(.5,!1).reverse()):i.push(e),i},Dqe=function(t){var e=t.bounds,r=t.styles;return e.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},e8=function(t){var e=t.styles,r=t.bounds,n=Di(e.paddingLeft,r.width),i=Di(e.paddingRight,r.width),a=Di(e.paddingTop,r.width),s=Di(e.paddingBottom,r.width);return r.add(n+e.borderLeftWidth,a+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+n+i),-(e.borderTopWidth+e.borderBottomWidth+a+s))},$Ar=function(t,e){return t===0?e.bounds:t===2?e8(e):Dqe(e)},GAr=function(t,e){return t===0?e.bounds:t===2?e8(e):Dqe(e)},Xae=function(t,e,r){var n=$Ar(DE(t.styles.backgroundOrigin,e),t),i=GAr(DE(t.styles.backgroundClip,e),t),a=zAr(DE(t.styles.backgroundSize,e),r,n),s=a[0],o=a[1],l=sk(DE(t.styles.backgroundPosition,e),n.width-s,n.height-o),u=VAr(DE(t.styles.backgroundRepeat,e),l,a,n,i),h=Math.round(n.left+l[0]),d=Math.round(n.top+l[1]);return[u,h,d,s,o]},NE=function(t){return _i(t)&&t.value===OE.AUTO},t8=function(t){return typeof t=="number"},zAr=function(t,e,r){var n=e[0],i=e[1],a=e[2],s=t[0],o=t[1];if(!s)return[0,0];if(es(s)&&o&&es(o))return[Di(s,r.width),Di(o,r.height)];var l=t8(a);if(_i(s)&&(s.value===OE.CONTAIN||s.value===OE.COVER)){if(t8(a)){var u=r.width/r.height;return u<a!=(s.value===OE.COVER)?[r.width,r.width/a]:[r.height*a,r.height]}return[r.width,r.height]}var h=t8(n),d=t8(i),f=h||d;if(NE(s)&&(!o||NE(o))){if(h&&d)return[n,i];if(!l&&!f)return[r.width,r.height];if(f&&l){var p=h?n:i*a,g=d?i:n/a;return[p,g]}var m=h?n:r.width,A=d?i:r.height;return[m,A]}if(l){var v=0,y=0;return es(s)?v=Di(s,r.width):es(o)&&(y=Di(o,r.height)),NE(s)?v=y*a:(!o||NE(o))&&(y=v/a),[v,y]}var _=null,b=null;if(es(s)?_=Di(s,r.width):o&&es(o)&&(b=Di(o,r.height)),_!==null&&(!o||NE(o))&&(b=h&&d?_/n*i:r.height),b!==null&&NE(s)&&(_=h&&d?b/i*n:r.width),_!==null&&b!==null)return[_,b];throw new Error("Unable to calculate background-size for element")},DE=function(t,e){var r=t[e];return typeof r>"u"?t[0]:r},VAr=function(t,e,r,n,i){var a=e[0],s=e[1],o=r[0],l=r[1];switch(t){case 2:return[new Jt(Math.round(n.left),Math.round(n.top+s)),new Jt(Math.round(n.left+n.width),Math.round(n.top+s)),new Jt(Math.round(n.left+n.width),Math.round(l+n.top+s)),new Jt(Math.round(n.left),Math.round(l+n.top+s))];case 3:return[new Jt(Math.round(n.left+a),Math.round(n.top)),new Jt(Math.round(n.left+a+o),Math.round(n.top)),new Jt(Math.round(n.left+a+o),Math.round(n.height+n.top)),new Jt(Math.round(n.left+a),Math.round(n.height+n.top))];case 1:return[new Jt(Math.round(n.left+a),Math.round(n.top+s)),new Jt(Math.round(n.left+a+o),Math.round(n.top+s)),new Jt(Math.round(n.left+a+o),Math.round(n.top+s+l)),new Jt(Math.round(n.left+a),Math.round(n.top+s+l))];default:return[new Jt(Math.round(i.left),Math.round(i.top)),new Jt(Math.round(i.left+i.width),Math.round(i.top)),new Jt(Math.round(i.left+i.width),Math.round(i.height+i.top)),new Jt(Math.round(i.left),Math.round(i.height+i.top))]}},HAr="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Lqe="Hidden Text",qAr=function(){function t(e){this._data={},this._document=e}return t.prototype.parseMetrics=function(e,r){var n=this._document.createElement("div"),i=this._document.createElement("img"),a=this._document.createElement("span"),s=this._document.body;n.style.visibility="hidden",n.style.fontFamily=e,n.style.fontSize=r,n.style.margin="0",n.style.padding="0",n.style.whiteSpace="nowrap",s.appendChild(n),i.src=HAr,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",a.style.fontFamily=e,a.style.fontSize=r,a.style.margin="0",a.style.padding="0",a.appendChild(this._document.createTextNode(Lqe)),n.appendChild(a),n.appendChild(i);var o=i.offsetTop-a.offsetTop+2;n.removeChild(a),n.appendChild(this._document.createTextNode(Lqe)),n.style.lineHeight="normal",i.style.verticalAlign="super";var l=i.offsetTop-n.offsetTop+2;return s.removeChild(n),{baseline:o,middle:l}},t.prototype.getMetrics=function(e,r){var n=e+" "+r;return typeof this._data[n]>"u"&&(this._data[n]=this.parseMetrics(e,r)),this._data[n]},t}(),Mqe=function(){function t(e,r){this.context=e,this.options=r}return t}(),YAr=1e4,WAr=function(t){Zh(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i._activeEffects=[],i.canvas=n.canvas?n.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),n.canvas||(i.canvas.width=Math.floor(n.width*n.scale),i.canvas.height=Math.floor(n.height*n.scale),i.canvas.style.width=n.width+"px",i.canvas.style.height=n.height+"px"),i.fontMetrics=new qAr(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-n.x,-n.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized ("+n.width+"x"+n.height+") with scale "+n.scale),i}return e.prototype.applyEffects=function(r){for(var n=this;this._activeEffects.length;)this.popEffect();r.forEach(function(i){return n.applyEffect(i)})},e.prototype.applyEffect=function(r){this.ctx.save(),MAr(r)&&(this.ctx.globalAlpha=r.opacity),LAr(r)&&(this.ctx.translate(r.offsetX,r.offsetY),this.ctx.transform(r.matrix[0],r.matrix[1],r.matrix[2],r.matrix[3],r.matrix[4],r.matrix[5]),this.ctx.translate(-r.offsetX,-r.offsetY)),Oqe(r)&&(this.path(r.path),this.ctx.clip()),this._activeEffects.push(r)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(r){return Gl(this,void 0,void 0,function(){var n;return Xo(this,function(i){switch(i.label){case 0:return n=r.element.container.styles,n.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(r){return Gl(this,void 0,void 0,function(){return Xo(this,function(n){switch(n.label){case 0:if(_s(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return n.sent(),[4,this.renderNodeContent(r)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(r,n,i){var a=this;if(n===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+i);else{var s=Bae(r.text);s.reduce(function(o,l){return a.ctx.fillText(l,o,r.bounds.top+i),o+a.ctx.measureText(l).width},r.bounds.left)}},e.prototype.createFontStyle=function(r){var n=r.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),i=JAr(r.fontFamily).join(", "),a=ak(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,n,r.fontWeight,a,i].join(" "),i,a]},e.prototype.renderTextNode=function(r,n){return Gl(this,void 0,void 0,function(){var i,a,s,o,l,u,h,d,f=this;return Xo(this,function(p){return i=this.createFontStyle(n),a=i[0],s=i[1],o=i[2],this.ctx.font=a,this.ctx.direction=n.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),u=l.baseline,h=l.middle,d=n.paintOrder,r.textBounds.forEach(function(g){d.forEach(function(m){switch(m){case 0:f.ctx.fillStyle=qs(n.color),f.renderTextWithLetterSpacing(g,n.letterSpacing,u);var A=n.textShadow;A.length&&g.text.trim().length&&(A.slice(0).reverse().forEach(function(v){f.ctx.shadowColor=qs(v.color),f.ctx.shadowOffsetX=v.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=v.offsetY.number*f.options.scale,f.ctx.shadowBlur=v.blur.number,f.renderTextWithLetterSpacing(g,n.letterSpacing,u)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),n.textDecorationLine.length&&(f.ctx.fillStyle=qs(n.textDecorationColor||n.color),n.textDecorationLine.forEach(function(v){switch(v){case 1:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top+u),g.bounds.width,1);break;case 2:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top),g.bounds.width,1);break;case 3:f.ctx.fillRect(g.bounds.left,Math.ceil(g.bounds.top+h),g.bounds.width,1);break}}));break;case 1:n.webkitTextStrokeWidth&&g.text.trim().length&&(f.ctx.strokeStyle=qs(n.webkitTextStrokeColor),f.ctx.lineWidth=n.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(g.text,g.bounds.left,g.bounds.top+u)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(r,n,i){if(i&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var a=e8(r),s=Z6(n);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,r.intrinsicWidth,r.intrinsicHeight,a.left,a.top,a.width,a.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(r){return Gl(this,void 0,void 0,function(){var n,i,a,s,o,l,y,y,u,h,d,f,b,p,g,S,m,A,v,y,_,b,S;return Xo(this,function(E){switch(E.label){case 0:this.applyEffects(r.getEffects(4)),n=r.container,i=r.curves,a=n.styles,s=0,o=n.textNodes,E.label=1;case 1:return s<o.length?(l=o[s],[4,this.renderTextNode(l,a)]):[3,4];case 2:E.sent(),E.label=3;case 3:return s++,[3,1];case 4:if(!(n instanceof JHe))return[3,8];E.label=5;case 5:return E.trys.push([5,7,,8]),[4,this.context.cache.match(n.src)];case 6:return y=E.sent(),this.renderReplacedElement(n,i,y),[3,8];case 7:return E.sent(),this.context.logger.error("Error loading image "+n.src),[3,8];case 8:if(n instanceof eqe&&this.renderReplacedElement(n,i,n.canvas),!(n instanceof tqe))return[3,12];E.label=9;case 9:return E.trys.push([9,11,,12]),[4,this.context.cache.match(n.svg)];case 10:return y=E.sent(),this.renderReplacedElement(n,i,y),[3,12];case 11:return E.sent(),this.context.logger.error("Error loading svg "+n.svg.substring(0,255)),[3,12];case 12:return n instanceof sqe&&n.tree?(u=new e(this.context,{scale:this.options.scale,backgroundColor:n.backgroundColor,x:0,y:0,width:n.width,height:n.height}),[4,u.render(n.tree)]):[3,14];case 13:h=E.sent(),n.width&&n.height&&this.ctx.drawImage(h,0,0,n.width,n.height,n.bounds.left,n.bounds.top,n.bounds.width,n.bounds.height),E.label=14;case 14:if(n instanceof Fae&&(d=Math.min(n.bounds.width,n.bounds.height),n.type===z6?n.checked&&(this.ctx.save(),this.path([new Jt(n.bounds.left+d*.39363,n.bounds.top+d*.79),new Jt(n.bounds.left+d*.16,n.bounds.top+d*.5549),new Jt(n.bounds.left+d*.27347,n.bounds.top+d*.44071),new Jt(n.bounds.left+d*.39694,n.bounds.top+d*.5649),new Jt(n.bounds.left+d*.72983,n.bounds.top+d*.23),new Jt(n.bounds.left+d*.84,n.bounds.top+d*.34085),new Jt(n.bounds.left+d*.39363,n.bounds.top+d*.79)]),this.ctx.fillStyle=qs(nqe),this.ctx.fill(),this.ctx.restore()):n.type===V6&&n.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.bounds.left+d/2,n.bounds.top+d/2,d/4,0,Math.PI*2,!0),this.ctx.fillStyle=qs(nqe),this.ctx.fill(),this.ctx.restore())),XAr(n)&&n.value.length){switch(f=this.createFontStyle(a),b=f[0],p=f[1],g=this.fontMetrics.getMetrics(b,p).baseline,this.ctx.font=b,this.ctx.fillStyle=qs(a.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=ZAr(n.styles.textAlign),S=e8(n),m=0,n.styles.textAlign){case 1:m+=S.width/2;break;case 2:m+=S.width;break}A=S.add(m,0,0,-S.height/2+1),this.ctx.save(),this.path([new Jt(S.left,S.top),new Jt(S.left+S.width,S.top),new Jt(S.left+S.width,S.top+S.height),new Jt(S.left,S.top+S.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new uk(n.value,A),a.letterSpacing,g),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!_s(n.styles.display,2048))return[3,20];if(n.styles.listStyleImage===null)return[3,19];if(v=n.styles.listStyleImage,v.type!==0)return[3,18];y=void 0,_=v.url,E.label=15;case 15:return E.trys.push([15,17,,18]),[4,this.context.cache.match(_)];case 16:return y=E.sent(),this.ctx.drawImage(y,n.bounds.left-(y.width+10),n.bounds.top),[3,18];case 17:return E.sent(),this.context.logger.error("Error loading list-style-image "+_),[3,18];case 18:return[3,20];case 19:r.listValue&&n.styles.listStyleType!==-1&&(b=this.createFontStyle(a)[0],this.ctx.font=b,this.ctx.fillStyle=qs(a.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",S=new _g(n.bounds.left,n.bounds.top+Di(n.styles.paddingTop,n.bounds.width),n.bounds.width,LHe(a.lineHeight,a.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new uk(r.listValue,S),a.letterSpacing,LHe(a.lineHeight,a.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),E.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(r){return Gl(this,void 0,void 0,function(){var n,i,v,a,s,v,o,l,v,u,h,v,d,f,v,p,g,v,m,A,v;return Xo(this,function(y){switch(y.label){case 0:if(_s(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:y.sent(),n=0,i=r.negativeZIndex,y.label=2;case 2:return n<i.length?(v=i[n],[4,this.renderStack(v)]):[3,5];case 3:y.sent(),y.label=4;case 4:return n++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:y.sent(),a=0,s=r.nonInlineLevel,y.label=7;case 7:return a<s.length?(v=s[a],[4,this.renderNode(v)]):[3,10];case 8:y.sent(),y.label=9;case 9:return a++,[3,7];case 10:o=0,l=r.nonPositionedFloats,y.label=11;case 11:return o<l.length?(v=l[o],[4,this.renderStack(v)]):[3,14];case 12:y.sent(),y.label=13;case 13:return o++,[3,11];case 14:u=0,h=r.nonPositionedInlineLevel,y.label=15;case 15:return u<h.length?(v=h[u],[4,this.renderStack(v)]):[3,18];case 16:y.sent(),y.label=17;case 17:return u++,[3,15];case 18:d=0,f=r.inlineLevel,y.label=19;case 19:return d<f.length?(v=f[d],[4,this.renderNode(v)]):[3,22];case 20:y.sent(),y.label=21;case 21:return d++,[3,19];case 22:p=0,g=r.zeroOrAutoZIndexOrTransformedOrOpacity,y.label=23;case 23:return p<g.length?(v=g[p],[4,this.renderStack(v)]):[3,26];case 24:y.sent(),y.label=25;case 25:return p++,[3,23];case 26:m=0,A=r.positiveZIndex,y.label=27;case 27:return m<A.length?(v=A[m],[4,this.renderStack(v)]):[3,30];case 28:y.sent(),y.label=29;case 29:return m++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(r){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(r.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(r){this.ctx.beginPath(),this.formatPath(r),this.ctx.closePath()},e.prototype.formatPath=function(r){var n=this;r.forEach(function(i,a){var s=eh(i)?i.start:i;a===0?n.ctx.moveTo(s.x,s.y):n.ctx.lineTo(s.x,s.y),eh(i)&&n.ctx.bezierCurveTo(i.startControl.x,i.startControl.y,i.endControl.x,i.endControl.y,i.end.x,i.end.y)})},e.prototype.renderRepeat=function(r,n,i,a){this.path(r),this.ctx.fillStyle=n,this.ctx.translate(i,a),this.ctx.fill(),this.ctx.translate(-i,-a)},e.prototype.resizeImage=function(r,n,i){var a;if(r.width===n&&r.height===i)return r;var s=(a=this.canvas.ownerDocument)!==null&&a!==void 0?a:document,o=s.createElement("canvas");o.width=Math.max(1,n),o.height=Math.max(1,i);var l=o.getContext("2d");return l.drawImage(r,0,0,r.width,r.height,0,0,n,i),o},e.prototype.renderBackgroundImage=function(r){return Gl(this,void 0,void 0,function(){var n,i,a,s,o,l;return Xo(this,function(u){switch(u.label){case 0:n=r.styles.backgroundImage.length-1,i=function(h){var d,f,p,R,L,M,D,T,O,g,R,L,M,D,T,m,A,v,y,_,b,S,E,w,O,x,R,C,k,D,T,I,L,M,P,Q,z,G,V,ee,ae,ne;return Xo(this,function(oe){switch(oe.label){case 0:if(h.type!==0)return[3,5];d=void 0,f=h.url,oe.label=1;case 1:return oe.trys.push([1,3,,4]),[4,a.context.cache.match(f)];case 2:return d=oe.sent(),[3,4];case 3:return oe.sent(),a.context.logger.error("Error loading background-image "+f),[3,4];case 4:return d&&(p=Xae(r,n,[d.width,d.height,d.width/d.height]),R=p[0],L=p[1],M=p[2],D=p[3],T=p[4],O=a.ctx.createPattern(a.resizeImage(d,D,T),"repeat"),a.renderRepeat(R,O,L,M)),[3,6];case 5:Lgr(h)?(g=Xae(r,n,[null,null,null]),R=g[0],L=g[1],M=g[2],D=g[3],T=g[4],m=Rgr(h.angle,D,T),A=m[0],v=m[1],y=m[2],_=m[3],b=m[4],S=document.createElement("canvas"),S.width=D,S.height=T,E=S.getContext("2d"),w=E.createLinearGradient(v,_,y,b),EHe(h.stops,A).forEach(function(Y){return w.addColorStop(Y.stop,qs(Y.color))}),E.fillStyle=w,E.fillRect(0,0,D,T),D>0&&T>0&&(O=a.ctx.createPattern(S,"repeat"),a.renderRepeat(R,O,L,M))):Mgr(h)&&(x=Xae(r,n,[null,null,null]),R=x[0],C=x[1],k=x[2],D=x[3],T=x[4],I=h.position.length===0?[bae]:h.position,L=Di(I[0],D),M=Di(I[I.length-1],T),P=kgr(h,L,M,D,T),Q=P[0],z=P[1],Q>0&&z>0&&(G=a.ctx.createRadialGradient(C+L,k+M,0,C+L,k+M,Q),EHe(h.stops,Q*2).forEach(function(Y){return G.addColorStop(Y.stop,qs(Y.color))}),a.path(R),a.ctx.fillStyle=G,Q!==z?(V=r.bounds.left+.5*r.bounds.width,ee=r.bounds.top+.5*r.bounds.height,ae=z/Q,ne=1/ae,a.ctx.save(),a.ctx.translate(V,ee),a.ctx.transform(1,0,0,ae,0,0),a.ctx.translate(-V,-ee),a.ctx.fillRect(C,ne*(k-ee)+ee,D,T*ne),a.ctx.restore()):a.ctx.fill())),oe.label=6;case 6:return n--,[2]}})},a=this,s=0,o=r.styles.backgroundImage.slice(0).reverse(),u.label=1;case 1:return s<o.length?(l=o[s],[5,i(l)]):[3,4];case 2:u.sent(),u.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(r,n,i){return Gl(this,void 0,void 0,function(){return Xo(this,function(a){return this.path(Nqe(i,n)),this.ctx.fillStyle=qs(r),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(r,n,i,a){return Gl(this,void 0,void 0,function(){var s,o;return Xo(this,function(l){switch(l.label){case 0:return n<3?[4,this.renderSolidBorder(r,i,a)]:[3,2];case 1:return l.sent(),[2];case 2:return s=FAr(a,i),this.path(s),this.ctx.fillStyle=qs(r),this.ctx.fill(),o=UAr(a,i),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(r){return Gl(this,void 0,void 0,function(){var n,i,a,s,o,l,u,h,d=this;return Xo(this,function(f){switch(f.label){case 0:return this.applyEffects(r.getEffects(2)),n=r.container.styles,i=!Pm(n.backgroundColor)||n.backgroundImage.length,a=[{style:n.borderTopStyle,color:n.borderTopColor,width:n.borderTopWidth},{style:n.borderRightStyle,color:n.borderRightColor,width:n.borderRightWidth},{style:n.borderBottomStyle,color:n.borderBottomColor,width:n.borderBottomWidth},{style:n.borderLeftStyle,color:n.borderLeftColor,width:n.borderLeftWidth}],s=KAr(DE(n.backgroundClip,0),r.curves),i||n.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),Pm(n.backgroundColor)||(this.ctx.fillStyle=qs(n.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:f.sent(),this.ctx.restore(),n.boxShadow.slice(0).reverse().forEach(function(p){d.ctx.save();var g=K6(r.curves),m=p.inset?0:YAr,A=BAr(g,-m+(p.inset?1:-1)*p.spread.number,(p.inset?1:-1)*p.spread.number,p.spread.number*(p.inset?-2:2),p.spread.number*(p.inset?-2:2));p.inset?(d.path(g),d.ctx.clip(),d.mask(A)):(d.mask(g),d.ctx.clip(),d.path(A)),d.ctx.shadowOffsetX=p.offsetX.number+m,d.ctx.shadowOffsetY=p.offsetY.number,d.ctx.shadowColor=qs(p.color),d.ctx.shadowBlur=p.blur.number,d.ctx.fillStyle=p.inset?qs(p.color):"rgba(0,0,0,1)",d.ctx.fill(),d.ctx.restore()}),f.label=2;case 2:o=0,l=0,u=a,f.label=3;case 3:return l<u.length?(h=u[l],h.style!==0&&!Pm(h.color)&&h.width>0?h.style!==2?[3,5]:[4,this.renderDashedDottedBorder(h.color,h.width,o,r.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return h.style!==3?[3,7]:[4,this.renderDashedDottedBorder(h.color,h.width,o,r.curves,3)];case 6:return f.sent(),[3,11];case 7:return h.style!==4?[3,9]:[4,this.renderDoubleBorder(h.color,h.width,o,r.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(h.color,o,r.curves)];case 10:f.sent(),f.label=11;case 11:o++,f.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(r,n,i,a,s){return Gl(this,void 0,void 0,function(){var o,l,u,h,d,f,p,g,m,A,v,y,_,b,S,E,S,E;return Xo(this,function(w){return this.ctx.save(),o=QAr(a,i),l=Nqe(a,i),s===2&&(this.path(l),this.ctx.clip()),eh(l[0])?(u=l[0].start.x,h=l[0].start.y):(u=l[0].x,h=l[0].y),eh(l[1])?(d=l[1].end.x,f=l[1].end.y):(d=l[1].x,f=l[1].y),i===0||i===2?p=Math.abs(u-d):p=Math.abs(h-f),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),g=n<3?n*3:n*2,m=n<3?n*2:n,s===3&&(g=n,m=n),A=!0,p<=g*2?A=!1:p<=g*2+m?(v=p/(2*g+m),g*=v,m*=v):(y=Math.floor((p+m)/(g+m)),_=(p-y*g)/(y-1),b=(p-(y+1)*g)/y,m=b<=0||Math.abs(m-_)<Math.abs(m-b)?_:b),A&&(s===3?this.ctx.setLineDash([0,g+m]):this.ctx.setLineDash([g,m])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=n):this.ctx.lineWidth=n*2+1.1,this.ctx.strokeStyle=qs(r),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(eh(l[0])&&(S=l[3],E=l[0],this.ctx.beginPath(),this.formatPath([new Jt(S.end.x,S.end.y),new Jt(E.start.x,E.start.y)]),this.ctx.stroke()),eh(l[1])&&(S=l[1],E=l[2],this.ctx.beginPath(),this.formatPath([new Jt(S.end.x,S.end.y),new Jt(E.start.x,E.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(r){return Gl(this,void 0,void 0,function(){var n;return Xo(this,function(i){switch(i.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=qs(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),n=PAr(r),[4,this.renderStack(n)];case 1:return i.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}(Mqe),XAr=function(t){return t instanceof aqe||t instanceof iqe?!0:t instanceof Fae&&t.type!==V6&&t.type!==z6},KAr=function(t,e){switch(t){case 0:return K6(e);case 2:return IAr(e);case 1:default:return Z6(e)}},ZAr=function(t){switch(t){case 1:return"center";case 2:return"right";case 0:default:return"left"}},jAr=["-apple-system","system-ui"],JAr=function(t){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?t.filter(function(e){return jAr.indexOf(e)===-1}):t},evr=function(t){Zh(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.canvas=n.canvas?n.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=n,i.canvas.width=Math.floor(n.width*n.scale),i.canvas.height=Math.floor(n.height*n.scale),i.canvas.style.width=n.width+"px",i.canvas.style.height=n.height+"px",i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-n.x,-n.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+n.width+"x"+n.height+" at "+n.x+","+n.y+") with scale "+n.scale),i}return e.prototype.render=function(r){return Gl(this,void 0,void 0,function(){var n,i;return Xo(this,function(a){switch(a.label){case 0:return n=Mae(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,tvr(n)];case 1:return i=a.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=qs(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(i,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}(Mqe),tvr=function(t){return new Promise(function(e,r){var n=new Image;n.onload=function(){e(n)},n.onerror=r,n.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(t))})},rvr=function(){function t(e){var r=e.id,n=e.enabled;this.id=r,this.enabled=n,this.start=Date.now()}return t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,c6([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},t.prototype.getTime=function(){return Date.now()-this.start},t.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,c6([this.id,this.getTime()+"ms"],e))},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,c6([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,c6([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},t.instances={},t}(),nvr=function(){function t(e,r){var n;this.windowBounds=r,this.instanceName="#"+t.instanceCount++,this.logger=new rvr({id:this.instanceName,enabled:e.logging}),this.cache=(n=e.cache)!==null&&n!==void 0?n:new EAr(this,e)}return t.instanceCount=1,t}(),Kae=function(t,e){return e===void 0&&(e={}),ivr(t,e)};typeof window<"u"&&Tqe.setContext(window);var ivr=function(t,e){return Gl(void 0,void 0,void 0,function(){var r,n,i,a,s,o,l,u,h,d,f,p,g,m,A,v,y,_,b,S,w,E,w,O,x,R,C,k,D,T,I,L,M,P,Q,z,G,V,ee,ae;return Xo(this,function(ne){switch(ne.label){case 0:if(!t||typeof t!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=t.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(n=r.defaultView,!n)throw new Error("Document is not attached to a Window");return i={allowTaint:(O=e.allowTaint)!==null&&O!==void 0?O:!1,imageTimeout:(x=e.imageTimeout)!==null&&x!==void 0?x:15e3,proxy:e.proxy,useCORS:(R=e.useCORS)!==null&&R!==void 0?R:!1},a=eae({logging:(C=e.logging)!==null&&C!==void 0?C:!0,cache:e.cache},i),s={windowWidth:(k=e.windowWidth)!==null&&k!==void 0?k:n.innerWidth,windowHeight:(D=e.windowHeight)!==null&&D!==void 0?D:n.innerHeight,scrollX:(T=e.scrollX)!==null&&T!==void 0?T:n.pageXOffset,scrollY:(I=e.scrollY)!==null&&I!==void 0?I:n.pageYOffset},o=new _g(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new nvr(a,o),u=(L=e.foreignObjectRendering)!==null&&L!==void 0?L:!1,h={allowTaint:(M=e.allowTaint)!==null&&M!==void 0?M:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:u,copyStyles:u},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),d=new wqe(l,t,h),f=d.clonedReferenceElement,f?[4,d.toIFrame(r,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return p=ne.sent(),g=Qae(f)||sAr(f)?Bfr(f.ownerDocument):u6(l,f),m=g.width,A=g.height,v=g.left,y=g.top,_=avr(l,f,e.backgroundColor),b={canvas:e.canvas,backgroundColor:_,scale:(Q=(P=e.scale)!==null&&P!==void 0?P:n.devicePixelRatio)!==null&&Q!==void 0?Q:1,x:((z=e.x)!==null&&z!==void 0?z:0)+v,y:((G=e.y)!==null&&G!==void 0?G:0)+y,width:(V=e.width)!==null&&V!==void 0?V:Math.ceil(m),height:(ee=e.height)!==null&&ee!==void 0?ee:Math.ceil(A)},u?(l.logger.debug("Document cloned, using foreign object rendering"),w=new evr(l,b),[4,w.render(f)]):[3,3];case 2:return S=ne.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+v+","+y+" with size "+m+"x"+A+" using computed rendering"),l.logger.debug("Starting DOM parsing"),E=lqe(l,f),_===E.styles.backgroundColor&&(E.styles.backgroundColor=Sg.TRANSPARENT),l.logger.debug("Starting renderer for element at "+b.x+","+b.y+" with size "+b.width+"x"+b.height),w=new WAr(l,b),[4,w.render(E)];case 4:S=ne.sent(),ne.label=5;case 5:return(!((ae=e.removeContainer)!==null&&ae!==void 0)||ae)&&(wqe.destroy(p)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,S]}})})},avr=function(t,e,r){var n=e.ownerDocument,i=n.documentElement?ok(t,getComputedStyle(n.documentElement).backgroundColor):Sg.TRANSPARENT,a=n.body?ok(t,getComputedStyle(n.body).backgroundColor):Sg.TRANSPARENT,s=typeof r=="string"?ok(t,r):r===null?Sg.TRANSPARENT:4294967295;return e===n.documentElement?Pm(i)?Pm(a)?s:a:i:s};class svr{constructor(){this.imageCache=new Map,this.defaultChartHeight=189,this.defaultChartWidth=567}canvasToBlob(e){return new Promise((r,n)=>{e.toBlob(i=>{i?(i.type!=="image/png"&&console.warn("Blob type 不是 image/png:",i.type),r(i)):n(new Error("Canvas to Blob 转换失败"))},"image/png",1)})}async captureEChartsAsImage(e){try{const r=await Kae(e,{backgroundColor:"#ffffff",scale:2,logging:!1,useCORS:!0}),n=r.width,i=r.height,a=await this.canvasToBlob(r),s=await this.blobToArrayBuffer(a);return{data:new Uint8Array(s),width:n,height:i}}catch(r){return console.error("捕获 ECharts 图表失败:",r),null}}async captureMermaidAsImage(e){try{const r=e.querySelector("svg");if(!r)return console.warn("未找到 Mermaid SVG 元素"),null;const n=r.getBoundingClientRect(),i=n.width,a=n.height,s=e.querySelector(".mermaid-controls");let o=null;s&&(o=s.style.display,s.style.display="none");try{const l=await Kae(e,{backgroundColor:"#ffffff",scale:2,logging:!1,useCORS:!0,allowTaint:!0,foreignObjectRendering:!1}),u=await this.canvasToBlob(l),h=await this.blobToArrayBuffer(u);return{data:new Uint8Array(h),width:l.width,height:l.height,displayWidth:i,displayHeight:a}}finally{s&&o!==null&&(s.style.display=o)}}catch(r){return console.error("捕获 Mermaid 图表失败:",r),null}}async captureMathAsImage(e){try{const r=e.getBoundingClientRect(),n=r.width,i=r.height,a=await Kae(e,{backgroundColor:"#ffffff",scale:3,logging:!1,useCORS:!0,allowTaint:!0}),s=await this.canvasToBlob(a),o=await this.blobToArrayBuffer(s);return{data:new Uint8Array(o),width:a.width,height:a.height,displayWidth:n,displayHeight:i}}catch(r){return console.error("捕获数学公式失败:",r),null}}async base64ToBlob(e){try{return await(await fetch(e)).blob()}catch(r){throw console.error("base64 转 Blob 失败:",r),r}}async blobToArrayBuffer(e){return new Promise((r,n)=>{const i=new FileReader;i.onload=()=>r(i.result),i.onerror=n,i.readAsArrayBuffer(e)})}base64ToUint8Array(e){try{const r=e.split(",")[1];if(!r)throw new Error("无效的 base64 数据");const n=atob(r),i=new Uint8Array(n.length);for(let a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return i}catch(r){throw console.error("base64 转换失败:",r),r}}validateImageData(e){return e.length<8?!1:e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71}parseMarkdown(e,r){return e.parse(r,{})}getDefaultTextStyle(){return{font:"宋体",size:20}}getDefaultSpacing(){return{before:120,after:0,line:288,lineRule:"auto"}}async convertTokensToDocx(e,r){const n=[];let i=0,a={},s=null,o=0,l=0,u=!1,h=[],d=0,f=[];for(let p=0;p<e.length;p++){const g=e[p];if(!(g.type==="fence"&&g.info.startsWith("dataset"))){if(g.type==="container_info_open"){s="info";continue}if(g.type==="container_warning_open"){s="warning";continue}if(g.type==="container_danger_open"){s="danger";continue}if(g.type==="container_success_open"){s="success";continue}if(g.type==="container_cell_open"){const m=g.info.match(/cell\s+(\d+)/);d=m?parseInt(m[1]):12,u=!0,h=[];continue}if(g.type==="container_cell_close"){if(f.push({width:d,contents:h}),f.reduce((A,v)=>A+v.width,0)>=12){const A=this.createGridTable(f);A&&n.push(A),f=[]}u=!1,h=[],d=0;continue}if(g.type==="container_info_close"||g.type==="container_warning_close"||g.type==="container_danger_close"||g.type==="container_success_close"){s=null,u||n.push(new Ua({text:"",spacing:{before:100,after:100}}));continue}if(g.type==="fence"&&g.info==="echarts"){const m=r.querySelectorAll('.echarts-container[data-processed="true"]');if(m[o]){try{const A=await this.captureEChartsAsImage(m[o]);if(A&&A.data)if(this.validateImageData(A.data)){let v,y;u?(v=Math.round(d/12*567*.9),y=300):(v=567,y=378);const _=A.width/A.height;let b=v,S=Math.round(b/_);S>y&&(S=y,b=Math.round(S*_));const E=new Ua({children:[new aVe({data:A.data,transformation:{width:b,height:S},type:"png",ext:"png",extension:"png"})],spacing:{before:200,after:200}});u?h.push(E):n.push(E)}else{console.warn("ECharts 图片数据无效");const v=new Ua({text:"[ECharts 图表]",spacing:{before:200,after:200}});u?h.push(v):n.push(v)}}catch(A){console.error("ECharts 图表转换失败:",A);const v=new Ua({text:"[ECharts 图表]",spacing:{before:200,after:200}});u?h.push(v):n.push(v)}o++}continue}if(g.type==="fence"&&g.info==="mermaid"){const m=r.querySelectorAll('.mermaid[data-processed="true"]');if(m[l]){try{await new Promise(v=>setTimeout(v,100));const A=await this.captureMermaidAsImage(m[l]);if(A&&A.data)if(this.validateImageData(A.data)){let v,y;if(u){const b=Math.round(d/12*567*.9),S=300,E=A.displayWidth/A.displayHeight;y=b,v=Math.round(y/E),v>S&&(v=S,y=Math.round(v*E))}else{v=this.defaultChartHeight;const b=A.displayWidth/A.displayHeight;y=Math.round(v*b)}const _=new Ua({children:[new aVe({data:A.data,transformation:{width:y,height:v},type:"png",ext:"png",extension:"png"})],spacing:{before:200,after:200}});u?h.push(_):n.push(_)}else{console.warn("Mermaid 图片数据无效");const v=new Ua({text:"[Mermaid 流程图]",spacing:{before:200,after:200}});u?h.push(v):n.push(v)}else{const v=new Ua({text:"[Mermaid 流程图]",spacing:{before:200,after:200}});u?h.push(v):n.push(v)}}catch(A){console.error("Mermaid 图表转换失败:",A);const v=new Ua({text:"[Mermaid 流程图]",spacing:{before:200,after:200}});u?h.push(v):n.push(v)}l++}continue}if(g.type==="heading_open"){parseInt(g.tag.substring(1));const m=e[p+1];if(m&&m.type==="inline"){const A=this.getDefaultTextStyle(),v=this.getDefaultSpacing(),y=new Ua({children:[new Wo({text:m.content,font:A.font,size:A.size,bold:!0})],spacing:v});u?h.push(y):n.push(y)}p+=2;continue}if(g.type==="paragraph_open"){const m=e[p+1];if(m&&m.type==="inline"){const A=this.parseInlineContent(m);if(A.length>0){const v=this.getDefaultSpacing(),y={children:A,spacing:v};if(s){const b=this.getContainerStyle(s);y.shading={fill:b.background},y.border={left:{color:b.borderColor,space:1,style:$l.SINGLE,size:24}}}const _=new Ua(y);u?h.push(_):n.push(_)}}p+=2;continue}if(g.type==="bullet_list_open"||g.type==="ordered_list_open"){const m=g.type==="ordered_list_open";i++,m&&(a[i]=1);continue}if(g.type==="bullet_list_close"||g.type==="ordered_list_close"){g.type==="ordered_list_close"&&delete a[i],i--;continue}if(g.type==="list_item_open"){const m=e[p+1];if(m&&m.type==="paragraph_open"){const A=e[p+2];if(A&&A.type==="inline"){const v=this.parseInlineContent(A),y=a[i]!==void 0,_=this.getDefaultTextStyle(),b=this.getDefaultSpacing(),S=y?`${a[i]}. `:"• ",E=new Ua({children:[new Wo({text:S,bold:!0,font:_.font,size:_.size}),...v],spacing:b,indent:{left:720*i}});u?h.push(E):n.push(E),y&&a[i]++}p+=3}continue}if(g.type==="math_block"||g.type==="math_block_end"){const m=this.getDefaultTextStyle(),A=this.getDefaultSpacing(),v=new Ua({children:[new Wo({text:g.content,font:"Cambria Math",size:m.size,italics:!0})],spacing:A,alignment:Xh.CENTER});u?h.push(v):n.push(v);continue}if(g.type==="fence"&&g.info!=="echarts"&&g.info!=="mermaid"&&!g.info.startsWith("dataset")){const m=g.content.split(`
1058
1058
  `).filter(y=>y.trim()),A=this.getDefaultTextStyle(),v=this.getDefaultSpacing();m.forEach(y=>{const _=new Ua({children:[new Wo({text:y,font:"Consolas",size:A.size})],spacing:v,shading:{fill:"F5F5F5"}});u?h.push(_):n.push(_)});continue}if(g.type==="table_open"){const m=this.parseTable(e,p);if(m){const A=this.createTable(m);u?h.push(A):n.push(A),p=m.endIndex}continue}if(g.type==="hr"){const m=new Ua({text:"",border:{bottom:{color:"CCCCCC",space:1,style:$l.SINGLE,size:6}},spacing:{before:200,after:200}});u?h.push(m):n.push(m);continue}}}if(f.length>0){const p=this.createGridTable(f);p&&n.push(p)}return n}parseInlineContent(e){const r=this.getDefaultTextStyle(),n=[];if(!e.children||e.children.length===0)return[new Wo({text:e.content||"",font:r.font,size:r.size})];e.children.forEach(s=>{s.type==="text"?n.push(new Wo({text:s.content,font:r.font,size:r.size})):s.type==="strong_open"||s.type==="strong_close"||s.type==="em_open"||s.type==="em_close"||(s.type==="code_inline"?n.push(new Wo({text:s.content,font:"Consolas",size:r.size,shading:{fill:"F5F5F5"}})):s.type==="math_inline"||s.type==="katex_inline"?n.push(new Wo({text:s.content,font:"Cambria Math",size:r.size,italics:!0})):s.type==="link_open"||s.type)});const i=[];let a=0;for(;a<e.children.length;){const s=e.children[a];if(s.type==="strong_open"&&a+2<e.children.length){const o=e.children[a+1];i.push(new Wo({text:o.content,bold:!0,font:r.font,size:r.size})),a+=3}else if(s.type==="em_open"&&a+2<e.children.length){const o=e.children[a+1];i.push(new Wo({text:o.content,italics:!0,font:r.font,size:r.size})),a+=3}else s.type==="text"?(i.push(new Wo({text:s.content,font:r.font,size:r.size})),a++):s.type==="code_inline"?(i.push(new Wo({text:s.content,font:"Consolas",size:r.size,shading:{fill:"F5F5F5"}})),a++):((s.type==="math_inline"||s.type==="katex_inline")&&i.push(new Wo({text:s.content,font:"Cambria Math",size:r.size,italics:!0})),a++)}return i.length>0?i:n}parseTable(e,r){const n=[];let i=r+1,a=!0;for(;i<e.length&&e[i].type!=="table_close";){if(e[i].type==="thead_open"||e[i].type==="tbody_open"){i++;continue}if(e[i].type==="thead_close"){a=!1,i++;continue}if(e[i].type==="tbody_close"){i++;continue}if(e[i].type==="tr_open"){const s=[];for(i++;i<e.length&&e[i].type!=="tr_close";)e[i].type==="th_open"||e[i].type==="td_open"?(i++,e[i]&&e[i].type==="inline"&&s.push({text:e[i].content,isHeader:a}),i+=2):i++;s.length>0&&n.push(s),i++}else i++}return n.length>0?{rows:n,endIndex:i}:null}createGridTable(e){if(!e||e.length===0)return null;const r=e.map(n=>new i6({children:n.contents.length>0?n.contents:[new Ua({text:""})],width:{size:n.width/12*100,type:yE.PERCENTAGE},borders:{top:{style:$l.NONE,size:0,color:"FFFFFF"},bottom:{style:$l.NONE,size:0,color:"FFFFFF"},left:{style:$l.NONE,size:0,color:"FFFFFF"},right:{style:$l.NONE,size:0,color:"FFFFFF"}},margins:{top:100,bottom:100,left:100,right:100}}));return new yVe({rows:[new _Ve({children:r})],width:{size:100,type:yE.PERCENTAGE},borders:{top:{style:$l.NONE,size:0,color:"FFFFFF"},bottom:{style:$l.NONE,size:0,color:"FFFFFF"},left:{style:$l.NONE,size:0,color:"FFFFFF"},right:{style:$l.NONE,size:0,color:"FFFFFF"},insideHorizontal:{style:$l.NONE,size:0,color:"FFFFFF"},insideVertical:{style:$l.NONE,size:0,color:"FFFFFF"}}})}createTable(e){const r=this.getDefaultTextStyle(),n=e.rows.map(i=>new _Ve({children:i.map(a=>new i6({children:[new Ua({children:[new Wo({text:a.text,bold:a.isHeader,font:r.font,size:r.size})],spacing:{before:0,after:0,line:288,lineRule:"auto"}})],shading:a.isHeader?{fill:"F0F0F0"}:void 0}))}));return new yVe({rows:n,width:{size:100,type:yE.PERCENTAGE}})}getContainerStyle(e){const r={info:{background:"E3F2FD",borderColor:"2196F3"},warning:{background:"FFF3E0",borderColor:"FF9800"},danger:{background:"FFEBEE",borderColor:"F44336"},success:{background:"E8F5E9",borderColor:"4CAF50"}};return r[e]||r.info}getHeadingLevel(e){return{1:fy.HEADING_1,2:fy.HEADING_2,3:fy.HEADING_3,4:fy.HEADING_4,5:fy.HEADING_5,6:fy.HEADING_6}[e]||fy.HEADING_1}async exportToWord(e,r,n,i="document.docx"){try{const a=this.parseMarkdown(e,r),s=await this.convertTokensToDocx(a,n),o=new yfr({sections:[{properties:{},children:s}]}),l=await Lfr.toBlob(o);return Mfr.saveAs(l,i),{success:!0,message:"导出成功"}}catch(a){return console.error("导出 Word 文档失败:",a),{success:!1,message:a.message}}}}const ovr={name:"MarkdownEditor",components:{EditModal:Lor,DatasetPanel:Qor},props:{content:{type:String,default:""},editable:{type:Boolean,default:!1},defaultShowEditor:{type:Boolean,default:!0},datasource:{type:Object,required:!1,validator:t=>["getDataSource","getDataSourceList","clearDataSourceCache","testDataSourceConnection"].every(r=>typeof t[r]=="function")},dark:{type:[Boolean,String],default:"auto",validator:t=>t==="auto"||typeof t=="boolean"},theme:{type:Object,default:()=>({})},showFullscreenButton:{type:Boolean,default:!1}},emits:["update:content","errors"],data(){return{showEditor:this.defaultShowEditor,md:null,chartRenderer:null,datasetRenderer:null,mermaidRenderer:null,d3Renderer:null,renderTimeout:null,editModalVisible:!1,currentEditContent:"",currentComponentType:"",currentComponentId:"",currentTokenStart:0,currentTokenEnd:0,isResizing:!1,editorWidth:500,minEditorWidth:300,maxEditorWidth:800,renderErrors:[],_isMounted:!1,_isRendering:!1,isDashboardMode:!1,isFullscreen:!1}},watch:{content:{handler(t){this.detectDashboardMode(t),this._isMounted&&!this._isRendering&&(this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout(()=>{this.$nextTick(()=>{this.renderWithQueue()})},150))},immediate:!0},showEditor:{handler(){this.$nextTick(()=>{var t;return(t=this.chartRenderer)==null?void 0:t.processEChartsElements()})}},localContent:{handler(t,e){t!==e&&this._isMounted&&this.$emit("update:content",t),this._isMounted&&!this._isRendering&&(this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout(()=>{this.$nextTick(()=>{this.renderWithQueue()})},150))}},isDarkMode:{handler(){if(this._isMounted){this.updateMermaidTheme();const t=this.isDarkMode?"dark":"light";this.chartRenderer.setTheme(t),this.$nextTick(()=>{this.clearProcessedMarks(),this.renderWithQueue()})}}}},created(){this.md=C8e(this.editable),this.chartRenderer=new vNt,this.datasetRenderer=new Agt,this.mermaidRenderer=new GZt,this.d3Renderer=new HZt,this.wordExporter=new svr,this.datasetRenderer.setDataSourceFunctions(this.datasource),this.chartRenderer.setDataset(this.datasetRenderer.getDataset()),this.d3Renderer.setDataset(this.datasetRenderer.getDataset()),this.updateMermaidTheme(),this.detectDashboardMode(this.content)},computed:{contentModel:{get(){return this.content},set(t){this.$emit("update:content",t)}},renderedContent(){return this.md?this.md.render(this.content):""},isDarkMode(){return this.dark==="auto"?typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1:this.dark===!0},themeVars(){const t=this.isDarkMode?"dark":"light",e=$or[t],r=this.theme[t]||{};return{...e,...r}}},mounted(){this._isMounted=!0,this.content&&this.localContent!==this.content&&(this.localContent=this.content),this.dark==="auto"&&typeof window<"u"&&window.matchMedia&&(this._themeMediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this._handleThemeChange=()=>{this.$forceUpdate()},this._themeMediaQuery.addEventListener("change",this._handleThemeChange));const t=this.$el.querySelector(".preview-container");t&&(this._handleEditClick=e=>{const r=e.target.closest('[data-editable="true"]');if(!r)return;e.stopPropagation(),e.preventDefault();const n=r.getBoundingClientRect(),i={left:n.right-20,top:n.top,right:n.right,bottom:n.top+20};if(!(e.clientX>=i.left&&e.clientX<=i.right&&e.clientY>=i.top&&e.clientY<=i.bottom))return;const s=r.getAttribute("data-component-id"),o=r.getAttribute("data-component-type"),l=r.getAttribute("data-position");if(s&&o&&l){const[u,h]=l.split(",").map(Number),d=this.content.substring(u,h);this.currentComponentId=s,this.currentComponentType=o,this.currentEditContent=d,this.currentTokenStart=u,this.currentTokenEnd=h,this.editModalVisible=!0}},t.addEventListener("click",this._handleEditClick)),this.$nextTick(()=>{const e=this.isDarkMode?"dark":"light",r=this.isDarkMode?"dark":"default";this.chartRenderer.setTheme(e),this.d3Renderer.setTheme(e),this.mermaidRenderer.initialize(r),this.renderWithQueue(),this.chartRenderer.observeDOM(".preview-container"),this.datasetRenderer.observeDOM(".preview-container"),this.d3Renderer.observeDOM(".preview-container"),this.mermaidRenderer.observeDOM(".preview-container")})},beforeUnmount(){var e,r,n,i;this._isMounted=!1,this.renderTimeout&&(clearTimeout(this.renderTimeout),this.renderTimeout=null),this._themeMediaQuery&&this._handleThemeChange&&(this._themeMediaQuery.removeEventListener("change",this._handleThemeChange),this._themeMediaQuery=null,this._handleThemeChange=null);const t=(e=this.$el)==null?void 0:e.querySelector(".preview-container");t&&this._handleEditClick&&(t.removeEventListener("click",this._handleEditClick),this._handleEditClick=null),(r=this.chartRenderer)==null||r.cleanup(),(n=this.datasetRenderer)==null||n.cleanup(),(i=this.mermaidRenderer)==null||i.cleanup()},methods:{detectDashboardMode(t){const e=/<!--\s*dashboard\s*-->/.test(t);e!==this.isDashboardMode&&(this.isDashboardMode=e)},clearProcessedMarks(){const t=this.$el.querySelector(".preview-container");if(!t)return;t.querySelectorAll('.mermaid[data-processed="true"]').forEach(i=>{i.removeAttribute("data-processed"),i.dataset.originalCode&&(i.textContent=i.dataset.originalCode)}),t.querySelectorAll('.echarts-container[data-processed="true"]').forEach(i=>{i.removeAttribute("data-processed")}),t.querySelectorAll('.dataset-container[data-processed="true"]').forEach(i=>{i.removeAttribute("data-processed")})},updateMermaidTheme(){const t=this.isDarkMode?"dark":"default";this.mermaidRenderer&&this.mermaidRenderer.setTheme(t)},handleResizerMouseDown(t){this.$emit("update:content",this.content)},async renderWithQueue(){if(!this._isRendering){this._isRendering=!0;try{this.chartRenderer.clearErrors(),this.datasetRenderer.clearErrors(),this.mermaidRenderer.clearErrors(),this.d3Renderer.clearErrors(),JD.clearErrors(),await this.datasetRenderer.renderDatasets(),await this.$nextTick(),this.chartRenderer.processEChartsElements(),this.d3Renderer.processD3Elements(),this.mermaidRenderer.renderMermaidCharts(),setTimeout(()=>{this.collectRenderErrors()},300)}catch(t){console.warn("渲染过程中发生错误:",t),setTimeout(()=>{this.collectRenderErrors()},300)}finally{this._isRendering=!1}}},getErrors(){return[...this.renderErrors]},collectRenderErrors(){const t=[],e=this.content.split(`
1059
- `);[...this.chartRenderer.getErrors(),...this.datasetRenderer.getErrors(),...this.mermaidRenderer.getErrors(),...this.d3Renderer.getErrors(),...JD.getErrors()].forEach(n=>{const i=this.findErrorLocation(n.message,e,n.type,n.code,n.line);i&&t.push(i)}),this.renderErrors=t,this.$emit("errors",t)},findErrorLocation(t,e,r=null,n=null,i=null){let a=-1,s=r||"Unknown",o=t;if(typeof i=="number"&&i>0&&(a=i),r||(t.includes("ECharts")?s="ECharts":t.includes("D3")?s="D3":t.includes("数据集")||t.includes("dataset")?s="Dataset":t.includes("Mermaid")&&(s="Mermaid")),a>0){const{codeSnippet:h,startLine:d,endLine:f}=this._extractBlockByLine(e,a,s)||{},p=o.replace(/^(ECharts|数据集|Mermaid|Container)(渲染|配置处理)?错误:\s*/i,"").replace(/\s*at\s+.*$/gm,"").split(`
1059
+ `);[...this.chartRenderer.getErrors(),...this.datasetRenderer.getErrors(),...this.mermaidRenderer.getErrors(),...this.d3Renderer.getErrors(),...JD.getErrors()].forEach(n=>{const i=this.findErrorLocation(n.message,e,n.type,n.code,n.line);i?t.push(i):n&&n.message&&t.push({line:typeof n.line=="number"&&n.line>0?n.line:-1,lineEnd:typeof n.line=="number"&&n.line>0?n.line:-1,type:n.type||"Unknown",message:n.message,code:n.code||"",severity:"error"})}),this.renderErrors=t,this.$emit("errors",t)},findErrorLocation(t,e,r=null,n=null,i=null){let a=-1,s=r||"Unknown",o=t;if(typeof i=="number"&&i>0&&(a=i),r||(t.includes("ECharts")?s="ECharts":t.includes("D3")?s="D3":t.includes("数据集")||t.includes("dataset")?s="Dataset":t.includes("Mermaid")&&(s="Mermaid")),a>0){const{codeSnippet:h,startLine:d,endLine:f}=this._extractBlockByLine(e,a,s)||{},p=o.replace(/^(ECharts|数据集|Mermaid|Container)(渲染|配置处理)?错误:\s*/i,"").replace(/\s*at\s+.*$/gm,"").split(`
1060
1060
  `)[0].trim();if(d)return{line:d,type:s,message:p,code:h,severity:"error",lineEnd:f}}let l=[],u=-1;for(let h=0;h<e.length;h++){const d=e[h];s==="ECharts"&&d.includes("```echarts")||s==="D3"&&(d.includes("```d3")||d.includes("```d3js"))?l.push(h+1):s==="Dataset"&&d.includes("```dataset")?(l.push(h+1),n&&n.includes(d.trim())&&(u=h+1)):(s==="Mermaid"&&d.includes("```mermaid")||s==="Container"&&d.includes("::: cell"))&&l.push(h+1)}if(u>0?a=u:l.length>0&&(a=l[l.length-1]),a>0){const h=Math.max(0,a-1);let d=h+1;if(s==="Container"){for(let g=h+1;g<e.length;g++)if(e[g].trim()===":::"){d=g+1;break}}else for(let g=h+1;g<e.length;g++)if(e[g].trim()==="```"){d=g+1;break}d=Math.min(e.length,d);const f=e.slice(h,d).join(`
1061
1061
  `);let p=o.replace(/^(ECharts|数据集|Mermaid|Container)(渲染|配置处理)?错误:\s*/i,"").replace(/\s*at\s+.*$/gm,"").split(`
1062
1062
  `)[0].trim();return{line:a,type:s,message:p,code:f,severity:"error"}}return null},_extractBlockByLine(t,e,r){const n=r==="Container",i=n?":::":"```",a=e-1;let s=a,o=a;for(let l=a;l>=0;l--){const u=t[l].trim();if(!n&&u.startsWith("```")||n&&u.startsWith(":::")){s=l;break}}for(let l=a+1;l<t.length;l++){const u=t[l].trim();if(!n&&u==="```"||n&&u===":::"){o=l;break}}return o<s&&(o=Math.min(t.length-1,a+3)),{codeSnippet:t.slice(s,o+1).join(`
1063
- `),startLine:s+1,endLine:o+1,marker:i}},handleEditSave(t){if(this.currentComponentId&&this.currentComponentType){const e=this.currentTokenStart,r=this.currentTokenEnd;let n=this.content;if(e!==void 0&&r!==void 0){const i=this.content.substring(0,e),a=this.content.substring(r);n=i+t+a;const s=r-e,l=t.length-s;l!==0&&this.$nextTick(()=>{this._updateSubsequentPositions(r,l)})}else{console.error("未找到精确位置信息,无法进行内容替换");return}this.$emit("update:content",n),this.editModalVisible=!1}},_updateSubsequentPositions(t,e){document.querySelectorAll('[data-editable="true"][data-position]').forEach(n=>{const i=n.getAttribute("data-position");if(!i)return;const[a,s]=i.split(",").map(Number);if(a>=t){const o=a+e,l=s+e;n.setAttribute("data-position",`${o},${l}`)}})},handleEditClose(){this.editModalVisible=!1,this.currentComponentId="",this.currentComponentType="",this.currentEditContent="",this.currentTokenStart=0,this.currentTokenEnd=0},handleEditFromPanel(t,e,r){const[n,i]=r.split(",").map(Number),a=this.content.substring(n,i);this.currentComponentId=t,this.currentComponentType=e,this.currentEditContent=a,this.currentTokenStart=n,this.currentTokenEnd=i,this.editModalVisible=!0},toggleEditor(){this.showEditor=!this.showEditor},toggleFullscreen(){this.isFullscreen=!this.isFullscreen},startResize(t){this.isResizing=!0,document.addEventListener("mousemove",this.handleResize),document.addEventListener("mouseup",this.stopResize),t.preventDefault()},handleResize(t){if(!this.isResizing)return;const n=this.$el.getBoundingClientRect().right-t.clientX;n>=this.minEditorWidth&&n<=this.maxEditorWidth&&(this.editorWidth=n)},stopResize(){this.isResizing=!1,document.removeEventListener("mousemove",this.handleResize),document.removeEventListener("mouseup",this.stopResize),this.$nextTick(()=>{var t;(t=this.chartRenderer)==null||t.processEChartsElements()})},async exportToWord(t="document.docx"){try{const e=this.$el.querySelector(".preview-container");return e?(await this.$nextTick(),await this.wordExporter.exportToWord(this.md,this.content,e,t)):{success:!1,message:"预览容器未找到"}}catch(e){return console.error("导出失败:",e),{success:!1,message:e.message}}}}},lvr=["data-theme-mode"],cvr=["title"],uvr={key:0,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},hvr={key:1,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},dvr=["innerHTML"];function fvr(t,e,r,n,i,a){const s=Dt.resolveComponent("DatasetPanel"),o=Dt.resolveComponent("EditModal");return Dt.openBlock(),Dt.createElementBlock("div",{class:Dt.normalizeClass(["markdown-editor",{"dashboard-mode":i.isDashboardMode,fullscreen:i.isFullscreen}]),"data-theme-mode":a.isDarkMode?"dark":"light",style:Dt.normalizeStyle(a.themeVars)},[i.isDashboardMode&&r.showFullscreenButton?(Dt.openBlock(),Dt.createElementBlock("div",{key:0,class:"fullscreen-toggle",onClick:e[0]||(e[0]=(...l)=>a.toggleFullscreen&&a.toggleFullscreen(...l)),title:i.isFullscreen?"退出全屏":"全屏"},[i.isFullscreen?(Dt.openBlock(),Dt.createElementBlock("svg",hvr,[...e[6]||(e[6]=[Dt.createElementVNode("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"},null,-1)])])):(Dt.openBlock(),Dt.createElementBlock("svg",uvr,[...e[5]||(e[5]=[Dt.createElementVNode("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"},null,-1)])]))],8,cvr)):Dt.createCommentVNode("",!0),i.isDashboardMode?(Dt.openBlock(),Dt.createBlock(s,{key:1,ref:"datasetPanel"},null,512)):Dt.createCommentVNode("",!0),Dt.createElementVNode("div",{class:Dt.normalizeClass(["preview-container",{"full-width":!i.showEditor}])},[Dt.createElementVNode("div",{class:"markdown-body",innerHTML:a.renderedContent},null,8,dvr)],2),r.editable?(Dt.openBlock(),Dt.createElementBlock("div",{key:2,class:Dt.normalizeClass(["resizer",{"resizer-collapsed":!i.showEditor}])},[i.showEditor?(Dt.openBlock(),Dt.createElementBlock("div",{key:0,class:"resizer-draggable",onMousedown:e[1]||(e[1]=(...l)=>a.startResize&&a.startResize(...l))},null,32)):Dt.createCommentVNode("",!0),Dt.createElementVNode("div",{class:"resizer-toggle",onClick:e[2]||(e[2]=(...l)=>a.toggleEditor&&a.toggleEditor(...l))},[Dt.createElementVNode("span",null,Dt.toDisplayString(i.showEditor?"›":"‹"),1)])],2)):Dt.createCommentVNode("",!0),r.editable&&i.showEditor?(Dt.openBlock(),Dt.createElementBlock("div",{key:3,class:"editor-container",style:Dt.normalizeStyle({width:i.editorWidth+"px"})},[Dt.withDirectives(Dt.createElementVNode("textarea",{"onUpdate:modelValue":e[3]||(e[3]=l=>a.contentModel=l),class:"editor",placeholder:"请输入 Markdown 内容..."},null,512),[[Dt.vModelText,a.contentModel]])],4)):Dt.createCommentVNode("",!0),Dt.createVNode(o,{visible:i.editModalVisible,"onUpdate:visible":e[4]||(e[4]=l=>i.editModalVisible=l),content:i.currentEditContent,"component-type":i.currentComponentType,onSave:a.handleEditSave,onClose:a.handleEditClose},null,8,["visible","content","component-type","onSave","onClose"])],14,lvr)}const Bqe=Gre(ovr,[["render",fvr],["__scopeId","data-v-fccba39d"]]);var pvr="[object Symbol]";function by(t){return typeof t=="symbol"||Gu(t)&&zp(t)==pvr}function Sy(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var Pqe=Qu?Qu.prototype:void 0,Fqe=Pqe?Pqe.toString:void 0;function Uqe(t){if(typeof t=="string")return t;if(yn(t))return Sy(t,Uqe)+"";if(by(t))return Fqe?Fqe.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var gvr=/\s/;function mvr(t){for(var e=t.length;e--&&gvr.test(t.charAt(e)););return e}var Avr=/^\s+/;function vvr(t){return t&&t.slice(0,mvr(t)+1).replace(Avr,"")}var Qqe=NaN,yvr=/^[-+]0x[0-9a-f]+$/i,_vr=/^0b[01]+$/i,bvr=/^0o[0-7]+$/i,Svr=parseInt;function Evr(t){if(typeof t=="number")return t;if(by(t))return Qqe;if(fc(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=fc(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=vvr(t);var r=_vr.test(t);return r||bvr.test(t)?Svr(t.slice(2),r?2:8):yvr.test(t)?Qqe:+t}var $qe=1/0,wvr=17976931348623157e292;function r8(t){if(!t)return t===0?t:0;if(t=Evr(t),t===$qe||t===-$qe){var e=t<0?-1:1;return e*wvr}return t===t?t:0}function n8(t){var e=r8(t),r=e%1;return e===e?r?e-r:e:0}function bs(){}function Gqe(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}function zqe(t,e,r,n){for(var i=t.length,a=r+-1;++a<i;)if(e(t[a],a,t))return a;return-1}function xvr(t){return t!==t}function Tvr(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function Zae(t,e,r){return e===e?Tvr(t,e,r):zqe(t,xvr,r)}function Vqe(t,e){var r=t==null?0:t.length;return!!r&&Zae(t,e,0)>-1}function Ss(t){return af(t)?TMe(t):C6e(t)}var Ovr=Object.prototype,Cvr=Ovr.hasOwnProperty,Kc=IMe(function(t,e){if(EC(e)||af(e)){DS(e,Ss(e),t);return}for(var r in e)Cvr.call(e,r)&&TC(t,r,e[r])}),Rvr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kvr=/^\w*$/;function jae(t,e){if(yn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||by(t)?!0:kvr.test(t)||!Rvr.test(t)||e!=null&&t in Object(e)}var Ivr=500;function Nvr(t){var e=kS(t,function(n){return r.size===Ivr&&r.clear(),n}),r=e.cache;return e}var Dvr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lvr=/\\(\\)?/g,Mvr=Nvr(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Dvr,function(r,n,i,a){e.push(i?a.replace(Lvr,"$1"):n||r)}),e});function Hqe(t){return t==null?"":Uqe(t)}function i8(t,e){return yn(t)?t:jae(t,e)?[t]:Mvr(Hqe(t))}function pk(t){if(typeof t=="string"||by(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function a8(t,e){e=i8(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[pk(e[r++])];return r&&r==n?t:void 0}function Bvr(t,e,r){var n=t==null?void 0:a8(t,e);return n===void 0?r:n}function Jae(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var qqe=Qu?Qu.isConcatSpreadable:void 0;function Pvr(t){return yn(t)||IS(t)||!!(qqe&&t&&t[qqe])}function gk(t,e,r,n,i){var a=-1,s=t.length;for(r||(r=Pvr),i||(i=[]);++a<s;){var o=t[a];r(o)?Jae(i,o):n||(i[i.length]=o)}return i}function Ys(t){var e=t==null?0:t.length;return e?gk(t):[]}function Fvr(t){return kMe(RMe(t,void 0,Ys),t+"")}function Yqe(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var a=Array(i);++n<i;)a[n]=t[n+e];return a}function Uvr(t,e,r,n){var i=-1,a=t==null?0:t.length;for(n&&a&&(r=t[++i]);++i<a;)r=e(r,t[i],i,t);return r}function Qvr(t,e){return t&&DS(e,Ss(e),t)}function $vr(t,e){return t&&DS(e,F1(e),t)}function ese(t,e){for(var r=-1,n=t==null?0:t.length,i=0,a=[];++r<n;){var s=t[r];e(s,r,t)&&(a[i++]=s)}return a}function Wqe(){return[]}var Gvr=Object.prototype,zvr=Gvr.propertyIsEnumerable,Xqe=Object.getOwnPropertySymbols,tse=Xqe?function(t){return t==null?[]:(t=Object(t),ese(Xqe(t),function(e){return zvr.call(t,e)}))}:Wqe;function Vvr(t,e){return DS(t,tse(t),e)}var Hvr=Object.getOwnPropertySymbols,Kqe=Hvr?function(t){for(var e=[];t;)Jae(e,tse(t)),t=gJ(t);return e}:Wqe;function qvr(t,e){return DS(t,Kqe(t),e)}function Zqe(t,e,r){var n=e(t);return yn(t)?n:Jae(n,r(t))}function rse(t){return Zqe(t,Ss,tse)}function jqe(t){return Zqe(t,F1,Kqe)}var Yvr=Object.prototype,Wvr=Yvr.hasOwnProperty;function Xvr(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Wvr.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function Kvr(t,e){var r=e?pJ(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Zvr=/\w*$/;function jvr(t){var e=new t.constructor(t.source,Zvr.exec(t));return e.lastIndex=t.lastIndex,e}var Jqe=Qu?Qu.prototype:void 0,eYe=Jqe?Jqe.valueOf:void 0;function Jvr(t){return eYe?Object(eYe.call(t)):{}}var e1r="[object Boolean]",t1r="[object Date]",r1r="[object Map]",n1r="[object Number]",i1r="[object RegExp]",a1r="[object Set]",s1r="[object String]",o1r="[object Symbol]",l1r="[object ArrayBuffer]",c1r="[object DataView]",u1r="[object Float32Array]",h1r="[object Float64Array]",d1r="[object Int8Array]",f1r="[object Int16Array]",p1r="[object Int32Array]",g1r="[object Uint8Array]",m1r="[object Uint8ClampedArray]",A1r="[object Uint16Array]",v1r="[object Uint32Array]";function y1r(t,e,r){var n=t.constructor;switch(e){case l1r:return pJ(t);case e1r:case t1r:return new n(+t);case c1r:return Kvr(t,r);case u1r:case h1r:case d1r:case f1r:case p1r:case g1r:case m1r:case A1r:case v1r:return fMe(t,r);case r1r:return new n;case n1r:case s1r:return new n(t);case i1r:return jvr(t);case a1r:return new n;case o1r:return Jvr(t)}}var _1r="[object Map]";function b1r(t){return Gu(t)&&Vu(t)==_1r}var tYe=cm&&cm.isMap,S1r=tYe?wC(tYe):b1r,E1r="[object Set]";function w1r(t){return Gu(t)&&Vu(t)==E1r}var rYe=cm&&cm.isSet,x1r=rYe?wC(rYe):w1r,T1r=1,O1r=2,C1r=4,nYe="[object Arguments]",R1r="[object Array]",k1r="[object Boolean]",I1r="[object Date]",N1r="[object Error]",iYe="[object Function]",D1r="[object GeneratorFunction]",L1r="[object Map]",M1r="[object Number]",aYe="[object Object]",B1r="[object RegExp]",P1r="[object Set]",F1r="[object String]",U1r="[object Symbol]",Q1r="[object WeakMap]",$1r="[object ArrayBuffer]",G1r="[object DataView]",z1r="[object Float32Array]",V1r="[object Float64Array]",H1r="[object Int8Array]",q1r="[object Int16Array]",Y1r="[object Int32Array]",W1r="[object Uint8Array]",X1r="[object Uint8ClampedArray]",K1r="[object Uint16Array]",Z1r="[object Uint32Array]",Li={};Li[nYe]=Li[R1r]=Li[$1r]=Li[G1r]=Li[k1r]=Li[I1r]=Li[z1r]=Li[V1r]=Li[H1r]=Li[q1r]=Li[Y1r]=Li[L1r]=Li[M1r]=Li[aYe]=Li[B1r]=Li[P1r]=Li[F1r]=Li[U1r]=Li[W1r]=Li[X1r]=Li[K1r]=Li[Z1r]=!0,Li[N1r]=Li[iYe]=Li[Q1r]=!1;function mk(t,e,r,n,i,a){var s,o=e&T1r,l=e&O1r,u=e&C1r;if(s!==void 0)return s;if(!fc(t))return t;var h=yn(t);if(h){if(s=Xvr(t),!o)return pMe(t,s)}else{var d=Vu(t),f=d==iYe||d==D1r;if(NS(t))return dMe(t,o);if(d==aYe||d==nYe||f&&!i){if(s=l||f?{}:AMe(t),!o)return l?qvr(t,$vr(s,t)):Vvr(t,Qvr(s,t))}else{if(!Li[d])return i?t:{};s=y1r(t,d,o)}}a||(a=new $h);var p=a.get(t);if(p)return p;a.set(t,s),x1r(t)?t.forEach(function(A){s.add(mk(A,e,r,A,t,a))}):S1r(t)&&t.forEach(function(A,v){s.set(v,mk(A,e,r,v,t,a))});var g=u?l?jqe:rse:l?F1:Ss,m=h?void 0:g(t);return Gqe(m||t,function(A,v){m&&(v=A,A=t[v]),TC(s,v,mk(A,e,r,v,t,a))}),s}var j1r=4;function Es(t){return mk(t,j1r)}var J1r=1,eyr=4;function tyr(t){return mk(t,J1r|eyr)}function Ak(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var a=t[e];a&&(i[n++]=a)}return i}var ryr="__lodash_hash_undefined__";function nyr(t){return this.__data__.set(t,ryr),this}function iyr(t){return this.__data__.has(t)}function LE(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Hp;++e<r;)this.add(t[e])}LE.prototype.add=LE.prototype.push=nyr,LE.prototype.has=iyr;function sYe(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function nse(t,e){return t.has(e)}var ayr=1,syr=2;function oYe(t,e,r,n,i,a){var s=r&ayr,o=t.length,l=e.length;if(o!=l&&!(s&&l>o))return!1;var u=a.get(t),h=a.get(e);if(u&&h)return u==e&&h==t;var d=-1,f=!0,p=r&syr?new LE:void 0;for(a.set(t,e),a.set(e,t);++d<o;){var g=t[d],m=e[d];if(n)var A=s?n(m,g,d,e,t,a):n(g,m,d,t,e,a);if(A!==void 0){if(A)continue;f=!1;break}if(p){if(!sYe(e,function(v,y){if(!nse(p,y)&&(g===v||i(g,v,r,n,a)))return p.push(y)})){f=!1;break}}else if(!(g===m||i(g,m,r,n,a))){f=!1;break}}return a.delete(t),a.delete(e),f}function oyr(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function ise(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var lyr=1,cyr=2,uyr="[object Boolean]",hyr="[object Date]",dyr="[object Error]",fyr="[object Map]",pyr="[object Number]",gyr="[object RegExp]",myr="[object Set]",Ayr="[object String]",vyr="[object Symbol]",yyr="[object ArrayBuffer]",_yr="[object DataView]",lYe=Qu?Qu.prototype:void 0,ase=lYe?lYe.valueOf:void 0;function byr(t,e,r,n,i,a,s){switch(r){case _yr:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case yyr:return!(t.byteLength!=e.byteLength||!a(new QM(t),new QM(e)));case uyr:case hyr:case pyr:return RS(+t,+e);case dyr:return t.name==e.name&&t.message==e.message;case gyr:case Ayr:return t==e+"";case fyr:var o=oyr;case myr:var l=n&lyr;if(o||(o=ise),t.size!=e.size&&!l)return!1;var u=s.get(t);if(u)return u==e;n|=cyr,s.set(t,e);var h=oYe(o(t),o(e),n,i,a,s);return s.delete(t),h;case vyr:if(ase)return ase.call(t)==ase.call(e)}return!1}var Syr=1,Eyr=Object.prototype,wyr=Eyr.hasOwnProperty;function xyr(t,e,r,n,i,a){var s=r&Syr,o=rse(t),l=o.length,u=rse(e),h=u.length;if(l!=h&&!s)return!1;for(var d=l;d--;){var f=o[d];if(!(s?f in e:wyr.call(e,f)))return!1}var p=a.get(t),g=a.get(e);if(p&&g)return p==e&&g==t;var m=!0;a.set(t,e),a.set(e,t);for(var A=s;++d<l;){f=o[d];var v=t[f],y=e[f];if(n)var _=s?n(y,v,f,e,t,a):n(v,y,f,t,e,a);if(!(_===void 0?v===y||i(v,y,r,n,a):_)){m=!1;break}A||(A=f=="constructor")}if(m&&!A){var b=t.constructor,S=e.constructor;b!=S&&"constructor"in t&&"constructor"in e&&!(typeof b=="function"&&b instanceof b&&typeof S=="function"&&S instanceof S)&&(m=!1)}return a.delete(t),a.delete(e),m}var Tyr=1,cYe="[object Arguments]",uYe="[object Array]",s8="[object Object]",Oyr=Object.prototype,hYe=Oyr.hasOwnProperty;function Cyr(t,e,r,n,i,a){var s=yn(t),o=yn(e),l=s?uYe:Vu(t),u=o?uYe:Vu(e);l=l==cYe?s8:l,u=u==cYe?s8:u;var h=l==s8,d=u==s8,f=l==u;if(f&&NS(t)){if(!NS(e))return!1;s=!0,h=!1}if(f&&!h)return a||(a=new $h),s||GM(t)?oYe(t,e,r,n,i,a):byr(t,e,l,r,n,i,a);if(!(r&Tyr)){var p=h&&hYe.call(t,"__wrapped__"),g=d&&hYe.call(e,"__wrapped__");if(p||g){var m=p?t.value():t,A=g?e.value():e;return a||(a=new $h),i(m,A,r,n,a)}}return f?(a||(a=new $h),xyr(t,e,r,n,i,a)):!1}function sse(t,e,r,n,i){return t===e?!0:t==null||e==null||!Gu(t)&&!Gu(e)?t!==t&&e!==e:Cyr(t,e,r,n,sse,i)}var Ryr=1,kyr=2;function Iyr(t,e,r,n){var i=r.length,a=i;if(t==null)return!a;for(t=Object(t);i--;){var s=r[i];if(s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<a;){s=r[i];var o=s[0],l=t[o],u=s[1];if(s[2]){if(l===void 0&&!(o in t))return!1}else{var h=new $h,d;if(!(d===void 0?sse(u,l,Ryr|kyr,n,h):d))return!1}}return!0}function dYe(t){return t===t&&!fc(t)}function Nyr(t){for(var e=Ss(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,dYe(i)]}return e}function fYe(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Dyr(t){var e=Nyr(t);return e.length==1&&e[0][2]?fYe(e[0][0],e[0][1]):function(r){return r===t||Iyr(r,t,e)}}function Lyr(t,e){return t!=null&&e in Object(t)}function pYe(t,e,r){e=i8(e,t);for(var n=-1,i=e.length,a=!1;++n<i;){var s=pk(e[n]);if(!(a=t!=null&&r(t,s)))break;t=t[s]}return a||++n!=i?a:(i=t==null?0:t.length,!!i&&mJ(i)&&zM(s,i)&&(yn(t)||IS(t)))}function gYe(t,e){return t!=null&&pYe(t,e,Lyr)}var Myr=1,Byr=2;function Pyr(t,e){return jae(t)&&dYe(e)?fYe(pk(t),e):function(r){var n=Bvr(r,t);return n===void 0&&n===e?gYe(r,t):sse(e,n,Myr|Byr)}}function Fyr(t){return function(e){return e==null?void 0:e[t]}}function Uyr(t){return function(e){return a8(e,t)}}function Qyr(t){return jae(t)?Fyr(pk(t)):Uyr(t)}function mc(t){return typeof t=="function"?t:t==null?qp:typeof t=="object"?yn(t)?Pyr(t[0],t[1]):Dyr(t):Qyr(t)}function $yr(t,e,r,n){for(var i=-1,a=t==null?0:t.length;++i<a;){var s=t[i];e(n,s,r(s),t)}return n}function ose(t,e){return t&&fJ(t,e,Ss)}function Gyr(t,e){return function(r,n){if(r==null)return r;if(!af(r))return t(r,n);for(var i=r.length,a=-1,s=Object(r);++a<i&&n(s[a],a,s)!==!1;);return r}}var Ey=Gyr(ose);function zyr(t,e,r,n){return Ey(t,function(i,a,s){e(n,i,r(i),s)}),n}function Vyr(t,e){return function(r,n){var i=yn(r)?$yr:zyr,a=e?e():{};return i(r,t,mc(n),a)}}var mYe=Object.prototype,Hyr=mYe.hasOwnProperty,o8=OC(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&CC(e[0],e[1],i)&&(n=1);++r<n;)for(var a=e[r],s=F1(a),o=-1,l=s.length;++o<l;){var u=s[o],h=t[u];(h===void 0||RS(h,mYe[u])&&!Hyr.call(t,u))&&(t[u]=a[u])}return t}),qyr=200;function Yyr(t,e,r,n){var i=-1,a=Vqe,s=!0,o=t.length,l=[],u=e.length;if(!o)return l;e.length>=qyr&&(a=nse,s=!1,e=new LE(e));e:for(;++i<o;){var h=t[i],d=h;if(h=h!==0?h:0,s&&d===d){for(var f=u;f--;)if(e[f]===d)continue e;l.push(h)}else a(e,d,n)||l.push(h)}return l}var l8=OC(function(t,e){return $M(t)?Yyr(t,gk(e,1,$M,!0)):[]});function Rf(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function go(t,e,r){var n=t==null?0:t.length;return n?(e=e===void 0?1:n8(e),Yqe(t,e<0?0:e,n)):[]}function vk(t,e,r){var n=t==null?0:t.length;return n?(e=e===void 0?1:n8(e),e=n-e,Yqe(t,0,e<0?0:e)):[]}function lse(t){return typeof t=="function"?t:qp}function rt(t,e){var r=yn(t)?Gqe:Ey;return r(t,lse(e))}function Wyr(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}function Xyr(t,e){var r=!0;return Ey(t,function(n,i,a){return r=!!e(n,i,a),r}),r}function Jh(t,e,r){var n=yn(t)?Wyr:Xyr;return n(t,mc(e))}function AYe(t,e){var r=[];return Ey(t,function(n,i,a){e(n,i,a)&&r.push(n)}),r}function _a(t,e){var r=yn(t)?ese:AYe;return r(t,mc(e))}function Kyr(t){return function(e,r,n){var i=Object(e);if(!af(e)){var a=mc(r);e=Ss(e),r=function(o){return a(i[o],o,i)}}var s=t(e,r,n);return s>-1?i[a?e[s]:s]:void 0}}var Zyr=Math.max;function jyr(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:n8(r);return i<0&&(i=Zyr(n+i,0)),zqe(t,mc(e),i)}var wg=Kyr(jyr);function ed(t){return t&&t.length?t[0]:void 0}function vYe(t,e){var r=-1,n=af(t)?Array(t.length):[];return Ey(t,function(i,a,s){n[++r]=e(i,a,s)}),n}function Qt(t,e){var r=yn(t)?Sy:vYe;return r(t,mc(e))}function Zc(t,e){return gk(Qt(t,e))}function Jyr(t,e){return t==null?t:fJ(t,lse(e),F1)}function e_r(t,e){return t&&ose(t,lse(e))}var t_r=Object.prototype,r_r=t_r.hasOwnProperty,n_r=Vyr(function(t,e,r){r_r.call(t,r)?t[r].push(e):SC(t,r,[e])});function i_r(t,e){return t>e}var a_r=Object.prototype,s_r=a_r.hasOwnProperty;function o_r(t,e){return t!=null&&s_r.call(t,e)}function Br(t,e){return t!=null&&pYe(t,e,o_r)}var l_r="[object String]";function Ac(t){return typeof t=="string"||!yn(t)&&Gu(t)&&zp(t)==l_r}function c_r(t,e){return Sy(e,function(r){return t[r]})}function bi(t){return t==null?[]:c_r(t,Ss(t))}var u_r=Math.max;function zl(t,e,r,n){t=af(t)?t:bi(t),r=r?n8(r):0;var i=t.length;return r<0&&(r=u_r(i+r,0)),Ac(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Zae(t,e,r)>-1}function yYe(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=0;return Zae(t,e,i)}var h_r="[object RegExp]";function d_r(t){return Gu(t)&&zp(t)==h_r}var _Ye=cm&&cm.isRegExp,xg=_Ye?wC(_Ye):d_r;function ni(t){return t===void 0}function bYe(t,e){return t<e}function c8(t,e){var r={};return e=mc(e),ose(t,function(n,i,a){SC(r,i,e(n,i,a))}),r}function cse(t,e,r){for(var n=-1,i=t.length;++n<i;){var a=t[n],s=e(a);if(s!=null&&(o===void 0?s===s&&!by(s):r(s,o)))var o=s,l=a}return l}function wy(t){return t&&t.length?cse(t,qp,i_r):void 0}function ME(t){return t&&t.length?cse(t,qp,bYe):void 0}function use(t,e){return t&&t.length?cse(t,mc(e),bYe):void 0}var f_r="Expected a function";function p_r(t){if(typeof t!="function")throw new TypeError(f_r);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function g_r(t,e,r,n){if(!fc(t))return t;e=i8(e,t);for(var i=-1,a=e.length,s=a-1,o=t;o!=null&&++i<a;){var l=pk(e[i]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(i!=s){var h=o[l];u=void 0,u===void 0&&(u=fc(h)?h:zM(e[i+1])?[]:{})}TC(o,l,u),o=o[l]}return t}function SYe(t,e,r){for(var n=-1,i=e.length,a={};++n<i;){var s=e[n],o=a8(t,s);r(o,s)&&g_r(a,i8(s,t),o)}return a}function td(t,e){if(t==null)return{};var r=Sy(jqe(t),function(n){return[n]});return e=mc(e),SYe(t,r,function(n,i){return e(n,i[0])})}function m_r(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}function A_r(t,e){if(t!==e){var r=t!==void 0,n=t===null,i=t===t,a=by(t),s=e!==void 0,o=e===null,l=e===e,u=by(e);if(!o&&!u&&!a&&t>e||a&&s&&l&&!o&&!u||n&&s&&l||!r&&l||!i)return 1;if(!n&&!a&&!u&&t<e||u&&r&&i&&!n&&!a||o&&r&&i||!s&&i||!l)return-1}return 0}function v_r(t,e,r){for(var n=-1,i=t.criteria,a=e.criteria,s=i.length,o=r.length;++n<s;){var l=A_r(i[n],a[n]);if(l){if(n>=o)return l;var u=r[n];return l*(u=="desc"?-1:1)}}return t.index-e.index}function y_r(t,e,r){e.length?e=Sy(e,function(a){return yn(a)?function(s){return a8(s,a.length===1?a[0]:a)}:a}):e=[qp];var n=-1;e=Sy(e,wC(mc));var i=vYe(t,function(a,s,o){var l=Sy(e,function(u){return u(a)});return{criteria:l,index:++n,value:a}});return m_r(i,function(a,s){return v_r(a,s,r)})}function __r(t,e){return SYe(t,e,function(r,n){return gYe(t,n)})}var u8=Fvr(function(t,e){return t==null?{}:__r(t,e)}),b_r=Math.ceil,S_r=Math.max;function E_r(t,e,r,n){for(var i=-1,a=S_r(b_r((e-t)/(r||1)),0),s=Array(a);a--;)s[++i]=t,t+=r;return s}function w_r(t){return function(e,r,n){return n&&typeof n!="number"&&CC(e,r,n)&&(r=n=void 0),e=r8(e),r===void 0?(r=e,e=0):r=r8(r),n=n===void 0?e<r?1:-1:r8(n),E_r(e,r,n)}}var BE=w_r();function x_r(t,e,r,n,i){return i(t,function(a,s,o){r=n?(n=!1,a):e(r,a,s,o)}),r}function ts(t,e,r){var n=yn(t)?Uvr:x_r,i=arguments.length<3;return n(t,mc(e),r,i,Ey)}function h8(t,e){var r=yn(t)?ese:AYe;return r(t,p_r(mc(e)))}function T_r(t,e){var r;return Ey(t,function(n,i,a){return r=e(n,i,a),!r}),!!r}function EYe(t,e,r){var n=yn(t)?sYe:T_r;return n(t,mc(e))}var yk=OC(function(t,e){if(t==null)return[];var r=e.length;return r>1&&CC(t,e[0],e[1])?e=[]:r>2&&CC(e[0],e[1],e[2])&&(e=[e[0]]),y_r(t,gk(e),[])}),O_r=1/0,C_r=VS&&1/ise(new VS([,-0]))[1]==O_r?function(t){return new VS(t)}:bs,R_r=200;function hse(t,e,r){var n=-1,i=Vqe,a=t.length,s=!0,o=[],l=o;if(a>=R_r){var u=e?null:C_r(t);if(u)return ise(u);s=!1,i=nse,l=new LE}else l=e?[]:o;e:for(;++n<a;){var h=t[n],d=e?e(h):h;if(h=h!==0?h:0,s&&d===d){for(var f=l.length;f--;)if(l[f]===d)continue e;e&&l.push(d),o.push(h)}else i(l,d,r)||(l!==o&&l.push(d),o.push(h))}return o}var k_r=OC(function(t){return hse(gk(t,1,$M,!0))});function dse(t){return t&&t.length?hse(t):[]}function I_r(t,e){return t&&t.length?hse(t,mc(e)):[]}var N_r=0;function fse(t){var e=++N_r;return Hqe(t)+e}function D_r(t,e,r){for(var n=-1,i=t.length,a=e.length,s={};++n<i;){var o=n<a?e[n]:void 0;r(s,t[n],o)}return s}function L_r(t,e){return D_r(t||[],e||[],TC)}var M_r="\0",xy="\0",wYe="";class vc{constructor(e={}){this._isDirected=Object.prototype.hasOwnProperty.call(e,"directed")?e.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,"multigraph")?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,"compound")?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=LS(void 0),this._defaultEdgeLabelFn=LS(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[xy]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return $u(e)||(e=LS(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Ss(this._nodes)}sources(){var e=this;return _a(this.nodes(),function(r){return Kn(e._in[r])})}sinks(){var e=this;return _a(this.nodes(),function(r){return Kn(e._out[r])})}setNodes(e,r){var n=arguments,i=this;return rt(e,function(a){n.length>1?i.setNode(a,r):i.setNode(a)}),this}setNode(e,r){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=r),this):(this._nodes[e]=arguments.length>1?r:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=xy,this._children[e]={},this._children[xy][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var r=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],rt(this.children(e),n=>{this.setParent(n)}),delete this._children[e]),rt(Ss(this._in[e]),r),delete this._in[e],delete this._preds[e],rt(Ss(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ni(r))r=xy;else{r+="";for(var n=r;!ni(n);n=this.parent(n))if(n===e)throw new Error("Setting "+r+" as parent of "+e+" would create a cycle");this.setNode(r)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=r,this._children[r][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var r=this._parent[e];if(r!==xy)return r}}children(e){if(ni(e)&&(e=xy),this._isCompound){var r=this._children[e];if(r)return Ss(r)}else{if(e===xy)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var r=this._preds[e];if(r)return Ss(r)}successors(e){var r=this._sucs[e];if(r)return Ss(r)}neighbors(e){var r=this.predecessors(e);if(r)return k_r(r,this.successors(e))}isLeaf(e){var r;return this.isDirected()?r=this.successors(e):r=this.neighbors(e),r.length===0}filterNodes(e){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var n=this;rt(this._nodes,function(s,o){e(o)&&r.setNode(o,s)}),rt(this._edgeObjs,function(s){r.hasNode(s.v)&&r.hasNode(s.w)&&r.setEdge(s,n.edge(s))});var i={};function a(s){var o=n.parent(s);return o===void 0||r.hasNode(o)?(i[s]=o,o):o in i?i[o]:a(o)}return this._isCompound&&rt(r.nodes(),function(s){r.setParent(s,a(s))}),r}setDefaultEdgeLabel(e){return $u(e)||(e=LS(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return bi(this._edgeObjs)}setPath(e,r){var n=this,i=arguments;return ts(e,function(a,s){return i.length>1?n.setEdge(a,s,r):n.setEdge(a,s),s}),this}setEdge(){var e,r,n,i,a=!1,s=arguments[0];typeof s=="object"&&s!==null&&"v"in s?(e=s.v,r=s.w,n=s.name,arguments.length===2&&(i=arguments[1],a=!0)):(e=s,r=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,r=""+r,ni(n)||(n=""+n);var o=_k(this._isDirected,e,r,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return a&&(this._edgeLabels[o]=i),this;if(!ni(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(r),this._edgeLabels[o]=a?i:this._defaultEdgeLabelFn(e,r,n);var l=B_r(this._isDirected,e,r,n);return e=l.v,r=l.w,Object.freeze(l),this._edgeObjs[o]=l,xYe(this._preds[r],e),xYe(this._sucs[e],r),this._in[r][o]=l,this._out[e][o]=l,this._edgeCount++,this}edge(e,r,n){var i=arguments.length===1?pse(this._isDirected,arguments[0]):_k(this._isDirected,e,r,n);return this._edgeLabels[i]}hasEdge(e,r,n){var i=arguments.length===1?pse(this._isDirected,arguments[0]):_k(this._isDirected,e,r,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,i)}removeEdge(e,r,n){var i=arguments.length===1?pse(this._isDirected,arguments[0]):_k(this._isDirected,e,r,n),a=this._edgeObjs[i];return a&&(e=a.v,r=a.w,delete this._edgeLabels[i],delete this._edgeObjs[i],TYe(this._preds[r],e),TYe(this._sucs[e],r),delete this._in[r][i],delete this._out[e][i],this._edgeCount--),this}inEdges(e,r){var n=this._in[e];if(n){var i=bi(n);return r?_a(i,function(a){return a.v===r}):i}}outEdges(e,r){var n=this._out[e];if(n){var i=bi(n);return r?_a(i,function(a){return a.w===r}):i}}nodeEdges(e,r){var n=this.inEdges(e,r);if(n)return n.concat(this.outEdges(e,r))}}vc.prototype._nodeCount=0,vc.prototype._edgeCount=0;function xYe(t,e){t[e]?t[e]++:t[e]=1}function TYe(t,e){--t[e]||delete t[e]}function _k(t,e,r,n){var i=""+e,a=""+r;if(!t&&i>a){var s=i;i=a,a=s}return i+wYe+a+wYe+(ni(n)?M_r:n)}function B_r(t,e,r,n){var i=""+e,a=""+r;if(!t&&i>a){var s=i;i=a,a=s}var o={v:i,w:a};return n&&(o.name=n),o}function pse(t,e){return _k(t,e.v,e.w,e.name)}class P_r{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,r=e._prev;if(r!==e)return OYe(r),r}enqueue(e){var r=this._sentinel;e._prev&&e._next&&OYe(e),e._next=r._next,r._next._prev=e,r._next=e,e._prev=r}toString(){for(var e=[],r=this._sentinel,n=r._prev;n!==r;)e.push(JSON.stringify(n,F_r)),n=n._prev;return"["+e.join(", ")+"]"}}function OYe(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function F_r(t,e){if(t!=="_next"&&t!=="_prev")return e}var U_r=LS(1);function Q_r(t,e){if(t.nodeCount()<=1)return[];var r=G_r(t,e||U_r),n=$_r(r.graph,r.buckets,r.zeroIdx);return Ys(Qt(n,function(i){return t.outEdges(i.v,i.w)}))}function $_r(t,e,r){for(var n=[],i=e[e.length-1],a=e[0],s;t.nodeCount();){for(;s=a.dequeue();)gse(t,e,r,s);for(;s=i.dequeue();)gse(t,e,r,s);if(t.nodeCount()){for(var o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(gse(t,e,r,s,!0));break}}}return n}function gse(t,e,r,n,i){var a=i?[]:void 0;return rt(t.inEdges(n.v),function(s){var o=t.edge(s),l=t.node(s.v);i&&a.push({v:s.v,w:s.w}),l.out-=o,mse(e,r,l)}),rt(t.outEdges(n.v),function(s){var o=t.edge(s),l=s.w,u=t.node(l);u.in-=o,mse(e,r,u)}),t.removeNode(n.v),a}function G_r(t,e){var r=new vc,n=0,i=0;rt(t.nodes(),function(o){r.setNode(o,{v:o,in:0,out:0})}),rt(t.edges(),function(o){var l=r.edge(o.v,o.w)||0,u=e(o),h=l+u;r.setEdge(o.v,o.w,h),i=Math.max(i,r.node(o.v).out+=u),n=Math.max(n,r.node(o.w).in+=u)});var a=BE(i+n+3).map(function(){return new P_r}),s=n+1;return rt(r.nodes(),function(o){mse(a,s,r.node(o))}),{graph:r,buckets:a,zeroIdx:s}}function mse(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}function z_r(t){var e=t.graph().acyclicer==="greedy"?Q_r(t,r(t)):V_r(t);rt(e,function(n){var i=t.edge(n);t.removeEdge(n),i.forwardName=n.name,i.reversed=!0,t.setEdge(n.w,n.v,i,fse("rev"))});function r(n){return function(i){return n.edge(i).weight}}}function V_r(t){var e=[],r={},n={};function i(a){Object.prototype.hasOwnProperty.call(n,a)||(n[a]=!0,r[a]=!0,rt(t.outEdges(a),function(s){Object.prototype.hasOwnProperty.call(r,s.w)?e.push(s):i(s.w)}),delete r[a])}return rt(t.nodes(),i),e}function H_r(t){rt(t.edges(),function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}})}function PE(t,e,r,n){var i;do i=fse(n);while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function q_r(t){var e=new vc().setGraph(t.graph());return rt(t.nodes(),function(r){e.setNode(r,t.node(r))}),rt(t.edges(),function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},i=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),e}function CYe(t){var e=new vc({multigraph:t.isMultigraph()}).setGraph(t.graph());return rt(t.nodes(),function(r){t.children(r).length||e.setNode(r,t.node(r))}),rt(t.edges(),function(r){e.setEdge(r,t.edge(r))}),e}function RYe(t,e){var r=t.x,n=t.y,i=e.x-r,a=e.y-n,s=t.width/2,o=t.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:r+l,y:n+u}}function d8(t){var e=Qt(BE(IYe(t)+1),function(){return[]});return rt(t.nodes(),function(r){var n=t.node(r),i=n.rank;ni(i)||(e[i][n.order]=r)}),e}function Y_r(t){var e=ME(Qt(t.nodes(),function(r){return t.node(r).rank}));rt(t.nodes(),function(r){var n=t.node(r);Br(n,"rank")&&(n.rank-=e)})}function W_r(t){var e=ME(Qt(t.nodes(),function(a){return t.node(a).rank})),r=[];rt(t.nodes(),function(a){var s=t.node(a).rank-e;r[s]||(r[s]=[]),r[s].push(a)});var n=0,i=t.graph().nodeRankFactor;rt(r,function(a,s){ni(a)&&s%i!==0?--n:n&&rt(a,function(o){t.node(o).rank+=n})})}function kYe(t,e,r,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),PE(t,"border",i,e)}function IYe(t){return wy(Qt(t.nodes(),function(e){var r=t.node(e).rank;if(!ni(r))return r}))}function X_r(t,e){var r={lhs:[],rhs:[]};return rt(t,function(n){e(n)?r.lhs.push(n):r.rhs.push(n)}),r}function K_r(t,e){return e()}function Z_r(t){function e(r){var n=t.children(r),i=t.node(r);if(n.length&&rt(n,e),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a<s;++a)NYe(t,"borderLeft","_bl",r,i,a),NYe(t,"borderRight","_br",r,i,a)}}rt(t.children(),e)}function NYe(t,e,r,n,i,a){var s={width:0,height:0,rank:a,borderType:e},o=i[e][a-1],l=PE(t,"border",s,r);i[e][a]=l,t.setParent(l,n),o&&t.setEdge(o,l,{weight:1})}function j_r(t){var e=t.graph().rankdir.toLowerCase();(e==="lr"||e==="rl")&&DYe(t)}function J_r(t){var e=t.graph().rankdir.toLowerCase();(e==="bt"||e==="rl")&&ebr(t),(e==="lr"||e==="rl")&&(tbr(t),DYe(t))}function DYe(t){rt(t.nodes(),function(e){LYe(t.node(e))}),rt(t.edges(),function(e){LYe(t.edge(e))})}function LYe(t){var e=t.width;t.width=t.height,t.height=e}function ebr(t){rt(t.nodes(),function(e){Ase(t.node(e))}),rt(t.edges(),function(e){var r=t.edge(e);rt(r.points,Ase),Object.prototype.hasOwnProperty.call(r,"y")&&Ase(r)})}function Ase(t){t.y=-t.y}function tbr(t){rt(t.nodes(),function(e){vse(t.node(e))}),rt(t.edges(),function(e){var r=t.edge(e);rt(r.points,vse),Object.prototype.hasOwnProperty.call(r,"x")&&vse(r)})}function vse(t){var e=t.x;t.x=t.y,t.y=e}function rbr(t){t.graph().dummyChains=[],rt(t.edges(),function(e){nbr(t,e)})}function nbr(t,e){var r=e.v,n=t.node(r).rank,i=e.w,a=t.node(i).rank,s=e.name,o=t.edge(e),l=o.labelRank;if(a!==n+1){t.removeEdge(e);var u=void 0,h,d;for(d=0,++n;n<a;++d,++n)o.points=[],u={width:0,height:0,edgeLabel:o,edgeObj:e,rank:n},h=PE(t,"edge",u,"_d"),n===l&&(u.width=o.width,u.height=o.height,u.dummy="edge-label",u.labelpos=o.labelpos),t.setEdge(r,h,{weight:o.weight},s),d===0&&t.graph().dummyChains.push(h),r=h;t.setEdge(r,i,{weight:o.weight},s)}}function ibr(t){rt(t.graph().dummyChains,function(e){var r=t.node(e),n=r.edgeLabel,i;for(t.setEdge(r.edgeObj,n);r.dummy;)i=t.successors(e)[0],t.removeNode(e),n.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),e=i,r=t.node(e)})}function yse(t){var e={};function r(n){var i=t.node(n);if(Object.prototype.hasOwnProperty.call(e,n))return i.rank;e[n]=!0;var a=ME(Qt(t.outEdges(n),function(s){return r(s.w)-t.edge(s).minlen}));return(a===Number.POSITIVE_INFINITY||a===void 0||a===null)&&(a=0),i.rank=a}rt(t.sources(),r)}function bk(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}function MYe(t){var e=new vc({directed:!1}),r=t.nodes()[0],n=t.nodeCount();e.setNode(r,{});for(var i,a;abr(e,t)<n;)i=sbr(e,t),a=e.hasNode(i.v)?bk(t,i):-bk(t,i),obr(e,t,a);return e}function abr(t,e){function r(n){rt(e.nodeEdges(n),function(i){var a=i.v,s=n===a?i.w:a;!t.hasNode(s)&&!bk(e,i)&&(t.setNode(s,{}),t.setEdge(n,s,{}),r(s))})}return rt(t.nodes(),r),t.nodeCount()}function sbr(t,e){return use(e.edges(),function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return bk(e,r)})}function obr(t,e,r){rt(t.nodes(),function(n){e.node(n).rank+=r})}function lbr(){}lbr.prototype=new Error;function BYe(t,e,r){yn(e)||(e=[e]);var n=(t.isDirected()?t.successors:t.neighbors).bind(t),i=[],a={};return rt(e,function(s){if(!t.hasNode(s))throw new Error("Graph does not have node: "+s);PYe(t,s,r==="post",a,n,i)}),i}function PYe(t,e,r,n,i,a){Object.prototype.hasOwnProperty.call(n,e)||(n[e]=!0,r||a.push(e),rt(i(e),function(s){PYe(t,s,r,n,i,a)}),r&&a.push(e))}function cbr(t,e){return BYe(t,e,"post")}function ubr(t,e){return BYe(t,e,"pre")}Ty.initLowLimValues=bse,Ty.initCutValues=_se,Ty.calcCutValue=FYe,Ty.leaveEdge=QYe,Ty.enterEdge=$Ye,Ty.exchangeEdges=GYe;function Ty(t){t=q_r(t),yse(t);var e=MYe(t);bse(e),_se(e,t);for(var r,n;r=QYe(e);)n=$Ye(e,t,r),GYe(e,t,r,n)}function _se(t,e){var r=cbr(t,t.nodes());r=r.slice(0,r.length-1),rt(r,function(n){hbr(t,e,n)})}function hbr(t,e,r){var n=t.node(r),i=n.parent;t.edge(r,i).cutvalue=FYe(t,e,r)}function FYe(t,e,r){var n=t.node(r),i=n.parent,a=!0,s=e.edge(r,i),o=0;return s||(a=!1,s=e.edge(i,r)),o=s.weight,rt(e.nodeEdges(r),function(l){var u=l.v===r,h=u?l.w:l.v;if(h!==i){var d=u===a,f=e.edge(l).weight;if(o+=d?f:-f,fbr(t,r,h)){var p=t.edge(r,h).cutvalue;o+=d?-p:p}}}),o}function bse(t,e){arguments.length<2&&(e=t.nodes()[0]),UYe(t,{},1,e)}function UYe(t,e,r,n,i){var a=r,s=t.node(n);return e[n]=!0,rt(t.neighbors(n),function(o){Object.prototype.hasOwnProperty.call(e,o)||(r=UYe(t,e,r,o,n))}),s.low=a,s.lim=r++,i?s.parent=i:delete s.parent,r}function QYe(t){return wg(t.edges(),function(e){return t.edge(e).cutvalue<0})}function $Ye(t,e,r){var n=r.v,i=r.w;e.hasEdge(n,i)||(n=r.w,i=r.v);var a=t.node(n),s=t.node(i),o=a,l=!1;a.lim>s.lim&&(o=s,l=!0);var u=_a(e.edges(),function(h){return l===zYe(t,t.node(h.v),o)&&l!==zYe(t,t.node(h.w),o)});return use(u,function(h){return bk(e,h)})}function GYe(t,e,r,n){var i=r.v,a=r.w;t.removeEdge(i,a),t.setEdge(n.v,n.w,{}),bse(t),_se(t,e),dbr(t,e)}function dbr(t,e){var r=wg(t.nodes(),function(i){return!e.node(i).parent}),n=ubr(t,r);n=n.slice(1),rt(n,function(i){var a=t.node(i).parent,s=e.edge(i,a),o=!1;s||(s=e.edge(a,i),o=!0),e.node(i).rank=e.node(a).rank+(o?s.minlen:-s.minlen)})}function fbr(t,e,r){return t.hasEdge(e,r)}function zYe(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}function pbr(t){switch(t.graph().ranker){case"network-simplex":VYe(t);break;case"tight-tree":mbr(t);break;case"longest-path":gbr(t);break;default:VYe(t)}}var gbr=yse;function mbr(t){yse(t),MYe(t)}function VYe(t){Ty(t)}function Abr(t){var e=PE(t,"root",{},"_root"),r=vbr(t),n=wy(bi(r))-1,i=2*n+1;t.graph().nestingRoot=e,rt(t.edges(),function(s){t.edge(s).minlen*=i});var a=ybr(t)+1;rt(t.children(),function(s){HYe(t,e,i,a,n,r,s)}),t.graph().nodeRankFactor=i}function HYe(t,e,r,n,i,a,s){var o=t.children(s);if(!o.length){s!==e&&t.setEdge(e,s,{weight:0,minlen:r});return}var l=kYe(t,"_bt"),u=kYe(t,"_bb"),h=t.node(s);t.setParent(l,s),h.borderTop=l,t.setParent(u,s),h.borderBottom=u,rt(o,function(d){HYe(t,e,r,n,i,a,d);var f=t.node(d),p=f.borderTop?f.borderTop:d,g=f.borderBottom?f.borderBottom:d,m=f.borderTop?n:2*n,A=p!==g?1:i-a[s]+1;t.setEdge(l,p,{weight:m,minlen:A,nestingEdge:!0}),t.setEdge(g,u,{weight:m,minlen:A,nestingEdge:!0})}),t.parent(s)||t.setEdge(e,l,{weight:0,minlen:i+a[s]})}function vbr(t){var e={};function r(n,i){var a=t.children(n);a&&a.length&&rt(a,function(s){r(s,i+1)}),e[n]=i}return rt(t.children(),function(n){r(n,1)}),e}function ybr(t){return ts(t.edges(),function(e,r){return e+t.edge(r).weight},0)}function _br(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,rt(t.edges(),function(r){var n=t.edge(r);n.nestingEdge&&t.removeEdge(r)})}function bbr(t,e,r){var n={},i;rt(r,function(a){for(var s=t.parent(a),o,l;s;){if(o=t.parent(s),o?(l=n[o],n[o]=s):(l=i,i=s),l&&l!==s){e.setEdge(l,s);return}s=o}})}function Sbr(t,e,r){var n=Ebr(t),i=new vc({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return t.node(a)});return rt(t.nodes(),function(a){var s=t.node(a),o=t.parent(a);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(i.setNode(a),i.setParent(a,o||n),rt(t[r](a),function(l){var u=l.v===a?l.w:l.v,h=i.edge(u,a),d=ni(h)?0:h.weight;i.setEdge(u,a,{weight:t.edge(l).weight+d})}),Object.prototype.hasOwnProperty.call(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))}),i}function Ebr(t){for(var e;t.hasNode(e=fse("_root")););return e}function wbr(t,e){for(var r=0,n=1;n<e.length;++n)r+=xbr(t,e[n-1],e[n]);return r}function xbr(t,e,r){for(var n=L_r(r,Qt(r,function(u,h){return h})),i=Ys(Qt(e,function(u){return yk(Qt(t.outEdges(u),function(h){return{pos:n[h.w],weight:t.edge(h).weight}}),"pos")})),a=1;a<r.length;)a<<=1;var s=2*a-1;a-=1;var o=Qt(new Array(s),function(){return 0}),l=0;return rt(i.forEach(function(u){var h=u.pos+a;o[h]+=u.weight;for(var d=0;h>0;)h%2&&(d+=o[h+1]),h=h-1>>1,o[h]+=u.weight;l+=u.weight*d})),l}function Tbr(t){var e={},r=_a(t.nodes(),function(o){return!t.children(o).length}),n=wy(Qt(r,function(o){return t.node(o).rank})),i=Qt(BE(n+1),function(){return[]});function a(o){if(!Br(e,o)){e[o]=!0;var l=t.node(o);i[l.rank].push(o),rt(t.successors(o),a)}}var s=yk(r,function(o){return t.node(o).rank});return rt(s,a),i}function Obr(t,e){return Qt(e,function(r){var n=t.inEdges(r);if(n.length){var i=ts(n,function(a,s){var o=t.edge(s),l=t.node(s.v);return{sum:a.sum+o.weight*l.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function Cbr(t,e){var r={};rt(t,function(i,a){var s=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};ni(i.barycenter)||(s.barycenter=i.barycenter,s.weight=i.weight)}),rt(e.edges(),function(i){var a=r[i.v],s=r[i.w];!ni(a)&&!ni(s)&&(s.indegree++,a.out.push(r[i.w]))});var n=_a(r,function(i){return!i.indegree});return Rbr(n)}function Rbr(t){var e=[];function r(a){return function(s){s.merged||(ni(s.barycenter)||ni(a.barycenter)||s.barycenter>=a.barycenter)&&kbr(a,s)}}function n(a){return function(s){s.in.push(a),--s.indegree===0&&t.push(s)}}for(;t.length;){var i=t.pop();e.push(i),rt(i.in.reverse(),r(i)),rt(i.out,n(i))}return Qt(_a(e,function(a){return!a.merged}),function(a){return u8(a,["vs","i","barycenter","weight"])})}function kbr(t,e){var r=0,n=0;t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=r/n,t.weight=n,t.i=Math.min(e.i,t.i),e.merged=!0}function Ibr(t,e){var r=X_r(t,function(h){return Object.prototype.hasOwnProperty.call(h,"barycenter")}),n=r.lhs,i=yk(r.rhs,function(h){return-h.i}),a=[],s=0,o=0,l=0;n.sort(Nbr(!!e)),l=qYe(a,i,l),rt(n,function(h){l+=h.vs.length,a.push(h.vs),s+=h.barycenter*h.weight,o+=h.weight,l=qYe(a,i,l)});var u={vs:Ys(a)};return o&&(u.barycenter=s/o,u.weight=o),u}function qYe(t,e,r){for(var n;e.length&&(n=Rf(e)).i<=r;)e.pop(),t.push(n.vs),r++;return r}function Nbr(t){return function(e,r){return e.barycenter<r.barycenter?-1:e.barycenter>r.barycenter?1:t?r.i-e.i:e.i-r.i}}function YYe(t,e,r,n){var i=t.children(e),a=t.node(e),s=a?a.borderLeft:void 0,o=a?a.borderRight:void 0,l={};s&&(i=_a(i,function(g){return g!==s&&g!==o}));var u=Obr(t,i);rt(u,function(g){if(t.children(g.v).length){var m=YYe(t,g.v,r,n);l[g.v]=m,Object.prototype.hasOwnProperty.call(m,"barycenter")&&Lbr(g,m)}});var h=Cbr(u,r);Dbr(h,l);var d=Ibr(h,n);if(s&&(d.vs=Ys([s,d.vs,o]),t.predecessors(s).length)){var f=t.node(t.predecessors(s)[0]),p=t.node(t.predecessors(o)[0]);Object.prototype.hasOwnProperty.call(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d}function Dbr(t,e){rt(t,function(r){r.vs=Ys(r.vs.map(function(n){return e[n]?e[n].vs:n}))})}function Lbr(t,e){ni(t.barycenter)?(t.barycenter=e.barycenter,t.weight=e.weight):(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight)}function Mbr(t){var e=IYe(t),r=WYe(t,BE(1,e+1),"inEdges"),n=WYe(t,BE(e-1,-1,-1),"outEdges"),i=Tbr(t);XYe(t,i);for(var a=Number.POSITIVE_INFINITY,s,o=0,l=0;l<4;++o,++l){Bbr(o%2?r:n,o%4>=2),i=d8(t);var u=wbr(t,i);u<a&&(l=0,s=tyr(i),a=u)}XYe(t,s)}function WYe(t,e,r){return Qt(e,function(n){return Sbr(t,n,r)})}function Bbr(t,e){var r=new vc;rt(t,function(n){var i=n.graph().root,a=YYe(n,i,r,e);rt(a.vs,function(s,o){n.node(s).order=o}),bbr(n,r,a.vs)})}function XYe(t,e){rt(e,function(r){rt(r,function(n,i){t.node(n).order=i})})}function Pbr(t){var e=Ubr(t);rt(t.graph().dummyChains,function(r){for(var n=t.node(r),i=n.edgeObj,a=Fbr(t,e,i.v,i.w),s=a.path,o=a.lca,l=0,u=s[l],h=!0;r!==i.w;){if(n=t.node(r),h){for(;(u=s[l])!==o&&t.node(u).maxRank<n.rank;)l++;u===o&&(h=!1)}if(!h){for(;l<s.length-1&&t.node(u=s[l+1]).minRank<=n.rank;)l++;u=s[l]}t.setParent(r,u),r=t.successors(r)[0]}})}function Fbr(t,e,r,n){var i=[],a=[],s=Math.min(e[r].low,e[n].low),o=Math.max(e[r].lim,e[n].lim),l,u;l=r;do l=t.parent(l),i.push(l);while(l&&(e[l].low>s||o>e[l].lim));for(u=l,l=n;(l=t.parent(l))!==u;)a.push(l);return{path:i.concat(a.reverse()),lca:u}}function Ubr(t){var e={},r=0;function n(i){var a=r;rt(t.children(i),n),e[i]={low:a,lim:r++}}return rt(t.children(),n),e}function Qbr(t,e){var r={};function n(i,a){var s=0,o=0,l=i.length,u=Rf(a);return rt(a,function(h,d){var f=Gbr(t,h),p=f?t.node(f).order:l;(f||h===u)&&(rt(a.slice(o,d+1),function(g){rt(t.predecessors(g),function(m){var A=t.node(m),v=A.order;(v<s||p<v)&&!(A.dummy&&t.node(g).dummy)&&KYe(r,m,g)})}),o=d+1,s=p)}),a}return ts(e,n),r}function $br(t,e){var r={};function n(a,s,o,l,u){var h;rt(BE(s,o),function(d){h=a[d],t.node(h).dummy&&rt(t.predecessors(h),function(f){var p=t.node(f);p.dummy&&(p.order<l||p.order>u)&&KYe(r,f,h)})})}function i(a,s){var o=-1,l,u=0;return rt(s,function(h,d){if(t.node(h).dummy==="border"){var f=t.predecessors(h);f.length&&(l=t.node(f[0]).order,n(s,u,d,o,l),u=d,o=l)}n(s,u,s.length,l,a.length)}),s}return ts(e,i),r}function Gbr(t,e){if(t.node(e).dummy)return wg(t.predecessors(e),function(r){return t.node(r).dummy})}function KYe(t,e,r){if(e>r){var n=e;e=r,r=n}Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=t[e];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function zbr(t,e,r){if(e>r){var n=e;e=r,r=n}return!!t[e]&&Object.prototype.hasOwnProperty.call(t[e],r)}function Vbr(t,e,r,n){var i={},a={},s={};return rt(e,function(o){rt(o,function(l,u){i[l]=l,a[l]=l,s[l]=u})}),rt(e,function(o){var l=-1;rt(o,function(u){var h=n(u);if(h.length){h=yk(h,function(m){return s[m]});for(var d=(h.length-1)/2,f=Math.floor(d),p=Math.ceil(d);f<=p;++f){var g=h[f];a[u]===u&&l<s[g]&&!zbr(r,u,g)&&(a[g]=u,a[u]=i[u]=i[g],l=s[g])}}})}),{root:i,align:a}}function Hbr(t,e,r,n,i){var a={},s=qbr(t,e,r,i),o=i?"borderLeft":"borderRight";function l(d,f){for(var p=s.nodes(),g=p.pop(),m={};g;)m[g]?d(g):(m[g]=!0,p.push(g),p=p.concat(f(g))),g=p.pop()}function u(d){a[d]=s.inEdges(d).reduce(function(f,p){return Math.max(f,a[p.v]+s.edge(p))},0)}function h(d){var f=s.outEdges(d).reduce(function(g,m){return Math.min(g,a[m.w]-s.edge(m))},Number.POSITIVE_INFINITY),p=t.node(d);f!==Number.POSITIVE_INFINITY&&p.borderType!==o&&(a[d]=Math.max(a[d],f))}return l(u,s.predecessors.bind(s)),l(h,s.successors.bind(s)),rt(n,function(d){a[d]=a[r[d]]}),a}function qbr(t,e,r,n){var i=new vc,a=t.graph(),s=Zbr(a.nodesep,a.edgesep,n);return rt(e,function(o){var l;rt(o,function(u){var h=r[u];if(i.setNode(h),l){var d=r[l],f=i.edge(d,h);i.setEdge(d,h,Math.max(s(t,u,l),f||0))}l=u})}),i}function Ybr(t,e){return use(bi(e),function(r){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return Jyr(r,function(a,s){var o=jbr(t,s)/2;n=Math.max(a+o,n),i=Math.min(a-o,i)}),n-i})}function Wbr(t,e){var r=bi(e),n=ME(r),i=wy(r);rt(["u","d"],function(a){rt(["l","r"],function(s){var o=a+s,l=t[o],u;if(l!==e){var h=bi(l);u=s==="l"?n-ME(h):i-wy(h),u&&(t[o]=c8(l,function(d){return d+u}))}})})}function Xbr(t,e){return c8(t.ul,function(r,n){if(e)return t[e.toLowerCase()][n];var i=yk(Qt(t,n));return(i[1]+i[2])/2})}function Kbr(t){var e=d8(t),r=VM(Qbr(t,e),$br(t,e)),n={},i;rt(["u","d"],function(s){i=s==="u"?e:bi(e).reverse(),rt(["l","r"],function(o){o==="r"&&(i=Qt(i,function(d){return bi(d).reverse()}));var l=(s==="u"?t.predecessors:t.successors).bind(t),u=Vbr(t,i,r,l),h=Hbr(t,i,u.root,u.align,o==="r");o==="r"&&(h=c8(h,function(d){return-d})),n[s+o]=h})});var a=Ybr(t,n);return Wbr(n,a),Xbr(n,t.graph().align)}function Zbr(t,e,r){return function(n,i,a){var s=n.node(i),o=n.node(a),l=0,u;if(l+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(l+=r?u:-u),u=0,l+=(s.dummy?e:t)/2,l+=(o.dummy?e:t)/2,l+=o.width/2,Object.prototype.hasOwnProperty.call(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(l+=r?u:-u),u=0,l}}function jbr(t,e){return t.node(e).width}function Jbr(t){t=CYe(t),eSr(t),e_r(Kbr(t),function(e,r){t.node(r).x=e})}function eSr(t){var e=d8(t),r=t.graph().ranksep,n=0;rt(e,function(i){var a=wy(Qt(i,function(s){return t.node(s).height}));rt(i,function(s){t.node(s).y=n+a/2}),n+=a+r})}function ZYe(t,e){var r=K_r;r("layout",()=>{var n=r(" buildLayoutGraph",()=>hSr(t));r(" runLayout",()=>tSr(n,r)),r(" updateInputGraph",()=>rSr(t,n))})}function tSr(t,e){e(" makeSpaceForEdgeLabels",()=>dSr(t)),e(" removeSelfEdges",()=>bSr(t)),e(" acyclic",()=>z_r(t)),e(" nestingGraph.run",()=>Abr(t)),e(" rank",()=>pbr(CYe(t))),e(" injectEdgeLabelProxies",()=>fSr(t)),e(" removeEmptyRanks",()=>W_r(t)),e(" nestingGraph.cleanup",()=>_br(t)),e(" normalizeRanks",()=>Y_r(t)),e(" assignRankMinMax",()=>pSr(t)),e(" removeEdgeLabelProxies",()=>gSr(t)),e(" normalize.run",()=>rbr(t)),e(" parentDummyChains",()=>Pbr(t)),e(" addBorderSegments",()=>Z_r(t)),e(" order",()=>Mbr(t)),e(" insertSelfEdges",()=>SSr(t)),e(" adjustCoordinateSystem",()=>j_r(t)),e(" position",()=>Jbr(t)),e(" positionSelfEdges",()=>ESr(t)),e(" removeBorderNodes",()=>_Sr(t)),e(" normalize.undo",()=>ibr(t)),e(" fixupEdgeLabelCoords",()=>vSr(t)),e(" undoCoordinateSystem",()=>J_r(t)),e(" translateGraph",()=>mSr(t)),e(" assignNodeIntersects",()=>ASr(t)),e(" reversePoints",()=>ySr(t)),e(" acyclic.undo",()=>H_r(t))}function rSr(t,e){rt(t.nodes(),function(r){var n=t.node(r),i=e.node(r);n&&(n.x=i.x,n.y=i.y,e.children(r).length&&(n.width=i.width,n.height=i.height))}),rt(t.edges(),function(r){var n=t.edge(r),i=e.edge(r);n.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(n.x=i.x,n.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}var nSr=["nodesep","edgesep","ranksep","marginx","marginy"],iSr={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},aSr=["acyclicer","ranker","rankdir","align"],sSr=["width","height"],oSr={width:0,height:0},lSr=["minlen","weight","width","height","labeloffset"],cSr={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},uSr=["labelpos"];function hSr(t){var e=new vc({multigraph:!0,compound:!0}),r=Ese(t.graph());return e.setGraph(VM({},iSr,Sse(r,nSr),u8(r,aSr))),rt(t.nodes(),function(n){var i=Ese(t.node(n));e.setNode(n,o8(Sse(i,sSr),oSr)),e.setParent(n,t.parent(n))}),rt(t.edges(),function(n){var i=Ese(t.edge(n));e.setEdge(n,VM({},cSr,Sse(i,lSr),u8(i,uSr)))}),e}function dSr(t){var e=t.graph();e.ranksep/=2,rt(t.edges(),function(r){var n=t.edge(r);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function fSr(t){rt(t.edges(),function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),i=t.node(e.w),a={rank:(i.rank-n.rank)/2+n.rank,e};PE(t,"edge-proxy",a,"_ep")}})}function pSr(t){var e=0;rt(t.nodes(),function(r){var n=t.node(r);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,e=wy(e,n.maxRank))}),t.graph().maxRank=e}function gSr(t){rt(t.nodes(),function(e){var r=t.node(e);r.dummy==="edge-proxy"&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}function mSr(t){var e=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,a=t.graph(),s=a.marginx||0,o=a.marginy||0;function l(u){var h=u.x,d=u.y,f=u.width,p=u.height;e=Math.min(e,h-f/2),r=Math.max(r,h+f/2),n=Math.min(n,d-p/2),i=Math.max(i,d+p/2)}rt(t.nodes(),function(u){l(t.node(u))}),rt(t.edges(),function(u){var h=t.edge(u);Object.prototype.hasOwnProperty.call(h,"x")&&l(h)}),e-=s,n-=o,rt(t.nodes(),function(u){var h=t.node(u);h.x-=e,h.y-=n}),rt(t.edges(),function(u){var h=t.edge(u);rt(h.points,function(d){d.x-=e,d.y-=n}),Object.prototype.hasOwnProperty.call(h,"x")&&(h.x-=e),Object.prototype.hasOwnProperty.call(h,"y")&&(h.y-=n)}),a.width=r-e+s,a.height=i-n+o}function ASr(t){rt(t.edges(),function(e){var r=t.edge(e),n=t.node(e.v),i=t.node(e.w),a,s;r.points?(a=r.points[0],s=r.points[r.points.length-1]):(r.points=[],a=i,s=n),r.points.unshift(RYe(n,a)),r.points.push(RYe(i,s))})}function vSr(t){rt(t.edges(),function(e){var r=t.edge(e);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function ySr(t){rt(t.edges(),function(e){var r=t.edge(e);r.reversed&&r.points.reverse()})}function _Sr(t){rt(t.nodes(),function(e){if(t.children(e).length){var r=t.node(e),n=t.node(r.borderTop),i=t.node(r.borderBottom),a=t.node(Rf(r.borderLeft)),s=t.node(Rf(r.borderRight));r.width=Math.abs(s.x-a.x),r.height=Math.abs(i.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),rt(t.nodes(),function(e){t.node(e).dummy==="border"&&t.removeNode(e)})}function bSr(t){rt(t.edges(),function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function SSr(t){var e=d8(t);rt(e,function(r){var n=0;rt(r,function(i,a){var s=t.node(i);s.order=a+n,rt(s.selfEdges,function(o){PE(t,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:a+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function ESr(t){rt(t.nodes(),function(e){var r=t.node(e);if(r.dummy==="selfedge"){var n=t.node(r.e.v),i=n.x+n.width/2,a=n.y,s=r.x-i,o=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],r.label.x=r.x,r.label.y=r.y}})}function Sse(t,e){return c8(u8(t,e),Number)}function Ese(t){var e={};return rt(t,function(r,n){e[n.toLowerCase()]=r}),e}function kf(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:wSr(t),edges:xSr(t)};return ni(t.graph())||(e.value=Es(t.graph())),e}function wSr(t){return Qt(t.nodes(),function(e){var r=t.node(e),n=t.parent(e),i={v:e};return ni(r)||(i.value=r),ni(n)||(i.parent=n),i})}function xSr(t){return Qt(t.edges(),function(e){var r=t.edge(e),n={v:e.v,w:e.w};return ni(e.name)||(n.name=e.name),ni(r)||(n.value=r),n})}var pn=new Map,Oy=new Map,jYe=new Map,TSr=N(()=>{Oy.clear(),jYe.clear(),pn.clear()},"clear"),f8=N((t,e)=>{const r=Oy.get(e)||[];return _e.trace("In isDescendant",e," ",t," = ",r.includes(t)),r.includes(t)},"isDescendant"),OSr=N((t,e)=>{const r=Oy.get(e)||[];return _e.info("Descendants of ",e," is ",r),_e.info("Edge is ",t),t.v===e||t.w===e?!1:r?r.includes(t.v)||f8(t.v,e)||f8(t.w,e)||r.includes(t.w):(_e.debug("Tilt, ",e,",not in descendants"),!1)},"edgeInCluster"),JYe=N((t,e,r,n)=>{_e.warn("Copying children of ",t,"root",n,"data",e.node(t),n);const i=e.children(t)||[];t!==n&&i.push(t),_e.warn("Copying (nodes) clusterId",t,"nodes",i),i.forEach(a=>{if(e.children(a).length>0)JYe(a,e,r,n);else{const s=e.node(a);_e.info("cp ",a," to ",n," with parent ",t),r.setNode(a,s),n!==e.parent(a)&&(_e.warn("Setting parent",a,e.parent(a)),r.setParent(a,e.parent(a))),t!==n&&a!==t?(_e.debug("Setting parent",a,t),r.setParent(a,t)):(_e.info("In copy ",t,"root",n,"data",e.node(t),n),_e.debug("Not Setting parent for node=",a,"cluster!==rootId",t!==n,"node!==clusterId",a!==t));const o=e.edges(a);_e.debug("Copying Edges",o),o.forEach(l=>{_e.info("Edge",l);const u=e.edge(l.v,l.w,l.name);_e.info("Edge data",u,n);try{OSr(l,n)?(_e.info("Copying as ",l.v,l.w,u,l.name),r.setEdge(l.v,l.w,u,l.name),_e.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):_e.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",n," clusterId:",t)}catch(h){_e.error(h)}})}_e.debug("Removing node",a),e.removeNode(a)})},"copy"),eWe=N((t,e)=>{const r=e.children(t);let n=[...r];for(const i of r)jYe.set(i,t),n=[...n,...eWe(i,e)];return n},"extractDescendants"),CSr=N((t,e,r)=>{const n=t.edges().filter(l=>l.v===e||l.w===e),i=t.edges().filter(l=>l.v===r||l.w===r),a=n.map(l=>({v:l.v===e?r:l.v,w:l.w===e?e:l.w})),s=i.map(l=>({v:l.v,w:l.w}));return a.filter(l=>s.some(u=>l.v===u.v&&l.w===u.w))},"findCommonEdges"),Sk=N((t,e,r)=>{const n=e.children(t);if(_e.trace("Searching children of id ",t,n),n.length<1)return t;let i;for(const a of n){const s=Sk(a,e,r),o=CSr(e,r,s);if(s)if(o.length>0)i=s;else return s}return i},"findNonClusterChild"),tWe=N(t=>!pn.has(t)||!pn.get(t).externalConnections?t:pn.has(t)?pn.get(t).id:t,"getAnchorId"),RSr=N((t,e)=>{if(!t||e>10){_e.debug("Opting out, no graph ");return}else _e.debug("Opting in, graph ");t.nodes().forEach(function(r){t.children(r).length>0&&(_e.warn("Cluster identified",r," Replacement id in edges: ",Sk(r,t,r)),Oy.set(r,eWe(r,t)),pn.set(r,{id:Sk(r,t,r),clusterData:t.node(r)}))}),t.nodes().forEach(function(r){const n=t.children(r),i=t.edges();n.length>0?(_e.debug("Cluster identified",r,Oy),i.forEach(a=>{const s=f8(a.v,r),o=f8(a.w,r);s^o&&(_e.warn("Edge: ",a," leaves cluster ",r),_e.warn("Descendants of XXX ",r,": ",Oy.get(r)),pn.get(r).externalConnections=!0)})):_e.debug("Not a cluster ",r,Oy)});for(let r of pn.keys()){const n=pn.get(r).id,i=t.parent(n);i!==r&&pn.has(i)&&!pn.get(i).externalConnections&&(pn.get(r).id=i)}t.edges().forEach(function(r){const n=t.edge(r);_e.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(r)),_e.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(t.edge(r)));let i=r.v,a=r.w;if(_e.warn("Fix XXX",pn,"ids:",r.v,r.w,"Translating: ",pn.get(r.v)," --- ",pn.get(r.w)),pn.get(r.v)||pn.get(r.w)){if(_e.warn("Fixing and trying - removing XXX",r.v,r.w,r.name),i=tWe(r.v),a=tWe(r.w),t.removeEdge(r.v,r.w,r.name),i!==r.v){const s=t.parent(i);pn.get(s).externalConnections=!0,n.fromCluster=r.v}if(a!==r.w){const s=t.parent(a);pn.get(s).externalConnections=!0,n.toCluster=r.w}_e.warn("Fix Replacing with XXX",i,a,r.name),t.setEdge(i,a,n,r.name)}}),_e.warn("Adjusted Graph",kf(t)),rWe(t,0),_e.trace(pn)},"adjustClustersAndEdges"),rWe=N((t,e)=>{var i,a;if(_e.warn("extractor - ",e,kf(t),t.children("D")),e>10){_e.error("Bailing out");return}let r=t.nodes(),n=!1;for(const s of r){const o=t.children(s);n=n||o.length>0}if(!n){_e.debug("Done, no node has children",t.nodes());return}_e.debug("Nodes = ",r,e);for(const s of r)if(_e.debug("Extracting node",s,pn,pn.has(s)&&!pn.get(s).externalConnections,!t.parent(s),t.node(s),t.children("D")," Depth ",e),!pn.has(s))_e.debug("Not a cluster",s,e);else if(!pn.get(s).externalConnections&&t.children(s)&&t.children(s).length>0){_e.warn("Cluster without external connections, without a parent and with children",s,e);let l=t.graph().rankdir==="TB"?"LR":"TB";(a=(i=pn.get(s))==null?void 0:i.clusterData)!=null&&a.dir&&(l=pn.get(s).clusterData.dir,_e.warn("Fixing dir",pn.get(s).clusterData.dir,l));const u=new vc({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});_e.warn("Old graph before copy",kf(t)),JYe(s,t,u,s),t.setNode(s,{clusterNode:!0,id:s,clusterData:pn.get(s).clusterData,label:pn.get(s).label,graph:u}),_e.warn("New graph after copy node: (",s,")",kf(u)),_e.debug("Old graph after copy",kf(t))}else _e.warn("Cluster ** ",s," **not meeting the criteria !externalConnections:",!pn.get(s).externalConnections," no parent: ",!t.parent(s)," children ",t.children(s)&&t.children(s).length>0,t.children("D"),e),_e.debug(pn);r=t.nodes(),_e.warn("New list of nodes",r);for(const s of r){const o=t.node(s);_e.warn(" Now next level",s,o),o!=null&&o.clusterNode&&rWe(o.graph,e+1)}},"extractor"),nWe=N((t,e)=>{if(e.length===0)return[];let r=Object.assign([],e);return e.forEach(n=>{const i=t.children(n),a=nWe(t,i);r=[...r,...a]}),r},"sorter"),kSr=N(t=>nWe(t,t.children()),"sortNodesByHierarchy"),iWe=N(async(t,e,r,n,i,a)=>{_e.warn("Graph in recursive render:XAX",kf(e),i);const s=e.graph().rankdir;_e.trace("Dir in recursive render - dir:",s);const o=t.insert("g").attr("class","root");e.nodes()?_e.info("Recursive render XXX",e.nodes()):_e.info("No nodes found for",e),e.edges().length>0&&_e.info("Recursive edges",e.edge(e.edges()[0]));const l=o.insert("g").attr("class","clusters"),u=o.insert("g").attr("class","edgePaths"),h=o.insert("g").attr("class","edgeLabels"),d=o.insert("g").attr("class","nodes");await Promise.all(e.nodes().map(async function(m){const A=e.node(m);if(i!==void 0){const v=JSON.parse(JSON.stringify(i.clusterData));_e.trace(`Setting data for parent cluster XXX
1063
+ `),startLine:s+1,endLine:o+1,marker:i}},handleEditSave(t){if(this.currentComponentId&&this.currentComponentType){const e=this.currentTokenStart,r=this.currentTokenEnd;let n=this.content;if(e!==void 0&&r!==void 0){const i=this.content.substring(0,e),a=this.content.substring(r);n=i+t+a;const s=r-e,l=t.length-s;l!==0&&this.$nextTick(()=>{this._updateSubsequentPositions(r,l)})}else{console.error("未找到精确位置信息,无法进行内容替换");return}this.$emit("update:content",n),this.editModalVisible=!1}},_updateSubsequentPositions(t,e){document.querySelectorAll('[data-editable="true"][data-position]').forEach(n=>{const i=n.getAttribute("data-position");if(!i)return;const[a,s]=i.split(",").map(Number);if(a>=t){const o=a+e,l=s+e;n.setAttribute("data-position",`${o},${l}`)}})},handleEditClose(){this.editModalVisible=!1,this.currentComponentId="",this.currentComponentType="",this.currentEditContent="",this.currentTokenStart=0,this.currentTokenEnd=0},handleEditFromPanel(t,e,r){const[n,i]=r.split(",").map(Number),a=this.content.substring(n,i);this.currentComponentId=t,this.currentComponentType=e,this.currentEditContent=a,this.currentTokenStart=n,this.currentTokenEnd=i,this.editModalVisible=!0},toggleEditor(){this.showEditor=!this.showEditor},toggleFullscreen(){this.isFullscreen=!this.isFullscreen},startResize(t){this.isResizing=!0,document.addEventListener("mousemove",this.handleResize),document.addEventListener("mouseup",this.stopResize),t.preventDefault()},handleResize(t){if(!this.isResizing)return;const n=this.$el.getBoundingClientRect().right-t.clientX;n>=this.minEditorWidth&&n<=this.maxEditorWidth&&(this.editorWidth=n)},stopResize(){this.isResizing=!1,document.removeEventListener("mousemove",this.handleResize),document.removeEventListener("mouseup",this.stopResize),this.$nextTick(()=>{var t;(t=this.chartRenderer)==null||t.processEChartsElements()})},async exportToWord(t="document.docx"){try{const e=this.$el.querySelector(".preview-container");return e?(await this.$nextTick(),await this.wordExporter.exportToWord(this.md,this.content,e,t)):{success:!1,message:"预览容器未找到"}}catch(e){return console.error("导出失败:",e),{success:!1,message:e.message}}}}},lvr=["data-theme-mode"],cvr=["title"],uvr={key:0,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},hvr={key:1,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},dvr=["innerHTML"];function fvr(t,e,r,n,i,a){const s=Dt.resolveComponent("DatasetPanel"),o=Dt.resolveComponent("EditModal");return Dt.openBlock(),Dt.createElementBlock("div",{class:Dt.normalizeClass(["markdown-editor",{"dashboard-mode":i.isDashboardMode,fullscreen:i.isFullscreen}]),"data-theme-mode":a.isDarkMode?"dark":"light",style:Dt.normalizeStyle(a.themeVars)},[i.isDashboardMode&&r.showFullscreenButton?(Dt.openBlock(),Dt.createElementBlock("div",{key:0,class:"fullscreen-toggle",onClick:e[0]||(e[0]=(...l)=>a.toggleFullscreen&&a.toggleFullscreen(...l)),title:i.isFullscreen?"退出全屏":"全屏"},[i.isFullscreen?(Dt.openBlock(),Dt.createElementBlock("svg",hvr,[...e[6]||(e[6]=[Dt.createElementVNode("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"},null,-1)])])):(Dt.openBlock(),Dt.createElementBlock("svg",uvr,[...e[5]||(e[5]=[Dt.createElementVNode("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"},null,-1)])]))],8,cvr)):Dt.createCommentVNode("",!0),i.isDashboardMode?(Dt.openBlock(),Dt.createBlock(s,{key:1,ref:"datasetPanel"},null,512)):Dt.createCommentVNode("",!0),Dt.createElementVNode("div",{class:Dt.normalizeClass(["preview-container",{"full-width":!i.showEditor}])},[Dt.createElementVNode("div",{class:"markdown-body",innerHTML:a.renderedContent},null,8,dvr)],2),r.editable?(Dt.openBlock(),Dt.createElementBlock("div",{key:2,class:Dt.normalizeClass(["resizer",{"resizer-collapsed":!i.showEditor}])},[i.showEditor?(Dt.openBlock(),Dt.createElementBlock("div",{key:0,class:"resizer-draggable",onMousedown:e[1]||(e[1]=(...l)=>a.startResize&&a.startResize(...l))},null,32)):Dt.createCommentVNode("",!0),Dt.createElementVNode("div",{class:"resizer-toggle",onClick:e[2]||(e[2]=(...l)=>a.toggleEditor&&a.toggleEditor(...l))},[Dt.createElementVNode("span",null,Dt.toDisplayString(i.showEditor?"›":"‹"),1)])],2)):Dt.createCommentVNode("",!0),r.editable&&i.showEditor?(Dt.openBlock(),Dt.createElementBlock("div",{key:3,class:"editor-container",style:Dt.normalizeStyle({width:i.editorWidth+"px"})},[Dt.withDirectives(Dt.createElementVNode("textarea",{"onUpdate:modelValue":e[3]||(e[3]=l=>a.contentModel=l),class:"editor",placeholder:"请输入 Markdown 内容..."},null,512),[[Dt.vModelText,a.contentModel]])],4)):Dt.createCommentVNode("",!0),Dt.createVNode(o,{visible:i.editModalVisible,"onUpdate:visible":e[4]||(e[4]=l=>i.editModalVisible=l),content:i.currentEditContent,"component-type":i.currentComponentType,onSave:a.handleEditSave,onClose:a.handleEditClose},null,8,["visible","content","component-type","onSave","onClose"])],14,lvr)}const Bqe=Gre(ovr,[["render",fvr],["__scopeId","data-v-d65d3d55"]]);var pvr="[object Symbol]";function by(t){return typeof t=="symbol"||Gu(t)&&zp(t)==pvr}function Sy(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var Pqe=Qu?Qu.prototype:void 0,Fqe=Pqe?Pqe.toString:void 0;function Uqe(t){if(typeof t=="string")return t;if(yn(t))return Sy(t,Uqe)+"";if(by(t))return Fqe?Fqe.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var gvr=/\s/;function mvr(t){for(var e=t.length;e--&&gvr.test(t.charAt(e)););return e}var Avr=/^\s+/;function vvr(t){return t&&t.slice(0,mvr(t)+1).replace(Avr,"")}var Qqe=NaN,yvr=/^[-+]0x[0-9a-f]+$/i,_vr=/^0b[01]+$/i,bvr=/^0o[0-7]+$/i,Svr=parseInt;function Evr(t){if(typeof t=="number")return t;if(by(t))return Qqe;if(fc(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=fc(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=vvr(t);var r=_vr.test(t);return r||bvr.test(t)?Svr(t.slice(2),r?2:8):yvr.test(t)?Qqe:+t}var $qe=1/0,wvr=17976931348623157e292;function r8(t){if(!t)return t===0?t:0;if(t=Evr(t),t===$qe||t===-$qe){var e=t<0?-1:1;return e*wvr}return t===t?t:0}function n8(t){var e=r8(t),r=e%1;return e===e?r?e-r:e:0}function bs(){}function Gqe(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}function zqe(t,e,r,n){for(var i=t.length,a=r+-1;++a<i;)if(e(t[a],a,t))return a;return-1}function xvr(t){return t!==t}function Tvr(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function Zae(t,e,r){return e===e?Tvr(t,e,r):zqe(t,xvr,r)}function Vqe(t,e){var r=t==null?0:t.length;return!!r&&Zae(t,e,0)>-1}function Ss(t){return af(t)?TMe(t):C6e(t)}var Ovr=Object.prototype,Cvr=Ovr.hasOwnProperty,Kc=IMe(function(t,e){if(EC(e)||af(e)){DS(e,Ss(e),t);return}for(var r in e)Cvr.call(e,r)&&TC(t,r,e[r])}),Rvr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kvr=/^\w*$/;function jae(t,e){if(yn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||by(t)?!0:kvr.test(t)||!Rvr.test(t)||e!=null&&t in Object(e)}var Ivr=500;function Nvr(t){var e=kS(t,function(n){return r.size===Ivr&&r.clear(),n}),r=e.cache;return e}var Dvr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lvr=/\\(\\)?/g,Mvr=Nvr(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Dvr,function(r,n,i,a){e.push(i?a.replace(Lvr,"$1"):n||r)}),e});function Hqe(t){return t==null?"":Uqe(t)}function i8(t,e){return yn(t)?t:jae(t,e)?[t]:Mvr(Hqe(t))}function pk(t){if(typeof t=="string"||by(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function a8(t,e){e=i8(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[pk(e[r++])];return r&&r==n?t:void 0}function Bvr(t,e,r){var n=t==null?void 0:a8(t,e);return n===void 0?r:n}function Jae(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var qqe=Qu?Qu.isConcatSpreadable:void 0;function Pvr(t){return yn(t)||IS(t)||!!(qqe&&t&&t[qqe])}function gk(t,e,r,n,i){var a=-1,s=t.length;for(r||(r=Pvr),i||(i=[]);++a<s;){var o=t[a];r(o)?Jae(i,o):n||(i[i.length]=o)}return i}function Ys(t){var e=t==null?0:t.length;return e?gk(t):[]}function Fvr(t){return kMe(RMe(t,void 0,Ys),t+"")}function Yqe(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var a=Array(i);++n<i;)a[n]=t[n+e];return a}function Uvr(t,e,r,n){var i=-1,a=t==null?0:t.length;for(n&&a&&(r=t[++i]);++i<a;)r=e(r,t[i],i,t);return r}function Qvr(t,e){return t&&DS(e,Ss(e),t)}function $vr(t,e){return t&&DS(e,F1(e),t)}function ese(t,e){for(var r=-1,n=t==null?0:t.length,i=0,a=[];++r<n;){var s=t[r];e(s,r,t)&&(a[i++]=s)}return a}function Wqe(){return[]}var Gvr=Object.prototype,zvr=Gvr.propertyIsEnumerable,Xqe=Object.getOwnPropertySymbols,tse=Xqe?function(t){return t==null?[]:(t=Object(t),ese(Xqe(t),function(e){return zvr.call(t,e)}))}:Wqe;function Vvr(t,e){return DS(t,tse(t),e)}var Hvr=Object.getOwnPropertySymbols,Kqe=Hvr?function(t){for(var e=[];t;)Jae(e,tse(t)),t=gJ(t);return e}:Wqe;function qvr(t,e){return DS(t,Kqe(t),e)}function Zqe(t,e,r){var n=e(t);return yn(t)?n:Jae(n,r(t))}function rse(t){return Zqe(t,Ss,tse)}function jqe(t){return Zqe(t,F1,Kqe)}var Yvr=Object.prototype,Wvr=Yvr.hasOwnProperty;function Xvr(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Wvr.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function Kvr(t,e){var r=e?pJ(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Zvr=/\w*$/;function jvr(t){var e=new t.constructor(t.source,Zvr.exec(t));return e.lastIndex=t.lastIndex,e}var Jqe=Qu?Qu.prototype:void 0,eYe=Jqe?Jqe.valueOf:void 0;function Jvr(t){return eYe?Object(eYe.call(t)):{}}var e1r="[object Boolean]",t1r="[object Date]",r1r="[object Map]",n1r="[object Number]",i1r="[object RegExp]",a1r="[object Set]",s1r="[object String]",o1r="[object Symbol]",l1r="[object ArrayBuffer]",c1r="[object DataView]",u1r="[object Float32Array]",h1r="[object Float64Array]",d1r="[object Int8Array]",f1r="[object Int16Array]",p1r="[object Int32Array]",g1r="[object Uint8Array]",m1r="[object Uint8ClampedArray]",A1r="[object Uint16Array]",v1r="[object Uint32Array]";function y1r(t,e,r){var n=t.constructor;switch(e){case l1r:return pJ(t);case e1r:case t1r:return new n(+t);case c1r:return Kvr(t,r);case u1r:case h1r:case d1r:case f1r:case p1r:case g1r:case m1r:case A1r:case v1r:return fMe(t,r);case r1r:return new n;case n1r:case s1r:return new n(t);case i1r:return jvr(t);case a1r:return new n;case o1r:return Jvr(t)}}var _1r="[object Map]";function b1r(t){return Gu(t)&&Vu(t)==_1r}var tYe=cm&&cm.isMap,S1r=tYe?wC(tYe):b1r,E1r="[object Set]";function w1r(t){return Gu(t)&&Vu(t)==E1r}var rYe=cm&&cm.isSet,x1r=rYe?wC(rYe):w1r,T1r=1,O1r=2,C1r=4,nYe="[object Arguments]",R1r="[object Array]",k1r="[object Boolean]",I1r="[object Date]",N1r="[object Error]",iYe="[object Function]",D1r="[object GeneratorFunction]",L1r="[object Map]",M1r="[object Number]",aYe="[object Object]",B1r="[object RegExp]",P1r="[object Set]",F1r="[object String]",U1r="[object Symbol]",Q1r="[object WeakMap]",$1r="[object ArrayBuffer]",G1r="[object DataView]",z1r="[object Float32Array]",V1r="[object Float64Array]",H1r="[object Int8Array]",q1r="[object Int16Array]",Y1r="[object Int32Array]",W1r="[object Uint8Array]",X1r="[object Uint8ClampedArray]",K1r="[object Uint16Array]",Z1r="[object Uint32Array]",Li={};Li[nYe]=Li[R1r]=Li[$1r]=Li[G1r]=Li[k1r]=Li[I1r]=Li[z1r]=Li[V1r]=Li[H1r]=Li[q1r]=Li[Y1r]=Li[L1r]=Li[M1r]=Li[aYe]=Li[B1r]=Li[P1r]=Li[F1r]=Li[U1r]=Li[W1r]=Li[X1r]=Li[K1r]=Li[Z1r]=!0,Li[N1r]=Li[iYe]=Li[Q1r]=!1;function mk(t,e,r,n,i,a){var s,o=e&T1r,l=e&O1r,u=e&C1r;if(s!==void 0)return s;if(!fc(t))return t;var h=yn(t);if(h){if(s=Xvr(t),!o)return pMe(t,s)}else{var d=Vu(t),f=d==iYe||d==D1r;if(NS(t))return dMe(t,o);if(d==aYe||d==nYe||f&&!i){if(s=l||f?{}:AMe(t),!o)return l?qvr(t,$vr(s,t)):Vvr(t,Qvr(s,t))}else{if(!Li[d])return i?t:{};s=y1r(t,d,o)}}a||(a=new $h);var p=a.get(t);if(p)return p;a.set(t,s),x1r(t)?t.forEach(function(A){s.add(mk(A,e,r,A,t,a))}):S1r(t)&&t.forEach(function(A,v){s.set(v,mk(A,e,r,v,t,a))});var g=u?l?jqe:rse:l?F1:Ss,m=h?void 0:g(t);return Gqe(m||t,function(A,v){m&&(v=A,A=t[v]),TC(s,v,mk(A,e,r,v,t,a))}),s}var j1r=4;function Es(t){return mk(t,j1r)}var J1r=1,eyr=4;function tyr(t){return mk(t,J1r|eyr)}function Ak(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var a=t[e];a&&(i[n++]=a)}return i}var ryr="__lodash_hash_undefined__";function nyr(t){return this.__data__.set(t,ryr),this}function iyr(t){return this.__data__.has(t)}function LE(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Hp;++e<r;)this.add(t[e])}LE.prototype.add=LE.prototype.push=nyr,LE.prototype.has=iyr;function sYe(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function nse(t,e){return t.has(e)}var ayr=1,syr=2;function oYe(t,e,r,n,i,a){var s=r&ayr,o=t.length,l=e.length;if(o!=l&&!(s&&l>o))return!1;var u=a.get(t),h=a.get(e);if(u&&h)return u==e&&h==t;var d=-1,f=!0,p=r&syr?new LE:void 0;for(a.set(t,e),a.set(e,t);++d<o;){var g=t[d],m=e[d];if(n)var A=s?n(m,g,d,e,t,a):n(g,m,d,t,e,a);if(A!==void 0){if(A)continue;f=!1;break}if(p){if(!sYe(e,function(v,y){if(!nse(p,y)&&(g===v||i(g,v,r,n,a)))return p.push(y)})){f=!1;break}}else if(!(g===m||i(g,m,r,n,a))){f=!1;break}}return a.delete(t),a.delete(e),f}function oyr(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function ise(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var lyr=1,cyr=2,uyr="[object Boolean]",hyr="[object Date]",dyr="[object Error]",fyr="[object Map]",pyr="[object Number]",gyr="[object RegExp]",myr="[object Set]",Ayr="[object String]",vyr="[object Symbol]",yyr="[object ArrayBuffer]",_yr="[object DataView]",lYe=Qu?Qu.prototype:void 0,ase=lYe?lYe.valueOf:void 0;function byr(t,e,r,n,i,a,s){switch(r){case _yr:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case yyr:return!(t.byteLength!=e.byteLength||!a(new QM(t),new QM(e)));case uyr:case hyr:case pyr:return RS(+t,+e);case dyr:return t.name==e.name&&t.message==e.message;case gyr:case Ayr:return t==e+"";case fyr:var o=oyr;case myr:var l=n&lyr;if(o||(o=ise),t.size!=e.size&&!l)return!1;var u=s.get(t);if(u)return u==e;n|=cyr,s.set(t,e);var h=oYe(o(t),o(e),n,i,a,s);return s.delete(t),h;case vyr:if(ase)return ase.call(t)==ase.call(e)}return!1}var Syr=1,Eyr=Object.prototype,wyr=Eyr.hasOwnProperty;function xyr(t,e,r,n,i,a){var s=r&Syr,o=rse(t),l=o.length,u=rse(e),h=u.length;if(l!=h&&!s)return!1;for(var d=l;d--;){var f=o[d];if(!(s?f in e:wyr.call(e,f)))return!1}var p=a.get(t),g=a.get(e);if(p&&g)return p==e&&g==t;var m=!0;a.set(t,e),a.set(e,t);for(var A=s;++d<l;){f=o[d];var v=t[f],y=e[f];if(n)var _=s?n(y,v,f,e,t,a):n(v,y,f,t,e,a);if(!(_===void 0?v===y||i(v,y,r,n,a):_)){m=!1;break}A||(A=f=="constructor")}if(m&&!A){var b=t.constructor,S=e.constructor;b!=S&&"constructor"in t&&"constructor"in e&&!(typeof b=="function"&&b instanceof b&&typeof S=="function"&&S instanceof S)&&(m=!1)}return a.delete(t),a.delete(e),m}var Tyr=1,cYe="[object Arguments]",uYe="[object Array]",s8="[object Object]",Oyr=Object.prototype,hYe=Oyr.hasOwnProperty;function Cyr(t,e,r,n,i,a){var s=yn(t),o=yn(e),l=s?uYe:Vu(t),u=o?uYe:Vu(e);l=l==cYe?s8:l,u=u==cYe?s8:u;var h=l==s8,d=u==s8,f=l==u;if(f&&NS(t)){if(!NS(e))return!1;s=!0,h=!1}if(f&&!h)return a||(a=new $h),s||GM(t)?oYe(t,e,r,n,i,a):byr(t,e,l,r,n,i,a);if(!(r&Tyr)){var p=h&&hYe.call(t,"__wrapped__"),g=d&&hYe.call(e,"__wrapped__");if(p||g){var m=p?t.value():t,A=g?e.value():e;return a||(a=new $h),i(m,A,r,n,a)}}return f?(a||(a=new $h),xyr(t,e,r,n,i,a)):!1}function sse(t,e,r,n,i){return t===e?!0:t==null||e==null||!Gu(t)&&!Gu(e)?t!==t&&e!==e:Cyr(t,e,r,n,sse,i)}var Ryr=1,kyr=2;function Iyr(t,e,r,n){var i=r.length,a=i;if(t==null)return!a;for(t=Object(t);i--;){var s=r[i];if(s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<a;){s=r[i];var o=s[0],l=t[o],u=s[1];if(s[2]){if(l===void 0&&!(o in t))return!1}else{var h=new $h,d;if(!(d===void 0?sse(u,l,Ryr|kyr,n,h):d))return!1}}return!0}function dYe(t){return t===t&&!fc(t)}function Nyr(t){for(var e=Ss(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,dYe(i)]}return e}function fYe(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Dyr(t){var e=Nyr(t);return e.length==1&&e[0][2]?fYe(e[0][0],e[0][1]):function(r){return r===t||Iyr(r,t,e)}}function Lyr(t,e){return t!=null&&e in Object(t)}function pYe(t,e,r){e=i8(e,t);for(var n=-1,i=e.length,a=!1;++n<i;){var s=pk(e[n]);if(!(a=t!=null&&r(t,s)))break;t=t[s]}return a||++n!=i?a:(i=t==null?0:t.length,!!i&&mJ(i)&&zM(s,i)&&(yn(t)||IS(t)))}function gYe(t,e){return t!=null&&pYe(t,e,Lyr)}var Myr=1,Byr=2;function Pyr(t,e){return jae(t)&&dYe(e)?fYe(pk(t),e):function(r){var n=Bvr(r,t);return n===void 0&&n===e?gYe(r,t):sse(e,n,Myr|Byr)}}function Fyr(t){return function(e){return e==null?void 0:e[t]}}function Uyr(t){return function(e){return a8(e,t)}}function Qyr(t){return jae(t)?Fyr(pk(t)):Uyr(t)}function mc(t){return typeof t=="function"?t:t==null?qp:typeof t=="object"?yn(t)?Pyr(t[0],t[1]):Dyr(t):Qyr(t)}function $yr(t,e,r,n){for(var i=-1,a=t==null?0:t.length;++i<a;){var s=t[i];e(n,s,r(s),t)}return n}function ose(t,e){return t&&fJ(t,e,Ss)}function Gyr(t,e){return function(r,n){if(r==null)return r;if(!af(r))return t(r,n);for(var i=r.length,a=-1,s=Object(r);++a<i&&n(s[a],a,s)!==!1;);return r}}var Ey=Gyr(ose);function zyr(t,e,r,n){return Ey(t,function(i,a,s){e(n,i,r(i),s)}),n}function Vyr(t,e){return function(r,n){var i=yn(r)?$yr:zyr,a=e?e():{};return i(r,t,mc(n),a)}}var mYe=Object.prototype,Hyr=mYe.hasOwnProperty,o8=OC(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&CC(e[0],e[1],i)&&(n=1);++r<n;)for(var a=e[r],s=F1(a),o=-1,l=s.length;++o<l;){var u=s[o],h=t[u];(h===void 0||RS(h,mYe[u])&&!Hyr.call(t,u))&&(t[u]=a[u])}return t}),qyr=200;function Yyr(t,e,r,n){var i=-1,a=Vqe,s=!0,o=t.length,l=[],u=e.length;if(!o)return l;e.length>=qyr&&(a=nse,s=!1,e=new LE(e));e:for(;++i<o;){var h=t[i],d=h;if(h=h!==0?h:0,s&&d===d){for(var f=u;f--;)if(e[f]===d)continue e;l.push(h)}else a(e,d,n)||l.push(h)}return l}var l8=OC(function(t,e){return $M(t)?Yyr(t,gk(e,1,$M,!0)):[]});function Rf(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function go(t,e,r){var n=t==null?0:t.length;return n?(e=e===void 0?1:n8(e),Yqe(t,e<0?0:e,n)):[]}function vk(t,e,r){var n=t==null?0:t.length;return n?(e=e===void 0?1:n8(e),e=n-e,Yqe(t,0,e<0?0:e)):[]}function lse(t){return typeof t=="function"?t:qp}function rt(t,e){var r=yn(t)?Gqe:Ey;return r(t,lse(e))}function Wyr(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}function Xyr(t,e){var r=!0;return Ey(t,function(n,i,a){return r=!!e(n,i,a),r}),r}function Jh(t,e,r){var n=yn(t)?Wyr:Xyr;return n(t,mc(e))}function AYe(t,e){var r=[];return Ey(t,function(n,i,a){e(n,i,a)&&r.push(n)}),r}function _a(t,e){var r=yn(t)?ese:AYe;return r(t,mc(e))}function Kyr(t){return function(e,r,n){var i=Object(e);if(!af(e)){var a=mc(r);e=Ss(e),r=function(o){return a(i[o],o,i)}}var s=t(e,r,n);return s>-1?i[a?e[s]:s]:void 0}}var Zyr=Math.max;function jyr(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:n8(r);return i<0&&(i=Zyr(n+i,0)),zqe(t,mc(e),i)}var wg=Kyr(jyr);function ed(t){return t&&t.length?t[0]:void 0}function vYe(t,e){var r=-1,n=af(t)?Array(t.length):[];return Ey(t,function(i,a,s){n[++r]=e(i,a,s)}),n}function Qt(t,e){var r=yn(t)?Sy:vYe;return r(t,mc(e))}function Zc(t,e){return gk(Qt(t,e))}function Jyr(t,e){return t==null?t:fJ(t,lse(e),F1)}function e_r(t,e){return t&&ose(t,lse(e))}var t_r=Object.prototype,r_r=t_r.hasOwnProperty,n_r=Vyr(function(t,e,r){r_r.call(t,r)?t[r].push(e):SC(t,r,[e])});function i_r(t,e){return t>e}var a_r=Object.prototype,s_r=a_r.hasOwnProperty;function o_r(t,e){return t!=null&&s_r.call(t,e)}function Br(t,e){return t!=null&&pYe(t,e,o_r)}var l_r="[object String]";function Ac(t){return typeof t=="string"||!yn(t)&&Gu(t)&&zp(t)==l_r}function c_r(t,e){return Sy(e,function(r){return t[r]})}function bi(t){return t==null?[]:c_r(t,Ss(t))}var u_r=Math.max;function zl(t,e,r,n){t=af(t)?t:bi(t),r=r?n8(r):0;var i=t.length;return r<0&&(r=u_r(i+r,0)),Ac(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Zae(t,e,r)>-1}function yYe(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=0;return Zae(t,e,i)}var h_r="[object RegExp]";function d_r(t){return Gu(t)&&zp(t)==h_r}var _Ye=cm&&cm.isRegExp,xg=_Ye?wC(_Ye):d_r;function ni(t){return t===void 0}function bYe(t,e){return t<e}function c8(t,e){var r={};return e=mc(e),ose(t,function(n,i,a){SC(r,i,e(n,i,a))}),r}function cse(t,e,r){for(var n=-1,i=t.length;++n<i;){var a=t[n],s=e(a);if(s!=null&&(o===void 0?s===s&&!by(s):r(s,o)))var o=s,l=a}return l}function wy(t){return t&&t.length?cse(t,qp,i_r):void 0}function ME(t){return t&&t.length?cse(t,qp,bYe):void 0}function use(t,e){return t&&t.length?cse(t,mc(e),bYe):void 0}var f_r="Expected a function";function p_r(t){if(typeof t!="function")throw new TypeError(f_r);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function g_r(t,e,r,n){if(!fc(t))return t;e=i8(e,t);for(var i=-1,a=e.length,s=a-1,o=t;o!=null&&++i<a;){var l=pk(e[i]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(i!=s){var h=o[l];u=void 0,u===void 0&&(u=fc(h)?h:zM(e[i+1])?[]:{})}TC(o,l,u),o=o[l]}return t}function SYe(t,e,r){for(var n=-1,i=e.length,a={};++n<i;){var s=e[n],o=a8(t,s);r(o,s)&&g_r(a,i8(s,t),o)}return a}function td(t,e){if(t==null)return{};var r=Sy(jqe(t),function(n){return[n]});return e=mc(e),SYe(t,r,function(n,i){return e(n,i[0])})}function m_r(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}function A_r(t,e){if(t!==e){var r=t!==void 0,n=t===null,i=t===t,a=by(t),s=e!==void 0,o=e===null,l=e===e,u=by(e);if(!o&&!u&&!a&&t>e||a&&s&&l&&!o&&!u||n&&s&&l||!r&&l||!i)return 1;if(!n&&!a&&!u&&t<e||u&&r&&i&&!n&&!a||o&&r&&i||!s&&i||!l)return-1}return 0}function v_r(t,e,r){for(var n=-1,i=t.criteria,a=e.criteria,s=i.length,o=r.length;++n<s;){var l=A_r(i[n],a[n]);if(l){if(n>=o)return l;var u=r[n];return l*(u=="desc"?-1:1)}}return t.index-e.index}function y_r(t,e,r){e.length?e=Sy(e,function(a){return yn(a)?function(s){return a8(s,a.length===1?a[0]:a)}:a}):e=[qp];var n=-1;e=Sy(e,wC(mc));var i=vYe(t,function(a,s,o){var l=Sy(e,function(u){return u(a)});return{criteria:l,index:++n,value:a}});return m_r(i,function(a,s){return v_r(a,s,r)})}function __r(t,e){return SYe(t,e,function(r,n){return gYe(t,n)})}var u8=Fvr(function(t,e){return t==null?{}:__r(t,e)}),b_r=Math.ceil,S_r=Math.max;function E_r(t,e,r,n){for(var i=-1,a=S_r(b_r((e-t)/(r||1)),0),s=Array(a);a--;)s[++i]=t,t+=r;return s}function w_r(t){return function(e,r,n){return n&&typeof n!="number"&&CC(e,r,n)&&(r=n=void 0),e=r8(e),r===void 0?(r=e,e=0):r=r8(r),n=n===void 0?e<r?1:-1:r8(n),E_r(e,r,n)}}var BE=w_r();function x_r(t,e,r,n,i){return i(t,function(a,s,o){r=n?(n=!1,a):e(r,a,s,o)}),r}function ts(t,e,r){var n=yn(t)?Uvr:x_r,i=arguments.length<3;return n(t,mc(e),r,i,Ey)}function h8(t,e){var r=yn(t)?ese:AYe;return r(t,p_r(mc(e)))}function T_r(t,e){var r;return Ey(t,function(n,i,a){return r=e(n,i,a),!r}),!!r}function EYe(t,e,r){var n=yn(t)?sYe:T_r;return n(t,mc(e))}var yk=OC(function(t,e){if(t==null)return[];var r=e.length;return r>1&&CC(t,e[0],e[1])?e=[]:r>2&&CC(e[0],e[1],e[2])&&(e=[e[0]]),y_r(t,gk(e),[])}),O_r=1/0,C_r=VS&&1/ise(new VS([,-0]))[1]==O_r?function(t){return new VS(t)}:bs,R_r=200;function hse(t,e,r){var n=-1,i=Vqe,a=t.length,s=!0,o=[],l=o;if(a>=R_r){var u=e?null:C_r(t);if(u)return ise(u);s=!1,i=nse,l=new LE}else l=e?[]:o;e:for(;++n<a;){var h=t[n],d=e?e(h):h;if(h=h!==0?h:0,s&&d===d){for(var f=l.length;f--;)if(l[f]===d)continue e;e&&l.push(d),o.push(h)}else i(l,d,r)||(l!==o&&l.push(d),o.push(h))}return o}var k_r=OC(function(t){return hse(gk(t,1,$M,!0))});function dse(t){return t&&t.length?hse(t):[]}function I_r(t,e){return t&&t.length?hse(t,mc(e)):[]}var N_r=0;function fse(t){var e=++N_r;return Hqe(t)+e}function D_r(t,e,r){for(var n=-1,i=t.length,a=e.length,s={};++n<i;){var o=n<a?e[n]:void 0;r(s,t[n],o)}return s}function L_r(t,e){return D_r(t||[],e||[],TC)}var M_r="\0",xy="\0",wYe="";class vc{constructor(e={}){this._isDirected=Object.prototype.hasOwnProperty.call(e,"directed")?e.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,"multigraph")?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,"compound")?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=LS(void 0),this._defaultEdgeLabelFn=LS(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[xy]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return $u(e)||(e=LS(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Ss(this._nodes)}sources(){var e=this;return _a(this.nodes(),function(r){return Kn(e._in[r])})}sinks(){var e=this;return _a(this.nodes(),function(r){return Kn(e._out[r])})}setNodes(e,r){var n=arguments,i=this;return rt(e,function(a){n.length>1?i.setNode(a,r):i.setNode(a)}),this}setNode(e,r){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=r),this):(this._nodes[e]=arguments.length>1?r:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=xy,this._children[e]={},this._children[xy][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var r=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],rt(this.children(e),n=>{this.setParent(n)}),delete this._children[e]),rt(Ss(this._in[e]),r),delete this._in[e],delete this._preds[e],rt(Ss(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ni(r))r=xy;else{r+="";for(var n=r;!ni(n);n=this.parent(n))if(n===e)throw new Error("Setting "+r+" as parent of "+e+" would create a cycle");this.setNode(r)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=r,this._children[r][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var r=this._parent[e];if(r!==xy)return r}}children(e){if(ni(e)&&(e=xy),this._isCompound){var r=this._children[e];if(r)return Ss(r)}else{if(e===xy)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var r=this._preds[e];if(r)return Ss(r)}successors(e){var r=this._sucs[e];if(r)return Ss(r)}neighbors(e){var r=this.predecessors(e);if(r)return k_r(r,this.successors(e))}isLeaf(e){var r;return this.isDirected()?r=this.successors(e):r=this.neighbors(e),r.length===0}filterNodes(e){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var n=this;rt(this._nodes,function(s,o){e(o)&&r.setNode(o,s)}),rt(this._edgeObjs,function(s){r.hasNode(s.v)&&r.hasNode(s.w)&&r.setEdge(s,n.edge(s))});var i={};function a(s){var o=n.parent(s);return o===void 0||r.hasNode(o)?(i[s]=o,o):o in i?i[o]:a(o)}return this._isCompound&&rt(r.nodes(),function(s){r.setParent(s,a(s))}),r}setDefaultEdgeLabel(e){return $u(e)||(e=LS(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return bi(this._edgeObjs)}setPath(e,r){var n=this,i=arguments;return ts(e,function(a,s){return i.length>1?n.setEdge(a,s,r):n.setEdge(a,s),s}),this}setEdge(){var e,r,n,i,a=!1,s=arguments[0];typeof s=="object"&&s!==null&&"v"in s?(e=s.v,r=s.w,n=s.name,arguments.length===2&&(i=arguments[1],a=!0)):(e=s,r=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,r=""+r,ni(n)||(n=""+n);var o=_k(this._isDirected,e,r,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return a&&(this._edgeLabels[o]=i),this;if(!ni(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(r),this._edgeLabels[o]=a?i:this._defaultEdgeLabelFn(e,r,n);var l=B_r(this._isDirected,e,r,n);return e=l.v,r=l.w,Object.freeze(l),this._edgeObjs[o]=l,xYe(this._preds[r],e),xYe(this._sucs[e],r),this._in[r][o]=l,this._out[e][o]=l,this._edgeCount++,this}edge(e,r,n){var i=arguments.length===1?pse(this._isDirected,arguments[0]):_k(this._isDirected,e,r,n);return this._edgeLabels[i]}hasEdge(e,r,n){var i=arguments.length===1?pse(this._isDirected,arguments[0]):_k(this._isDirected,e,r,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,i)}removeEdge(e,r,n){var i=arguments.length===1?pse(this._isDirected,arguments[0]):_k(this._isDirected,e,r,n),a=this._edgeObjs[i];return a&&(e=a.v,r=a.w,delete this._edgeLabels[i],delete this._edgeObjs[i],TYe(this._preds[r],e),TYe(this._sucs[e],r),delete this._in[r][i],delete this._out[e][i],this._edgeCount--),this}inEdges(e,r){var n=this._in[e];if(n){var i=bi(n);return r?_a(i,function(a){return a.v===r}):i}}outEdges(e,r){var n=this._out[e];if(n){var i=bi(n);return r?_a(i,function(a){return a.w===r}):i}}nodeEdges(e,r){var n=this.inEdges(e,r);if(n)return n.concat(this.outEdges(e,r))}}vc.prototype._nodeCount=0,vc.prototype._edgeCount=0;function xYe(t,e){t[e]?t[e]++:t[e]=1}function TYe(t,e){--t[e]||delete t[e]}function _k(t,e,r,n){var i=""+e,a=""+r;if(!t&&i>a){var s=i;i=a,a=s}return i+wYe+a+wYe+(ni(n)?M_r:n)}function B_r(t,e,r,n){var i=""+e,a=""+r;if(!t&&i>a){var s=i;i=a,a=s}var o={v:i,w:a};return n&&(o.name=n),o}function pse(t,e){return _k(t,e.v,e.w,e.name)}class P_r{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,r=e._prev;if(r!==e)return OYe(r),r}enqueue(e){var r=this._sentinel;e._prev&&e._next&&OYe(e),e._next=r._next,r._next._prev=e,r._next=e,e._prev=r}toString(){for(var e=[],r=this._sentinel,n=r._prev;n!==r;)e.push(JSON.stringify(n,F_r)),n=n._prev;return"["+e.join(", ")+"]"}}function OYe(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function F_r(t,e){if(t!=="_next"&&t!=="_prev")return e}var U_r=LS(1);function Q_r(t,e){if(t.nodeCount()<=1)return[];var r=G_r(t,e||U_r),n=$_r(r.graph,r.buckets,r.zeroIdx);return Ys(Qt(n,function(i){return t.outEdges(i.v,i.w)}))}function $_r(t,e,r){for(var n=[],i=e[e.length-1],a=e[0],s;t.nodeCount();){for(;s=a.dequeue();)gse(t,e,r,s);for(;s=i.dequeue();)gse(t,e,r,s);if(t.nodeCount()){for(var o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(gse(t,e,r,s,!0));break}}}return n}function gse(t,e,r,n,i){var a=i?[]:void 0;return rt(t.inEdges(n.v),function(s){var o=t.edge(s),l=t.node(s.v);i&&a.push({v:s.v,w:s.w}),l.out-=o,mse(e,r,l)}),rt(t.outEdges(n.v),function(s){var o=t.edge(s),l=s.w,u=t.node(l);u.in-=o,mse(e,r,u)}),t.removeNode(n.v),a}function G_r(t,e){var r=new vc,n=0,i=0;rt(t.nodes(),function(o){r.setNode(o,{v:o,in:0,out:0})}),rt(t.edges(),function(o){var l=r.edge(o.v,o.w)||0,u=e(o),h=l+u;r.setEdge(o.v,o.w,h),i=Math.max(i,r.node(o.v).out+=u),n=Math.max(n,r.node(o.w).in+=u)});var a=BE(i+n+3).map(function(){return new P_r}),s=n+1;return rt(r.nodes(),function(o){mse(a,s,r.node(o))}),{graph:r,buckets:a,zeroIdx:s}}function mse(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}function z_r(t){var e=t.graph().acyclicer==="greedy"?Q_r(t,r(t)):V_r(t);rt(e,function(n){var i=t.edge(n);t.removeEdge(n),i.forwardName=n.name,i.reversed=!0,t.setEdge(n.w,n.v,i,fse("rev"))});function r(n){return function(i){return n.edge(i).weight}}}function V_r(t){var e=[],r={},n={};function i(a){Object.prototype.hasOwnProperty.call(n,a)||(n[a]=!0,r[a]=!0,rt(t.outEdges(a),function(s){Object.prototype.hasOwnProperty.call(r,s.w)?e.push(s):i(s.w)}),delete r[a])}return rt(t.nodes(),i),e}function H_r(t){rt(t.edges(),function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}})}function PE(t,e,r,n){var i;do i=fse(n);while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function q_r(t){var e=new vc().setGraph(t.graph());return rt(t.nodes(),function(r){e.setNode(r,t.node(r))}),rt(t.edges(),function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},i=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),e}function CYe(t){var e=new vc({multigraph:t.isMultigraph()}).setGraph(t.graph());return rt(t.nodes(),function(r){t.children(r).length||e.setNode(r,t.node(r))}),rt(t.edges(),function(r){e.setEdge(r,t.edge(r))}),e}function RYe(t,e){var r=t.x,n=t.y,i=e.x-r,a=e.y-n,s=t.width/2,o=t.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:r+l,y:n+u}}function d8(t){var e=Qt(BE(IYe(t)+1),function(){return[]});return rt(t.nodes(),function(r){var n=t.node(r),i=n.rank;ni(i)||(e[i][n.order]=r)}),e}function Y_r(t){var e=ME(Qt(t.nodes(),function(r){return t.node(r).rank}));rt(t.nodes(),function(r){var n=t.node(r);Br(n,"rank")&&(n.rank-=e)})}function W_r(t){var e=ME(Qt(t.nodes(),function(a){return t.node(a).rank})),r=[];rt(t.nodes(),function(a){var s=t.node(a).rank-e;r[s]||(r[s]=[]),r[s].push(a)});var n=0,i=t.graph().nodeRankFactor;rt(r,function(a,s){ni(a)&&s%i!==0?--n:n&&rt(a,function(o){t.node(o).rank+=n})})}function kYe(t,e,r,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),PE(t,"border",i,e)}function IYe(t){return wy(Qt(t.nodes(),function(e){var r=t.node(e).rank;if(!ni(r))return r}))}function X_r(t,e){var r={lhs:[],rhs:[]};return rt(t,function(n){e(n)?r.lhs.push(n):r.rhs.push(n)}),r}function K_r(t,e){return e()}function Z_r(t){function e(r){var n=t.children(r),i=t.node(r);if(n.length&&rt(n,e),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a<s;++a)NYe(t,"borderLeft","_bl",r,i,a),NYe(t,"borderRight","_br",r,i,a)}}rt(t.children(),e)}function NYe(t,e,r,n,i,a){var s={width:0,height:0,rank:a,borderType:e},o=i[e][a-1],l=PE(t,"border",s,r);i[e][a]=l,t.setParent(l,n),o&&t.setEdge(o,l,{weight:1})}function j_r(t){var e=t.graph().rankdir.toLowerCase();(e==="lr"||e==="rl")&&DYe(t)}function J_r(t){var e=t.graph().rankdir.toLowerCase();(e==="bt"||e==="rl")&&ebr(t),(e==="lr"||e==="rl")&&(tbr(t),DYe(t))}function DYe(t){rt(t.nodes(),function(e){LYe(t.node(e))}),rt(t.edges(),function(e){LYe(t.edge(e))})}function LYe(t){var e=t.width;t.width=t.height,t.height=e}function ebr(t){rt(t.nodes(),function(e){Ase(t.node(e))}),rt(t.edges(),function(e){var r=t.edge(e);rt(r.points,Ase),Object.prototype.hasOwnProperty.call(r,"y")&&Ase(r)})}function Ase(t){t.y=-t.y}function tbr(t){rt(t.nodes(),function(e){vse(t.node(e))}),rt(t.edges(),function(e){var r=t.edge(e);rt(r.points,vse),Object.prototype.hasOwnProperty.call(r,"x")&&vse(r)})}function vse(t){var e=t.x;t.x=t.y,t.y=e}function rbr(t){t.graph().dummyChains=[],rt(t.edges(),function(e){nbr(t,e)})}function nbr(t,e){var r=e.v,n=t.node(r).rank,i=e.w,a=t.node(i).rank,s=e.name,o=t.edge(e),l=o.labelRank;if(a!==n+1){t.removeEdge(e);var u=void 0,h,d;for(d=0,++n;n<a;++d,++n)o.points=[],u={width:0,height:0,edgeLabel:o,edgeObj:e,rank:n},h=PE(t,"edge",u,"_d"),n===l&&(u.width=o.width,u.height=o.height,u.dummy="edge-label",u.labelpos=o.labelpos),t.setEdge(r,h,{weight:o.weight},s),d===0&&t.graph().dummyChains.push(h),r=h;t.setEdge(r,i,{weight:o.weight},s)}}function ibr(t){rt(t.graph().dummyChains,function(e){var r=t.node(e),n=r.edgeLabel,i;for(t.setEdge(r.edgeObj,n);r.dummy;)i=t.successors(e)[0],t.removeNode(e),n.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),e=i,r=t.node(e)})}function yse(t){var e={};function r(n){var i=t.node(n);if(Object.prototype.hasOwnProperty.call(e,n))return i.rank;e[n]=!0;var a=ME(Qt(t.outEdges(n),function(s){return r(s.w)-t.edge(s).minlen}));return(a===Number.POSITIVE_INFINITY||a===void 0||a===null)&&(a=0),i.rank=a}rt(t.sources(),r)}function bk(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}function MYe(t){var e=new vc({directed:!1}),r=t.nodes()[0],n=t.nodeCount();e.setNode(r,{});for(var i,a;abr(e,t)<n;)i=sbr(e,t),a=e.hasNode(i.v)?bk(t,i):-bk(t,i),obr(e,t,a);return e}function abr(t,e){function r(n){rt(e.nodeEdges(n),function(i){var a=i.v,s=n===a?i.w:a;!t.hasNode(s)&&!bk(e,i)&&(t.setNode(s,{}),t.setEdge(n,s,{}),r(s))})}return rt(t.nodes(),r),t.nodeCount()}function sbr(t,e){return use(e.edges(),function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return bk(e,r)})}function obr(t,e,r){rt(t.nodes(),function(n){e.node(n).rank+=r})}function lbr(){}lbr.prototype=new Error;function BYe(t,e,r){yn(e)||(e=[e]);var n=(t.isDirected()?t.successors:t.neighbors).bind(t),i=[],a={};return rt(e,function(s){if(!t.hasNode(s))throw new Error("Graph does not have node: "+s);PYe(t,s,r==="post",a,n,i)}),i}function PYe(t,e,r,n,i,a){Object.prototype.hasOwnProperty.call(n,e)||(n[e]=!0,r||a.push(e),rt(i(e),function(s){PYe(t,s,r,n,i,a)}),r&&a.push(e))}function cbr(t,e){return BYe(t,e,"post")}function ubr(t,e){return BYe(t,e,"pre")}Ty.initLowLimValues=bse,Ty.initCutValues=_se,Ty.calcCutValue=FYe,Ty.leaveEdge=QYe,Ty.enterEdge=$Ye,Ty.exchangeEdges=GYe;function Ty(t){t=q_r(t),yse(t);var e=MYe(t);bse(e),_se(e,t);for(var r,n;r=QYe(e);)n=$Ye(e,t,r),GYe(e,t,r,n)}function _se(t,e){var r=cbr(t,t.nodes());r=r.slice(0,r.length-1),rt(r,function(n){hbr(t,e,n)})}function hbr(t,e,r){var n=t.node(r),i=n.parent;t.edge(r,i).cutvalue=FYe(t,e,r)}function FYe(t,e,r){var n=t.node(r),i=n.parent,a=!0,s=e.edge(r,i),o=0;return s||(a=!1,s=e.edge(i,r)),o=s.weight,rt(e.nodeEdges(r),function(l){var u=l.v===r,h=u?l.w:l.v;if(h!==i){var d=u===a,f=e.edge(l).weight;if(o+=d?f:-f,fbr(t,r,h)){var p=t.edge(r,h).cutvalue;o+=d?-p:p}}}),o}function bse(t,e){arguments.length<2&&(e=t.nodes()[0]),UYe(t,{},1,e)}function UYe(t,e,r,n,i){var a=r,s=t.node(n);return e[n]=!0,rt(t.neighbors(n),function(o){Object.prototype.hasOwnProperty.call(e,o)||(r=UYe(t,e,r,o,n))}),s.low=a,s.lim=r++,i?s.parent=i:delete s.parent,r}function QYe(t){return wg(t.edges(),function(e){return t.edge(e).cutvalue<0})}function $Ye(t,e,r){var n=r.v,i=r.w;e.hasEdge(n,i)||(n=r.w,i=r.v);var a=t.node(n),s=t.node(i),o=a,l=!1;a.lim>s.lim&&(o=s,l=!0);var u=_a(e.edges(),function(h){return l===zYe(t,t.node(h.v),o)&&l!==zYe(t,t.node(h.w),o)});return use(u,function(h){return bk(e,h)})}function GYe(t,e,r,n){var i=r.v,a=r.w;t.removeEdge(i,a),t.setEdge(n.v,n.w,{}),bse(t),_se(t,e),dbr(t,e)}function dbr(t,e){var r=wg(t.nodes(),function(i){return!e.node(i).parent}),n=ubr(t,r);n=n.slice(1),rt(n,function(i){var a=t.node(i).parent,s=e.edge(i,a),o=!1;s||(s=e.edge(a,i),o=!0),e.node(i).rank=e.node(a).rank+(o?s.minlen:-s.minlen)})}function fbr(t,e,r){return t.hasEdge(e,r)}function zYe(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}function pbr(t){switch(t.graph().ranker){case"network-simplex":VYe(t);break;case"tight-tree":mbr(t);break;case"longest-path":gbr(t);break;default:VYe(t)}}var gbr=yse;function mbr(t){yse(t),MYe(t)}function VYe(t){Ty(t)}function Abr(t){var e=PE(t,"root",{},"_root"),r=vbr(t),n=wy(bi(r))-1,i=2*n+1;t.graph().nestingRoot=e,rt(t.edges(),function(s){t.edge(s).minlen*=i});var a=ybr(t)+1;rt(t.children(),function(s){HYe(t,e,i,a,n,r,s)}),t.graph().nodeRankFactor=i}function HYe(t,e,r,n,i,a,s){var o=t.children(s);if(!o.length){s!==e&&t.setEdge(e,s,{weight:0,minlen:r});return}var l=kYe(t,"_bt"),u=kYe(t,"_bb"),h=t.node(s);t.setParent(l,s),h.borderTop=l,t.setParent(u,s),h.borderBottom=u,rt(o,function(d){HYe(t,e,r,n,i,a,d);var f=t.node(d),p=f.borderTop?f.borderTop:d,g=f.borderBottom?f.borderBottom:d,m=f.borderTop?n:2*n,A=p!==g?1:i-a[s]+1;t.setEdge(l,p,{weight:m,minlen:A,nestingEdge:!0}),t.setEdge(g,u,{weight:m,minlen:A,nestingEdge:!0})}),t.parent(s)||t.setEdge(e,l,{weight:0,minlen:i+a[s]})}function vbr(t){var e={};function r(n,i){var a=t.children(n);a&&a.length&&rt(a,function(s){r(s,i+1)}),e[n]=i}return rt(t.children(),function(n){r(n,1)}),e}function ybr(t){return ts(t.edges(),function(e,r){return e+t.edge(r).weight},0)}function _br(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,rt(t.edges(),function(r){var n=t.edge(r);n.nestingEdge&&t.removeEdge(r)})}function bbr(t,e,r){var n={},i;rt(r,function(a){for(var s=t.parent(a),o,l;s;){if(o=t.parent(s),o?(l=n[o],n[o]=s):(l=i,i=s),l&&l!==s){e.setEdge(l,s);return}s=o}})}function Sbr(t,e,r){var n=Ebr(t),i=new vc({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return t.node(a)});return rt(t.nodes(),function(a){var s=t.node(a),o=t.parent(a);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(i.setNode(a),i.setParent(a,o||n),rt(t[r](a),function(l){var u=l.v===a?l.w:l.v,h=i.edge(u,a),d=ni(h)?0:h.weight;i.setEdge(u,a,{weight:t.edge(l).weight+d})}),Object.prototype.hasOwnProperty.call(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))}),i}function Ebr(t){for(var e;t.hasNode(e=fse("_root")););return e}function wbr(t,e){for(var r=0,n=1;n<e.length;++n)r+=xbr(t,e[n-1],e[n]);return r}function xbr(t,e,r){for(var n=L_r(r,Qt(r,function(u,h){return h})),i=Ys(Qt(e,function(u){return yk(Qt(t.outEdges(u),function(h){return{pos:n[h.w],weight:t.edge(h).weight}}),"pos")})),a=1;a<r.length;)a<<=1;var s=2*a-1;a-=1;var o=Qt(new Array(s),function(){return 0}),l=0;return rt(i.forEach(function(u){var h=u.pos+a;o[h]+=u.weight;for(var d=0;h>0;)h%2&&(d+=o[h+1]),h=h-1>>1,o[h]+=u.weight;l+=u.weight*d})),l}function Tbr(t){var e={},r=_a(t.nodes(),function(o){return!t.children(o).length}),n=wy(Qt(r,function(o){return t.node(o).rank})),i=Qt(BE(n+1),function(){return[]});function a(o){if(!Br(e,o)){e[o]=!0;var l=t.node(o);i[l.rank].push(o),rt(t.successors(o),a)}}var s=yk(r,function(o){return t.node(o).rank});return rt(s,a),i}function Obr(t,e){return Qt(e,function(r){var n=t.inEdges(r);if(n.length){var i=ts(n,function(a,s){var o=t.edge(s),l=t.node(s.v);return{sum:a.sum+o.weight*l.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function Cbr(t,e){var r={};rt(t,function(i,a){var s=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};ni(i.barycenter)||(s.barycenter=i.barycenter,s.weight=i.weight)}),rt(e.edges(),function(i){var a=r[i.v],s=r[i.w];!ni(a)&&!ni(s)&&(s.indegree++,a.out.push(r[i.w]))});var n=_a(r,function(i){return!i.indegree});return Rbr(n)}function Rbr(t){var e=[];function r(a){return function(s){s.merged||(ni(s.barycenter)||ni(a.barycenter)||s.barycenter>=a.barycenter)&&kbr(a,s)}}function n(a){return function(s){s.in.push(a),--s.indegree===0&&t.push(s)}}for(;t.length;){var i=t.pop();e.push(i),rt(i.in.reverse(),r(i)),rt(i.out,n(i))}return Qt(_a(e,function(a){return!a.merged}),function(a){return u8(a,["vs","i","barycenter","weight"])})}function kbr(t,e){var r=0,n=0;t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=r/n,t.weight=n,t.i=Math.min(e.i,t.i),e.merged=!0}function Ibr(t,e){var r=X_r(t,function(h){return Object.prototype.hasOwnProperty.call(h,"barycenter")}),n=r.lhs,i=yk(r.rhs,function(h){return-h.i}),a=[],s=0,o=0,l=0;n.sort(Nbr(!!e)),l=qYe(a,i,l),rt(n,function(h){l+=h.vs.length,a.push(h.vs),s+=h.barycenter*h.weight,o+=h.weight,l=qYe(a,i,l)});var u={vs:Ys(a)};return o&&(u.barycenter=s/o,u.weight=o),u}function qYe(t,e,r){for(var n;e.length&&(n=Rf(e)).i<=r;)e.pop(),t.push(n.vs),r++;return r}function Nbr(t){return function(e,r){return e.barycenter<r.barycenter?-1:e.barycenter>r.barycenter?1:t?r.i-e.i:e.i-r.i}}function YYe(t,e,r,n){var i=t.children(e),a=t.node(e),s=a?a.borderLeft:void 0,o=a?a.borderRight:void 0,l={};s&&(i=_a(i,function(g){return g!==s&&g!==o}));var u=Obr(t,i);rt(u,function(g){if(t.children(g.v).length){var m=YYe(t,g.v,r,n);l[g.v]=m,Object.prototype.hasOwnProperty.call(m,"barycenter")&&Lbr(g,m)}});var h=Cbr(u,r);Dbr(h,l);var d=Ibr(h,n);if(s&&(d.vs=Ys([s,d.vs,o]),t.predecessors(s).length)){var f=t.node(t.predecessors(s)[0]),p=t.node(t.predecessors(o)[0]);Object.prototype.hasOwnProperty.call(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d}function Dbr(t,e){rt(t,function(r){r.vs=Ys(r.vs.map(function(n){return e[n]?e[n].vs:n}))})}function Lbr(t,e){ni(t.barycenter)?(t.barycenter=e.barycenter,t.weight=e.weight):(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight)}function Mbr(t){var e=IYe(t),r=WYe(t,BE(1,e+1),"inEdges"),n=WYe(t,BE(e-1,-1,-1),"outEdges"),i=Tbr(t);XYe(t,i);for(var a=Number.POSITIVE_INFINITY,s,o=0,l=0;l<4;++o,++l){Bbr(o%2?r:n,o%4>=2),i=d8(t);var u=wbr(t,i);u<a&&(l=0,s=tyr(i),a=u)}XYe(t,s)}function WYe(t,e,r){return Qt(e,function(n){return Sbr(t,n,r)})}function Bbr(t,e){var r=new vc;rt(t,function(n){var i=n.graph().root,a=YYe(n,i,r,e);rt(a.vs,function(s,o){n.node(s).order=o}),bbr(n,r,a.vs)})}function XYe(t,e){rt(e,function(r){rt(r,function(n,i){t.node(n).order=i})})}function Pbr(t){var e=Ubr(t);rt(t.graph().dummyChains,function(r){for(var n=t.node(r),i=n.edgeObj,a=Fbr(t,e,i.v,i.w),s=a.path,o=a.lca,l=0,u=s[l],h=!0;r!==i.w;){if(n=t.node(r),h){for(;(u=s[l])!==o&&t.node(u).maxRank<n.rank;)l++;u===o&&(h=!1)}if(!h){for(;l<s.length-1&&t.node(u=s[l+1]).minRank<=n.rank;)l++;u=s[l]}t.setParent(r,u),r=t.successors(r)[0]}})}function Fbr(t,e,r,n){var i=[],a=[],s=Math.min(e[r].low,e[n].low),o=Math.max(e[r].lim,e[n].lim),l,u;l=r;do l=t.parent(l),i.push(l);while(l&&(e[l].low>s||o>e[l].lim));for(u=l,l=n;(l=t.parent(l))!==u;)a.push(l);return{path:i.concat(a.reverse()),lca:u}}function Ubr(t){var e={},r=0;function n(i){var a=r;rt(t.children(i),n),e[i]={low:a,lim:r++}}return rt(t.children(),n),e}function Qbr(t,e){var r={};function n(i,a){var s=0,o=0,l=i.length,u=Rf(a);return rt(a,function(h,d){var f=Gbr(t,h),p=f?t.node(f).order:l;(f||h===u)&&(rt(a.slice(o,d+1),function(g){rt(t.predecessors(g),function(m){var A=t.node(m),v=A.order;(v<s||p<v)&&!(A.dummy&&t.node(g).dummy)&&KYe(r,m,g)})}),o=d+1,s=p)}),a}return ts(e,n),r}function $br(t,e){var r={};function n(a,s,o,l,u){var h;rt(BE(s,o),function(d){h=a[d],t.node(h).dummy&&rt(t.predecessors(h),function(f){var p=t.node(f);p.dummy&&(p.order<l||p.order>u)&&KYe(r,f,h)})})}function i(a,s){var o=-1,l,u=0;return rt(s,function(h,d){if(t.node(h).dummy==="border"){var f=t.predecessors(h);f.length&&(l=t.node(f[0]).order,n(s,u,d,o,l),u=d,o=l)}n(s,u,s.length,l,a.length)}),s}return ts(e,i),r}function Gbr(t,e){if(t.node(e).dummy)return wg(t.predecessors(e),function(r){return t.node(r).dummy})}function KYe(t,e,r){if(e>r){var n=e;e=r,r=n}Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=t[e];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function zbr(t,e,r){if(e>r){var n=e;e=r,r=n}return!!t[e]&&Object.prototype.hasOwnProperty.call(t[e],r)}function Vbr(t,e,r,n){var i={},a={},s={};return rt(e,function(o){rt(o,function(l,u){i[l]=l,a[l]=l,s[l]=u})}),rt(e,function(o){var l=-1;rt(o,function(u){var h=n(u);if(h.length){h=yk(h,function(m){return s[m]});for(var d=(h.length-1)/2,f=Math.floor(d),p=Math.ceil(d);f<=p;++f){var g=h[f];a[u]===u&&l<s[g]&&!zbr(r,u,g)&&(a[g]=u,a[u]=i[u]=i[g],l=s[g])}}})}),{root:i,align:a}}function Hbr(t,e,r,n,i){var a={},s=qbr(t,e,r,i),o=i?"borderLeft":"borderRight";function l(d,f){for(var p=s.nodes(),g=p.pop(),m={};g;)m[g]?d(g):(m[g]=!0,p.push(g),p=p.concat(f(g))),g=p.pop()}function u(d){a[d]=s.inEdges(d).reduce(function(f,p){return Math.max(f,a[p.v]+s.edge(p))},0)}function h(d){var f=s.outEdges(d).reduce(function(g,m){return Math.min(g,a[m.w]-s.edge(m))},Number.POSITIVE_INFINITY),p=t.node(d);f!==Number.POSITIVE_INFINITY&&p.borderType!==o&&(a[d]=Math.max(a[d],f))}return l(u,s.predecessors.bind(s)),l(h,s.successors.bind(s)),rt(n,function(d){a[d]=a[r[d]]}),a}function qbr(t,e,r,n){var i=new vc,a=t.graph(),s=Zbr(a.nodesep,a.edgesep,n);return rt(e,function(o){var l;rt(o,function(u){var h=r[u];if(i.setNode(h),l){var d=r[l],f=i.edge(d,h);i.setEdge(d,h,Math.max(s(t,u,l),f||0))}l=u})}),i}function Ybr(t,e){return use(bi(e),function(r){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return Jyr(r,function(a,s){var o=jbr(t,s)/2;n=Math.max(a+o,n),i=Math.min(a-o,i)}),n-i})}function Wbr(t,e){var r=bi(e),n=ME(r),i=wy(r);rt(["u","d"],function(a){rt(["l","r"],function(s){var o=a+s,l=t[o],u;if(l!==e){var h=bi(l);u=s==="l"?n-ME(h):i-wy(h),u&&(t[o]=c8(l,function(d){return d+u}))}})})}function Xbr(t,e){return c8(t.ul,function(r,n){if(e)return t[e.toLowerCase()][n];var i=yk(Qt(t,n));return(i[1]+i[2])/2})}function Kbr(t){var e=d8(t),r=VM(Qbr(t,e),$br(t,e)),n={},i;rt(["u","d"],function(s){i=s==="u"?e:bi(e).reverse(),rt(["l","r"],function(o){o==="r"&&(i=Qt(i,function(d){return bi(d).reverse()}));var l=(s==="u"?t.predecessors:t.successors).bind(t),u=Vbr(t,i,r,l),h=Hbr(t,i,u.root,u.align,o==="r");o==="r"&&(h=c8(h,function(d){return-d})),n[s+o]=h})});var a=Ybr(t,n);return Wbr(n,a),Xbr(n,t.graph().align)}function Zbr(t,e,r){return function(n,i,a){var s=n.node(i),o=n.node(a),l=0,u;if(l+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(l+=r?u:-u),u=0,l+=(s.dummy?e:t)/2,l+=(o.dummy?e:t)/2,l+=o.width/2,Object.prototype.hasOwnProperty.call(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(l+=r?u:-u),u=0,l}}function jbr(t,e){return t.node(e).width}function Jbr(t){t=CYe(t),eSr(t),e_r(Kbr(t),function(e,r){t.node(r).x=e})}function eSr(t){var e=d8(t),r=t.graph().ranksep,n=0;rt(e,function(i){var a=wy(Qt(i,function(s){return t.node(s).height}));rt(i,function(s){t.node(s).y=n+a/2}),n+=a+r})}function ZYe(t,e){var r=K_r;r("layout",()=>{var n=r(" buildLayoutGraph",()=>hSr(t));r(" runLayout",()=>tSr(n,r)),r(" updateInputGraph",()=>rSr(t,n))})}function tSr(t,e){e(" makeSpaceForEdgeLabels",()=>dSr(t)),e(" removeSelfEdges",()=>bSr(t)),e(" acyclic",()=>z_r(t)),e(" nestingGraph.run",()=>Abr(t)),e(" rank",()=>pbr(CYe(t))),e(" injectEdgeLabelProxies",()=>fSr(t)),e(" removeEmptyRanks",()=>W_r(t)),e(" nestingGraph.cleanup",()=>_br(t)),e(" normalizeRanks",()=>Y_r(t)),e(" assignRankMinMax",()=>pSr(t)),e(" removeEdgeLabelProxies",()=>gSr(t)),e(" normalize.run",()=>rbr(t)),e(" parentDummyChains",()=>Pbr(t)),e(" addBorderSegments",()=>Z_r(t)),e(" order",()=>Mbr(t)),e(" insertSelfEdges",()=>SSr(t)),e(" adjustCoordinateSystem",()=>j_r(t)),e(" position",()=>Jbr(t)),e(" positionSelfEdges",()=>ESr(t)),e(" removeBorderNodes",()=>_Sr(t)),e(" normalize.undo",()=>ibr(t)),e(" fixupEdgeLabelCoords",()=>vSr(t)),e(" undoCoordinateSystem",()=>J_r(t)),e(" translateGraph",()=>mSr(t)),e(" assignNodeIntersects",()=>ASr(t)),e(" reversePoints",()=>ySr(t)),e(" acyclic.undo",()=>H_r(t))}function rSr(t,e){rt(t.nodes(),function(r){var n=t.node(r),i=e.node(r);n&&(n.x=i.x,n.y=i.y,e.children(r).length&&(n.width=i.width,n.height=i.height))}),rt(t.edges(),function(r){var n=t.edge(r),i=e.edge(r);n.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(n.x=i.x,n.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}var nSr=["nodesep","edgesep","ranksep","marginx","marginy"],iSr={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},aSr=["acyclicer","ranker","rankdir","align"],sSr=["width","height"],oSr={width:0,height:0},lSr=["minlen","weight","width","height","labeloffset"],cSr={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},uSr=["labelpos"];function hSr(t){var e=new vc({multigraph:!0,compound:!0}),r=Ese(t.graph());return e.setGraph(VM({},iSr,Sse(r,nSr),u8(r,aSr))),rt(t.nodes(),function(n){var i=Ese(t.node(n));e.setNode(n,o8(Sse(i,sSr),oSr)),e.setParent(n,t.parent(n))}),rt(t.edges(),function(n){var i=Ese(t.edge(n));e.setEdge(n,VM({},cSr,Sse(i,lSr),u8(i,uSr)))}),e}function dSr(t){var e=t.graph();e.ranksep/=2,rt(t.edges(),function(r){var n=t.edge(r);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function fSr(t){rt(t.edges(),function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),i=t.node(e.w),a={rank:(i.rank-n.rank)/2+n.rank,e};PE(t,"edge-proxy",a,"_ep")}})}function pSr(t){var e=0;rt(t.nodes(),function(r){var n=t.node(r);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,e=wy(e,n.maxRank))}),t.graph().maxRank=e}function gSr(t){rt(t.nodes(),function(e){var r=t.node(e);r.dummy==="edge-proxy"&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}function mSr(t){var e=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,a=t.graph(),s=a.marginx||0,o=a.marginy||0;function l(u){var h=u.x,d=u.y,f=u.width,p=u.height;e=Math.min(e,h-f/2),r=Math.max(r,h+f/2),n=Math.min(n,d-p/2),i=Math.max(i,d+p/2)}rt(t.nodes(),function(u){l(t.node(u))}),rt(t.edges(),function(u){var h=t.edge(u);Object.prototype.hasOwnProperty.call(h,"x")&&l(h)}),e-=s,n-=o,rt(t.nodes(),function(u){var h=t.node(u);h.x-=e,h.y-=n}),rt(t.edges(),function(u){var h=t.edge(u);rt(h.points,function(d){d.x-=e,d.y-=n}),Object.prototype.hasOwnProperty.call(h,"x")&&(h.x-=e),Object.prototype.hasOwnProperty.call(h,"y")&&(h.y-=n)}),a.width=r-e+s,a.height=i-n+o}function ASr(t){rt(t.edges(),function(e){var r=t.edge(e),n=t.node(e.v),i=t.node(e.w),a,s;r.points?(a=r.points[0],s=r.points[r.points.length-1]):(r.points=[],a=i,s=n),r.points.unshift(RYe(n,a)),r.points.push(RYe(i,s))})}function vSr(t){rt(t.edges(),function(e){var r=t.edge(e);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function ySr(t){rt(t.edges(),function(e){var r=t.edge(e);r.reversed&&r.points.reverse()})}function _Sr(t){rt(t.nodes(),function(e){if(t.children(e).length){var r=t.node(e),n=t.node(r.borderTop),i=t.node(r.borderBottom),a=t.node(Rf(r.borderLeft)),s=t.node(Rf(r.borderRight));r.width=Math.abs(s.x-a.x),r.height=Math.abs(i.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),rt(t.nodes(),function(e){t.node(e).dummy==="border"&&t.removeNode(e)})}function bSr(t){rt(t.edges(),function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function SSr(t){var e=d8(t);rt(e,function(r){var n=0;rt(r,function(i,a){var s=t.node(i);s.order=a+n,rt(s.selfEdges,function(o){PE(t,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:a+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function ESr(t){rt(t.nodes(),function(e){var r=t.node(e);if(r.dummy==="selfedge"){var n=t.node(r.e.v),i=n.x+n.width/2,a=n.y,s=r.x-i,o=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],r.label.x=r.x,r.label.y=r.y}})}function Sse(t,e){return c8(u8(t,e),Number)}function Ese(t){var e={};return rt(t,function(r,n){e[n.toLowerCase()]=r}),e}function kf(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:wSr(t),edges:xSr(t)};return ni(t.graph())||(e.value=Es(t.graph())),e}function wSr(t){return Qt(t.nodes(),function(e){var r=t.node(e),n=t.parent(e),i={v:e};return ni(r)||(i.value=r),ni(n)||(i.parent=n),i})}function xSr(t){return Qt(t.edges(),function(e){var r=t.edge(e),n={v:e.v,w:e.w};return ni(e.name)||(n.name=e.name),ni(r)||(n.value=r),n})}var pn=new Map,Oy=new Map,jYe=new Map,TSr=N(()=>{Oy.clear(),jYe.clear(),pn.clear()},"clear"),f8=N((t,e)=>{const r=Oy.get(e)||[];return _e.trace("In isDescendant",e," ",t," = ",r.includes(t)),r.includes(t)},"isDescendant"),OSr=N((t,e)=>{const r=Oy.get(e)||[];return _e.info("Descendants of ",e," is ",r),_e.info("Edge is ",t),t.v===e||t.w===e?!1:r?r.includes(t.v)||f8(t.v,e)||f8(t.w,e)||r.includes(t.w):(_e.debug("Tilt, ",e,",not in descendants"),!1)},"edgeInCluster"),JYe=N((t,e,r,n)=>{_e.warn("Copying children of ",t,"root",n,"data",e.node(t),n);const i=e.children(t)||[];t!==n&&i.push(t),_e.warn("Copying (nodes) clusterId",t,"nodes",i),i.forEach(a=>{if(e.children(a).length>0)JYe(a,e,r,n);else{const s=e.node(a);_e.info("cp ",a," to ",n," with parent ",t),r.setNode(a,s),n!==e.parent(a)&&(_e.warn("Setting parent",a,e.parent(a)),r.setParent(a,e.parent(a))),t!==n&&a!==t?(_e.debug("Setting parent",a,t),r.setParent(a,t)):(_e.info("In copy ",t,"root",n,"data",e.node(t),n),_e.debug("Not Setting parent for node=",a,"cluster!==rootId",t!==n,"node!==clusterId",a!==t));const o=e.edges(a);_e.debug("Copying Edges",o),o.forEach(l=>{_e.info("Edge",l);const u=e.edge(l.v,l.w,l.name);_e.info("Edge data",u,n);try{OSr(l,n)?(_e.info("Copying as ",l.v,l.w,u,l.name),r.setEdge(l.v,l.w,u,l.name),_e.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):_e.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",n," clusterId:",t)}catch(h){_e.error(h)}})}_e.debug("Removing node",a),e.removeNode(a)})},"copy"),eWe=N((t,e)=>{const r=e.children(t);let n=[...r];for(const i of r)jYe.set(i,t),n=[...n,...eWe(i,e)];return n},"extractDescendants"),CSr=N((t,e,r)=>{const n=t.edges().filter(l=>l.v===e||l.w===e),i=t.edges().filter(l=>l.v===r||l.w===r),a=n.map(l=>({v:l.v===e?r:l.v,w:l.w===e?e:l.w})),s=i.map(l=>({v:l.v,w:l.w}));return a.filter(l=>s.some(u=>l.v===u.v&&l.w===u.w))},"findCommonEdges"),Sk=N((t,e,r)=>{const n=e.children(t);if(_e.trace("Searching children of id ",t,n),n.length<1)return t;let i;for(const a of n){const s=Sk(a,e,r),o=CSr(e,r,s);if(s)if(o.length>0)i=s;else return s}return i},"findNonClusterChild"),tWe=N(t=>!pn.has(t)||!pn.get(t).externalConnections?t:pn.has(t)?pn.get(t).id:t,"getAnchorId"),RSr=N((t,e)=>{if(!t||e>10){_e.debug("Opting out, no graph ");return}else _e.debug("Opting in, graph ");t.nodes().forEach(function(r){t.children(r).length>0&&(_e.warn("Cluster identified",r," Replacement id in edges: ",Sk(r,t,r)),Oy.set(r,eWe(r,t)),pn.set(r,{id:Sk(r,t,r),clusterData:t.node(r)}))}),t.nodes().forEach(function(r){const n=t.children(r),i=t.edges();n.length>0?(_e.debug("Cluster identified",r,Oy),i.forEach(a=>{const s=f8(a.v,r),o=f8(a.w,r);s^o&&(_e.warn("Edge: ",a," leaves cluster ",r),_e.warn("Descendants of XXX ",r,": ",Oy.get(r)),pn.get(r).externalConnections=!0)})):_e.debug("Not a cluster ",r,Oy)});for(let r of pn.keys()){const n=pn.get(r).id,i=t.parent(n);i!==r&&pn.has(i)&&!pn.get(i).externalConnections&&(pn.get(r).id=i)}t.edges().forEach(function(r){const n=t.edge(r);_e.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(r)),_e.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(t.edge(r)));let i=r.v,a=r.w;if(_e.warn("Fix XXX",pn,"ids:",r.v,r.w,"Translating: ",pn.get(r.v)," --- ",pn.get(r.w)),pn.get(r.v)||pn.get(r.w)){if(_e.warn("Fixing and trying - removing XXX",r.v,r.w,r.name),i=tWe(r.v),a=tWe(r.w),t.removeEdge(r.v,r.w,r.name),i!==r.v){const s=t.parent(i);pn.get(s).externalConnections=!0,n.fromCluster=r.v}if(a!==r.w){const s=t.parent(a);pn.get(s).externalConnections=!0,n.toCluster=r.w}_e.warn("Fix Replacing with XXX",i,a,r.name),t.setEdge(i,a,n,r.name)}}),_e.warn("Adjusted Graph",kf(t)),rWe(t,0),_e.trace(pn)},"adjustClustersAndEdges"),rWe=N((t,e)=>{var i,a;if(_e.warn("extractor - ",e,kf(t),t.children("D")),e>10){_e.error("Bailing out");return}let r=t.nodes(),n=!1;for(const s of r){const o=t.children(s);n=n||o.length>0}if(!n){_e.debug("Done, no node has children",t.nodes());return}_e.debug("Nodes = ",r,e);for(const s of r)if(_e.debug("Extracting node",s,pn,pn.has(s)&&!pn.get(s).externalConnections,!t.parent(s),t.node(s),t.children("D")," Depth ",e),!pn.has(s))_e.debug("Not a cluster",s,e);else if(!pn.get(s).externalConnections&&t.children(s)&&t.children(s).length>0){_e.warn("Cluster without external connections, without a parent and with children",s,e);let l=t.graph().rankdir==="TB"?"LR":"TB";(a=(i=pn.get(s))==null?void 0:i.clusterData)!=null&&a.dir&&(l=pn.get(s).clusterData.dir,_e.warn("Fixing dir",pn.get(s).clusterData.dir,l));const u=new vc({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});_e.warn("Old graph before copy",kf(t)),JYe(s,t,u,s),t.setNode(s,{clusterNode:!0,id:s,clusterData:pn.get(s).clusterData,label:pn.get(s).label,graph:u}),_e.warn("New graph after copy node: (",s,")",kf(u)),_e.debug("Old graph after copy",kf(t))}else _e.warn("Cluster ** ",s," **not meeting the criteria !externalConnections:",!pn.get(s).externalConnections," no parent: ",!t.parent(s)," children ",t.children(s)&&t.children(s).length>0,t.children("D"),e),_e.debug(pn);r=t.nodes(),_e.warn("New list of nodes",r);for(const s of r){const o=t.node(s);_e.warn(" Now next level",s,o),o!=null&&o.clusterNode&&rWe(o.graph,e+1)}},"extractor"),nWe=N((t,e)=>{if(e.length===0)return[];let r=Object.assign([],e);return e.forEach(n=>{const i=t.children(n),a=nWe(t,i);r=[...r,...a]}),r},"sorter"),kSr=N(t=>nWe(t,t.children()),"sortNodesByHierarchy"),iWe=N(async(t,e,r,n,i,a)=>{_e.warn("Graph in recursive render:XAX",kf(e),i);const s=e.graph().rankdir;_e.trace("Dir in recursive render - dir:",s);const o=t.insert("g").attr("class","root");e.nodes()?_e.info("Recursive render XXX",e.nodes()):_e.info("No nodes found for",e),e.edges().length>0&&_e.info("Recursive edges",e.edge(e.edges()[0]));const l=o.insert("g").attr("class","clusters"),u=o.insert("g").attr("class","edgePaths"),h=o.insert("g").attr("class","edgeLabels"),d=o.insert("g").attr("class","nodes");await Promise.all(e.nodes().map(async function(m){const A=e.node(m);if(i!==void 0){const v=JSON.parse(JSON.stringify(i.clusterData));_e.trace(`Setting data for parent cluster XXX
1064
1064
  Node.id = `,m,`
1065
1065
  data=`,v.height,`
1066
1066
  Parent cluster`,i.height),e.setNode(i.id,v),e.parent(m)||(_e.trace("Setting parent",m,i.id),e.setParent(m,i.id,v))}if(_e.info("(Insert) Node XXX"+m+": "+JSON.stringify(e.node(m))),A!=null&&A.clusterNode){_e.info("Cluster identified XBX",m,A.width,e.node(m));const{ranksep:v,nodesep:y}=e.graph();A.graph.setGraph({...A.graph.graph(),ranksep:v+25,nodesep:y});const _=await iWe(d,A.graph,r,n,e.node(m),a),b=_.elem;vr(A,b),A.diff=_.diff||0,_e.info("New compound node after recursive render XAX",m,"width",A.width,"height",A.height),nWt(b,A)}else e.children(m).length>0?(_e.trace("Cluster - the non recursive path XBX",m,A.id,A,A.width,"Graph:",e),_e.trace(Sk(A.id,e)),pn.set(A.id,{id:Sk(A.id,e),node:A})):(_e.trace("Node - the non recursive path XAX",m,d,e.node(m),s),await gB(d,e.node(m),{config:a,dir:s}))})),await N(async()=>{const m=e.edges().map(async function(A){const v=e.edge(A.v,A.w,A.name);_e.info("Edge "+A.v+" -> "+A.w+": "+JSON.stringify(A)),_e.info("Edge "+A.v+" -> "+A.w+": ",A," ",JSON.stringify(e.edge(A))),_e.info("Fix",pn,"ids:",A.v,A.w,"Translating: ",pn.get(A.v),pn.get(A.w)),await u6e(h,v)});await Promise.all(m)},"processEdges")(),_e.info("Graph before layout:",JSON.stringify(kf(e))),_e.info("############################################# XXX"),_e.info("### Layout ### XXX"),_e.info("############################################# XXX"),ZYe(e),_e.info("Graph after layout:",JSON.stringify(kf(e)));let p=0,{subGraphTitleTotalMargin:g}=vC(a);return await Promise.all(kSr(e).map(async function(m){var v;const A=e.node(m);if(_e.info("Position XBX => "+m+": ("+A.x,","+A.y,") width: ",A.width," height: ",A.height),A!=null&&A.clusterNode)A.y+=g,_e.info("A tainted cluster node XBX1",m,A.id,A.width,A.height,A.x,A.y,e.parent(m)),pn.get(A.id).node=A,ree(A);else if(e.children(m).length>0){_e.info("A pure cluster node XBX1",m,A.id,A.x,A.y,A.width,A.height,e.parent(m)),A.height+=g,e.node(A.parentId);const y=(A==null?void 0:A.padding)/2||0,_=((v=A==null?void 0:A.labelBBox)==null?void 0:v.height)||0,b=_-y||0;_e.debug("OffsetY",b,"labelHeight",_,"halfPadding",y),await ZJ(l,A),pn.get(A.id).node=A}else{const y=e.node(A.parentId);A.y+=g/2,_e.info("A regular node XBX1 - using the padding",A.id,"parent",A.parentId,A.width,A.height,A.x,A.y,"offsetY",A.offsetY,"parent",y,y==null?void 0:y.offsetY,A),ree(A)}})),e.edges().forEach(function(m){const A=e.edge(m);_e.info("Edge "+m.v+" -> "+m.w+": "+JSON.stringify(A),A),A.points.forEach(b=>b.y+=g/2);const v=e.node(m.v);var y=e.node(m.w);const _=g6e(u,A,pn,r,v,y,n);h6e(A,_)}),e.nodes().forEach(function(m){const A=e.node(m);_e.info(m,A.type,A.diff),A.isGroup&&(p=A.diff)}),_e.warn("Returning from recursive render XAX",o,p),{elem:o,diff:p}},"recursiveRender"),ISr=N(async(t,e)=>{var a,s,o,l,u,h;const r=new vc({multigraph:!0,compound:!0}).setGraph({rankdir:t.direction,nodesep:((a=t.config)==null?void 0:a.nodeSpacing)||((o=(s=t.config)==null?void 0:s.flowchart)==null?void 0:o.nodeSpacing)||t.nodeSpacing,ranksep:((l=t.config)==null?void 0:l.rankSpacing)||((h=(u=t.config)==null?void 0:u.flowchart)==null?void 0:h.rankSpacing)||t.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),n=e.select("g");v6e(n,t.markers,t.type,t.diagramId),iWt(),oWt(),UYt(),TSr(),t.nodes.forEach(d=>{r.setNode(d.id,{...d}),d.parentId&&r.setParent(d.id,d.parentId)}),_e.debug("Edges:",t.edges),t.edges.forEach(d=>{if(d.start===d.end){const f=d.start,p=f+"---"+f+"---1",g=f+"---"+f+"---2",m=r.node(f);r.setNode(p,{domId:p,id:p,parentId:m.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),r.setParent(p,m.parentId),r.setNode(g,{domId:g,id:g,parentId:m.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),r.setParent(g,m.parentId);const A=structuredClone(d),v=structuredClone(d),y=structuredClone(d);A.label="",A.arrowTypeEnd="none",A.id=f+"-cyclic-special-1",v.arrowTypeStart="none",v.arrowTypeEnd="none",v.id=f+"-cyclic-special-mid",y.label="",m.isGroup&&(A.fromCluster=f,y.toCluster=f),y.id=f+"-cyclic-special-2",y.arrowTypeStart="none",r.setEdge(f,p,A,f+"-cyclic-special-0"),r.setEdge(p,g,v,f+"-cyclic-special-1"),r.setEdge(g,f,y,f+"-cyc<lic-special-2")}else r.setEdge(d.start,d.end,{...d},d.id)}),_e.warn("Graph at first:",JSON.stringify(kf(r))),RSr(r),_e.warn("Graph after XAX:",JSON.stringify(kf(r)));const i=He();await iWe(n,r,t.type,t.diagramId,void 0,i)},"render");const NSr=Object.freeze(Object.defineProperty({__proto__:null,render:ISr},Symbol.toStringTag,{value:"Module"}));function wse(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function DSr(t){if(Array.isArray(t))return t}function LSr(t){if(Array.isArray(t))return wse(t)}function $m(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function MSr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,sWe(n.key),n)}}function Gm(t,e,r){return e&&MSr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function yc(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=xse(t))||e){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data_wise/hyper-markdown",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "type": "module",
5
5
  "description": "A powerful Vue 3 Markdown editor with rich features including ECharts, D3.js, Mermaid, KaTeX, and dataset support",
6
6
  "keywords": [