modscape 1.1.5 → 1.1.7
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.
|
@@ -37,7 +37,7 @@ Error generating stack: `+p.message+`
|
|
|
37
37
|
`+t.slice(r,s),r=s+1),l=c;return u+=`
|
|
38
38
|
`,t.length-r>e&&l>r?u+=t.slice(r,l)+`
|
|
39
39
|
`+t.slice(l+1):u+=t.slice(r),u.slice(1)}function rG(t){for(var e="",n=0,i,r=0;r<t.length;n>=65536?r+=2:r++)n=Vc(t,r),i=En[n],!i&&mu(n)?(e+=t[r],n>=65536&&(e+=t[r+1])):e+=i||X$(n);return e}function sG(t,e,n){var i="",r=t.tag,s,l,c;for(s=0,l=n.length;s<l;s+=1)c=n[s],t.replacer&&(c=t.replacer.call(n,String(s),c)),(ts(t,e,c,!1,!1)||typeof c>"u"&&ts(t,e,null,!1,!1))&&(i!==""&&(i+=","+(t.condenseFlow?"":" ")),i+=t.dump);t.tag=r,t.dump="["+i+"]"}function TE(t,e,n,i){var r="",s=t.tag,l,c,u;for(l=0,c=n.length;l<c;l+=1)u=n[l],t.replacer&&(u=t.replacer.call(n,String(l),u)),(ts(t,e+1,u,!0,!0,!1,!0)||typeof u>"u"&&ts(t,e+1,null,!0,!0,!1,!0))&&((!i||r!=="")&&(r+=Iw(t,e)),t.dump&&du===t.dump.charCodeAt(0)?r+="-":r+="- ",r+=t.dump);t.tag=s,t.dump=r||"[]"}function aG(t,e,n){var i="",r=t.tag,s=Object.keys(n),l,c,u,h,d;for(l=0,c=s.length;l<c;l+=1)d="",i!==""&&(d+=", "),t.condenseFlow&&(d+='"'),u=s[l],h=n[u],t.replacer&&(h=t.replacer.call(n,u,h)),ts(t,e,u,!1,!1)&&(t.dump.length>1024&&(d+="? "),d+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),ts(t,e,h,!1,!1)&&(d+=t.dump,i+=d));t.tag=r,t.dump="{"+i+"}"}function lG(t,e,n,i){var r="",s=t.tag,l=Object.keys(n),c,u,h,d,m,g;if(t.sortKeys===!0)l.sort();else if(typeof t.sortKeys=="function")l.sort(t.sortKeys);else if(t.sortKeys)throw new Dn("sortKeys must be a boolean or a function");for(c=0,u=l.length;c<u;c+=1)g="",(!i||r!=="")&&(g+=Iw(t,e)),h=l[c],d=n[h],t.replacer&&(d=t.replacer.call(n,h,d)),ts(t,e+1,h,!0,!0,!0)&&(m=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,m&&(t.dump&&du===t.dump.charCodeAt(0)?g+="?":g+="? "),g+=t.dump,m&&(g+=Iw(t,e)),ts(t,e+1,d,!0,m)&&(t.dump&&du===t.dump.charCodeAt(0)?g+=":":g+=": ",g+=t.dump,r+=g));t.tag=s,t.dump=r||"{}"}function ME(t,e,n){var i,r,s,l,c,u;for(r=n?t.explicitTypes:t.implicitTypes,s=0,l=r.length;s<l;s+=1)if(c=r[s],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof e=="object"&&e instanceof c.instanceOf)&&(!c.predicate||c.predicate(e))){if(n?c.multi&&c.representName?t.tag=c.representName(e):t.tag=c.tag:t.tag="?",c.represent){if(u=t.styleMap[c.tag]||c.defaultStyle,f8.call(c.represent)==="[object Function]")i=c.represent(e,u);else if(h8.call(c.represent,u))i=c.represent[u](e,u);else throw new Dn("!<"+c.tag+'> tag resolver accepts not "'+u+'" style');t.dump=i}return!0}return!1}function ts(t,e,n,i,r,s,l){t.tag=null,t.dump=n,ME(t,n,!1)||ME(t,n,!0);var c=f8.call(t.dump),u=i,h;i&&(i=t.flowLevel<0||t.flowLevel>e);var d=c==="[object Object]"||c==="[object Array]",m,g;if(d&&(m=t.duplicates.indexOf(n),g=m!==-1),(t.tag!==null&&t.tag!=="?"||g||t.indent!==2&&e>0)&&(r=!1),g&&t.usedDuplicates[m])t.dump="*ref_"+m;else{if(d&&g&&!t.usedDuplicates[m]&&(t.usedDuplicates[m]=!0),c==="[object Object]")i&&Object.keys(t.dump).length!==0?(lG(t,e,t.dump,r),g&&(t.dump="&ref_"+m+t.dump)):(aG(t,e,t.dump),g&&(t.dump="&ref_"+m+" "+t.dump));else if(c==="[object Array]")i&&t.dump.length!==0?(t.noArrayIndent&&!l&&e>0?TE(t,e-1,t.dump,r):TE(t,e,t.dump,r),g&&(t.dump="&ref_"+m+t.dump)):(sG(t,e,t.dump),g&&(t.dump="&ref_"+m+" "+t.dump));else if(c==="[object String]")t.tag!=="?"&&nG(t,t.dump,e,s,u);else{if(c==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new Dn("unacceptable kind of an object to dump "+c)}t.tag!==null&&t.tag!=="?"&&(h=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?h="!"+h:h.slice(0,18)==="tag:yaml.org,2002:"?h="!!"+h.slice(18):h="!<"+h+">",t.dump=h+" "+t.dump)}return!0}function oG(t,e){var n=[],i=[],r,s;for(Hw(t,n,i),r=0,s=i.length;r<s;r+=1)e.duplicates.push(n[i[r]]);e.usedDuplicates=new Array(s)}function Hw(t,e,n){var i,r,s;if(t!==null&&typeof t=="object")if(r=e.indexOf(t),r!==-1)n.indexOf(r)===-1&&n.push(r);else if(e.push(t),Array.isArray(t))for(r=0,s=t.length;r<s;r+=1)Hw(t[r],e,n);else for(i=Object.keys(t),r=0,s=i.length;r<s;r+=1)Hw(t[i[r]],e,n)}function cG(t,e){e=e||{};var n=new K$(e);n.noRefs||oG(t,n);var i=t;return n.replacer&&(i=n.replacer.call({"":i},"",i)),ts(n,0,i,!0,!0)?n.dump+`
|
|
40
|
-
`:""}var uG=cG,fG={dump:uG};function g2(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var hG=wn,dG=qL,pG=PL,mG=$L,gG=GL,yG=h2,vG=u8.load,bG=u8.loadAll,xG=fG.dump,wG=Dn,SG={binary:KL,float:FL,map:IL,null:HL,pairs:JL,set:e8,timestamp:XL,bool:UL,int:VL,merge:WL,omap:ZL,seq:jL,str:BL},CG=g2("safeLoad","load"),kG=g2("safeLoadAll","loadAll"),AG=g2("safeDump","dump"),Uw={Type:hG,Schema:dG,FAILSAFE_SCHEMA:pG,JSON_SCHEMA:mG,CORE_SCHEMA:gG,DEFAULT_SCHEMA:yG,load:vG,loadAll:bG,dump:xG,YAMLException:wG,types:SG,safeLoad:CG,safeLoadAll:kG,safeDump:AG};function y2(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var C0,NE;function _G(){if(NE)return C0;NE=1;function t(){this.__data__=[],this.size=0}return C0=t,C0}var k0,RE;function Ro(){if(RE)return k0;RE=1;function t(e,n){return e===n||e!==e&&n!==n}return k0=t,k0}var A0,DE;function hp(){if(DE)return A0;DE=1;var t=Ro();function e(n,i){for(var r=n.length;r--;)if(t(n[r][0],i))return r;return-1}return A0=e,A0}var _0,LE;function OG(){if(LE)return _0;LE=1;var t=hp(),e=Array.prototype,n=e.splice;function i(r){var s=this.__data__,l=t(s,r);if(l<0)return!1;var c=s.length-1;return l==c?s.pop():n.call(s,l,1),--this.size,!0}return _0=i,_0}var O0,zE;function EG(){if(zE)return O0;zE=1;var t=hp();function e(n){var i=this.__data__,r=t(i,n);return r<0?void 0:i[r][1]}return O0=e,O0}var E0,qE;function TG(){if(qE)return E0;qE=1;var t=hp();function e(n){return t(this.__data__,n)>-1}return E0=e,E0}var T0,BE;function MG(){if(BE)return T0;BE=1;var t=hp();function e(n,i){var r=this.__data__,s=t(r,n);return s<0?(++this.size,r.push([n,i])):r[s][1]=i,this}return T0=e,T0}var M0,jE;function dp(){if(jE)return M0;jE=1;var t=_G(),e=OG(),n=EG(),i=TG(),r=MG();function s(l){var c=-1,u=l==null?0:l.length;for(this.clear();++c<u;){var h=l[c];this.set(h[0],h[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=n,s.prototype.has=i,s.prototype.set=r,M0=s,M0}var N0,IE;function NG(){if(IE)return N0;IE=1;var t=dp();function e(){this.__data__=new t,this.size=0}return N0=e,N0}var R0,PE;function RG(){if(PE)return R0;PE=1;function t(e){var n=this.__data__,i=n.delete(e);return this.size=n.size,i}return R0=t,R0}var D0,HE;function DG(){if(HE)return D0;HE=1;function t(e){return this.__data__.get(e)}return D0=t,D0}var L0,UE;function LG(){if(UE)return L0;UE=1;function t(e){return this.__data__.has(e)}return L0=t,L0}var z0,VE;function S8(){if(VE)return z0;VE=1;var t=typeof mh=="object"&&mh&&mh.Object===Object&&mh;return z0=t,z0}var q0,FE;function Xi(){if(FE)return q0;FE=1;var t=S8(),e=typeof self=="object"&&self&&self.Object===Object&&self,n=t||e||Function("return this")();return q0=n,q0}var B0,$E;function Do(){if($E)return B0;$E=1;var t=Xi(),e=t.Symbol;return B0=e,B0}var j0,GE;function zG(){if(GE)return j0;GE=1;var t=Do(),e=Object.prototype,n=e.hasOwnProperty,i=e.toString,r=t?t.toStringTag:void 0;function s(l){var c=n.call(l,r),u=l[r];try{l[r]=void 0;var h=!0}catch{}var d=i.call(l);return h&&(c?l[r]=u:delete l[r]),d}return j0=s,j0}var I0,YE;function qG(){if(YE)return I0;YE=1;var t=Object.prototype,e=t.toString;function n(i){return e.call(i)}return I0=n,I0}var P0,QE;function Za(){if(QE)return P0;QE=1;var t=Do(),e=zG(),n=qG(),i="[object Null]",r="[object Undefined]",s=t?t.toStringTag:void 0;function l(c){return c==null?c===void 0?r:i:s&&s in Object(c)?e(c):n(c)}return P0=l,P0}var H0,XE;function Di(){if(XE)return H0;XE=1;function t(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}return H0=t,H0}var U0,WE;function ju(){if(WE)return U0;WE=1;var t=Za(),e=Di(),n="[object AsyncFunction]",i="[object Function]",r="[object GeneratorFunction]",s="[object Proxy]";function l(c){if(!e(c))return!1;var u=t(c);return u==i||u==r||u==n||u==s}return U0=l,U0}var V0,KE;function BG(){if(KE)return V0;KE=1;var t=Xi(),e=t["__core-js_shared__"];return V0=e,V0}var F0,ZE;function jG(){if(ZE)return F0;ZE=1;var t=BG(),e=(function(){var i=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function n(i){return!!e&&e in i}return F0=n,F0}var $0,JE;function C8(){if(JE)return $0;JE=1;var t=Function.prototype,e=t.toString;function n(i){if(i!=null){try{return e.call(i)}catch{}try{return i+""}catch{}}return""}return $0=n,$0}var G0,eT;function IG(){if(eT)return G0;eT=1;var t=ju(),e=jG(),n=Di(),i=C8(),r=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,l=Function.prototype,c=Object.prototype,u=l.toString,h=c.hasOwnProperty,d=RegExp("^"+u.call(h).replace(r,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(g){if(!n(g)||e(g))return!1;var v=t(g)?d:s;return v.test(i(g))}return G0=m,G0}var Y0,tT;function PG(){if(tT)return Y0;tT=1;function t(e,n){return e?.[n]}return Y0=t,Y0}var Q0,nT;function Ja(){if(nT)return Q0;nT=1;var t=IG(),e=PG();function n(i,r){var s=e(i,r);return t(s)?s:void 0}return Q0=n,Q0}var X0,iT;function v2(){if(iT)return X0;iT=1;var t=Ja(),e=Xi(),n=t(e,"Map");return X0=n,X0}var W0,rT;function pp(){if(rT)return W0;rT=1;var t=Ja(),e=t(Object,"create");return W0=e,W0}var K0,sT;function HG(){if(sT)return K0;sT=1;var t=pp();function e(){this.__data__=t?t(null):{},this.size=0}return K0=e,K0}var Z0,aT;function UG(){if(aT)return Z0;aT=1;function t(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}return Z0=t,Z0}var J0,lT;function VG(){if(lT)return J0;lT=1;var t=pp(),e="__lodash_hash_undefined__",n=Object.prototype,i=n.hasOwnProperty;function r(s){var l=this.__data__;if(t){var c=l[s];return c===e?void 0:c}return i.call(l,s)?l[s]:void 0}return J0=r,J0}var ey,oT;function FG(){if(oT)return ey;oT=1;var t=pp(),e=Object.prototype,n=e.hasOwnProperty;function i(r){var s=this.__data__;return t?s[r]!==void 0:n.call(s,r)}return ey=i,ey}var ty,cT;function $G(){if(cT)return ty;cT=1;var t=pp(),e="__lodash_hash_undefined__";function n(i,r){var s=this.__data__;return this.size+=this.has(i)?0:1,s[i]=t&&r===void 0?e:r,this}return ty=n,ty}var ny,uT;function GG(){if(uT)return ny;uT=1;var t=HG(),e=UG(),n=VG(),i=FG(),r=$G();function s(l){var c=-1,u=l==null?0:l.length;for(this.clear();++c<u;){var h=l[c];this.set(h[0],h[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=n,s.prototype.has=i,s.prototype.set=r,ny=s,ny}var iy,fT;function YG(){if(fT)return iy;fT=1;var t=GG(),e=dp(),n=v2();function i(){this.size=0,this.__data__={hash:new t,map:new(n||e),string:new t}}return iy=i,iy}var ry,hT;function QG(){if(hT)return ry;hT=1;function t(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}return ry=t,ry}var sy,dT;function mp(){if(dT)return sy;dT=1;var t=QG();function e(n,i){var r=n.__data__;return t(i)?r[typeof i=="string"?"string":"hash"]:r.map}return sy=e,sy}var ay,pT;function XG(){if(pT)return ay;pT=1;var t=mp();function e(n){var i=t(this,n).delete(n);return this.size-=i?1:0,i}return ay=e,ay}var ly,mT;function WG(){if(mT)return ly;mT=1;var t=mp();function e(n){return t(this,n).get(n)}return ly=e,ly}var oy,gT;function KG(){if(gT)return oy;gT=1;var t=mp();function e(n){return t(this,n).has(n)}return oy=e,oy}var cy,yT;function ZG(){if(yT)return cy;yT=1;var t=mp();function e(n,i){var r=t(this,n),s=r.size;return r.set(n,i),this.size+=r.size==s?0:1,this}return cy=e,cy}var uy,vT;function b2(){if(vT)return uy;vT=1;var t=YG(),e=XG(),n=WG(),i=KG(),r=ZG();function s(l){var c=-1,u=l==null?0:l.length;for(this.clear();++c<u;){var h=l[c];this.set(h[0],h[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=n,s.prototype.has=i,s.prototype.set=r,uy=s,uy}var fy,bT;function JG(){if(bT)return fy;bT=1;var t=dp(),e=v2(),n=b2(),i=200;function r(s,l){var c=this.__data__;if(c instanceof t){var u=c.__data__;if(!e||u.length<i-1)return u.push([s,l]),this.size=++c.size,this;c=this.__data__=new n(u)}return c.set(s,l),this.size=c.size,this}return fy=r,fy}var hy,xT;function gp(){if(xT)return hy;xT=1;var t=dp(),e=NG(),n=RG(),i=DG(),r=LG(),s=JG();function l(c){var u=this.__data__=new t(c);this.size=u.size}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=i,l.prototype.has=r,l.prototype.set=s,hy=l,hy}var dy,wT;function x2(){if(wT)return dy;wT=1;function t(e,n){for(var i=-1,r=e==null?0:e.length;++i<r&&n(e[i],i,e)!==!1;);return e}return dy=t,dy}var py,ST;function k8(){if(ST)return py;ST=1;var t=Ja(),e=(function(){try{var n=t(Object,"defineProperty");return n({},"",{}),n}catch{}})();return py=e,py}var my,CT;function yp(){if(CT)return my;CT=1;var t=k8();function e(n,i,r){i=="__proto__"&&t?t(n,i,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[i]=r}return my=e,my}var gy,kT;function vp(){if(kT)return gy;kT=1;var t=yp(),e=Ro(),n=Object.prototype,i=n.hasOwnProperty;function r(s,l,c){var u=s[l];(!(i.call(s,l)&&e(u,c))||c===void 0&&!(l in s))&&t(s,l,c)}return gy=r,gy}var yy,AT;function Iu(){if(AT)return yy;AT=1;var t=vp(),e=yp();function n(i,r,s,l){var c=!s;s||(s={});for(var u=-1,h=r.length;++u<h;){var d=r[u],m=l?l(s[d],i[d],d,s,i):void 0;m===void 0&&(m=i[d]),c?e(s,d,m):t(s,d,m)}return s}return yy=n,yy}var vy,_T;function eY(){if(_T)return vy;_T=1;function t(e,n){for(var i=-1,r=Array(e);++i<e;)r[i]=n(i);return r}return vy=t,vy}var by,OT;function vr(){if(OT)return by;OT=1;function t(e){return e!=null&&typeof e=="object"}return by=t,by}var xy,ET;function tY(){if(ET)return xy;ET=1;var t=Za(),e=vr(),n="[object Arguments]";function i(r){return e(r)&&t(r)==n}return xy=i,xy}var wy,TT;function Pu(){if(TT)return wy;TT=1;var t=tY(),e=vr(),n=Object.prototype,i=n.hasOwnProperty,r=n.propertyIsEnumerable,s=t((function(){return arguments})())?t:function(l){return e(l)&&i.call(l,"callee")&&!r.call(l,"callee")};return wy=s,wy}var Sy,MT;function nn(){if(MT)return Sy;MT=1;var t=Array.isArray;return Sy=t,Sy}var Fc={exports:{}},Cy,NT;function nY(){if(NT)return Cy;NT=1;function t(){return!1}return Cy=t,Cy}Fc.exports;var RT;function Lo(){return RT||(RT=1,(function(t,e){var n=Xi(),i=nY(),r=e&&!e.nodeType&&e,s=r&&!0&&t&&!t.nodeType&&t,l=s&&s.exports===r,c=l?n.Buffer:void 0,u=c?c.isBuffer:void 0,h=u||i;t.exports=h})(Fc,Fc.exports)),Fc.exports}var ky,DT;function bp(){if(DT)return ky;DT=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function n(i,r){var s=typeof i;return r=r??t,!!r&&(s=="number"||s!="symbol"&&e.test(i))&&i>-1&&i%1==0&&i<r}return ky=n,ky}var Ay,LT;function w2(){if(LT)return Ay;LT=1;var t=9007199254740991;function e(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=t}return Ay=e,Ay}var _y,zT;function iY(){if(zT)return _y;zT=1;var t=Za(),e=w2(),n=vr(),i="[object Arguments]",r="[object Array]",s="[object Boolean]",l="[object Date]",c="[object Error]",u="[object Function]",h="[object Map]",d="[object Number]",m="[object Object]",g="[object RegExp]",v="[object Set]",x="[object String]",w="[object WeakMap]",C="[object ArrayBuffer]",k="[object DataView]",A="[object Float32Array]",O="[object Float64Array]",E="[object Int8Array]",M="[object Int16Array]",T="[object Int32Array]",N="[object Uint8Array]",I="[object Uint8ClampedArray]",q="[object Uint16Array]",H="[object Uint32Array]",B={};B[A]=B[O]=B[E]=B[M]=B[T]=B[N]=B[I]=B[q]=B[H]=!0,B[i]=B[r]=B[C]=B[s]=B[k]=B[l]=B[c]=B[u]=B[h]=B[d]=B[m]=B[g]=B[v]=B[x]=B[w]=!1;function $(V){return n(V)&&e(V.length)&&!!B[t(V)]}return _y=$,_y}var Oy,qT;function xp(){if(qT)return Oy;qT=1;function t(e){return function(n){return e(n)}}return Oy=t,Oy}var $c={exports:{}};$c.exports;var BT;function S2(){return BT||(BT=1,(function(t,e){var n=S8(),i=e&&!e.nodeType&&e,r=i&&!0&&t&&!t.nodeType&&t,s=r&&r.exports===i,l=s&&n.process,c=(function(){try{var u=r&&r.require&&r.require("util").types;return u||l&&l.binding&&l.binding("util")}catch{}})();t.exports=c})($c,$c.exports)),$c.exports}var Ey,jT;function Hu(){if(jT)return Ey;jT=1;var t=iY(),e=xp(),n=S2(),i=n&&n.isTypedArray,r=i?e(i):t;return Ey=r,Ey}var Ty,IT;function A8(){if(IT)return Ty;IT=1;var t=eY(),e=Pu(),n=nn(),i=Lo(),r=bp(),s=Hu(),l=Object.prototype,c=l.hasOwnProperty;function u(h,d){var m=n(h),g=!m&&e(h),v=!m&&!g&&i(h),x=!m&&!g&&!v&&s(h),w=m||g||v||x,C=w?t(h.length,String):[],k=C.length;for(var A in h)(d||c.call(h,A))&&!(w&&(A=="length"||v&&(A=="offset"||A=="parent")||x&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||r(A,k)))&&C.push(A);return C}return Ty=u,Ty}var My,PT;function wp(){if(PT)return My;PT=1;var t=Object.prototype;function e(n){var i=n&&n.constructor,r=typeof i=="function"&&i.prototype||t;return n===r}return My=e,My}var Ny,HT;function _8(){if(HT)return Ny;HT=1;function t(e,n){return function(i){return e(n(i))}}return Ny=t,Ny}var Ry,UT;function rY(){if(UT)return Ry;UT=1;var t=_8(),e=t(Object.keys,Object);return Ry=e,Ry}var Dy,VT;function C2(){if(VT)return Dy;VT=1;var t=wp(),e=rY(),n=Object.prototype,i=n.hasOwnProperty;function r(s){if(!t(s))return e(s);var l=[];for(var c in Object(s))i.call(s,c)&&c!="constructor"&&l.push(c);return l}return Dy=r,Dy}var Ly,FT;function as(){if(FT)return Ly;FT=1;var t=ju(),e=w2();function n(i){return i!=null&&e(i.length)&&!t(i)}return Ly=n,Ly}var zy,$T;function ia(){if($T)return zy;$T=1;var t=A8(),e=C2(),n=as();function i(r){return n(r)?t(r):e(r)}return zy=i,zy}var qy,GT;function sY(){if(GT)return qy;GT=1;var t=Iu(),e=ia();function n(i,r){return i&&t(r,e(r),i)}return qy=n,qy}var By,YT;function aY(){if(YT)return By;YT=1;function t(e){var n=[];if(e!=null)for(var i in Object(e))n.push(i);return n}return By=t,By}var jy,QT;function lY(){if(QT)return jy;QT=1;var t=Di(),e=wp(),n=aY(),i=Object.prototype,r=i.hasOwnProperty;function s(l){if(!t(l))return n(l);var c=e(l),u=[];for(var h in l)h=="constructor"&&(c||!r.call(l,h))||u.push(h);return u}return jy=s,jy}var Iy,XT;function el(){if(XT)return Iy;XT=1;var t=A8(),e=lY(),n=as();function i(r){return n(r)?t(r,!0):e(r)}return Iy=i,Iy}var Py,WT;function oY(){if(WT)return Py;WT=1;var t=Iu(),e=el();function n(i,r){return i&&t(r,e(r),i)}return Py=n,Py}var Gc={exports:{}};Gc.exports;var KT;function O8(){return KT||(KT=1,(function(t,e){var n=Xi(),i=e&&!e.nodeType&&e,r=i&&!0&&t&&!t.nodeType&&t,s=r&&r.exports===i,l=s?n.Buffer:void 0,c=l?l.allocUnsafe:void 0;function u(h,d){if(d)return h.slice();var m=h.length,g=c?c(m):new h.constructor(m);return h.copy(g),g}t.exports=u})(Gc,Gc.exports)),Gc.exports}var Hy,ZT;function E8(){if(ZT)return Hy;ZT=1;function t(e,n){var i=-1,r=e.length;for(n||(n=Array(r));++i<r;)n[i]=e[i];return n}return Hy=t,Hy}var Uy,JT;function T8(){if(JT)return Uy;JT=1;function t(e,n){for(var i=-1,r=e==null?0:e.length,s=0,l=[];++i<r;){var c=e[i];n(c,i,e)&&(l[s++]=c)}return l}return Uy=t,Uy}var Vy,eM;function M8(){if(eM)return Vy;eM=1;function t(){return[]}return Vy=t,Vy}var Fy,tM;function k2(){if(tM)return Fy;tM=1;var t=T8(),e=M8(),n=Object.prototype,i=n.propertyIsEnumerable,r=Object.getOwnPropertySymbols,s=r?function(l){return l==null?[]:(l=Object(l),t(r(l),function(c){return i.call(l,c)}))}:e;return Fy=s,Fy}var $y,nM;function cY(){if(nM)return $y;nM=1;var t=Iu(),e=k2();function n(i,r){return t(i,e(i),r)}return $y=n,$y}var Gy,iM;function A2(){if(iM)return Gy;iM=1;function t(e,n){for(var i=-1,r=n.length,s=e.length;++i<r;)e[s+i]=n[i];return e}return Gy=t,Gy}var Yy,rM;function Sp(){if(rM)return Yy;rM=1;var t=_8(),e=t(Object.getPrototypeOf,Object);return Yy=e,Yy}var Qy,sM;function N8(){if(sM)return Qy;sM=1;var t=A2(),e=Sp(),n=k2(),i=M8(),r=Object.getOwnPropertySymbols,s=r?function(l){for(var c=[];l;)t(c,n(l)),l=e(l);return c}:i;return Qy=s,Qy}var Xy,aM;function uY(){if(aM)return Xy;aM=1;var t=Iu(),e=N8();function n(i,r){return t(i,e(i),r)}return Xy=n,Xy}var Wy,lM;function R8(){if(lM)return Wy;lM=1;var t=A2(),e=nn();function n(i,r,s){var l=r(i);return e(i)?l:t(l,s(i))}return Wy=n,Wy}var Ky,oM;function D8(){if(oM)return Ky;oM=1;var t=R8(),e=k2(),n=ia();function i(r){return t(r,n,e)}return Ky=i,Ky}var Zy,cM;function fY(){if(cM)return Zy;cM=1;var t=R8(),e=N8(),n=el();function i(r){return t(r,n,e)}return Zy=i,Zy}var Jy,uM;function hY(){if(uM)return Jy;uM=1;var t=Ja(),e=Xi(),n=t(e,"DataView");return Jy=n,Jy}var ev,fM;function dY(){if(fM)return ev;fM=1;var t=Ja(),e=Xi(),n=t(e,"Promise");return ev=n,ev}var tv,hM;function L8(){if(hM)return tv;hM=1;var t=Ja(),e=Xi(),n=t(e,"Set");return tv=n,tv}var nv,dM;function pY(){if(dM)return nv;dM=1;var t=Ja(),e=Xi(),n=t(e,"WeakMap");return nv=n,nv}var iv,pM;function zo(){if(pM)return iv;pM=1;var t=hY(),e=v2(),n=dY(),i=L8(),r=pY(),s=Za(),l=C8(),c="[object Map]",u="[object Object]",h="[object Promise]",d="[object Set]",m="[object WeakMap]",g="[object DataView]",v=l(t),x=l(e),w=l(n),C=l(i),k=l(r),A=s;return(t&&A(new t(new ArrayBuffer(1)))!=g||e&&A(new e)!=c||n&&A(n.resolve())!=h||i&&A(new i)!=d||r&&A(new r)!=m)&&(A=function(O){var E=s(O),M=E==u?O.constructor:void 0,T=M?l(M):"";if(T)switch(T){case v:return g;case x:return c;case w:return h;case C:return d;case k:return m}return E}),iv=A,iv}var rv,mM;function mY(){if(mM)return rv;mM=1;var t=Object.prototype,e=t.hasOwnProperty;function n(i){var r=i.length,s=new i.constructor(r);return r&&typeof i[0]=="string"&&e.call(i,"index")&&(s.index=i.index,s.input=i.input),s}return rv=n,rv}var sv,gM;function z8(){if(gM)return sv;gM=1;var t=Xi(),e=t.Uint8Array;return sv=e,sv}var av,yM;function _2(){if(yM)return av;yM=1;var t=z8();function e(n){var i=new n.constructor(n.byteLength);return new t(i).set(new t(n)),i}return av=e,av}var lv,vM;function gY(){if(vM)return lv;vM=1;var t=_2();function e(n,i){var r=i?t(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}return lv=e,lv}var ov,bM;function yY(){if(bM)return ov;bM=1;var t=/\w*$/;function e(n){var i=new n.constructor(n.source,t.exec(n));return i.lastIndex=n.lastIndex,i}return ov=e,ov}var cv,xM;function vY(){if(xM)return cv;xM=1;var t=Do(),e=t?t.prototype:void 0,n=e?e.valueOf:void 0;function i(r){return n?Object(n.call(r)):{}}return cv=i,cv}var uv,wM;function q8(){if(wM)return uv;wM=1;var t=_2();function e(n,i){var r=i?t(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}return uv=e,uv}var fv,SM;function bY(){if(SM)return fv;SM=1;var t=_2(),e=gY(),n=yY(),i=vY(),r=q8(),s="[object Boolean]",l="[object Date]",c="[object Map]",u="[object Number]",h="[object RegExp]",d="[object Set]",m="[object String]",g="[object Symbol]",v="[object ArrayBuffer]",x="[object DataView]",w="[object Float32Array]",C="[object Float64Array]",k="[object Int8Array]",A="[object Int16Array]",O="[object Int32Array]",E="[object Uint8Array]",M="[object Uint8ClampedArray]",T="[object Uint16Array]",N="[object Uint32Array]";function I(q,H,B){var $=q.constructor;switch(H){case v:return t(q);case s:case l:return new $(+q);case x:return e(q,B);case w:case C:case k:case A:case O:case E:case M:case T:case N:return r(q,B);case c:return new $;case u:case m:return new $(q);case h:return n(q);case d:return new $;case g:return i(q)}}return fv=I,fv}var hv,CM;function B8(){if(CM)return hv;CM=1;var t=Di(),e=Object.create,n=(function(){function i(){}return function(r){if(!t(r))return{};if(e)return e(r);i.prototype=r;var s=new i;return i.prototype=void 0,s}})();return hv=n,hv}var dv,kM;function j8(){if(kM)return dv;kM=1;var t=B8(),e=Sp(),n=wp();function i(r){return typeof r.constructor=="function"&&!n(r)?t(e(r)):{}}return dv=i,dv}var pv,AM;function xY(){if(AM)return pv;AM=1;var t=zo(),e=vr(),n="[object Map]";function i(r){return e(r)&&t(r)==n}return pv=i,pv}var mv,_M;function wY(){if(_M)return mv;_M=1;var t=xY(),e=xp(),n=S2(),i=n&&n.isMap,r=i?e(i):t;return mv=r,mv}var gv,OM;function SY(){if(OM)return gv;OM=1;var t=zo(),e=vr(),n="[object Set]";function i(r){return e(r)&&t(r)==n}return gv=i,gv}var yv,EM;function CY(){if(EM)return yv;EM=1;var t=SY(),e=xp(),n=S2(),i=n&&n.isSet,r=i?e(i):t;return yv=r,yv}var vv,TM;function I8(){if(TM)return vv;TM=1;var t=gp(),e=x2(),n=vp(),i=sY(),r=oY(),s=O8(),l=E8(),c=cY(),u=uY(),h=D8(),d=fY(),m=zo(),g=mY(),v=bY(),x=j8(),w=nn(),C=Lo(),k=wY(),A=Di(),O=CY(),E=ia(),M=el(),T=1,N=2,I=4,q="[object Arguments]",H="[object Array]",B="[object Boolean]",$="[object Date]",V="[object Error]",D="[object Function]",P="[object GeneratorFunction]",L="[object Map]",Q="[object Number]",Z="[object Object]",U="[object RegExp]",re="[object Set]",z="[object String]",G="[object Symbol]",te="[object WeakMap]",j="[object ArrayBuffer]",K="[object DataView]",ee="[object Float32Array]",oe="[object Float64Array]",ge="[object Int8Array]",xe="[object Int16Array]",Me="[object Int32Array]",X="[object Uint8Array]",pe="[object Uint8ClampedArray]",Se="[object Uint16Array]",ye="[object Uint32Array]",_e={};_e[q]=_e[H]=_e[j]=_e[K]=_e[B]=_e[$]=_e[ee]=_e[oe]=_e[ge]=_e[xe]=_e[Me]=_e[L]=_e[Q]=_e[Z]=_e[U]=_e[re]=_e[z]=_e[G]=_e[X]=_e[pe]=_e[Se]=_e[ye]=!0,_e[V]=_e[D]=_e[te]=!1;function ot(Oe,ve,Fe,on,rn,jt){var ft,at=ve&T,Et=ve&N,$t=ve&I;if(Fe&&(ft=rn?Fe(Oe,on,rn,jt):Fe(Oe)),ft!==void 0)return ft;if(!A(Oe))return Oe;var Gt=w(Oe);if(Gt){if(ft=g(Oe),!at)return l(Oe,ft)}else{var wt=m(Oe),pn=wt==D||wt==P;if(C(Oe))return s(Oe,at);if(wt==Z||wt==q||pn&&!rn){if(ft=Et||pn?{}:x(Oe),!at)return Et?u(Oe,r(ft,Oe)):c(Oe,i(ft,Oe))}else{if(!_e[wt])return rn?Oe:{};ft=v(Oe,wt,at)}}jt||(jt=new t);var ni=jt.get(Oe);if(ni)return ni;jt.set(Oe,ft),O(Oe)?Oe.forEach(function(me){ft.add(ot(me,ve,Fe,me,Oe,jt))}):k(Oe)&&Oe.forEach(function(me,Re){ft.set(Re,ot(me,ve,Fe,Re,Oe,jt))});var Mt=$t?Et?d:h:Et?M:E,Ae=Gt?void 0:Mt(Oe);return e(Ae||Oe,function(me,Re){Ae&&(Re=me,me=Oe[Re]),n(ft,Re,ot(me,ve,Fe,Re,Oe,jt))}),ft}return vv=ot,vv}var bv,MM;function kY(){if(MM)return bv;MM=1;var t=I8(),e=4;function n(i){return t(i,e)}return bv=n,bv}var xv,NM;function O2(){if(NM)return xv;NM=1;function t(e){return function(){return e}}return xv=t,xv}var wv,RM;function AY(){if(RM)return wv;RM=1;function t(e){return function(n,i,r){for(var s=-1,l=Object(n),c=r(n),u=c.length;u--;){var h=c[e?u:++s];if(i(l[h],h,l)===!1)break}return n}}return wv=t,wv}var Sv,DM;function E2(){if(DM)return Sv;DM=1;var t=AY(),e=t();return Sv=e,Sv}var Cv,LM;function T2(){if(LM)return Cv;LM=1;var t=E2(),e=ia();function n(i,r){return i&&t(i,r,e)}return Cv=n,Cv}var kv,zM;function _Y(){if(zM)return kv;zM=1;var t=as();function e(n,i){return function(r,s){if(r==null)return r;if(!t(r))return n(r,s);for(var l=r.length,c=i?l:-1,u=Object(r);(i?c--:++c<l)&&s(u[c],c,u)!==!1;);return r}}return kv=e,kv}var Av,qM;function Cp(){if(qM)return Av;qM=1;var t=T2(),e=_Y(),n=e(t);return Av=n,Av}var _v,BM;function tl(){if(BM)return _v;BM=1;function t(e){return e}return _v=t,_v}var Ov,jM;function P8(){if(jM)return Ov;jM=1;var t=tl();function e(n){return typeof n=="function"?n:t}return Ov=e,Ov}var Ev,IM;function H8(){if(IM)return Ev;IM=1;var t=x2(),e=Cp(),n=P8(),i=nn();function r(s,l){var c=i(s)?t:e;return c(s,n(l))}return Ev=r,Ev}var Tv,PM;function U8(){return PM||(PM=1,Tv=H8()),Tv}var Mv,HM;function OY(){if(HM)return Mv;HM=1;var t=Cp();function e(n,i){var r=[];return t(n,function(s,l,c){i(s,l,c)&&r.push(s)}),r}return Mv=e,Mv}var Nv,UM;function EY(){if(UM)return Nv;UM=1;var t="__lodash_hash_undefined__";function e(n){return this.__data__.set(n,t),this}return Nv=e,Nv}var Rv,VM;function TY(){if(VM)return Rv;VM=1;function t(e){return this.__data__.has(e)}return Rv=t,Rv}var Dv,FM;function V8(){if(FM)return Dv;FM=1;var t=b2(),e=EY(),n=TY();function i(r){var s=-1,l=r==null?0:r.length;for(this.__data__=new t;++s<l;)this.add(r[s])}return i.prototype.add=i.prototype.push=e,i.prototype.has=n,Dv=i,Dv}var Lv,$M;function MY(){if($M)return Lv;$M=1;function t(e,n){for(var i=-1,r=e==null?0:e.length;++i<r;)if(n(e[i],i,e))return!0;return!1}return Lv=t,Lv}var zv,GM;function F8(){if(GM)return zv;GM=1;function t(e,n){return e.has(n)}return zv=t,zv}var qv,YM;function $8(){if(YM)return qv;YM=1;var t=V8(),e=MY(),n=F8(),i=1,r=2;function s(l,c,u,h,d,m){var g=u&i,v=l.length,x=c.length;if(v!=x&&!(g&&x>v))return!1;var w=m.get(l),C=m.get(c);if(w&&C)return w==c&&C==l;var k=-1,A=!0,O=u&r?new t:void 0;for(m.set(l,c),m.set(c,l);++k<v;){var E=l[k],M=c[k];if(h)var T=g?h(M,E,k,c,l,m):h(E,M,k,l,c,m);if(T!==void 0){if(T)continue;A=!1;break}if(O){if(!e(c,function(N,I){if(!n(O,I)&&(E===N||d(E,N,u,h,m)))return O.push(I)})){A=!1;break}}else if(!(E===M||d(E,M,u,h,m))){A=!1;break}}return m.delete(l),m.delete(c),A}return qv=s,qv}var Bv,QM;function NY(){if(QM)return Bv;QM=1;function t(e){var n=-1,i=Array(e.size);return e.forEach(function(r,s){i[++n]=[s,r]}),i}return Bv=t,Bv}var jv,XM;function M2(){if(XM)return jv;XM=1;function t(e){var n=-1,i=Array(e.size);return e.forEach(function(r){i[++n]=r}),i}return jv=t,jv}var Iv,WM;function RY(){if(WM)return Iv;WM=1;var t=Do(),e=z8(),n=Ro(),i=$8(),r=NY(),s=M2(),l=1,c=2,u="[object Boolean]",h="[object Date]",d="[object Error]",m="[object Map]",g="[object Number]",v="[object RegExp]",x="[object Set]",w="[object String]",C="[object Symbol]",k="[object ArrayBuffer]",A="[object DataView]",O=t?t.prototype:void 0,E=O?O.valueOf:void 0;function M(T,N,I,q,H,B,$){switch(I){case A:if(T.byteLength!=N.byteLength||T.byteOffset!=N.byteOffset)return!1;T=T.buffer,N=N.buffer;case k:return!(T.byteLength!=N.byteLength||!B(new e(T),new e(N)));case u:case h:case g:return n(+T,+N);case d:return T.name==N.name&&T.message==N.message;case v:case w:return T==N+"";case m:var V=r;case x:var D=q&l;if(V||(V=s),T.size!=N.size&&!D)return!1;var P=$.get(T);if(P)return P==N;q|=c,$.set(T,N);var L=i(V(T),V(N),q,H,B,$);return $.delete(T),L;case C:if(E)return E.call(T)==E.call(N)}return!1}return Iv=M,Iv}var Pv,KM;function DY(){if(KM)return Pv;KM=1;var t=D8(),e=1,n=Object.prototype,i=n.hasOwnProperty;function r(s,l,c,u,h,d){var m=c&e,g=t(s),v=g.length,x=t(l),w=x.length;if(v!=w&&!m)return!1;for(var C=v;C--;){var k=g[C];if(!(m?k in l:i.call(l,k)))return!1}var A=d.get(s),O=d.get(l);if(A&&O)return A==l&&O==s;var E=!0;d.set(s,l),d.set(l,s);for(var M=m;++C<v;){k=g[C];var T=s[k],N=l[k];if(u)var I=m?u(N,T,k,l,s,d):u(T,N,k,s,l,d);if(!(I===void 0?T===N||h(T,N,c,u,d):I)){E=!1;break}M||(M=k=="constructor")}if(E&&!M){var q=s.constructor,H=l.constructor;q!=H&&"constructor"in s&&"constructor"in l&&!(typeof q=="function"&&q instanceof q&&typeof H=="function"&&H instanceof H)&&(E=!1)}return d.delete(s),d.delete(l),E}return Pv=r,Pv}var Hv,ZM;function LY(){if(ZM)return Hv;ZM=1;var t=gp(),e=$8(),n=RY(),i=DY(),r=zo(),s=nn(),l=Lo(),c=Hu(),u=1,h="[object Arguments]",d="[object Array]",m="[object Object]",g=Object.prototype,v=g.hasOwnProperty;function x(w,C,k,A,O,E){var M=s(w),T=s(C),N=M?d:r(w),I=T?d:r(C);N=N==h?m:N,I=I==h?m:I;var q=N==m,H=I==m,B=N==I;if(B&&l(w)){if(!l(C))return!1;M=!0,q=!1}if(B&&!q)return E||(E=new t),M||c(w)?e(w,C,k,A,O,E):n(w,C,N,k,A,O,E);if(!(k&u)){var $=q&&v.call(w,"__wrapped__"),V=H&&v.call(C,"__wrapped__");if($||V){var D=$?w.value():w,P=V?C.value():C;return E||(E=new t),O(D,P,k,A,E)}}return B?(E||(E=new t),i(w,C,k,A,O,E)):!1}return Hv=x,Hv}var Uv,JM;function G8(){if(JM)return Uv;JM=1;var t=LY(),e=vr();function n(i,r,s,l,c){return i===r?!0:i==null||r==null||!e(i)&&!e(r)?i!==i&&r!==r:t(i,r,s,l,n,c)}return Uv=n,Uv}var Vv,eN;function zY(){if(eN)return Vv;eN=1;var t=gp(),e=G8(),n=1,i=2;function r(s,l,c,u){var h=c.length,d=h,m=!u;if(s==null)return!d;for(s=Object(s);h--;){var g=c[h];if(m&&g[2]?g[1]!==s[g[0]]:!(g[0]in s))return!1}for(;++h<d;){g=c[h];var v=g[0],x=s[v],w=g[1];if(m&&g[2]){if(x===void 0&&!(v in s))return!1}else{var C=new t;if(u)var k=u(x,w,v,s,l,C);if(!(k===void 0?e(w,x,n|i,u,C):k))return!1}}return!0}return Vv=r,Vv}var Fv,tN;function Y8(){if(tN)return Fv;tN=1;var t=Di();function e(n){return n===n&&!t(n)}return Fv=e,Fv}var $v,nN;function qY(){if(nN)return $v;nN=1;var t=Y8(),e=ia();function n(i){for(var r=e(i),s=r.length;s--;){var l=r[s],c=i[l];r[s]=[l,c,t(c)]}return r}return $v=n,$v}var Gv,iN;function Q8(){if(iN)return Gv;iN=1;function t(e,n){return function(i){return i==null?!1:i[e]===n&&(n!==void 0||e in Object(i))}}return Gv=t,Gv}var Yv,rN;function BY(){if(rN)return Yv;rN=1;var t=zY(),e=qY(),n=Q8();function i(r){var s=e(r);return s.length==1&&s[0][2]?n(s[0][0],s[0][1]):function(l){return l===r||t(l,r,s)}}return Yv=i,Yv}var Qv,sN;function qo(){if(sN)return Qv;sN=1;var t=Za(),e=vr(),n="[object Symbol]";function i(r){return typeof r=="symbol"||e(r)&&t(r)==n}return Qv=i,Qv}var Xv,aN;function N2(){if(aN)return Xv;aN=1;var t=nn(),e=qo(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;function r(s,l){if(t(s))return!1;var c=typeof s;return c=="number"||c=="symbol"||c=="boolean"||s==null||e(s)?!0:i.test(s)||!n.test(s)||l!=null&&s in Object(l)}return Xv=r,Xv}var Wv,lN;function jY(){if(lN)return Wv;lN=1;var t=b2(),e="Expected a function";function n(i,r){if(typeof i!="function"||r!=null&&typeof r!="function")throw new TypeError(e);var s=function(){var l=arguments,c=r?r.apply(this,l):l[0],u=s.cache;if(u.has(c))return u.get(c);var h=i.apply(this,l);return s.cache=u.set(c,h)||u,h};return s.cache=new(n.Cache||t),s}return n.Cache=t,Wv=n,Wv}var Kv,oN;function IY(){if(oN)return Kv;oN=1;var t=jY(),e=500;function n(i){var r=t(i,function(l){return s.size===e&&s.clear(),l}),s=r.cache;return r}return Kv=n,Kv}var Zv,cN;function PY(){if(cN)return Zv;cN=1;var t=IY(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,i=t(function(r){var s=[];return r.charCodeAt(0)===46&&s.push(""),r.replace(e,function(l,c,u,h){s.push(u?h.replace(n,"$1"):c||l)}),s});return Zv=i,Zv}var Jv,uN;function kp(){if(uN)return Jv;uN=1;function t(e,n){for(var i=-1,r=e==null?0:e.length,s=Array(r);++i<r;)s[i]=n(e[i],i,e);return s}return Jv=t,Jv}var eb,fN;function HY(){if(fN)return eb;fN=1;var t=Do(),e=kp(),n=nn(),i=qo(),r=t?t.prototype:void 0,s=r?r.toString:void 0;function l(c){if(typeof c=="string")return c;if(n(c))return e(c,l)+"";if(i(c))return s?s.call(c):"";var u=c+"";return u=="0"&&1/c==-1/0?"-0":u}return eb=l,eb}var tb,hN;function X8(){if(hN)return tb;hN=1;var t=HY();function e(n){return n==null?"":t(n)}return tb=e,tb}var nb,dN;function Ap(){if(dN)return nb;dN=1;var t=nn(),e=N2(),n=PY(),i=X8();function r(s,l){return t(s)?s:e(s,l)?[s]:n(i(s))}return nb=r,nb}var ib,pN;function Uu(){if(pN)return ib;pN=1;var t=qo();function e(n){if(typeof n=="string"||t(n))return n;var i=n+"";return i=="0"&&1/n==-1/0?"-0":i}return ib=e,ib}var rb,mN;function _p(){if(mN)return rb;mN=1;var t=Ap(),e=Uu();function n(i,r){r=t(r,i);for(var s=0,l=r.length;i!=null&&s<l;)i=i[e(r[s++])];return s&&s==l?i:void 0}return rb=n,rb}var sb,gN;function UY(){if(gN)return sb;gN=1;var t=_p();function e(n,i,r){var s=n==null?void 0:t(n,i);return s===void 0?r:s}return sb=e,sb}var ab,yN;function VY(){if(yN)return ab;yN=1;function t(e,n){return e!=null&&n in Object(e)}return ab=t,ab}var lb,vN;function W8(){if(vN)return lb;vN=1;var t=Ap(),e=Pu(),n=nn(),i=bp(),r=w2(),s=Uu();function l(c,u,h){u=t(u,c);for(var d=-1,m=u.length,g=!1;++d<m;){var v=s(u[d]);if(!(g=c!=null&&h(c,v)))break;c=c[v]}return g||++d!=m?g:(m=c==null?0:c.length,!!m&&r(m)&&i(v,m)&&(n(c)||e(c)))}return lb=l,lb}var ob,bN;function K8(){if(bN)return ob;bN=1;var t=VY(),e=W8();function n(i,r){return i!=null&&e(i,r,t)}return ob=n,ob}var cb,xN;function FY(){if(xN)return cb;xN=1;var t=G8(),e=UY(),n=K8(),i=N2(),r=Y8(),s=Q8(),l=Uu(),c=1,u=2;function h(d,m){return i(d)&&r(m)?s(l(d),m):function(g){var v=e(g,d);return v===void 0&&v===m?n(g,d):t(m,v,c|u)}}return cb=h,cb}var ub,wN;function Z8(){if(wN)return ub;wN=1;function t(e){return function(n){return n?.[e]}}return ub=t,ub}var fb,SN;function $Y(){if(SN)return fb;SN=1;var t=_p();function e(n){return function(i){return t(i,n)}}return fb=e,fb}var hb,CN;function GY(){if(CN)return hb;CN=1;var t=Z8(),e=$Y(),n=N2(),i=Uu();function r(s){return n(s)?t(i(s)):e(s)}return hb=r,hb}var db,kN;function ls(){if(kN)return db;kN=1;var t=BY(),e=FY(),n=tl(),i=nn(),r=GY();function s(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?i(l)?e(l[0],l[1]):t(l):r(l)}return db=s,db}var pb,AN;function J8(){if(AN)return pb;AN=1;var t=T8(),e=OY(),n=ls(),i=nn();function r(s,l){var c=i(s)?t:e;return c(s,n(l,3))}return pb=r,pb}var mb,_N;function YY(){if(_N)return mb;_N=1;var t=Object.prototype,e=t.hasOwnProperty;function n(i,r){return i!=null&&e.call(i,r)}return mb=n,mb}var gb,ON;function ez(){if(ON)return gb;ON=1;var t=YY(),e=W8();function n(i,r){return i!=null&&e(i,r,t)}return gb=n,gb}var yb,EN;function QY(){if(EN)return yb;EN=1;var t=C2(),e=zo(),n=Pu(),i=nn(),r=as(),s=Lo(),l=wp(),c=Hu(),u="[object Map]",h="[object Set]",d=Object.prototype,m=d.hasOwnProperty;function g(v){if(v==null)return!0;if(r(v)&&(i(v)||typeof v=="string"||typeof v.splice=="function"||s(v)||c(v)||n(v)))return!v.length;var x=e(v);if(x==u||x==h)return!v.size;if(l(v))return!t(v).length;for(var w in v)if(m.call(v,w))return!1;return!0}return yb=g,yb}var vb,TN;function tz(){if(TN)return vb;TN=1;function t(e){return e===void 0}return vb=t,vb}var bb,MN;function nz(){if(MN)return bb;MN=1;var t=Cp(),e=as();function n(i,r){var s=-1,l=e(i)?Array(i.length):[];return t(i,function(c,u,h){l[++s]=r(c,u,h)}),l}return bb=n,bb}var xb,NN;function iz(){if(NN)return xb;NN=1;var t=kp(),e=ls(),n=nz(),i=nn();function r(s,l){var c=i(s)?t:n;return c(s,e(l,3))}return xb=r,xb}var wb,RN;function XY(){if(RN)return wb;RN=1;function t(e,n,i,r){var s=-1,l=e==null?0:e.length;for(r&&l&&(i=e[++s]);++s<l;)i=n(i,e[s],s,e);return i}return wb=t,wb}var Sb,DN;function WY(){if(DN)return Sb;DN=1;function t(e,n,i,r,s){return s(e,function(l,c,u){i=r?(r=!1,l):n(i,l,c,u)}),i}return Sb=t,Sb}var Cb,LN;function rz(){if(LN)return Cb;LN=1;var t=XY(),e=Cp(),n=ls(),i=WY(),r=nn();function s(l,c,u){var h=r(l)?t:i,d=arguments.length<3;return h(l,n(c,4),u,d,e)}return Cb=s,Cb}var kb,zN;function KY(){if(zN)return kb;zN=1;var t=Za(),e=nn(),n=vr(),i="[object String]";function r(s){return typeof s=="string"||!e(s)&&n(s)&&t(s)==i}return kb=r,kb}var Ab,qN;function ZY(){if(qN)return Ab;qN=1;var t=Z8(),e=t("length");return Ab=e,Ab}var _b,BN;function JY(){if(BN)return _b;BN=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",r=e+n+i,s="\\ufe0e\\ufe0f",l="\\u200d",c=RegExp("["+l+t+r+s+"]");function u(h){return c.test(h)}return _b=u,_b}var Ob,jN;function eQ(){if(jN)return Ob;jN=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",r=e+n+i,s="\\ufe0e\\ufe0f",l="["+t+"]",c="["+r+"]",u="\\ud83c[\\udffb-\\udfff]",h="(?:"+c+"|"+u+")",d="[^"+t+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",x=h+"?",w="["+s+"]?",C="(?:"+v+"(?:"+[d,m,g].join("|")+")"+w+x+")*",k=w+x+C,A="(?:"+[d+c+"?",c,m,g,l].join("|")+")",O=RegExp(u+"(?="+u+")|"+A+k,"g");function E(M){for(var T=O.lastIndex=0;O.test(M);)++T;return T}return Ob=E,Ob}var Eb,IN;function tQ(){if(IN)return Eb;IN=1;var t=ZY(),e=JY(),n=eQ();function i(r){return e(r)?n(r):t(r)}return Eb=i,Eb}var Tb,PN;function nQ(){if(PN)return Tb;PN=1;var t=C2(),e=zo(),n=as(),i=KY(),r=tQ(),s="[object Map]",l="[object Set]";function c(u){if(u==null)return 0;if(n(u))return i(u)?r(u):u.length;var h=e(u);return h==s||h==l?u.size:t(u).length}return Tb=c,Tb}var Mb,HN;function iQ(){if(HN)return Mb;HN=1;var t=x2(),e=B8(),n=T2(),i=ls(),r=Sp(),s=nn(),l=Lo(),c=ju(),u=Di(),h=Hu();function d(m,g,v){var x=s(m),w=x||l(m)||h(m);if(g=i(g,4),v==null){var C=m&&m.constructor;w?v=x?new C:[]:u(m)?v=c(C)?e(r(m)):{}:v={}}return(w?t:n)(m,function(k,A,O){return g(v,k,A,O)}),v}return Mb=d,Mb}var Nb,UN;function rQ(){if(UN)return Nb;UN=1;var t=Do(),e=Pu(),n=nn(),i=t?t.isConcatSpreadable:void 0;function r(s){return n(s)||e(s)||!!(i&&s&&s[i])}return Nb=r,Nb}var Rb,VN;function R2(){if(VN)return Rb;VN=1;var t=A2(),e=rQ();function n(i,r,s,l,c){var u=-1,h=i.length;for(s||(s=e),c||(c=[]);++u<h;){var d=i[u];r>0&&s(d)?r>1?n(d,r-1,s,l,c):t(c,d):l||(c[c.length]=d)}return c}return Rb=n,Rb}var Db,FN;function sQ(){if(FN)return Db;FN=1;function t(e,n,i){switch(i.length){case 0:return e.call(n);case 1:return e.call(n,i[0]);case 2:return e.call(n,i[0],i[1]);case 3:return e.call(n,i[0],i[1],i[2])}return e.apply(n,i)}return Db=t,Db}var Lb,$N;function sz(){if($N)return Lb;$N=1;var t=sQ(),e=Math.max;function n(i,r,s){return r=e(r===void 0?i.length-1:r,0),function(){for(var l=arguments,c=-1,u=e(l.length-r,0),h=Array(u);++c<u;)h[c]=l[r+c];c=-1;for(var d=Array(r+1);++c<r;)d[c]=l[c];return d[r]=s(h),t(i,this,d)}}return Lb=n,Lb}var zb,GN;function aQ(){if(GN)return zb;GN=1;var t=O2(),e=k8(),n=tl(),i=e?function(r,s){return e(r,"toString",{configurable:!0,enumerable:!1,value:t(s),writable:!0})}:n;return zb=i,zb}var qb,YN;function lQ(){if(YN)return qb;YN=1;var t=800,e=16,n=Date.now;function i(r){var s=0,l=0;return function(){var c=n(),u=e-(c-l);if(l=c,u>0){if(++s>=t)return arguments[0]}else s=0;return r.apply(void 0,arguments)}}return qb=i,qb}var Bb,QN;function az(){if(QN)return Bb;QN=1;var t=aQ(),e=lQ(),n=e(t);return Bb=n,Bb}var jb,XN;function Op(){if(XN)return jb;XN=1;var t=tl(),e=sz(),n=az();function i(r,s){return n(e(r,s,t),r+"")}return jb=i,jb}var Ib,WN;function lz(){if(WN)return Ib;WN=1;function t(e,n,i,r){for(var s=e.length,l=i+(r?1:-1);r?l--:++l<s;)if(n(e[l],l,e))return l;return-1}return Ib=t,Ib}var Pb,KN;function oQ(){if(KN)return Pb;KN=1;function t(e){return e!==e}return Pb=t,Pb}var Hb,ZN;function cQ(){if(ZN)return Hb;ZN=1;function t(e,n,i){for(var r=i-1,s=e.length;++r<s;)if(e[r]===n)return r;return-1}return Hb=t,Hb}var Ub,JN;function uQ(){if(JN)return Ub;JN=1;var t=lz(),e=oQ(),n=cQ();function i(r,s,l){return s===s?n(r,s,l):t(r,e,l)}return Ub=i,Ub}var Vb,eR;function fQ(){if(eR)return Vb;eR=1;var t=uQ();function e(n,i){var r=n==null?0:n.length;return!!r&&t(n,i,0)>-1}return Vb=e,Vb}var Fb,tR;function hQ(){if(tR)return Fb;tR=1;function t(e,n,i){for(var r=-1,s=e==null?0:e.length;++r<s;)if(i(n,e[r]))return!0;return!1}return Fb=t,Fb}var $b,nR;function dQ(){if(nR)return $b;nR=1;function t(){}return $b=t,$b}var Gb,iR;function pQ(){if(iR)return Gb;iR=1;var t=L8(),e=dQ(),n=M2(),i=1/0,r=t&&1/n(new t([,-0]))[1]==i?function(s){return new t(s)}:e;return Gb=r,Gb}var Yb,rR;function mQ(){if(rR)return Yb;rR=1;var t=V8(),e=fQ(),n=hQ(),i=F8(),r=pQ(),s=M2(),l=200;function c(u,h,d){var m=-1,g=e,v=u.length,x=!0,w=[],C=w;if(d)x=!1,g=n;else if(v>=l){var k=h?null:r(u);if(k)return s(k);x=!1,g=i,C=new t}else C=h?[]:w;e:for(;++m<v;){var A=u[m],O=h?h(A):A;if(A=d||A!==0?A:0,x&&O===O){for(var E=C.length;E--;)if(C[E]===O)continue e;h&&C.push(O),w.push(A)}else g(C,O,d)||(C!==w&&C.push(O),w.push(A))}return w}return Yb=c,Yb}var Qb,sR;function oz(){if(sR)return Qb;sR=1;var t=as(),e=vr();function n(i){return e(i)&&t(i)}return Qb=n,Qb}var Xb,aR;function gQ(){if(aR)return Xb;aR=1;var t=R2(),e=Op(),n=mQ(),i=oz(),r=e(function(s){return n(t(s,1,i,!0))});return Xb=r,Xb}var Wb,lR;function yQ(){if(lR)return Wb;lR=1;var t=kp();function e(n,i){return t(i,function(r){return n[r]})}return Wb=e,Wb}var Kb,oR;function cz(){if(oR)return Kb;oR=1;var t=yQ(),e=ia();function n(i){return i==null?[]:t(i,e(i))}return Kb=n,Kb}var Zb,cR;function Li(){if(cR)return Zb;cR=1;var t;if(typeof y2=="function")try{t={clone:kY(),constant:O2(),each:U8(),filter:J8(),has:ez(),isArray:nn(),isEmpty:QY(),isFunction:ju(),isUndefined:tz(),keys:ia(),map:iz(),reduce:rz(),size:nQ(),transform:iQ(),union:gQ(),values:cz()}}catch{}return t||(t=window._),Zb=t,Zb}var Jb,uR;function D2(){if(uR)return Jb;uR=1;var t=Li();Jb=r;var e="\0",n="\0",i="";function r(d){this._isDirected=t.has(d,"directed")?d.directed:!0,this._isMultigraph=t.has(d,"multigraph")?d.multigraph:!1,this._isCompound=t.has(d,"compound")?d.compound:!1,this._label=void 0,this._defaultNodeLabelFn=t.constant(void 0),this._defaultEdgeLabelFn=t.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}r.prototype._nodeCount=0,r.prototype._edgeCount=0,r.prototype.isDirected=function(){return this._isDirected},r.prototype.isMultigraph=function(){return this._isMultigraph},r.prototype.isCompound=function(){return this._isCompound},r.prototype.setGraph=function(d){return this._label=d,this},r.prototype.graph=function(){return this._label},r.prototype.setDefaultNodeLabel=function(d){return t.isFunction(d)||(d=t.constant(d)),this._defaultNodeLabelFn=d,this},r.prototype.nodeCount=function(){return this._nodeCount},r.prototype.nodes=function(){return t.keys(this._nodes)},r.prototype.sources=function(){var d=this;return t.filter(this.nodes(),function(m){return t.isEmpty(d._in[m])})},r.prototype.sinks=function(){var d=this;return t.filter(this.nodes(),function(m){return t.isEmpty(d._out[m])})},r.prototype.setNodes=function(d,m){var g=arguments,v=this;return t.each(d,function(x){g.length>1?v.setNode(x,m):v.setNode(x)}),this},r.prototype.setNode=function(d,m){return t.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=m),this):(this._nodes[d]=arguments.length>1?m:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=n,this._children[d]={},this._children[n][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},r.prototype.node=function(d){return this._nodes[d]},r.prototype.hasNode=function(d){return t.has(this._nodes,d)},r.prototype.removeNode=function(d){var m=this;if(t.has(this._nodes,d)){var g=function(v){m.removeEdge(m._edgeObjs[v])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],t.each(this.children(d),function(v){m.setParent(v)}),delete this._children[d]),t.each(t.keys(this._in[d]),g),delete this._in[d],delete this._preds[d],t.each(t.keys(this._out[d]),g),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},r.prototype.setParent=function(d,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(m))m=n;else{m+="";for(var g=m;!t.isUndefined(g);g=this.parent(g))if(g===d)throw new Error("Setting "+m+" as parent of "+d+" would create a cycle");this.setNode(m)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=m,this._children[m][d]=!0,this},r.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},r.prototype.parent=function(d){if(this._isCompound){var m=this._parent[d];if(m!==n)return m}},r.prototype.children=function(d){if(t.isUndefined(d)&&(d=n),this._isCompound){var m=this._children[d];if(m)return t.keys(m)}else{if(d===n)return this.nodes();if(this.hasNode(d))return[]}},r.prototype.predecessors=function(d){var m=this._preds[d];if(m)return t.keys(m)},r.prototype.successors=function(d){var m=this._sucs[d];if(m)return t.keys(m)},r.prototype.neighbors=function(d){var m=this.predecessors(d);if(m)return t.union(m,this.successors(d))},r.prototype.isLeaf=function(d){var m;return this.isDirected()?m=this.successors(d):m=this.neighbors(d),m.length===0},r.prototype.filterNodes=function(d){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var g=this;t.each(this._nodes,function(w,C){d(C)&&m.setNode(C,w)}),t.each(this._edgeObjs,function(w){m.hasNode(w.v)&&m.hasNode(w.w)&&m.setEdge(w,g.edge(w))});var v={};function x(w){var C=g.parent(w);return C===void 0||m.hasNode(C)?(v[w]=C,C):C in v?v[C]:x(C)}return this._isCompound&&t.each(m.nodes(),function(w){m.setParent(w,x(w))}),m},r.prototype.setDefaultEdgeLabel=function(d){return t.isFunction(d)||(d=t.constant(d)),this._defaultEdgeLabelFn=d,this},r.prototype.edgeCount=function(){return this._edgeCount},r.prototype.edges=function(){return t.values(this._edgeObjs)},r.prototype.setPath=function(d,m){var g=this,v=arguments;return t.reduce(d,function(x,w){return v.length>1?g.setEdge(x,w,m):g.setEdge(x,w),w}),this},r.prototype.setEdge=function(){var d,m,g,v,x=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(d=w.v,m=w.w,g=w.name,arguments.length===2&&(v=arguments[1],x=!0)):(d=w,m=arguments[1],g=arguments[3],arguments.length>2&&(v=arguments[2],x=!0)),d=""+d,m=""+m,t.isUndefined(g)||(g=""+g);var C=c(this._isDirected,d,m,g);if(t.has(this._edgeLabels,C))return x&&(this._edgeLabels[C]=v),this;if(!t.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(m),this._edgeLabels[C]=x?v:this._defaultEdgeLabelFn(d,m,g);var k=u(this._isDirected,d,m,g);return d=k.v,m=k.w,Object.freeze(k),this._edgeObjs[C]=k,s(this._preds[m],d),s(this._sucs[d],m),this._in[m][C]=k,this._out[d][C]=k,this._edgeCount++,this},r.prototype.edge=function(d,m,g){var v=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,d,m,g);return this._edgeLabels[v]},r.prototype.hasEdge=function(d,m,g){var v=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,d,m,g);return t.has(this._edgeLabels,v)},r.prototype.removeEdge=function(d,m,g){var v=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,d,m,g),x=this._edgeObjs[v];return x&&(d=x.v,m=x.w,delete this._edgeLabels[v],delete this._edgeObjs[v],l(this._preds[m],d),l(this._sucs[d],m),delete this._in[m][v],delete this._out[d][v],this._edgeCount--),this},r.prototype.inEdges=function(d,m){var g=this._in[d];if(g){var v=t.values(g);return m?t.filter(v,function(x){return x.v===m}):v}},r.prototype.outEdges=function(d,m){var g=this._out[d];if(g){var v=t.values(g);return m?t.filter(v,function(x){return x.w===m}):v}},r.prototype.nodeEdges=function(d,m){var g=this.inEdges(d,m);if(g)return g.concat(this.outEdges(d,m))};function s(d,m){d[m]?d[m]++:d[m]=1}function l(d,m){--d[m]||delete d[m]}function c(d,m,g,v){var x=""+m,w=""+g;if(!d&&x>w){var C=x;x=w,w=C}return x+i+w+i+(t.isUndefined(v)?e:v)}function u(d,m,g,v){var x=""+m,w=""+g;if(!d&&x>w){var C=x;x=w,w=C}var k={v:x,w};return v&&(k.name=v),k}function h(d,m){return c(d,m.v,m.w,m.name)}return Jb}var ex,fR;function vQ(){return fR||(fR=1,ex="2.1.8"),ex}var tx,hR;function bQ(){return hR||(hR=1,tx={Graph:D2(),version:vQ()}),tx}var nx,dR;function xQ(){if(dR)return nx;dR=1;var t=Li(),e=D2();nx={write:n,read:s};function n(l){var c={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:i(l),edges:r(l)};return t.isUndefined(l.graph())||(c.value=t.clone(l.graph())),c}function i(l){return t.map(l.nodes(),function(c){var u=l.node(c),h=l.parent(c),d={v:c};return t.isUndefined(u)||(d.value=u),t.isUndefined(h)||(d.parent=h),d})}function r(l){return t.map(l.edges(),function(c){var u=l.edge(c),h={v:c.v,w:c.w};return t.isUndefined(c.name)||(h.name=c.name),t.isUndefined(u)||(h.value=u),h})}function s(l){var c=new e(l.options).setGraph(l.value);return t.each(l.nodes,function(u){c.setNode(u.v,u.value),u.parent&&c.setParent(u.v,u.parent)}),t.each(l.edges,function(u){c.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),c}return nx}var ix,pR;function wQ(){if(pR)return ix;pR=1;var t=Li();ix=e;function e(n){var i={},r=[],s;function l(c){t.has(i,c)||(i[c]=!0,s.push(c),t.each(n.successors(c),l),t.each(n.predecessors(c),l))}return t.each(n.nodes(),function(c){s=[],l(c),s.length&&r.push(s)}),r}return ix}var rx,mR;function uz(){if(mR)return rx;mR=1;var t=Li();rx=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(n){return n.key})},e.prototype.has=function(n){return t.has(this._keyIndices,n)},e.prototype.priority=function(n){var i=this._keyIndices[n];if(i!==void 0)return this._arr[i].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(n,i){var r=this._keyIndices;if(n=String(n),!t.has(r,n)){var s=this._arr,l=s.length;return r[n]=l,s.push({key:n,priority:i}),this._decrease(l),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},e.prototype.decrease=function(n,i){var r=this._keyIndices[n];if(i>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[r].priority+" New: "+i);this._arr[r].priority=i,this._decrease(r)},e.prototype._heapify=function(n){var i=this._arr,r=2*n,s=r+1,l=n;r<i.length&&(l=i[r].priority<i[l].priority?r:l,s<i.length&&(l=i[s].priority<i[l].priority?s:l),l!==n&&(this._swap(n,l),this._heapify(l)))},e.prototype._decrease=function(n){for(var i=this._arr,r=i[n].priority,s;n!==0&&(s=n>>1,!(i[s].priority<r));)this._swap(n,s),n=s},e.prototype._swap=function(n,i){var r=this._arr,s=this._keyIndices,l=r[n],c=r[i];r[n]=c,r[i]=l,s[c.key]=n,s[l.key]=i},rx}var sx,gR;function fz(){if(gR)return sx;gR=1;var t=Li(),e=uz();sx=i;var n=t.constant(1);function i(s,l,c,u){return r(s,String(l),c||n,u||function(h){return s.outEdges(h)})}function r(s,l,c,u){var h={},d=new e,m,g,v=function(x){var w=x.v!==m?x.v:x.w,C=h[w],k=c(x),A=g.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+x+" Weight: "+k);A<C.distance&&(C.distance=A,C.predecessor=m,d.decrease(w,A))};for(s.nodes().forEach(function(x){var w=x===l?0:Number.POSITIVE_INFINITY;h[x]={distance:w},d.add(x,w)});d.size()>0&&(m=d.removeMin(),g=h[m],g.distance!==Number.POSITIVE_INFINITY);)u(m).forEach(v);return h}return sx}var ax,yR;function SQ(){if(yR)return ax;yR=1;var t=fz(),e=Li();ax=n;function n(i,r,s){return e.transform(i.nodes(),function(l,c){l[c]=t(i,c,r,s)},{})}return ax}var lx,vR;function hz(){if(vR)return lx;vR=1;var t=Li();lx=e;function e(n){var i=0,r=[],s={},l=[];function c(u){var h=s[u]={onStack:!0,lowlink:i,index:i++};if(r.push(u),n.successors(u).forEach(function(g){t.has(s,g)?s[g].onStack&&(h.lowlink=Math.min(h.lowlink,s[g].index)):(c(g),h.lowlink=Math.min(h.lowlink,s[g].lowlink))}),h.lowlink===h.index){var d=[],m;do m=r.pop(),s[m].onStack=!1,d.push(m);while(u!==m);l.push(d)}}return n.nodes().forEach(function(u){t.has(s,u)||c(u)}),l}return lx}var ox,bR;function CQ(){if(bR)return ox;bR=1;var t=Li(),e=hz();ox=n;function n(i){return t.filter(e(i),function(r){return r.length>1||r.length===1&&i.hasEdge(r[0],r[0])})}return ox}var cx,xR;function kQ(){if(xR)return cx;xR=1;var t=Li();cx=n;var e=t.constant(1);function n(r,s,l){return i(r,s||e,l||function(c){return r.outEdges(c)})}function i(r,s,l){var c={},u=r.nodes();return u.forEach(function(h){c[h]={},c[h][h]={distance:0},u.forEach(function(d){h!==d&&(c[h][d]={distance:Number.POSITIVE_INFINITY})}),l(h).forEach(function(d){var m=d.v===h?d.w:d.v,g=s(d);c[h][m]={distance:g,predecessor:h}})}),u.forEach(function(h){var d=c[h];u.forEach(function(m){var g=c[m];u.forEach(function(v){var x=g[h],w=d[v],C=g[v],k=x.distance+w.distance;k<C.distance&&(C.distance=k,C.predecessor=w.predecessor)})})}),c}return cx}var ux,wR;function dz(){if(wR)return ux;wR=1;var t=Li();ux=e,e.CycleException=n;function e(i){var r={},s={},l=[];function c(u){if(t.has(s,u))throw new n;t.has(r,u)||(s[u]=!0,r[u]=!0,t.each(i.predecessors(u),c),delete s[u],l.push(u))}if(t.each(i.sinks(),c),t.size(r)!==i.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,ux}var fx,SR;function AQ(){if(SR)return fx;SR=1;var t=dz();fx=e;function e(n){try{t(n)}catch(i){if(i instanceof t.CycleException)return!1;throw i}return!0}return fx}var hx,CR;function pz(){if(CR)return hx;CR=1;var t=Li();hx=e;function e(i,r,s){t.isArray(r)||(r=[r]);var l=(i.isDirected()?i.successors:i.neighbors).bind(i),c=[],u={};return t.each(r,function(h){if(!i.hasNode(h))throw new Error("Graph does not have node: "+h);n(i,h,s==="post",u,l,c)}),c}function n(i,r,s,l,c,u){t.has(l,r)||(l[r]=!0,s||u.push(r),t.each(c(r),function(h){n(i,h,s,l,c,u)}),s&&u.push(r))}return hx}var dx,kR;function _Q(){if(kR)return dx;kR=1;var t=pz();dx=e;function e(n,i){return t(n,i,"post")}return dx}var px,AR;function OQ(){if(AR)return px;AR=1;var t=pz();px=e;function e(n,i){return t(n,i,"pre")}return px}var mx,_R;function EQ(){if(_R)return mx;_R=1;var t=Li(),e=D2(),n=uz();mx=i;function i(r,s){var l=new e,c={},u=new n,h;function d(g){var v=g.v===h?g.w:g.v,x=u.priority(v);if(x!==void 0){var w=s(g);w<x&&(c[v]=h,u.decrease(v,w))}}if(r.nodeCount()===0)return l;t.each(r.nodes(),function(g){u.add(g,Number.POSITIVE_INFINITY),l.setNode(g)}),u.decrease(r.nodes()[0],0);for(var m=!1;u.size()>0;){if(h=u.removeMin(),t.has(c,h))l.setEdge(h,c[h]);else{if(m)throw new Error("Input graph is not connected: "+r);m=!0}r.nodeEdges(h).forEach(d)}return l}return mx}var gx,OR;function TQ(){return OR||(OR=1,gx={components:wQ(),dijkstra:fz(),dijkstraAll:SQ(),findCycles:CQ(),floydWarshall:kQ(),isAcyclic:AQ(),postorder:_Q(),preorder:OQ(),prim:EQ(),tarjan:hz(),topsort:dz()}),gx}var yx,ER;function MQ(){if(ER)return yx;ER=1;var t=bQ();return yx={Graph:t.Graph,json:xQ(),alg:TQ(),version:t.version},yx}var vx,TR;function Gi(){if(TR)return vx;TR=1;var t;if(typeof y2=="function")try{t=MQ()}catch{}return t||(t=window.graphlib),vx=t,vx}var bx,MR;function NQ(){if(MR)return bx;MR=1;var t=I8(),e=1,n=4;function i(r){return t(r,e|n)}return bx=i,bx}var xx,NR;function Ep(){if(NR)return xx;NR=1;var t=Ro(),e=as(),n=bp(),i=Di();function r(s,l,c){if(!i(c))return!1;var u=typeof l;return(u=="number"?e(c)&&n(l,c.length):u=="string"&&l in c)?t(c[l],s):!1}return xx=r,xx}var wx,RR;function RQ(){if(RR)return wx;RR=1;var t=Op(),e=Ro(),n=Ep(),i=el(),r=Object.prototype,s=r.hasOwnProperty,l=t(function(c,u){c=Object(c);var h=-1,d=u.length,m=d>2?u[2]:void 0;for(m&&n(u[0],u[1],m)&&(d=1);++h<d;)for(var g=u[h],v=i(g),x=-1,w=v.length;++x<w;){var C=v[x],k=c[C];(k===void 0||e(k,r[C])&&!s.call(c,C))&&(c[C]=g[C])}return c});return wx=l,wx}var Sx,DR;function DQ(){if(DR)return Sx;DR=1;var t=ls(),e=as(),n=ia();function i(r){return function(s,l,c){var u=Object(s);if(!e(s)){var h=t(l,3);s=n(s),l=function(m){return h(u[m],m,u)}}var d=r(s,l,c);return d>-1?u[h?s[d]:d]:void 0}}return Sx=i,Sx}var Cx,LR;function LQ(){if(LR)return Cx;LR=1;var t=/\s/;function e(n){for(var i=n.length;i--&&t.test(n.charAt(i)););return i}return Cx=e,Cx}var kx,zR;function zQ(){if(zR)return kx;zR=1;var t=LQ(),e=/^\s+/;function n(i){return i&&i.slice(0,t(i)+1).replace(e,"")}return kx=n,kx}var Ax,qR;function qQ(){if(qR)return Ax;qR=1;var t=zQ(),e=Di(),n=qo(),i=NaN,r=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;function u(h){if(typeof h=="number")return h;if(n(h))return i;if(e(h)){var d=typeof h.valueOf=="function"?h.valueOf():h;h=e(d)?d+"":d}if(typeof h!="string")return h===0?h:+h;h=t(h);var m=s.test(h);return m||l.test(h)?c(h.slice(2),m?2:8):r.test(h)?i:+h}return Ax=u,Ax}var _x,BR;function mz(){if(BR)return _x;BR=1;var t=qQ(),e=1/0,n=17976931348623157e292;function i(r){if(!r)return r===0?r:0;if(r=t(r),r===e||r===-e){var s=r<0?-1:1;return s*n}return r===r?r:0}return _x=i,_x}var Ox,jR;function BQ(){if(jR)return Ox;jR=1;var t=mz();function e(n){var i=t(n),r=i%1;return i===i?r?i-r:i:0}return Ox=e,Ox}var Ex,IR;function jQ(){if(IR)return Ex;IR=1;var t=lz(),e=ls(),n=BQ(),i=Math.max;function r(s,l,c){var u=s==null?0:s.length;if(!u)return-1;var h=c==null?0:n(c);return h<0&&(h=i(u+h,0)),t(s,e(l,3),h)}return Ex=r,Ex}var Tx,PR;function IQ(){if(PR)return Tx;PR=1;var t=DQ(),e=jQ(),n=t(e);return Tx=n,Tx}var Mx,HR;function gz(){if(HR)return Mx;HR=1;var t=R2();function e(n){var i=n==null?0:n.length;return i?t(n,1):[]}return Mx=e,Mx}var Nx,UR;function PQ(){if(UR)return Nx;UR=1;var t=E2(),e=P8(),n=el();function i(r,s){return r==null?r:t(r,e(s),n)}return Nx=i,Nx}var Rx,VR;function HQ(){if(VR)return Rx;VR=1;function t(e){var n=e==null?0:e.length;return n?e[n-1]:void 0}return Rx=t,Rx}var Dx,FR;function UQ(){if(FR)return Dx;FR=1;var t=yp(),e=T2(),n=ls();function i(r,s){var l={};return s=n(s,3),e(r,function(c,u,h){t(l,u,s(c,u,h))}),l}return Dx=i,Dx}var Lx,$R;function L2(){if($R)return Lx;$R=1;var t=qo();function e(n,i,r){for(var s=-1,l=n.length;++s<l;){var c=n[s],u=i(c);if(u!=null&&(h===void 0?u===u&&!t(u):r(u,h)))var h=u,d=c}return d}return Lx=e,Lx}var zx,GR;function VQ(){if(GR)return zx;GR=1;function t(e,n){return e>n}return zx=t,zx}var qx,YR;function FQ(){if(YR)return qx;YR=1;var t=L2(),e=VQ(),n=tl();function i(r){return r&&r.length?t(r,n,e):void 0}return qx=i,qx}var Bx,QR;function yz(){if(QR)return Bx;QR=1;var t=yp(),e=Ro();function n(i,r,s){(s!==void 0&&!e(i[r],s)||s===void 0&&!(r in i))&&t(i,r,s)}return Bx=n,Bx}var jx,XR;function $Q(){if(XR)return jx;XR=1;var t=Za(),e=Sp(),n=vr(),i="[object Object]",r=Function.prototype,s=Object.prototype,l=r.toString,c=s.hasOwnProperty,u=l.call(Object);function h(d){if(!n(d)||t(d)!=i)return!1;var m=e(d);if(m===null)return!0;var g=c.call(m,"constructor")&&m.constructor;return typeof g=="function"&&g instanceof g&&l.call(g)==u}return jx=h,jx}var Ix,WR;function vz(){if(WR)return Ix;WR=1;function t(e,n){if(!(n==="constructor"&&typeof e[n]=="function")&&n!="__proto__")return e[n]}return Ix=t,Ix}var Px,KR;function GQ(){if(KR)return Px;KR=1;var t=Iu(),e=el();function n(i){return t(i,e(i))}return Px=n,Px}var Hx,ZR;function YQ(){if(ZR)return Hx;ZR=1;var t=yz(),e=O8(),n=q8(),i=E8(),r=j8(),s=Pu(),l=nn(),c=oz(),u=Lo(),h=ju(),d=Di(),m=$Q(),g=Hu(),v=vz(),x=GQ();function w(C,k,A,O,E,M,T){var N=v(C,A),I=v(k,A),q=T.get(I);if(q){t(C,A,q);return}var H=M?M(N,I,A+"",C,k,T):void 0,B=H===void 0;if(B){var $=l(I),V=!$&&u(I),D=!$&&!V&&g(I);H=I,$||V||D?l(N)?H=N:c(N)?H=i(N):V?(B=!1,H=e(I,!0)):D?(B=!1,H=n(I,!0)):H=[]:m(I)||s(I)?(H=N,s(N)?H=x(N):(!d(N)||h(N))&&(H=r(I))):B=!1}B&&(T.set(I,H),E(H,I,O,M,T),T.delete(I)),t(C,A,H)}return Hx=w,Hx}var Ux,JR;function QQ(){if(JR)return Ux;JR=1;var t=gp(),e=yz(),n=E2(),i=YQ(),r=Di(),s=el(),l=vz();function c(u,h,d,m,g){u!==h&&n(h,function(v,x){if(g||(g=new t),r(v))i(u,h,x,d,c,m,g);else{var w=m?m(l(u,x),v,x+"",u,h,g):void 0;w===void 0&&(w=v),e(u,x,w)}},s)}return Ux=c,Ux}var Vx,eD;function XQ(){if(eD)return Vx;eD=1;var t=Op(),e=Ep();function n(i){return t(function(r,s){var l=-1,c=s.length,u=c>1?s[c-1]:void 0,h=c>2?s[2]:void 0;for(u=i.length>3&&typeof u=="function"?(c--,u):void 0,h&&e(s[0],s[1],h)&&(u=c<3?void 0:u,c=1),r=Object(r);++l<c;){var d=s[l];d&&i(r,d,l,u)}return r})}return Vx=n,Vx}var Fx,tD;function WQ(){if(tD)return Fx;tD=1;var t=QQ(),e=XQ(),n=e(function(i,r,s){t(i,r,s)});return Fx=n,Fx}var $x,nD;function bz(){if(nD)return $x;nD=1;function t(e,n){return e<n}return $x=t,$x}var Gx,iD;function KQ(){if(iD)return Gx;iD=1;var t=L2(),e=bz(),n=tl();function i(r){return r&&r.length?t(r,n,e):void 0}return Gx=i,Gx}var Yx,rD;function ZQ(){if(rD)return Yx;rD=1;var t=L2(),e=ls(),n=bz();function i(r,s){return r&&r.length?t(r,e(s,2),n):void 0}return Yx=i,Yx}var Qx,sD;function JQ(){if(sD)return Qx;sD=1;var t=Xi(),e=function(){return t.Date.now()};return Qx=e,Qx}var Xx,aD;function eX(){if(aD)return Xx;aD=1;var t=vp(),e=Ap(),n=bp(),i=Di(),r=Uu();function s(l,c,u,h){if(!i(l))return l;c=e(c,l);for(var d=-1,m=c.length,g=m-1,v=l;v!=null&&++d<m;){var x=r(c[d]),w=u;if(x==="__proto__"||x==="constructor"||x==="prototype")return l;if(d!=g){var C=v[x];w=h?h(C,x,v):void 0,w===void 0&&(w=i(C)?C:n(c[d+1])?[]:{})}t(v,x,w),v=v[x]}return l}return Xx=s,Xx}var Wx,lD;function tX(){if(lD)return Wx;lD=1;var t=_p(),e=eX(),n=Ap();function i(r,s,l){for(var c=-1,u=s.length,h={};++c<u;){var d=s[c],m=t(r,d);l(m,d)&&e(h,n(d,r),m)}return h}return Wx=i,Wx}var Kx,oD;function nX(){if(oD)return Kx;oD=1;var t=tX(),e=K8();function n(i,r){return t(i,r,function(s,l){return e(i,l)})}return Kx=n,Kx}var Zx,cD;function iX(){if(cD)return Zx;cD=1;var t=gz(),e=sz(),n=az();function i(r){return n(e(r,void 0,t),r+"")}return Zx=i,Zx}var Jx,uD;function rX(){if(uD)return Jx;uD=1;var t=nX(),e=iX(),n=e(function(i,r){return i==null?{}:t(i,r)});return Jx=n,Jx}var e1,fD;function sX(){if(fD)return e1;fD=1;var t=Math.ceil,e=Math.max;function n(i,r,s,l){for(var c=-1,u=e(t((r-i)/(s||1)),0),h=Array(u);u--;)h[l?u:++c]=i,i+=s;return h}return e1=n,e1}var t1,hD;function aX(){if(hD)return t1;hD=1;var t=sX(),e=Ep(),n=mz();function i(r){return function(s,l,c){return c&&typeof c!="number"&&e(s,l,c)&&(l=c=void 0),s=n(s),l===void 0?(l=s,s=0):l=n(l),c=c===void 0?s<l?1:-1:n(c),t(s,l,c,r)}}return t1=i,t1}var n1,dD;function lX(){if(dD)return n1;dD=1;var t=aX(),e=t();return n1=e,n1}var i1,pD;function oX(){if(pD)return i1;pD=1;function t(e,n){var i=e.length;for(e.sort(n);i--;)e[i]=e[i].value;return e}return i1=t,i1}var r1,mD;function cX(){if(mD)return r1;mD=1;var t=qo();function e(n,i){if(n!==i){var r=n!==void 0,s=n===null,l=n===n,c=t(n),u=i!==void 0,h=i===null,d=i===i,m=t(i);if(!h&&!m&&!c&&n>i||c&&u&&d&&!h&&!m||s&&u&&d||!r&&d||!l)return 1;if(!s&&!c&&!m&&n<i||m&&r&&l&&!s&&!c||h&&r&&l||!u&&l||!d)return-1}return 0}return r1=e,r1}var s1,gD;function uX(){if(gD)return s1;gD=1;var t=cX();function e(n,i,r){for(var s=-1,l=n.criteria,c=i.criteria,u=l.length,h=r.length;++s<u;){var d=t(l[s],c[s]);if(d){if(s>=h)return d;var m=r[s];return d*(m=="desc"?-1:1)}}return n.index-i.index}return s1=e,s1}var a1,yD;function fX(){if(yD)return a1;yD=1;var t=kp(),e=_p(),n=ls(),i=nz(),r=oX(),s=xp(),l=uX(),c=tl(),u=nn();function h(d,m,g){m.length?m=t(m,function(w){return u(w)?function(C){return e(C,w.length===1?w[0]:w)}:w}):m=[c];var v=-1;m=t(m,s(n));var x=i(d,function(w,C,k){var A=t(m,function(O){return O(w)});return{criteria:A,index:++v,value:w}});return r(x,function(w,C){return l(w,C,g)})}return a1=h,a1}var l1,vD;function hX(){if(vD)return l1;vD=1;var t=R2(),e=fX(),n=Op(),i=Ep(),r=n(function(s,l){if(s==null)return[];var c=l.length;return c>1&&i(s,l[0],l[1])?l=[]:c>2&&i(l[0],l[1],l[2])&&(l=[l[0]]),e(s,t(l,1),[])});return l1=r,l1}var o1,bD;function dX(){if(bD)return o1;bD=1;var t=X8(),e=0;function n(i){var r=++e;return t(i)+r}return o1=n,o1}var c1,xD;function pX(){if(xD)return c1;xD=1;function t(e,n,i){for(var r=-1,s=e.length,l=n.length,c={};++r<s;){var u=r<l?n[r]:void 0;i(c,e[r],u)}return c}return c1=t,c1}var u1,wD;function mX(){if(wD)return u1;wD=1;var t=vp(),e=pX();function n(i,r){return e(i||[],r||[],t)}return u1=n,u1}var f1,SD;function Ot(){if(SD)return f1;SD=1;var t;if(typeof y2=="function")try{t={cloneDeep:NQ(),constant:O2(),defaults:RQ(),each:U8(),filter:J8(),find:IQ(),flatten:gz(),forEach:H8(),forIn:PQ(),has:ez(),isUndefined:tz(),last:HQ(),map:iz(),mapValues:UQ(),max:FQ(),merge:WQ(),min:KQ(),minBy:ZQ(),now:JQ(),pick:rX(),range:lX(),reduce:rz(),sortBy:hX(),uniqueId:dX(),values:cz(),zipObject:mX()}}catch{}return t||(t=window._),f1=t,f1}var h1,CD;function gX(){if(CD)return h1;CD=1,h1=t;function t(){var i={};i._next=i._prev=i,this._sentinel=i}t.prototype.dequeue=function(){var i=this._sentinel,r=i._prev;if(r!==i)return e(r),r},t.prototype.enqueue=function(i){var r=this._sentinel;i._prev&&i._next&&e(i),i._next=r._next,r._next._prev=i,r._next=i,i._prev=r},t.prototype.toString=function(){for(var i=[],r=this._sentinel,s=r._prev;s!==r;)i.push(JSON.stringify(s,n)),s=s._prev;return"["+i.join(", ")+"]"};function e(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function n(i,r){if(i!=="_next"&&i!=="_prev")return r}return h1}var d1,kD;function yX(){if(kD)return d1;kD=1;var t=Ot(),e=Gi().Graph,n=gX();d1=r;var i=t.constant(1);function r(h,d){if(h.nodeCount()<=1)return[];var m=c(h,d||i),g=s(m.graph,m.buckets,m.zeroIdx);return t.flatten(t.map(g,function(v){return h.outEdges(v.v,v.w)}),!0)}function s(h,d,m){for(var g=[],v=d[d.length-1],x=d[0],w;h.nodeCount();){for(;w=x.dequeue();)l(h,d,m,w);for(;w=v.dequeue();)l(h,d,m,w);if(h.nodeCount()){for(var C=d.length-2;C>0;--C)if(w=d[C].dequeue(),w){g=g.concat(l(h,d,m,w,!0));break}}}return g}function l(h,d,m,g,v){var x=v?[]:void 0;return t.forEach(h.inEdges(g.v),function(w){var C=h.edge(w),k=h.node(w.v);v&&x.push({v:w.v,w:w.w}),k.out-=C,u(d,m,k)}),t.forEach(h.outEdges(g.v),function(w){var C=h.edge(w),k=w.w,A=h.node(k);A.in-=C,u(d,m,A)}),h.removeNode(g.v),x}function c(h,d){var m=new e,g=0,v=0;t.forEach(h.nodes(),function(C){m.setNode(C,{v:C,in:0,out:0})}),t.forEach(h.edges(),function(C){var k=m.edge(C.v,C.w)||0,A=d(C),O=k+A;m.setEdge(C.v,C.w,O),v=Math.max(v,m.node(C.v).out+=A),g=Math.max(g,m.node(C.w).in+=A)});var x=t.range(v+g+3).map(function(){return new n}),w=g+1;return t.forEach(m.nodes(),function(C){u(x,w,m.node(C))}),{graph:m,buckets:x,zeroIdx:w}}function u(h,d,m){m.out?m.in?h[m.out-m.in+d].enqueue(m):h[h.length-1].enqueue(m):h[0].enqueue(m)}return d1}var p1,AD;function vX(){if(AD)return p1;AD=1;var t=Ot(),e=yX();p1={run:n,undo:r};function n(s){var l=s.graph().acyclicer==="greedy"?e(s,c(s)):i(s);t.forEach(l,function(u){var h=s.edge(u);s.removeEdge(u),h.forwardName=u.name,h.reversed=!0,s.setEdge(u.w,u.v,h,t.uniqueId("rev"))});function c(u){return function(h){return u.edge(h).weight}}}function i(s){var l=[],c={},u={};function h(d){t.has(u,d)||(u[d]=!0,c[d]=!0,t.forEach(s.outEdges(d),function(m){t.has(c,m.w)?l.push(m):h(m.w)}),delete c[d])}return t.forEach(s.nodes(),h),l}function r(s){t.forEach(s.edges(),function(l){var c=s.edge(l);if(c.reversed){s.removeEdge(l);var u=c.forwardName;delete c.reversed,delete c.forwardName,s.setEdge(l.w,l.v,c,u)}})}return p1}var m1,_D;function Kn(){if(_D)return m1;_D=1;var t=Ot(),e=Gi().Graph;m1={addDummyNode:n,simplify:i,asNonCompoundGraph:r,successorWeights:s,predecessorWeights:l,intersectRect:c,buildLayerMatrix:u,normalizeRanks:h,removeEmptyRanks:d,addBorderNode:m,maxRank:g,partition:v,time:x,notime:w};function n(C,k,A,O){var E;do E=t.uniqueId(O);while(C.hasNode(E));return A.dummy=k,C.setNode(E,A),E}function i(C){var k=new e().setGraph(C.graph());return t.forEach(C.nodes(),function(A){k.setNode(A,C.node(A))}),t.forEach(C.edges(),function(A){var O=k.edge(A.v,A.w)||{weight:0,minlen:1},E=C.edge(A);k.setEdge(A.v,A.w,{weight:O.weight+E.weight,minlen:Math.max(O.minlen,E.minlen)})}),k}function r(C){var k=new e({multigraph:C.isMultigraph()}).setGraph(C.graph());return t.forEach(C.nodes(),function(A){C.children(A).length||k.setNode(A,C.node(A))}),t.forEach(C.edges(),function(A){k.setEdge(A,C.edge(A))}),k}function s(C){var k=t.map(C.nodes(),function(A){var O={};return t.forEach(C.outEdges(A),function(E){O[E.w]=(O[E.w]||0)+C.edge(E).weight}),O});return t.zipObject(C.nodes(),k)}function l(C){var k=t.map(C.nodes(),function(A){var O={};return t.forEach(C.inEdges(A),function(E){O[E.v]=(O[E.v]||0)+C.edge(E).weight}),O});return t.zipObject(C.nodes(),k)}function c(C,k){var A=C.x,O=C.y,E=k.x-A,M=k.y-O,T=C.width/2,N=C.height/2;if(!E&&!M)throw new Error("Not possible to find intersection inside of the rectangle");var I,q;return Math.abs(M)*T>Math.abs(E)*N?(M<0&&(N=-N),I=N*E/M,q=N):(E<0&&(T=-T),I=T,q=T*M/E),{x:A+I,y:O+q}}function u(C){var k=t.map(t.range(g(C)+1),function(){return[]});return t.forEach(C.nodes(),function(A){var O=C.node(A),E=O.rank;t.isUndefined(E)||(k[E][O.order]=A)}),k}function h(C){var k=t.min(t.map(C.nodes(),function(A){return C.node(A).rank}));t.forEach(C.nodes(),function(A){var O=C.node(A);t.has(O,"rank")&&(O.rank-=k)})}function d(C){var k=t.min(t.map(C.nodes(),function(M){return C.node(M).rank})),A=[];t.forEach(C.nodes(),function(M){var T=C.node(M).rank-k;A[T]||(A[T]=[]),A[T].push(M)});var O=0,E=C.graph().nodeRankFactor;t.forEach(A,function(M,T){t.isUndefined(M)&&T%E!==0?--O:O&&t.forEach(M,function(N){C.node(N).rank+=O})})}function m(C,k,A,O){var E={width:0,height:0};return arguments.length>=4&&(E.rank=A,E.order=O),n(C,"border",E,k)}function g(C){return t.max(t.map(C.nodes(),function(k){var A=C.node(k).rank;if(!t.isUndefined(A))return A}))}function v(C,k){var A={lhs:[],rhs:[]};return t.forEach(C,function(O){k(O)?A.lhs.push(O):A.rhs.push(O)}),A}function x(C,k){var A=t.now();try{return k()}finally{console.log(C+" time: "+(t.now()-A)+"ms")}}function w(C,k){return k()}return m1}var g1,OD;function bX(){if(OD)return g1;OD=1;var t=Ot(),e=Kn();g1={run:n,undo:r};function n(s){s.graph().dummyChains=[],t.forEach(s.edges(),function(l){i(s,l)})}function i(s,l){var c=l.v,u=s.node(c).rank,h=l.w,d=s.node(h).rank,m=l.name,g=s.edge(l),v=g.labelRank;if(d!==u+1){s.removeEdge(l);var x,w,C;for(C=0,++u;u<d;++C,++u)g.points=[],w={width:0,height:0,edgeLabel:g,edgeObj:l,rank:u},x=e.addDummyNode(s,"edge",w,"_d"),u===v&&(w.width=g.width,w.height=g.height,w.dummy="edge-label",w.labelpos=g.labelpos),s.setEdge(c,x,{weight:g.weight},m),C===0&&s.graph().dummyChains.push(x),c=x;s.setEdge(c,h,{weight:g.weight},m)}}function r(s){t.forEach(s.graph().dummyChains,function(l){var c=s.node(l),u=c.edgeLabel,h;for(s.setEdge(c.edgeObj,u);c.dummy;)h=s.successors(l)[0],s.removeNode(l),u.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(u.x=c.x,u.y=c.y,u.width=c.width,u.height=c.height),l=h,c=s.node(l)})}return g1}var y1,ED;function Ad(){if(ED)return y1;ED=1;var t=Ot();y1={longestPath:e,slack:n};function e(i){var r={};function s(l){var c=i.node(l);if(t.has(r,l))return c.rank;r[l]=!0;var u=t.min(t.map(i.outEdges(l),function(h){return s(h.w)-i.edge(h).minlen}));return(u===Number.POSITIVE_INFINITY||u===void 0||u===null)&&(u=0),c.rank=u}t.forEach(i.sources(),s)}function n(i,r){return i.node(r.w).rank-i.node(r.v).rank-i.edge(r).minlen}return y1}var v1,TD;function xz(){if(TD)return v1;TD=1;var t=Ot(),e=Gi().Graph,n=Ad().slack;v1=i;function i(c){var u=new e({directed:!1}),h=c.nodes()[0],d=c.nodeCount();u.setNode(h,{});for(var m,g;r(u,c)<d;)m=s(u,c),g=u.hasNode(m.v)?n(c,m):-n(c,m),l(u,c,g);return u}function r(c,u){function h(d){t.forEach(u.nodeEdges(d),function(m){var g=m.v,v=d===g?m.w:g;!c.hasNode(v)&&!n(u,m)&&(c.setNode(v,{}),c.setEdge(d,v,{}),h(v))})}return t.forEach(c.nodes(),h),c.nodeCount()}function s(c,u){return t.minBy(u.edges(),function(h){if(c.hasNode(h.v)!==c.hasNode(h.w))return n(u,h)})}function l(c,u,h){t.forEach(c.nodes(),function(d){u.node(d).rank+=h})}return v1}var b1,MD;function xX(){if(MD)return b1;MD=1;var t=Ot(),e=xz(),n=Ad().slack,i=Ad().longestPath,r=Gi().alg.preorder,s=Gi().alg.postorder,l=Kn().simplify;b1=c,c.initLowLimValues=m,c.initCutValues=u,c.calcCutValue=d,c.leaveEdge=v,c.enterEdge=x,c.exchangeEdges=w;function c(O){O=l(O),i(O);var E=e(O);m(E),u(E,O);for(var M,T;M=v(E);)T=x(E,O,M),w(E,O,M,T)}function u(O,E){var M=s(O,O.nodes());M=M.slice(0,M.length-1),t.forEach(M,function(T){h(O,E,T)})}function h(O,E,M){var T=O.node(M),N=T.parent;O.edge(M,N).cutvalue=d(O,E,M)}function d(O,E,M){var T=O.node(M),N=T.parent,I=!0,q=E.edge(M,N),H=0;return q||(I=!1,q=E.edge(N,M)),H=q.weight,t.forEach(E.nodeEdges(M),function(B){var $=B.v===M,V=$?B.w:B.v;if(V!==N){var D=$===I,P=E.edge(B).weight;if(H+=D?P:-P,k(O,M,V)){var L=O.edge(M,V).cutvalue;H+=D?-L:L}}}),H}function m(O,E){arguments.length<2&&(E=O.nodes()[0]),g(O,{},1,E)}function g(O,E,M,T,N){var I=M,q=O.node(T);return E[T]=!0,t.forEach(O.neighbors(T),function(H){t.has(E,H)||(M=g(O,E,M,H,T))}),q.low=I,q.lim=M++,N?q.parent=N:delete q.parent,M}function v(O){return t.find(O.edges(),function(E){return O.edge(E).cutvalue<0})}function x(O,E,M){var T=M.v,N=M.w;E.hasEdge(T,N)||(T=M.w,N=M.v);var I=O.node(T),q=O.node(N),H=I,B=!1;I.lim>q.lim&&(H=q,B=!0);var $=t.filter(E.edges(),function(V){return B===A(O,O.node(V.v),H)&&B!==A(O,O.node(V.w),H)});return t.minBy($,function(V){return n(E,V)})}function w(O,E,M,T){var N=M.v,I=M.w;O.removeEdge(N,I),O.setEdge(T.v,T.w,{}),m(O),u(O,E),C(O,E)}function C(O,E){var M=t.find(O.nodes(),function(N){return!E.node(N).parent}),T=r(O,M);T=T.slice(1),t.forEach(T,function(N){var I=O.node(N).parent,q=E.edge(N,I),H=!1;q||(q=E.edge(I,N),H=!0),E.node(N).rank=E.node(I).rank+(H?q.minlen:-q.minlen)})}function k(O,E,M){return O.hasEdge(E,M)}function A(O,E,M){return M.low<=E.lim&&E.lim<=M.lim}return b1}var x1,ND;function wX(){if(ND)return x1;ND=1;var t=Ad(),e=t.longestPath,n=xz(),i=xX();x1=r;function r(u){switch(u.graph().ranker){case"network-simplex":c(u);break;case"tight-tree":l(u);break;case"longest-path":s(u);break;default:c(u)}}var s=e;function l(u){e(u),n(u)}function c(u){i(u)}return x1}var w1,RD;function SX(){if(RD)return w1;RD=1;var t=Ot();w1=e;function e(r){var s=i(r);t.forEach(r.graph().dummyChains,function(l){for(var c=r.node(l),u=c.edgeObj,h=n(r,s,u.v,u.w),d=h.path,m=h.lca,g=0,v=d[g],x=!0;l!==u.w;){if(c=r.node(l),x){for(;(v=d[g])!==m&&r.node(v).maxRank<c.rank;)g++;v===m&&(x=!1)}if(!x){for(;g<d.length-1&&r.node(v=d[g+1]).minRank<=c.rank;)g++;v=d[g]}r.setParent(l,v),l=r.successors(l)[0]}})}function n(r,s,l,c){var u=[],h=[],d=Math.min(s[l].low,s[c].low),m=Math.max(s[l].lim,s[c].lim),g,v;g=l;do g=r.parent(g),u.push(g);while(g&&(s[g].low>d||m>s[g].lim));for(v=g,g=c;(g=r.parent(g))!==v;)h.push(g);return{path:u.concat(h.reverse()),lca:v}}function i(r){var s={},l=0;function c(u){var h=l;t.forEach(r.children(u),c),s[u]={low:h,lim:l++}}return t.forEach(r.children(),c),s}return w1}var S1,DD;function CX(){if(DD)return S1;DD=1;var t=Ot(),e=Kn();S1={run:n,cleanup:l};function n(c){var u=e.addDummyNode(c,"root",{},"_root"),h=r(c),d=t.max(t.values(h))-1,m=2*d+1;c.graph().nestingRoot=u,t.forEach(c.edges(),function(v){c.edge(v).minlen*=m});var g=s(c)+1;t.forEach(c.children(),function(v){i(c,u,m,g,d,h,v)}),c.graph().nodeRankFactor=m}function i(c,u,h,d,m,g,v){var x=c.children(v);if(!x.length){v!==u&&c.setEdge(u,v,{weight:0,minlen:h});return}var w=e.addBorderNode(c,"_bt"),C=e.addBorderNode(c,"_bb"),k=c.node(v);c.setParent(w,v),k.borderTop=w,c.setParent(C,v),k.borderBottom=C,t.forEach(x,function(A){i(c,u,h,d,m,g,A);var O=c.node(A),E=O.borderTop?O.borderTop:A,M=O.borderBottom?O.borderBottom:A,T=O.borderTop?d:2*d,N=E!==M?1:m-g[v]+1;c.setEdge(w,E,{weight:T,minlen:N,nestingEdge:!0}),c.setEdge(M,C,{weight:T,minlen:N,nestingEdge:!0})}),c.parent(v)||c.setEdge(u,w,{weight:0,minlen:m+g[v]})}function r(c){var u={};function h(d,m){var g=c.children(d);g&&g.length&&t.forEach(g,function(v){h(v,m+1)}),u[d]=m}return t.forEach(c.children(),function(d){h(d,1)}),u}function s(c){return t.reduce(c.edges(),function(u,h){return u+c.edge(h).weight},0)}function l(c){var u=c.graph();c.removeNode(u.nestingRoot),delete u.nestingRoot,t.forEach(c.edges(),function(h){var d=c.edge(h);d.nestingEdge&&c.removeEdge(h)})}return S1}var C1,LD;function kX(){if(LD)return C1;LD=1;var t=Ot(),e=Kn();C1=n;function n(r){function s(l){var c=r.children(l),u=r.node(l);if(c.length&&t.forEach(c,s),t.has(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(var h=u.minRank,d=u.maxRank+1;h<d;++h)i(r,"borderLeft","_bl",l,u,h),i(r,"borderRight","_br",l,u,h)}}t.forEach(r.children(),s)}function i(r,s,l,c,u,h){var d={width:0,height:0,rank:h,borderType:s},m=u[s][h-1],g=e.addDummyNode(r,"border",d,l);u[s][h]=g,r.setParent(g,c),m&&r.setEdge(m,g,{weight:1})}return C1}var k1,zD;function AX(){if(zD)return k1;zD=1;var t=Ot();k1={adjust:e,undo:n};function e(h){var d=h.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(h)}function n(h){var d=h.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&s(h),(d==="lr"||d==="rl")&&(c(h),i(h))}function i(h){t.forEach(h.nodes(),function(d){r(h.node(d))}),t.forEach(h.edges(),function(d){r(h.edge(d))})}function r(h){var d=h.width;h.width=h.height,h.height=d}function s(h){t.forEach(h.nodes(),function(d){l(h.node(d))}),t.forEach(h.edges(),function(d){var m=h.edge(d);t.forEach(m.points,l),t.has(m,"y")&&l(m)})}function l(h){h.y=-h.y}function c(h){t.forEach(h.nodes(),function(d){u(h.node(d))}),t.forEach(h.edges(),function(d){var m=h.edge(d);t.forEach(m.points,u),t.has(m,"x")&&u(m)})}function u(h){var d=h.x;h.x=h.y,h.y=d}return k1}var A1,qD;function _X(){if(qD)return A1;qD=1;var t=Ot();A1=e;function e(n){var i={},r=t.filter(n.nodes(),function(h){return!n.children(h).length}),s=t.max(t.map(r,function(h){return n.node(h).rank})),l=t.map(t.range(s+1),function(){return[]});function c(h){if(!t.has(i,h)){i[h]=!0;var d=n.node(h);l[d.rank].push(h),t.forEach(n.successors(h),c)}}var u=t.sortBy(r,function(h){return n.node(h).rank});return t.forEach(u,c),l}return A1}var _1,BD;function OX(){if(BD)return _1;BD=1;var t=Ot();_1=e;function e(i,r){for(var s=0,l=1;l<r.length;++l)s+=n(i,r[l-1],r[l]);return s}function n(i,r,s){for(var l=t.zipObject(s,t.map(s,function(g,v){return v})),c=t.flatten(t.map(r,function(g){return t.sortBy(t.map(i.outEdges(g),function(v){return{pos:l[v.w],weight:i.edge(v).weight}}),"pos")}),!0),u=1;u<s.length;)u<<=1;var h=2*u-1;u-=1;var d=t.map(new Array(h),function(){return 0}),m=0;return t.forEach(c.forEach(function(g){var v=g.pos+u;d[v]+=g.weight;for(var x=0;v>0;)v%2&&(x+=d[v+1]),v=v-1>>1,d[v]+=g.weight;m+=g.weight*x})),m}return _1}var O1,jD;function EX(){if(jD)return O1;jD=1;var t=Ot();O1=e;function e(n,i){return t.map(i,function(r){var s=n.inEdges(r);if(s.length){var l=t.reduce(s,function(c,u){var h=n.edge(u),d=n.node(u.v);return{sum:c.sum+h.weight*d.order,weight:c.weight+h.weight}},{sum:0,weight:0});return{v:r,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:r}})}return O1}var E1,ID;function TX(){if(ID)return E1;ID=1;var t=Ot();E1=e;function e(r,s){var l={};t.forEach(r,function(u,h){var d=l[u.v]={indegree:0,in:[],out:[],vs:[u.v],i:h};t.isUndefined(u.barycenter)||(d.barycenter=u.barycenter,d.weight=u.weight)}),t.forEach(s.edges(),function(u){var h=l[u.v],d=l[u.w];!t.isUndefined(h)&&!t.isUndefined(d)&&(d.indegree++,h.out.push(l[u.w]))});var c=t.filter(l,function(u){return!u.indegree});return n(c)}function n(r){var s=[];function l(h){return function(d){d.merged||(t.isUndefined(d.barycenter)||t.isUndefined(h.barycenter)||d.barycenter>=h.barycenter)&&i(h,d)}}function c(h){return function(d){d.in.push(h),--d.indegree===0&&r.push(d)}}for(;r.length;){var u=r.pop();s.push(u),t.forEach(u.in.reverse(),l(u)),t.forEach(u.out,c(u))}return t.map(t.filter(s,function(h){return!h.merged}),function(h){return t.pick(h,["vs","i","barycenter","weight"])})}function i(r,s){var l=0,c=0;r.weight&&(l+=r.barycenter*r.weight,c+=r.weight),s.weight&&(l+=s.barycenter*s.weight,c+=s.weight),r.vs=s.vs.concat(r.vs),r.barycenter=l/c,r.weight=c,r.i=Math.min(s.i,r.i),s.merged=!0}return E1}var T1,PD;function MX(){if(PD)return T1;PD=1;var t=Ot(),e=Kn();T1=n;function n(s,l){var c=e.partition(s,function(w){return t.has(w,"barycenter")}),u=c.lhs,h=t.sortBy(c.rhs,function(w){return-w.i}),d=[],m=0,g=0,v=0;u.sort(r(!!l)),v=i(d,h,v),t.forEach(u,function(w){v+=w.vs.length,d.push(w.vs),m+=w.barycenter*w.weight,g+=w.weight,v=i(d,h,v)});var x={vs:t.flatten(d,!0)};return g&&(x.barycenter=m/g,x.weight=g),x}function i(s,l,c){for(var u;l.length&&(u=t.last(l)).i<=c;)l.pop(),s.push(u.vs),c++;return c}function r(s){return function(l,c){return l.barycenter<c.barycenter?-1:l.barycenter>c.barycenter?1:s?c.i-l.i:l.i-c.i}}return T1}var M1,HD;function NX(){if(HD)return M1;HD=1;var t=Ot(),e=EX(),n=TX(),i=MX();M1=r;function r(c,u,h,d){var m=c.children(u),g=c.node(u),v=g?g.borderLeft:void 0,x=g?g.borderRight:void 0,w={};v&&(m=t.filter(m,function(M){return M!==v&&M!==x}));var C=e(c,m);t.forEach(C,function(M){if(c.children(M.v).length){var T=r(c,M.v,h,d);w[M.v]=T,t.has(T,"barycenter")&&l(M,T)}});var k=n(C,h);s(k,w);var A=i(k,d);if(v&&(A.vs=t.flatten([v,A.vs,x],!0),c.predecessors(v).length)){var O=c.node(c.predecessors(v)[0]),E=c.node(c.predecessors(x)[0]);t.has(A,"barycenter")||(A.barycenter=0,A.weight=0),A.barycenter=(A.barycenter*A.weight+O.order+E.order)/(A.weight+2),A.weight+=2}return A}function s(c,u){t.forEach(c,function(h){h.vs=t.flatten(h.vs.map(function(d){return u[d]?u[d].vs:d}),!0)})}function l(c,u){t.isUndefined(c.barycenter)?(c.barycenter=u.barycenter,c.weight=u.weight):(c.barycenter=(c.barycenter*c.weight+u.barycenter*u.weight)/(c.weight+u.weight),c.weight+=u.weight)}return M1}var N1,UD;function RX(){if(UD)return N1;UD=1;var t=Ot(),e=Gi().Graph;N1=n;function n(r,s,l){var c=i(r),u=new e({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(h){return r.node(h)});return t.forEach(r.nodes(),function(h){var d=r.node(h),m=r.parent(h);(d.rank===s||d.minRank<=s&&s<=d.maxRank)&&(u.setNode(h),u.setParent(h,m||c),t.forEach(r[l](h),function(g){var v=g.v===h?g.w:g.v,x=u.edge(v,h),w=t.isUndefined(x)?0:x.weight;u.setEdge(v,h,{weight:r.edge(g).weight+w})}),t.has(d,"minRank")&&u.setNode(h,{borderLeft:d.borderLeft[s],borderRight:d.borderRight[s]}))}),u}function i(r){for(var s;r.hasNode(s=t.uniqueId("_root")););return s}return N1}var R1,VD;function DX(){if(VD)return R1;VD=1;var t=Ot();R1=e;function e(n,i,r){var s={},l;t.forEach(r,function(c){for(var u=n.parent(c),h,d;u;){if(h=n.parent(u),h?(d=s[h],s[h]=u):(d=l,l=u),d&&d!==u){i.setEdge(d,u);return}u=h}})}return R1}var D1,FD;function LX(){if(FD)return D1;FD=1;var t=Ot(),e=_X(),n=OX(),i=NX(),r=RX(),s=DX(),l=Gi().Graph,c=Kn();D1=u;function u(g){var v=c.maxRank(g),x=h(g,t.range(1,v+1),"inEdges"),w=h(g,t.range(v-1,-1,-1),"outEdges"),C=e(g);m(g,C);for(var k=Number.POSITIVE_INFINITY,A,O=0,E=0;E<4;++O,++E){d(O%2?x:w,O%4>=2),C=c.buildLayerMatrix(g);var M=n(g,C);M<k&&(E=0,A=t.cloneDeep(C),k=M)}m(g,A)}function h(g,v,x){return t.map(v,function(w){return r(g,w,x)})}function d(g,v){var x=new l;t.forEach(g,function(w){var C=w.graph().root,k=i(w,C,x,v);t.forEach(k.vs,function(A,O){w.node(A).order=O}),s(w,x,k.vs)})}function m(g,v){t.forEach(v,function(x){t.forEach(x,function(w,C){g.node(w).order=C})})}return D1}var L1,$D;function zX(){if($D)return L1;$D=1;var t=Ot(),e=Gi().Graph,n=Kn();L1={positionX:x,findType1Conflicts:i,findType2Conflicts:r,addConflict:l,hasConflict:c,verticalAlignment:u,horizontalCompaction:h,alignCoordinates:g,findSmallestWidthAlignment:m,balance:v};function i(k,A){var O={};function E(M,T){var N=0,I=0,q=M.length,H=t.last(T);return t.forEach(T,function(B,$){var V=s(k,B),D=V?k.node(V).order:q;(V||B===H)&&(t.forEach(T.slice(I,$+1),function(P){t.forEach(k.predecessors(P),function(L){var Q=k.node(L),Z=Q.order;(Z<N||D<Z)&&!(Q.dummy&&k.node(P).dummy)&&l(O,L,P)})}),I=$+1,N=D)}),T}return t.reduce(A,E),O}function r(k,A){var O={};function E(T,N,I,q,H){var B;t.forEach(t.range(N,I),function($){B=T[$],k.node(B).dummy&&t.forEach(k.predecessors(B),function(V){var D=k.node(V);D.dummy&&(D.order<q||D.order>H)&&l(O,V,B)})})}function M(T,N){var I=-1,q,H=0;return t.forEach(N,function(B,$){if(k.node(B).dummy==="border"){var V=k.predecessors(B);V.length&&(q=k.node(V[0]).order,E(N,H,$,I,q),H=$,I=q)}E(N,H,N.length,q,T.length)}),N}return t.reduce(A,M),O}function s(k,A){if(k.node(A).dummy)return t.find(k.predecessors(A),function(O){return k.node(O).dummy})}function l(k,A,O){if(A>O){var E=A;A=O,O=E}var M=k[A];M||(k[A]=M={}),M[O]=!0}function c(k,A,O){if(A>O){var E=A;A=O,O=E}return t.has(k[A],O)}function u(k,A,O,E){var M={},T={},N={};return t.forEach(A,function(I){t.forEach(I,function(q,H){M[q]=q,T[q]=q,N[q]=H})}),t.forEach(A,function(I){var q=-1;t.forEach(I,function(H){var B=E(H);if(B.length){B=t.sortBy(B,function(L){return N[L]});for(var $=(B.length-1)/2,V=Math.floor($),D=Math.ceil($);V<=D;++V){var P=B[V];T[H]===H&&q<N[P]&&!c(O,H,P)&&(T[P]=H,T[H]=M[H]=M[P],q=N[P])}}})}),{root:M,align:T}}function h(k,A,O,E,M){var T={},N=d(k,A,O,M),I=M?"borderLeft":"borderRight";function q($,V){for(var D=N.nodes(),P=D.pop(),L={};P;)L[P]?$(P):(L[P]=!0,D.push(P),D=D.concat(V(P))),P=D.pop()}function H($){T[$]=N.inEdges($).reduce(function(V,D){return Math.max(V,T[D.v]+N.edge(D))},0)}function B($){var V=N.outEdges($).reduce(function(P,L){return Math.min(P,T[L.w]-N.edge(L))},Number.POSITIVE_INFINITY),D=k.node($);V!==Number.POSITIVE_INFINITY&&D.borderType!==I&&(T[$]=Math.max(T[$],V))}return q(H,N.predecessors.bind(N)),q(B,N.successors.bind(N)),t.forEach(E,function($){T[$]=T[O[$]]}),T}function d(k,A,O,E){var M=new e,T=k.graph(),N=w(T.nodesep,T.edgesep,E);return t.forEach(A,function(I){var q;t.forEach(I,function(H){var B=O[H];if(M.setNode(B),q){var $=O[q],V=M.edge($,B);M.setEdge($,B,Math.max(N(k,H,q),V||0))}q=H})}),M}function m(k,A){return t.minBy(t.values(A),function(O){var E=Number.NEGATIVE_INFINITY,M=Number.POSITIVE_INFINITY;return t.forIn(O,function(T,N){var I=C(k,N)/2;E=Math.max(T+I,E),M=Math.min(T-I,M)}),E-M})}function g(k,A){var O=t.values(A),E=t.min(O),M=t.max(O);t.forEach(["u","d"],function(T){t.forEach(["l","r"],function(N){var I=T+N,q=k[I],H;if(q!==A){var B=t.values(q);H=N==="l"?E-t.min(B):M-t.max(B),H&&(k[I]=t.mapValues(q,function($){return $+H}))}})})}function v(k,A){return t.mapValues(k.ul,function(O,E){if(A)return k[A.toLowerCase()][E];var M=t.sortBy(t.map(k,E));return(M[1]+M[2])/2})}function x(k){var A=n.buildLayerMatrix(k),O=t.merge(i(k,A),r(k,A)),E={},M;t.forEach(["u","d"],function(N){M=N==="u"?A:t.values(A).reverse(),t.forEach(["l","r"],function(I){I==="r"&&(M=t.map(M,function($){return t.values($).reverse()}));var q=(N==="u"?k.predecessors:k.successors).bind(k),H=u(k,M,O,q),B=h(k,M,H.root,H.align,I==="r");I==="r"&&(B=t.mapValues(B,function($){return-$})),E[N+I]=B})});var T=m(k,E);return g(E,T),v(E,k.graph().align)}function w(k,A,O){return function(E,M,T){var N=E.node(M),I=E.node(T),q=0,H;if(q+=N.width/2,t.has(N,"labelpos"))switch(N.labelpos.toLowerCase()){case"l":H=-N.width/2;break;case"r":H=N.width/2;break}if(H&&(q+=O?H:-H),H=0,q+=(N.dummy?A:k)/2,q+=(I.dummy?A:k)/2,q+=I.width/2,t.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":H=I.width/2;break;case"r":H=-I.width/2;break}return H&&(q+=O?H:-H),H=0,q}}function C(k,A){return k.node(A).width}return L1}var z1,GD;function qX(){if(GD)return z1;GD=1;var t=Ot(),e=Kn(),n=zX().positionX;z1=i;function i(s){s=e.asNonCompoundGraph(s),r(s),t.forEach(n(s),function(l,c){s.node(c).x=l})}function r(s){var l=e.buildLayerMatrix(s),c=s.graph().ranksep,u=0;t.forEach(l,function(h){var d=t.max(t.map(h,function(m){return s.node(m).height}));t.forEach(h,function(m){s.node(m).y=u+d/2}),u+=d+c})}return z1}var q1,YD;function BX(){if(YD)return q1;YD=1;var t=Ot(),e=vX(),n=bX(),i=wX(),r=Kn().normalizeRanks,s=SX(),l=Kn().removeEmptyRanks,c=CX(),u=kX(),h=AX(),d=LX(),m=qX(),g=Kn(),v=Gi().Graph;q1=x;function x(j,K){var ee=K&&K.debugTiming?g.time:g.notime;ee("layout",function(){var oe=ee(" buildLayoutGraph",function(){return q(j)});ee(" runLayout",function(){w(oe,ee)}),ee(" updateInputGraph",function(){C(j,oe)})})}function w(j,K){K(" makeSpaceForEdgeLabels",function(){H(j)}),K(" removeSelfEdges",function(){U(j)}),K(" acyclic",function(){e.run(j)}),K(" nestingGraph.run",function(){c.run(j)}),K(" rank",function(){i(g.asNonCompoundGraph(j))}),K(" injectEdgeLabelProxies",function(){B(j)}),K(" removeEmptyRanks",function(){l(j)}),K(" nestingGraph.cleanup",function(){c.cleanup(j)}),K(" normalizeRanks",function(){r(j)}),K(" assignRankMinMax",function(){$(j)}),K(" removeEdgeLabelProxies",function(){V(j)}),K(" normalize.run",function(){n.run(j)}),K(" parentDummyChains",function(){s(j)}),K(" addBorderSegments",function(){u(j)}),K(" order",function(){d(j)}),K(" insertSelfEdges",function(){re(j)}),K(" adjustCoordinateSystem",function(){h.adjust(j)}),K(" position",function(){m(j)}),K(" positionSelfEdges",function(){z(j)}),K(" removeBorderNodes",function(){Z(j)}),K(" normalize.undo",function(){n.undo(j)}),K(" fixupEdgeLabelCoords",function(){L(j)}),K(" undoCoordinateSystem",function(){h.undo(j)}),K(" translateGraph",function(){D(j)}),K(" assignNodeIntersects",function(){P(j)}),K(" reversePoints",function(){Q(j)}),K(" acyclic.undo",function(){e.undo(j)})}function C(j,K){t.forEach(j.nodes(),function(ee){var oe=j.node(ee),ge=K.node(ee);oe&&(oe.x=ge.x,oe.y=ge.y,K.children(ee).length&&(oe.width=ge.width,oe.height=ge.height))}),t.forEach(j.edges(),function(ee){var oe=j.edge(ee),ge=K.edge(ee);oe.points=ge.points,t.has(ge,"x")&&(oe.x=ge.x,oe.y=ge.y)}),j.graph().width=K.graph().width,j.graph().height=K.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],A={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},O=["acyclicer","ranker","rankdir","align"],E=["width","height"],M={width:0,height:0},T=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},I=["labelpos"];function q(j){var K=new v({multigraph:!0,compound:!0}),ee=te(j.graph());return K.setGraph(t.merge({},A,G(ee,k),t.pick(ee,O))),t.forEach(j.nodes(),function(oe){var ge=te(j.node(oe));K.setNode(oe,t.defaults(G(ge,E),M)),K.setParent(oe,j.parent(oe))}),t.forEach(j.edges(),function(oe){var ge=te(j.edge(oe));K.setEdge(oe,t.merge({},N,G(ge,T),t.pick(ge,I)))}),K}function H(j){var K=j.graph();K.ranksep/=2,t.forEach(j.edges(),function(ee){var oe=j.edge(ee);oe.minlen*=2,oe.labelpos.toLowerCase()!=="c"&&(K.rankdir==="TB"||K.rankdir==="BT"?oe.width+=oe.labeloffset:oe.height+=oe.labeloffset)})}function B(j){t.forEach(j.edges(),function(K){var ee=j.edge(K);if(ee.width&&ee.height){var oe=j.node(K.v),ge=j.node(K.w),xe={rank:(ge.rank-oe.rank)/2+oe.rank,e:K};g.addDummyNode(j,"edge-proxy",xe,"_ep")}})}function $(j){var K=0;t.forEach(j.nodes(),function(ee){var oe=j.node(ee);oe.borderTop&&(oe.minRank=j.node(oe.borderTop).rank,oe.maxRank=j.node(oe.borderBottom).rank,K=t.max(K,oe.maxRank))}),j.graph().maxRank=K}function V(j){t.forEach(j.nodes(),function(K){var ee=j.node(K);ee.dummy==="edge-proxy"&&(j.edge(ee.e).labelRank=ee.rank,j.removeNode(K))})}function D(j){var K=Number.POSITIVE_INFINITY,ee=0,oe=Number.POSITIVE_INFINITY,ge=0,xe=j.graph(),Me=xe.marginx||0,X=xe.marginy||0;function pe(Se){var ye=Se.x,_e=Se.y,ot=Se.width,Oe=Se.height;K=Math.min(K,ye-ot/2),ee=Math.max(ee,ye+ot/2),oe=Math.min(oe,_e-Oe/2),ge=Math.max(ge,_e+Oe/2)}t.forEach(j.nodes(),function(Se){pe(j.node(Se))}),t.forEach(j.edges(),function(Se){var ye=j.edge(Se);t.has(ye,"x")&&pe(ye)}),K-=Me,oe-=X,t.forEach(j.nodes(),function(Se){var ye=j.node(Se);ye.x-=K,ye.y-=oe}),t.forEach(j.edges(),function(Se){var ye=j.edge(Se);t.forEach(ye.points,function(_e){_e.x-=K,_e.y-=oe}),t.has(ye,"x")&&(ye.x-=K),t.has(ye,"y")&&(ye.y-=oe)}),xe.width=ee-K+Me,xe.height=ge-oe+X}function P(j){t.forEach(j.edges(),function(K){var ee=j.edge(K),oe=j.node(K.v),ge=j.node(K.w),xe,Me;ee.points?(xe=ee.points[0],Me=ee.points[ee.points.length-1]):(ee.points=[],xe=ge,Me=oe),ee.points.unshift(g.intersectRect(oe,xe)),ee.points.push(g.intersectRect(ge,Me))})}function L(j){t.forEach(j.edges(),function(K){var ee=j.edge(K);if(t.has(ee,"x"))switch((ee.labelpos==="l"||ee.labelpos==="r")&&(ee.width-=ee.labeloffset),ee.labelpos){case"l":ee.x-=ee.width/2+ee.labeloffset;break;case"r":ee.x+=ee.width/2+ee.labeloffset;break}})}function Q(j){t.forEach(j.edges(),function(K){var ee=j.edge(K);ee.reversed&&ee.points.reverse()})}function Z(j){t.forEach(j.nodes(),function(K){if(j.children(K).length){var ee=j.node(K),oe=j.node(ee.borderTop),ge=j.node(ee.borderBottom),xe=j.node(t.last(ee.borderLeft)),Me=j.node(t.last(ee.borderRight));ee.width=Math.abs(Me.x-xe.x),ee.height=Math.abs(ge.y-oe.y),ee.x=xe.x+ee.width/2,ee.y=oe.y+ee.height/2}}),t.forEach(j.nodes(),function(K){j.node(K).dummy==="border"&&j.removeNode(K)})}function U(j){t.forEach(j.edges(),function(K){if(K.v===K.w){var ee=j.node(K.v);ee.selfEdges||(ee.selfEdges=[]),ee.selfEdges.push({e:K,label:j.edge(K)}),j.removeEdge(K)}})}function re(j){var K=g.buildLayerMatrix(j);t.forEach(K,function(ee){var oe=0;t.forEach(ee,function(ge,xe){var Me=j.node(ge);Me.order=xe+oe,t.forEach(Me.selfEdges,function(X){g.addDummyNode(j,"selfedge",{width:X.label.width,height:X.label.height,rank:Me.rank,order:xe+ ++oe,e:X.e,label:X.label},"_se")}),delete Me.selfEdges})})}function z(j){t.forEach(j.nodes(),function(K){var ee=j.node(K);if(ee.dummy==="selfedge"){var oe=j.node(ee.e.v),ge=oe.x+oe.width/2,xe=oe.y,Me=ee.x-ge,X=oe.height/2;j.setEdge(ee.e,ee.label),j.removeNode(K),ee.label.points=[{x:ge+2*Me/3,y:xe-X},{x:ge+5*Me/6,y:xe-X},{x:ge+Me,y:xe},{x:ge+5*Me/6,y:xe+X},{x:ge+2*Me/3,y:xe+X}],ee.label.x=ee.x,ee.label.y=ee.y}})}function G(j,K){return t.mapValues(t.pick(j,K),Number)}function te(j){var K={};return t.forEach(j,function(ee,oe){K[oe.toLowerCase()]=ee}),K}return q1}var B1,QD;function jX(){if(QD)return B1;QD=1;var t=Ot(),e=Kn(),n=Gi().Graph;B1={debugOrdering:i};function i(r){var s=e.buildLayerMatrix(r),l=new n({compound:!0,multigraph:!0}).setGraph({});return t.forEach(r.nodes(),function(c){l.setNode(c,{label:c}),l.setParent(c,"layer"+r.node(c).rank)}),t.forEach(r.edges(),function(c){l.setEdge(c.v,c.w,{},c.name)}),t.forEach(s,function(c,u){var h="layer"+u;l.setNode(h,{rank:"same"}),t.reduce(c,function(d,m){return l.setEdge(d,m,{style:"invis"}),m})}),l}return B1}var j1,XD;function IX(){return XD||(XD=1,j1="0.8.5"),j1}var I1,WD;function PX(){return WD||(WD=1,I1={graphlib:Gi(),layout:BX(),debug:jX(),util:{time:Kn().time,notime:Kn().notime},version:IX()}),I1}var HX=PX();const Ah=FS(HX);function Vn(t){if(!t||typeof t!="object")throw new Error("Invalid YAML: Root must be an object");const e={tables:Array.isArray(t.tables)?t.tables:[],relationships:Array.isArray(t.relationships)?t.relationships:[],domains:Array.isArray(t.domains)?t.domains:[],annotations:Array.isArray(t.annotations)?t.annotations:[],layout:t.layout||{}};return e.tables=e.tables.map(n=>{let i=n.sampleData;if(i&&typeof i=="object"&&!Array.isArray(i)){const s=Array.isArray(i.columns)?i.columns:[],l=Array.isArray(i.rows)?i.rows:[];if(s.length>0&&l.length>0){const c=Array.isArray(n.columns)?n.columns:[];i=l.map(u=>c.map(h=>{const d=s.indexOf(h.id);return d!==-1?u[d]:null}))}else l.length>0?i=l:i=[]}const r=n.appearance?{...n.appearance}:void 0;return r&&r.sub_type&&/^type[0-7]$/.test(r.sub_type)&&!r.scd&&(r.scd=r.sub_type,r.sub_type=void 0),{...n,id:n.id||"unknown",name:n.name!==void 0?n.name:n.id||"Unnamed Table",logical_name:n.logical_name,physical_name:n.physical_name,appearance:r,lineage:n.lineage?{...n.lineage}:void 0,columns:Array.isArray(n.columns)?n.columns.map(s=>({...s,logical:s.logical?{...s.logical}:void 0,physical:s.physical?{...s.physical}:void 0})):[],sampleData:Array.isArray(i)?i:[]}}),e}function UX(t){try{const e=Uw.load(t);return Vn(e)}catch(e){throw new Error(`YAML Parsing Error: ${e.message}`)}}let P1=null;const en=aF((t,e)=>({schema:null,selectedTableId:null,selectedEdgeId:null,selectedAnnotationId:null,hoveredColumnId:null,error:null,isCliMode:typeof window<"u"&&window.MODSCAPE_CLI_MODE===!0,isAutoSaveEnabled:!0,savingStatus:"idle",lastUpdateSource:"visual",yamlInput:"",setYamlInput:n=>t({yamlInput:n,lastUpdateSource:"user"}),syncToYamlInput:()=>{const{schema:n}=e();if(n){const i=Uw.dump(n,{indent:2,lineWidth:-1,noRefs:!0});t({yamlInput:i,lastUpdateSource:"visual"})}},availableFiles:[],currentModelSlug:null,isSidebarOpen:!0,isRightPanelOpen:!1,isPresentationMode:!1,activeTab:"editor",activeRightPanelTab:"tables",focusNodeId:null,pathFinderResult:null,showER:!0,showLineage:!0,showAnnotations:!0,connectionStartHandle:null,theme:typeof window<"u"&&localStorage.getItem("modscape-theme")||(window.matchMedia?.("(prefers-color-scheme: light)").matches?"light":"dark"),isDetailPanelSuppressed:!1,isDetailPanelMinimized:!0,setSchema:n=>{try{const i=Vn(n);t({schema:i,error:null}),e().syncToYamlInput()}catch(i){t({error:i.message})}},setShowER:n=>t({showER:n}),setShowLineage:n=>t({showLineage:n}),setShowAnnotations:n=>t({showAnnotations:n}),setIsPresentationMode:n=>t({isPresentationMode:n}),setIsAutoSaveEnabled:n=>t({isAutoSaveEnabled:n}),setLastUpdateSource:n=>t({lastUpdateSource:n}),setSelectedTableId:n=>t({selectedTableId:n,selectedEdgeId:null,selectedAnnotationId:null,isDetailPanelMinimized:n?e().isDetailPanelMinimized:!0}),setSelectedEdgeId:n=>t({selectedEdgeId:n,selectedTableId:null,selectedAnnotationId:null,isDetailPanelMinimized:n?e().isDetailPanelMinimized:!0}),setSelectedAnnotationId:n=>t({selectedAnnotationId:n,selectedTableId:null,selectedEdgeId:null,isDetailPanelMinimized:n?e().isDetailPanelMinimized:!0}),setIsDetailPanelSuppressed:n=>t({isDetailPanelSuppressed:n}),setIsDetailPanelMinimized:n=>t({isDetailPanelMinimized:n}),setHoveredColumnId:n=>t({hoveredColumnId:n}),setIsCliMode:n=>t({isCliMode:n}),setIsSidebarOpen:n=>t({isSidebarOpen:n}),setIsRightPanelOpen:n=>t({isRightPanelOpen:n}),setActiveTab:n=>t({activeTab:n}),setActiveRightPanelTab:n=>t({activeRightPanelTab:n,pathFinderResult:null}),setPathFinderResult:n=>t({pathFinderResult:n}),setFocusNodeId:n=>t({focusNodeId:n}),setConnectionStartHandle:n=>t({connectionStartHandle:n}),toggleTheme:()=>{const{theme:n}=e(),i=n==="dark"?"light":"dark";t({theme:i}),localStorage.setItem("modscape-theme",i)},calculateAutoLayout:()=>{const{schema:n}=e();if(!n)return;const i={...n.layout||{}},r=320,s=220,l=80,c=120,u={};n.domains?.forEach(g=>{const v=g.tables;if(v.length===0){u[g.id]={width:400,height:200,tableOffsets:{}};return}const x=new Ah.graphlib.Graph;x.setGraph({rankdir:"TB",nodesep:l,ranksep:l}),x.setDefaultEdgeLabel(()=>({})),v.forEach(T=>{const N=n.layout?.[T];x.setNode(T,{width:N?.width||r,height:N?.height||s})}),(n.relationships||[]).forEach(T=>{v.includes(T.from.table)&&v.includes(T.to.table)&&x.setEdge(T.from.table,T.to.table)}),n.tables.forEach(T=>{v.includes(T.id)&&T.lineage?.upstream&&T.lineage.upstream.forEach(N=>{v.includes(N)&&x.setEdge(N,T.id)})}),Ah.layout(x);let w=1/0,C=1/0,k=-1/0,A=-1/0;const O={};x.nodes().forEach(T=>{const N=x.node(T);O[T]={x:N.x,y:N.y},w=Math.min(w,N.x-N.width/2),C=Math.min(C,N.y-N.height/2),k=Math.max(k,N.x+N.width/2),A=Math.max(A,N.y+N.height/2)});const E=k-w+c,M=A-C+c;v.forEach(T=>{O[T].x=Math.round(O[T].x-w-x.node(T).width/2+c/2),O[T].y=Math.round(O[T].y-C-x.node(T).height/2+c/2)}),u[g.id]={width:E,height:M,tableOffsets:O}});const h=[...n.domains?.map(g=>g.id)||[],...n.tables.filter(g=>!n.domains?.some(v=>v.tables.includes(g.id))).map(g=>g.id)],d=new Ah.graphlib.Graph;d.setGraph({rankdir:"LR",nodesep:200,ranksep:300}),d.setDefaultEdgeLabel(()=>({})),h.forEach(g=>{const v=n.domains?.some(C=>C.id===g),x=v?u[g].width:n.layout?.[g]?.width||r,w=v?u[g].height:n.layout?.[g]?.height||s;d.setNode(g,{width:x,height:w})});const m=g=>n.domains?.find(v=>v.tables.includes(g))?.id||g;n.relationships?.forEach(g=>{const v=m(g.from.table),x=m(g.to.table);v!==x&&d.setEdge(v,x)}),n.tables.forEach(g=>{if(g.lineage?.upstream){const v=m(g.id);g.lineage.upstream.forEach(x=>{const w=m(x);w!==v&&d.setEdge(w,v)})}}),Ah.layout(d),d.nodes().forEach(g=>{const v=d.node(g),x=Math.round(v.x-v.width/2),w=Math.round(v.y-v.height/2),C=n.domains?.find(k=>k.id===g);C?(i[g]={x,y:w,width:u[g].width,height:u[g].height},C.tables.forEach(k=>{i[k]={x:u[g].tableOffsets[k].x,y:u[g].tableOffsets[k].y}})):i[g]={x,y:w}}),t({schema:{...n,layout:i},lastUpdateSource:"visual"}),e().syncToYamlInput(),e().saveSchema(!0)},fetchAvailableFiles:async()=>{const n=window.__MODSCAPE_DATA__;if(n&&n.models){const i=n.models.map(r=>({slug:r.slug,name:r.name,path:""}));t({availableFiles:i});return}try{const r=await(await fetch("/api/files")).json();t({availableFiles:r})}catch(i){console.error("Failed to fetch files:",i)}},setCurrentModel:async n=>{const i=window.__MODSCAPE_DATA__;if(i&&i.models){const r=i.models.find(s=>s.slug===n);if(r){t({currentModelSlug:n,schema:Vn(r.schema),selectedTableId:null,selectedEdgeId:null,selectedAnnotationId:null,error:null}),e().syncToYamlInput();const s=new URLSearchParams(window.location.search);s.set("model",n);const l=window.location.pathname+"?"+s.toString();window.history.pushState(null,"",l)}return}try{const r=`/api/model?model=${n}`,l=await(await fetch(r)).json();t({currentModelSlug:n,schema:Vn(l),selectedTableId:null,selectedEdgeId:null,selectedAnnotationId:null,error:null}),e().syncToYamlInput();const c=new URLSearchParams(window.location.search);c.set("model",n);const u=window.location.pathname+"?"+c.toString();window.history.pushState(null,"",u)}catch(r){console.error("Failed to fetch model:",r)}},parseAndSetSchema:n=>{if(!(!n||n.trim()===""))try{const i=UX(n);t({schema:i,error:null}),e().saveSchema()}catch(i){t({error:i.message})}},updateNodePosition:(n,i,r,s)=>{const l=e().schema;if(!l)return;let c=l.domains||[];s!==void 0&&(c=c.map(d=>({...d,tables:d.tables.filter(m=>m!==n)})),s&&(c=c.map(d=>d.id===s?{...d,tables:Array.from(new Set([...d.tables,n]))}:d)));const u=l.layout?.[n]||{x:0,y:0},h={...l.layout||{},[n]:{...u,x:Math.round(i),y:Math.round(r)}};t({schema:{...l,domains:c,layout:h}}),e().syncToYamlInput(),e().saveSchema()},updateNodesPosition:n=>{const i=e().schema;if(!i||n.length===0)return;const r={...i.layout||{}};n.forEach(s=>{const l=r[s.id]||{x:0,y:0};r[s.id]={...l,x:Math.round(s.x),y:Math.round(s.y)}}),t({schema:{...i,layout:r},lastUpdateSource:"visual"}),e().syncToYamlInput(),e().saveSchema()},updateNodeDimensions:(n,i,r)=>{const s=e().schema;if(!s)return;const l=s.layout?.[n]||{x:0,y:0},c={...s.layout||{},[n]:{...l,width:Math.round(i),height:Math.round(r)}};t({schema:{...s,layout:c}}),e().syncToYamlInput(),e().saveSchema()},saveSchema:async(n=!1)=>{const{schema:i,currentModelSlug:r,isAutoSaveEnabled:s,isCliMode:l}=e();!i||!l||!s&&!n||(t({savingStatus:"saving"}),P1&&clearTimeout(P1),P1=setTimeout(async()=>{try{const c=r?`/api/save?model=${r}`:"/api/save",u=Uw.dump(i,{indent:2,lineWidth:-1,noRefs:!0});await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:u})}),t({savingStatus:"saved"}),setTimeout(()=>t({savingStatus:"idle"}),2e3)}catch(c){console.error("Failed to save schema:",c),t({savingStatus:"error"})}},500))},refreshModelData:async()=>{const{currentModelSlug:n,isCliMode:i}=e();if(i)try{t({savingStatus:"saving"}),await e().fetchAvailableFiles();let r=n;if(r||(r=new URLSearchParams(window.location.search).get("model")),!r&&e().availableFiles.length>0&&(r=e().availableFiles[0].slug),r){const s=`/api/model?model=${r}`,c=await(await fetch(s)).json(),u=Vn(c);t({schema:u,currentModelSlug:r,error:null}),e().syncToYamlInput()}t({savingStatus:"idle"})}catch(r){console.error("Failed to refresh data:",r),t({error:"Failed to refresh data from server",savingStatus:"error"})}},addTable:(n,i)=>{const r=e().schema||{tables:[],relationships:[],domains:[],layout:{}},s=`new_table_${Date.now()}`,l={id:s,name:"NEW_TABLE",appearance:{type:"table"},columns:[{id:"id",logical:{name:"ID",type:"Integer",isPrimaryKey:!0}}]},c={...r,tables:[...r.tables||[],l],layout:{...r.layout||{},[s]:{x:Math.round(n),y:Math.round(i)}}};t({schema:Vn(c),error:null,selectedTableId:s,selectedEdgeId:null,selectedAnnotationId:null}),e().syncToYamlInput(),e().saveSchema()},addDomain:(n,i)=>{const r=e().schema||{tables:[],relationships:[],domains:[],layout:{}},s=`new_domain_${Date.now()}`,l={id:s,name:"NEW_DOMAIN",description:"Domain purpose",tables:[],color:"rgba(59, 130, 246, 0.05)"},c={...r,domains:[...r.domains||[],l],layout:{...r.layout||{},[s]:{x:Math.round(n),y:Math.round(i),width:600,height:400}}};t({schema:Vn(c),error:null,selectedTableId:s,selectedEdgeId:null,selectedAnnotationId:null}),e().syncToYamlInput(),e().saveSchema()},addRelationship:(n,i,r,s)=>{const l=e().schema;if(!l)return;if(r?.includes("lineage")||s?.includes("lineage")){e().addLineage(n,i);return}let u=n,h=i,d=r,m=s;const g=r?.includes("target"),v=s?.includes("source");(g||v)&&(u=i,h=n,d=s,m=r);const x=(E,M)=>{if(!M)return;const T=M.replace(`${E}-`,"");if(!(T.startsWith("er-")||T.startsWith("lin-")))return T.split("-")[0]||void 0},w=x(u,d),C=x(h,m);if((l.relationships||[]).some(E=>E.from.table===u&&E.from.column===w&&E.to.table===h&&E.to.column===C))return;const A={from:{table:u,column:w},to:{table:h,column:C},type:"one-to-many"},O={...l,relationships:[...l.relationships||[],A]};t({schema:Vn(O)}),e().syncToYamlInput(),e().saveSchema()},addLineage:(n,i)=>{const{schema:r}=e();if(!r)return;const s=r.tables.map(c=>{if(c.id===i){const u=c.lineage?.upstream||[];if(!u.includes(n))return{...c,lineage:{...c.lineage,upstream:[...u,n]}}}return c}),l={...r,tables:s};t({schema:Vn(l)}),e().syncToYamlInput(),e().saveSchema()},updateRelationship:(n,i)=>{const{schema:r}=e();if(!r||!r.relationships)return;const s=r.relationships.map((l,c)=>c===n?{...l,...i}:l);t({schema:{...r,relationships:s}}),e().syncToYamlInput(),e().saveSchema()},removeEdge:(n,i)=>{const{schema:r}=e();if(!r)return;const s=(r.relationships||[]).filter(u=>!(u.from.table===n&&u.to.table===i||u.from.table===i&&u.to.table===n)),l=r.tables.map(u=>u.id===i&&u.lineage?.upstream?{...u,lineage:{...u.lineage,upstream:u.lineage.upstream.filter(h=>h!==n)}}:u),c={...r,relationships:s,tables:l};t({schema:Vn(c),selectedEdgeId:null}),e().syncToYamlInput(),e().saveSchema()},removeNode:n=>{const{schema:i}=e();if(!i)return;const r=i.tables.filter(d=>d.id!==n),s=(i.domains||[]).filter(d=>d.id!==n).map(d=>({...d,tables:d.tables.filter(m=>m!==n)})),l=(i.relationships||[]).filter(d=>d.from.table!==n&&d.to.table!==n),c=(i.annotations||[]).filter(d=>d.id!==n&&d.targetId!==n),u={...i.layout||{}};delete u[n];const h={...i,tables:r,domains:s,relationships:l,annotations:c,layout:u};t({schema:Vn(h),selectedTableId:null,selectedAnnotationId:null}),e().syncToYamlInput(),e().saveSchema()},updateTable:(n,i)=>{const{schema:r}=e();if(!r)return;const s=r.tables.map(c=>c.id===n?{...c,...i}:c),l={...r,tables:s};t({schema:Vn(l)}),e().syncToYamlInput(),e().saveSchema()},updateDomain:(n,i)=>{const{schema:r}=e();if(!r||!r.domains)return;const s=r.domains.map(c=>c.id===n?{...c,...i}:c),l={...r,domains:s};t({schema:Vn(l)}),e().syncToYamlInput(),e().saveSchema()},toggleDomainLock:n=>{const{schema:i}=e();if(!i||!i.domains)return;const r=i.domains.map(s=>s.id===n?{...s,isLocked:!s.isLocked}:s);t({schema:{...i,domains:r}}),e().syncToYamlInput(),e().saveSchema()},assignTableToDomain:(n,i)=>{const{schema:r}=e();if(!r)return;const s=(r.domains||[]).map(c=>{const u=c.tables.filter(h=>h!==n);return c.id===i?{...c,tables:Array.from(new Set([...u,n]))}:{...c,tables:u}}),l={...r.layout||{},[n]:{x:20,y:20}};t({schema:{...r,domains:s,layout:l}}),e().syncToYamlInput(),e().saveSchema()},toggleTableSelection:n=>{const{selectedTableId:i,isDetailPanelMinimized:r}=e();t(i===n?{selectedTableId:null,isDetailPanelMinimized:!0}:{selectedTableId:n,selectedEdgeId:null,selectedAnnotationId:null,isDetailPanelMinimized:r})},toggleEdgeSelection:n=>{const{selectedEdgeId:i,isDetailPanelMinimized:r}=e();t(i===n?{selectedEdgeId:null,isDetailPanelMinimized:!0}:{selectedEdgeId:n,selectedTableId:null,selectedAnnotationId:null,isDetailPanelMinimized:r})},toggleAnnotationSelection:n=>{const{selectedAnnotationId:i,isDetailPanelMinimized:r}=e();t(i===n?{selectedAnnotationId:null,isDetailPanelMinimized:!0}:{selectedAnnotationId:n,selectedTableId:null,selectedEdgeId:null,isDetailPanelMinimized:r})},addAnnotation:(n,i,r)=>{const{schema:s}=e();if(!s)return;const l=`note_${Date.now()}`,c={id:l,targetId:i,targetType:r,text:"New Note",type:"sticky",offset:n},u={...s,annotations:[...s.annotations||[],c]};t({schema:Vn(u),selectedAnnotationId:l,selectedTableId:null,selectedEdgeId:null}),i||e().setFocusNodeId(l),e().syncToYamlInput(),e().saveSchema()},updateAnnotation:(n,i)=>{const{schema:r}=e();if(!r||!r.annotations)return;const s=r.annotations.map(l=>l.id===n?{...l,...i}:l);t({schema:{...r,annotations:s}}),e().syncToYamlInput(),e().saveSchema()},removeAnnotation:n=>{const{schema:i}=e();if(!i||!i.annotations)return;const r=i.annotations.filter(s=>s.id!==n);t({schema:{...i,annotations:r},selectedAnnotationId:null}),e().syncToYamlInput(),e().saveSchema()},getSelectedTable:()=>{const{schema:n,selectedTableId:i}=e();return!n||!i?null:n.tables.find(r=>r.id===i)||null},getSelectedDomain:()=>{const{schema:n,selectedTableId:i}=e();return!n||!i||!n.domains?null:n.domains.find(r=>r.id===i)||null},getSelectedRelationship:()=>{const{schema:n,selectedEdgeId:i}=e();if(!n||!i)return null;if(i.startsWith("lin-")){const l=i.split("-"),c=l[1],u=l[2];return{relationship:{from:{table:c},to:{table:u},type:"lineage"},index:-1}}if(!i.startsWith("e-"))return null;const r=parseInt(i.split("-")[1]),s=n.relationships[r];return s?{relationship:s,index:r}:null},getSelectedAnnotation:()=>{const{schema:n,selectedAnnotationId:i}=e();return!n||!i||!n.annotations?null:n.annotations.find(r=>r.id===i)||null}})),VX={fact:{color:"#f87171",icon:"📊",label:"FACT"},dimension:{color:"#60a5fa",icon:"🏷️",label:"DIM"},hub:{color:"#fbbf24",icon:"🌐",label:"HUB"},link:{color:"#34d399",icon:"🔗",label:"LINK"},satellite:{color:"#a78bfa",icon:"🛰️",label:"SAT"},mart:{color:"#f5700b",icon:"📈",label:"MART"},table:{color:"#64748b",icon:"📋",label:"TABLE"}},FX=({id:t,data:e,selected:n})=>{const{table:i}=e,[r,s]=Y.useState(!0),l=LV();Y.useEffect(()=>{l(t);const P=setTimeout(()=>s(!1),1e3);return()=>clearTimeout(P)},[t,i.name,i.logical_name,i.physical_name,i.columns,l]);const{updateNodeDimensions:c,hoveredColumnId:u,showER:h,showLineage:d,connectionStartHandle:m,theme:g,isPresentationMode:v,selectedTableId:x,selectedAnnotationId:w,toggleTableSelection:C}=en(),k=n,O=v&&!!(x||w)&&!k,E=i.columns&&i.columns.length>0,M=h&&d,T=i.appearance?.type?VX[i.appearance.type]:null,N=i.appearance?.color||T?.color||"#334155",I=i.appearance?.icon||T?.icon||"";let q=T?.label||"";const H=i.appearance?.sub_type,B=i.appearance?.scd;if(i.appearance?.type==="fact"&&H?q=`FACT (${{transaction:"Trans.",periodic:"Periodic",accumulating:"Accum.",factless:"Factless"}[H]||H})`:i.appearance?.type&&H?q=`${i.appearance.type.toUpperCase()} (${H})`:i.appearance?.type&&(q=i.appearance.type.toUpperCase()),B){const P=`SCD ${B.replace("type","T")}`;q=q?`${q} / ${P}`:P}const $=(P,L)=>{c(t,L.width,L.height)},V=(P,L)=>{if(!m)return"";const Q=m.nodeId===t,Z=m.handleType,U=!m.handleId?.includes("lin-");return Q||L!==U?"handle-dim":Z==="source"&&P==="target"||Z==="target"&&P==="source"?"handle-pulse":"handle-dim"},D=(P,L)=>M&&L?{background:"#ef4444",cursor:"not-allowed",border:"1px solid #7f1d1d"}:{background:P,cursor:"crosshair"};return S.jsxs("div",{className:r?"animate-creation":"",style:{width:"100%",height:"100%",minWidth:"220px",position:"relative",cursor:"default",opacity:O?.3:1,zIndex:k?50:0,transition:"opacity 0.5s ease-in-out, z-index 0.3s"},children:[S.jsx(DL,{color:"#3b82f6",isVisible:k,minWidth:220,minHeight:40,onResizeEnd:$,handleStyle:{width:12,height:12,borderRadius:"50%",backgroundColor:"#3b82f6",border:"2px solid #ffffff",zIndex:100}}),q&&S.jsx("div",{style:{position:"absolute",top:"-12px",left:"12px",height:"14px",padding:"0 6px",backgroundColor:N,color:"#ffffff",fontSize:"8px",fontWeight:900,borderRadius:"4px 4px 0 0",display:"flex",alignItems:"center",justifyContent:"center",textTransform:"uppercase",letterSpacing:"0.05em",boxShadow:"0 -2px 4px rgba(0,0,0,0.1)",zIndex:1},children:q}),S.jsx(Pi,{type:"target",position:Te.Top,id:`${t}-er-target-top`,className:V("target",!0),style:{...D(g==="dark"?"#94a3b8":"#64748b",h),width:"8px",height:"8px",zIndex:10,opacity:h?1:0,pointerEvents:h?"all":"none"}}),S.jsx(Pi,{type:"target",position:Te.Left,id:`${t}-lin-target-left`,className:V("target",!1),style:{...D("#3b82f6",d),top:"50%",left:"-4px",width:"10px",height:"10px",zIndex:20,opacity:d?1:0,pointerEvents:d?"all":"none"}}),S.jsx(Pi,{type:"source",position:Te.Right,id:`${t}-lin-source-right`,className:V("source",!1),style:{...D("#3b82f6",d),top:"50%",right:"-4px",width:"10px",height:"10px",zIndex:20,opacity:d?1:0,pointerEvents:d?"all":"none"}}),S.jsxs("div",{style:{width:"100%",height:"100%",backgroundColor:"var(--node-bg)",borderLeft:`2px solid ${k?"#3b82f6":"var(--border-main)"}`,borderRight:`2px solid ${k?"#3b82f6":"var(--border-main)"}`,borderBottom:`2px solid ${k?"#3b82f6":"var(--border-main)"}`,borderTop:`4px solid ${N}`,borderRadius:"8px",overflow:"hidden",color:"var(--text-primary)",boxShadow:k?"0 0 0 4px rgba(59, 130, 246, 0.2)":g==="dark"?"0 4px 6px -1px rgba(0, 0, 0, 0.3)":"0 4px 12px -2px rgba(0, 0, 0, 0.1)",fontFamily:"sans-serif",display:"flex",flexDirection:"column",transition:"background-color 0.3s, border-color 0.3s, color 0.3s"},children:[S.jsxs("div",{className:"table-drag-handle",onClick:P=>{P.stopPropagation(),C(t)},onDoubleClick:P=>{P.stopPropagation(),P.preventDefault()},style:{padding:"12px",backgroundColor:g==="dark"?"rgba(15, 23, 42, 0.8)":"rgba(241, 245, 249, 0.9)",borderBottom:E?"1px solid var(--border-main)":"none",flexShrink:0,cursor:"grab",display:"flex",flexDirection:"column",gap:"2px"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[I&&S.jsx("span",{style:{fontSize:"18px"},children:I}),S.jsx("div",{style:{fontSize:"16px",fontWeight:800,color:"var(--text-primary)",lineHeight:"1.2",wordBreak:"break-all"},children:i.name})]}),i.logical_name&&i.logical_name!==i.name&&S.jsx("div",{style:{fontSize:"11px",fontWeight:500,color:"var(--text-secondary)",paddingLeft:I?"26px":"0",opacity:.8},children:i.logical_name}),S.jsx("div",{title:i.physical_name||i.id,style:{fontSize:"9px",color:g==="dark"?"#94a3b8":"#64748b",fontFamily:"monospace",letterSpacing:"0.02em",paddingLeft:I?"26px":"0",marginTop:"2px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},children:i.physical_name||i.id})]}),E&&S.jsx("div",{className:"nodrag",style:{padding:"0",overflowY:"auto",flex:1,cursor:"default"},children:S.jsx("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"11px"},children:S.jsx("tbody",{children:i.columns.map((P,L)=>{const Q=P.logical?.name||P.id,Z=P.physical?.name||P.id,U=Q!==Z;return S.jsxs("tr",{className:"column-row",style:{borderBottom:"1px solid var(--border-main)",backgroundColor:u===P.id?g==="dark"?"rgba(30, 58, 138, 0.6)":"rgba(191, 219, 254, 0.4)":"transparent",position:"relative"},children:[S.jsxs("td",{style:{padding:"6px 12px",fontWeight:500,color:"var(--text-primary)",position:"relative"},children:[S.jsx(Pi,{type:"target",position:Te.Left,id:`${t}-${P.id}-er-target-left`,className:`column-handle ${V("target",!0)}`,style:{...D("#3b82f6",h),left:"-4px",opacity:0,pointerEvents:h?"all":"none"}}),S.jsxs("div",{style:{display:"flex",alignItems:"flex-start"},children:[S.jsxs("span",{style:{color:"var(--text-secondary)",marginRight:"6px",fontSize:"9px",fontFamily:"monospace",width:"14px",textAlign:"right",opacity:.6,marginTop:"2px"},children:[L+1,"."]}),S.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[S.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[P.logical?.isPrimaryKey&&S.jsx("span",{style:{color:"#eab308"},children:"🔑"}),P.logical?.isForeignKey&&S.jsx("span",{style:{opacity:.8},children:"🔩"}),P.logical?.isPartitionKey&&S.jsx("span",{style:{opacity:.8},children:"📂"}),P.logical?.isMetadata&&S.jsx("span",{style:{opacity:.8},title:"Metadata/Audit Column",children:"🕒"}),P.logical?.additivity==="fully"&&S.jsx("span",{style:{color:"#4ade80"},title:"Fully Additive",children:"Σ"}),P.logical?.additivity==="semi"&&S.jsx("span",{style:{color:"#fbbf24"},title:"Semi-Additive",children:"Σ~"}),P.logical?.additivity==="non"&&S.jsx("span",{style:{color:"#f87171"},title:"Non-Additive",children:"⊘"}),S.jsx("span",{className:"truncate",title:Q,children:Q})]}),U&&S.jsx("div",{style:{fontSize:"8px",fontFamily:"monospace",opacity:.6,marginTop:"1px",paddingLeft:"2px"},className:"truncate",title:Z,children:Z})]})]})]}),S.jsxs("td",{style:{padding:"6px 12px",textAlign:"right",fontStyle:"italic",color:"var(--text-secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"120px",position:"relative",verticalAlign:"top",opacity:.8},children:[P.logical?.type||"Unknown",S.jsx(Pi,{type:"source",position:Te.Right,id:`${t}-${P.id}-er-source-right`,className:`column-handle ${V("source",!0)}`,style:{...D("#3b82f6",h),right:"-4px",opacity:0,pointerEvents:h?"all":"none"}})]})]},P.id)})})})})]}),S.jsx(Pi,{type:"source",position:Te.Bottom,id:`${t}-er-source-bottom`,className:V("source",!0),style:{...D(g==="dark"?"#94a3b8":"#64748b",h),width:"8px",height:"8px",zIndex:10,opacity:h?1:0,pointerEvents:h?"all":"none"}})]})},$X=Y.memo(FX);const wz=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim();const GX=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const YX=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase());const KD=t=>{const e=YX(t);return e.charAt(0).toUpperCase()+e.slice(1)};var QX={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const XX=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const WX=Y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:s,iconNode:l,...c},u)=>Y.createElement("svg",{ref:u,...QX,width:e,height:e,stroke:t,strokeWidth:i?Number(n)*24/Number(e):n,className:wz("lucide",r),...!s&&!XX(c)&&{"aria-hidden":"true"},...c},[...l.map(([h,d])=>Y.createElement(h,d)),...Array.isArray(s)?s:[s]]));const Xe=(t,e)=>{const n=Y.forwardRef(({className:i,...r},s)=>Y.createElement(WX,{ref:s,iconNode:e,className:wz(`lucide-${GX(KD(t))}`,`lucide-${t}`,i),...r}));return n.displayName=KD(t),n};const KX=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],ed=Xe("arrow-up-right",KX);const ZX=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],JX=Xe("camera",ZX);const eW=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],tW=Xe("check",eW);const nW=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qa=Xe("chevron-down",nW);const iW=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Sz=Xe("chevron-left",iW);const rW=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vw=Xe("chevron-right",rW);const sW=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],aW=Xe("chevron-up",sW);const lW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],td=Xe("circle-alert",lW);const oW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],cW=Xe("circle-check",oW);const uW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Cz=Xe("circle-question-mark",uW);const fW=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],hW=Xe("command",fW);const dW=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Ba=Xe("database",dW);const pW=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],z2=Xe("git-graph",pW);const mW=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],gW=Xe("grid-3x3",mW);const yW=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],vW=Xe("grip-vertical",yW);const bW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],xW=Xe("info",bW);const wW=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],SW=Xe("layout-template",wW);const CW=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],kW=Xe("link",CW);const AW=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],_W=Xe("list-tree",AW);const OW=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],EW=Xe("loader-circle",OW);const TW=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],MW=Xe("lock-open",TW);const NW=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],RW=Xe("lock",NW);const DW=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],kz=Xe("message-square",DW);const LW=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],zW=Xe("moon",LW);const qW=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],BW=Xe("network",qW);const jW=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],Az=Xe("panels-top-left",jW);const IW=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],PW=Xe("play",IW);const HW=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Fw=Xe("plus",HW);const UW=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],VW=Xe("redo-2",UW);const FW=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],$W=Xe("route",FW);const GW=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],q2=Xe("search",GW);const YW=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],QW=Xe("sun",YW);const XW=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],ZD=Xe("table",XW);const WW=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],ko=Xe("tag",WW);const KW=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],_d=Xe("trash-2",KW);const ZW=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],JW=Xe("undo-2",ZW);const eK=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],tK=Xe("unlink",eK);const nK=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Vu=Xe("x",nK),iK=({id:t,data:e,selected:n})=>{const[i,r]=Y.useState(!0);Y.useEffect(()=>{const M=setTimeout(()=>r(!1),1e3);return()=>clearTimeout(M)},[]);const{updateNodeDimensions:s,theme:l,toggleDomainLock:c,isPresentationMode:u,selectedTableId:h,selectedAnnotationId:d}=en(),m=n,v=u&&!!(h||d)&&!m,x=e.isLocked,w=e.color||"#3b82f6",C=l==="dark"?"rgba(15, 23, 42, 0.98)":"rgba(255, 255, 255, 0.98)",k=w,O=w.startsWith("rgba")||w.startsWith("hsla")||w.startsWith("#")&&w.length>7?1:.5,E=(M,T)=>{s(t,T.width,T.height)};return S.jsxs("div",{className:i?"animate-creation":"",style:{width:"100%",height:"100%",border:x?`2px solid ${l==="dark"?"#334155":"#cbd5e1"}`:`2px dashed ${m?"#3b82f6":l==="dark"?"#334155":"#cbd5e1"}`,borderRadius:"12px",padding:"10px",position:"relative",color:"var(--text-secondary)",cursor:"default",transition:"border-color 0.3s, opacity 0.5s ease-in-out, z-index 0.3s",opacity:v?.2:x?.8:1,zIndex:m?40:-1},children:[!x&&S.jsx(DL,{color:"#3b82f6",isVisible:m,minWidth:200,minHeight:150,onResizeEnd:E,handleStyle:{width:14,height:14,borderRadius:"50%",backgroundColor:"#3b82f6",border:"2px solid #ffffff",zIndex:100}}),S.jsx("div",{style:{position:"absolute",inset:0,backgroundColor:w,opacity:O,borderRadius:"10px",zIndex:-1,cursor:"default"}}),S.jsxs("div",{className:x?"domain-locked-handle":"domain-drag-handle",style:{position:"absolute",top:"-30px",left:"0",fontSize:"13px",fontWeight:"bold",color:l==="dark"?"#f1f5f9":"#0f172a",whiteSpace:"nowrap",pointerEvents:"all",cursor:x?"default":"grab",padding:"4px 12px 4px 10px",backgroundColor:C,borderRadius:"6px 6px 0 0",border:`1px solid ${m?"#3b82f6":l==="dark"?"#334155":"#cbd5e1"}`,borderLeft:`4px solid ${k}`,borderBottom:"none",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"8px",boxShadow:l==="dark"?"0 -4px 12px rgba(0,0,0,0.4)":"0 -2px 8px rgba(0,0,0,0.08)",zIndex:10},children:[!x&&S.jsx(vW,{size:14,className:l==="dark"?"text-slate-400":"text-slate-500"}),S.jsx("span",{className:"truncate max-w-[200px]",children:e.label}),S.jsx("div",{className:`w-px h-3 mx-1 ${l==="dark"?"bg-slate-700":"bg-slate-200"}`}),S.jsx("button",{onClick:M=>{M.stopPropagation(),c(t)},className:`p-0.5 rounded transition-colors ${x?"text-amber-500 hover:text-amber-400":"text-slate-400 hover:text-blue-500"}`,title:x?"Unlock Domain":"Lock Domain",children:x?S.jsx(RW,{size:12}):S.jsx(MW,{size:12})})]})]})},rK=Y.memo(iK),JD=new Set,sK=(t,e)=>{let n=0,i=0,r=0;if(t.startsWith("#"))t.length===4?(n=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16),r=parseInt(t[3]+t[3],16)):(n=parseInt(t.substring(1,3),16),i=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16));else if(t.startsWith("rgba")||t.startsWith("rgb")){const l=t.match(/\d+/g);l&&(n=parseInt(l[0]),i=parseInt(l[1]),r=parseInt(l[2]))}else return e==="dark"?"#f1f5f9":"#1e293b";return(.299*n+.587*i+.114*r)/255>.55?"#1e293b":"#ffffff"},aK=({id:t,data:e,selected:n})=>{const{annotation:i}=e,{updateAnnotation:r,removeAnnotation:s,theme:l,isPresentationMode:c,selectedTableId:u,selectedAnnotationId:h}=en(),[d,m]=Y.useState(!1),[g,v]=Y.useState(i.text),[x,w]=Y.useState(!JD.has(t)),C=Y.useMemo(()=>(t.split("").reduce((H,B)=>H+B.charCodeAt(0),0)%30-15)/10,[t]);Y.useEffect(()=>{v(i.text)},[i.text]),Y.useEffect(()=>{if(x){JD.add(t);const q=setTimeout(()=>w(!1),1e3);return()=>clearTimeout(q)}},[t,x]);const k=()=>{m(!1),g!==i.text&&r(i.id,{text:g})},A=q=>{q.stopPropagation(),s(i.id)},O=i.color||(l==="dark"?"#334155":"#fef3c7"),E=sK(O,l),M=n?"#3b82f6":"transparent",T=n,I=c&&!!(u||h)&&!T;return S.jsxs("div",{className:`relative group ${x?"animate-creation":""}`,style:{padding:"12px 12px 20px 12px",backgroundColor:O,borderRadius:"2px",border:`2px solid ${M}`,boxShadow:n?"0 0 0 4px rgba(59, 130, 246, 0.2), 0 10px 15px -3px rgba(0, 0, 0, 0.1)":"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",minWidth:"140px",maxWidth:"280px",transform:`rotate(${C}deg)`,transition:"background-color 0.3s, color 0.3s, opacity 0.5s ease-in-out, border-color 0.2s",cursor:d?"text":"grab",color:E,opacity:I?.2:1,zIndex:T?50:0},onDoubleClick:()=>m(!0),children:[S.jsx(Pi,{type:"source",position:Te.Top,id:`${t}-source`,style:{background:"transparent",border:"none",top:"50%",left:"50%",pointerEvents:"none"}}),S.jsx("div",{className:`absolute -top-10 right-0 gap-1 shadow-xl border rounded-lg p-1 z-10 animate-in fade-in zoom-in duration-200 ${n?"flex":"hidden group-hover:flex"} ${l==="dark"?"bg-slate-800 border-slate-700":"bg-white border-slate-200"}`,children:S.jsx("button",{onClick:A,className:`p-1.5 rounded-md transition-colors ${l==="dark"?"hover:bg-red-500/20 text-slate-400 hover:text-red-400":"hover:bg-red-50 text-slate-400 hover:text-red-500"}`,title:"Delete Annotation",children:S.jsx(_d,{size:14})})}),S.jsx("div",{className:"custom-scrollbar sidebar-content",style:{maxHeight:"240px",overflowY:"auto",paddingRight:"4px"},children:d?S.jsx("textarea",{autoFocus:!0,value:g,onChange:q=>v(q.target.value),onBlur:k,className:"w-full bg-transparent border-none outline-none resize-none font-sans text-sm leading-relaxed",style:{height:"auto",minHeight:"80px",color:"inherit"}}):S.jsx("div",{className:"font-sans text-sm leading-relaxed whitespace-pre-wrap break-words pr-1",children:i.text||S.jsx("span",{className:"opacity-40 italic",children:"Double-click to edit..."})})}),S.jsx("div",{className:"absolute bottom-0 right-0 w-6 h-6 pointer-events-none",style:{background:"linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.05) 50%, rgba(0,0,0,0.1) 100%)"},children:S.jsx("div",{style:{position:"absolute",bottom:0,right:0,width:"100%",height:"100%",background:`linear-gradient(225deg, transparent 50%, ${l==="dark"?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.03)"} 50%)`,clipPath:"polygon(100% 0, 0 100%, 100% 100%)"}})})]})},lK=Y.memo(aK),e3={fact:{color:"#f87171",icon:"📊",label:"FACT"},dimension:{color:"#60a5fa",icon:"🏷️",label:"DIM"},hub:{color:"#fbbf24",icon:"🌐",label:"HUB"},link:{color:"#34d399",icon:"🔗",label:"LINK"},satellite:{color:"#a78bfa",icon:"🛰️",label:"SAT"},mart:{color:"#f5700b",icon:"📈",label:"MART"},table:{color:"#64748b",icon:"📋",label:"TABLE"}},oK=()=>{const{schema:t,getSelectedTable:e,getSelectedDomain:n,getSelectedRelationship:i,getSelectedAnnotation:r,updateTable:s,updateDomain:l,updateRelationship:c,updateAnnotation:u,assignTableToDomain:h,theme:d,isDetailPanelSuppressed:m,isDetailPanelMinimized:g,setIsDetailPanelMinimized:v}=en(),x=e(),w=n(),C=i(),k=r(),[A,O]=Y.useState("conceptual"),[E,M]=Y.useState(""),[T,N]=Y.useState(400),[I,q]=Y.useState(!1);if(Y.useEffect(()=>{if(!I)return;const X=Se=>{const ye=window.innerHeight-Se.clientY;N(Math.max(150,Math.min(ye,window.innerHeight*.9)))},pe=()=>{q(!1),document.body.style.cursor="default"};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",pe),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",pe)}},[I]),m)return null;const H=X=>{X.preventDefault(),q(!0),document.body.style.cursor="ns-resize"},B=X=>{X.stopPropagation()},$={height:`${T}px`,maxHeight:"90vh",minHeight:"150px",backgroundColor:"var(--node-bg)",borderTop:`2px solid ${d==="dark"?"#3b82f6":"#60a5fa"}`,display:"flex",flexDirection:"column",color:"var(--text-primary)",boxShadow:d==="dark"?"0 -10px 25px -5px rgba(0, 0, 0, 0.4)":"0 -4px 12px rgba(0, 0, 0, 0.05)",fontFamily:"sans-serif",position:"relative",transition:"background-color 0.3s, color 0.3s"};if(g){const X=x?.name||w?.name||(C?`${C.relationship.from.table} → ${C.relationship.to.table}`:null)||k?.text?.substring(0,20),pe=!!X;let Se=d==="dark"?"#334155":"#e2e8f0";if(x){const ye=x.appearance?.type?e3[x.appearance.type]:null;Se=x.appearance?.color||ye?.color||Se}else w?Se=w.color||Se:k&&(Se=k.color||"#f59e0b");return S.jsxs("div",{className:`shadow-2xl z-50 flex items-center justify-between px-6 transition-all border-t-2 ${pe?"cursor-pointer hover:bg-slate-50 dark:hover:bg-slate-900":"cursor-default opacity-80"}`,onClick:ye=>{pe&&(ye.stopPropagation(),v(!1))},onMouseDown:B,onPointerDown:B,style:{height:"40px",backgroundColor:"var(--node-bg)",borderColor:Se,color:"var(--text-primary)"},children:[S.jsx("div",{className:"flex items-center gap-3 overflow-hidden flex-1",children:S.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-slate-500 whitespace-nowrap",children:pe?`Selected: ${X}`:"Select an object on the canvas to view its details"})}),S.jsx("div",{className:"flex items-center gap-4",children:pe&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"text-[10px] font-medium text-slate-400 italic hidden sm:block",children:"Click to expand"}),S.jsx("button",{className:`p-1 rounded-full transition-colors ${d==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,children:S.jsx(aW,{size:18,style:{color:Se}})})]})})]})}const V=X=>{s(x.id,X)};if(k)return S.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:B,onMouseDown:B,onPointerDown:B,style:{...$,borderTopColor:k.color||"#f59e0b"},children:[S.jsx("div",{onMouseDown:H,style:{position:"absolute",top:"-4px",left:0,right:0,height:"8px",cursor:"ns-resize",zIndex:60}}),S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[S.jsx(ko,{size:18,style:{color:k.color||"#f59e0b"}}),S.jsxs("div",{style:{flex:1},children:[S.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:S.jsx("span",{style:{fontSize:"14px",fontWeight:"bold"},children:"Annotation"})}),S.jsx("p",{style:{fontSize:"11px",color:"var(--text-secondary)",textTransform:"uppercase",margin:0},children:k.targetId?`Sticky to ${k.targetId} (${k.targetType})`:"Floating Note"})]})]}),S.jsx("div",{className:"flex items-center gap-1",children:S.jsx("button",{onClick:()=>v(!0),className:`p-1.5 rounded-full transition-colors ${d==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,title:"Minimize Details",children:S.jsx(qa,{size:18})})})]}),S.jsx("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:S.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Note Content"}),S.jsx("textarea",{value:k.text||"",onChange:X=>u(k.id,{text:X.target.value}),style:{width:"100%",minHeight:"100px",backgroundColor:d==="dark"?"#0f172a":"#ffffff",border:"1px solid var(--border-main)",borderRadius:"6px",padding:"12px",color:"var(--text-primary)",fontSize:"13px",lineHeight:"1.6",resize:"none",outline:"none"}})]}),S.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Target Binding"}),S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("div",{className:"flex gap-2",children:[S.jsxs("select",{value:k.targetId||"",onChange:X=>{const pe=X.target.value;if(!pe)u(k.id,{targetId:void 0,targetType:void 0});else{const Se=t?.tables.some(ye=>ye.id===pe);u(k.id,{targetId:pe,targetType:Se?"table":"domain",offset:{x:50,y:-50}})}},className:`flex-1 border rounded text-xs p-2 outline-none ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300":"bg-white border-slate-200 text-slate-900"}`,children:[S.jsx("option",{value:"",children:"- Floating (No Target) -"}),S.jsx("optgroup",{label:"Tables",children:t?.tables.map(X=>S.jsxs("option",{value:X.id,children:[X.name," (",X.id,")"]},X.id))}),S.jsx("optgroup",{label:"Domains",children:t?.domains?.map(X=>S.jsxs("option",{value:X.id,children:[X.name," (",X.id,")"]},X.id))})]}),k.targetId?S.jsx("button",{onClick:()=>u(k.id,{targetId:void 0,targetType:void 0}),className:"p-2 text-red-500 hover:bg-red-50 rounded border border-red-100",title:"Unbind Target",children:S.jsx(tK,{size:14})}):S.jsx("div",{className:"p-2 text-slate-300 border border-slate-100 rounded",children:S.jsx(kW,{size:14})})]}),S.jsx("p",{className:"text-[10px] text-slate-400 italic",children:'Bind to a table to make the note "stick" when moving.'})]})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Note Color"}),S.jsx("div",{className:"flex flex-col gap-3",children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("input",{type:"color",value:k.color||(d==="dark"?"#334155":"#fef3c7"),onChange:X=>u(k.id,{color:X.target.value}),className:"w-8 h-8 p-0 border-none rounded cursor-pointer bg-transparent"}),S.jsx("input",{value:k.color||"",onChange:X=>u(k.id,{color:X.target.value}),placeholder:"e.g. #fef3c7",className:`flex-1 border rounded text-[10px] p-1.5 outline-none font-mono ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300":"bg-white border-slate-200 text-slate-900"}`})]})})]})]})]})})]});if(C){const{relationship:X,index:pe}=C;return S.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:B,onMouseDown:B,onPointerDown:B,style:$,children:[S.jsx("div",{onMouseDown:H,style:{position:"absolute",top:"-4px",left:0,right:0,height:"8px",cursor:"ns-resize",zIndex:60}}),S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[S.jsx(Ba,{size:18,style:{color:"#3b82f6"}}),S.jsxs("div",{style:{flex:1},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[S.jsx("span",{style:{fontSize:"14px",fontWeight:"bold"},children:"Relationship"}),S.jsx("span",{style:{fontSize:"9px",fontWeight:800,padding:"1px 5px",borderRadius:"3px",backgroundColor:"rgba(59, 130, 246, 0.1)",color:"#60a5fa",border:"1px solid rgba(59, 130, 246, 0.2)",textTransform:"uppercase"},children:"EDGE"})]}),S.jsxs("p",{style:{fontSize:"11px",color:"var(--text-secondary)",textTransform:"uppercase",margin:0},children:[X.from.table,X.from.column?`.${X.from.column}`:""," → ",X.to.table,X.to.column?`.${X.to.column}`:""]})]})]}),S.jsx("div",{className:"flex items-center gap-1",children:S.jsx("button",{onClick:()=>v(!0),className:`p-1.5 rounded-full transition-colors ${d==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,title:"Minimize Details",children:S.jsx(qa,{size:18})})})]}),S.jsx("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:S.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[S.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Relationship Type"}),S.jsxs("select",{value:X.type||"one-to-many",onChange:Se=>c(pe,{type:Se.target.value}),className:`w-full border rounded text-sm p-2.5 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-200 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`,children:[S.jsx("option",{value:"one-to-one",children:"One-to-One"}),S.jsx("option",{value:"one-to-many",children:"One-to-Many"}),S.jsx("option",{value:"many-to-one",children:"Many-to-One"}),S.jsx("option",{value:"many-to-many",children:"Many-to-Many"})]})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Cardinality (Metadata)"}),S.jsxs("div",{className:"text-slate-500 text-sm",children:["Mapping established from ",S.jsx("strong",{children:X.from.table})," to ",S.jsx("strong",{children:X.to.table}),"."]})]})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Source/Target Details"}),S.jsxs("div",{className:`flex gap-4 items-center p-3 rounded border ${d==="dark"?"bg-slate-800/50 border-slate-800":"bg-slate-50 border-slate-100"}`,children:[S.jsxs("div",{className:"flex-1",children:[S.jsx("div",{className:"text-[10px] text-slate-500 uppercase",children:"From Table"}),S.jsx("div",{className:`text-sm font-bold ${d==="dark"?"text-blue-400":"text-blue-600"}`,children:X.from.table}),S.jsxs("div",{className:"text-[10px] text-slate-500",children:["Column: ",X.from.column||"(Table level)"]})]}),S.jsx("div",{className:"text-slate-400 dark:text-slate-600",children:"→"}),S.jsxs("div",{className:"flex-1",children:[S.jsx("div",{className:"text-[10px] text-slate-500 uppercase",children:"To Table"}),S.jsx("div",{className:`text-sm font-bold ${d==="dark"?"text-blue-400":"text-blue-600"}`,children:X.to.table}),S.jsxs("div",{className:"text-[10px] text-slate-500",children:["Column: ",X.to.column||"(Table level)"]})]})]})]})]})})]})}if(w)return S.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:B,onMouseDown:B,onPointerDown:B,style:{...$,borderTopColor:w.color||"#3b82f6"},children:[S.jsx("div",{onMouseDown:H,style:{position:"absolute",top:"-4px",left:0,right:0,height:"8px",cursor:"ns-resize",zIndex:60}}),S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[S.jsx(Ba,{size:18,style:{color:w.color||"#3b82f6"}}),S.jsxs("div",{style:{flex:1},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[S.jsx("input",{value:w.name??"",onChange:X=>l(w.id,{name:X.target.value}),onBlur:X=>{X.target.value||l(w.id,{name:"UNNAMED_DOMAIN"})},style:{fontSize:"16px",fontWeight:"bold",color:"var(--text-primary)",backgroundColor:"transparent",border:"none",borderBottom:"1px solid transparent",padding:"2px 0",outline:"none",width:"fit-content",minWidth:"200px"},onFocus:X=>X.target.style.borderBottom="1px solid #3b82f6"}),S.jsx("span",{style:{fontSize:"9px",fontWeight:800,padding:"1px 5px",borderRadius:"3px",backgroundColor:"rgba(59, 130, 246, 0.1)",color:"#60a5fa",border:"1px solid rgba(59, 130, 246, 0.2)",textTransform:"uppercase"},children:"DOMAIN"})]}),S.jsx("p",{style:{fontSize:"11px",color:"var(--text-secondary)",textTransform:"uppercase",margin:0},children:w.id})]})]}),S.jsx("div",{className:"flex items-center gap-1",children:S.jsx("button",{onClick:()=>v(!0),className:`p-1.5 rounded-full transition-colors ${d==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,title:"Minimize Details",children:S.jsx(qa,{size:18})})})]}),S.jsx("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:S.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Domain Description"}),S.jsx("textarea",{value:w.description||"",onChange:X=>l(w.id,{description:X.target.value}),placeholder:"What is the purpose of this domain?",style:{width:"100%",minHeight:"80px",backgroundColor:d==="dark"?"#0f172a":"#ffffff",border:"1px solid var(--border-main)",borderRadius:"6px",padding:"12px",color:"var(--text-primary)",fontSize:"13px",lineHeight:"1.6",resize:"none",outline:"none",transition:"background-color 0.3s"}})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Domain Theme Color"}),S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[S.jsx("input",{type:"color",value:w.color?.startsWith("rgba")?"#3b82f6":w.color||"#3b82f6",onChange:X=>l(w.id,{color:X.target.value}),style:{width:"40px",height:"40px",padding:0,border:"none",borderRadius:"4px",cursor:"pointer",backgroundColor:"transparent"}}),S.jsx("input",{value:w.color||"",onChange:X=>l(w.id,{color:X.target.value}),placeholder:"e.g. #3b82f6 or rgba(...)",className:`border rounded font-mono text-sm p-2 outline-none flex-1 transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`})]})]})]})})]});const D=[{id:"conceptual",label:"Conceptual",icon:S.jsx(ko,{size:14})},{id:"logical",label:"Logical",icon:S.jsx(Ba,{size:14})},{id:"physical",label:"Physical",icon:S.jsx(Ba,{size:14})},{id:"sample",label:"Sample Data",icon:S.jsx(ZD,{size:14})}],P=x.appearance?.type?e3[x.appearance.type]:null,L=x.appearance?.color||P?.color||"#334155",Q=x.appearance?.icon||P?.icon||"";let Z=P?.label||"";const U=x.appearance?.sub_type,re=x.appearance?.scd;if(x.appearance?.type==="fact"&&U?Z=`FACT (${{transaction:"Trans.",periodic:"Periodic",accumulating:"Accum.",factless:"Factless"}[U]||U})`:x.appearance?.type&&U?Z=`${x.appearance.type.toUpperCase()} (${U})`:x.appearance?.type&&(Z=x.appearance.type.toUpperCase()),re){const X=`SCD ${re.replace("type","T")}`;Z=Z?`${Z} / ${X}`:X}const z=X=>{X.stopPropagation();const pe={id:`col_${Date.now()}`,logical:{name:"New Column",type:"String",description:""},physical:{name:"",type:"VARCHAR(255)",constraints:[]}};V({columns:[...x.columns||[],pe]})},G=(X,pe)=>{X.stopPropagation();const Se=x.columns?.filter(ye=>ye.id!==pe)||[];V({columns:Se})},te=(X,pe)=>{const Se=x.columns?.map(ye=>ye.id===X?{...ye,logical:{name:ye.logical?.name||ye.id,type:ye.logical?.type||"String",...ye.logical,...pe}}:ye)||[];V({columns:Se})},j=(X,pe)=>{const Se=x.columns?.map(ye=>ye.id===X?{...ye,physical:{...ye.physical,...pe}}:ye)||[];V({columns:Se})},K=X=>{if(X.key==="Enter"&&E.trim()){const pe=x.conceptual?.tags||[];pe.includes(E.trim())||V({conceptual:{...x.conceptual,tags:[...pe,E.trim()]}}),M("")}},ee=(X,pe)=>{X.stopPropagation();const Se=x.conceptual?.tags||[];V({conceptual:{...x.conceptual,tags:Se.filter(ye=>ye!==pe)}})},oe=X=>{V({sampleData:X})},ge=X=>{X.stopPropagation();const pe=x.sampleData||[],Se=x.columns?.length||0,ye=new Array(Se).fill("");oe([...pe,ye])},xe=(X,pe)=>{X.stopPropagation();const ye=(x.sampleData||[]).filter((_e,ot)=>ot!==pe);oe(ye)},Me=(X,pe,Se)=>{const ye=[...x.sampleData||[]];if(!ye[X])return;const _e=[...ye[X]];_e[pe]=Se,ye[X]=_e,oe(ye)};return S.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:B,onMouseDown:B,onPointerDown:B,style:{...$,borderTopColor:L},children:[S.jsx("div",{onMouseDown:H,style:{position:"absolute",top:"-4px",left:0,right:0,height:"8px",cursor:"ns-resize",zIndex:60}}),S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[S.jsxs("div",{style:{flex:1},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[Q&&S.jsx("span",{style:{fontSize:"16px"},children:Q}),S.jsx("span",{style:{fontSize:"11px",color:"var(--text-secondary)",textTransform:"uppercase",fontFamily:"monospace",letterSpacing:"0.05em"},children:x.id}),Z&&S.jsx("span",{style:{fontSize:"9px",fontWeight:800,padding:"1px 5px",borderRadius:"3px",backgroundColor:`${L}30`,color:L,border:`1px solid ${L}50`,textTransform:"uppercase"},children:Z})]}),S.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:S.jsx("input",{value:x.name??"",onChange:X=>V({name:X.target.value}),onBlur:X=>{X.target.value||V({name:"UNNAMED_TABLE"})},title:"Conceptual Table Name",style:{fontSize:"18px",fontWeight:"bold",color:"var(--text-primary)",backgroundColor:"transparent",border:"none",borderBottom:"1px solid transparent",padding:"2px 0",outline:"none",width:"100%",maxWidth:"500px"},onFocus:X=>X.target.style.borderBottom="1px solid #3b82f6"})})]}),S.jsxs("div",{style:{display:"flex",gap:"8px",marginRight:"16px"},children:[S.jsxs("select",{value:x.appearance?.type||"fact",onChange:X=>V({appearance:{...x.appearance,type:X.target.value}}),className:`border rounded text-[10px] px-2 py-1 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400"}`,title:"Table Type",children:[S.jsx("option",{value:"fact",children:"Fact"}),S.jsx("option",{value:"dimension",children:"Dimension"}),S.jsx("option",{value:"mart",children:"Mart"}),S.jsx("option",{value:"table",children:"Table"}),S.jsx("option",{value:"hub",children:"Hub"}),S.jsx("option",{value:"link",children:"Link"}),S.jsx("option",{value:"satellite",children:"Satellite"})]}),S.jsxs("select",{value:x.appearance?.sub_type||"",onChange:X=>V({appearance:{...x.appearance,sub_type:X.target.value||void 0}}),className:`border rounded text-[10px] px-2 py-1 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400"}`,title:"Table Sub-type",children:[S.jsx("option",{value:"",children:"- Sub-type -"}),S.jsx("option",{value:"transaction",children:"Transaction"}),S.jsx("option",{value:"periodic",children:"Periodic Snapshot"}),S.jsx("option",{value:"accumulating",children:"Accumulating Snapshot"}),S.jsx("option",{value:"factless",children:"Factless"}),S.jsx("option",{value:"conformed",children:"Conformed"}),S.jsx("option",{value:"junk",children:"Junk"}),S.jsx("option",{value:"degenerate",children:"Degenerate"})]}),S.jsxs("select",{value:x.appearance?.scd||"",onChange:X=>V({appearance:{...x.appearance,scd:X.target.value||void 0}}),className:`border rounded text-[10px] px-2 py-1 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400"}`,title:"SCD Type",children:[S.jsx("option",{value:"",children:"- SCD Type -"}),S.jsx("option",{value:"type0",children:"SCD Type 0"}),S.jsx("option",{value:"type1",children:"SCD Type 1"}),S.jsx("option",{value:"type2",children:"SCD Type 2"}),S.jsx("option",{value:"type3",children:"SCD Type 3"}),S.jsx("option",{value:"type4",children:"SCD Type 4"}),S.jsx("option",{value:"type5",children:"SCD Type 5"}),S.jsx("option",{value:"type6",children:"SCD Type 6"}),S.jsx("option",{value:"type7",children:"SCD Type 7"})]})]}),S.jsx("div",{className:"flex items-center gap-1",children:S.jsx("button",{onClick:()=>v(!0),className:`p-1.5 rounded-full transition-colors ${d==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,title:"Minimize Details",children:S.jsx(qa,{size:18})})})]}),S.jsx("div",{style:{display:"flex",gap:"24px",padding:"0 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:D.map(X=>S.jsxs("button",{onClick:pe=>{pe.stopPropagation(),O(X.id)},style:{padding:"12px 0",backgroundColor:"transparent",border:"none",borderBottom:A===X.id?"2px solid #3b82f6":"2px solid transparent",color:A===X.id?d==="dark"?"#60a5fa":"#2563eb":"var(--text-secondary)",fontSize:"13px",fontWeight:500,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s"},children:[X.icon," ",X.label]},X.id))}),S.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"15px 20px"},children:[A==="conceptual"&&S.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Description"}),S.jsx("textarea",{value:x.conceptual?.description||"",onChange:X=>V({conceptual:{...x.conceptual,description:X.target.value}}),placeholder:"Enter business description...",style:{width:"100%",minHeight:"100px",backgroundColor:d==="dark"?"#0f172a":"#ffffff",border:"1px solid var(--border-main)",borderRadius:"6px",padding:"12px",color:"var(--text-primary)",fontSize:"13px",lineHeight:"1.6",resize:"none",outline:"none",transition:"background-color 0.3s"}})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Domain Assignment"}),S.jsxs("select",{value:t?.domains?.find(X=>X.tables.includes(x.id))?.id||"",onChange:X=>h(x.id,X.target.value||null),className:`w-full border rounded text-sm p-2 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-200 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`,children:[S.jsx("option",{value:"",children:"- No Domain -"}),t?.domains?.map(X=>S.jsxs("option",{value:X.id,children:[X.name," (",X.id,")"]},X.id))]})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Tags"}),S.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[x.conceptual?.tags?.map(X=>S.jsxs("span",{className:`flex items-center gap-2 px-3 py-1 border rounded-full text-xs font-medium transition-colors ${d==="dark"?"bg-blue-500/10 text-blue-400 border-blue-500/20":"bg-blue-50 text-blue-600 border-blue-100"}`,children:[X,S.jsx("button",{onClick:pe=>ee(pe,X),className:"hover:text-red-500 transition-colors",children:S.jsx(Vu,{size:12})})]},X)),S.jsx("div",{style:{position:"relative"},children:S.jsx("input",{type:"text",value:E,onChange:X=>M(X.target.value),onKeyDown:K,placeholder:"+ New Tag",style:{backgroundColor:"transparent",border:"1px dashed var(--border-main)",borderRadius:"16px",padding:"4px 12px",fontSize:"11px",color:"var(--text-primary)",outline:"none",width:"100px"}})})]})]})]}),A==="logical"&&S.jsxs("div",{children:[S.jsxs("div",{className:"flex flex-col gap-4 mb-6",children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Logical Table Name"}),S.jsx("input",{value:x.logical_name||"",onChange:X=>V({logical_name:X.target.value}),placeholder:x.name,className:`w-full border rounded text-sm p-2 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-200 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`})]}),S.jsxs("div",{className:"flex justify-between items-center",children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500",children:"Logical Schema (Columns)"}),S.jsxs("button",{onClick:z,className:"flex items-center gap-2 px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded text-xs transition-colors shadow-md shadow-blue-500/20 font-medium",children:[S.jsx(Fw,{size:14})," Add Column"]})]})]}),S.jsx("div",{style:{border:"1px solid var(--border-main)",borderRadius:"8px",overflow:"hidden"},children:S.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[S.jsx("thead",{style:{backgroundColor:"var(--header-bg)",borderBottom:"1px solid var(--border-main)",textAlign:"left"},children:S.jsxs("tr",{children:[S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"35%"},children:"Logical Name"}),S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"15%"},children:"Role"}),S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"15%"},children:"Type"}),S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"30%"},children:"Description"}),S.jsx("th",{style:{padding:"10px 16px",width:"50px"}})]})}),S.jsx("tbody",{children:(x.columns||[]).map(X=>S.jsxs("tr",{style:{borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--node-bg)"},children:[S.jsx("td",{style:{padding:"6px 16px"},children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>te(X.id,{isPrimaryKey:!X.logical?.isPrimaryKey}),title:"Primary Key",className:`transition-opacity ${X.logical?.isPrimaryKey?"opacity-100":"opacity-20 hover:opacity-50"}`,children:"🔑"}),S.jsx("input",{value:X.logical?.name??"",onChange:pe=>te(X.id,{name:pe.target.value}),onBlur:pe=>{pe.target.value||te(X.id,{name:X.id})},className:`bg-transparent border-none w-full outline-none p-1 rounded font-medium transition-colors ${d==="dark"?"text-white focus:bg-slate-800":"text-slate-900 focus:bg-slate-50"}`})]})}),S.jsx("td",{style:{padding:"6px 16px"},children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>te(X.id,{isMetadata:!X.logical?.isMetadata}),title:"Metadata/Audit",className:`transition-opacity text-sm ${X.logical?.isMetadata?"opacity-100":"opacity-20 hover:opacity-50"}`,children:"🕒"}),S.jsxs("select",{value:X.logical?.additivity||"",onChange:pe=>te(X.id,{additivity:pe.target.value||void 0}),title:"Additivity (for Measures)",style:{fontSize:"10px"},className:`border rounded outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-400":"bg-white border-slate-200 text-slate-600"}`,children:[S.jsx("option",{value:"",children:"-"}),S.jsx("option",{value:"fully",children:"Σ (Full)"}),S.jsx("option",{value:"semi",children:"Σ~ (Semi)"}),S.jsx("option",{value:"non",children:"⊘ (Non)"})]})]})}),S.jsx("td",{style:{padding:"6px 16px"},children:S.jsx("input",{value:X.logical?.type??"",onChange:pe=>te(X.id,{type:pe.target.value}),onBlur:pe=>{pe.target.value||te(X.id,{type:"String"})},placeholder:"Type...",className:`bg-transparent border-none font-mono text-[11px] w-full outline-none p-1 rounded transition-colors ${d==="dark"?"text-slate-400 focus:bg-slate-800":"text-slate-500 focus:bg-slate-50"}`})}),S.jsx("td",{style:{padding:"6px 16px"},children:S.jsx("input",{value:X.logical?.description||"",onChange:pe=>te(X.id,{description:pe.target.value}),placeholder:"Description...",className:`bg-transparent border-none text-[11px] w-full outline-none p-1 rounded transition-colors ${d==="dark"?"text-slate-500 focus:bg-slate-800":"text-slate-400 focus:bg-slate-50"}`})}),S.jsx("td",{style:{padding:"6px 16px",textAlign:"right"},children:S.jsx("button",{onClick:pe=>G(pe,X.id),className:"text-red-500/50 hover:text-red-500 p-1 transition-colors",children:S.jsx(_d,{size:14})})})]},X.id))})]})})]}),A==="physical"&&S.jsxs("div",{children:[S.jsxs("div",{className:"flex flex-col gap-4 mb-6",children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Physical Table Name"}),S.jsx("input",{value:x.physical_name||"",onChange:X=>V({physical_name:X.target.value}),placeholder:x.id,className:`w-full border rounded font-mono text-sm p-2 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`})]}),S.jsx("div",{className:"flex justify-between items-center",children:S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500",children:"Physical Mappings"})})]}),S.jsx("div",{style:{border:"1px solid var(--border-main)",borderRadius:"8px",overflow:"hidden"},children:S.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[S.jsx("thead",{style:{backgroundColor:"var(--header-bg)",borderBottom:"1px solid var(--border-main)",textAlign:"left"},children:S.jsxs("tr",{children:[S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"25%"},children:"Logical Column"}),S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"30%"},children:"DB Column Name"}),S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"20%"},children:"DB Type"}),S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"25%"},children:"Constraints"})]})}),S.jsx("tbody",{children:(x.columns||[]).map(X=>S.jsxs("tr",{style:{borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--node-bg)"},children:[S.jsx("td",{style:{padding:"6px 16px",color:"var(--text-secondary)",borderRight:"1px solid var(--border-main)"},children:S.jsx("div",{className:"text-[11px] font-medium truncate",title:X.logical?.name||X.id,children:X.logical?.name||X.id})}),S.jsx("td",{style:{padding:"6px 16px"},children:S.jsx("input",{value:X.physical?.name??"",onChange:pe=>j(X.id,{name:pe.target.value}),placeholder:X.logical?.name.toLowerCase().replace(/ /g,"_"),className:`bg-transparent border-none font-mono text-[11px] w-full outline-none p-1 rounded transition-colors ${d==="dark"?"text-blue-400 focus:bg-slate-800":"text-blue-600 focus:bg-slate-50"}`})}),S.jsx("td",{style:{padding:"6px 16px"},children:S.jsx("input",{value:X.physical?.type??"",onChange:pe=>j(X.id,{type:pe.target.value}),placeholder:X.logical?.type.toUpperCase(),className:`bg-transparent border-none font-mono text-[11px] w-full outline-none p-1 rounded transition-colors ${d==="dark"?"text-slate-400 focus:bg-slate-800":"text-slate-500 focus:bg-slate-50"}`})}),S.jsx("td",{style:{padding:"6px 16px"},children:S.jsx("input",{value:X.physical?.constraints?.join(", ")||"",onChange:pe=>j(X.id,{constraints:pe.target.value.split(",").map(Se=>Se.trim()).filter(Boolean)}),placeholder:"e.g. NOT NULL",className:`bg-transparent border-none text-[11px] w-full outline-none p-1 rounded transition-colors ${d==="dark"?"text-slate-500 focus:bg-slate-800":"text-slate-400 focus:bg-slate-50"}`})})]},X.id))})]})})]}),A==="sample"&&S.jsxs("div",{className:"flex flex-col h-full",children:[S.jsxs("div",{className:"flex justify-between items-center mb-4",children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500",children:"Sample Data Editor"}),S.jsx("div",{className:"flex gap-2",children:S.jsxs("button",{onClick:ge,disabled:!x.columns||x.columns.length===0,className:`flex items-center gap-2 px-3 py-1.5 text-white rounded text-xs transition-colors font-medium shadow-md ${!x.columns||x.columns.length===0?"bg-slate-300 dark:bg-slate-700 cursor-not-allowed opacity-50":"bg-emerald-600 hover:bg-emerald-700 shadow-emerald-500/20"}`,children:[S.jsx(Fw,{size:14})," Add Row"]})})]}),!x.columns||x.columns.length===0?S.jsxs("div",{className:`flex-1 flex flex-col items-center justify-center p-8 rounded-lg border border-dashed transition-colors ${d==="dark"?"bg-slate-900/50 border-slate-800":"bg-slate-50 border-slate-200"}`,children:[S.jsx(ZD,{size:32,className:`${d==="dark"?"text-slate-700":"text-slate-300"} mb-4`}),S.jsx("p",{className:"text-sm text-slate-500 mb-1",children:"No columns defined yet."}),S.jsx("p",{className:"text-xs text-slate-400 italic",children:'Add columns in the "Logical" tab first to enable sample data.'})]}):S.jsx("div",{className:`flex-1 overflow-auto border rounded-lg shadow-inner transition-colors ${d==="dark"?"border-slate-800 bg-slate-950/20":"border-slate-200 bg-white"}`,children:S.jsxs("table",{className:"w-full border-collapse text-xs",children:[S.jsx("thead",{className:`sticky top-0 z-10 border-b transition-colors ${d==="dark"?"bg-slate-950 border-slate-800":"bg-slate-100 border-slate-200"}`,children:S.jsxs("tr",{children:[(x.columns||[]).map(X=>S.jsx("th",{className:`p-3 text-left border-r min-w-[140px] transition-colors ${d==="dark"?"border-slate-800":"border-slate-200"}`,children:S.jsxs("div",{className:"flex flex-col gap-0.5",children:[S.jsx("span",{className:`font-bold ${d==="dark"?"text-slate-200":"text-slate-700"}`,children:X?.logical?.name||X.id}),S.jsx("span",{className:`text-[10px] font-mono italic ${d==="dark"?"text-blue-400":"text-blue-600"}`,children:X?.physical?.name||X?.logical?.name?.toLowerCase().replace(/ /g,"_")||X.id})]})},X.id)),S.jsx("th",{className:`w-10 transition-colors ${d==="dark"?"bg-slate-950":"bg-slate-100"}`})]})}),S.jsxs("tbody",{children:[(x.sampleData||[]).map((X,pe)=>S.jsxs("tr",{className:`border-b transition-colors ${d==="dark"?"border-slate-800 hover:bg-slate-800/30":"border-slate-100 hover:bg-slate-50"}`,children:[(x.columns||[]).map((Se,ye)=>S.jsx("td",{className:`p-0 border-r transition-colors ${d==="dark"?"border-slate-800":"border-slate-200"}`,children:S.jsx("input",{value:String(X[ye]??""),onChange:_e=>Me(pe,ye,_e.target.value),className:`w-full bg-transparent border-none p-3 outline-none font-mono transition-colors ${d==="dark"?"focus:bg-slate-800 text-slate-300":"focus:bg-blue-50 text-slate-700"}`})},Se.id)),S.jsx("td",{className:"p-2 text-center",children:S.jsx("button",{onClick:Se=>xe(Se,pe),className:"text-slate-400 hover:text-red-500 transition-colors",children:S.jsx(_d,{size:12})})})]},pe)),(!x.sampleData||x.sampleData.length===0)&&S.jsx("tr",{children:S.jsx("td",{colSpan:(x.columns?.length||0)+1,className:`p-8 text-center text-slate-400 italic transition-colors ${d==="dark"?"bg-slate-900/20":"bg-slate-50"}`,children:'No rows defined. Click "Add Row" to start.'})})]})]})})]})]})]})};function $w(){return $w=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},$w.apply(null,arguments)}function cK(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}let Gw=[],_z=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?_z:Gw).push(n=n+t[e])})();function uK(t){if(t<768)return!1;for(let e=0,n=Gw.length;;){let i=e+n>>1;if(t<Gw[i])n=i;else if(t>=_z[i])e=i+1;else return!0;if(e==n)return!1}}function t3(t){return t>=127462&&t<=127487}const n3=8205;function fK(t,e,n=!0,i=!0){return(n?Oz:hK)(t,e,i)}function Oz(t,e,n){if(e==t.length)return e;e&&Ez(t.charCodeAt(e))&&Tz(t.charCodeAt(e-1))&&e--;let i=H1(t,e);for(e+=i3(i);e<t.length;){let r=H1(t,e);if(i==n3||r==n3||n&&uK(r))e+=i3(r),i=r;else if(t3(r)){let s=0,l=e-2;for(;l>=0&&t3(H1(t,l));)s++,l-=2;if(s%2==0)break;e+=2}else break}return e}function hK(t,e,n){for(;e>0;){let i=Oz(t,e-2,n);if(i<e)return i;e--}return 0}function H1(t,e){let n=t.charCodeAt(e);if(!Tz(n)||e+1==t.length)return n;let i=t.charCodeAt(e+1);return Ez(i)?(n-55296<<10)+(i-56320)+65536:n}function Ez(t){return t>=56320&&t<57344}function Tz(t){return t>=55296&&t<56320}function i3(t){return t<65536?1:2}class it{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,i){[e,n]=Ao(this,e,n);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(n,this.length,r,1),or.from(r,this.length-(n-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Ao(this,e,n);let i=[];return this.decompose(e,n,i,0),or.from(i,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new Wc(this),s=new Wc(e);for(let l=n,c=n;;){if(r.next(l),s.next(l),l=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(c+=r.value.length,r.done||c>=i)return!0}}iter(e=1){return new Wc(this,e)}iterRange(e,n=this.length){return new Mz(this,e,n)}iterLines(e,n){let i;if(e==null)i=this.iter();else{n==null&&(n=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new Nz(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?it.empty:e.length<=32?new Ut(e):or.from(Ut.split(e,[]))}}class Ut extends it{constructor(e,n=dK(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,i,r){for(let s=0;;s++){let l=this.text[s],c=r+l.length;if((n?i:c)>=e)return new pK(r,c,i,l);r=c+1,i++}}decompose(e,n,i,r){let s=e<=0&&n>=this.length?this:new Ut(r3(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(r&1){let l=i.pop(),c=nd(s.text,l.text.slice(),0,s.length);if(c.length<=32)i.push(new Ut(c,l.length+s.length));else{let u=c.length>>1;i.push(new Ut(c.slice(0,u)),new Ut(c.slice(u)))}}else i.push(s)}replace(e,n,i){if(!(i instanceof Ut))return super.replace(e,n,i);[e,n]=Ao(this,e,n);let r=nd(this.text,nd(i.text,r3(this.text,0,e)),n),s=this.length+i.length-(n-e);return r.length<=32?new Ut(r,s):or.from(Ut.split(r,[]),s)}sliceString(e,n=this.length,i=`
|
|
40
|
+
`:""}var uG=cG,fG={dump:uG};function g2(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var hG=wn,dG=qL,pG=PL,mG=$L,gG=GL,yG=h2,vG=u8.load,bG=u8.loadAll,xG=fG.dump,wG=Dn,SG={binary:KL,float:FL,map:IL,null:HL,pairs:JL,set:e8,timestamp:XL,bool:UL,int:VL,merge:WL,omap:ZL,seq:jL,str:BL},CG=g2("safeLoad","load"),kG=g2("safeLoadAll","loadAll"),AG=g2("safeDump","dump"),Uw={Type:hG,Schema:dG,FAILSAFE_SCHEMA:pG,JSON_SCHEMA:mG,CORE_SCHEMA:gG,DEFAULT_SCHEMA:yG,load:vG,loadAll:bG,dump:xG,YAMLException:wG,types:SG,safeLoad:CG,safeLoadAll:kG,safeDump:AG};function y2(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var C0,NE;function _G(){if(NE)return C0;NE=1;function t(){this.__data__=[],this.size=0}return C0=t,C0}var k0,RE;function Ro(){if(RE)return k0;RE=1;function t(e,n){return e===n||e!==e&&n!==n}return k0=t,k0}var A0,DE;function hp(){if(DE)return A0;DE=1;var t=Ro();function e(n,i){for(var r=n.length;r--;)if(t(n[r][0],i))return r;return-1}return A0=e,A0}var _0,LE;function OG(){if(LE)return _0;LE=1;var t=hp(),e=Array.prototype,n=e.splice;function i(r){var s=this.__data__,l=t(s,r);if(l<0)return!1;var c=s.length-1;return l==c?s.pop():n.call(s,l,1),--this.size,!0}return _0=i,_0}var O0,zE;function EG(){if(zE)return O0;zE=1;var t=hp();function e(n){var i=this.__data__,r=t(i,n);return r<0?void 0:i[r][1]}return O0=e,O0}var E0,qE;function TG(){if(qE)return E0;qE=1;var t=hp();function e(n){return t(this.__data__,n)>-1}return E0=e,E0}var T0,BE;function MG(){if(BE)return T0;BE=1;var t=hp();function e(n,i){var r=this.__data__,s=t(r,n);return s<0?(++this.size,r.push([n,i])):r[s][1]=i,this}return T0=e,T0}var M0,jE;function dp(){if(jE)return M0;jE=1;var t=_G(),e=OG(),n=EG(),i=TG(),r=MG();function s(l){var c=-1,u=l==null?0:l.length;for(this.clear();++c<u;){var h=l[c];this.set(h[0],h[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=n,s.prototype.has=i,s.prototype.set=r,M0=s,M0}var N0,IE;function NG(){if(IE)return N0;IE=1;var t=dp();function e(){this.__data__=new t,this.size=0}return N0=e,N0}var R0,PE;function RG(){if(PE)return R0;PE=1;function t(e){var n=this.__data__,i=n.delete(e);return this.size=n.size,i}return R0=t,R0}var D0,HE;function DG(){if(HE)return D0;HE=1;function t(e){return this.__data__.get(e)}return D0=t,D0}var L0,UE;function LG(){if(UE)return L0;UE=1;function t(e){return this.__data__.has(e)}return L0=t,L0}var z0,VE;function S8(){if(VE)return z0;VE=1;var t=typeof mh=="object"&&mh&&mh.Object===Object&&mh;return z0=t,z0}var q0,FE;function Xi(){if(FE)return q0;FE=1;var t=S8(),e=typeof self=="object"&&self&&self.Object===Object&&self,n=t||e||Function("return this")();return q0=n,q0}var B0,$E;function Do(){if($E)return B0;$E=1;var t=Xi(),e=t.Symbol;return B0=e,B0}var j0,GE;function zG(){if(GE)return j0;GE=1;var t=Do(),e=Object.prototype,n=e.hasOwnProperty,i=e.toString,r=t?t.toStringTag:void 0;function s(l){var c=n.call(l,r),u=l[r];try{l[r]=void 0;var h=!0}catch{}var d=i.call(l);return h&&(c?l[r]=u:delete l[r]),d}return j0=s,j0}var I0,YE;function qG(){if(YE)return I0;YE=1;var t=Object.prototype,e=t.toString;function n(i){return e.call(i)}return I0=n,I0}var P0,QE;function Za(){if(QE)return P0;QE=1;var t=Do(),e=zG(),n=qG(),i="[object Null]",r="[object Undefined]",s=t?t.toStringTag:void 0;function l(c){return c==null?c===void 0?r:i:s&&s in Object(c)?e(c):n(c)}return P0=l,P0}var H0,XE;function Di(){if(XE)return H0;XE=1;function t(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}return H0=t,H0}var U0,WE;function ju(){if(WE)return U0;WE=1;var t=Za(),e=Di(),n="[object AsyncFunction]",i="[object Function]",r="[object GeneratorFunction]",s="[object Proxy]";function l(c){if(!e(c))return!1;var u=t(c);return u==i||u==r||u==n||u==s}return U0=l,U0}var V0,KE;function BG(){if(KE)return V0;KE=1;var t=Xi(),e=t["__core-js_shared__"];return V0=e,V0}var F0,ZE;function jG(){if(ZE)return F0;ZE=1;var t=BG(),e=(function(){var i=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function n(i){return!!e&&e in i}return F0=n,F0}var $0,JE;function C8(){if(JE)return $0;JE=1;var t=Function.prototype,e=t.toString;function n(i){if(i!=null){try{return e.call(i)}catch{}try{return i+""}catch{}}return""}return $0=n,$0}var G0,eT;function IG(){if(eT)return G0;eT=1;var t=ju(),e=jG(),n=Di(),i=C8(),r=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,l=Function.prototype,c=Object.prototype,u=l.toString,h=c.hasOwnProperty,d=RegExp("^"+u.call(h).replace(r,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(g){if(!n(g)||e(g))return!1;var v=t(g)?d:s;return v.test(i(g))}return G0=m,G0}var Y0,tT;function PG(){if(tT)return Y0;tT=1;function t(e,n){return e?.[n]}return Y0=t,Y0}var Q0,nT;function Ja(){if(nT)return Q0;nT=1;var t=IG(),e=PG();function n(i,r){var s=e(i,r);return t(s)?s:void 0}return Q0=n,Q0}var X0,iT;function v2(){if(iT)return X0;iT=1;var t=Ja(),e=Xi(),n=t(e,"Map");return X0=n,X0}var W0,rT;function pp(){if(rT)return W0;rT=1;var t=Ja(),e=t(Object,"create");return W0=e,W0}var K0,sT;function HG(){if(sT)return K0;sT=1;var t=pp();function e(){this.__data__=t?t(null):{},this.size=0}return K0=e,K0}var Z0,aT;function UG(){if(aT)return Z0;aT=1;function t(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}return Z0=t,Z0}var J0,lT;function VG(){if(lT)return J0;lT=1;var t=pp(),e="__lodash_hash_undefined__",n=Object.prototype,i=n.hasOwnProperty;function r(s){var l=this.__data__;if(t){var c=l[s];return c===e?void 0:c}return i.call(l,s)?l[s]:void 0}return J0=r,J0}var ey,oT;function FG(){if(oT)return ey;oT=1;var t=pp(),e=Object.prototype,n=e.hasOwnProperty;function i(r){var s=this.__data__;return t?s[r]!==void 0:n.call(s,r)}return ey=i,ey}var ty,cT;function $G(){if(cT)return ty;cT=1;var t=pp(),e="__lodash_hash_undefined__";function n(i,r){var s=this.__data__;return this.size+=this.has(i)?0:1,s[i]=t&&r===void 0?e:r,this}return ty=n,ty}var ny,uT;function GG(){if(uT)return ny;uT=1;var t=HG(),e=UG(),n=VG(),i=FG(),r=$G();function s(l){var c=-1,u=l==null?0:l.length;for(this.clear();++c<u;){var h=l[c];this.set(h[0],h[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=n,s.prototype.has=i,s.prototype.set=r,ny=s,ny}var iy,fT;function YG(){if(fT)return iy;fT=1;var t=GG(),e=dp(),n=v2();function i(){this.size=0,this.__data__={hash:new t,map:new(n||e),string:new t}}return iy=i,iy}var ry,hT;function QG(){if(hT)return ry;hT=1;function t(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}return ry=t,ry}var sy,dT;function mp(){if(dT)return sy;dT=1;var t=QG();function e(n,i){var r=n.__data__;return t(i)?r[typeof i=="string"?"string":"hash"]:r.map}return sy=e,sy}var ay,pT;function XG(){if(pT)return ay;pT=1;var t=mp();function e(n){var i=t(this,n).delete(n);return this.size-=i?1:0,i}return ay=e,ay}var ly,mT;function WG(){if(mT)return ly;mT=1;var t=mp();function e(n){return t(this,n).get(n)}return ly=e,ly}var oy,gT;function KG(){if(gT)return oy;gT=1;var t=mp();function e(n){return t(this,n).has(n)}return oy=e,oy}var cy,yT;function ZG(){if(yT)return cy;yT=1;var t=mp();function e(n,i){var r=t(this,n),s=r.size;return r.set(n,i),this.size+=r.size==s?0:1,this}return cy=e,cy}var uy,vT;function b2(){if(vT)return uy;vT=1;var t=YG(),e=XG(),n=WG(),i=KG(),r=ZG();function s(l){var c=-1,u=l==null?0:l.length;for(this.clear();++c<u;){var h=l[c];this.set(h[0],h[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=n,s.prototype.has=i,s.prototype.set=r,uy=s,uy}var fy,bT;function JG(){if(bT)return fy;bT=1;var t=dp(),e=v2(),n=b2(),i=200;function r(s,l){var c=this.__data__;if(c instanceof t){var u=c.__data__;if(!e||u.length<i-1)return u.push([s,l]),this.size=++c.size,this;c=this.__data__=new n(u)}return c.set(s,l),this.size=c.size,this}return fy=r,fy}var hy,xT;function gp(){if(xT)return hy;xT=1;var t=dp(),e=NG(),n=RG(),i=DG(),r=LG(),s=JG();function l(c){var u=this.__data__=new t(c);this.size=u.size}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=i,l.prototype.has=r,l.prototype.set=s,hy=l,hy}var dy,wT;function x2(){if(wT)return dy;wT=1;function t(e,n){for(var i=-1,r=e==null?0:e.length;++i<r&&n(e[i],i,e)!==!1;);return e}return dy=t,dy}var py,ST;function k8(){if(ST)return py;ST=1;var t=Ja(),e=(function(){try{var n=t(Object,"defineProperty");return n({},"",{}),n}catch{}})();return py=e,py}var my,CT;function yp(){if(CT)return my;CT=1;var t=k8();function e(n,i,r){i=="__proto__"&&t?t(n,i,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[i]=r}return my=e,my}var gy,kT;function vp(){if(kT)return gy;kT=1;var t=yp(),e=Ro(),n=Object.prototype,i=n.hasOwnProperty;function r(s,l,c){var u=s[l];(!(i.call(s,l)&&e(u,c))||c===void 0&&!(l in s))&&t(s,l,c)}return gy=r,gy}var yy,AT;function Iu(){if(AT)return yy;AT=1;var t=vp(),e=yp();function n(i,r,s,l){var c=!s;s||(s={});for(var u=-1,h=r.length;++u<h;){var d=r[u],m=l?l(s[d],i[d],d,s,i):void 0;m===void 0&&(m=i[d]),c?e(s,d,m):t(s,d,m)}return s}return yy=n,yy}var vy,_T;function eY(){if(_T)return vy;_T=1;function t(e,n){for(var i=-1,r=Array(e);++i<e;)r[i]=n(i);return r}return vy=t,vy}var by,OT;function vr(){if(OT)return by;OT=1;function t(e){return e!=null&&typeof e=="object"}return by=t,by}var xy,ET;function tY(){if(ET)return xy;ET=1;var t=Za(),e=vr(),n="[object Arguments]";function i(r){return e(r)&&t(r)==n}return xy=i,xy}var wy,TT;function Pu(){if(TT)return wy;TT=1;var t=tY(),e=vr(),n=Object.prototype,i=n.hasOwnProperty,r=n.propertyIsEnumerable,s=t((function(){return arguments})())?t:function(l){return e(l)&&i.call(l,"callee")&&!r.call(l,"callee")};return wy=s,wy}var Sy,MT;function nn(){if(MT)return Sy;MT=1;var t=Array.isArray;return Sy=t,Sy}var Fc={exports:{}},Cy,NT;function nY(){if(NT)return Cy;NT=1;function t(){return!1}return Cy=t,Cy}Fc.exports;var RT;function Lo(){return RT||(RT=1,(function(t,e){var n=Xi(),i=nY(),r=e&&!e.nodeType&&e,s=r&&!0&&t&&!t.nodeType&&t,l=s&&s.exports===r,c=l?n.Buffer:void 0,u=c?c.isBuffer:void 0,h=u||i;t.exports=h})(Fc,Fc.exports)),Fc.exports}var ky,DT;function bp(){if(DT)return ky;DT=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function n(i,r){var s=typeof i;return r=r??t,!!r&&(s=="number"||s!="symbol"&&e.test(i))&&i>-1&&i%1==0&&i<r}return ky=n,ky}var Ay,LT;function w2(){if(LT)return Ay;LT=1;var t=9007199254740991;function e(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=t}return Ay=e,Ay}var _y,zT;function iY(){if(zT)return _y;zT=1;var t=Za(),e=w2(),n=vr(),i="[object Arguments]",r="[object Array]",s="[object Boolean]",l="[object Date]",c="[object Error]",u="[object Function]",h="[object Map]",d="[object Number]",m="[object Object]",g="[object RegExp]",v="[object Set]",x="[object String]",w="[object WeakMap]",C="[object ArrayBuffer]",k="[object DataView]",A="[object Float32Array]",O="[object Float64Array]",E="[object Int8Array]",M="[object Int16Array]",T="[object Int32Array]",N="[object Uint8Array]",I="[object Uint8ClampedArray]",q="[object Uint16Array]",H="[object Uint32Array]",B={};B[A]=B[O]=B[E]=B[M]=B[T]=B[N]=B[I]=B[q]=B[H]=!0,B[i]=B[r]=B[C]=B[s]=B[k]=B[l]=B[c]=B[u]=B[h]=B[d]=B[m]=B[g]=B[v]=B[x]=B[w]=!1;function $(V){return n(V)&&e(V.length)&&!!B[t(V)]}return _y=$,_y}var Oy,qT;function xp(){if(qT)return Oy;qT=1;function t(e){return function(n){return e(n)}}return Oy=t,Oy}var $c={exports:{}};$c.exports;var BT;function S2(){return BT||(BT=1,(function(t,e){var n=S8(),i=e&&!e.nodeType&&e,r=i&&!0&&t&&!t.nodeType&&t,s=r&&r.exports===i,l=s&&n.process,c=(function(){try{var u=r&&r.require&&r.require("util").types;return u||l&&l.binding&&l.binding("util")}catch{}})();t.exports=c})($c,$c.exports)),$c.exports}var Ey,jT;function Hu(){if(jT)return Ey;jT=1;var t=iY(),e=xp(),n=S2(),i=n&&n.isTypedArray,r=i?e(i):t;return Ey=r,Ey}var Ty,IT;function A8(){if(IT)return Ty;IT=1;var t=eY(),e=Pu(),n=nn(),i=Lo(),r=bp(),s=Hu(),l=Object.prototype,c=l.hasOwnProperty;function u(h,d){var m=n(h),g=!m&&e(h),v=!m&&!g&&i(h),x=!m&&!g&&!v&&s(h),w=m||g||v||x,C=w?t(h.length,String):[],k=C.length;for(var A in h)(d||c.call(h,A))&&!(w&&(A=="length"||v&&(A=="offset"||A=="parent")||x&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||r(A,k)))&&C.push(A);return C}return Ty=u,Ty}var My,PT;function wp(){if(PT)return My;PT=1;var t=Object.prototype;function e(n){var i=n&&n.constructor,r=typeof i=="function"&&i.prototype||t;return n===r}return My=e,My}var Ny,HT;function _8(){if(HT)return Ny;HT=1;function t(e,n){return function(i){return e(n(i))}}return Ny=t,Ny}var Ry,UT;function rY(){if(UT)return Ry;UT=1;var t=_8(),e=t(Object.keys,Object);return Ry=e,Ry}var Dy,VT;function C2(){if(VT)return Dy;VT=1;var t=wp(),e=rY(),n=Object.prototype,i=n.hasOwnProperty;function r(s){if(!t(s))return e(s);var l=[];for(var c in Object(s))i.call(s,c)&&c!="constructor"&&l.push(c);return l}return Dy=r,Dy}var Ly,FT;function as(){if(FT)return Ly;FT=1;var t=ju(),e=w2();function n(i){return i!=null&&e(i.length)&&!t(i)}return Ly=n,Ly}var zy,$T;function ia(){if($T)return zy;$T=1;var t=A8(),e=C2(),n=as();function i(r){return n(r)?t(r):e(r)}return zy=i,zy}var qy,GT;function sY(){if(GT)return qy;GT=1;var t=Iu(),e=ia();function n(i,r){return i&&t(r,e(r),i)}return qy=n,qy}var By,YT;function aY(){if(YT)return By;YT=1;function t(e){var n=[];if(e!=null)for(var i in Object(e))n.push(i);return n}return By=t,By}var jy,QT;function lY(){if(QT)return jy;QT=1;var t=Di(),e=wp(),n=aY(),i=Object.prototype,r=i.hasOwnProperty;function s(l){if(!t(l))return n(l);var c=e(l),u=[];for(var h in l)h=="constructor"&&(c||!r.call(l,h))||u.push(h);return u}return jy=s,jy}var Iy,XT;function el(){if(XT)return Iy;XT=1;var t=A8(),e=lY(),n=as();function i(r){return n(r)?t(r,!0):e(r)}return Iy=i,Iy}var Py,WT;function oY(){if(WT)return Py;WT=1;var t=Iu(),e=el();function n(i,r){return i&&t(r,e(r),i)}return Py=n,Py}var Gc={exports:{}};Gc.exports;var KT;function O8(){return KT||(KT=1,(function(t,e){var n=Xi(),i=e&&!e.nodeType&&e,r=i&&!0&&t&&!t.nodeType&&t,s=r&&r.exports===i,l=s?n.Buffer:void 0,c=l?l.allocUnsafe:void 0;function u(h,d){if(d)return h.slice();var m=h.length,g=c?c(m):new h.constructor(m);return h.copy(g),g}t.exports=u})(Gc,Gc.exports)),Gc.exports}var Hy,ZT;function E8(){if(ZT)return Hy;ZT=1;function t(e,n){var i=-1,r=e.length;for(n||(n=Array(r));++i<r;)n[i]=e[i];return n}return Hy=t,Hy}var Uy,JT;function T8(){if(JT)return Uy;JT=1;function t(e,n){for(var i=-1,r=e==null?0:e.length,s=0,l=[];++i<r;){var c=e[i];n(c,i,e)&&(l[s++]=c)}return l}return Uy=t,Uy}var Vy,eM;function M8(){if(eM)return Vy;eM=1;function t(){return[]}return Vy=t,Vy}var Fy,tM;function k2(){if(tM)return Fy;tM=1;var t=T8(),e=M8(),n=Object.prototype,i=n.propertyIsEnumerable,r=Object.getOwnPropertySymbols,s=r?function(l){return l==null?[]:(l=Object(l),t(r(l),function(c){return i.call(l,c)}))}:e;return Fy=s,Fy}var $y,nM;function cY(){if(nM)return $y;nM=1;var t=Iu(),e=k2();function n(i,r){return t(i,e(i),r)}return $y=n,$y}var Gy,iM;function A2(){if(iM)return Gy;iM=1;function t(e,n){for(var i=-1,r=n.length,s=e.length;++i<r;)e[s+i]=n[i];return e}return Gy=t,Gy}var Yy,rM;function Sp(){if(rM)return Yy;rM=1;var t=_8(),e=t(Object.getPrototypeOf,Object);return Yy=e,Yy}var Qy,sM;function N8(){if(sM)return Qy;sM=1;var t=A2(),e=Sp(),n=k2(),i=M8(),r=Object.getOwnPropertySymbols,s=r?function(l){for(var c=[];l;)t(c,n(l)),l=e(l);return c}:i;return Qy=s,Qy}var Xy,aM;function uY(){if(aM)return Xy;aM=1;var t=Iu(),e=N8();function n(i,r){return t(i,e(i),r)}return Xy=n,Xy}var Wy,lM;function R8(){if(lM)return Wy;lM=1;var t=A2(),e=nn();function n(i,r,s){var l=r(i);return e(i)?l:t(l,s(i))}return Wy=n,Wy}var Ky,oM;function D8(){if(oM)return Ky;oM=1;var t=R8(),e=k2(),n=ia();function i(r){return t(r,n,e)}return Ky=i,Ky}var Zy,cM;function fY(){if(cM)return Zy;cM=1;var t=R8(),e=N8(),n=el();function i(r){return t(r,n,e)}return Zy=i,Zy}var Jy,uM;function hY(){if(uM)return Jy;uM=1;var t=Ja(),e=Xi(),n=t(e,"DataView");return Jy=n,Jy}var ev,fM;function dY(){if(fM)return ev;fM=1;var t=Ja(),e=Xi(),n=t(e,"Promise");return ev=n,ev}var tv,hM;function L8(){if(hM)return tv;hM=1;var t=Ja(),e=Xi(),n=t(e,"Set");return tv=n,tv}var nv,dM;function pY(){if(dM)return nv;dM=1;var t=Ja(),e=Xi(),n=t(e,"WeakMap");return nv=n,nv}var iv,pM;function zo(){if(pM)return iv;pM=1;var t=hY(),e=v2(),n=dY(),i=L8(),r=pY(),s=Za(),l=C8(),c="[object Map]",u="[object Object]",h="[object Promise]",d="[object Set]",m="[object WeakMap]",g="[object DataView]",v=l(t),x=l(e),w=l(n),C=l(i),k=l(r),A=s;return(t&&A(new t(new ArrayBuffer(1)))!=g||e&&A(new e)!=c||n&&A(n.resolve())!=h||i&&A(new i)!=d||r&&A(new r)!=m)&&(A=function(O){var E=s(O),M=E==u?O.constructor:void 0,T=M?l(M):"";if(T)switch(T){case v:return g;case x:return c;case w:return h;case C:return d;case k:return m}return E}),iv=A,iv}var rv,mM;function mY(){if(mM)return rv;mM=1;var t=Object.prototype,e=t.hasOwnProperty;function n(i){var r=i.length,s=new i.constructor(r);return r&&typeof i[0]=="string"&&e.call(i,"index")&&(s.index=i.index,s.input=i.input),s}return rv=n,rv}var sv,gM;function z8(){if(gM)return sv;gM=1;var t=Xi(),e=t.Uint8Array;return sv=e,sv}var av,yM;function _2(){if(yM)return av;yM=1;var t=z8();function e(n){var i=new n.constructor(n.byteLength);return new t(i).set(new t(n)),i}return av=e,av}var lv,vM;function gY(){if(vM)return lv;vM=1;var t=_2();function e(n,i){var r=i?t(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}return lv=e,lv}var ov,bM;function yY(){if(bM)return ov;bM=1;var t=/\w*$/;function e(n){var i=new n.constructor(n.source,t.exec(n));return i.lastIndex=n.lastIndex,i}return ov=e,ov}var cv,xM;function vY(){if(xM)return cv;xM=1;var t=Do(),e=t?t.prototype:void 0,n=e?e.valueOf:void 0;function i(r){return n?Object(n.call(r)):{}}return cv=i,cv}var uv,wM;function q8(){if(wM)return uv;wM=1;var t=_2();function e(n,i){var r=i?t(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}return uv=e,uv}var fv,SM;function bY(){if(SM)return fv;SM=1;var t=_2(),e=gY(),n=yY(),i=vY(),r=q8(),s="[object Boolean]",l="[object Date]",c="[object Map]",u="[object Number]",h="[object RegExp]",d="[object Set]",m="[object String]",g="[object Symbol]",v="[object ArrayBuffer]",x="[object DataView]",w="[object Float32Array]",C="[object Float64Array]",k="[object Int8Array]",A="[object Int16Array]",O="[object Int32Array]",E="[object Uint8Array]",M="[object Uint8ClampedArray]",T="[object Uint16Array]",N="[object Uint32Array]";function I(q,H,B){var $=q.constructor;switch(H){case v:return t(q);case s:case l:return new $(+q);case x:return e(q,B);case w:case C:case k:case A:case O:case E:case M:case T:case N:return r(q,B);case c:return new $;case u:case m:return new $(q);case h:return n(q);case d:return new $;case g:return i(q)}}return fv=I,fv}var hv,CM;function B8(){if(CM)return hv;CM=1;var t=Di(),e=Object.create,n=(function(){function i(){}return function(r){if(!t(r))return{};if(e)return e(r);i.prototype=r;var s=new i;return i.prototype=void 0,s}})();return hv=n,hv}var dv,kM;function j8(){if(kM)return dv;kM=1;var t=B8(),e=Sp(),n=wp();function i(r){return typeof r.constructor=="function"&&!n(r)?t(e(r)):{}}return dv=i,dv}var pv,AM;function xY(){if(AM)return pv;AM=1;var t=zo(),e=vr(),n="[object Map]";function i(r){return e(r)&&t(r)==n}return pv=i,pv}var mv,_M;function wY(){if(_M)return mv;_M=1;var t=xY(),e=xp(),n=S2(),i=n&&n.isMap,r=i?e(i):t;return mv=r,mv}var gv,OM;function SY(){if(OM)return gv;OM=1;var t=zo(),e=vr(),n="[object Set]";function i(r){return e(r)&&t(r)==n}return gv=i,gv}var yv,EM;function CY(){if(EM)return yv;EM=1;var t=SY(),e=xp(),n=S2(),i=n&&n.isSet,r=i?e(i):t;return yv=r,yv}var vv,TM;function I8(){if(TM)return vv;TM=1;var t=gp(),e=x2(),n=vp(),i=sY(),r=oY(),s=O8(),l=E8(),c=cY(),u=uY(),h=D8(),d=fY(),m=zo(),g=mY(),v=bY(),x=j8(),w=nn(),C=Lo(),k=wY(),A=Di(),O=CY(),E=ia(),M=el(),T=1,N=2,I=4,q="[object Arguments]",H="[object Array]",B="[object Boolean]",$="[object Date]",V="[object Error]",D="[object Function]",P="[object GeneratorFunction]",L="[object Map]",Q="[object Number]",Z="[object Object]",U="[object RegExp]",re="[object Set]",z="[object String]",G="[object Symbol]",te="[object WeakMap]",j="[object ArrayBuffer]",K="[object DataView]",ee="[object Float32Array]",oe="[object Float64Array]",ge="[object Int8Array]",xe="[object Int16Array]",Me="[object Int32Array]",X="[object Uint8Array]",pe="[object Uint8ClampedArray]",Se="[object Uint16Array]",ye="[object Uint32Array]",_e={};_e[q]=_e[H]=_e[j]=_e[K]=_e[B]=_e[$]=_e[ee]=_e[oe]=_e[ge]=_e[xe]=_e[Me]=_e[L]=_e[Q]=_e[Z]=_e[U]=_e[re]=_e[z]=_e[G]=_e[X]=_e[pe]=_e[Se]=_e[ye]=!0,_e[V]=_e[D]=_e[te]=!1;function ot(Oe,ve,Fe,on,rn,jt){var ft,at=ve&T,Et=ve&N,$t=ve&I;if(Fe&&(ft=rn?Fe(Oe,on,rn,jt):Fe(Oe)),ft!==void 0)return ft;if(!A(Oe))return Oe;var Gt=w(Oe);if(Gt){if(ft=g(Oe),!at)return l(Oe,ft)}else{var wt=m(Oe),pn=wt==D||wt==P;if(C(Oe))return s(Oe,at);if(wt==Z||wt==q||pn&&!rn){if(ft=Et||pn?{}:x(Oe),!at)return Et?u(Oe,r(ft,Oe)):c(Oe,i(ft,Oe))}else{if(!_e[wt])return rn?Oe:{};ft=v(Oe,wt,at)}}jt||(jt=new t);var ni=jt.get(Oe);if(ni)return ni;jt.set(Oe,ft),O(Oe)?Oe.forEach(function(me){ft.add(ot(me,ve,Fe,me,Oe,jt))}):k(Oe)&&Oe.forEach(function(me,Re){ft.set(Re,ot(me,ve,Fe,Re,Oe,jt))});var Mt=$t?Et?d:h:Et?M:E,Ae=Gt?void 0:Mt(Oe);return e(Ae||Oe,function(me,Re){Ae&&(Re=me,me=Oe[Re]),n(ft,Re,ot(me,ve,Fe,Re,Oe,jt))}),ft}return vv=ot,vv}var bv,MM;function kY(){if(MM)return bv;MM=1;var t=I8(),e=4;function n(i){return t(i,e)}return bv=n,bv}var xv,NM;function O2(){if(NM)return xv;NM=1;function t(e){return function(){return e}}return xv=t,xv}var wv,RM;function AY(){if(RM)return wv;RM=1;function t(e){return function(n,i,r){for(var s=-1,l=Object(n),c=r(n),u=c.length;u--;){var h=c[e?u:++s];if(i(l[h],h,l)===!1)break}return n}}return wv=t,wv}var Sv,DM;function E2(){if(DM)return Sv;DM=1;var t=AY(),e=t();return Sv=e,Sv}var Cv,LM;function T2(){if(LM)return Cv;LM=1;var t=E2(),e=ia();function n(i,r){return i&&t(i,r,e)}return Cv=n,Cv}var kv,zM;function _Y(){if(zM)return kv;zM=1;var t=as();function e(n,i){return function(r,s){if(r==null)return r;if(!t(r))return n(r,s);for(var l=r.length,c=i?l:-1,u=Object(r);(i?c--:++c<l)&&s(u[c],c,u)!==!1;);return r}}return kv=e,kv}var Av,qM;function Cp(){if(qM)return Av;qM=1;var t=T2(),e=_Y(),n=e(t);return Av=n,Av}var _v,BM;function tl(){if(BM)return _v;BM=1;function t(e){return e}return _v=t,_v}var Ov,jM;function P8(){if(jM)return Ov;jM=1;var t=tl();function e(n){return typeof n=="function"?n:t}return Ov=e,Ov}var Ev,IM;function H8(){if(IM)return Ev;IM=1;var t=x2(),e=Cp(),n=P8(),i=nn();function r(s,l){var c=i(s)?t:e;return c(s,n(l))}return Ev=r,Ev}var Tv,PM;function U8(){return PM||(PM=1,Tv=H8()),Tv}var Mv,HM;function OY(){if(HM)return Mv;HM=1;var t=Cp();function e(n,i){var r=[];return t(n,function(s,l,c){i(s,l,c)&&r.push(s)}),r}return Mv=e,Mv}var Nv,UM;function EY(){if(UM)return Nv;UM=1;var t="__lodash_hash_undefined__";function e(n){return this.__data__.set(n,t),this}return Nv=e,Nv}var Rv,VM;function TY(){if(VM)return Rv;VM=1;function t(e){return this.__data__.has(e)}return Rv=t,Rv}var Dv,FM;function V8(){if(FM)return Dv;FM=1;var t=b2(),e=EY(),n=TY();function i(r){var s=-1,l=r==null?0:r.length;for(this.__data__=new t;++s<l;)this.add(r[s])}return i.prototype.add=i.prototype.push=e,i.prototype.has=n,Dv=i,Dv}var Lv,$M;function MY(){if($M)return Lv;$M=1;function t(e,n){for(var i=-1,r=e==null?0:e.length;++i<r;)if(n(e[i],i,e))return!0;return!1}return Lv=t,Lv}var zv,GM;function F8(){if(GM)return zv;GM=1;function t(e,n){return e.has(n)}return zv=t,zv}var qv,YM;function $8(){if(YM)return qv;YM=1;var t=V8(),e=MY(),n=F8(),i=1,r=2;function s(l,c,u,h,d,m){var g=u&i,v=l.length,x=c.length;if(v!=x&&!(g&&x>v))return!1;var w=m.get(l),C=m.get(c);if(w&&C)return w==c&&C==l;var k=-1,A=!0,O=u&r?new t:void 0;for(m.set(l,c),m.set(c,l);++k<v;){var E=l[k],M=c[k];if(h)var T=g?h(M,E,k,c,l,m):h(E,M,k,l,c,m);if(T!==void 0){if(T)continue;A=!1;break}if(O){if(!e(c,function(N,I){if(!n(O,I)&&(E===N||d(E,N,u,h,m)))return O.push(I)})){A=!1;break}}else if(!(E===M||d(E,M,u,h,m))){A=!1;break}}return m.delete(l),m.delete(c),A}return qv=s,qv}var Bv,QM;function NY(){if(QM)return Bv;QM=1;function t(e){var n=-1,i=Array(e.size);return e.forEach(function(r,s){i[++n]=[s,r]}),i}return Bv=t,Bv}var jv,XM;function M2(){if(XM)return jv;XM=1;function t(e){var n=-1,i=Array(e.size);return e.forEach(function(r){i[++n]=r}),i}return jv=t,jv}var Iv,WM;function RY(){if(WM)return Iv;WM=1;var t=Do(),e=z8(),n=Ro(),i=$8(),r=NY(),s=M2(),l=1,c=2,u="[object Boolean]",h="[object Date]",d="[object Error]",m="[object Map]",g="[object Number]",v="[object RegExp]",x="[object Set]",w="[object String]",C="[object Symbol]",k="[object ArrayBuffer]",A="[object DataView]",O=t?t.prototype:void 0,E=O?O.valueOf:void 0;function M(T,N,I,q,H,B,$){switch(I){case A:if(T.byteLength!=N.byteLength||T.byteOffset!=N.byteOffset)return!1;T=T.buffer,N=N.buffer;case k:return!(T.byteLength!=N.byteLength||!B(new e(T),new e(N)));case u:case h:case g:return n(+T,+N);case d:return T.name==N.name&&T.message==N.message;case v:case w:return T==N+"";case m:var V=r;case x:var D=q&l;if(V||(V=s),T.size!=N.size&&!D)return!1;var P=$.get(T);if(P)return P==N;q|=c,$.set(T,N);var L=i(V(T),V(N),q,H,B,$);return $.delete(T),L;case C:if(E)return E.call(T)==E.call(N)}return!1}return Iv=M,Iv}var Pv,KM;function DY(){if(KM)return Pv;KM=1;var t=D8(),e=1,n=Object.prototype,i=n.hasOwnProperty;function r(s,l,c,u,h,d){var m=c&e,g=t(s),v=g.length,x=t(l),w=x.length;if(v!=w&&!m)return!1;for(var C=v;C--;){var k=g[C];if(!(m?k in l:i.call(l,k)))return!1}var A=d.get(s),O=d.get(l);if(A&&O)return A==l&&O==s;var E=!0;d.set(s,l),d.set(l,s);for(var M=m;++C<v;){k=g[C];var T=s[k],N=l[k];if(u)var I=m?u(N,T,k,l,s,d):u(T,N,k,s,l,d);if(!(I===void 0?T===N||h(T,N,c,u,d):I)){E=!1;break}M||(M=k=="constructor")}if(E&&!M){var q=s.constructor,H=l.constructor;q!=H&&"constructor"in s&&"constructor"in l&&!(typeof q=="function"&&q instanceof q&&typeof H=="function"&&H instanceof H)&&(E=!1)}return d.delete(s),d.delete(l),E}return Pv=r,Pv}var Hv,ZM;function LY(){if(ZM)return Hv;ZM=1;var t=gp(),e=$8(),n=RY(),i=DY(),r=zo(),s=nn(),l=Lo(),c=Hu(),u=1,h="[object Arguments]",d="[object Array]",m="[object Object]",g=Object.prototype,v=g.hasOwnProperty;function x(w,C,k,A,O,E){var M=s(w),T=s(C),N=M?d:r(w),I=T?d:r(C);N=N==h?m:N,I=I==h?m:I;var q=N==m,H=I==m,B=N==I;if(B&&l(w)){if(!l(C))return!1;M=!0,q=!1}if(B&&!q)return E||(E=new t),M||c(w)?e(w,C,k,A,O,E):n(w,C,N,k,A,O,E);if(!(k&u)){var $=q&&v.call(w,"__wrapped__"),V=H&&v.call(C,"__wrapped__");if($||V){var D=$?w.value():w,P=V?C.value():C;return E||(E=new t),O(D,P,k,A,E)}}return B?(E||(E=new t),i(w,C,k,A,O,E)):!1}return Hv=x,Hv}var Uv,JM;function G8(){if(JM)return Uv;JM=1;var t=LY(),e=vr();function n(i,r,s,l,c){return i===r?!0:i==null||r==null||!e(i)&&!e(r)?i!==i&&r!==r:t(i,r,s,l,n,c)}return Uv=n,Uv}var Vv,eN;function zY(){if(eN)return Vv;eN=1;var t=gp(),e=G8(),n=1,i=2;function r(s,l,c,u){var h=c.length,d=h,m=!u;if(s==null)return!d;for(s=Object(s);h--;){var g=c[h];if(m&&g[2]?g[1]!==s[g[0]]:!(g[0]in s))return!1}for(;++h<d;){g=c[h];var v=g[0],x=s[v],w=g[1];if(m&&g[2]){if(x===void 0&&!(v in s))return!1}else{var C=new t;if(u)var k=u(x,w,v,s,l,C);if(!(k===void 0?e(w,x,n|i,u,C):k))return!1}}return!0}return Vv=r,Vv}var Fv,tN;function Y8(){if(tN)return Fv;tN=1;var t=Di();function e(n){return n===n&&!t(n)}return Fv=e,Fv}var $v,nN;function qY(){if(nN)return $v;nN=1;var t=Y8(),e=ia();function n(i){for(var r=e(i),s=r.length;s--;){var l=r[s],c=i[l];r[s]=[l,c,t(c)]}return r}return $v=n,$v}var Gv,iN;function Q8(){if(iN)return Gv;iN=1;function t(e,n){return function(i){return i==null?!1:i[e]===n&&(n!==void 0||e in Object(i))}}return Gv=t,Gv}var Yv,rN;function BY(){if(rN)return Yv;rN=1;var t=zY(),e=qY(),n=Q8();function i(r){var s=e(r);return s.length==1&&s[0][2]?n(s[0][0],s[0][1]):function(l){return l===r||t(l,r,s)}}return Yv=i,Yv}var Qv,sN;function qo(){if(sN)return Qv;sN=1;var t=Za(),e=vr(),n="[object Symbol]";function i(r){return typeof r=="symbol"||e(r)&&t(r)==n}return Qv=i,Qv}var Xv,aN;function N2(){if(aN)return Xv;aN=1;var t=nn(),e=qo(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;function r(s,l){if(t(s))return!1;var c=typeof s;return c=="number"||c=="symbol"||c=="boolean"||s==null||e(s)?!0:i.test(s)||!n.test(s)||l!=null&&s in Object(l)}return Xv=r,Xv}var Wv,lN;function jY(){if(lN)return Wv;lN=1;var t=b2(),e="Expected a function";function n(i,r){if(typeof i!="function"||r!=null&&typeof r!="function")throw new TypeError(e);var s=function(){var l=arguments,c=r?r.apply(this,l):l[0],u=s.cache;if(u.has(c))return u.get(c);var h=i.apply(this,l);return s.cache=u.set(c,h)||u,h};return s.cache=new(n.Cache||t),s}return n.Cache=t,Wv=n,Wv}var Kv,oN;function IY(){if(oN)return Kv;oN=1;var t=jY(),e=500;function n(i){var r=t(i,function(l){return s.size===e&&s.clear(),l}),s=r.cache;return r}return Kv=n,Kv}var Zv,cN;function PY(){if(cN)return Zv;cN=1;var t=IY(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,i=t(function(r){var s=[];return r.charCodeAt(0)===46&&s.push(""),r.replace(e,function(l,c,u,h){s.push(u?h.replace(n,"$1"):c||l)}),s});return Zv=i,Zv}var Jv,uN;function kp(){if(uN)return Jv;uN=1;function t(e,n){for(var i=-1,r=e==null?0:e.length,s=Array(r);++i<r;)s[i]=n(e[i],i,e);return s}return Jv=t,Jv}var eb,fN;function HY(){if(fN)return eb;fN=1;var t=Do(),e=kp(),n=nn(),i=qo(),r=t?t.prototype:void 0,s=r?r.toString:void 0;function l(c){if(typeof c=="string")return c;if(n(c))return e(c,l)+"";if(i(c))return s?s.call(c):"";var u=c+"";return u=="0"&&1/c==-1/0?"-0":u}return eb=l,eb}var tb,hN;function X8(){if(hN)return tb;hN=1;var t=HY();function e(n){return n==null?"":t(n)}return tb=e,tb}var nb,dN;function Ap(){if(dN)return nb;dN=1;var t=nn(),e=N2(),n=PY(),i=X8();function r(s,l){return t(s)?s:e(s,l)?[s]:n(i(s))}return nb=r,nb}var ib,pN;function Uu(){if(pN)return ib;pN=1;var t=qo();function e(n){if(typeof n=="string"||t(n))return n;var i=n+"";return i=="0"&&1/n==-1/0?"-0":i}return ib=e,ib}var rb,mN;function _p(){if(mN)return rb;mN=1;var t=Ap(),e=Uu();function n(i,r){r=t(r,i);for(var s=0,l=r.length;i!=null&&s<l;)i=i[e(r[s++])];return s&&s==l?i:void 0}return rb=n,rb}var sb,gN;function UY(){if(gN)return sb;gN=1;var t=_p();function e(n,i,r){var s=n==null?void 0:t(n,i);return s===void 0?r:s}return sb=e,sb}var ab,yN;function VY(){if(yN)return ab;yN=1;function t(e,n){return e!=null&&n in Object(e)}return ab=t,ab}var lb,vN;function W8(){if(vN)return lb;vN=1;var t=Ap(),e=Pu(),n=nn(),i=bp(),r=w2(),s=Uu();function l(c,u,h){u=t(u,c);for(var d=-1,m=u.length,g=!1;++d<m;){var v=s(u[d]);if(!(g=c!=null&&h(c,v)))break;c=c[v]}return g||++d!=m?g:(m=c==null?0:c.length,!!m&&r(m)&&i(v,m)&&(n(c)||e(c)))}return lb=l,lb}var ob,bN;function K8(){if(bN)return ob;bN=1;var t=VY(),e=W8();function n(i,r){return i!=null&&e(i,r,t)}return ob=n,ob}var cb,xN;function FY(){if(xN)return cb;xN=1;var t=G8(),e=UY(),n=K8(),i=N2(),r=Y8(),s=Q8(),l=Uu(),c=1,u=2;function h(d,m){return i(d)&&r(m)?s(l(d),m):function(g){var v=e(g,d);return v===void 0&&v===m?n(g,d):t(m,v,c|u)}}return cb=h,cb}var ub,wN;function Z8(){if(wN)return ub;wN=1;function t(e){return function(n){return n?.[e]}}return ub=t,ub}var fb,SN;function $Y(){if(SN)return fb;SN=1;var t=_p();function e(n){return function(i){return t(i,n)}}return fb=e,fb}var hb,CN;function GY(){if(CN)return hb;CN=1;var t=Z8(),e=$Y(),n=N2(),i=Uu();function r(s){return n(s)?t(i(s)):e(s)}return hb=r,hb}var db,kN;function ls(){if(kN)return db;kN=1;var t=BY(),e=FY(),n=tl(),i=nn(),r=GY();function s(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?i(l)?e(l[0],l[1]):t(l):r(l)}return db=s,db}var pb,AN;function J8(){if(AN)return pb;AN=1;var t=T8(),e=OY(),n=ls(),i=nn();function r(s,l){var c=i(s)?t:e;return c(s,n(l,3))}return pb=r,pb}var mb,_N;function YY(){if(_N)return mb;_N=1;var t=Object.prototype,e=t.hasOwnProperty;function n(i,r){return i!=null&&e.call(i,r)}return mb=n,mb}var gb,ON;function ez(){if(ON)return gb;ON=1;var t=YY(),e=W8();function n(i,r){return i!=null&&e(i,r,t)}return gb=n,gb}var yb,EN;function QY(){if(EN)return yb;EN=1;var t=C2(),e=zo(),n=Pu(),i=nn(),r=as(),s=Lo(),l=wp(),c=Hu(),u="[object Map]",h="[object Set]",d=Object.prototype,m=d.hasOwnProperty;function g(v){if(v==null)return!0;if(r(v)&&(i(v)||typeof v=="string"||typeof v.splice=="function"||s(v)||c(v)||n(v)))return!v.length;var x=e(v);if(x==u||x==h)return!v.size;if(l(v))return!t(v).length;for(var w in v)if(m.call(v,w))return!1;return!0}return yb=g,yb}var vb,TN;function tz(){if(TN)return vb;TN=1;function t(e){return e===void 0}return vb=t,vb}var bb,MN;function nz(){if(MN)return bb;MN=1;var t=Cp(),e=as();function n(i,r){var s=-1,l=e(i)?Array(i.length):[];return t(i,function(c,u,h){l[++s]=r(c,u,h)}),l}return bb=n,bb}var xb,NN;function iz(){if(NN)return xb;NN=1;var t=kp(),e=ls(),n=nz(),i=nn();function r(s,l){var c=i(s)?t:n;return c(s,e(l,3))}return xb=r,xb}var wb,RN;function XY(){if(RN)return wb;RN=1;function t(e,n,i,r){var s=-1,l=e==null?0:e.length;for(r&&l&&(i=e[++s]);++s<l;)i=n(i,e[s],s,e);return i}return wb=t,wb}var Sb,DN;function WY(){if(DN)return Sb;DN=1;function t(e,n,i,r,s){return s(e,function(l,c,u){i=r?(r=!1,l):n(i,l,c,u)}),i}return Sb=t,Sb}var Cb,LN;function rz(){if(LN)return Cb;LN=1;var t=XY(),e=Cp(),n=ls(),i=WY(),r=nn();function s(l,c,u){var h=r(l)?t:i,d=arguments.length<3;return h(l,n(c,4),u,d,e)}return Cb=s,Cb}var kb,zN;function KY(){if(zN)return kb;zN=1;var t=Za(),e=nn(),n=vr(),i="[object String]";function r(s){return typeof s=="string"||!e(s)&&n(s)&&t(s)==i}return kb=r,kb}var Ab,qN;function ZY(){if(qN)return Ab;qN=1;var t=Z8(),e=t("length");return Ab=e,Ab}var _b,BN;function JY(){if(BN)return _b;BN=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",r=e+n+i,s="\\ufe0e\\ufe0f",l="\\u200d",c=RegExp("["+l+t+r+s+"]");function u(h){return c.test(h)}return _b=u,_b}var Ob,jN;function eQ(){if(jN)return Ob;jN=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",r=e+n+i,s="\\ufe0e\\ufe0f",l="["+t+"]",c="["+r+"]",u="\\ud83c[\\udffb-\\udfff]",h="(?:"+c+"|"+u+")",d="[^"+t+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",x=h+"?",w="["+s+"]?",C="(?:"+v+"(?:"+[d,m,g].join("|")+")"+w+x+")*",k=w+x+C,A="(?:"+[d+c+"?",c,m,g,l].join("|")+")",O=RegExp(u+"(?="+u+")|"+A+k,"g");function E(M){for(var T=O.lastIndex=0;O.test(M);)++T;return T}return Ob=E,Ob}var Eb,IN;function tQ(){if(IN)return Eb;IN=1;var t=ZY(),e=JY(),n=eQ();function i(r){return e(r)?n(r):t(r)}return Eb=i,Eb}var Tb,PN;function nQ(){if(PN)return Tb;PN=1;var t=C2(),e=zo(),n=as(),i=KY(),r=tQ(),s="[object Map]",l="[object Set]";function c(u){if(u==null)return 0;if(n(u))return i(u)?r(u):u.length;var h=e(u);return h==s||h==l?u.size:t(u).length}return Tb=c,Tb}var Mb,HN;function iQ(){if(HN)return Mb;HN=1;var t=x2(),e=B8(),n=T2(),i=ls(),r=Sp(),s=nn(),l=Lo(),c=ju(),u=Di(),h=Hu();function d(m,g,v){var x=s(m),w=x||l(m)||h(m);if(g=i(g,4),v==null){var C=m&&m.constructor;w?v=x?new C:[]:u(m)?v=c(C)?e(r(m)):{}:v={}}return(w?t:n)(m,function(k,A,O){return g(v,k,A,O)}),v}return Mb=d,Mb}var Nb,UN;function rQ(){if(UN)return Nb;UN=1;var t=Do(),e=Pu(),n=nn(),i=t?t.isConcatSpreadable:void 0;function r(s){return n(s)||e(s)||!!(i&&s&&s[i])}return Nb=r,Nb}var Rb,VN;function R2(){if(VN)return Rb;VN=1;var t=A2(),e=rQ();function n(i,r,s,l,c){var u=-1,h=i.length;for(s||(s=e),c||(c=[]);++u<h;){var d=i[u];r>0&&s(d)?r>1?n(d,r-1,s,l,c):t(c,d):l||(c[c.length]=d)}return c}return Rb=n,Rb}var Db,FN;function sQ(){if(FN)return Db;FN=1;function t(e,n,i){switch(i.length){case 0:return e.call(n);case 1:return e.call(n,i[0]);case 2:return e.call(n,i[0],i[1]);case 3:return e.call(n,i[0],i[1],i[2])}return e.apply(n,i)}return Db=t,Db}var Lb,$N;function sz(){if($N)return Lb;$N=1;var t=sQ(),e=Math.max;function n(i,r,s){return r=e(r===void 0?i.length-1:r,0),function(){for(var l=arguments,c=-1,u=e(l.length-r,0),h=Array(u);++c<u;)h[c]=l[r+c];c=-1;for(var d=Array(r+1);++c<r;)d[c]=l[c];return d[r]=s(h),t(i,this,d)}}return Lb=n,Lb}var zb,GN;function aQ(){if(GN)return zb;GN=1;var t=O2(),e=k8(),n=tl(),i=e?function(r,s){return e(r,"toString",{configurable:!0,enumerable:!1,value:t(s),writable:!0})}:n;return zb=i,zb}var qb,YN;function lQ(){if(YN)return qb;YN=1;var t=800,e=16,n=Date.now;function i(r){var s=0,l=0;return function(){var c=n(),u=e-(c-l);if(l=c,u>0){if(++s>=t)return arguments[0]}else s=0;return r.apply(void 0,arguments)}}return qb=i,qb}var Bb,QN;function az(){if(QN)return Bb;QN=1;var t=aQ(),e=lQ(),n=e(t);return Bb=n,Bb}var jb,XN;function Op(){if(XN)return jb;XN=1;var t=tl(),e=sz(),n=az();function i(r,s){return n(e(r,s,t),r+"")}return jb=i,jb}var Ib,WN;function lz(){if(WN)return Ib;WN=1;function t(e,n,i,r){for(var s=e.length,l=i+(r?1:-1);r?l--:++l<s;)if(n(e[l],l,e))return l;return-1}return Ib=t,Ib}var Pb,KN;function oQ(){if(KN)return Pb;KN=1;function t(e){return e!==e}return Pb=t,Pb}var Hb,ZN;function cQ(){if(ZN)return Hb;ZN=1;function t(e,n,i){for(var r=i-1,s=e.length;++r<s;)if(e[r]===n)return r;return-1}return Hb=t,Hb}var Ub,JN;function uQ(){if(JN)return Ub;JN=1;var t=lz(),e=oQ(),n=cQ();function i(r,s,l){return s===s?n(r,s,l):t(r,e,l)}return Ub=i,Ub}var Vb,eR;function fQ(){if(eR)return Vb;eR=1;var t=uQ();function e(n,i){var r=n==null?0:n.length;return!!r&&t(n,i,0)>-1}return Vb=e,Vb}var Fb,tR;function hQ(){if(tR)return Fb;tR=1;function t(e,n,i){for(var r=-1,s=e==null?0:e.length;++r<s;)if(i(n,e[r]))return!0;return!1}return Fb=t,Fb}var $b,nR;function dQ(){if(nR)return $b;nR=1;function t(){}return $b=t,$b}var Gb,iR;function pQ(){if(iR)return Gb;iR=1;var t=L8(),e=dQ(),n=M2(),i=1/0,r=t&&1/n(new t([,-0]))[1]==i?function(s){return new t(s)}:e;return Gb=r,Gb}var Yb,rR;function mQ(){if(rR)return Yb;rR=1;var t=V8(),e=fQ(),n=hQ(),i=F8(),r=pQ(),s=M2(),l=200;function c(u,h,d){var m=-1,g=e,v=u.length,x=!0,w=[],C=w;if(d)x=!1,g=n;else if(v>=l){var k=h?null:r(u);if(k)return s(k);x=!1,g=i,C=new t}else C=h?[]:w;e:for(;++m<v;){var A=u[m],O=h?h(A):A;if(A=d||A!==0?A:0,x&&O===O){for(var E=C.length;E--;)if(C[E]===O)continue e;h&&C.push(O),w.push(A)}else g(C,O,d)||(C!==w&&C.push(O),w.push(A))}return w}return Yb=c,Yb}var Qb,sR;function oz(){if(sR)return Qb;sR=1;var t=as(),e=vr();function n(i){return e(i)&&t(i)}return Qb=n,Qb}var Xb,aR;function gQ(){if(aR)return Xb;aR=1;var t=R2(),e=Op(),n=mQ(),i=oz(),r=e(function(s){return n(t(s,1,i,!0))});return Xb=r,Xb}var Wb,lR;function yQ(){if(lR)return Wb;lR=1;var t=kp();function e(n,i){return t(i,function(r){return n[r]})}return Wb=e,Wb}var Kb,oR;function cz(){if(oR)return Kb;oR=1;var t=yQ(),e=ia();function n(i){return i==null?[]:t(i,e(i))}return Kb=n,Kb}var Zb,cR;function Li(){if(cR)return Zb;cR=1;var t;if(typeof y2=="function")try{t={clone:kY(),constant:O2(),each:U8(),filter:J8(),has:ez(),isArray:nn(),isEmpty:QY(),isFunction:ju(),isUndefined:tz(),keys:ia(),map:iz(),reduce:rz(),size:nQ(),transform:iQ(),union:gQ(),values:cz()}}catch{}return t||(t=window._),Zb=t,Zb}var Jb,uR;function D2(){if(uR)return Jb;uR=1;var t=Li();Jb=r;var e="\0",n="\0",i="";function r(d){this._isDirected=t.has(d,"directed")?d.directed:!0,this._isMultigraph=t.has(d,"multigraph")?d.multigraph:!1,this._isCompound=t.has(d,"compound")?d.compound:!1,this._label=void 0,this._defaultNodeLabelFn=t.constant(void 0),this._defaultEdgeLabelFn=t.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}r.prototype._nodeCount=0,r.prototype._edgeCount=0,r.prototype.isDirected=function(){return this._isDirected},r.prototype.isMultigraph=function(){return this._isMultigraph},r.prototype.isCompound=function(){return this._isCompound},r.prototype.setGraph=function(d){return this._label=d,this},r.prototype.graph=function(){return this._label},r.prototype.setDefaultNodeLabel=function(d){return t.isFunction(d)||(d=t.constant(d)),this._defaultNodeLabelFn=d,this},r.prototype.nodeCount=function(){return this._nodeCount},r.prototype.nodes=function(){return t.keys(this._nodes)},r.prototype.sources=function(){var d=this;return t.filter(this.nodes(),function(m){return t.isEmpty(d._in[m])})},r.prototype.sinks=function(){var d=this;return t.filter(this.nodes(),function(m){return t.isEmpty(d._out[m])})},r.prototype.setNodes=function(d,m){var g=arguments,v=this;return t.each(d,function(x){g.length>1?v.setNode(x,m):v.setNode(x)}),this},r.prototype.setNode=function(d,m){return t.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=m),this):(this._nodes[d]=arguments.length>1?m:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=n,this._children[d]={},this._children[n][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},r.prototype.node=function(d){return this._nodes[d]},r.prototype.hasNode=function(d){return t.has(this._nodes,d)},r.prototype.removeNode=function(d){var m=this;if(t.has(this._nodes,d)){var g=function(v){m.removeEdge(m._edgeObjs[v])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],t.each(this.children(d),function(v){m.setParent(v)}),delete this._children[d]),t.each(t.keys(this._in[d]),g),delete this._in[d],delete this._preds[d],t.each(t.keys(this._out[d]),g),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},r.prototype.setParent=function(d,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(m))m=n;else{m+="";for(var g=m;!t.isUndefined(g);g=this.parent(g))if(g===d)throw new Error("Setting "+m+" as parent of "+d+" would create a cycle");this.setNode(m)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=m,this._children[m][d]=!0,this},r.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},r.prototype.parent=function(d){if(this._isCompound){var m=this._parent[d];if(m!==n)return m}},r.prototype.children=function(d){if(t.isUndefined(d)&&(d=n),this._isCompound){var m=this._children[d];if(m)return t.keys(m)}else{if(d===n)return this.nodes();if(this.hasNode(d))return[]}},r.prototype.predecessors=function(d){var m=this._preds[d];if(m)return t.keys(m)},r.prototype.successors=function(d){var m=this._sucs[d];if(m)return t.keys(m)},r.prototype.neighbors=function(d){var m=this.predecessors(d);if(m)return t.union(m,this.successors(d))},r.prototype.isLeaf=function(d){var m;return this.isDirected()?m=this.successors(d):m=this.neighbors(d),m.length===0},r.prototype.filterNodes=function(d){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var g=this;t.each(this._nodes,function(w,C){d(C)&&m.setNode(C,w)}),t.each(this._edgeObjs,function(w){m.hasNode(w.v)&&m.hasNode(w.w)&&m.setEdge(w,g.edge(w))});var v={};function x(w){var C=g.parent(w);return C===void 0||m.hasNode(C)?(v[w]=C,C):C in v?v[C]:x(C)}return this._isCompound&&t.each(m.nodes(),function(w){m.setParent(w,x(w))}),m},r.prototype.setDefaultEdgeLabel=function(d){return t.isFunction(d)||(d=t.constant(d)),this._defaultEdgeLabelFn=d,this},r.prototype.edgeCount=function(){return this._edgeCount},r.prototype.edges=function(){return t.values(this._edgeObjs)},r.prototype.setPath=function(d,m){var g=this,v=arguments;return t.reduce(d,function(x,w){return v.length>1?g.setEdge(x,w,m):g.setEdge(x,w),w}),this},r.prototype.setEdge=function(){var d,m,g,v,x=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(d=w.v,m=w.w,g=w.name,arguments.length===2&&(v=arguments[1],x=!0)):(d=w,m=arguments[1],g=arguments[3],arguments.length>2&&(v=arguments[2],x=!0)),d=""+d,m=""+m,t.isUndefined(g)||(g=""+g);var C=c(this._isDirected,d,m,g);if(t.has(this._edgeLabels,C))return x&&(this._edgeLabels[C]=v),this;if(!t.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(m),this._edgeLabels[C]=x?v:this._defaultEdgeLabelFn(d,m,g);var k=u(this._isDirected,d,m,g);return d=k.v,m=k.w,Object.freeze(k),this._edgeObjs[C]=k,s(this._preds[m],d),s(this._sucs[d],m),this._in[m][C]=k,this._out[d][C]=k,this._edgeCount++,this},r.prototype.edge=function(d,m,g){var v=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,d,m,g);return this._edgeLabels[v]},r.prototype.hasEdge=function(d,m,g){var v=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,d,m,g);return t.has(this._edgeLabels,v)},r.prototype.removeEdge=function(d,m,g){var v=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,d,m,g),x=this._edgeObjs[v];return x&&(d=x.v,m=x.w,delete this._edgeLabels[v],delete this._edgeObjs[v],l(this._preds[m],d),l(this._sucs[d],m),delete this._in[m][v],delete this._out[d][v],this._edgeCount--),this},r.prototype.inEdges=function(d,m){var g=this._in[d];if(g){var v=t.values(g);return m?t.filter(v,function(x){return x.v===m}):v}},r.prototype.outEdges=function(d,m){var g=this._out[d];if(g){var v=t.values(g);return m?t.filter(v,function(x){return x.w===m}):v}},r.prototype.nodeEdges=function(d,m){var g=this.inEdges(d,m);if(g)return g.concat(this.outEdges(d,m))};function s(d,m){d[m]?d[m]++:d[m]=1}function l(d,m){--d[m]||delete d[m]}function c(d,m,g,v){var x=""+m,w=""+g;if(!d&&x>w){var C=x;x=w,w=C}return x+i+w+i+(t.isUndefined(v)?e:v)}function u(d,m,g,v){var x=""+m,w=""+g;if(!d&&x>w){var C=x;x=w,w=C}var k={v:x,w};return v&&(k.name=v),k}function h(d,m){return c(d,m.v,m.w,m.name)}return Jb}var ex,fR;function vQ(){return fR||(fR=1,ex="2.1.8"),ex}var tx,hR;function bQ(){return hR||(hR=1,tx={Graph:D2(),version:vQ()}),tx}var nx,dR;function xQ(){if(dR)return nx;dR=1;var t=Li(),e=D2();nx={write:n,read:s};function n(l){var c={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:i(l),edges:r(l)};return t.isUndefined(l.graph())||(c.value=t.clone(l.graph())),c}function i(l){return t.map(l.nodes(),function(c){var u=l.node(c),h=l.parent(c),d={v:c};return t.isUndefined(u)||(d.value=u),t.isUndefined(h)||(d.parent=h),d})}function r(l){return t.map(l.edges(),function(c){var u=l.edge(c),h={v:c.v,w:c.w};return t.isUndefined(c.name)||(h.name=c.name),t.isUndefined(u)||(h.value=u),h})}function s(l){var c=new e(l.options).setGraph(l.value);return t.each(l.nodes,function(u){c.setNode(u.v,u.value),u.parent&&c.setParent(u.v,u.parent)}),t.each(l.edges,function(u){c.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),c}return nx}var ix,pR;function wQ(){if(pR)return ix;pR=1;var t=Li();ix=e;function e(n){var i={},r=[],s;function l(c){t.has(i,c)||(i[c]=!0,s.push(c),t.each(n.successors(c),l),t.each(n.predecessors(c),l))}return t.each(n.nodes(),function(c){s=[],l(c),s.length&&r.push(s)}),r}return ix}var rx,mR;function uz(){if(mR)return rx;mR=1;var t=Li();rx=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(n){return n.key})},e.prototype.has=function(n){return t.has(this._keyIndices,n)},e.prototype.priority=function(n){var i=this._keyIndices[n];if(i!==void 0)return this._arr[i].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(n,i){var r=this._keyIndices;if(n=String(n),!t.has(r,n)){var s=this._arr,l=s.length;return r[n]=l,s.push({key:n,priority:i}),this._decrease(l),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},e.prototype.decrease=function(n,i){var r=this._keyIndices[n];if(i>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[r].priority+" New: "+i);this._arr[r].priority=i,this._decrease(r)},e.prototype._heapify=function(n){var i=this._arr,r=2*n,s=r+1,l=n;r<i.length&&(l=i[r].priority<i[l].priority?r:l,s<i.length&&(l=i[s].priority<i[l].priority?s:l),l!==n&&(this._swap(n,l),this._heapify(l)))},e.prototype._decrease=function(n){for(var i=this._arr,r=i[n].priority,s;n!==0&&(s=n>>1,!(i[s].priority<r));)this._swap(n,s),n=s},e.prototype._swap=function(n,i){var r=this._arr,s=this._keyIndices,l=r[n],c=r[i];r[n]=c,r[i]=l,s[c.key]=n,s[l.key]=i},rx}var sx,gR;function fz(){if(gR)return sx;gR=1;var t=Li(),e=uz();sx=i;var n=t.constant(1);function i(s,l,c,u){return r(s,String(l),c||n,u||function(h){return s.outEdges(h)})}function r(s,l,c,u){var h={},d=new e,m,g,v=function(x){var w=x.v!==m?x.v:x.w,C=h[w],k=c(x),A=g.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+x+" Weight: "+k);A<C.distance&&(C.distance=A,C.predecessor=m,d.decrease(w,A))};for(s.nodes().forEach(function(x){var w=x===l?0:Number.POSITIVE_INFINITY;h[x]={distance:w},d.add(x,w)});d.size()>0&&(m=d.removeMin(),g=h[m],g.distance!==Number.POSITIVE_INFINITY);)u(m).forEach(v);return h}return sx}var ax,yR;function SQ(){if(yR)return ax;yR=1;var t=fz(),e=Li();ax=n;function n(i,r,s){return e.transform(i.nodes(),function(l,c){l[c]=t(i,c,r,s)},{})}return ax}var lx,vR;function hz(){if(vR)return lx;vR=1;var t=Li();lx=e;function e(n){var i=0,r=[],s={},l=[];function c(u){var h=s[u]={onStack:!0,lowlink:i,index:i++};if(r.push(u),n.successors(u).forEach(function(g){t.has(s,g)?s[g].onStack&&(h.lowlink=Math.min(h.lowlink,s[g].index)):(c(g),h.lowlink=Math.min(h.lowlink,s[g].lowlink))}),h.lowlink===h.index){var d=[],m;do m=r.pop(),s[m].onStack=!1,d.push(m);while(u!==m);l.push(d)}}return n.nodes().forEach(function(u){t.has(s,u)||c(u)}),l}return lx}var ox,bR;function CQ(){if(bR)return ox;bR=1;var t=Li(),e=hz();ox=n;function n(i){return t.filter(e(i),function(r){return r.length>1||r.length===1&&i.hasEdge(r[0],r[0])})}return ox}var cx,xR;function kQ(){if(xR)return cx;xR=1;var t=Li();cx=n;var e=t.constant(1);function n(r,s,l){return i(r,s||e,l||function(c){return r.outEdges(c)})}function i(r,s,l){var c={},u=r.nodes();return u.forEach(function(h){c[h]={},c[h][h]={distance:0},u.forEach(function(d){h!==d&&(c[h][d]={distance:Number.POSITIVE_INFINITY})}),l(h).forEach(function(d){var m=d.v===h?d.w:d.v,g=s(d);c[h][m]={distance:g,predecessor:h}})}),u.forEach(function(h){var d=c[h];u.forEach(function(m){var g=c[m];u.forEach(function(v){var x=g[h],w=d[v],C=g[v],k=x.distance+w.distance;k<C.distance&&(C.distance=k,C.predecessor=w.predecessor)})})}),c}return cx}var ux,wR;function dz(){if(wR)return ux;wR=1;var t=Li();ux=e,e.CycleException=n;function e(i){var r={},s={},l=[];function c(u){if(t.has(s,u))throw new n;t.has(r,u)||(s[u]=!0,r[u]=!0,t.each(i.predecessors(u),c),delete s[u],l.push(u))}if(t.each(i.sinks(),c),t.size(r)!==i.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,ux}var fx,SR;function AQ(){if(SR)return fx;SR=1;var t=dz();fx=e;function e(n){try{t(n)}catch(i){if(i instanceof t.CycleException)return!1;throw i}return!0}return fx}var hx,CR;function pz(){if(CR)return hx;CR=1;var t=Li();hx=e;function e(i,r,s){t.isArray(r)||(r=[r]);var l=(i.isDirected()?i.successors:i.neighbors).bind(i),c=[],u={};return t.each(r,function(h){if(!i.hasNode(h))throw new Error("Graph does not have node: "+h);n(i,h,s==="post",u,l,c)}),c}function n(i,r,s,l,c,u){t.has(l,r)||(l[r]=!0,s||u.push(r),t.each(c(r),function(h){n(i,h,s,l,c,u)}),s&&u.push(r))}return hx}var dx,kR;function _Q(){if(kR)return dx;kR=1;var t=pz();dx=e;function e(n,i){return t(n,i,"post")}return dx}var px,AR;function OQ(){if(AR)return px;AR=1;var t=pz();px=e;function e(n,i){return t(n,i,"pre")}return px}var mx,_R;function EQ(){if(_R)return mx;_R=1;var t=Li(),e=D2(),n=uz();mx=i;function i(r,s){var l=new e,c={},u=new n,h;function d(g){var v=g.v===h?g.w:g.v,x=u.priority(v);if(x!==void 0){var w=s(g);w<x&&(c[v]=h,u.decrease(v,w))}}if(r.nodeCount()===0)return l;t.each(r.nodes(),function(g){u.add(g,Number.POSITIVE_INFINITY),l.setNode(g)}),u.decrease(r.nodes()[0],0);for(var m=!1;u.size()>0;){if(h=u.removeMin(),t.has(c,h))l.setEdge(h,c[h]);else{if(m)throw new Error("Input graph is not connected: "+r);m=!0}r.nodeEdges(h).forEach(d)}return l}return mx}var gx,OR;function TQ(){return OR||(OR=1,gx={components:wQ(),dijkstra:fz(),dijkstraAll:SQ(),findCycles:CQ(),floydWarshall:kQ(),isAcyclic:AQ(),postorder:_Q(),preorder:OQ(),prim:EQ(),tarjan:hz(),topsort:dz()}),gx}var yx,ER;function MQ(){if(ER)return yx;ER=1;var t=bQ();return yx={Graph:t.Graph,json:xQ(),alg:TQ(),version:t.version},yx}var vx,TR;function Gi(){if(TR)return vx;TR=1;var t;if(typeof y2=="function")try{t=MQ()}catch{}return t||(t=window.graphlib),vx=t,vx}var bx,MR;function NQ(){if(MR)return bx;MR=1;var t=I8(),e=1,n=4;function i(r){return t(r,e|n)}return bx=i,bx}var xx,NR;function Ep(){if(NR)return xx;NR=1;var t=Ro(),e=as(),n=bp(),i=Di();function r(s,l,c){if(!i(c))return!1;var u=typeof l;return(u=="number"?e(c)&&n(l,c.length):u=="string"&&l in c)?t(c[l],s):!1}return xx=r,xx}var wx,RR;function RQ(){if(RR)return wx;RR=1;var t=Op(),e=Ro(),n=Ep(),i=el(),r=Object.prototype,s=r.hasOwnProperty,l=t(function(c,u){c=Object(c);var h=-1,d=u.length,m=d>2?u[2]:void 0;for(m&&n(u[0],u[1],m)&&(d=1);++h<d;)for(var g=u[h],v=i(g),x=-1,w=v.length;++x<w;){var C=v[x],k=c[C];(k===void 0||e(k,r[C])&&!s.call(c,C))&&(c[C]=g[C])}return c});return wx=l,wx}var Sx,DR;function DQ(){if(DR)return Sx;DR=1;var t=ls(),e=as(),n=ia();function i(r){return function(s,l,c){var u=Object(s);if(!e(s)){var h=t(l,3);s=n(s),l=function(m){return h(u[m],m,u)}}var d=r(s,l,c);return d>-1?u[h?s[d]:d]:void 0}}return Sx=i,Sx}var Cx,LR;function LQ(){if(LR)return Cx;LR=1;var t=/\s/;function e(n){for(var i=n.length;i--&&t.test(n.charAt(i)););return i}return Cx=e,Cx}var kx,zR;function zQ(){if(zR)return kx;zR=1;var t=LQ(),e=/^\s+/;function n(i){return i&&i.slice(0,t(i)+1).replace(e,"")}return kx=n,kx}var Ax,qR;function qQ(){if(qR)return Ax;qR=1;var t=zQ(),e=Di(),n=qo(),i=NaN,r=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;function u(h){if(typeof h=="number")return h;if(n(h))return i;if(e(h)){var d=typeof h.valueOf=="function"?h.valueOf():h;h=e(d)?d+"":d}if(typeof h!="string")return h===0?h:+h;h=t(h);var m=s.test(h);return m||l.test(h)?c(h.slice(2),m?2:8):r.test(h)?i:+h}return Ax=u,Ax}var _x,BR;function mz(){if(BR)return _x;BR=1;var t=qQ(),e=1/0,n=17976931348623157e292;function i(r){if(!r)return r===0?r:0;if(r=t(r),r===e||r===-e){var s=r<0?-1:1;return s*n}return r===r?r:0}return _x=i,_x}var Ox,jR;function BQ(){if(jR)return Ox;jR=1;var t=mz();function e(n){var i=t(n),r=i%1;return i===i?r?i-r:i:0}return Ox=e,Ox}var Ex,IR;function jQ(){if(IR)return Ex;IR=1;var t=lz(),e=ls(),n=BQ(),i=Math.max;function r(s,l,c){var u=s==null?0:s.length;if(!u)return-1;var h=c==null?0:n(c);return h<0&&(h=i(u+h,0)),t(s,e(l,3),h)}return Ex=r,Ex}var Tx,PR;function IQ(){if(PR)return Tx;PR=1;var t=DQ(),e=jQ(),n=t(e);return Tx=n,Tx}var Mx,HR;function gz(){if(HR)return Mx;HR=1;var t=R2();function e(n){var i=n==null?0:n.length;return i?t(n,1):[]}return Mx=e,Mx}var Nx,UR;function PQ(){if(UR)return Nx;UR=1;var t=E2(),e=P8(),n=el();function i(r,s){return r==null?r:t(r,e(s),n)}return Nx=i,Nx}var Rx,VR;function HQ(){if(VR)return Rx;VR=1;function t(e){var n=e==null?0:e.length;return n?e[n-1]:void 0}return Rx=t,Rx}var Dx,FR;function UQ(){if(FR)return Dx;FR=1;var t=yp(),e=T2(),n=ls();function i(r,s){var l={};return s=n(s,3),e(r,function(c,u,h){t(l,u,s(c,u,h))}),l}return Dx=i,Dx}var Lx,$R;function L2(){if($R)return Lx;$R=1;var t=qo();function e(n,i,r){for(var s=-1,l=n.length;++s<l;){var c=n[s],u=i(c);if(u!=null&&(h===void 0?u===u&&!t(u):r(u,h)))var h=u,d=c}return d}return Lx=e,Lx}var zx,GR;function VQ(){if(GR)return zx;GR=1;function t(e,n){return e>n}return zx=t,zx}var qx,YR;function FQ(){if(YR)return qx;YR=1;var t=L2(),e=VQ(),n=tl();function i(r){return r&&r.length?t(r,n,e):void 0}return qx=i,qx}var Bx,QR;function yz(){if(QR)return Bx;QR=1;var t=yp(),e=Ro();function n(i,r,s){(s!==void 0&&!e(i[r],s)||s===void 0&&!(r in i))&&t(i,r,s)}return Bx=n,Bx}var jx,XR;function $Q(){if(XR)return jx;XR=1;var t=Za(),e=Sp(),n=vr(),i="[object Object]",r=Function.prototype,s=Object.prototype,l=r.toString,c=s.hasOwnProperty,u=l.call(Object);function h(d){if(!n(d)||t(d)!=i)return!1;var m=e(d);if(m===null)return!0;var g=c.call(m,"constructor")&&m.constructor;return typeof g=="function"&&g instanceof g&&l.call(g)==u}return jx=h,jx}var Ix,WR;function vz(){if(WR)return Ix;WR=1;function t(e,n){if(!(n==="constructor"&&typeof e[n]=="function")&&n!="__proto__")return e[n]}return Ix=t,Ix}var Px,KR;function GQ(){if(KR)return Px;KR=1;var t=Iu(),e=el();function n(i){return t(i,e(i))}return Px=n,Px}var Hx,ZR;function YQ(){if(ZR)return Hx;ZR=1;var t=yz(),e=O8(),n=q8(),i=E8(),r=j8(),s=Pu(),l=nn(),c=oz(),u=Lo(),h=ju(),d=Di(),m=$Q(),g=Hu(),v=vz(),x=GQ();function w(C,k,A,O,E,M,T){var N=v(C,A),I=v(k,A),q=T.get(I);if(q){t(C,A,q);return}var H=M?M(N,I,A+"",C,k,T):void 0,B=H===void 0;if(B){var $=l(I),V=!$&&u(I),D=!$&&!V&&g(I);H=I,$||V||D?l(N)?H=N:c(N)?H=i(N):V?(B=!1,H=e(I,!0)):D?(B=!1,H=n(I,!0)):H=[]:m(I)||s(I)?(H=N,s(N)?H=x(N):(!d(N)||h(N))&&(H=r(I))):B=!1}B&&(T.set(I,H),E(H,I,O,M,T),T.delete(I)),t(C,A,H)}return Hx=w,Hx}var Ux,JR;function QQ(){if(JR)return Ux;JR=1;var t=gp(),e=yz(),n=E2(),i=YQ(),r=Di(),s=el(),l=vz();function c(u,h,d,m,g){u!==h&&n(h,function(v,x){if(g||(g=new t),r(v))i(u,h,x,d,c,m,g);else{var w=m?m(l(u,x),v,x+"",u,h,g):void 0;w===void 0&&(w=v),e(u,x,w)}},s)}return Ux=c,Ux}var Vx,eD;function XQ(){if(eD)return Vx;eD=1;var t=Op(),e=Ep();function n(i){return t(function(r,s){var l=-1,c=s.length,u=c>1?s[c-1]:void 0,h=c>2?s[2]:void 0;for(u=i.length>3&&typeof u=="function"?(c--,u):void 0,h&&e(s[0],s[1],h)&&(u=c<3?void 0:u,c=1),r=Object(r);++l<c;){var d=s[l];d&&i(r,d,l,u)}return r})}return Vx=n,Vx}var Fx,tD;function WQ(){if(tD)return Fx;tD=1;var t=QQ(),e=XQ(),n=e(function(i,r,s){t(i,r,s)});return Fx=n,Fx}var $x,nD;function bz(){if(nD)return $x;nD=1;function t(e,n){return e<n}return $x=t,$x}var Gx,iD;function KQ(){if(iD)return Gx;iD=1;var t=L2(),e=bz(),n=tl();function i(r){return r&&r.length?t(r,n,e):void 0}return Gx=i,Gx}var Yx,rD;function ZQ(){if(rD)return Yx;rD=1;var t=L2(),e=ls(),n=bz();function i(r,s){return r&&r.length?t(r,e(s,2),n):void 0}return Yx=i,Yx}var Qx,sD;function JQ(){if(sD)return Qx;sD=1;var t=Xi(),e=function(){return t.Date.now()};return Qx=e,Qx}var Xx,aD;function eX(){if(aD)return Xx;aD=1;var t=vp(),e=Ap(),n=bp(),i=Di(),r=Uu();function s(l,c,u,h){if(!i(l))return l;c=e(c,l);for(var d=-1,m=c.length,g=m-1,v=l;v!=null&&++d<m;){var x=r(c[d]),w=u;if(x==="__proto__"||x==="constructor"||x==="prototype")return l;if(d!=g){var C=v[x];w=h?h(C,x,v):void 0,w===void 0&&(w=i(C)?C:n(c[d+1])?[]:{})}t(v,x,w),v=v[x]}return l}return Xx=s,Xx}var Wx,lD;function tX(){if(lD)return Wx;lD=1;var t=_p(),e=eX(),n=Ap();function i(r,s,l){for(var c=-1,u=s.length,h={};++c<u;){var d=s[c],m=t(r,d);l(m,d)&&e(h,n(d,r),m)}return h}return Wx=i,Wx}var Kx,oD;function nX(){if(oD)return Kx;oD=1;var t=tX(),e=K8();function n(i,r){return t(i,r,function(s,l){return e(i,l)})}return Kx=n,Kx}var Zx,cD;function iX(){if(cD)return Zx;cD=1;var t=gz(),e=sz(),n=az();function i(r){return n(e(r,void 0,t),r+"")}return Zx=i,Zx}var Jx,uD;function rX(){if(uD)return Jx;uD=1;var t=nX(),e=iX(),n=e(function(i,r){return i==null?{}:t(i,r)});return Jx=n,Jx}var e1,fD;function sX(){if(fD)return e1;fD=1;var t=Math.ceil,e=Math.max;function n(i,r,s,l){for(var c=-1,u=e(t((r-i)/(s||1)),0),h=Array(u);u--;)h[l?u:++c]=i,i+=s;return h}return e1=n,e1}var t1,hD;function aX(){if(hD)return t1;hD=1;var t=sX(),e=Ep(),n=mz();function i(r){return function(s,l,c){return c&&typeof c!="number"&&e(s,l,c)&&(l=c=void 0),s=n(s),l===void 0?(l=s,s=0):l=n(l),c=c===void 0?s<l?1:-1:n(c),t(s,l,c,r)}}return t1=i,t1}var n1,dD;function lX(){if(dD)return n1;dD=1;var t=aX(),e=t();return n1=e,n1}var i1,pD;function oX(){if(pD)return i1;pD=1;function t(e,n){var i=e.length;for(e.sort(n);i--;)e[i]=e[i].value;return e}return i1=t,i1}var r1,mD;function cX(){if(mD)return r1;mD=1;var t=qo();function e(n,i){if(n!==i){var r=n!==void 0,s=n===null,l=n===n,c=t(n),u=i!==void 0,h=i===null,d=i===i,m=t(i);if(!h&&!m&&!c&&n>i||c&&u&&d&&!h&&!m||s&&u&&d||!r&&d||!l)return 1;if(!s&&!c&&!m&&n<i||m&&r&&l&&!s&&!c||h&&r&&l||!u&&l||!d)return-1}return 0}return r1=e,r1}var s1,gD;function uX(){if(gD)return s1;gD=1;var t=cX();function e(n,i,r){for(var s=-1,l=n.criteria,c=i.criteria,u=l.length,h=r.length;++s<u;){var d=t(l[s],c[s]);if(d){if(s>=h)return d;var m=r[s];return d*(m=="desc"?-1:1)}}return n.index-i.index}return s1=e,s1}var a1,yD;function fX(){if(yD)return a1;yD=1;var t=kp(),e=_p(),n=ls(),i=nz(),r=oX(),s=xp(),l=uX(),c=tl(),u=nn();function h(d,m,g){m.length?m=t(m,function(w){return u(w)?function(C){return e(C,w.length===1?w[0]:w)}:w}):m=[c];var v=-1;m=t(m,s(n));var x=i(d,function(w,C,k){var A=t(m,function(O){return O(w)});return{criteria:A,index:++v,value:w}});return r(x,function(w,C){return l(w,C,g)})}return a1=h,a1}var l1,vD;function hX(){if(vD)return l1;vD=1;var t=R2(),e=fX(),n=Op(),i=Ep(),r=n(function(s,l){if(s==null)return[];var c=l.length;return c>1&&i(s,l[0],l[1])?l=[]:c>2&&i(l[0],l[1],l[2])&&(l=[l[0]]),e(s,t(l,1),[])});return l1=r,l1}var o1,bD;function dX(){if(bD)return o1;bD=1;var t=X8(),e=0;function n(i){var r=++e;return t(i)+r}return o1=n,o1}var c1,xD;function pX(){if(xD)return c1;xD=1;function t(e,n,i){for(var r=-1,s=e.length,l=n.length,c={};++r<s;){var u=r<l?n[r]:void 0;i(c,e[r],u)}return c}return c1=t,c1}var u1,wD;function mX(){if(wD)return u1;wD=1;var t=vp(),e=pX();function n(i,r){return e(i||[],r||[],t)}return u1=n,u1}var f1,SD;function Ot(){if(SD)return f1;SD=1;var t;if(typeof y2=="function")try{t={cloneDeep:NQ(),constant:O2(),defaults:RQ(),each:U8(),filter:J8(),find:IQ(),flatten:gz(),forEach:H8(),forIn:PQ(),has:ez(),isUndefined:tz(),last:HQ(),map:iz(),mapValues:UQ(),max:FQ(),merge:WQ(),min:KQ(),minBy:ZQ(),now:JQ(),pick:rX(),range:lX(),reduce:rz(),sortBy:hX(),uniqueId:dX(),values:cz(),zipObject:mX()}}catch{}return t||(t=window._),f1=t,f1}var h1,CD;function gX(){if(CD)return h1;CD=1,h1=t;function t(){var i={};i._next=i._prev=i,this._sentinel=i}t.prototype.dequeue=function(){var i=this._sentinel,r=i._prev;if(r!==i)return e(r),r},t.prototype.enqueue=function(i){var r=this._sentinel;i._prev&&i._next&&e(i),i._next=r._next,r._next._prev=i,r._next=i,i._prev=r},t.prototype.toString=function(){for(var i=[],r=this._sentinel,s=r._prev;s!==r;)i.push(JSON.stringify(s,n)),s=s._prev;return"["+i.join(", ")+"]"};function e(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function n(i,r){if(i!=="_next"&&i!=="_prev")return r}return h1}var d1,kD;function yX(){if(kD)return d1;kD=1;var t=Ot(),e=Gi().Graph,n=gX();d1=r;var i=t.constant(1);function r(h,d){if(h.nodeCount()<=1)return[];var m=c(h,d||i),g=s(m.graph,m.buckets,m.zeroIdx);return t.flatten(t.map(g,function(v){return h.outEdges(v.v,v.w)}),!0)}function s(h,d,m){for(var g=[],v=d[d.length-1],x=d[0],w;h.nodeCount();){for(;w=x.dequeue();)l(h,d,m,w);for(;w=v.dequeue();)l(h,d,m,w);if(h.nodeCount()){for(var C=d.length-2;C>0;--C)if(w=d[C].dequeue(),w){g=g.concat(l(h,d,m,w,!0));break}}}return g}function l(h,d,m,g,v){var x=v?[]:void 0;return t.forEach(h.inEdges(g.v),function(w){var C=h.edge(w),k=h.node(w.v);v&&x.push({v:w.v,w:w.w}),k.out-=C,u(d,m,k)}),t.forEach(h.outEdges(g.v),function(w){var C=h.edge(w),k=w.w,A=h.node(k);A.in-=C,u(d,m,A)}),h.removeNode(g.v),x}function c(h,d){var m=new e,g=0,v=0;t.forEach(h.nodes(),function(C){m.setNode(C,{v:C,in:0,out:0})}),t.forEach(h.edges(),function(C){var k=m.edge(C.v,C.w)||0,A=d(C),O=k+A;m.setEdge(C.v,C.w,O),v=Math.max(v,m.node(C.v).out+=A),g=Math.max(g,m.node(C.w).in+=A)});var x=t.range(v+g+3).map(function(){return new n}),w=g+1;return t.forEach(m.nodes(),function(C){u(x,w,m.node(C))}),{graph:m,buckets:x,zeroIdx:w}}function u(h,d,m){m.out?m.in?h[m.out-m.in+d].enqueue(m):h[h.length-1].enqueue(m):h[0].enqueue(m)}return d1}var p1,AD;function vX(){if(AD)return p1;AD=1;var t=Ot(),e=yX();p1={run:n,undo:r};function n(s){var l=s.graph().acyclicer==="greedy"?e(s,c(s)):i(s);t.forEach(l,function(u){var h=s.edge(u);s.removeEdge(u),h.forwardName=u.name,h.reversed=!0,s.setEdge(u.w,u.v,h,t.uniqueId("rev"))});function c(u){return function(h){return u.edge(h).weight}}}function i(s){var l=[],c={},u={};function h(d){t.has(u,d)||(u[d]=!0,c[d]=!0,t.forEach(s.outEdges(d),function(m){t.has(c,m.w)?l.push(m):h(m.w)}),delete c[d])}return t.forEach(s.nodes(),h),l}function r(s){t.forEach(s.edges(),function(l){var c=s.edge(l);if(c.reversed){s.removeEdge(l);var u=c.forwardName;delete c.reversed,delete c.forwardName,s.setEdge(l.w,l.v,c,u)}})}return p1}var m1,_D;function Kn(){if(_D)return m1;_D=1;var t=Ot(),e=Gi().Graph;m1={addDummyNode:n,simplify:i,asNonCompoundGraph:r,successorWeights:s,predecessorWeights:l,intersectRect:c,buildLayerMatrix:u,normalizeRanks:h,removeEmptyRanks:d,addBorderNode:m,maxRank:g,partition:v,time:x,notime:w};function n(C,k,A,O){var E;do E=t.uniqueId(O);while(C.hasNode(E));return A.dummy=k,C.setNode(E,A),E}function i(C){var k=new e().setGraph(C.graph());return t.forEach(C.nodes(),function(A){k.setNode(A,C.node(A))}),t.forEach(C.edges(),function(A){var O=k.edge(A.v,A.w)||{weight:0,minlen:1},E=C.edge(A);k.setEdge(A.v,A.w,{weight:O.weight+E.weight,minlen:Math.max(O.minlen,E.minlen)})}),k}function r(C){var k=new e({multigraph:C.isMultigraph()}).setGraph(C.graph());return t.forEach(C.nodes(),function(A){C.children(A).length||k.setNode(A,C.node(A))}),t.forEach(C.edges(),function(A){k.setEdge(A,C.edge(A))}),k}function s(C){var k=t.map(C.nodes(),function(A){var O={};return t.forEach(C.outEdges(A),function(E){O[E.w]=(O[E.w]||0)+C.edge(E).weight}),O});return t.zipObject(C.nodes(),k)}function l(C){var k=t.map(C.nodes(),function(A){var O={};return t.forEach(C.inEdges(A),function(E){O[E.v]=(O[E.v]||0)+C.edge(E).weight}),O});return t.zipObject(C.nodes(),k)}function c(C,k){var A=C.x,O=C.y,E=k.x-A,M=k.y-O,T=C.width/2,N=C.height/2;if(!E&&!M)throw new Error("Not possible to find intersection inside of the rectangle");var I,q;return Math.abs(M)*T>Math.abs(E)*N?(M<0&&(N=-N),I=N*E/M,q=N):(E<0&&(T=-T),I=T,q=T*M/E),{x:A+I,y:O+q}}function u(C){var k=t.map(t.range(g(C)+1),function(){return[]});return t.forEach(C.nodes(),function(A){var O=C.node(A),E=O.rank;t.isUndefined(E)||(k[E][O.order]=A)}),k}function h(C){var k=t.min(t.map(C.nodes(),function(A){return C.node(A).rank}));t.forEach(C.nodes(),function(A){var O=C.node(A);t.has(O,"rank")&&(O.rank-=k)})}function d(C){var k=t.min(t.map(C.nodes(),function(M){return C.node(M).rank})),A=[];t.forEach(C.nodes(),function(M){var T=C.node(M).rank-k;A[T]||(A[T]=[]),A[T].push(M)});var O=0,E=C.graph().nodeRankFactor;t.forEach(A,function(M,T){t.isUndefined(M)&&T%E!==0?--O:O&&t.forEach(M,function(N){C.node(N).rank+=O})})}function m(C,k,A,O){var E={width:0,height:0};return arguments.length>=4&&(E.rank=A,E.order=O),n(C,"border",E,k)}function g(C){return t.max(t.map(C.nodes(),function(k){var A=C.node(k).rank;if(!t.isUndefined(A))return A}))}function v(C,k){var A={lhs:[],rhs:[]};return t.forEach(C,function(O){k(O)?A.lhs.push(O):A.rhs.push(O)}),A}function x(C,k){var A=t.now();try{return k()}finally{console.log(C+" time: "+(t.now()-A)+"ms")}}function w(C,k){return k()}return m1}var g1,OD;function bX(){if(OD)return g1;OD=1;var t=Ot(),e=Kn();g1={run:n,undo:r};function n(s){s.graph().dummyChains=[],t.forEach(s.edges(),function(l){i(s,l)})}function i(s,l){var c=l.v,u=s.node(c).rank,h=l.w,d=s.node(h).rank,m=l.name,g=s.edge(l),v=g.labelRank;if(d!==u+1){s.removeEdge(l);var x,w,C;for(C=0,++u;u<d;++C,++u)g.points=[],w={width:0,height:0,edgeLabel:g,edgeObj:l,rank:u},x=e.addDummyNode(s,"edge",w,"_d"),u===v&&(w.width=g.width,w.height=g.height,w.dummy="edge-label",w.labelpos=g.labelpos),s.setEdge(c,x,{weight:g.weight},m),C===0&&s.graph().dummyChains.push(x),c=x;s.setEdge(c,h,{weight:g.weight},m)}}function r(s){t.forEach(s.graph().dummyChains,function(l){var c=s.node(l),u=c.edgeLabel,h;for(s.setEdge(c.edgeObj,u);c.dummy;)h=s.successors(l)[0],s.removeNode(l),u.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(u.x=c.x,u.y=c.y,u.width=c.width,u.height=c.height),l=h,c=s.node(l)})}return g1}var y1,ED;function Ad(){if(ED)return y1;ED=1;var t=Ot();y1={longestPath:e,slack:n};function e(i){var r={};function s(l){var c=i.node(l);if(t.has(r,l))return c.rank;r[l]=!0;var u=t.min(t.map(i.outEdges(l),function(h){return s(h.w)-i.edge(h).minlen}));return(u===Number.POSITIVE_INFINITY||u===void 0||u===null)&&(u=0),c.rank=u}t.forEach(i.sources(),s)}function n(i,r){return i.node(r.w).rank-i.node(r.v).rank-i.edge(r).minlen}return y1}var v1,TD;function xz(){if(TD)return v1;TD=1;var t=Ot(),e=Gi().Graph,n=Ad().slack;v1=i;function i(c){var u=new e({directed:!1}),h=c.nodes()[0],d=c.nodeCount();u.setNode(h,{});for(var m,g;r(u,c)<d;)m=s(u,c),g=u.hasNode(m.v)?n(c,m):-n(c,m),l(u,c,g);return u}function r(c,u){function h(d){t.forEach(u.nodeEdges(d),function(m){var g=m.v,v=d===g?m.w:g;!c.hasNode(v)&&!n(u,m)&&(c.setNode(v,{}),c.setEdge(d,v,{}),h(v))})}return t.forEach(c.nodes(),h),c.nodeCount()}function s(c,u){return t.minBy(u.edges(),function(h){if(c.hasNode(h.v)!==c.hasNode(h.w))return n(u,h)})}function l(c,u,h){t.forEach(c.nodes(),function(d){u.node(d).rank+=h})}return v1}var b1,MD;function xX(){if(MD)return b1;MD=1;var t=Ot(),e=xz(),n=Ad().slack,i=Ad().longestPath,r=Gi().alg.preorder,s=Gi().alg.postorder,l=Kn().simplify;b1=c,c.initLowLimValues=m,c.initCutValues=u,c.calcCutValue=d,c.leaveEdge=v,c.enterEdge=x,c.exchangeEdges=w;function c(O){O=l(O),i(O);var E=e(O);m(E),u(E,O);for(var M,T;M=v(E);)T=x(E,O,M),w(E,O,M,T)}function u(O,E){var M=s(O,O.nodes());M=M.slice(0,M.length-1),t.forEach(M,function(T){h(O,E,T)})}function h(O,E,M){var T=O.node(M),N=T.parent;O.edge(M,N).cutvalue=d(O,E,M)}function d(O,E,M){var T=O.node(M),N=T.parent,I=!0,q=E.edge(M,N),H=0;return q||(I=!1,q=E.edge(N,M)),H=q.weight,t.forEach(E.nodeEdges(M),function(B){var $=B.v===M,V=$?B.w:B.v;if(V!==N){var D=$===I,P=E.edge(B).weight;if(H+=D?P:-P,k(O,M,V)){var L=O.edge(M,V).cutvalue;H+=D?-L:L}}}),H}function m(O,E){arguments.length<2&&(E=O.nodes()[0]),g(O,{},1,E)}function g(O,E,M,T,N){var I=M,q=O.node(T);return E[T]=!0,t.forEach(O.neighbors(T),function(H){t.has(E,H)||(M=g(O,E,M,H,T))}),q.low=I,q.lim=M++,N?q.parent=N:delete q.parent,M}function v(O){return t.find(O.edges(),function(E){return O.edge(E).cutvalue<0})}function x(O,E,M){var T=M.v,N=M.w;E.hasEdge(T,N)||(T=M.w,N=M.v);var I=O.node(T),q=O.node(N),H=I,B=!1;I.lim>q.lim&&(H=q,B=!0);var $=t.filter(E.edges(),function(V){return B===A(O,O.node(V.v),H)&&B!==A(O,O.node(V.w),H)});return t.minBy($,function(V){return n(E,V)})}function w(O,E,M,T){var N=M.v,I=M.w;O.removeEdge(N,I),O.setEdge(T.v,T.w,{}),m(O),u(O,E),C(O,E)}function C(O,E){var M=t.find(O.nodes(),function(N){return!E.node(N).parent}),T=r(O,M);T=T.slice(1),t.forEach(T,function(N){var I=O.node(N).parent,q=E.edge(N,I),H=!1;q||(q=E.edge(I,N),H=!0),E.node(N).rank=E.node(I).rank+(H?q.minlen:-q.minlen)})}function k(O,E,M){return O.hasEdge(E,M)}function A(O,E,M){return M.low<=E.lim&&E.lim<=M.lim}return b1}var x1,ND;function wX(){if(ND)return x1;ND=1;var t=Ad(),e=t.longestPath,n=xz(),i=xX();x1=r;function r(u){switch(u.graph().ranker){case"network-simplex":c(u);break;case"tight-tree":l(u);break;case"longest-path":s(u);break;default:c(u)}}var s=e;function l(u){e(u),n(u)}function c(u){i(u)}return x1}var w1,RD;function SX(){if(RD)return w1;RD=1;var t=Ot();w1=e;function e(r){var s=i(r);t.forEach(r.graph().dummyChains,function(l){for(var c=r.node(l),u=c.edgeObj,h=n(r,s,u.v,u.w),d=h.path,m=h.lca,g=0,v=d[g],x=!0;l!==u.w;){if(c=r.node(l),x){for(;(v=d[g])!==m&&r.node(v).maxRank<c.rank;)g++;v===m&&(x=!1)}if(!x){for(;g<d.length-1&&r.node(v=d[g+1]).minRank<=c.rank;)g++;v=d[g]}r.setParent(l,v),l=r.successors(l)[0]}})}function n(r,s,l,c){var u=[],h=[],d=Math.min(s[l].low,s[c].low),m=Math.max(s[l].lim,s[c].lim),g,v;g=l;do g=r.parent(g),u.push(g);while(g&&(s[g].low>d||m>s[g].lim));for(v=g,g=c;(g=r.parent(g))!==v;)h.push(g);return{path:u.concat(h.reverse()),lca:v}}function i(r){var s={},l=0;function c(u){var h=l;t.forEach(r.children(u),c),s[u]={low:h,lim:l++}}return t.forEach(r.children(),c),s}return w1}var S1,DD;function CX(){if(DD)return S1;DD=1;var t=Ot(),e=Kn();S1={run:n,cleanup:l};function n(c){var u=e.addDummyNode(c,"root",{},"_root"),h=r(c),d=t.max(t.values(h))-1,m=2*d+1;c.graph().nestingRoot=u,t.forEach(c.edges(),function(v){c.edge(v).minlen*=m});var g=s(c)+1;t.forEach(c.children(),function(v){i(c,u,m,g,d,h,v)}),c.graph().nodeRankFactor=m}function i(c,u,h,d,m,g,v){var x=c.children(v);if(!x.length){v!==u&&c.setEdge(u,v,{weight:0,minlen:h});return}var w=e.addBorderNode(c,"_bt"),C=e.addBorderNode(c,"_bb"),k=c.node(v);c.setParent(w,v),k.borderTop=w,c.setParent(C,v),k.borderBottom=C,t.forEach(x,function(A){i(c,u,h,d,m,g,A);var O=c.node(A),E=O.borderTop?O.borderTop:A,M=O.borderBottom?O.borderBottom:A,T=O.borderTop?d:2*d,N=E!==M?1:m-g[v]+1;c.setEdge(w,E,{weight:T,minlen:N,nestingEdge:!0}),c.setEdge(M,C,{weight:T,minlen:N,nestingEdge:!0})}),c.parent(v)||c.setEdge(u,w,{weight:0,minlen:m+g[v]})}function r(c){var u={};function h(d,m){var g=c.children(d);g&&g.length&&t.forEach(g,function(v){h(v,m+1)}),u[d]=m}return t.forEach(c.children(),function(d){h(d,1)}),u}function s(c){return t.reduce(c.edges(),function(u,h){return u+c.edge(h).weight},0)}function l(c){var u=c.graph();c.removeNode(u.nestingRoot),delete u.nestingRoot,t.forEach(c.edges(),function(h){var d=c.edge(h);d.nestingEdge&&c.removeEdge(h)})}return S1}var C1,LD;function kX(){if(LD)return C1;LD=1;var t=Ot(),e=Kn();C1=n;function n(r){function s(l){var c=r.children(l),u=r.node(l);if(c.length&&t.forEach(c,s),t.has(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(var h=u.minRank,d=u.maxRank+1;h<d;++h)i(r,"borderLeft","_bl",l,u,h),i(r,"borderRight","_br",l,u,h)}}t.forEach(r.children(),s)}function i(r,s,l,c,u,h){var d={width:0,height:0,rank:h,borderType:s},m=u[s][h-1],g=e.addDummyNode(r,"border",d,l);u[s][h]=g,r.setParent(g,c),m&&r.setEdge(m,g,{weight:1})}return C1}var k1,zD;function AX(){if(zD)return k1;zD=1;var t=Ot();k1={adjust:e,undo:n};function e(h){var d=h.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(h)}function n(h){var d=h.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&s(h),(d==="lr"||d==="rl")&&(c(h),i(h))}function i(h){t.forEach(h.nodes(),function(d){r(h.node(d))}),t.forEach(h.edges(),function(d){r(h.edge(d))})}function r(h){var d=h.width;h.width=h.height,h.height=d}function s(h){t.forEach(h.nodes(),function(d){l(h.node(d))}),t.forEach(h.edges(),function(d){var m=h.edge(d);t.forEach(m.points,l),t.has(m,"y")&&l(m)})}function l(h){h.y=-h.y}function c(h){t.forEach(h.nodes(),function(d){u(h.node(d))}),t.forEach(h.edges(),function(d){var m=h.edge(d);t.forEach(m.points,u),t.has(m,"x")&&u(m)})}function u(h){var d=h.x;h.x=h.y,h.y=d}return k1}var A1,qD;function _X(){if(qD)return A1;qD=1;var t=Ot();A1=e;function e(n){var i={},r=t.filter(n.nodes(),function(h){return!n.children(h).length}),s=t.max(t.map(r,function(h){return n.node(h).rank})),l=t.map(t.range(s+1),function(){return[]});function c(h){if(!t.has(i,h)){i[h]=!0;var d=n.node(h);l[d.rank].push(h),t.forEach(n.successors(h),c)}}var u=t.sortBy(r,function(h){return n.node(h).rank});return t.forEach(u,c),l}return A1}var _1,BD;function OX(){if(BD)return _1;BD=1;var t=Ot();_1=e;function e(i,r){for(var s=0,l=1;l<r.length;++l)s+=n(i,r[l-1],r[l]);return s}function n(i,r,s){for(var l=t.zipObject(s,t.map(s,function(g,v){return v})),c=t.flatten(t.map(r,function(g){return t.sortBy(t.map(i.outEdges(g),function(v){return{pos:l[v.w],weight:i.edge(v).weight}}),"pos")}),!0),u=1;u<s.length;)u<<=1;var h=2*u-1;u-=1;var d=t.map(new Array(h),function(){return 0}),m=0;return t.forEach(c.forEach(function(g){var v=g.pos+u;d[v]+=g.weight;for(var x=0;v>0;)v%2&&(x+=d[v+1]),v=v-1>>1,d[v]+=g.weight;m+=g.weight*x})),m}return _1}var O1,jD;function EX(){if(jD)return O1;jD=1;var t=Ot();O1=e;function e(n,i){return t.map(i,function(r){var s=n.inEdges(r);if(s.length){var l=t.reduce(s,function(c,u){var h=n.edge(u),d=n.node(u.v);return{sum:c.sum+h.weight*d.order,weight:c.weight+h.weight}},{sum:0,weight:0});return{v:r,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:r}})}return O1}var E1,ID;function TX(){if(ID)return E1;ID=1;var t=Ot();E1=e;function e(r,s){var l={};t.forEach(r,function(u,h){var d=l[u.v]={indegree:0,in:[],out:[],vs:[u.v],i:h};t.isUndefined(u.barycenter)||(d.barycenter=u.barycenter,d.weight=u.weight)}),t.forEach(s.edges(),function(u){var h=l[u.v],d=l[u.w];!t.isUndefined(h)&&!t.isUndefined(d)&&(d.indegree++,h.out.push(l[u.w]))});var c=t.filter(l,function(u){return!u.indegree});return n(c)}function n(r){var s=[];function l(h){return function(d){d.merged||(t.isUndefined(d.barycenter)||t.isUndefined(h.barycenter)||d.barycenter>=h.barycenter)&&i(h,d)}}function c(h){return function(d){d.in.push(h),--d.indegree===0&&r.push(d)}}for(;r.length;){var u=r.pop();s.push(u),t.forEach(u.in.reverse(),l(u)),t.forEach(u.out,c(u))}return t.map(t.filter(s,function(h){return!h.merged}),function(h){return t.pick(h,["vs","i","barycenter","weight"])})}function i(r,s){var l=0,c=0;r.weight&&(l+=r.barycenter*r.weight,c+=r.weight),s.weight&&(l+=s.barycenter*s.weight,c+=s.weight),r.vs=s.vs.concat(r.vs),r.barycenter=l/c,r.weight=c,r.i=Math.min(s.i,r.i),s.merged=!0}return E1}var T1,PD;function MX(){if(PD)return T1;PD=1;var t=Ot(),e=Kn();T1=n;function n(s,l){var c=e.partition(s,function(w){return t.has(w,"barycenter")}),u=c.lhs,h=t.sortBy(c.rhs,function(w){return-w.i}),d=[],m=0,g=0,v=0;u.sort(r(!!l)),v=i(d,h,v),t.forEach(u,function(w){v+=w.vs.length,d.push(w.vs),m+=w.barycenter*w.weight,g+=w.weight,v=i(d,h,v)});var x={vs:t.flatten(d,!0)};return g&&(x.barycenter=m/g,x.weight=g),x}function i(s,l,c){for(var u;l.length&&(u=t.last(l)).i<=c;)l.pop(),s.push(u.vs),c++;return c}function r(s){return function(l,c){return l.barycenter<c.barycenter?-1:l.barycenter>c.barycenter?1:s?c.i-l.i:l.i-c.i}}return T1}var M1,HD;function NX(){if(HD)return M1;HD=1;var t=Ot(),e=EX(),n=TX(),i=MX();M1=r;function r(c,u,h,d){var m=c.children(u),g=c.node(u),v=g?g.borderLeft:void 0,x=g?g.borderRight:void 0,w={};v&&(m=t.filter(m,function(M){return M!==v&&M!==x}));var C=e(c,m);t.forEach(C,function(M){if(c.children(M.v).length){var T=r(c,M.v,h,d);w[M.v]=T,t.has(T,"barycenter")&&l(M,T)}});var k=n(C,h);s(k,w);var A=i(k,d);if(v&&(A.vs=t.flatten([v,A.vs,x],!0),c.predecessors(v).length)){var O=c.node(c.predecessors(v)[0]),E=c.node(c.predecessors(x)[0]);t.has(A,"barycenter")||(A.barycenter=0,A.weight=0),A.barycenter=(A.barycenter*A.weight+O.order+E.order)/(A.weight+2),A.weight+=2}return A}function s(c,u){t.forEach(c,function(h){h.vs=t.flatten(h.vs.map(function(d){return u[d]?u[d].vs:d}),!0)})}function l(c,u){t.isUndefined(c.barycenter)?(c.barycenter=u.barycenter,c.weight=u.weight):(c.barycenter=(c.barycenter*c.weight+u.barycenter*u.weight)/(c.weight+u.weight),c.weight+=u.weight)}return M1}var N1,UD;function RX(){if(UD)return N1;UD=1;var t=Ot(),e=Gi().Graph;N1=n;function n(r,s,l){var c=i(r),u=new e({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(h){return r.node(h)});return t.forEach(r.nodes(),function(h){var d=r.node(h),m=r.parent(h);(d.rank===s||d.minRank<=s&&s<=d.maxRank)&&(u.setNode(h),u.setParent(h,m||c),t.forEach(r[l](h),function(g){var v=g.v===h?g.w:g.v,x=u.edge(v,h),w=t.isUndefined(x)?0:x.weight;u.setEdge(v,h,{weight:r.edge(g).weight+w})}),t.has(d,"minRank")&&u.setNode(h,{borderLeft:d.borderLeft[s],borderRight:d.borderRight[s]}))}),u}function i(r){for(var s;r.hasNode(s=t.uniqueId("_root")););return s}return N1}var R1,VD;function DX(){if(VD)return R1;VD=1;var t=Ot();R1=e;function e(n,i,r){var s={},l;t.forEach(r,function(c){for(var u=n.parent(c),h,d;u;){if(h=n.parent(u),h?(d=s[h],s[h]=u):(d=l,l=u),d&&d!==u){i.setEdge(d,u);return}u=h}})}return R1}var D1,FD;function LX(){if(FD)return D1;FD=1;var t=Ot(),e=_X(),n=OX(),i=NX(),r=RX(),s=DX(),l=Gi().Graph,c=Kn();D1=u;function u(g){var v=c.maxRank(g),x=h(g,t.range(1,v+1),"inEdges"),w=h(g,t.range(v-1,-1,-1),"outEdges"),C=e(g);m(g,C);for(var k=Number.POSITIVE_INFINITY,A,O=0,E=0;E<4;++O,++E){d(O%2?x:w,O%4>=2),C=c.buildLayerMatrix(g);var M=n(g,C);M<k&&(E=0,A=t.cloneDeep(C),k=M)}m(g,A)}function h(g,v,x){return t.map(v,function(w){return r(g,w,x)})}function d(g,v){var x=new l;t.forEach(g,function(w){var C=w.graph().root,k=i(w,C,x,v);t.forEach(k.vs,function(A,O){w.node(A).order=O}),s(w,x,k.vs)})}function m(g,v){t.forEach(v,function(x){t.forEach(x,function(w,C){g.node(w).order=C})})}return D1}var L1,$D;function zX(){if($D)return L1;$D=1;var t=Ot(),e=Gi().Graph,n=Kn();L1={positionX:x,findType1Conflicts:i,findType2Conflicts:r,addConflict:l,hasConflict:c,verticalAlignment:u,horizontalCompaction:h,alignCoordinates:g,findSmallestWidthAlignment:m,balance:v};function i(k,A){var O={};function E(M,T){var N=0,I=0,q=M.length,H=t.last(T);return t.forEach(T,function(B,$){var V=s(k,B),D=V?k.node(V).order:q;(V||B===H)&&(t.forEach(T.slice(I,$+1),function(P){t.forEach(k.predecessors(P),function(L){var Q=k.node(L),Z=Q.order;(Z<N||D<Z)&&!(Q.dummy&&k.node(P).dummy)&&l(O,L,P)})}),I=$+1,N=D)}),T}return t.reduce(A,E),O}function r(k,A){var O={};function E(T,N,I,q,H){var B;t.forEach(t.range(N,I),function($){B=T[$],k.node(B).dummy&&t.forEach(k.predecessors(B),function(V){var D=k.node(V);D.dummy&&(D.order<q||D.order>H)&&l(O,V,B)})})}function M(T,N){var I=-1,q,H=0;return t.forEach(N,function(B,$){if(k.node(B).dummy==="border"){var V=k.predecessors(B);V.length&&(q=k.node(V[0]).order,E(N,H,$,I,q),H=$,I=q)}E(N,H,N.length,q,T.length)}),N}return t.reduce(A,M),O}function s(k,A){if(k.node(A).dummy)return t.find(k.predecessors(A),function(O){return k.node(O).dummy})}function l(k,A,O){if(A>O){var E=A;A=O,O=E}var M=k[A];M||(k[A]=M={}),M[O]=!0}function c(k,A,O){if(A>O){var E=A;A=O,O=E}return t.has(k[A],O)}function u(k,A,O,E){var M={},T={},N={};return t.forEach(A,function(I){t.forEach(I,function(q,H){M[q]=q,T[q]=q,N[q]=H})}),t.forEach(A,function(I){var q=-1;t.forEach(I,function(H){var B=E(H);if(B.length){B=t.sortBy(B,function(L){return N[L]});for(var $=(B.length-1)/2,V=Math.floor($),D=Math.ceil($);V<=D;++V){var P=B[V];T[H]===H&&q<N[P]&&!c(O,H,P)&&(T[P]=H,T[H]=M[H]=M[P],q=N[P])}}})}),{root:M,align:T}}function h(k,A,O,E,M){var T={},N=d(k,A,O,M),I=M?"borderLeft":"borderRight";function q($,V){for(var D=N.nodes(),P=D.pop(),L={};P;)L[P]?$(P):(L[P]=!0,D.push(P),D=D.concat(V(P))),P=D.pop()}function H($){T[$]=N.inEdges($).reduce(function(V,D){return Math.max(V,T[D.v]+N.edge(D))},0)}function B($){var V=N.outEdges($).reduce(function(P,L){return Math.min(P,T[L.w]-N.edge(L))},Number.POSITIVE_INFINITY),D=k.node($);V!==Number.POSITIVE_INFINITY&&D.borderType!==I&&(T[$]=Math.max(T[$],V))}return q(H,N.predecessors.bind(N)),q(B,N.successors.bind(N)),t.forEach(E,function($){T[$]=T[O[$]]}),T}function d(k,A,O,E){var M=new e,T=k.graph(),N=w(T.nodesep,T.edgesep,E);return t.forEach(A,function(I){var q;t.forEach(I,function(H){var B=O[H];if(M.setNode(B),q){var $=O[q],V=M.edge($,B);M.setEdge($,B,Math.max(N(k,H,q),V||0))}q=H})}),M}function m(k,A){return t.minBy(t.values(A),function(O){var E=Number.NEGATIVE_INFINITY,M=Number.POSITIVE_INFINITY;return t.forIn(O,function(T,N){var I=C(k,N)/2;E=Math.max(T+I,E),M=Math.min(T-I,M)}),E-M})}function g(k,A){var O=t.values(A),E=t.min(O),M=t.max(O);t.forEach(["u","d"],function(T){t.forEach(["l","r"],function(N){var I=T+N,q=k[I],H;if(q!==A){var B=t.values(q);H=N==="l"?E-t.min(B):M-t.max(B),H&&(k[I]=t.mapValues(q,function($){return $+H}))}})})}function v(k,A){return t.mapValues(k.ul,function(O,E){if(A)return k[A.toLowerCase()][E];var M=t.sortBy(t.map(k,E));return(M[1]+M[2])/2})}function x(k){var A=n.buildLayerMatrix(k),O=t.merge(i(k,A),r(k,A)),E={},M;t.forEach(["u","d"],function(N){M=N==="u"?A:t.values(A).reverse(),t.forEach(["l","r"],function(I){I==="r"&&(M=t.map(M,function($){return t.values($).reverse()}));var q=(N==="u"?k.predecessors:k.successors).bind(k),H=u(k,M,O,q),B=h(k,M,H.root,H.align,I==="r");I==="r"&&(B=t.mapValues(B,function($){return-$})),E[N+I]=B})});var T=m(k,E);return g(E,T),v(E,k.graph().align)}function w(k,A,O){return function(E,M,T){var N=E.node(M),I=E.node(T),q=0,H;if(q+=N.width/2,t.has(N,"labelpos"))switch(N.labelpos.toLowerCase()){case"l":H=-N.width/2;break;case"r":H=N.width/2;break}if(H&&(q+=O?H:-H),H=0,q+=(N.dummy?A:k)/2,q+=(I.dummy?A:k)/2,q+=I.width/2,t.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":H=I.width/2;break;case"r":H=-I.width/2;break}return H&&(q+=O?H:-H),H=0,q}}function C(k,A){return k.node(A).width}return L1}var z1,GD;function qX(){if(GD)return z1;GD=1;var t=Ot(),e=Kn(),n=zX().positionX;z1=i;function i(s){s=e.asNonCompoundGraph(s),r(s),t.forEach(n(s),function(l,c){s.node(c).x=l})}function r(s){var l=e.buildLayerMatrix(s),c=s.graph().ranksep,u=0;t.forEach(l,function(h){var d=t.max(t.map(h,function(m){return s.node(m).height}));t.forEach(h,function(m){s.node(m).y=u+d/2}),u+=d+c})}return z1}var q1,YD;function BX(){if(YD)return q1;YD=1;var t=Ot(),e=vX(),n=bX(),i=wX(),r=Kn().normalizeRanks,s=SX(),l=Kn().removeEmptyRanks,c=CX(),u=kX(),h=AX(),d=LX(),m=qX(),g=Kn(),v=Gi().Graph;q1=x;function x(j,K){var ee=K&&K.debugTiming?g.time:g.notime;ee("layout",function(){var oe=ee(" buildLayoutGraph",function(){return q(j)});ee(" runLayout",function(){w(oe,ee)}),ee(" updateInputGraph",function(){C(j,oe)})})}function w(j,K){K(" makeSpaceForEdgeLabels",function(){H(j)}),K(" removeSelfEdges",function(){U(j)}),K(" acyclic",function(){e.run(j)}),K(" nestingGraph.run",function(){c.run(j)}),K(" rank",function(){i(g.asNonCompoundGraph(j))}),K(" injectEdgeLabelProxies",function(){B(j)}),K(" removeEmptyRanks",function(){l(j)}),K(" nestingGraph.cleanup",function(){c.cleanup(j)}),K(" normalizeRanks",function(){r(j)}),K(" assignRankMinMax",function(){$(j)}),K(" removeEdgeLabelProxies",function(){V(j)}),K(" normalize.run",function(){n.run(j)}),K(" parentDummyChains",function(){s(j)}),K(" addBorderSegments",function(){u(j)}),K(" order",function(){d(j)}),K(" insertSelfEdges",function(){re(j)}),K(" adjustCoordinateSystem",function(){h.adjust(j)}),K(" position",function(){m(j)}),K(" positionSelfEdges",function(){z(j)}),K(" removeBorderNodes",function(){Z(j)}),K(" normalize.undo",function(){n.undo(j)}),K(" fixupEdgeLabelCoords",function(){L(j)}),K(" undoCoordinateSystem",function(){h.undo(j)}),K(" translateGraph",function(){D(j)}),K(" assignNodeIntersects",function(){P(j)}),K(" reversePoints",function(){Q(j)}),K(" acyclic.undo",function(){e.undo(j)})}function C(j,K){t.forEach(j.nodes(),function(ee){var oe=j.node(ee),ge=K.node(ee);oe&&(oe.x=ge.x,oe.y=ge.y,K.children(ee).length&&(oe.width=ge.width,oe.height=ge.height))}),t.forEach(j.edges(),function(ee){var oe=j.edge(ee),ge=K.edge(ee);oe.points=ge.points,t.has(ge,"x")&&(oe.x=ge.x,oe.y=ge.y)}),j.graph().width=K.graph().width,j.graph().height=K.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],A={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},O=["acyclicer","ranker","rankdir","align"],E=["width","height"],M={width:0,height:0},T=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},I=["labelpos"];function q(j){var K=new v({multigraph:!0,compound:!0}),ee=te(j.graph());return K.setGraph(t.merge({},A,G(ee,k),t.pick(ee,O))),t.forEach(j.nodes(),function(oe){var ge=te(j.node(oe));K.setNode(oe,t.defaults(G(ge,E),M)),K.setParent(oe,j.parent(oe))}),t.forEach(j.edges(),function(oe){var ge=te(j.edge(oe));K.setEdge(oe,t.merge({},N,G(ge,T),t.pick(ge,I)))}),K}function H(j){var K=j.graph();K.ranksep/=2,t.forEach(j.edges(),function(ee){var oe=j.edge(ee);oe.minlen*=2,oe.labelpos.toLowerCase()!=="c"&&(K.rankdir==="TB"||K.rankdir==="BT"?oe.width+=oe.labeloffset:oe.height+=oe.labeloffset)})}function B(j){t.forEach(j.edges(),function(K){var ee=j.edge(K);if(ee.width&&ee.height){var oe=j.node(K.v),ge=j.node(K.w),xe={rank:(ge.rank-oe.rank)/2+oe.rank,e:K};g.addDummyNode(j,"edge-proxy",xe,"_ep")}})}function $(j){var K=0;t.forEach(j.nodes(),function(ee){var oe=j.node(ee);oe.borderTop&&(oe.minRank=j.node(oe.borderTop).rank,oe.maxRank=j.node(oe.borderBottom).rank,K=t.max(K,oe.maxRank))}),j.graph().maxRank=K}function V(j){t.forEach(j.nodes(),function(K){var ee=j.node(K);ee.dummy==="edge-proxy"&&(j.edge(ee.e).labelRank=ee.rank,j.removeNode(K))})}function D(j){var K=Number.POSITIVE_INFINITY,ee=0,oe=Number.POSITIVE_INFINITY,ge=0,xe=j.graph(),Me=xe.marginx||0,X=xe.marginy||0;function pe(Se){var ye=Se.x,_e=Se.y,ot=Se.width,Oe=Se.height;K=Math.min(K,ye-ot/2),ee=Math.max(ee,ye+ot/2),oe=Math.min(oe,_e-Oe/2),ge=Math.max(ge,_e+Oe/2)}t.forEach(j.nodes(),function(Se){pe(j.node(Se))}),t.forEach(j.edges(),function(Se){var ye=j.edge(Se);t.has(ye,"x")&&pe(ye)}),K-=Me,oe-=X,t.forEach(j.nodes(),function(Se){var ye=j.node(Se);ye.x-=K,ye.y-=oe}),t.forEach(j.edges(),function(Se){var ye=j.edge(Se);t.forEach(ye.points,function(_e){_e.x-=K,_e.y-=oe}),t.has(ye,"x")&&(ye.x-=K),t.has(ye,"y")&&(ye.y-=oe)}),xe.width=ee-K+Me,xe.height=ge-oe+X}function P(j){t.forEach(j.edges(),function(K){var ee=j.edge(K),oe=j.node(K.v),ge=j.node(K.w),xe,Me;ee.points?(xe=ee.points[0],Me=ee.points[ee.points.length-1]):(ee.points=[],xe=ge,Me=oe),ee.points.unshift(g.intersectRect(oe,xe)),ee.points.push(g.intersectRect(ge,Me))})}function L(j){t.forEach(j.edges(),function(K){var ee=j.edge(K);if(t.has(ee,"x"))switch((ee.labelpos==="l"||ee.labelpos==="r")&&(ee.width-=ee.labeloffset),ee.labelpos){case"l":ee.x-=ee.width/2+ee.labeloffset;break;case"r":ee.x+=ee.width/2+ee.labeloffset;break}})}function Q(j){t.forEach(j.edges(),function(K){var ee=j.edge(K);ee.reversed&&ee.points.reverse()})}function Z(j){t.forEach(j.nodes(),function(K){if(j.children(K).length){var ee=j.node(K),oe=j.node(ee.borderTop),ge=j.node(ee.borderBottom),xe=j.node(t.last(ee.borderLeft)),Me=j.node(t.last(ee.borderRight));ee.width=Math.abs(Me.x-xe.x),ee.height=Math.abs(ge.y-oe.y),ee.x=xe.x+ee.width/2,ee.y=oe.y+ee.height/2}}),t.forEach(j.nodes(),function(K){j.node(K).dummy==="border"&&j.removeNode(K)})}function U(j){t.forEach(j.edges(),function(K){if(K.v===K.w){var ee=j.node(K.v);ee.selfEdges||(ee.selfEdges=[]),ee.selfEdges.push({e:K,label:j.edge(K)}),j.removeEdge(K)}})}function re(j){var K=g.buildLayerMatrix(j);t.forEach(K,function(ee){var oe=0;t.forEach(ee,function(ge,xe){var Me=j.node(ge);Me.order=xe+oe,t.forEach(Me.selfEdges,function(X){g.addDummyNode(j,"selfedge",{width:X.label.width,height:X.label.height,rank:Me.rank,order:xe+ ++oe,e:X.e,label:X.label},"_se")}),delete Me.selfEdges})})}function z(j){t.forEach(j.nodes(),function(K){var ee=j.node(K);if(ee.dummy==="selfedge"){var oe=j.node(ee.e.v),ge=oe.x+oe.width/2,xe=oe.y,Me=ee.x-ge,X=oe.height/2;j.setEdge(ee.e,ee.label),j.removeNode(K),ee.label.points=[{x:ge+2*Me/3,y:xe-X},{x:ge+5*Me/6,y:xe-X},{x:ge+Me,y:xe},{x:ge+5*Me/6,y:xe+X},{x:ge+2*Me/3,y:xe+X}],ee.label.x=ee.x,ee.label.y=ee.y}})}function G(j,K){return t.mapValues(t.pick(j,K),Number)}function te(j){var K={};return t.forEach(j,function(ee,oe){K[oe.toLowerCase()]=ee}),K}return q1}var B1,QD;function jX(){if(QD)return B1;QD=1;var t=Ot(),e=Kn(),n=Gi().Graph;B1={debugOrdering:i};function i(r){var s=e.buildLayerMatrix(r),l=new n({compound:!0,multigraph:!0}).setGraph({});return t.forEach(r.nodes(),function(c){l.setNode(c,{label:c}),l.setParent(c,"layer"+r.node(c).rank)}),t.forEach(r.edges(),function(c){l.setEdge(c.v,c.w,{},c.name)}),t.forEach(s,function(c,u){var h="layer"+u;l.setNode(h,{rank:"same"}),t.reduce(c,function(d,m){return l.setEdge(d,m,{style:"invis"}),m})}),l}return B1}var j1,XD;function IX(){return XD||(XD=1,j1="0.8.5"),j1}var I1,WD;function PX(){return WD||(WD=1,I1={graphlib:Gi(),layout:BX(),debug:jX(),util:{time:Kn().time,notime:Kn().notime},version:IX()}),I1}var HX=PX();const Ah=FS(HX);function Vn(t){if(!t||typeof t!="object")throw new Error("Invalid YAML: Root must be an object");const e={tables:Array.isArray(t.tables)?t.tables:[],relationships:Array.isArray(t.relationships)?t.relationships:[],domains:Array.isArray(t.domains)?t.domains:[],annotations:Array.isArray(t.annotations)?t.annotations:[],layout:t.layout||{}};return e.tables=e.tables.map(n=>{let i=n.sampleData;if(i&&typeof i=="object"&&!Array.isArray(i)){const s=Array.isArray(i.columns)?i.columns:[],l=Array.isArray(i.rows)?i.rows:[];if(s.length>0&&l.length>0){const c=Array.isArray(n.columns)?n.columns:[];i=l.map(u=>c.map(h=>{const d=s.indexOf(h.id);return d!==-1?u[d]:null}))}else l.length>0?i=l:i=[]}const r=n.appearance?{...n.appearance}:void 0;return r&&r.sub_type&&/^type[0-7]$/.test(r.sub_type)&&!r.scd&&(r.scd=r.sub_type,r.sub_type=void 0),{...n,id:n.id||"unknown",name:n.name!==void 0?n.name:n.id||"Unnamed Table",logical_name:n.logical_name,physical_name:n.physical_name,appearance:r,lineage:n.lineage?{...n.lineage}:void 0,columns:Array.isArray(n.columns)?n.columns.map(s=>({...s,logical:s.logical?{...s.logical}:void 0,physical:s.physical?{...s.physical}:void 0})):[],sampleData:Array.isArray(i)?i:[]}}),e}function UX(t){try{const e=Uw.load(t);return Vn(e)}catch(e){throw new Error(`YAML Parsing Error: ${e.message}`)}}let P1=null;const en=aF((t,e)=>({schema:null,selectedTableId:null,selectedEdgeId:null,selectedAnnotationId:null,hoveredColumnId:null,error:null,isCliMode:typeof window<"u"&&window.MODSCAPE_CLI_MODE===!0,isAutoSaveEnabled:!0,lastSavedAt:0,savingStatus:"idle",lastUpdateSource:"visual",yamlInput:"",setYamlInput:n=>t({yamlInput:n,lastUpdateSource:"user"}),syncToYamlInput:()=>{const{schema:n}=e();if(n){const i=Uw.dump(n,{indent:2,lineWidth:-1,noRefs:!0});t({yamlInput:i,lastUpdateSource:"visual"})}},availableFiles:[],currentModelSlug:null,isSidebarOpen:!0,isRightPanelOpen:!1,isPresentationMode:!1,activeTab:"editor",activeRightPanelTab:"tables",focusNodeId:null,pathFinderResult:null,showER:!0,showLineage:!0,showAnnotations:!0,connectionStartHandle:null,theme:typeof window<"u"&&localStorage.getItem("modscape-theme")||(window.matchMedia?.("(prefers-color-scheme: light)").matches?"light":"dark"),isDetailPanelSuppressed:!1,isDetailPanelMinimized:!0,setSchema:n=>{try{const i=Vn(n);t({schema:i,error:null}),e().syncToYamlInput()}catch(i){t({error:i.message})}},setShowER:n=>t({showER:n}),setShowLineage:n=>t({showLineage:n}),setShowAnnotations:n=>t({showAnnotations:n}),setIsPresentationMode:n=>t({isPresentationMode:n}),setIsAutoSaveEnabled:n=>t({isAutoSaveEnabled:n}),setLastUpdateSource:n=>t({lastUpdateSource:n}),setSelectedTableId:n=>t({selectedTableId:n,selectedEdgeId:null,selectedAnnotationId:null,isDetailPanelMinimized:n?e().isDetailPanelMinimized:!0}),setSelectedEdgeId:n=>t({selectedEdgeId:n,selectedTableId:null,selectedAnnotationId:null,isDetailPanelMinimized:n?e().isDetailPanelMinimized:!0}),setSelectedAnnotationId:n=>t({selectedAnnotationId:n,selectedTableId:null,selectedEdgeId:null,isDetailPanelMinimized:n?e().isDetailPanelMinimized:!0}),setIsDetailPanelSuppressed:n=>t({isDetailPanelSuppressed:n}),setIsDetailPanelMinimized:n=>t({isDetailPanelMinimized:n}),setHoveredColumnId:n=>t({hoveredColumnId:n}),setIsCliMode:n=>t({isCliMode:n}),setIsSidebarOpen:n=>t({isSidebarOpen:n}),setIsRightPanelOpen:n=>t({isRightPanelOpen:n}),setActiveTab:n=>t({activeTab:n}),setActiveRightPanelTab:n=>t({activeRightPanelTab:n,pathFinderResult:null}),setPathFinderResult:n=>t({pathFinderResult:n}),setFocusNodeId:n=>t({focusNodeId:n}),setConnectionStartHandle:n=>t({connectionStartHandle:n}),toggleTheme:()=>{const{theme:n}=e(),i=n==="dark"?"light":"dark";t({theme:i}),localStorage.setItem("modscape-theme",i)},calculateAutoLayout:()=>{const{schema:n}=e();if(!n)return;const i={...n.layout||{}},r=320,s=220,l=80,c=120,u={};n.domains?.forEach(g=>{const v=g.tables;if(v.length===0){u[g.id]={width:400,height:200,tableOffsets:{}};return}const x=new Ah.graphlib.Graph;x.setGraph({rankdir:"TB",nodesep:l,ranksep:l}),x.setDefaultEdgeLabel(()=>({})),v.forEach(T=>{const N=n.layout?.[T];x.setNode(T,{width:N?.width||r,height:N?.height||s})}),(n.relationships||[]).forEach(T=>{v.includes(T.from.table)&&v.includes(T.to.table)&&x.setEdge(T.from.table,T.to.table)}),n.tables.forEach(T=>{v.includes(T.id)&&T.lineage?.upstream&&T.lineage.upstream.forEach(N=>{v.includes(N)&&x.setEdge(N,T.id)})}),Ah.layout(x);let w=1/0,C=1/0,k=-1/0,A=-1/0;const O={};x.nodes().forEach(T=>{const N=x.node(T);O[T]={x:N.x,y:N.y},w=Math.min(w,N.x-N.width/2),C=Math.min(C,N.y-N.height/2),k=Math.max(k,N.x+N.width/2),A=Math.max(A,N.y+N.height/2)});const E=k-w+c,M=A-C+c;v.forEach(T=>{O[T].x=Math.round(O[T].x-w-x.node(T).width/2+c/2),O[T].y=Math.round(O[T].y-C-x.node(T).height/2+c/2)}),u[g.id]={width:E,height:M,tableOffsets:O}});const h=[...n.domains?.map(g=>g.id)||[],...n.tables.filter(g=>!n.domains?.some(v=>v.tables.includes(g.id))).map(g=>g.id)],d=new Ah.graphlib.Graph;d.setGraph({rankdir:"LR",nodesep:200,ranksep:300}),d.setDefaultEdgeLabel(()=>({})),h.forEach(g=>{const v=n.domains?.some(C=>C.id===g),x=v?u[g].width:n.layout?.[g]?.width||r,w=v?u[g].height:n.layout?.[g]?.height||s;d.setNode(g,{width:x,height:w})});const m=g=>n.domains?.find(v=>v.tables.includes(g))?.id||g;n.relationships?.forEach(g=>{const v=m(g.from.table),x=m(g.to.table);v!==x&&d.setEdge(v,x)}),n.tables.forEach(g=>{if(g.lineage?.upstream){const v=m(g.id);g.lineage.upstream.forEach(x=>{const w=m(x);w!==v&&d.setEdge(w,v)})}}),Ah.layout(d),d.nodes().forEach(g=>{const v=d.node(g),x=Math.round(v.x-v.width/2),w=Math.round(v.y-v.height/2),C=n.domains?.find(k=>k.id===g);C?(i[g]={x,y:w,width:u[g].width,height:u[g].height},C.tables.forEach(k=>{i[k]={x:u[g].tableOffsets[k].x,y:u[g].tableOffsets[k].y}})):i[g]={x,y:w}}),t({schema:{...n,layout:i},lastUpdateSource:"visual"}),e().syncToYamlInput(),e().saveSchema(!0)},fetchAvailableFiles:async()=>{const n=window.__MODSCAPE_DATA__;if(n&&n.models){const i=n.models.map(r=>({slug:r.slug,name:r.name,path:""}));t({availableFiles:i});return}try{const r=await(await fetch("/api/files")).json();t({availableFiles:r})}catch(i){console.error("Failed to fetch files:",i)}},setCurrentModel:async n=>{const i=window.__MODSCAPE_DATA__;if(i&&i.models){const r=i.models.find(s=>s.slug===n);if(r){t({currentModelSlug:n,schema:Vn(r.schema),selectedTableId:null,selectedEdgeId:null,selectedAnnotationId:null,error:null}),e().syncToYamlInput();const s=new URLSearchParams(window.location.search);s.set("model",n);const l=window.location.pathname+"?"+s.toString();window.history.pushState(null,"",l)}return}try{const r=`/api/model?model=${n}`,l=await(await fetch(r)).json();t({currentModelSlug:n,schema:Vn(l),selectedTableId:null,selectedEdgeId:null,selectedAnnotationId:null,error:null}),e().syncToYamlInput();const c=new URLSearchParams(window.location.search);c.set("model",n);const u=window.location.pathname+"?"+c.toString();window.history.pushState(null,"",u)}catch(r){console.error("Failed to fetch model:",r)}},parseAndSetSchema:n=>{if(!(!n||n.trim()===""))try{const i=UX(n);t({schema:i,error:null}),e().saveSchema()}catch(i){t({error:i.message})}},updateNodePosition:(n,i,r,s)=>{const l=e().schema;if(!l)return;let c=l.domains||[];s!==void 0&&(c=c.map(d=>({...d,tables:d.tables.filter(m=>m!==n)})),s&&(c=c.map(d=>d.id===s?{...d,tables:Array.from(new Set([...d.tables,n]))}:d)));const u=l.layout?.[n]||{x:0,y:0},h={...l.layout||{},[n]:{...u,x:Math.round(i),y:Math.round(r)}};t({schema:{...l,domains:c,layout:h}}),e().syncToYamlInput(),e().saveSchema()},updateNodesPosition:n=>{const i=e().schema;if(!i||n.length===0)return;const r={...i.layout||{}};n.forEach(s=>{const l=r[s.id]||{x:0,y:0};r[s.id]={...l,x:Math.round(s.x),y:Math.round(s.y)}}),t({schema:{...i,layout:r},lastUpdateSource:"visual"}),e().syncToYamlInput(),e().saveSchema()},updateNodeDimensions:(n,i,r)=>{const s=e().schema;if(!s)return;const l=s.layout?.[n]||{x:0,y:0},c={...s.layout||{},[n]:{...l,width:Math.round(i),height:Math.round(r)}};t({schema:{...s,layout:c}}),e().syncToYamlInput(),e().saveSchema()},saveSchema:async(n=!1)=>{const{schema:i,currentModelSlug:r,isAutoSaveEnabled:s,isCliMode:l}=e();!i||!l||!s&&!n||(t({savingStatus:"saving"}),P1&&clearTimeout(P1),P1=setTimeout(async()=>{try{const c=r?`/api/save?model=${r}`:"/api/save",u=Uw.dump(i,{indent:2,lineWidth:-1,noRefs:!0});await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:u})}),t({savingStatus:"saved",lastSavedAt:Date.now()}),setTimeout(()=>t({savingStatus:"idle"}),2e3)}catch(c){console.error("Failed to save schema:",c),t({savingStatus:"error"})}},500))},refreshModelData:async()=>{const{currentModelSlug:n,isCliMode:i,savingStatus:r,lastSavedAt:s}=e();if(i){if(r==="saving"||Date.now()-s<3e3){console.log("🔇 Skipping refresh: update originated from recent browser save or save in progress");return}try{t({savingStatus:"saving"}),await e().fetchAvailableFiles();let l=n;if(l||(l=new URLSearchParams(window.location.search).get("model")),!l&&e().availableFiles.length>0&&(l=e().availableFiles[0].slug),l){const c=`/api/model?model=${l}`,h=await(await fetch(c)).json(),d=Vn(h);t({schema:d,currentModelSlug:l,error:null}),e().syncToYamlInput()}t({savingStatus:"idle"})}catch(l){console.error("Failed to refresh data:",l),t({error:"Failed to refresh data from server",savingStatus:"error"})}}},addTable:(n,i)=>{const r=e().schema||{tables:[],relationships:[],domains:[],layout:{}},s=`new_table_${Date.now()}`,l={id:s,name:"NEW_TABLE",appearance:{type:"table"},columns:[{id:"id",logical:{name:"ID",type:"Integer",isPrimaryKey:!0}}]},c={...r,tables:[...r.tables||[],l],layout:{...r.layout||{},[s]:{x:Math.round(n),y:Math.round(i)}}};t({schema:Vn(c),error:null,selectedTableId:s,selectedEdgeId:null,selectedAnnotationId:null}),e().syncToYamlInput(),e().saveSchema()},addDomain:(n,i)=>{const r=e().schema||{tables:[],relationships:[],domains:[],layout:{}},s=`new_domain_${Date.now()}`,l={id:s,name:"NEW_DOMAIN",description:"Domain purpose",tables:[],color:"rgba(59, 130, 246, 0.05)"},c={...r,domains:[...r.domains||[],l],layout:{...r.layout||{},[s]:{x:Math.round(n),y:Math.round(i),width:600,height:400}}};t({schema:Vn(c),error:null,selectedTableId:s,selectedEdgeId:null,selectedAnnotationId:null}),e().syncToYamlInput(),e().saveSchema()},addRelationship:(n,i,r,s)=>{const l=e().schema;if(!l)return;if(r?.includes("lineage")||s?.includes("lineage")){e().addLineage(n,i);return}let u=n,h=i,d=r,m=s;const g=r?.includes("target"),v=s?.includes("source");(g||v)&&(u=i,h=n,d=s,m=r);const x=(E,M)=>{if(!M)return;const T=M.replace(`${E}-`,"");if(!(T.startsWith("er-")||T.startsWith("lin-")))return T.split("-")[0]||void 0},w=x(u,d),C=x(h,m);if((l.relationships||[]).some(E=>E.from.table===u&&E.from.column===w&&E.to.table===h&&E.to.column===C))return;const A={from:{table:u,column:w},to:{table:h,column:C},type:"one-to-many"},O={...l,relationships:[...l.relationships||[],A]};t({schema:Vn(O)}),e().syncToYamlInput(),e().saveSchema()},addLineage:(n,i)=>{const{schema:r}=e();if(!r)return;const s=r.tables.map(c=>{if(c.id===i){const u=c.lineage?.upstream||[];if(!u.includes(n))return{...c,lineage:{...c.lineage,upstream:[...u,n]}}}return c}),l={...r,tables:s};t({schema:Vn(l)}),e().syncToYamlInput(),e().saveSchema()},updateRelationship:(n,i)=>{const{schema:r}=e();if(!r||!r.relationships)return;const s=r.relationships.map((l,c)=>c===n?{...l,...i}:l);t({schema:{...r,relationships:s}}),e().syncToYamlInput(),e().saveSchema()},removeEdge:(n,i)=>{const{schema:r}=e();if(!r)return;const s=(r.relationships||[]).filter(u=>!(u.from.table===n&&u.to.table===i||u.from.table===i&&u.to.table===n)),l=r.tables.map(u=>u.id===i&&u.lineage?.upstream?{...u,lineage:{...u.lineage,upstream:u.lineage.upstream.filter(h=>h!==n)}}:u),c={...r,relationships:s,tables:l};t({schema:Vn(c),selectedEdgeId:null}),e().syncToYamlInput(),e().saveSchema()},removeNode:n=>{const{schema:i}=e();if(!i)return;const r=i.tables.filter(d=>d.id!==n),s=(i.domains||[]).filter(d=>d.id!==n).map(d=>({...d,tables:d.tables.filter(m=>m!==n)})),l=(i.relationships||[]).filter(d=>d.from.table!==n&&d.to.table!==n),c=(i.annotations||[]).filter(d=>d.id!==n&&d.targetId!==n),u={...i.layout||{}};delete u[n];const h={...i,tables:r,domains:s,relationships:l,annotations:c,layout:u};t({schema:Vn(h),selectedTableId:null,selectedAnnotationId:null}),e().syncToYamlInput(),e().saveSchema()},updateTable:(n,i)=>{const{schema:r}=e();if(!r)return;const s=r.tables.map(c=>c.id===n?{...c,...i}:c),l={...r,tables:s};t({schema:Vn(l)}),e().syncToYamlInput(),e().saveSchema()},updateDomain:(n,i)=>{const{schema:r}=e();if(!r||!r.domains)return;const s=r.domains.map(c=>c.id===n?{...c,...i}:c),l={...r,domains:s};t({schema:Vn(l)}),e().syncToYamlInput(),e().saveSchema()},toggleDomainLock:n=>{const{schema:i}=e();if(!i||!i.domains)return;const r=i.domains.map(s=>s.id===n?{...s,isLocked:!s.isLocked}:s);t({schema:{...i,domains:r}}),e().syncToYamlInput(),e().saveSchema()},assignTableToDomain:(n,i)=>{const{schema:r}=e();if(!r)return;const s=(r.domains||[]).map(c=>{const u=c.tables.filter(h=>h!==n);return c.id===i?{...c,tables:Array.from(new Set([...u,n]))}:{...c,tables:u}}),l={...r.layout||{},[n]:{x:20,y:20}};t({schema:{...r,domains:s,layout:l}}),e().syncToYamlInput(),e().saveSchema()},toggleTableSelection:n=>{const{selectedTableId:i,isDetailPanelMinimized:r}=e();t(i===n?{selectedTableId:null,isDetailPanelMinimized:!0}:{selectedTableId:n,selectedEdgeId:null,selectedAnnotationId:null,isDetailPanelMinimized:r})},toggleEdgeSelection:n=>{const{selectedEdgeId:i,isDetailPanelMinimized:r}=e();t(i===n?{selectedEdgeId:null,isDetailPanelMinimized:!0}:{selectedEdgeId:n,selectedTableId:null,selectedAnnotationId:null,isDetailPanelMinimized:r})},toggleAnnotationSelection:n=>{const{selectedAnnotationId:i,isDetailPanelMinimized:r}=e();t(i===n?{selectedAnnotationId:null,isDetailPanelMinimized:!0}:{selectedAnnotationId:n,selectedTableId:null,selectedEdgeId:null,isDetailPanelMinimized:r})},addAnnotation:(n,i,r)=>{const{schema:s}=e();if(!s)return;const l=`note_${Date.now()}`,c={id:l,targetId:i,targetType:r,text:"New Note",type:"sticky",offset:n},u={...s,annotations:[...s.annotations||[],c]};t({schema:Vn(u),selectedAnnotationId:l,selectedTableId:null,selectedEdgeId:null}),i||e().setFocusNodeId(l),e().syncToYamlInput(),e().saveSchema()},updateAnnotation:(n,i)=>{const{schema:r}=e();if(!r||!r.annotations)return;const s=r.annotations.map(l=>l.id===n?{...l,...i}:l);t({schema:{...r,annotations:s}}),e().syncToYamlInput(),e().saveSchema()},removeAnnotation:n=>{const{schema:i}=e();if(!i||!i.annotations)return;const r=i.annotations.filter(s=>s.id!==n);t({schema:{...i,annotations:r},selectedAnnotationId:null}),e().syncToYamlInput(),e().saveSchema()},getSelectedTable:()=>{const{schema:n,selectedTableId:i}=e();return!n||!i?null:n.tables.find(r=>r.id===i)||null},getSelectedDomain:()=>{const{schema:n,selectedTableId:i}=e();return!n||!i||!n.domains?null:n.domains.find(r=>r.id===i)||null},getSelectedRelationship:()=>{const{schema:n,selectedEdgeId:i}=e();if(!n||!i)return null;if(i.startsWith("lin-")){const l=i.split("-"),c=l[1],u=l[2];return{relationship:{from:{table:c},to:{table:u},type:"lineage"},index:-1}}if(!i.startsWith("e-"))return null;const r=parseInt(i.split("-")[1]),s=n.relationships[r];return s?{relationship:s,index:r}:null},getSelectedAnnotation:()=>{const{schema:n,selectedAnnotationId:i}=e();return!n||!i||!n.annotations?null:n.annotations.find(r=>r.id===i)||null}})),VX={fact:{color:"#f87171",icon:"📊",label:"FACT"},dimension:{color:"#60a5fa",icon:"🏷️",label:"DIM"},hub:{color:"#fbbf24",icon:"🌐",label:"HUB"},link:{color:"#34d399",icon:"🔗",label:"LINK"},satellite:{color:"#a78bfa",icon:"🛰️",label:"SAT"},mart:{color:"#f5700b",icon:"📈",label:"MART"},table:{color:"#64748b",icon:"📋",label:"TABLE"}},FX=({id:t,data:e,selected:n})=>{const{table:i}=e,[r,s]=Y.useState(!0),l=LV();Y.useEffect(()=>{l(t);const P=setTimeout(()=>s(!1),1e3);return()=>clearTimeout(P)},[t,i.name,i.logical_name,i.physical_name,i.columns,l]);const{updateNodeDimensions:c,hoveredColumnId:u,showER:h,showLineage:d,connectionStartHandle:m,theme:g,isPresentationMode:v,selectedTableId:x,selectedAnnotationId:w,toggleTableSelection:C}=en(),k=n,O=v&&!!(x||w)&&!k,E=i.columns&&i.columns.length>0,M=h&&d,T=i.appearance?.type?VX[i.appearance.type]:null,N=i.appearance?.color||T?.color||"#334155",I=i.appearance?.icon||T?.icon||"";let q=T?.label||"";const H=i.appearance?.sub_type,B=i.appearance?.scd;if(i.appearance?.type==="fact"&&H?q=`FACT (${{transaction:"Trans.",periodic:"Periodic",accumulating:"Accum.",factless:"Factless"}[H]||H})`:i.appearance?.type&&H?q=`${i.appearance.type.toUpperCase()} (${H})`:i.appearance?.type&&(q=i.appearance.type.toUpperCase()),B){const P=`SCD ${B.replace("type","T")}`;q=q?`${q} / ${P}`:P}const $=(P,L)=>{c(t,L.width,L.height)},V=(P,L)=>{if(!m)return"";const Q=m.nodeId===t,Z=m.handleType,U=!m.handleId?.includes("lin-");return Q||L!==U?"handle-dim":Z==="source"&&P==="target"||Z==="target"&&P==="source"?"handle-pulse":"handle-dim"},D=(P,L)=>M&&L?{background:"#ef4444",cursor:"not-allowed",border:"1px solid #7f1d1d"}:{background:P,cursor:"crosshair"};return S.jsxs("div",{className:r?"animate-creation":"",style:{width:"100%",height:"100%",minWidth:"220px",position:"relative",cursor:"default",opacity:O?.3:1,zIndex:k?50:0,transition:"opacity 0.5s ease-in-out, z-index 0.3s"},children:[S.jsx(DL,{color:"#3b82f6",isVisible:k,minWidth:220,minHeight:40,onResizeEnd:$,handleStyle:{width:12,height:12,borderRadius:"50%",backgroundColor:"#3b82f6",border:"2px solid #ffffff",zIndex:100}}),q&&S.jsx("div",{style:{position:"absolute",top:"-12px",left:"12px",height:"14px",padding:"0 6px",backgroundColor:N,color:"#ffffff",fontSize:"8px",fontWeight:900,borderRadius:"4px 4px 0 0",display:"flex",alignItems:"center",justifyContent:"center",textTransform:"uppercase",letterSpacing:"0.05em",boxShadow:"0 -2px 4px rgba(0,0,0,0.1)",zIndex:1},children:q}),S.jsx(Pi,{type:"target",position:Te.Top,id:`${t}-er-target-top`,className:V("target",!0),style:{...D(g==="dark"?"#94a3b8":"#64748b",h),width:"8px",height:"8px",zIndex:10,opacity:h?1:0,pointerEvents:h?"all":"none"}}),S.jsx(Pi,{type:"target",position:Te.Left,id:`${t}-lin-target-left`,className:V("target",!1),style:{...D("#3b82f6",d),top:"50%",left:"-4px",width:"10px",height:"10px",zIndex:20,opacity:d?1:0,pointerEvents:d?"all":"none"}}),S.jsx(Pi,{type:"source",position:Te.Right,id:`${t}-lin-source-right`,className:V("source",!1),style:{...D("#3b82f6",d),top:"50%",right:"-4px",width:"10px",height:"10px",zIndex:20,opacity:d?1:0,pointerEvents:d?"all":"none"}}),S.jsxs("div",{style:{width:"100%",height:"100%",backgroundColor:"var(--node-bg)",borderLeft:`2px solid ${k?"#3b82f6":"var(--border-main)"}`,borderRight:`2px solid ${k?"#3b82f6":"var(--border-main)"}`,borderBottom:`2px solid ${k?"#3b82f6":"var(--border-main)"}`,borderTop:`4px solid ${N}`,borderRadius:"8px",overflow:"hidden",color:"var(--text-primary)",boxShadow:k?"0 0 0 4px rgba(59, 130, 246, 0.2)":g==="dark"?"0 4px 6px -1px rgba(0, 0, 0, 0.3)":"0 4px 12px -2px rgba(0, 0, 0, 0.1)",fontFamily:"sans-serif",display:"flex",flexDirection:"column",transition:"background-color 0.3s, border-color 0.3s, color 0.3s"},children:[S.jsxs("div",{className:"table-drag-handle",onClick:P=>{P.stopPropagation(),C(t)},onDoubleClick:P=>{P.stopPropagation(),P.preventDefault()},style:{padding:"12px",backgroundColor:g==="dark"?"rgba(15, 23, 42, 0.8)":"rgba(241, 245, 249, 0.9)",borderBottom:E?"1px solid var(--border-main)":"none",flexShrink:0,cursor:"grab",display:"flex",flexDirection:"column",gap:"2px"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[I&&S.jsx("span",{style:{fontSize:"18px"},children:I}),S.jsx("div",{style:{fontSize:"16px",fontWeight:800,color:"var(--text-primary)",lineHeight:"1.2",wordBreak:"break-all"},children:i.name})]}),i.logical_name&&i.logical_name!==i.name&&S.jsx("div",{style:{fontSize:"11px",fontWeight:500,color:"var(--text-secondary)",paddingLeft:I?"26px":"0",opacity:.8},children:i.logical_name}),S.jsx("div",{title:i.physical_name||i.id,style:{fontSize:"9px",color:g==="dark"?"#94a3b8":"#64748b",fontFamily:"monospace",letterSpacing:"0.02em",paddingLeft:I?"26px":"0",marginTop:"2px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},children:i.physical_name||i.id})]}),E&&S.jsx("div",{className:"nodrag",style:{padding:"0",overflowY:"auto",flex:1,cursor:"default"},children:S.jsx("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"11px"},children:S.jsx("tbody",{children:i.columns.map((P,L)=>{const Q=P.logical?.name||P.id,Z=P.physical?.name||P.id,U=Q!==Z;return S.jsxs("tr",{className:"column-row",style:{borderBottom:"1px solid var(--border-main)",backgroundColor:u===P.id?g==="dark"?"rgba(30, 58, 138, 0.6)":"rgba(191, 219, 254, 0.4)":"transparent",position:"relative"},children:[S.jsxs("td",{style:{padding:"6px 12px",fontWeight:500,color:"var(--text-primary)",position:"relative"},children:[S.jsx(Pi,{type:"target",position:Te.Left,id:`${t}-${P.id}-er-target-left`,className:`column-handle ${V("target",!0)}`,style:{...D("#3b82f6",h),left:"-4px",opacity:0,pointerEvents:h?"all":"none"}}),S.jsxs("div",{style:{display:"flex",alignItems:"flex-start"},children:[S.jsxs("span",{style:{color:"var(--text-secondary)",marginRight:"6px",fontSize:"9px",fontFamily:"monospace",width:"14px",textAlign:"right",opacity:.6,marginTop:"2px"},children:[L+1,"."]}),S.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[S.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[P.logical?.isPrimaryKey&&S.jsx("span",{style:{color:"#eab308"},children:"🔑"}),P.logical?.isForeignKey&&S.jsx("span",{style:{opacity:.8},children:"🔩"}),P.logical?.isPartitionKey&&S.jsx("span",{style:{opacity:.8},children:"📂"}),P.logical?.isMetadata&&S.jsx("span",{style:{opacity:.8},title:"Metadata/Audit Column",children:"🕒"}),P.logical?.additivity==="fully"&&S.jsx("span",{style:{color:"#4ade80"},title:"Fully Additive",children:"Σ"}),P.logical?.additivity==="semi"&&S.jsx("span",{style:{color:"#fbbf24"},title:"Semi-Additive",children:"Σ~"}),P.logical?.additivity==="non"&&S.jsx("span",{style:{color:"#f87171"},title:"Non-Additive",children:"⊘"}),S.jsx("span",{className:"truncate",title:Q,children:Q})]}),U&&S.jsx("div",{style:{fontSize:"8px",fontFamily:"monospace",opacity:.6,marginTop:"1px",paddingLeft:"2px"},className:"truncate",title:Z,children:Z})]})]})]}),S.jsxs("td",{style:{padding:"6px 12px",textAlign:"right",fontStyle:"italic",color:"var(--text-secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"120px",position:"relative",verticalAlign:"top",opacity:.8},children:[P.logical?.type||"Unknown",S.jsx(Pi,{type:"source",position:Te.Right,id:`${t}-${P.id}-er-source-right`,className:`column-handle ${V("source",!0)}`,style:{...D("#3b82f6",h),right:"-4px",opacity:0,pointerEvents:h?"all":"none"}})]})]},P.id)})})})})]}),S.jsx(Pi,{type:"source",position:Te.Bottom,id:`${t}-er-source-bottom`,className:V("source",!0),style:{...D(g==="dark"?"#94a3b8":"#64748b",h),width:"8px",height:"8px",zIndex:10,opacity:h?1:0,pointerEvents:h?"all":"none"}})]})},$X=Y.memo(FX);const wz=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim();const GX=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const YX=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase());const KD=t=>{const e=YX(t);return e.charAt(0).toUpperCase()+e.slice(1)};var QX={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const XX=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const WX=Y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:s,iconNode:l,...c},u)=>Y.createElement("svg",{ref:u,...QX,width:e,height:e,stroke:t,strokeWidth:i?Number(n)*24/Number(e):n,className:wz("lucide",r),...!s&&!XX(c)&&{"aria-hidden":"true"},...c},[...l.map(([h,d])=>Y.createElement(h,d)),...Array.isArray(s)?s:[s]]));const Xe=(t,e)=>{const n=Y.forwardRef(({className:i,...r},s)=>Y.createElement(WX,{ref:s,iconNode:e,className:wz(`lucide-${GX(KD(t))}`,`lucide-${t}`,i),...r}));return n.displayName=KD(t),n};const KX=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],ed=Xe("arrow-up-right",KX);const ZX=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],JX=Xe("camera",ZX);const eW=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],tW=Xe("check",eW);const nW=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qa=Xe("chevron-down",nW);const iW=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Sz=Xe("chevron-left",iW);const rW=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vw=Xe("chevron-right",rW);const sW=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],aW=Xe("chevron-up",sW);const lW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],td=Xe("circle-alert",lW);const oW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],cW=Xe("circle-check",oW);const uW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Cz=Xe("circle-question-mark",uW);const fW=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],hW=Xe("command",fW);const dW=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Ba=Xe("database",dW);const pW=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],z2=Xe("git-graph",pW);const mW=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],gW=Xe("grid-3x3",mW);const yW=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],vW=Xe("grip-vertical",yW);const bW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],xW=Xe("info",bW);const wW=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],SW=Xe("layout-template",wW);const CW=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],kW=Xe("link",CW);const AW=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],_W=Xe("list-tree",AW);const OW=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],EW=Xe("loader-circle",OW);const TW=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],MW=Xe("lock-open",TW);const NW=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],RW=Xe("lock",NW);const DW=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],kz=Xe("message-square",DW);const LW=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],zW=Xe("moon",LW);const qW=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],BW=Xe("network",qW);const jW=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],Az=Xe("panels-top-left",jW);const IW=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],PW=Xe("play",IW);const HW=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Fw=Xe("plus",HW);const UW=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],VW=Xe("redo-2",UW);const FW=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],$W=Xe("route",FW);const GW=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],q2=Xe("search",GW);const YW=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],QW=Xe("sun",YW);const XW=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],ZD=Xe("table",XW);const WW=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],ko=Xe("tag",WW);const KW=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],_d=Xe("trash-2",KW);const ZW=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],JW=Xe("undo-2",ZW);const eK=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],tK=Xe("unlink",eK);const nK=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Vu=Xe("x",nK),iK=({id:t,data:e,selected:n})=>{const[i,r]=Y.useState(!0);Y.useEffect(()=>{const M=setTimeout(()=>r(!1),1e3);return()=>clearTimeout(M)},[]);const{updateNodeDimensions:s,theme:l,toggleDomainLock:c,isPresentationMode:u,selectedTableId:h,selectedAnnotationId:d}=en(),m=n,v=u&&!!(h||d)&&!m,x=e.isLocked,w=e.color||"#3b82f6",C=l==="dark"?"rgba(15, 23, 42, 0.98)":"rgba(255, 255, 255, 0.98)",k=w,O=w.startsWith("rgba")||w.startsWith("hsla")||w.startsWith("#")&&w.length>7?1:.5,E=(M,T)=>{s(t,T.width,T.height)};return S.jsxs("div",{className:i?"animate-creation":"",style:{width:"100%",height:"100%",border:x?`2px solid ${l==="dark"?"#334155":"#cbd5e1"}`:`2px dashed ${m?"#3b82f6":l==="dark"?"#334155":"#cbd5e1"}`,borderRadius:"12px",padding:"10px",position:"relative",color:"var(--text-secondary)",cursor:"default",transition:"border-color 0.3s, opacity 0.5s ease-in-out, z-index 0.3s",opacity:v?.2:x?.8:1,zIndex:m?40:-1},children:[!x&&S.jsx(DL,{color:"#3b82f6",isVisible:m,minWidth:200,minHeight:150,onResizeEnd:E,handleStyle:{width:14,height:14,borderRadius:"50%",backgroundColor:"#3b82f6",border:"2px solid #ffffff",zIndex:100}}),S.jsx("div",{style:{position:"absolute",inset:0,backgroundColor:w,opacity:O,borderRadius:"10px",zIndex:-1,cursor:"default"}}),S.jsxs("div",{className:x?"domain-locked-handle":"domain-drag-handle",style:{position:"absolute",top:"-30px",left:"0",fontSize:"13px",fontWeight:"bold",color:l==="dark"?"#f1f5f9":"#0f172a",whiteSpace:"nowrap",pointerEvents:"all",cursor:x?"default":"grab",padding:"4px 12px 4px 10px",backgroundColor:C,borderRadius:"6px 6px 0 0",border:`1px solid ${m?"#3b82f6":l==="dark"?"#334155":"#cbd5e1"}`,borderLeft:`4px solid ${k}`,borderBottom:"none",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"8px",boxShadow:l==="dark"?"0 -4px 12px rgba(0,0,0,0.4)":"0 -2px 8px rgba(0,0,0,0.08)",zIndex:10},children:[!x&&S.jsx(vW,{size:14,className:l==="dark"?"text-slate-400":"text-slate-500"}),S.jsx("span",{className:"truncate max-w-[200px]",children:e.label}),S.jsx("div",{className:`w-px h-3 mx-1 ${l==="dark"?"bg-slate-700":"bg-slate-200"}`}),S.jsx("button",{onClick:M=>{M.stopPropagation(),c(t)},className:`p-0.5 rounded transition-colors ${x?"text-amber-500 hover:text-amber-400":"text-slate-400 hover:text-blue-500"}`,title:x?"Unlock Domain":"Lock Domain",children:x?S.jsx(RW,{size:12}):S.jsx(MW,{size:12})})]})]})},rK=Y.memo(iK),JD=new Set,sK=(t,e)=>{let n=0,i=0,r=0;if(t.startsWith("#"))t.length===4?(n=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16),r=parseInt(t[3]+t[3],16)):(n=parseInt(t.substring(1,3),16),i=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16));else if(t.startsWith("rgba")||t.startsWith("rgb")){const l=t.match(/\d+/g);l&&(n=parseInt(l[0]),i=parseInt(l[1]),r=parseInt(l[2]))}else return e==="dark"?"#f1f5f9":"#1e293b";return(.299*n+.587*i+.114*r)/255>.55?"#1e293b":"#ffffff"},aK=({id:t,data:e,selected:n})=>{const{annotation:i}=e,{updateAnnotation:r,removeAnnotation:s,theme:l,isPresentationMode:c,selectedTableId:u,selectedAnnotationId:h}=en(),[d,m]=Y.useState(!1),[g,v]=Y.useState(i.text),[x,w]=Y.useState(!JD.has(t)),C=Y.useMemo(()=>(t.split("").reduce((H,B)=>H+B.charCodeAt(0),0)%30-15)/10,[t]);Y.useEffect(()=>{v(i.text)},[i.text]),Y.useEffect(()=>{if(x){JD.add(t);const q=setTimeout(()=>w(!1),1e3);return()=>clearTimeout(q)}},[t,x]);const k=()=>{m(!1),g!==i.text&&r(i.id,{text:g})},A=q=>{q.stopPropagation(),s(i.id)},O=i.color||(l==="dark"?"#334155":"#fef3c7"),E=sK(O,l),M=n?"#3b82f6":"transparent",T=n,I=c&&!!(u||h)&&!T;return S.jsxs("div",{className:`relative group ${x?"animate-creation":""}`,style:{padding:"12px 12px 20px 12px",backgroundColor:O,borderRadius:"2px",border:`2px solid ${M}`,boxShadow:n?"0 0 0 4px rgba(59, 130, 246, 0.2), 0 10px 15px -3px rgba(0, 0, 0, 0.1)":"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",minWidth:"140px",maxWidth:"280px",transform:`rotate(${C}deg)`,transition:"background-color 0.3s, color 0.3s, opacity 0.5s ease-in-out, border-color 0.2s",cursor:d?"text":"grab",color:E,opacity:I?.2:1,zIndex:T?50:0},onDoubleClick:()=>m(!0),children:[S.jsx(Pi,{type:"source",position:Te.Top,id:`${t}-source`,style:{background:"transparent",border:"none",top:"50%",left:"50%",pointerEvents:"none"}}),S.jsx("div",{className:`absolute -top-10 right-0 gap-1 shadow-xl border rounded-lg p-1 z-10 animate-in fade-in zoom-in duration-200 ${n?"flex":"hidden group-hover:flex"} ${l==="dark"?"bg-slate-800 border-slate-700":"bg-white border-slate-200"}`,children:S.jsx("button",{onClick:A,className:`p-1.5 rounded-md transition-colors ${l==="dark"?"hover:bg-red-500/20 text-slate-400 hover:text-red-400":"hover:bg-red-50 text-slate-400 hover:text-red-500"}`,title:"Delete Annotation",children:S.jsx(_d,{size:14})})}),S.jsx("div",{className:"custom-scrollbar sidebar-content",style:{maxHeight:"240px",overflowY:"auto",paddingRight:"4px"},children:d?S.jsx("textarea",{autoFocus:!0,value:g,onChange:q=>v(q.target.value),onBlur:k,className:"w-full bg-transparent border-none outline-none resize-none font-sans text-sm leading-relaxed",style:{height:"auto",minHeight:"80px",color:"inherit"}}):S.jsx("div",{className:"font-sans text-sm leading-relaxed whitespace-pre-wrap break-words pr-1",children:i.text||S.jsx("span",{className:"opacity-40 italic",children:"Double-click to edit..."})})}),S.jsx("div",{className:"absolute bottom-0 right-0 w-6 h-6 pointer-events-none",style:{background:"linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.05) 50%, rgba(0,0,0,0.1) 100%)"},children:S.jsx("div",{style:{position:"absolute",bottom:0,right:0,width:"100%",height:"100%",background:`linear-gradient(225deg, transparent 50%, ${l==="dark"?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.03)"} 50%)`,clipPath:"polygon(100% 0, 0 100%, 100% 100%)"}})})]})},lK=Y.memo(aK),e3={fact:{color:"#f87171",icon:"📊",label:"FACT"},dimension:{color:"#60a5fa",icon:"🏷️",label:"DIM"},hub:{color:"#fbbf24",icon:"🌐",label:"HUB"},link:{color:"#34d399",icon:"🔗",label:"LINK"},satellite:{color:"#a78bfa",icon:"🛰️",label:"SAT"},mart:{color:"#f5700b",icon:"📈",label:"MART"},table:{color:"#64748b",icon:"📋",label:"TABLE"}},oK=()=>{const{schema:t,getSelectedTable:e,getSelectedDomain:n,getSelectedRelationship:i,getSelectedAnnotation:r,updateTable:s,updateDomain:l,updateRelationship:c,updateAnnotation:u,assignTableToDomain:h,theme:d,isDetailPanelSuppressed:m,isDetailPanelMinimized:g,setIsDetailPanelMinimized:v}=en(),x=e(),w=n(),C=i(),k=r(),[A,O]=Y.useState("conceptual"),[E,M]=Y.useState(""),[T,N]=Y.useState(400),[I,q]=Y.useState(!1);if(Y.useEffect(()=>{if(!I)return;const X=Se=>{const ye=window.innerHeight-Se.clientY;N(Math.max(150,Math.min(ye,window.innerHeight*.9)))},pe=()=>{q(!1),document.body.style.cursor="default"};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",pe),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",pe)}},[I]),m)return null;const H=X=>{X.preventDefault(),q(!0),document.body.style.cursor="ns-resize"},B=X=>{X.stopPropagation()},$={height:`${T}px`,maxHeight:"90vh",minHeight:"150px",backgroundColor:"var(--node-bg)",borderTop:`2px solid ${d==="dark"?"#3b82f6":"#60a5fa"}`,display:"flex",flexDirection:"column",color:"var(--text-primary)",boxShadow:d==="dark"?"0 -10px 25px -5px rgba(0, 0, 0, 0.4)":"0 -4px 12px rgba(0, 0, 0, 0.05)",fontFamily:"sans-serif",position:"relative",transition:"background-color 0.3s, color 0.3s"};if(g){const X=x?.name||w?.name||(C?`${C.relationship.from.table} → ${C.relationship.to.table}`:null)||k?.text?.substring(0,20),pe=!!X;let Se=d==="dark"?"#334155":"#e2e8f0";if(x){const ye=x.appearance?.type?e3[x.appearance.type]:null;Se=x.appearance?.color||ye?.color||Se}else w?Se=w.color||Se:k&&(Se=k.color||"#f59e0b");return S.jsxs("div",{className:`shadow-2xl z-50 flex items-center justify-between px-6 transition-all border-t-2 ${pe?"cursor-pointer hover:bg-slate-50 dark:hover:bg-slate-900":"cursor-default opacity-80"}`,onClick:ye=>{pe&&(ye.stopPropagation(),v(!1))},onMouseDown:B,onPointerDown:B,style:{height:"40px",backgroundColor:"var(--node-bg)",borderColor:Se,color:"var(--text-primary)"},children:[S.jsx("div",{className:"flex items-center gap-3 overflow-hidden flex-1",children:S.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-slate-500 whitespace-nowrap",children:pe?`Selected: ${X}`:"Select an object on the canvas to view its details"})}),S.jsx("div",{className:"flex items-center gap-4",children:pe&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"text-[10px] font-medium text-slate-400 italic hidden sm:block",children:"Click to expand"}),S.jsx("button",{className:`p-1 rounded-full transition-colors ${d==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,children:S.jsx(aW,{size:18,style:{color:Se}})})]})})]})}const V=X=>{s(x.id,X)};if(k)return S.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:B,onMouseDown:B,onPointerDown:B,style:{...$,borderTopColor:k.color||"#f59e0b"},children:[S.jsx("div",{onMouseDown:H,style:{position:"absolute",top:"-4px",left:0,right:0,height:"8px",cursor:"ns-resize",zIndex:60}}),S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[S.jsx(ko,{size:18,style:{color:k.color||"#f59e0b"}}),S.jsxs("div",{style:{flex:1},children:[S.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:S.jsx("span",{style:{fontSize:"14px",fontWeight:"bold"},children:"Annotation"})}),S.jsx("p",{style:{fontSize:"11px",color:"var(--text-secondary)",textTransform:"uppercase",margin:0},children:k.targetId?`Sticky to ${k.targetId} (${k.targetType})`:"Floating Note"})]})]}),S.jsx("div",{className:"flex items-center gap-1",children:S.jsx("button",{onClick:()=>v(!0),className:`p-1.5 rounded-full transition-colors ${d==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,title:"Minimize Details",children:S.jsx(qa,{size:18})})})]}),S.jsx("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:S.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Note Content"}),S.jsx("textarea",{value:k.text||"",onChange:X=>u(k.id,{text:X.target.value}),style:{width:"100%",minHeight:"100px",backgroundColor:d==="dark"?"#0f172a":"#ffffff",border:"1px solid var(--border-main)",borderRadius:"6px",padding:"12px",color:"var(--text-primary)",fontSize:"13px",lineHeight:"1.6",resize:"none",outline:"none"}})]}),S.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Target Binding"}),S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("div",{className:"flex gap-2",children:[S.jsxs("select",{value:k.targetId||"",onChange:X=>{const pe=X.target.value;if(!pe)u(k.id,{targetId:void 0,targetType:void 0});else{const Se=t?.tables.some(ye=>ye.id===pe);u(k.id,{targetId:pe,targetType:Se?"table":"domain",offset:{x:50,y:-50}})}},className:`flex-1 border rounded text-xs p-2 outline-none ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300":"bg-white border-slate-200 text-slate-900"}`,children:[S.jsx("option",{value:"",children:"- Floating (No Target) -"}),S.jsx("optgroup",{label:"Tables",children:t?.tables.map(X=>S.jsxs("option",{value:X.id,children:[X.name," (",X.id,")"]},X.id))}),S.jsx("optgroup",{label:"Domains",children:t?.domains?.map(X=>S.jsxs("option",{value:X.id,children:[X.name," (",X.id,")"]},X.id))})]}),k.targetId?S.jsx("button",{onClick:()=>u(k.id,{targetId:void 0,targetType:void 0}),className:"p-2 text-red-500 hover:bg-red-50 rounded border border-red-100",title:"Unbind Target",children:S.jsx(tK,{size:14})}):S.jsx("div",{className:"p-2 text-slate-300 border border-slate-100 rounded",children:S.jsx(kW,{size:14})})]}),S.jsx("p",{className:"text-[10px] text-slate-400 italic",children:'Bind to a table to make the note "stick" when moving.'})]})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Note Color"}),S.jsx("div",{className:"flex flex-col gap-3",children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("input",{type:"color",value:k.color||(d==="dark"?"#334155":"#fef3c7"),onChange:X=>u(k.id,{color:X.target.value}),className:"w-8 h-8 p-0 border-none rounded cursor-pointer bg-transparent"}),S.jsx("input",{value:k.color||"",onChange:X=>u(k.id,{color:X.target.value}),placeholder:"e.g. #fef3c7",className:`flex-1 border rounded text-[10px] p-1.5 outline-none font-mono ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300":"bg-white border-slate-200 text-slate-900"}`})]})})]})]})]})})]});if(C){const{relationship:X,index:pe}=C;return S.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:B,onMouseDown:B,onPointerDown:B,style:$,children:[S.jsx("div",{onMouseDown:H,style:{position:"absolute",top:"-4px",left:0,right:0,height:"8px",cursor:"ns-resize",zIndex:60}}),S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[S.jsx(Ba,{size:18,style:{color:"#3b82f6"}}),S.jsxs("div",{style:{flex:1},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[S.jsx("span",{style:{fontSize:"14px",fontWeight:"bold"},children:"Relationship"}),S.jsx("span",{style:{fontSize:"9px",fontWeight:800,padding:"1px 5px",borderRadius:"3px",backgroundColor:"rgba(59, 130, 246, 0.1)",color:"#60a5fa",border:"1px solid rgba(59, 130, 246, 0.2)",textTransform:"uppercase"},children:"EDGE"})]}),S.jsxs("p",{style:{fontSize:"11px",color:"var(--text-secondary)",textTransform:"uppercase",margin:0},children:[X.from.table,X.from.column?`.${X.from.column}`:""," → ",X.to.table,X.to.column?`.${X.to.column}`:""]})]})]}),S.jsx("div",{className:"flex items-center gap-1",children:S.jsx("button",{onClick:()=>v(!0),className:`p-1.5 rounded-full transition-colors ${d==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,title:"Minimize Details",children:S.jsx(qa,{size:18})})})]}),S.jsx("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:S.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[S.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Relationship Type"}),S.jsxs("select",{value:X.type||"one-to-many",onChange:Se=>c(pe,{type:Se.target.value}),className:`w-full border rounded text-sm p-2.5 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-200 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`,children:[S.jsx("option",{value:"one-to-one",children:"One-to-One"}),S.jsx("option",{value:"one-to-many",children:"One-to-Many"}),S.jsx("option",{value:"many-to-one",children:"Many-to-One"}),S.jsx("option",{value:"many-to-many",children:"Many-to-Many"})]})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Cardinality (Metadata)"}),S.jsxs("div",{className:"text-slate-500 text-sm",children:["Mapping established from ",S.jsx("strong",{children:X.from.table})," to ",S.jsx("strong",{children:X.to.table}),"."]})]})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Source/Target Details"}),S.jsxs("div",{className:`flex gap-4 items-center p-3 rounded border ${d==="dark"?"bg-slate-800/50 border-slate-800":"bg-slate-50 border-slate-100"}`,children:[S.jsxs("div",{className:"flex-1",children:[S.jsx("div",{className:"text-[10px] text-slate-500 uppercase",children:"From Table"}),S.jsx("div",{className:`text-sm font-bold ${d==="dark"?"text-blue-400":"text-blue-600"}`,children:X.from.table}),S.jsxs("div",{className:"text-[10px] text-slate-500",children:["Column: ",X.from.column||"(Table level)"]})]}),S.jsx("div",{className:"text-slate-400 dark:text-slate-600",children:"→"}),S.jsxs("div",{className:"flex-1",children:[S.jsx("div",{className:"text-[10px] text-slate-500 uppercase",children:"To Table"}),S.jsx("div",{className:`text-sm font-bold ${d==="dark"?"text-blue-400":"text-blue-600"}`,children:X.to.table}),S.jsxs("div",{className:"text-[10px] text-slate-500",children:["Column: ",X.to.column||"(Table level)"]})]})]})]})]})})]})}if(w)return S.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:B,onMouseDown:B,onPointerDown:B,style:{...$,borderTopColor:w.color||"#3b82f6"},children:[S.jsx("div",{onMouseDown:H,style:{position:"absolute",top:"-4px",left:0,right:0,height:"8px",cursor:"ns-resize",zIndex:60}}),S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[S.jsx(Ba,{size:18,style:{color:w.color||"#3b82f6"}}),S.jsxs("div",{style:{flex:1},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[S.jsx("input",{value:w.name??"",onChange:X=>l(w.id,{name:X.target.value}),onBlur:X=>{X.target.value||l(w.id,{name:"UNNAMED_DOMAIN"})},style:{fontSize:"16px",fontWeight:"bold",color:"var(--text-primary)",backgroundColor:"transparent",border:"none",borderBottom:"1px solid transparent",padding:"2px 0",outline:"none",width:"fit-content",minWidth:"200px"},onFocus:X=>X.target.style.borderBottom="1px solid #3b82f6"}),S.jsx("span",{style:{fontSize:"9px",fontWeight:800,padding:"1px 5px",borderRadius:"3px",backgroundColor:"rgba(59, 130, 246, 0.1)",color:"#60a5fa",border:"1px solid rgba(59, 130, 246, 0.2)",textTransform:"uppercase"},children:"DOMAIN"})]}),S.jsx("p",{style:{fontSize:"11px",color:"var(--text-secondary)",textTransform:"uppercase",margin:0},children:w.id})]})]}),S.jsx("div",{className:"flex items-center gap-1",children:S.jsx("button",{onClick:()=>v(!0),className:`p-1.5 rounded-full transition-colors ${d==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,title:"Minimize Details",children:S.jsx(qa,{size:18})})})]}),S.jsx("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:S.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Domain Description"}),S.jsx("textarea",{value:w.description||"",onChange:X=>l(w.id,{description:X.target.value}),placeholder:"What is the purpose of this domain?",style:{width:"100%",minHeight:"80px",backgroundColor:d==="dark"?"#0f172a":"#ffffff",border:"1px solid var(--border-main)",borderRadius:"6px",padding:"12px",color:"var(--text-primary)",fontSize:"13px",lineHeight:"1.6",resize:"none",outline:"none",transition:"background-color 0.3s"}})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Domain Theme Color"}),S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[S.jsx("input",{type:"color",value:w.color?.startsWith("rgba")?"#3b82f6":w.color||"#3b82f6",onChange:X=>l(w.id,{color:X.target.value}),style:{width:"40px",height:"40px",padding:0,border:"none",borderRadius:"4px",cursor:"pointer",backgroundColor:"transparent"}}),S.jsx("input",{value:w.color||"",onChange:X=>l(w.id,{color:X.target.value}),placeholder:"e.g. #3b82f6 or rgba(...)",className:`border rounded font-mono text-sm p-2 outline-none flex-1 transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`})]})]})]})})]});const D=[{id:"conceptual",label:"Conceptual",icon:S.jsx(ko,{size:14})},{id:"logical",label:"Logical",icon:S.jsx(Ba,{size:14})},{id:"physical",label:"Physical",icon:S.jsx(Ba,{size:14})},{id:"sample",label:"Sample Data",icon:S.jsx(ZD,{size:14})}],P=x.appearance?.type?e3[x.appearance.type]:null,L=x.appearance?.color||P?.color||"#334155",Q=x.appearance?.icon||P?.icon||"";let Z=P?.label||"";const U=x.appearance?.sub_type,re=x.appearance?.scd;if(x.appearance?.type==="fact"&&U?Z=`FACT (${{transaction:"Trans.",periodic:"Periodic",accumulating:"Accum.",factless:"Factless"}[U]||U})`:x.appearance?.type&&U?Z=`${x.appearance.type.toUpperCase()} (${U})`:x.appearance?.type&&(Z=x.appearance.type.toUpperCase()),re){const X=`SCD ${re.replace("type","T")}`;Z=Z?`${Z} / ${X}`:X}const z=X=>{X.stopPropagation();const pe={id:`col_${Date.now()}`,logical:{name:"New Column",type:"String",description:""},physical:{name:"",type:"VARCHAR(255)",constraints:[]}};V({columns:[...x.columns||[],pe]})},G=(X,pe)=>{X.stopPropagation();const Se=x.columns?.filter(ye=>ye.id!==pe)||[];V({columns:Se})},te=(X,pe)=>{const Se=x.columns?.map(ye=>ye.id===X?{...ye,logical:{name:ye.logical?.name||ye.id,type:ye.logical?.type||"String",...ye.logical,...pe}}:ye)||[];V({columns:Se})},j=(X,pe)=>{const Se=x.columns?.map(ye=>ye.id===X?{...ye,physical:{...ye.physical,...pe}}:ye)||[];V({columns:Se})},K=X=>{if(X.key==="Enter"&&E.trim()){const pe=x.conceptual?.tags||[];pe.includes(E.trim())||V({conceptual:{...x.conceptual,tags:[...pe,E.trim()]}}),M("")}},ee=(X,pe)=>{X.stopPropagation();const Se=x.conceptual?.tags||[];V({conceptual:{...x.conceptual,tags:Se.filter(ye=>ye!==pe)}})},oe=X=>{V({sampleData:X})},ge=X=>{X.stopPropagation();const pe=x.sampleData||[],Se=x.columns?.length||0,ye=new Array(Se).fill("");oe([...pe,ye])},xe=(X,pe)=>{X.stopPropagation();const ye=(x.sampleData||[]).filter((_e,ot)=>ot!==pe);oe(ye)},Me=(X,pe,Se)=>{const ye=[...x.sampleData||[]];if(!ye[X])return;const _e=[...ye[X]];_e[pe]=Se,ye[X]=_e,oe(ye)};return S.jsxs("div",{className:"shadow-2xl z-50 flex flex-col sidebar-content",onClick:B,onMouseDown:B,onPointerDown:B,style:{...$,borderTopColor:L},children:[S.jsx("div",{onMouseDown:H,style:{position:"absolute",top:"-4px",left:0,right:0,height:"8px",cursor:"ns-resize",zIndex:60}}),S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:[S.jsxs("div",{style:{flex:1},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[Q&&S.jsx("span",{style:{fontSize:"16px"},children:Q}),S.jsx("span",{style:{fontSize:"11px",color:"var(--text-secondary)",textTransform:"uppercase",fontFamily:"monospace",letterSpacing:"0.05em"},children:x.id}),Z&&S.jsx("span",{style:{fontSize:"9px",fontWeight:800,padding:"1px 5px",borderRadius:"3px",backgroundColor:`${L}30`,color:L,border:`1px solid ${L}50`,textTransform:"uppercase"},children:Z})]}),S.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:S.jsx("input",{value:x.name??"",onChange:X=>V({name:X.target.value}),onBlur:X=>{X.target.value||V({name:"UNNAMED_TABLE"})},title:"Conceptual Table Name",style:{fontSize:"18px",fontWeight:"bold",color:"var(--text-primary)",backgroundColor:"transparent",border:"none",borderBottom:"1px solid transparent",padding:"2px 0",outline:"none",width:"100%",maxWidth:"500px"},onFocus:X=>X.target.style.borderBottom="1px solid #3b82f6"})})]}),S.jsxs("div",{style:{display:"flex",gap:"8px",marginRight:"16px"},children:[S.jsxs("select",{value:x.appearance?.type||"fact",onChange:X=>V({appearance:{...x.appearance,type:X.target.value}}),className:`border rounded text-[10px] px-2 py-1 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400"}`,title:"Table Type",children:[S.jsx("option",{value:"fact",children:"Fact"}),S.jsx("option",{value:"dimension",children:"Dimension"}),S.jsx("option",{value:"mart",children:"Mart"}),S.jsx("option",{value:"table",children:"Table"}),S.jsx("option",{value:"hub",children:"Hub"}),S.jsx("option",{value:"link",children:"Link"}),S.jsx("option",{value:"satellite",children:"Satellite"})]}),S.jsxs("select",{value:x.appearance?.sub_type||"",onChange:X=>V({appearance:{...x.appearance,sub_type:X.target.value||void 0}}),className:`border rounded text-[10px] px-2 py-1 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400"}`,title:"Table Sub-type",children:[S.jsx("option",{value:"",children:"- Sub-type -"}),S.jsx("option",{value:"transaction",children:"Transaction"}),S.jsx("option",{value:"periodic",children:"Periodic Snapshot"}),S.jsx("option",{value:"accumulating",children:"Accumulating Snapshot"}),S.jsx("option",{value:"factless",children:"Factless"}),S.jsx("option",{value:"conformed",children:"Conformed"}),S.jsx("option",{value:"junk",children:"Junk"}),S.jsx("option",{value:"degenerate",children:"Degenerate"})]}),S.jsxs("select",{value:x.appearance?.scd||"",onChange:X=>V({appearance:{...x.appearance,scd:X.target.value||void 0}}),className:`border rounded text-[10px] px-2 py-1 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400"}`,title:"SCD Type",children:[S.jsx("option",{value:"",children:"- SCD Type -"}),S.jsx("option",{value:"type0",children:"SCD Type 0"}),S.jsx("option",{value:"type1",children:"SCD Type 1"}),S.jsx("option",{value:"type2",children:"SCD Type 2"}),S.jsx("option",{value:"type3",children:"SCD Type 3"}),S.jsx("option",{value:"type4",children:"SCD Type 4"}),S.jsx("option",{value:"type5",children:"SCD Type 5"}),S.jsx("option",{value:"type6",children:"SCD Type 6"}),S.jsx("option",{value:"type7",children:"SCD Type 7"})]})]}),S.jsx("div",{className:"flex items-center gap-1",children:S.jsx("button",{onClick:()=>v(!0),className:`p-1.5 rounded-full transition-colors ${d==="dark"?"hover:bg-slate-800 text-slate-500":"hover:bg-slate-200 text-slate-400"}`,title:"Minimize Details",children:S.jsx(qa,{size:18})})})]}),S.jsx("div",{style:{display:"flex",gap:"24px",padding:"0 20px",borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--header-bg)"},children:D.map(X=>S.jsxs("button",{onClick:pe=>{pe.stopPropagation(),O(X.id)},style:{padding:"12px 0",backgroundColor:"transparent",border:"none",borderBottom:A===X.id?"2px solid #3b82f6":"2px solid transparent",color:A===X.id?d==="dark"?"#60a5fa":"#2563eb":"var(--text-secondary)",fontSize:"13px",fontWeight:500,cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s"},children:[X.icon," ",X.label]},X.id))}),S.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"15px 20px"},children:[A==="conceptual"&&S.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Description"}),S.jsx("textarea",{value:x.conceptual?.description||"",onChange:X=>V({conceptual:{...x.conceptual,description:X.target.value}}),placeholder:"Enter business description...",style:{width:"100%",minHeight:"100px",backgroundColor:d==="dark"?"#0f172a":"#ffffff",border:"1px solid var(--border-main)",borderRadius:"6px",padding:"12px",color:"var(--text-primary)",fontSize:"13px",lineHeight:"1.6",resize:"none",outline:"none",transition:"background-color 0.3s"}})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Domain Assignment"}),S.jsxs("select",{value:t?.domains?.find(X=>X.tables.includes(x.id))?.id||"",onChange:X=>h(x.id,X.target.value||null),className:`w-full border rounded text-sm p-2 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-200 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`,children:[S.jsx("option",{value:"",children:"- No Domain -"}),t?.domains?.map(X=>S.jsxs("option",{value:X.id,children:[X.name," (",X.id,")"]},X.id))]})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Tags"}),S.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[x.conceptual?.tags?.map(X=>S.jsxs("span",{className:`flex items-center gap-2 px-3 py-1 border rounded-full text-xs font-medium transition-colors ${d==="dark"?"bg-blue-500/10 text-blue-400 border-blue-500/20":"bg-blue-50 text-blue-600 border-blue-100"}`,children:[X,S.jsx("button",{onClick:pe=>ee(pe,X),className:"hover:text-red-500 transition-colors",children:S.jsx(Vu,{size:12})})]},X)),S.jsx("div",{style:{position:"relative"},children:S.jsx("input",{type:"text",value:E,onChange:X=>M(X.target.value),onKeyDown:K,placeholder:"+ New Tag",style:{backgroundColor:"transparent",border:"1px dashed var(--border-main)",borderRadius:"16px",padding:"4px 12px",fontSize:"11px",color:"var(--text-primary)",outline:"none",width:"100px"}})})]})]})]}),A==="logical"&&S.jsxs("div",{children:[S.jsxs("div",{className:"flex flex-col gap-4 mb-6",children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Logical Table Name"}),S.jsx("input",{value:x.logical_name||"",onChange:X=>V({logical_name:X.target.value}),placeholder:x.name,className:`w-full border rounded text-sm p-2 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-200 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`})]}),S.jsxs("div",{className:"flex justify-between items-center",children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500",children:"Logical Schema (Columns)"}),S.jsxs("button",{onClick:z,className:"flex items-center gap-2 px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded text-xs transition-colors shadow-md shadow-blue-500/20 font-medium",children:[S.jsx(Fw,{size:14})," Add Column"]})]})]}),S.jsx("div",{style:{border:"1px solid var(--border-main)",borderRadius:"8px",overflow:"hidden"},children:S.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[S.jsx("thead",{style:{backgroundColor:"var(--header-bg)",borderBottom:"1px solid var(--border-main)",textAlign:"left"},children:S.jsxs("tr",{children:[S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"35%"},children:"Logical Name"}),S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"15%"},children:"Role"}),S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"15%"},children:"Type"}),S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"30%"},children:"Description"}),S.jsx("th",{style:{padding:"10px 16px",width:"50px"}})]})}),S.jsx("tbody",{children:(x.columns||[]).map(X=>S.jsxs("tr",{style:{borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--node-bg)"},children:[S.jsx("td",{style:{padding:"6px 16px"},children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>te(X.id,{isPrimaryKey:!X.logical?.isPrimaryKey}),title:"Primary Key",className:`transition-opacity ${X.logical?.isPrimaryKey?"opacity-100":"opacity-20 hover:opacity-50"}`,children:"🔑"}),S.jsx("input",{value:X.logical?.name??"",onChange:pe=>te(X.id,{name:pe.target.value}),onBlur:pe=>{pe.target.value||te(X.id,{name:X.id})},className:`bg-transparent border-none w-full outline-none p-1 rounded font-medium transition-colors ${d==="dark"?"text-white focus:bg-slate-800":"text-slate-900 focus:bg-slate-50"}`})]})}),S.jsx("td",{style:{padding:"6px 16px"},children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>te(X.id,{isMetadata:!X.logical?.isMetadata}),title:"Metadata/Audit",className:`transition-opacity text-sm ${X.logical?.isMetadata?"opacity-100":"opacity-20 hover:opacity-50"}`,children:"🕒"}),S.jsxs("select",{value:X.logical?.additivity||"",onChange:pe=>te(X.id,{additivity:pe.target.value||void 0}),title:"Additivity (for Measures)",style:{fontSize:"10px"},className:`border rounded outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-400":"bg-white border-slate-200 text-slate-600"}`,children:[S.jsx("option",{value:"",children:"-"}),S.jsx("option",{value:"fully",children:"Σ (Full)"}),S.jsx("option",{value:"semi",children:"Σ~ (Semi)"}),S.jsx("option",{value:"non",children:"⊘ (Non)"})]})]})}),S.jsx("td",{style:{padding:"6px 16px"},children:S.jsx("input",{value:X.logical?.type??"",onChange:pe=>te(X.id,{type:pe.target.value}),onBlur:pe=>{pe.target.value||te(X.id,{type:"String"})},placeholder:"Type...",className:`bg-transparent border-none font-mono text-[11px] w-full outline-none p-1 rounded transition-colors ${d==="dark"?"text-slate-400 focus:bg-slate-800":"text-slate-500 focus:bg-slate-50"}`})}),S.jsx("td",{style:{padding:"6px 16px"},children:S.jsx("input",{value:X.logical?.description||"",onChange:pe=>te(X.id,{description:pe.target.value}),placeholder:"Description...",className:`bg-transparent border-none text-[11px] w-full outline-none p-1 rounded transition-colors ${d==="dark"?"text-slate-500 focus:bg-slate-800":"text-slate-400 focus:bg-slate-50"}`})}),S.jsx("td",{style:{padding:"6px 16px",textAlign:"right"},children:S.jsx("button",{onClick:pe=>G(pe,X.id),className:"text-red-500/50 hover:text-red-500 p-1 transition-colors",children:S.jsx(_d,{size:14})})})]},X.id))})]})})]}),A==="physical"&&S.jsxs("div",{children:[S.jsxs("div",{className:"flex flex-col gap-4 mb-6",children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500 mb-2",children:"Physical Table Name"}),S.jsx("input",{value:x.physical_name||"",onChange:X=>V({physical_name:X.target.value}),placeholder:x.id,className:`w-full border rounded font-mono text-sm p-2 outline-none transition-colors ${d==="dark"?"bg-slate-800 border-slate-700 text-slate-300 focus:ring-blue-500":"bg-white border-slate-200 text-slate-900 focus:ring-blue-400 focus:border-blue-400 shadow-sm"}`})]}),S.jsx("div",{className:"flex justify-between items-center",children:S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500",children:"Physical Mappings"})})]}),S.jsx("div",{style:{border:"1px solid var(--border-main)",borderRadius:"8px",overflow:"hidden"},children:S.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[S.jsx("thead",{style:{backgroundColor:"var(--header-bg)",borderBottom:"1px solid var(--border-main)",textAlign:"left"},children:S.jsxs("tr",{children:[S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"25%"},children:"Logical Column"}),S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"30%"},children:"DB Column Name"}),S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"20%"},children:"DB Type"}),S.jsx("th",{style:{padding:"10px 16px",color:"var(--text-secondary)",width:"25%"},children:"Constraints"})]})}),S.jsx("tbody",{children:(x.columns||[]).map(X=>S.jsxs("tr",{style:{borderBottom:"1px solid var(--border-main)",backgroundColor:"var(--node-bg)"},children:[S.jsx("td",{style:{padding:"6px 16px",color:"var(--text-secondary)",borderRight:"1px solid var(--border-main)"},children:S.jsx("div",{className:"text-[11px] font-medium truncate",title:X.logical?.name||X.id,children:X.logical?.name||X.id})}),S.jsx("td",{style:{padding:"6px 16px"},children:S.jsx("input",{value:X.physical?.name??"",onChange:pe=>j(X.id,{name:pe.target.value}),placeholder:X.logical?.name.toLowerCase().replace(/ /g,"_"),className:`bg-transparent border-none font-mono text-[11px] w-full outline-none p-1 rounded transition-colors ${d==="dark"?"text-blue-400 focus:bg-slate-800":"text-blue-600 focus:bg-slate-50"}`})}),S.jsx("td",{style:{padding:"6px 16px"},children:S.jsx("input",{value:X.physical?.type??"",onChange:pe=>j(X.id,{type:pe.target.value}),placeholder:X.logical?.type.toUpperCase(),className:`bg-transparent border-none font-mono text-[11px] w-full outline-none p-1 rounded transition-colors ${d==="dark"?"text-slate-400 focus:bg-slate-800":"text-slate-500 focus:bg-slate-50"}`})}),S.jsx("td",{style:{padding:"6px 16px"},children:S.jsx("input",{value:X.physical?.constraints?.join(", ")||"",onChange:pe=>j(X.id,{constraints:pe.target.value.split(",").map(Se=>Se.trim()).filter(Boolean)}),placeholder:"e.g. NOT NULL",className:`bg-transparent border-none text-[11px] w-full outline-none p-1 rounded transition-colors ${d==="dark"?"text-slate-500 focus:bg-slate-800":"text-slate-400 focus:bg-slate-50"}`})})]},X.id))})]})})]}),A==="sample"&&S.jsxs("div",{className:"flex flex-col h-full",children:[S.jsxs("div",{className:"flex justify-between items-center mb-4",children:[S.jsx("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-slate-500",children:"Sample Data Editor"}),S.jsx("div",{className:"flex gap-2",children:S.jsxs("button",{onClick:ge,disabled:!x.columns||x.columns.length===0,className:`flex items-center gap-2 px-3 py-1.5 text-white rounded text-xs transition-colors font-medium shadow-md ${!x.columns||x.columns.length===0?"bg-slate-300 dark:bg-slate-700 cursor-not-allowed opacity-50":"bg-emerald-600 hover:bg-emerald-700 shadow-emerald-500/20"}`,children:[S.jsx(Fw,{size:14})," Add Row"]})})]}),!x.columns||x.columns.length===0?S.jsxs("div",{className:`flex-1 flex flex-col items-center justify-center p-8 rounded-lg border border-dashed transition-colors ${d==="dark"?"bg-slate-900/50 border-slate-800":"bg-slate-50 border-slate-200"}`,children:[S.jsx(ZD,{size:32,className:`${d==="dark"?"text-slate-700":"text-slate-300"} mb-4`}),S.jsx("p",{className:"text-sm text-slate-500 mb-1",children:"No columns defined yet."}),S.jsx("p",{className:"text-xs text-slate-400 italic",children:'Add columns in the "Logical" tab first to enable sample data.'})]}):S.jsx("div",{className:`flex-1 overflow-auto border rounded-lg shadow-inner transition-colors ${d==="dark"?"border-slate-800 bg-slate-950/20":"border-slate-200 bg-white"}`,children:S.jsxs("table",{className:"w-full border-collapse text-xs",children:[S.jsx("thead",{className:`sticky top-0 z-10 border-b transition-colors ${d==="dark"?"bg-slate-950 border-slate-800":"bg-slate-100 border-slate-200"}`,children:S.jsxs("tr",{children:[(x.columns||[]).map(X=>S.jsx("th",{className:`p-3 text-left border-r min-w-[140px] transition-colors ${d==="dark"?"border-slate-800":"border-slate-200"}`,children:S.jsxs("div",{className:"flex flex-col gap-0.5",children:[S.jsx("span",{className:`font-bold ${d==="dark"?"text-slate-200":"text-slate-700"}`,children:X?.logical?.name||X.id}),S.jsx("span",{className:`text-[10px] font-mono italic ${d==="dark"?"text-blue-400":"text-blue-600"}`,children:X?.physical?.name||X?.logical?.name?.toLowerCase().replace(/ /g,"_")||X.id})]})},X.id)),S.jsx("th",{className:`w-10 transition-colors ${d==="dark"?"bg-slate-950":"bg-slate-100"}`})]})}),S.jsxs("tbody",{children:[(x.sampleData||[]).map((X,pe)=>S.jsxs("tr",{className:`border-b transition-colors ${d==="dark"?"border-slate-800 hover:bg-slate-800/30":"border-slate-100 hover:bg-slate-50"}`,children:[(x.columns||[]).map((Se,ye)=>S.jsx("td",{className:`p-0 border-r transition-colors ${d==="dark"?"border-slate-800":"border-slate-200"}`,children:S.jsx("input",{value:String(X[ye]??""),onChange:_e=>Me(pe,ye,_e.target.value),className:`w-full bg-transparent border-none p-3 outline-none font-mono transition-colors ${d==="dark"?"focus:bg-slate-800 text-slate-300":"focus:bg-blue-50 text-slate-700"}`})},Se.id)),S.jsx("td",{className:"p-2 text-center",children:S.jsx("button",{onClick:Se=>xe(Se,pe),className:"text-slate-400 hover:text-red-500 transition-colors",children:S.jsx(_d,{size:12})})})]},pe)),(!x.sampleData||x.sampleData.length===0)&&S.jsx("tr",{children:S.jsx("td",{colSpan:(x.columns?.length||0)+1,className:`p-8 text-center text-slate-400 italic transition-colors ${d==="dark"?"bg-slate-900/20":"bg-slate-50"}`,children:'No rows defined. Click "Add Row" to start.'})})]})]})})]})]})]})};function $w(){return $w=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},$w.apply(null,arguments)}function cK(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}let Gw=[],_z=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?_z:Gw).push(n=n+t[e])})();function uK(t){if(t<768)return!1;for(let e=0,n=Gw.length;;){let i=e+n>>1;if(t<Gw[i])n=i;else if(t>=_z[i])e=i+1;else return!0;if(e==n)return!1}}function t3(t){return t>=127462&&t<=127487}const n3=8205;function fK(t,e,n=!0,i=!0){return(n?Oz:hK)(t,e,i)}function Oz(t,e,n){if(e==t.length)return e;e&&Ez(t.charCodeAt(e))&&Tz(t.charCodeAt(e-1))&&e--;let i=H1(t,e);for(e+=i3(i);e<t.length;){let r=H1(t,e);if(i==n3||r==n3||n&&uK(r))e+=i3(r),i=r;else if(t3(r)){let s=0,l=e-2;for(;l>=0&&t3(H1(t,l));)s++,l-=2;if(s%2==0)break;e+=2}else break}return e}function hK(t,e,n){for(;e>0;){let i=Oz(t,e-2,n);if(i<e)return i;e--}return 0}function H1(t,e){let n=t.charCodeAt(e);if(!Tz(n)||e+1==t.length)return n;let i=t.charCodeAt(e+1);return Ez(i)?(n-55296<<10)+(i-56320)+65536:n}function Ez(t){return t>=56320&&t<57344}function Tz(t){return t>=55296&&t<56320}function i3(t){return t<65536?1:2}class it{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,i){[e,n]=Ao(this,e,n);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(n,this.length,r,1),or.from(r,this.length-(n-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Ao(this,e,n);let i=[];return this.decompose(e,n,i,0),or.from(i,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new Wc(this),s=new Wc(e);for(let l=n,c=n;;){if(r.next(l),s.next(l),l=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(c+=r.value.length,r.done||c>=i)return!0}}iter(e=1){return new Wc(this,e)}iterRange(e,n=this.length){return new Mz(this,e,n)}iterLines(e,n){let i;if(e==null)i=this.iter();else{n==null&&(n=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new Nz(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?it.empty:e.length<=32?new Ut(e):or.from(Ut.split(e,[]))}}class Ut extends it{constructor(e,n=dK(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,i,r){for(let s=0;;s++){let l=this.text[s],c=r+l.length;if((n?i:c)>=e)return new pK(r,c,i,l);r=c+1,i++}}decompose(e,n,i,r){let s=e<=0&&n>=this.length?this:new Ut(r3(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(r&1){let l=i.pop(),c=nd(s.text,l.text.slice(),0,s.length);if(c.length<=32)i.push(new Ut(c,l.length+s.length));else{let u=c.length>>1;i.push(new Ut(c.slice(0,u)),new Ut(c.slice(u)))}}else i.push(s)}replace(e,n,i){if(!(i instanceof Ut))return super.replace(e,n,i);[e,n]=Ao(this,e,n);let r=nd(this.text,nd(i.text,r3(this.text,0,e)),n),s=this.length+i.length-(n-e);return r.length<=32?new Ut(r,s):or.from(Ut.split(r,[]),s)}sliceString(e,n=this.length,i=`
|
|
41
41
|
`){[e,n]=Ao(this,e,n);let r="";for(let s=0,l=0;s<=n&&l<this.text.length;l++){let c=this.text[l],u=s+c.length;s>e&&l&&(r+=i),e<u&&n>s&&(r+=c.slice(Math.max(0,e-s),n-s)),s=u+1}return r}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(n.push(new Ut(i,r)),i=[],r=-1);return r>-1&&n.push(new Ut(i,r)),n}}class or extends it{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,n,i,r){for(let s=0;;s++){let l=this.children[s],c=r+l.length,u=i+l.lines-1;if((n?u:c)>=e)return l.lineInner(e,n,i,r);r=c+1,i=u+1}}decompose(e,n,i,r){for(let s=0,l=0;l<=n&&s<this.children.length;s++){let c=this.children[s],u=l+c.length;if(e<=u&&n>=l){let h=r&((l<=e?1:0)|(u>=n?2:0));l>=e&&u<=n&&!h?i.push(c):c.decompose(e-l,n-l,i,h)}l=u+1}}replace(e,n,i){if([e,n]=Ao(this,e,n),i.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let l=this.children[r],c=s+l.length;if(e>=s&&n<=c){let u=l.replace(e-s,n-s,i),h=this.lines-l.lines+u.lines;if(u.lines<h>>4&&u.lines>h>>6){let d=this.children.slice();return d[r]=u,new or(d,this.length-(n-e)+i.length)}return super.replace(s,c,u)}s=c+1}return super.replace(e,n,i)}sliceString(e,n=this.length,i=`
|
|
42
42
|
`){[e,n]=Ao(this,e,n);let r="";for(let s=0,l=0;s<this.children.length&&l<=n;s++){let c=this.children[s],u=l+c.length;l>e&&s&&(r+=i),e<u&&n>l&&(r+=c.sliceString(e-l,n-l,i)),l=u+1}return r}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof or))return 0;let i=0,[r,s,l,c]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=n,s+=n){if(r==l||s==c)return i;let u=this.children[r],h=e.children[s];if(u!=h)return i+u.scanIdentical(h,n);i+=u.length+1}}static from(e,n=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let v of e)i+=v.lines;if(i<32){let v=[];for(let x of e)x.flatten(v);return new Ut(v,n)}let r=Math.max(32,i>>5),s=r<<1,l=r>>1,c=[],u=0,h=-1,d=[];function m(v){let x;if(v.lines>s&&v instanceof or)for(let w of v.children)m(w);else v.lines>l&&(u>l||!u)?(g(),c.push(v)):v instanceof Ut&&u&&(x=d[d.length-1])instanceof Ut&&v.lines+x.lines<=32?(u+=v.lines,h+=v.length+1,d[d.length-1]=new Ut(x.text.concat(v.text),x.length+1+v.length)):(u+v.lines>r&&g(),u+=v.lines,h+=v.length+1,d.push(v))}function g(){u!=0&&(c.push(d.length==1?d[0]:or.from(d,h)),h=-1,u=d.length=0)}for(let v of e)m(v);return g(),c.length==1?c[0]:new or(c,n)}}it.empty=new Ut([""],0);function dK(t){let e=-1;for(let n of t)e+=n.length+1;return e}function nd(t,e,n=0,i=1e9){for(let r=0,s=0,l=!0;s<t.length&&r<=i;s++){let c=t[s],u=r+c.length;u>=n&&(u>i&&(c=c.slice(0,i-r)),r<n&&(c=c.slice(n-r)),l?(e[e.length-1]+=c,l=!1):e.push(c)),r=u+1}return e}function r3(t,e,n){return nd(t,[""],e,n)}class Wc{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof Ut?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],l=s>>1,c=r instanceof Ut?r.text.length:r.children.length;if(l==(n>0?c:0)){if(i==0)return this.done=!0,this.value="",this;n>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[i]+=n,e==0)return this.lineBreak=!0,this.value=`
|
|
43
43
|
`,this;e--}else if(r instanceof Ut){let u=r.text[l+(n<0?-1:0)];if(this.offsets[i]+=n,u.length>Math.max(0,e))return this.value=e==0?u:n>0?u.slice(e):u.slice(0,u.length-e),this;e-=u.length}else{let u=r.children[l+(n<0?-1:0)];e>u.length?(e-=u.length,this.offsets[i]+=n):(n<0&&this.offsets[i]--,this.nodes.push(u),this.offsets.push(n>0?1:(u instanceof Ut?u.text.length:u.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Mz{constructor(e,n,i){this.value="",this.done=!1,this.cursor=new Wc(e,n>i?-1:1),this.pos=n>i?e.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let i=n<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*n,this.value=r.length<=i?r:n<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Nz{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:i,value:r}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(it.prototype[Symbol.iterator]=function(){return this.iter()},Wc.prototype[Symbol.iterator]=Mz.prototype[Symbol.iterator]=Nz.prototype[Symbol.iterator]=function(){return this});class pK{constructor(e,n,i,r){this.from=e,this.to=n,this.number=i,this.text=r}get length(){return this.to-this.from}}function Ao(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function dn(t,e,n=!0,i=!0){return fK(t,e,n,i)}function mK(t){return t>=56320&&t<57344}function gK(t){return t>=55296&&t<56320}function Fn(t,e){let n=t.charCodeAt(e);if(!gK(n)||e+1==t.length)return n;let i=t.charCodeAt(e+1);return mK(i)?(n-55296<<10)+(i-56320)+65536:n}function B2(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function cr(t){return t<65536?1:2}const Yw=/\r\n?|\n/;var Ln=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Ln||(Ln={}));class gr{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n+1];e+=i<0?this.sections[n]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,i=0,r=0;n<this.sections.length;){let s=this.sections[n++],l=this.sections[n++];l<0?(e(i,r,s),r+=s):r+=l,i+=s}}iterChangedRanges(e,n=!1){Qw(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let i=this.sections[n++],r=this.sections[n++];r<0?e.push(i,r):e.push(r,i)}return new gr(e)}composeDesc(e){return this.empty?e:e.empty?this:Rz(this,e)}mapDesc(e,n=!1){return e.empty?this:Xw(this,e,n)}mapPos(e,n=-1,i=Ln.Simple){let r=0,s=0;for(let l=0;l<this.sections.length;){let c=this.sections[l++],u=this.sections[l++],h=r+c;if(u<0){if(h>e)return s+(e-r);s+=c}else{if(i!=Ln.Simple&&h>=e&&(i==Ln.TrackDel&&r<e&&h>e||i==Ln.TrackBefore&&r<e||i==Ln.TrackAfter&&h>e))return null;if(h>e||h==e&&n<0&&!c)return e==r||n<0?s:s+u;s+=u}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,n=e){for(let i=0,r=0;i<this.sections.length&&r<=n;){let s=this.sections[i++],l=this.sections[i++],c=r+s;if(l>=0&&r<=n&&c>=e)return r<e&&c>n?"cover":!0;r=c}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let i=this.sections[n++],r=this.sections[n++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new gr(e)}static create(e){return new gr(e)}}class an extends gr{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Qw(this,(n,i,r,s,l)=>e=e.replace(r,r+(i-n),l),!1),e}mapDesc(e,n=!1){return Xw(this,e,n,!0)}invert(e){let n=this.sections.slice(),i=[];for(let r=0,s=0;r<n.length;r+=2){let l=n[r],c=n[r+1];if(c>=0){n[r]=c,n[r+1]=l;let u=r>>1;for(;i.length<u;)i.push(it.empty);i.push(l?e.slice(s,s+l):it.empty)}s+=l}return new an(n,i)}compose(e){return this.empty?e:e.empty?this:Rz(this,e,!0)}map(e,n=!1){return e.empty?this:Xw(this,e,n,!0)}iterChanges(e,n=!1){Qw(this,e,n)}get desc(){return gr.create(this.sections)}filter(e){let n=[],i=[],r=[],s=new gu(this);e:for(let l=0,c=0;;){let u=l==e.length?1e9:e[l++];for(;c<u||c==u&&s.len==0;){if(s.done)break e;let d=Math.min(s.len,u-c);An(r,d,-1);let m=s.ins==-1?-1:s.off==0?s.ins:0;An(n,d,m),m>0&&Ps(i,n,s.text),s.forward(d),c+=d}let h=e[l++];for(;c<h;){if(s.done)break e;let d=Math.min(s.len,h-c);An(n,d,-1),An(r,d,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(d),c+=d}}return{changes:new an(n,i),filtered:gr.create(r)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n],r=this.sections[n+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,i){let r=[],s=[],l=0,c=null;function u(d=!1){if(!d&&!r.length)return;l<n&&An(r,n-l,-1);let m=new an(r,s);c=c?c.compose(m.map(c)):m,r=[],s=[],l=0}function h(d){if(Array.isArray(d))for(let m of d)h(m);else if(d instanceof an){if(d.length!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);u(),c=c?c.compose(d.map(c)):d}else{let{from:m,to:g=m,insert:v}=d;if(m>g||m<0||g>n)throw new RangeError(`Invalid change range ${m} to ${g} (in doc of length ${n})`);let x=v?typeof v=="string"?it.of(v.split(i||Yw)):v:it.empty,w=x.length;if(m==g&&w==0)return;m<l&&u(),m>l&&An(r,m-l,-1),An(r,g-m,w),Ps(s,r,x),l=g}}return h(e),u(!c),c}static empty(e){return new an(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],i=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")n.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((l,c)=>c&&typeof l!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;i.length<r;)i.push(it.empty);i[r]=it.of(s.slice(1)),n.push(s[0],i[r].length)}}}return new an(n,i)}static createSet(e,n){return new an(e,n)}}function An(t,e,n,i=!1){if(e==0&&n<=0)return;let r=t.length-2;r>=0&&n<=0&&n==t[r+1]?t[r]+=e:r>=0&&e==0&&t[r]==0?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}function Ps(t,e,n){if(n.length==0)return;let i=e.length-2>>1;if(i<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<i;)t.push(it.empty);t.push(n)}}function Qw(t,e,n){let i=t.inserted;for(let r=0,s=0,l=0;l<t.sections.length;){let c=t.sections[l++],u=t.sections[l++];if(u<0)r+=c,s+=c;else{let h=r,d=s,m=it.empty;for(;h+=c,d+=u,u&&i&&(m=m.append(i[l-2>>1])),!(n||l==t.sections.length||t.sections[l+1]<0);)c=t.sections[l++],u=t.sections[l++];e(r,h,s,d,m),r=h,s=d}}}function Xw(t,e,n,i=!1){let r=[],s=i?[]:null,l=new gu(t),c=new gu(e);for(let u=-1;;){if(l.done&&c.len||c.done&&l.len)throw new Error("Mismatched change set lengths");if(l.ins==-1&&c.ins==-1){let h=Math.min(l.len,c.len);An(r,h,-1),l.forward(h),c.forward(h)}else if(c.ins>=0&&(l.ins<0||u==l.i||l.off==0&&(c.len<l.len||c.len==l.len&&!n))){let h=c.len;for(An(r,c.ins,-1);h;){let d=Math.min(l.len,h);l.ins>=0&&u<l.i&&l.len<=d&&(An(r,0,l.ins),s&&Ps(s,r,l.text),u=l.i),l.forward(d),h-=d}c.next()}else if(l.ins>=0){let h=0,d=l.len;for(;d;)if(c.ins==-1){let m=Math.min(d,c.len);h+=m,d-=m,c.forward(m)}else if(c.ins==0&&c.len<d)d-=c.len,c.next();else break;An(r,h,u<l.i?l.ins:0),s&&u<l.i&&Ps(s,r,l.text),u=l.i,l.forward(l.len-d)}else{if(l.done&&c.done)return s?an.createSet(r,s):gr.create(r);throw new Error("Mismatched change set lengths")}}}function Rz(t,e,n=!1){let i=[],r=n?[]:null,s=new gu(t),l=new gu(e);for(let c=!1;;){if(s.done&&l.done)return r?an.createSet(i,r):gr.create(i);if(s.ins==0)An(i,s.len,0,c),s.next();else if(l.len==0&&!l.done)An(i,0,l.ins,c),r&&Ps(r,i,l.text),l.next();else{if(s.done||l.done)throw new Error("Mismatched change set lengths");{let u=Math.min(s.len2,l.len),h=i.length;if(s.ins==-1){let d=l.ins==-1?-1:l.off?0:l.ins;An(i,u,d,c),r&&d&&Ps(r,i,l.text)}else l.ins==-1?(An(i,s.off?0:s.len,u,c),r&&Ps(r,i,s.textBit(u))):(An(i,s.off?0:s.len,l.off?0:l.ins,c),r&&!l.off&&Ps(r,i,l.text));c=(s.ins>u||l.ins>=0&&l.len>u)&&(c||i.length>h),s.forward2(u),l.forward(u)}}}}class gu{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?it.empty:e[n]}textBit(e){let{inserted:n}=this.set,i=this.i-2>>1;return i>=n.length&&!e?it.empty:n[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ja{constructor(e,n,i){this.from=e,this.to=n,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,n):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new ja(i,r,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return de.range(e,n);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return de.range(this.anchor,i)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return de.range(e.anchor,e.head)}static create(e,n,i){return new ja(e,n,i)}}class de{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:de.create(this.ranges.map(i=>i.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new de([this.main],0)}addRange(e,n=!0){return de.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let i=this.ranges.slice();return i[n]=e,de.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new de(e.ranges.map(n=>ja.fromJSON(n)),e.main)}static single(e,n=e){return new de([de.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let s=e[r];if(s.empty?s.from<=i:s.from<i)return de.normalized(e.slice(),n);i=s.to}return new de(e,n)}static cursor(e,n=0,i,r){return ja.create(e,e,(n==0?0:n<0?8:16)|(i==null?7:Math.min(6,i))|(r??16777215)<<6)}static range(e,n,i,r){let s=(i??16777215)<<6|(r==null?7:Math.min(6,r));return n<e?ja.create(n,e,48|s):ja.create(e,n,(n>e?8:0)|s)}static normalized(e,n=0){let i=e[n];e.sort((r,s)=>r.from-s.from),n=e.indexOf(i);for(let r=1;r<e.length;r++){let s=e[r],l=e[r-1];if(s.empty?s.from<=l.to:s.from<l.to){let c=l.from,u=Math.max(s.to,l.to);r<=n&&n--,e.splice(--r,2,s.anchor>s.head?de.range(u,c):de.range(c,u))}}return new de(e,n)}}function Dz(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let j2=0;class ke{constructor(e,n,i,r,s){this.combine=e,this.compareInput=n,this.compare=i,this.isStatic=r,this.id=j2++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new ke(e.combine||(n=>n),e.compareInput||((n,i)=>n===i),e.compare||(e.combine?(n,i)=>n===i:I2),!!e.static,e.enables)}of(e){return new id([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new id(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new id(e,this,2,n)}from(e,n){return n||(n=i=>i),this.compute([e],i=>n(i.field(e)))}}function I2(t,e){return t==e||t.length==e.length&&t.every((n,i)=>n===e[i])}class id{constructor(e,n,i,r){this.dependencies=e,this.facet=n,this.type=i,this.value=r,this.id=j2++}dynamicSlot(e){var n;let i=this.value,r=this.facet.compareInput,s=this.id,l=e[s]>>1,c=this.type==2,u=!1,h=!1,d=[];for(let m of this.dependencies)m=="doc"?u=!0:m=="selection"?h=!0:(((n=e[m.id])!==null&&n!==void 0?n:1)&1)==0&&d.push(e[m.id]);return{create(m){return m.values[l]=i(m),1},update(m,g){if(u&&g.docChanged||h&&(g.docChanged||g.selection)||Ww(m,d)){let v=i(m);if(c?!s3(v,m.values[l],r):!r(v,m.values[l]))return m.values[l]=v,1}return 0},reconfigure:(m,g)=>{let v,x=g.config.address[s];if(x!=null){let w=Ed(g,x);if(this.dependencies.every(C=>C instanceof ke?g.facet(C)===m.facet(C):C instanceof Tn?g.field(C,!1)==m.field(C,!1):!0)||(c?s3(v=i(m),w,r):r(v=i(m),w)))return m.values[l]=w,0}else v=i(m);return m.values[l]=v,1}}}}function s3(t,e,n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!n(t[i],e[i]))return!1;return!0}function Ww(t,e){let n=!1;for(let i of e)Kc(t,i)&1&&(n=!0);return n}function yK(t,e,n){let i=n.map(u=>t[u.id]),r=n.map(u=>u.type),s=i.filter(u=>!(u&1)),l=t[e.id]>>1;function c(u){let h=[];for(let d=0;d<i.length;d++){let m=Ed(u,i[d]);if(r[d]==2)for(let g of m)h.push(g);else h.push(m)}return e.combine(h)}return{create(u){for(let h of i)Kc(u,h);return u.values[l]=c(u),1},update(u,h){if(!Ww(u,s))return 0;let d=c(u);return e.compare(d,u.values[l])?0:(u.values[l]=d,1)},reconfigure(u,h){let d=Ww(u,i),m=h.config.facets[e.id],g=h.facet(e);if(m&&!d&&I2(n,m))return u.values[l]=g,0;let v=c(u);return e.compare(v,g)?(u.values[l]=g,0):(u.values[l]=v,1)}}}const _h=ke.define({static:!0});class Tn{constructor(e,n,i,r,s){this.id=e,this.createF=n,this.updateF=i,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let n=new Tn(j2++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(_h).find(i=>i.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:i=>(i.values[n]=this.create(i),1),update:(i,r)=>{let s=i.values[n],l=this.updateF(s,r);return this.compareF(s,l)?0:(i.values[n]=l,1)},reconfigure:(i,r)=>{let s=i.facet(_h),l=r.facet(_h),c;return(c=s.find(u=>u.field==this))&&c!=l.find(u=>u.field==this)?(i.values[n]=c.create(i),1):r.config.address[this.id]!=null?(i.values[n]=r.field(this),0):(i.values[n]=this.create(i),1)}}}init(e){return[this,_h.of({field:this,create:e})]}get extension(){return this}}const Na={lowest:4,low:3,default:2,high:1,highest:0};function zc(t){return e=>new Lz(e,t)}const nl={highest:zc(Na.highest),high:zc(Na.high),default:zc(Na.default),low:zc(Na.low),lowest:zc(Na.lowest)};class Lz{constructor(e,n){this.inner=e,this.prec=n}}class Tp{of(e){return new Kw(this,e)}reconfigure(e){return Tp.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Kw{constructor(e,n){this.compartment=e,this.inner=n}}class Od{constructor(e,n,i,r,s,l){for(this.base=e,this.compartments=n,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=l,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,i){let r=[],s=Object.create(null),l=new Map;for(let g of vK(e,n,l))g instanceof Tn?r.push(g):(s[g.facet.id]||(s[g.facet.id]=[])).push(g);let c=Object.create(null),u=[],h=[];for(let g of r)c[g.id]=h.length<<1,h.push(v=>g.slot(v));let d=i?.config.facets;for(let g in s){let v=s[g],x=v[0].facet,w=d&&d[g]||[];if(v.every(C=>C.type==0))if(c[x.id]=u.length<<1|1,I2(w,v))u.push(i.facet(x));else{let C=x.combine(v.map(k=>k.value));u.push(i&&x.compare(C,i.facet(x))?i.facet(x):C)}else{for(let C of v)C.type==0?(c[C.id]=u.length<<1|1,u.push(C.value)):(c[C.id]=h.length<<1,h.push(k=>C.dynamicSlot(k)));c[x.id]=h.length<<1,h.push(C=>yK(C,x,v))}}let m=h.map(g=>g(c));return new Od(e,l,m,c,u,s)}}function vK(t,e,n){let i=[[],[],[],[],[]],r=new Map;function s(l,c){let u=r.get(l);if(u!=null){if(u<=c)return;let h=i[u].indexOf(l);h>-1&&i[u].splice(h,1),l instanceof Kw&&n.delete(l.compartment)}if(r.set(l,c),Array.isArray(l))for(let h of l)s(h,c);else if(l instanceof Kw){if(n.has(l.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(l.compartment)||l.inner;n.set(l.compartment,h),s(h,c)}else if(l instanceof Lz)s(l.inner,l.prec);else if(l instanceof Tn)i[c].push(l),l.provides&&s(l.provides,c);else if(l instanceof id)i[c].push(l),l.facet.extensions&&s(l.facet.extensions,Na.default);else{let h=l.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${l}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,c)}}return s(t,Na.default),i.reduce((l,c)=>l.concat(c))}function Kc(t,e){if(e&1)return 2;let n=e>>1,i=t.status[n];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;t.status[n]=4;let r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function Ed(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const zz=ke.define(),Zw=ke.define({combine:t=>t.some(e=>e),static:!0}),qz=ke.define({combine:t=>t.length?t[0]:void 0,static:!0}),Bz=ke.define(),jz=ke.define(),Iz=ke.define(),Pz=ke.define({combine:t=>t.length?t[0]:!1});class br{constructor(e,n){this.type=e,this.value=n}static define(){return new bK}}class bK{of(e){return new br(this,e)}}class xK{constructor(e){this.map=e}of(e){return new Ue(this,e)}}class Ue{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new Ue(this.type,n)}is(e){return this.type==e}static define(e={}){return new xK(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let i=[];for(let r of e){let s=r.map(n);s&&i.push(s)}return i}}Ue.reconfigure=Ue.define();Ue.appendConfig=Ue.define();class Vt{constructor(e,n,i,r,s,l){this.startState=e,this.changes=n,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=l,this._doc=null,this._state=null,i&&Dz(i,n.newLength),s.some(c=>c.type==Vt.time)||(this.annotations=s.concat(Vt.time.of(Date.now())))}static create(e,n,i,r,s,l){return new Vt(e,n,i,r,s,l)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Vt.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Vt.time=br.define();Vt.userEvent=br.define();Vt.addToHistory=br.define();Vt.remote=br.define();function wK(t,e){let n=[];for(let i=0,r=0;;){let s,l;if(i<t.length&&(r==e.length||e[r]>=t[i]))s=t[i++],l=t[i++];else if(r<e.length)s=e[r++],l=e[r++];else return n;!n.length||n[n.length-1]<s?n.push(s,l):n[n.length-1]<l&&(n[n.length-1]=l)}}function Hz(t,e,n){var i;let r,s,l;return n?(r=e.changes,s=an.empty(e.changes.length),l=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),l=t.changes.compose(r)),{changes:l,selection:e.selection?e.selection.map(s):(i=t.selection)===null||i===void 0?void 0:i.map(r),effects:Ue.mapEffects(t.effects,r).concat(Ue.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Jw(t,e,n){let i=e.selection,r=ho(e.annotations);return e.userEvent&&(r=r.concat(Vt.userEvent.of(e.userEvent))),{changes:e.changes instanceof an?e.changes:an.of(e.changes||[],n,t.facet(qz)),selection:i&&(i instanceof de?i:de.single(i.anchor,i.head)),effects:ho(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Uz(t,e,n){let i=Jw(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(n=!1);let l=!!e[s].sequential;i=Hz(i,Jw(t,e[s],l?i.changes.newLength:t.doc.length),l)}let r=Vt.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return CK(n?SK(r):r)}function SK(t){let e=t.startState,n=!0;for(let r of e.facet(Bz)){let s=r(t);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:wK(n,s))}if(n!==!0){let r,s;if(n===!1)s=t.changes.invertedDesc,r=an.empty(e.doc.length);else{let l=t.changes.filter(n);r=l.changes,s=l.filtered.mapDesc(l.changes).invertedDesc}t=Vt.create(e,r,t.selection&&t.selection.map(s),Ue.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let i=e.facet(jz);for(let r=i.length-1;r>=0;r--){let s=i[r](t);s instanceof Vt?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Vt?t=s[0]:t=Uz(e,ho(s),!1)}return t}function CK(t){let e=t.startState,n=e.facet(Iz),i=t;for(let r=n.length-1;r>=0;r--){let s=n[r](t);s&&Object.keys(s).length&&(i=Hz(i,Jw(e,s,t.changes.newLength),!0))}return i==t?t:Vt.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}const kK=[];function ho(t){return t==null?kK:Array.isArray(t)?t:[t]}var At=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(At||(At={}));const AK=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let eS;try{eS=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function _K(t){if(eS)return eS.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||AK.test(n)))return!0}return!1}function OK(t){return e=>{if(!/\S/.test(e))return At.Space;if(_K(e))return At.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return At.Word;return At.Other}}class nt{constructor(e,n,i,r,s,l){this.config=e,this.doc=n,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,l&&(l._state=this);for(let c=0;c<this.config.dynamicSlots.length;c++)Kc(this,c<<1);this.computeSlot=null}field(e,n=!0){let i=this.config.address[e.id];if(i==null){if(n)throw new RangeError("Field is not present in this state");return}return Kc(this,i),Ed(this,i)}update(...e){return Uz(this,e,!0)}applyTransaction(e){let n=this.config,{base:i,compartments:r}=n;for(let c of e.effects)c.is(Tp.reconfigure)?(n&&(r=new Map,n.compartments.forEach((u,h)=>r.set(h,u)),n=null),r.set(c.value.compartment,c.value.extension)):c.is(Ue.reconfigure)?(n=null,i=c.value):c.is(Ue.appendConfig)&&(n=null,i=ho(i).concat(c.value));let s;n?s=e.startState.values.slice():(n=Od.resolve(i,r,this),s=new nt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(u,h)=>h.reconfigure(u,this),null).values);let l=e.startState.facet(Zw)?e.newSelection:e.newSelection.asSingle();new nt(n,e.newDoc,l,s,(c,u)=>u.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:de.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,i=e(n.ranges[0]),r=this.changes(i.changes),s=[i.range],l=ho(i.effects);for(let c=1;c<n.ranges.length;c++){let u=e(n.ranges[c]),h=this.changes(u.changes),d=h.map(r);for(let g=0;g<c;g++)s[g]=s[g].map(d);let m=r.mapDesc(h,!0);s.push(u.range.map(m)),r=r.compose(d),l=Ue.mapEffects(l,d).concat(Ue.mapEffects(ho(u.effects),m))}return{changes:r,selection:de.create(s,n.mainIndex),effects:l}}changes(e=[]){return e instanceof an?e:an.of(e,this.doc.length,this.facet(nt.lineSeparator))}toText(e){return it.of(e.split(this.facet(nt.lineSeparator)||Yw))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(Kc(this,n),Ed(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof Tn&&this.config.address[r.id]!=null&&(n[i]=r.spec.toJSON(this.field(e[i]),this))}return n}static fromJSON(e,n={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let l=i[s],c=e[s];r.push(l.init(u=>l.spec.fromJSON(c,u)))}}return nt.create({doc:e.doc,selection:de.fromJSON(e.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(e={}){let n=Od.resolve(e.extensions||[],new Map),i=e.doc instanceof it?e.doc:it.of((e.doc||"").split(n.staticFacet(nt.lineSeparator)||Yw)),r=e.selection?e.selection instanceof de?e.selection:de.single(e.selection.anchor,e.selection.head):de.single(0);return Dz(r,i.length),n.staticFacet(Zw)||(r=r.asSingle()),new nt(n,i,r,n.dynamicSlots.map(()=>null),(s,l)=>l.create(s),null)}get tabSize(){return this.facet(nt.tabSize)}get lineBreak(){return this.facet(nt.lineSeparator)||`
|
|
@@ -51,7 +51,7 @@ Error generating stack: `+p.message+`
|
|
|
51
51
|
`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new rie(this):new tie(this)}getCursor(e,n=0,i){let r=e.doc?e:nt.create({doc:e});return i==null&&(i=r.doc.length),this.regexp?Zl(this,r,n,i):Kl(this,r,n,i)}}class iB{constructor(e){this.spec=e}}function Jne(t,e,n){return(i,r,s,l)=>{if(n&&!n(i,r,s,l))return!1;let c=i>=l&&r<=l+s.length?s.slice(i-l,r-l):e.doc.sliceString(i,r);return t(c,e,i,r)}}function Kl(t,e,n,i){let r;return t.wholeWord&&(r=eie(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(r=Jne(t.test,e,r)),new Mo(e.doc,t.unquoted,n,i,t.caseSensitive?void 0:s=>s.toLowerCase(),r)}function eie(t,e){return(n,i,r,s)=>((s>n||s+r.length<i)&&(s=Math.max(0,n-2),r=t.sliceString(s,Math.min(t.length,i+2))),(e(Yd(r,n-s))!=At.Word||e(Qd(r,n-s))!=At.Word)&&(e(Qd(r,i-s))!=At.Word||e(Yd(r,i-s))!=At.Word))}class tie extends iB{constructor(e){super(e)}nextMatch(e,n,i){let r=Kl(this.spec,e,i,e.doc.length).nextOverlapping();if(r.done){let s=Math.min(e.doc.length,n+this.spec.unquoted.length);r=Kl(this.spec,e,0,s).nextOverlapping()}return r.done||r.value.from==n&&r.value.to==i?null:r.value}prevMatchInRange(e,n,i){for(let r=i;;){let s=Math.max(n,r-1e4-this.spec.unquoted.length),l=Kl(this.spec,e,s,r),c=null;for(;!l.nextOverlapping().done;)c=l.value;if(c)return c;if(s==n)return null;r-=1e4}}prevMatch(e,n,i){let r=this.prevMatchInRange(e,0,n);return r||(r=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=n||r.to!=i)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let i=Kl(this.spec,e,0,e.doc.length),r=[];for(;!i.next().done;){if(r.length>=n)return null;r.push(i.value)}return r}highlight(e,n,i,r){let s=Kl(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}function nie(t,e,n){return(i,r,s)=>(!n||n(i,r,s))&&t(s[0],e,i,r)}function Zl(t,e,n,i){let r;return t.wholeWord&&(r=iie(e.charCategorizer(e.selection.main.head))),t.test&&(r=nie(t.test,e,r)),new eB(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:r},n,i)}function Yd(t,e){return t.slice(dn(t,e,!1),e)}function Qd(t,e){return t.slice(e,dn(t,e))}function iie(t){return(e,n,i)=>!i[0].length||(t(Yd(i.input,i.index))!=At.Word||t(Qd(i.input,i.index))!=At.Word)&&(t(Qd(i.input,i.index+i[0].length))!=At.Word||t(Yd(i.input,i.index+i[0].length))!=At.Word)}class rie extends iB{nextMatch(e,n,i){let r=Zl(this.spec,e,i,e.doc.length).next();return r.done&&(r=Zl(this.spec,e,0,n).next()),r.done?null:r.value}prevMatchInRange(e,n,i){for(let r=1;;r++){let s=Math.max(n,i-r*1e4),l=Zl(this.spec,e,s,i),c=null;for(;!l.next().done;)c=l.value;if(c&&(s==n||c.from>s+10))return c;if(s==n)return null}}prevMatch(e,n,i){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let r=i.length;r>0;r--){let s=+i.slice(0,r);if(s>0&&s<e.match.length)return e.match[s]+i.slice(r)}return n})}matchAll(e,n){let i=Zl(this.spec,e,0,e.doc.length),r=[];for(;!i.next().done;){if(r.length>=n)return null;r.push(i.value)}return r}highlight(e,n,i,r){let s=Zl(this.spec,e,Math.max(0,n-250),Math.min(i+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}const Eu=Ue.define(),dC=Ue.define(),$s=Tn.define({create(t){return new hw(BS(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Eu)?t=new hw(n.value.create(),t.panel):n.is(dC)&&(t=new hw(t.query,n.value?pC:null));return t},provide:t=>ku.from(t,e=>e.panel)});class hw{constructor(e,n){this.query=e,this.panel=n}}const sie=je.mark({class:"cm-searchMatch"}),aie=je.mark({class:"cm-searchMatch cm-searchMatch-selected"}),lie=Bt.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field($s))}update(t){let e=t.state.field($s);(e!=t.startState.field($s)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return je.none;let{view:n}=this,i=new ns;for(let r=0,s=n.visibleRanges,l=s.length;r<l;r++){let{from:c,to:u}=s[r];for(;r<l-1&&u>s[r+1].from-500;)u=s[++r].to;t.highlight(n.state,c,u,(h,d)=>{let m=n.state.selection.ranges.some(g=>g.from==h&&g.to==d);i.add(h,d,m?aie:sie)})}return i.finish()}},{decorations:t=>t.decorations});function Ku(t){return e=>{let n=e.state.field($s,!1);return n&&n.query.spec.valid?t(e,n):aB(e)}}const Xd=Ku((t,{query:e})=>{let{to:n}=t.state.selection.main,i=e.nextMatch(t.state,n,n);if(!i)return!1;let r=de.single(i.from,i.to),s=t.state.facet(Io);return t.dispatch({selection:r,effects:[mC(t,i),s.scrollToMatch(r.main,t)],userEvent:"select.search"}),sB(t),!0}),Wd=Ku((t,{query:e})=>{let{state:n}=t,{from:i}=n.selection.main,r=e.prevMatch(n,i,i);if(!r)return!1;let s=de.single(r.from,r.to),l=t.state.facet(Io);return t.dispatch({selection:s,effects:[mC(t,r),l.scrollToMatch(s.main,t)],userEvent:"select.search"}),sB(t),!0}),oie=Ku((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:de.create(n.map(i=>de.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),cie=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:i,to:r}=n.main,s=[],l=0;for(let c=new Mo(t.doc,t.sliceDoc(i,r));!c.next().done;){if(s.length>1e3)return!1;c.value.from==i&&(l=s.length),s.push(de.range(c.value.from,c.value.to))}return e(t.update({selection:de.create(s,l),userEvent:"select.search.matches"})),!0},k5=Ku((t,{query:e})=>{let{state:n}=t,{from:i,to:r}=n.selection.main;if(n.readOnly)return!1;let s=e.nextMatch(n,i,i);if(!s)return!1;let l=s,c=[],u,h,d=[];l.from==i&&l.to==r&&(h=n.toText(e.getReplacement(l)),c.push({from:l.from,to:l.to,insert:h}),l=e.nextMatch(n,l.from,l.to),d.push(we.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(i).number)+".")));let m=t.state.changes(c);return l&&(u=de.single(l.from,l.to).map(m),d.push(mC(t,l)),d.push(n.facet(Io).scrollToMatch(u.main,t))),t.dispatch({changes:m,selection:u,effects:d,userEvent:"input.replace"}),!0}),uie=Ku((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(r=>{let{from:s,to:l}=r;return{from:s,to:l,insert:e.getReplacement(r)}});if(!n.length)return!1;let i=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:we.announce.of(i),userEvent:"input.replace.all"}),!0});function pC(t){return t.state.facet(Io).createPanel(t)}function BS(t,e){var n,i,r,s,l;let c=t.selection.main,u=c.empty||c.to>c.from+100?"":t.sliceDoc(c.from,c.to);if(e&&!u)return e;let h=t.facet(Io);return new nB({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?u:u.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(r=e?.literal)!==null&&r!==void 0?r:h.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:h.regexp,wholeWord:(l=e?.wholeWord)!==null&&l!==void 0?l:h.wholeWord})}function rB(t){let e=tC(t,pC);return e&&e.dom.querySelector("[main-field]")}function sB(t){let e=rB(t);e&&e==t.root.activeElement&&e.select()}const aB=t=>{let e=t.state.field($s,!1);if(e&&e.panel){let n=rB(t);if(n&&n!=t.root.activeElement){let i=BS(t.state,e.query.spec);i.valid&&t.dispatch({effects:Eu.of(i)}),n.focus(),n.select()}}else t.dispatch({effects:[dC.of(!0),e?Eu.of(BS(t.state,e.query.spec)):Ue.appendConfig.of(pie)]});return!0},lB=t=>{let e=t.state.field($s,!1);if(!e||!e.panel)return!1;let n=tC(t,pC);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:dC.of(!1)}),!0},fie=[{key:"Mod-f",run:aB,scope:"editor search-panel"},{key:"F3",run:Xd,shift:Wd,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Xd,shift:Wd,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:lB,scope:"editor search-panel"},{key:"Mod-Shift-l",run:cie},{key:"Mod-Alt-g",run:Hne},{key:"Mod-d",run:Zne,preventDefault:!0}];class hie{constructor(e){this.view=e;let n=this.query=e.state.field($s).query.spec;this.commit=this.commit.bind(this),this.searchField=mt("input",{value:n.search,placeholder:fi(e,"Find"),"aria-label":fi(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=mt("input",{value:n.replace,placeholder:fi(e,"Replace"),"aria-label":fi(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=mt("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=mt("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=mt("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function i(r,s,l){return mt("button",{class:"cm-button",name:r,onclick:s,type:"button"},l)}this.dom=mt("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,i("next",()=>Xd(e),[fi(e,"next")]),i("prev",()=>Wd(e),[fi(e,"previous")]),i("select",()=>oie(e),[fi(e,"all")]),mt("label",null,[this.caseField,fi(e,"match case")]),mt("label",null,[this.reField,fi(e,"regexp")]),mt("label",null,[this.wordField,fi(e,"by word")]),...e.state.readOnly?[]:[mt("br"),this.replaceField,i("replace",()=>k5(e),[fi(e,"replace")]),i("replaceAll",()=>uie(e),[fi(e,"replace all")])],mt("button",{name:"close",onclick:()=>lB(e),"aria-label":fi(e,"close"),type:"button"},["×"])])}commit(){let e=new nB({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Eu.of(e)}))}keydown(e){gJ(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Wd:Xd)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),k5(this.view))}update(e){for(let n of e.transactions)for(let i of n.effects)i.is(Eu)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Io).top}}function fi(t,e){return t.state.phrase(e)}const $h=30,Gh=/[\s\.,:;?!]/;function mC(t,{from:e,to:n}){let i=t.state.doc.lineAt(e),r=t.state.doc.lineAt(n).to,s=Math.max(i.from,e-$h),l=Math.min(r,n+$h),c=t.state.sliceDoc(s,l);if(s!=i.from){for(let u=0;u<$h;u++)if(!Gh.test(c[u+1])&&Gh.test(c[u])){c=c.slice(u);break}}if(l!=r){for(let u=c.length-1;u>c.length-$h;u--)if(!Gh.test(c[u-1])&&Gh.test(c[u])){c=c.slice(0,u);break}}return we.announce.of(`${t.state.phrase("current match")}. ${c} ${t.state.phrase("on line")} ${i.number}.`)}const die=we.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),pie=[$s,nl.low(lie),die];class oB{constructor(e,n,i,r){this.state=e,this.pos=n,this.explicit=i,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=_n(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),i=Math.max(n.from,this.pos-250),r=n.text.slice(i-n.from,this.pos-n.from),s=r.search(cB(e,!1));return s<0?null:{from:i+s,to:this.pos,text:r.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function A5(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function mie(t){let e=Object.create(null),n=Object.create(null);for(let{label:r}of t){e[r[0]]=!0;for(let s=1;s<r.length;s++)n[r[s]]=!0}let i=A5(e)+A5(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function gie(t){let e=t.map(r=>typeof r=="string"?{label:r}:r),[n,i]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:mie(e);return r=>{let s=r.matchBefore(i);return s||r.explicit?{from:s?s.from:r.pos,options:e,validFor:n}:null}}class _5{constructor(e,n,i,r){this.completion=e,this.source=n,this.match=i,this.score=r}}function $a(t){return t.selection.main.from}function cB(t,e){var n;let{source:i}=t,r=e&&i[0]!="^",s=i[i.length-1]!="$";return!r&&!s?t:new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const uB=br.define();function yie(t,e,n,i){let{main:r}=t.selection,s=n-r.from,l=i-r.from;return{...t.changeByRange(c=>{if(c!=r&&n!=i&&t.sliceDoc(c.from+s,c.from+l)!=t.sliceDoc(n,i))return{range:c};let u=t.toText(e);return{changes:{from:c.from+s,to:i==r.from?c.to:c.from+l,insert:u},range:de.cursor(c.from+s+u.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const O5=new WeakMap;function vie(t){if(!Array.isArray(t))return t;let e=O5.get(t);return e||O5.set(t,e=gie(t)),e}const Kd=Ue.define(),Tu=Ue.define();class bie{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let i=Fn(e,n),r=cr(i);this.chars.push(i);let s=e.slice(n,n+r),l=s.toUpperCase();this.folded.push(Fn(l==s?s.toLowerCase():l,0)),n+=r}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:i,any:r,precise:s,byWord:l}=this;if(n.length==1){let A=Fn(e,0),O=cr(A),E=O==e.length?0:-100;if(A!=n[0])if(A==i[0])E+=-200;else return null;return this.ret(E,[0,O])}let c=e.indexOf(this.pattern);if(c==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let u=n.length,h=0;if(c<0){for(let A=0,O=Math.min(e.length,200);A<O&&h<u;){let E=Fn(e,A);(E==n[h]||E==i[h])&&(r[h++]=A),A+=cr(E)}if(h<u)return null}let d=0,m=0,g=!1,v=0,x=-1,w=-1,C=/[a-z]/.test(e),k=!0;for(let A=0,O=Math.min(e.length,200),E=0;A<O&&m<u;){let M=Fn(e,A);c<0&&(d<u&&M==n[d]&&(s[d++]=A),v<u&&(M==n[v]||M==i[v]?(v==0&&(x=A),w=A+1,v++):v=0));let T,N=M<255?M>=48&&M<=57||M>=97&&M<=122?2:M>=65&&M<=90?1:0:(T=B2(M))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!A||N==1&&C||E==0&&N!=0)&&(n[m]==M||i[m]==M&&(g=!0)?l[m++]=A:l.length&&(k=!1)),E=N,A+=cr(M)}return m==u&&l[0]==0&&k?this.result(-100+(g?-200:0),l,e):v==u&&x==0?this.ret(-200-e.length+(w==e.length?0:-100),[0,w]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==u?this.ret(-900-e.length,[x,w]):m==u?this.result(-100+(g?-200:0)+-700+(k?0:-1100),l,e):n.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,n,i){let r=[],s=0;for(let l of n){let c=l+(this.astral?cr(Fn(i,l)):1);s&&r[s-1]==l?r[s-1]=c:(r[s++]=l,r[s++]=c)}return this.ret(e-i.length,r)}}class xie{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),i=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return i==null?null:(this.matched=[0,n.length],this.score=i+(e.length==this.pattern.length?0:-100),this)}}const hn=ke.define({combine(t){return xr(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:wie,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>i=>E5(e(i),n(i)),optionClass:(e,n)=>i=>E5(e(i),n(i)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function E5(t,e){return t?e?t+" "+e:t:e}function wie(t,e,n,i,r,s){let l=t.textDirection==vt.RTL,c=l,u=!1,h="top",d,m,g=e.left-r.left,v=r.right-e.right,x=i.right-i.left,w=i.bottom-i.top;if(c&&g<Math.min(x,v)?c=!1:!c&&v<Math.min(x,g)&&(c=!0),x<=(c?g:v))d=Math.max(r.top,Math.min(n.top,r.bottom-w))-e.top,m=Math.min(400,c?g:v);else{u=!0,m=Math.min(400,(l?e.right:r.right-e.left)-30);let A=r.bottom-e.bottom;A>=w||A>e.top?d=n.bottom-e.top:(h="bottom",d=e.bottom-n.top)}let C=(e.bottom-e.top)/s.offsetHeight,k=(e.right-e.left)/s.offsetWidth;return{style:`${h}: ${d/C}px; max-width: ${m/k}px`,class:"cm-completionInfo-"+(u?l?"left-narrow":"right-narrow":c?"left":"right")}}const gC=Ue.define();function Sie(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),n.type&&i.classList.add(...n.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(n,i,r,s){let l=document.createElement("span");l.className="cm-completionLabel";let c=n.displayLabel||n.label,u=0;for(let h=0;h<s.length;){let d=s[h++],m=s[h++];d>u&&l.appendChild(document.createTextNode(c.slice(u,d)));let g=l.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(c.slice(d,m))),g.className="cm-completionMatchedText",u=m}return u<c.length&&l.appendChild(document.createTextNode(c.slice(u))),l},position:50},{render(n){if(!n.detail)return null;let i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=n.detail,i},position:80}),e.sort((n,i)=>n.position-i.position).map(n=>n.render)}function dw(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let r=Math.floor(e/n);return{from:r*n,to:(r+1)*n}}let i=Math.floor((t-e)/n);return{from:t-(i+1)*n,to:t-i*n}}class Cie{constructor(e,n,i){this.view=e,this.stateField=n,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:u=>this.placeInfo(u),key:this},this.space=null,this.currentClass="";let r=e.state.field(n),{options:s,selected:l}=r.open,c=e.state.facet(hn);this.optionContent=Sie(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=dw(s.length,l,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",u=>{let{options:h}=e.state.field(n).open;for(let d=u.target,m;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(m=/-(\d+)$/.exec(d.id))&&+m[1]<h.length){this.applyCompletion(e,h[+m[1]]),u.preventDefault();return}if(u.target==this.list){let d=this.list.classList.contains("cm-completionListIncompleteTop")&&u.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&u.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(e.dispatch({effects:gC.of(d)}),u.preventDefault())}}),this.dom.addEventListener("focusout",u=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(hn).closeOnBlur&&u.relatedTarget!=e.contentDOM&&e.dispatch({effects:Tu.of(null)})}),this.showOptions(s,r.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let i=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=r){let{options:s,selected:l,disabled:c}=i.open;(!r.open||r.open.options!=s)&&(this.range=dw(s.length,l,e.state.facet(hn).maxRenderedOptions),this.showOptions(s,i.id)),this.updateSel(),c!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of n.split(" "))i&&this.dom.classList.add(i);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=dw(n.options.length,n.selected,this.view.state.facet(hn).maxRenderedOptions),this.showOptions(n.options,e.id));let i=this.updateSelectedOption(n.selected);if(i){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:s}=r;if(!s)return;let l=typeof s=="string"?document.createTextNode(s):s(r);if(!l)return;"then"in l?l.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,r)}).catch(c=>Xn(this.view.state,c,"completion info")):(this.addInfoPane(l,r),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:s}=e;i.appendChild(r),this.infoDestroy=s||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let i=this.list.firstChild,r=this.range.from;i;i=i.nextSibling,r++)i.nodeName!="LI"||!i.id?r--:r==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),n=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return n&&Aie(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),s=this.space;if(!s){let l=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return r.top>Math.min(s.bottom,n.bottom)-10||r.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(hn).positionInfo(this.view,n,r,i,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,i){const r=document.createElement("ul");r.id=n,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",l=>{l.target==r&&l.preventDefault()});let s=null;for(let l=i.from;l<i.to;l++){let{completion:c,match:u}=e[l],{section:h}=c;if(h){let g=typeof h=="string"?h:h.name;if(g!=s&&(l>i.from||i.from==0))if(s=g,typeof h!="string"&&h.header)r.appendChild(h.header(h));else{let v=r.appendChild(document.createElement("completion-section"));v.textContent=g}}const d=r.appendChild(document.createElement("li"));d.id=n+"-"+l,d.setAttribute("role","option");let m=this.optionClass(c);m&&(d.className=m);for(let g of this.optionContent){let v=g(c,this.view.state,this.view,u);v&&d.appendChild(v)}}return i.from&&r.classList.add("cm-completionListIncompleteTop"),i.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function kie(t,e){return n=>new Cie(n,t,e)}function Aie(t,e){let n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),r=n.height/t.offsetHeight;i.top<n.top?t.scrollTop-=(n.top-i.top)/r:i.bottom>n.bottom&&(t.scrollTop+=(i.bottom-n.bottom)/r)}function T5(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function _ie(t,e){let n=[],i=null,r=null,s=d=>{n.push(d);let{section:m}=d.completion;if(m){i||(i=[]);let g=typeof m=="string"?m:m.name;i.some(v=>v.name==g)||i.push(typeof m=="string"?{name:g}:m)}},l=e.facet(hn);for(let d of t)if(d.hasResult()){let m=d.result.getMatch;if(d.result.filter===!1)for(let g of d.result.options)s(new _5(g,d.source,m?m(g):[],1e9-n.length));else{let g=e.sliceDoc(d.from,d.to),v,x=l.filterStrict?new xie(g):new bie(g);for(let w of d.result.options)if(v=x.match(w.label)){let C=w.displayLabel?m?m(w,v.matched):[]:v.matched,k=v.score+(w.boost||0);if(s(new _5(w,d.source,C,k)),typeof w.section=="object"&&w.section.rank==="dynamic"){let{name:A}=w.section;r||(r=Object.create(null)),r[A]=Math.max(k,r[A]||-1e9)}}}}if(i){let d=Object.create(null),m=0,g=(v,x)=>(v.rank==="dynamic"&&x.rank==="dynamic"?r[x.name]-r[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof x.rank=="number"?x.rank:1e9)||(v.name<x.name?-1:1);for(let v of i.sort(g))m-=1e5,d[v.name]=m;for(let v of n){let{section:x}=v.completion;x&&(v.score+=d[typeof x=="string"?x:x.name])}}let c=[],u=null,h=l.compareCompletions;for(let d of n.sort((m,g)=>g.score-m.score||h(m.completion,g.completion))){let m=d.completion;!u||u.label!=m.label||u.detail!=m.detail||u.type!=null&&m.type!=null&&u.type!=m.type||u.apply!=m.apply||u.boost!=m.boost?c.push(d):T5(d.completion)>T5(u)&&(c[c.length-1]=d),u=d.completion}return c}class ao{constructor(e,n,i,r,s,l){this.options=e,this.attrs=n,this.tooltip=i,this.timestamp=r,this.selected=s,this.disabled=l}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new ao(this.options,M5(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,i,r,s,l){if(r&&!l&&e.some(h=>h.isPending))return r.setDisabled();let c=_ie(e,n);if(!c.length)return r&&e.some(h=>h.isPending)?r.setDisabled():null;let u=n.facet(hn).selectOnOpen?0:-1;if(r&&r.selected!=u&&r.selected!=-1){let h=r.options[r.selected].completion;for(let d=0;d<c.length;d++)if(c[d].completion==h){u=d;break}}return new ao(c,M5(i,u),{pos:e.reduce((h,d)=>d.hasResult()?Math.min(h,d.from):h,1e8),create:Rie,above:s.aboveCursor},r?r.timestamp:Date.now(),u,!1)}map(e){return new ao(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ao(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Zd{constructor(e,n,i){this.active=e,this.id=n,this.open=i}static start(){return new Zd(Mie,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,i=n.facet(hn),s=(i.override||n.languageDataAt("autocomplete",$a(n)).map(vie)).map(u=>(this.active.find(d=>d.source==u)||new Ni(u,this.active.some(d=>d.state!=0)?1:0)).update(e,i));s.length==this.active.length&&s.every((u,h)=>u==this.active[h])&&(s=this.active);let l=this.open,c=e.effects.some(u=>u.is(yC));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||s.some(u=>u.hasResult()&&e.changes.touchesRange(u.from,u.to))||!Oie(s,this.active)||c?l=ao.build(s,n,this.id,l,i,c):l&&l.disabled&&!s.some(u=>u.isPending)&&(l=null),!l&&s.every(u=>!u.isPending)&&s.some(u=>u.hasResult())&&(s=s.map(u=>u.hasResult()?new Ni(u.source,0):u));for(let u of e.effects)u.is(gC)&&(l=l&&l.setSelected(u.value,this.id));return s==this.active&&l==this.open?this:new Zd(s,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Eie:Tie}}function Oie(t,e){if(t==e)return!0;for(let n=0,i=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;i<e.length&&!e[i].hasResult();)i++;let r=n==t.length,s=i==e.length;if(r||s)return r==s;if(t[n++].result!=e[i++].result)return!1}}const Eie={"aria-autocomplete":"list"},Tie={};function M5(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const Mie=[];function fB(t,e){if(t.isUserEvent("input.complete")){let i=t.annotation(uB);if(i&&e.activateOnCompletion(i))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Ni{constructor(e,n,i=!1){this.source=e,this.state=n,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let i=fB(e,n),r=this;(i&8||i&16&&this.touches(e))&&(r=new Ni(r.source,0)),i&4&&r.state==0&&(r=new Ni(this.source,1)),r=r.updateFor(e,i);for(let s of e.effects)if(s.is(Kd))r=new Ni(r.source,1,s.value);else if(s.is(Tu))r=new Ni(r.source,0);else if(s.is(yC))for(let l of s.value)l.source==r.source&&(r=l);return r}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange($a(e.state))}}class vo extends Ni{constructor(e,n,i,r,s,l){super(e,3,n),this.limit=i,this.result=r,this.from=s,this.to=l}hasResult(){return!0}updateFor(e,n){var i;if(!(n&3))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let s=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),c=$a(e.state);if(c>l||!r||n&2&&($a(e.startState)==this.from||c<this.limit))return new Ni(this.source,n&4?1:0);let u=e.changes.mapPos(this.limit);return Nie(r.validFor,e.state,s,l)?new vo(this.source,this.explicit,u,r,s,l):r.update&&(r=r.update(r,s,l,new oB(e.state,c,!1)))?new vo(this.source,this.explicit,u,r,r.from,(i=r.to)!==null&&i!==void 0?i:$a(e.state)):new Ni(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new vo(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Ni(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function Nie(t,e,n,i){if(!t)return!1;let r=e.sliceDoc(n,i);return typeof t=="function"?t(r,n,i,e):cB(t,!0).test(r)}const yC=Ue.define({map(t,e){return t.map(n=>n.map(e))}}),$n=Tn.define({create(){return Zd.start()},update(t,e){return t.update(e)},provide:t=>[eC.from(t,e=>e.tooltip),we.contentAttributes.from(t,e=>e.attrs)]});function vC(t,e){const n=e.completion.apply||e.completion.label;let i=t.state.field($n).active.find(r=>r.source==e.source);return i instanceof vo?(typeof n=="string"?t.dispatch({...yie(t.state,n,i.from,i.to),annotations:uB.of(e.completion)}):n(t,e.completion,i.from,i.to),!0):!1}const Rie=kie($n,vC);function Yh(t,e="option"){return n=>{let i=n.state.field($n,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(hn).interactionDelay)return!1;let r=1,s;e=="page"&&(s=F6(n,i.open.tooltip))&&(r=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:l}=i.open.options,c=i.open.selected>-1?i.open.selected+r*(t?1:-1):t?0:l-1;return c<0?c=e=="page"?0:l-1:c>=l&&(c=e=="page"?l-1:0),n.dispatch({effects:gC.of(c)}),!0}}const Die=t=>{let e=t.state.field($n,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(hn).interactionDelay?!1:vC(t,e.open.options[e.open.selected])},pw=t=>t.state.field($n,!1)?(t.dispatch({effects:Kd.of(!0)}),!0):!1,Lie=t=>{let e=t.state.field($n,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Tu.of(null)}),!0)};class zie{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const qie=50,Bie=1e3,jie=Bt.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field($n).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field($n),n=t.state.facet(hn);if(!t.selectionSet&&!t.docChanged&&t.startState.field($n)==e)return;let i=t.transactions.some(s=>{let l=fB(s,n);return l&8||(s.selection||s.docChanged)&&!(l&3)});for(let s=0;s<this.running.length;s++){let l=this.running[s];if(i||l.context.abortOnDocChange&&t.docChanged||l.updates.length+t.transactions.length>qie&&Date.now()-l.time>Bie){for(let c of l.context.abortListeners)try{c()}catch(u){Xn(this.view.state,u)}l.context.abortListeners=null,this.running.splice(s--,1)}else l.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(l=>l.is(Kd)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(l=>l.active.source==s.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let s of t.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field($n);for(let n of e.active)n.isPending&&!this.running.some(i=>i.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(hn).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=$a(e),i=new oB(e,n,t.explicit,this.view),r=new zie(t,i);this.running.push(r),Promise.resolve(t.source(i)).then(s=>{r.context.aborted||(r.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Tu.of(null)}),Xn(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(hn).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(hn),i=this.view.state.field($n);for(let r=0;r<this.running.length;r++){let s=this.running[r];if(s.done===void 0)continue;if(this.running.splice(r--,1),s.done){let c=$a(s.updates.length?s.updates[0].startState:this.view.state),u=Math.min(c,s.done.from+(s.active.explicit?0:1)),h=new vo(s.active.source,s.active.explicit,u,s.done,s.done.from,(t=s.done.to)!==null&&t!==void 0?t:c);for(let d of s.updates)h=h.update(d,n);if(h.hasResult()){e.push(h);continue}}let l=i.active.find(c=>c.source==s.active.source);if(l&&l.isPending)if(s.done==null){let c=new Ni(s.active.source,0);for(let u of s.updates)c=c.update(u,n);c.isPending||e.push(c)}else this.startQuery(l)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:yC.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field($n,!1);if(e&&e.tooltip&&this.view.state.facet(hn).closeOnBlur){let n=e.open&&F6(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Tu.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Kd.of(!1)}),20),this.composing=0}}}),Iie=typeof navigator=="object"&&/Win/.test(navigator.platform),Pie=nl.highest(we.domEventHandlers({keydown(t,e){let n=e.state.field($n,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Iie&&t.altKey)||t.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find(l=>l.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&vC(e,i),!1}})),Hie=we.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Mu={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Pa=Ue.define({map(t,e){let n=e.mapPos(t,-1,Ln.TrackAfter);return n??void 0}}),bC=new class extends Xs{};bC.startSide=1;bC.endSide=-1;const hB=Tn.define({create(){return Ze.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:i=>i>=n.from&&i<=n.to})}for(let n of e.effects)n.is(Pa)&&(t=t.update({add:[bC.range(n.value,n.value+1)]}));return t}});function Uie(){return[Fie,hB]}const mw="()[]{}<>«»»«[]{}";function dB(t){for(let e=0;e<mw.length;e+=2)if(mw.charCodeAt(e)==t)return mw.charAt(e+1);return B2(t<128?t:t+1)}function pB(t,e){return t.languageDataAt("closeBrackets",e)[0]||Mu}const Vie=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Fie=we.inputHandler.of((t,e,n,i)=>{if((Vie?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(i.length>2||i.length==2&&cr(Fn(i,0))==1||e!=r.from||n!=r.to)return!1;let s=Yie(t.state,i);return s?(t.dispatch(s),!0):!1}),$ie=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=pB(t,t.selection.main.head).brackets||Mu.brackets,r=null,s=t.changeByRange(l=>{if(l.empty){let c=Qie(t.doc,l.head);for(let u of i)if(u==c&&Fp(t.doc,l.head)==dB(Fn(u,0)))return{changes:{from:l.head-u.length,to:l.head+u.length},range:de.cursor(l.head-u.length)}}return{range:r=l}});return r||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},Gie=[{key:"Backspace",run:$ie}];function Yie(t,e){let n=pB(t,t.selection.main.head),i=n.brackets||Mu.brackets;for(let r of i){let s=dB(Fn(r,0));if(e==r)return s==r?Kie(t,r,i.indexOf(r+r+r)>-1,n):Xie(t,r,s,n.before||Mu.before);if(e==s&&mB(t,t.selection.main.from))return Wie(t,r,s)}return null}function mB(t,e){let n=!1;return t.field(hB).between(0,t.doc.length,i=>{i==e&&(n=!0)}),n}function Fp(t,e){let n=t.sliceString(e,e+2);return n.slice(0,cr(Fn(n,0)))}function Qie(t,e){let n=t.sliceString(e-2,e);return cr(Fn(n,0))==n.length?n:n.slice(1)}function Xie(t,e,n,i){let r=null,s=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:n,from:l.to}],effects:Pa.of(l.to+e.length),range:de.range(l.anchor+e.length,l.head+e.length)};let c=Fp(t.doc,l.head);return!c||/\s/.test(c)||i.indexOf(c)>-1?{changes:{insert:e+n,from:l.head},effects:Pa.of(l.head+e.length),range:de.cursor(l.head+e.length)}:{range:r=l}});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Wie(t,e,n){let i=null,r=t.changeByRange(s=>s.empty&&Fp(t.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:de.cursor(s.head+n.length)}:i={range:s});return i?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Kie(t,e,n,i){let r=i.stringPrefixes||Mu.stringPrefixes,s=null,l=t.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:Pa.of(c.to+e.length),range:de.range(c.anchor+e.length,c.head+e.length)};let u=c.head,h=Fp(t.doc,u),d;if(h==e){if(N5(t,u))return{changes:{insert:e+e,from:u},effects:Pa.of(u+e.length),range:de.cursor(u+e.length)};if(mB(t,u)){let g=n&&t.sliceDoc(u,u+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:u,to:u+g.length,insert:g},range:de.cursor(u+g.length)}}}else{if(n&&t.sliceDoc(u-2*e.length,u)==e+e&&(d=R5(t,u-2*e.length,r))>-1&&N5(t,d))return{changes:{insert:e+e+e+e,from:u},effects:Pa.of(u+e.length),range:de.cursor(u+e.length)};if(t.charCategorizer(u)(h)!=At.Word&&R5(t,u,r)>-1&&!Zie(t,u,e,r))return{changes:{insert:e+e,from:u},effects:Pa.of(u+e.length),range:de.cursor(u+e.length)}}return{range:s=c}});return s?null:t.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function N5(t,e){let n=_n(t).resolveInner(e+1);return n.parent&&n.from==e}function Zie(t,e,n,i){let r=_n(t).resolveInner(e,-1),s=i.reduce((l,c)=>Math.max(l,c.length),0);for(let l=0;l<5;l++){let c=t.sliceDoc(r.from,Math.min(r.to,r.from+n.length+s)),u=c.indexOf(n);if(!u||u>-1&&i.indexOf(c.slice(0,u))>-1){let d=r.firstChild;for(;d&&d.from==r.from&&d.to-d.from>n.length+u;){if(t.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let h=r.to==e&&r.parent;if(!h)break;r=h}return!1}function R5(t,e,n){let i=t.charCategorizer(e);if(i(t.sliceDoc(e-1,e))!=At.Word)return e;for(let r of n){let s=e-r.length;if(t.sliceDoc(s,e)==r&&i(t.sliceDoc(s-1,s))!=At.Word)return s}return-1}function Jie(t={}){return[Pie,$n,hn.of(t),jie,ere,Hie]}const gB=[{key:"Ctrl-Space",run:pw},{mac:"Alt-`",run:pw},{mac:"Alt-i",run:pw},{key:"Escape",run:Lie},{key:"ArrowDown",run:Yh(!0)},{key:"ArrowUp",run:Yh(!1)},{key:"PageDown",run:Yh(!0,"page")},{key:"PageUp",run:Yh(!1,"page")},{key:"Enter",run:Die}],ere=nl.highest(zp.computeN([hn],t=>t.facet(hn).defaultKeymap?[gB]:[]));class D5{constructor(e,n,i){this.from=e,this.to=n,this.diagnostic=i}}class Ra{constructor(e,n,i){this.diagnostics=e,this.panel=n,this.selected=i}static init(e,n,i){let r=i.facet(Nu).markerFilter;r&&(e=r(e,i));let s=e.slice().sort((v,x)=>v.from-x.from||v.to-x.to),l=new ns,c=[],u=0,h=i.doc.iter(),d=0,m=i.doc.length;for(let v=0;;){let x=v==s.length?null:s[v];if(!x&&!c.length)break;let w,C;if(c.length)w=u,C=c.reduce((O,E)=>Math.min(O,E.to),x&&x.from>w?x.from:1e8);else{if(w=x.from,w>m)break;C=x.to,c.push(x),v++}for(;v<s.length;){let O=s[v];if(O.from==w&&(O.to>O.from||O.to==w))c.push(O),v++,C=Math.min(O.to,C);else{C=Math.min(O.from,C);break}}C=Math.min(C,m);let k=!1;if(c.some(O=>O.from==w&&(O.to==C||C==m))&&(k=w==C,!k&&C-w<10)){let O=w-(d+h.value.length);O>0&&(h.next(O),d=w);for(let E=w;;){if(E>=C){k=!0;break}if(!h.lineBreak&&d+h.value.length>E)break;E=d+h.value.length,d+=h.value.length,h.next()}}let A=dre(c);if(k)l.add(w,w,je.widget({widget:new cre(A),diagnostics:c.slice()}));else{let O=c.reduce((E,M)=>M.markClass?E+" "+M.markClass:E,"");l.add(w,C,je.mark({class:"cm-lintRange cm-lintRange-"+A+O,diagnostics:c.slice(),inclusiveEnd:c.some(E=>E.to>C)}))}if(u=C,u==m)break;for(let O=0;O<c.length;O++)c[O].to<=u&&c.splice(O--,1)}let g=l.finish();return new Ra(g,n,ta(g))}}function ta(t,e=null,n=0){let i=null;return t.between(n,1e9,(r,s,{spec:l})=>{if(!(e&&l.diagnostics.indexOf(e)<0))if(!i)i=new D5(r,s,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new D5(i.from,s,i.diagnostic)}}),i}function tre(t,e){let n=e.pos,i=e.end||n,r=t.state.facet(Nu).hideOn(t,n,i);if(r!=null)return r;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(l=>l.is(yB))||t.changes.touchesRange(s.from,Math.max(s.to,i)))}function nre(t,e){return t.field(mi,!1)?e:e.concat(Ue.appendConfig.of(pre))}const yB=Ue.define(),xC=Ue.define(),vB=Ue.define(),mi=Tn.define({create(){return new Ra(je.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),i=null,r=t.panel;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);i=ta(n,t.selected.diagnostic,s)||ta(n,null,s)}!n.size&&r&&e.state.facet(Nu).autoPanel&&(r=null),t=new Ra(n,r,i)}for(let n of e.effects)if(n.is(yB)){let i=e.state.facet(Nu).autoPanel?n.value.length?Ru.open:null:t.panel;t=Ra.init(n.value,i,e.state)}else n.is(xC)?t=new Ra(t.diagnostics,n.value?Ru.open:null,t.selected):n.is(vB)&&(t=new Ra(t.diagnostics,t.panel,n.value));return t},provide:t=>[ku.from(t,e=>e.panel),we.decorations.from(t,e=>e.diagnostics)]}),ire=je.mark({class:"cm-lintRange cm-lintRange-active"});function rre(t,e,n){let{diagnostics:i}=t.state.field(mi),r,s=-1,l=-1;i.between(e-(n<0?1:0),e+(n>0?1:0),(u,h,{spec:d})=>{if(e>=u&&e<=h&&(u==h||(e>u||n>0)&&(e<h||n<0)))return r=d.diagnostics,s=u,l=h,!1});let c=t.state.facet(Nu).tooltipFilter;return r&&c&&(r=c(r,t.state)),r?{pos:s,end:l,above:t.state.doc.lineAt(s).to<l,create(){return{dom:sre(t,r)}}}:null}function sre(t,e){return mt("ul",{class:"cm-tooltip-lint"},e.map(n=>xB(t,n,!1)))}const are=t=>{let e=t.state.field(mi,!1);(!e||!e.panel)&&t.dispatch({effects:nre(t.state,[xC.of(!0)])});let n=tC(t,Ru.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},L5=t=>{let e=t.state.field(mi,!1);return!e||!e.panel?!1:(t.dispatch({effects:xC.of(!1)}),!0)},lre=t=>{let e=t.state.field(mi,!1);if(!e)return!1;let n=t.state.selection.main,i=ta(e.diagnostics,null,n.to+1);return!i&&(i=ta(e.diagnostics,null,0),!i||i.from==n.from&&i.to==n.to)?!1:(t.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},ore=[{key:"Mod-Shift-m",run:are,preventDefault:!0},{key:"F8",run:lre}],Nu=ke.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...xr(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:z5,tooltipFilter:z5,needsRefresh:(e,n)=>e?n?i=>e(i)||n(i):e:n,hideOn:(e,n)=>e?n?(i,r,s)=>e(i,r,s)||n(i,r,s):e:n,autoPanel:(e,n)=>e||n})}}});function z5(t,e){return t?e?(n,i)=>e(t(n,i),i):t:e}function bB(t){let e=[];if(t)e:for(let{name:n}of t){for(let i=0;i<n.length;i++){let r=n[i];if(/[a-zA-Z]/.test(r)&&!e.some(s=>s.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function xB(t,e,n){var i;let r=n?bB(e.actions):[];return mt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},mt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((s,l)=>{let c=!1,u=v=>{if(v.preventDefault(),c)return;c=!0;let x=ta(t.state.field(mi).diagnostics,e);x&&s.apply(t,x.from,x.to)},{name:h}=s,d=r[l]?h.indexOf(r[l]):-1,m=d<0?h:[h.slice(0,d),mt("u",h.slice(d,d+1)),h.slice(d+1)],g=s.markClass?" "+s.markClass:"";return mt("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:u,onmousedown:u,"aria-label":` Action: ${h}${d<0?"":` (access key "${r[l]})"`}.`},m)}),e.source&&mt("div",{class:"cm-diagnosticSource"},e.source))}class cre extends wr{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return mt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class q5{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=xB(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Ru{constructor(e){this.view=e,this.items=[];let n=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)L5(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],l=bB(s.actions);for(let c=0;c<l.length;c++)if(l[c].toUpperCase().charCodeAt(0)==r.keyCode){let u=ta(this.view.state.field(mi).diagnostics,s);u&&s.actions[c].apply(e,u.from,u.to)}}else return;r.preventDefault()}},i=r=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(r.target)&&this.moveSelection(s)};this.list=mt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:i}),this.dom=mt("div",{class:"cm-panel-lint"},this.list,mt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>L5(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(mi).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(mi),i=0,r=!1,s=null,l=new Set;for(e.between(0,this.view.state.doc.length,(c,u,{spec:h})=>{for(let d of h.diagnostics){if(l.has(d))continue;l.add(d);let m=-1,g;for(let v=i;v<this.items.length;v++)if(this.items[v].diagnostic==d){m=v;break}m<0?(g=new q5(this.view,d),this.items.splice(i,0,g),r=!0):(g=this.items[m],m>i&&(this.items.splice(i,m-i),r=!0)),n&&g.diagnostic==n.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),s=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new q5(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:c,panel:u})=>{let h=u.height/this.list.offsetHeight;c.top<u.top?this.list.scrollTop-=(u.top-c.top)/h:c.bottom>u.bottom&&(this.list.scrollTop+=(c.bottom-u.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function n(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)n();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(mi),i=ta(n.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:vB.of(i)})}static open(e){return new Ru(e)}}function ure(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function Qh(t){return ure(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const fre=we.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Qh("#d11")},".cm-lintRange-warning":{backgroundImage:Qh("orange")},".cm-lintRange-info":{backgroundImage:Qh("#999")},".cm-lintRange-hint":{backgroundImage:Qh("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function hre(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function dre(t){let e="hint",n=1;for(let i of t){let r=hre(i.severity);r>n&&(n=r,e=i.severity)}return e}const pre=[mi,we.decorations.compute([mi],t=>{let{selected:e,panel:n}=t.field(mi);return!e||!n||e.from==e.to?je.none:je.set([ire.range(e.from,e.to)])}),ree(rre,{hideOn:tre}),fre];var B5=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,i=[];e.closeBracketsKeymap!==!1&&(i=i.concat(Gie)),e.defaultKeymap!==!1&&(i=i.concat(jne)),e.searchKeymap!==!1&&(i=i.concat(fie)),e.historyKeymap!==!1&&(i=i.concat($te)),e.foldKeymap!==!1&&(i=i.concat(ste)),e.completionKeymap!==!1&&(i=i.concat(gB)),e.lintKeymap!==!1&&(i=i.concat(ore));var r=[];return e.lineNumbers!==!1&&r.push(yee()),e.highlightActiveLineGutter!==!1&&r.push(xee()),e.highlightSpecialChars!==!1&&r.push(DJ()),e.history!==!1&&r.push(qte()),e.foldGutter!==!1&&r.push(cte()),e.drawSelection!==!1&&r.push(SJ()),e.dropCursor!==!1&&r.push(OJ()),e.allowMultipleSelections!==!1&&r.push(nt.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&r.push(Xee()),e.syntaxHighlighting!==!1&&r.push(yq(dte,{fallback:!0})),e.bracketMatching!==!1&&r.push(xte()),e.closeBrackets!==!1&&r.push(Uie()),e.autocompletion!==!1&&r.push(Jie()),e.rectangularSelection!==!1&&r.push(YJ()),n!==!1&&r.push(WJ()),e.highlightActiveLine!==!1&&r.push(IJ()),e.highlightSelectionMatches!==!1&&r.push(Fne()),e.tabSize&&typeof e.tabSize=="number"&&r.push(Bp.of(" ".repeat(e.tabSize))),r.concat([zp.of(i.flat())]).filter(Boolean)};const mre="#e5c07b",j5="#e06c75",gre="#56b6c2",yre="#ffffff",cd="#abb2bf",jS="#7d8799",vre="#61afef",bre="#98c379",I5="#d19a66",xre="#c678dd",wre="#21252b",P5="#2c313a",H5="#282c34",gw="#353a42",Sre="#3E4451",U5="#528bff",Cre=we.theme({"&":{color:cd,backgroundColor:H5},".cm-content":{caretColor:U5},".cm-cursor, .cm-dropCursor":{borderLeftColor:U5},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Sre},".cm-panels":{backgroundColor:wre,color:cd},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:H5,color:jS,border:"none"},".cm-activeLineGutter":{backgroundColor:P5},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:gw},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:gw,borderBottomColor:gw},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:P5,color:cd}}},{dark:!0}),kre=Xu.define([{tag:le.keyword,color:xre},{tag:[le.name,le.deleted,le.character,le.propertyName,le.macroName],color:j5},{tag:[le.function(le.variableName),le.labelName],color:vre},{tag:[le.color,le.constant(le.name),le.standard(le.name)],color:I5},{tag:[le.definition(le.name),le.separator],color:cd},{tag:[le.typeName,le.className,le.number,le.changed,le.annotation,le.modifier,le.self,le.namespace],color:mre},{tag:[le.operator,le.operatorKeyword,le.url,le.escape,le.regexp,le.link,le.special(le.string)],color:gre},{tag:[le.meta,le.comment],color:jS},{tag:le.strong,fontWeight:"bold"},{tag:le.emphasis,fontStyle:"italic"},{tag:le.strikethrough,textDecoration:"line-through"},{tag:le.link,color:jS,textDecoration:"underline"},{tag:le.heading,fontWeight:"bold",color:j5},{tag:[le.atom,le.bool,le.special(le.variableName)],color:I5},{tag:[le.processingInstruction,le.string,le.inserted],color:bre},{tag:le.invalid,color:yre}]),wB=[Cre,yq(kre)];var Are=we.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),_re=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:i=!0,readOnly:r=!1,theme:s="light",placeholder:l="",basicSetup:c=!0}=e,u=[];switch(n&&u.unshift(zp.of([Ine])),c&&(typeof c=="boolean"?u.unshift(B5()):u.unshift(B5(c))),l&&u.unshift(VJ(l)),s){case"light":u.push(Are);break;case"dark":u.push(wB);break;case"none":break;default:u.push(s);break}return i===!1&&u.push(we.editable.of(!1)),r&&u.push(nt.readOnly.of(!0)),[...u]},Ore=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class Ere{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(i){console.error("TimeoutLatch callback error:",i)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class V5{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var yw=null,Tre=()=>typeof window>"u"?new V5:(yw||(yw=new V5),yw),F5=br.define(),Mre=200,Nre=[];function Rre(t){var{value:e,selection:n,onChange:i,onStatistics:r,onCreateEditor:s,onUpdate:l,extensions:c=Nre,autoFocus:u,theme:h="light",height:d=null,minHeight:m=null,maxHeight:g=null,width:v=null,minWidth:x=null,maxWidth:w=null,placeholder:C="",editable:k=!0,readOnly:A=!1,indentWithTab:O=!0,basicSetup:E=!0,root:M,initialState:T}=t,[N,I]=Y.useState(),[q,H]=Y.useState(),[B,$]=Y.useState(),V=Y.useState(()=>({current:null}))[0],D=Y.useState(()=>({current:null}))[0],P=we.theme({"&":{height:d,minHeight:m,maxHeight:g,width:v,minWidth:x,maxWidth:w},"& .cm-scroller":{height:"100% !important"}}),L=we.updateListener.of(U=>{if(U.docChanged&&typeof i=="function"&&!U.transactions.some(G=>G.annotation(F5))){V.current?V.current.reset():(V.current=new Ere(()=>{if(D.current){var G=D.current;D.current=null,G()}V.current=null},Mre),Tre().add(V.current));var re=U.state.doc,z=re.toString();i(z,U)}r&&r(Ore(U))}),Q=_re({theme:h,editable:k,readOnly:A,placeholder:C,indentWithTab:O,basicSetup:E}),Z=[L,P,...Q];return l&&typeof l=="function"&&Z.push(we.updateListener.of(l)),Z=Z.concat(c),Y.useLayoutEffect(()=>{if(N&&!B){var U={doc:e,selection:n,extensions:Z},re=T?nt.fromJSON(T.json,U,T.fields):nt.create(U);if($(re),!q){var z=new we({state:re,parent:N,root:M});H(z),s&&s(z,re)}}return()=>{q&&($(void 0),H(void 0))}},[N,B]),Y.useEffect(()=>{t.container&&I(t.container)},[t.container]),Y.useEffect(()=>()=>{q&&(q.destroy(),H(void 0)),V.current&&(V.current.cancel(),V.current=null)},[q]),Y.useEffect(()=>{u&&q&&q.focus()},[u,q]),Y.useEffect(()=>{q&&q.dispatch({effects:Ue.reconfigure.of(Z)})},[h,c,d,m,g,v,x,w,C,k,A,O,E,i,l]),Y.useEffect(()=>{if(e!==void 0){var U=q?q.state.doc.toString():"";if(q&&e!==U){var re=V.current&&!V.current.isDone,z=()=>{q&&e!==q.state.doc.toString()&&q.dispatch({changes:{from:0,to:q.state.doc.toString().length,insert:e||""},annotations:[F5.of(!0)]})};re?D.current=z:z()}}},[e,q]),{state:B,setState:$,view:q,setView:H,container:N,setContainer:I}}var Dre=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],SB=Y.forwardRef((t,e)=>{var{className:n,value:i="",selection:r,extensions:s=[],onChange:l,onStatistics:c,onCreateEditor:u,onUpdate:h,autoFocus:d,theme:m="light",height:g,minHeight:v,maxHeight:x,width:w,minWidth:C,maxWidth:k,basicSetup:A,placeholder:O,indentWithTab:E,editable:M,readOnly:T,root:N,initialState:I}=t,q=cK(t,Dre),H=Y.useRef(null),{state:B,view:$,container:V,setContainer:D}=Rre({root:N,value:i,autoFocus:d,theme:m,height:g,minHeight:v,maxHeight:x,width:w,minWidth:C,maxWidth:k,basicSetup:A,placeholder:O,indentWithTab:E,editable:M,readOnly:T,selection:r,onChange:l,onStatistics:c,onCreateEditor:u,onUpdate:h,extensions:s,initialState:I});Y.useImperativeHandle(e,()=>({editor:H.current,state:B,view:$}),[H,V,B,$]);var P=Y.useCallback(Q=>{H.current=Q,D(Q)},[D]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var L=typeof m=="string"?"cm-theme-"+m:"cm-theme";return S.jsx("div",$w({ref:P,className:""+L+(n?" "+n:"")},q))});SB.displayName="CodeMirror";var $5={};class Jd{constructor(e,n,i,r,s,l,c,u,h,d=0,m){this.p=e,this.stack=n,this.state=i,this.reducePos=r,this.pos=s,this.score=l,this.buffer=c,this.bufferBase=u,this.curContext=h,this.lookAhead=d,this.parent=m}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,i=0){let r=e.parser.context;return new Jd(e,[],n,i,i,0,[],0,r?new G5(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let i=e>>19,r=e&65535,{parser:s}=this.p,l=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),c=s.dynamicPrecedence(r);if(c&&(this.score+=c),i==0){this.pushState(s.getGoto(this.state,r,!0),this.reducePos),r<s.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,l?8:4,!0),this.reduceContext(r,this.reducePos);return}let u=this.stack.length-(i-1)*3-(e&262144?6:0),h=u?this.stack[u-2]:this.p.ranges[0].from,d=this.reducePos-h;d>=2e3&&!(!((n=this.p.parser.nodeSet.types[r])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=d));let m=u?this.stack[u-1]:0,g=this.bufferBase+this.buffer.length-m;if(r<s.minRepeatTerm||e&131072){let v=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,h,v,g+4,!0)}if(e&262144)this.state=this.stack[u];else{let v=this.stack[u-3];this.state=s.getGoto(v,r,!0)}for(;this.stack.length>u;)this.stack.pop();this.reduceContext(r,h)}storeNode(e,n,i,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let l=this,c=this.buffer.length;if(c==0&&l.parent&&(c=l.bufferBase-l.parent.bufferBase,l=l.parent),c>0&&l.buffer[c-4]==0&&l.buffer[c-1]>-1){if(n==i)return;if(l.buffer[c-2]>=n){l.buffer[c-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(e,n,i,r);else{let l=this.buffer.length;if(l>0&&(this.buffer[l-4]!=0||this.buffer[l-1]<0)){let c=!1;for(let u=l;u>0&&this.buffer[u-2]>i;u-=4)if(this.buffer[u-1]>=0){c=!0;break}if(c)for(;l>0&&this.buffer[l-2]>i;)this.buffer[l]=this.buffer[l-4],this.buffer[l+1]=this.buffer[l-3],this.buffer[l+2]=this.buffer[l-2],this.buffer[l+3]=this.buffer[l-1],l-=4,r>4&&(r-=4)}this.buffer[l]=e,this.buffer[l+1]=n,this.buffer[l+2]=i,this.buffer[l+3]=r}}shift(e,n,i,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:l}=this.p;this.pos=r;let c=l.stateFlag(s,1);!c&&(r>i||n<=l.maxNode)&&(this.reducePos=r),this.pushState(s,c?i:Math.min(i,this.reducePos)),this.shiftContext(n,i),n<=l.maxNode&&this.buffer.push(n,i,r,4)}else this.pos=r,this.shiftContext(n,i),n<=this.p.parser.maxNode&&this.buffer.push(n,i,r,4)}apply(e,n,i,r){e&65536?this.reduce(e):this.shift(e,n,i,r)}useNode(e,n){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(n,r),this.buffer.push(i,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let i=e.buffer.slice(n),r=e.bufferBase+n;for(;e&&r==e.bufferBase;)e=e.parent;return new Jd(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,i?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Lre(this);;){let i=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(i==0)return!1;if((i&65536)==0)return!0;n.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let r=[];for(let s=0,l;s<n.length;s+=2)(l=n[s+1])!=this.state&&this.p.parser.hasAction(l,e)&&r.push(n[s],l);if(this.stack.length<120)for(let s=0;r.length<8&&s<n.length;s+=2){let l=n[s+1];r.some((c,u)=>u&1&&c==l)||r.push(n[s],l)}n=r}let i=[];for(let r=0;r<n.length&&i.length<4;r+=2){let s=n[r+1];if(s==this.state)continue;let l=this.split();l.pushState(s,this.pos),l.storeNode(0,l.pos,l.pos,4,!0),l.shiftContext(n[r],this.pos),l.reducePos=this.pos,l.score-=200,i.push(l)}return i}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let i=n>>19,r=n&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let l=this.findForcedReduction();if(l==null)return!1;n=l}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],i=(r,s)=>{if(!n.includes(r))return n.push(r),e.allActions(r,l=>{if(!(l&393216))if(l&65536){let c=(l>>19)-s;if(c>1){let u=l&65535,h=this.stack.length-c*3;if(h>=0&&e.getGoto(this.stack[h],u,!1)>=0)return c<<19|65536|u}}else{let c=i(l,s+1);if(c!=null)return c}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new G5(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class G5{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Lre{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=r}}class ep{constructor(e,n,i){this.stack=e,this.pos=n,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new ep(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ep(this.stack,this.pos,this.index)}}function Xh(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let i=0,r=0;i<t.length;){let s=0;for(;;){let l=t.charCodeAt(i++),c=!1;if(l==126){s=65535;break}l>=92&&l--,l>=34&&l--;let u=l-32;if(u>=46&&(u-=46,c=!0),s+=u,c)break;s*=46}n?n[r++]=s:n=new e(s)}return n}class ud{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Y5=new ud;class zre{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Y5,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let i=this.range,r=this.rangeIndex,s=this.pos+e;for(;s<i.from;){if(!r)return null;let l=this.ranges[--r];s-=i.from-l.to,i=l}for(;n<0?s>i.to:s>=i.to;){if(r==this.ranges.length-1)return null;let l=this.ranges[++r];s+=l.from-i.to,i=l}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,i,r;if(n>=0&&n<this.chunk.length)i=this.pos+e,r=this.chunk.charCodeAt(n);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(i=s,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let l=this.rangeIndex,c=this.range;for(;c.to<=i;)c=this.ranges[++l];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>c.to&&(this.chunk2=this.chunk2.slice(0,c.to-i)),r=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),r}acceptToken(e,n=0){let i=n?this.resolveOffset(n,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=Y5,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let i="";for(let r of this.ranges){if(r.from>=n)break;r.to>e&&(i+=this.input.read(Math.max(r.from,e),Math.min(r.to,n)))}return i}}class bo{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:i}=n.p;qre(this.data,e,n,this.id,i.data,i.tokenPrecTable)}}bo.prototype.contextual=bo.prototype.fallback=bo.prototype.extend=!1;bo.prototype.fallback=bo.prototype.extend=!1;class $p{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function qre(t,e,n,i,r,s){let l=0,c=1<<i,{dialect:u}=n.p.parser;e:for(;(c&t[l])!=0;){let h=t[l+1];for(let v=l+3;v<h;v+=2)if((t[v+1]&c)>0){let x=t[v];if(u.allows(x)&&(e.token.value==-1||e.token.value==x||Bre(x,e.token.value,r,s))){e.acceptToken(x);break}}let d=e.next,m=0,g=t[l+2];if(e.next<0&&g>m&&t[h+g*3-3]==65535){l=t[h+g*3-1];continue e}for(;m<g;){let v=m+g>>1,x=h+v+(v<<1),w=t[x],C=t[x+1]||65536;if(d<w)g=v;else if(d>=C)m=v+1;else{l=t[x+2],e.advance();continue e}}break}}function Q5(t,e,n){for(let i=e,r;(r=t[i])!=65535;i++)if(r==n)return i-e;return-1}function Bre(t,e,n,i){let r=Q5(n,i,e);return r<0||Q5(n,i,t)<r}const hi=typeof process<"u"&&$5&&/\bparse\b/.test($5.LOG);let vw=null;function X5(t,e,n){let i=t.cursor(Lt.IncludeAnonymous);for(i.moveTo(e);;)if(!(n<0?i.childBefore(e):i.childAfter(e)))for(;;){if((n<0?i.to<e:i.from>e)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(t.length,Math.max(i.from+1,e+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:t.length}}class jre{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?X5(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?X5(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let i=this.trees[n],r=this.index[n];if(r==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[r],l=this.start[n]+i.positions[r];if(l>e)return this.nextStart=l,null;if(s instanceof Ft){if(l==e){if(l<this.safeFrom)return null;let c=l+s.length;if(c<=this.safeTo){let u=s.prop(Qe.lookAhead);if(!u||c+u<this.fragment.to)return s}}this.index[n]++,l+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(l),this.index.push(0))}else this.index[n]++,this.nextStart=l+s.length}}}class Ire{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new ud)}getActions(e){let n=0,i=null,{parser:r}=e.p,{tokenizers:s}=r,l=r.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,u=0;for(let h=0;h<s.length;h++){if((1<<h&l)==0)continue;let d=s[h],m=this.tokens[h];if(!(i&&!d.fallback)&&((d.contextual||m.start!=e.pos||m.mask!=l||m.context!=c)&&(this.updateCachedToken(m,d,e),m.mask=l,m.context=c),m.lookAhead>m.end+25&&(u=Math.max(m.lookAhead,u)),m.value!=0)){let g=n;if(m.extended>-1&&(n=this.addActions(e,m.extended,m.end,n)),n=this.addActions(e,m.value,m.end,n),!d.extend&&(i=m,n>g))break}}for(;this.actions.length>n;)this.actions.pop();return u&&e.setLookAhead(u),!i&&e.pos==this.stream.end&&(i=new ud,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,n=this.addActions(e,i.value,i.end,n)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new ud,{pos:i,p:r}=e;return n.start=i,n.end=Math.min(i+1,r.stream.end),n.value=i==r.stream.end?r.parser.eofTerm:0,n}updateCachedToken(e,n,i){let r=this.stream.clipPos(i.pos);if(n.token(this.stream.reset(r,e),i),e.value>-1){let{parser:s}=i.p;for(let l=0;l<s.specialized.length;l++)if(s.specialized[l]==e.value){let c=s.specializers[l](this.stream.read(e.start,e.end),i);if(c>=0&&i.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,n,i,r){for(let s=0;s<r;s+=3)if(this.actions[s]==e)return r;return this.actions[r++]=e,this.actions[r++]=n,this.actions[r++]=i,r}addActions(e,n,i,r){let{state:s}=e,{parser:l}=e.p,{data:c}=l;for(let u=0;u<2;u++)for(let h=l.stateSlot(s,u?2:1);;h+=3){if(c[h]==65535)if(c[h+1]==1)h=Xr(c,h+2);else{r==0&&c[h+1]==2&&(r=this.putAction(Xr(c,h+2),n,i,r));break}c[h]==n&&(r=this.putAction(Xr(c,h+1),n,i,r))}return r}}class Pre{constructor(e,n,i,r){this.parser=e,this.input=n,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new zre(n,r),this.tokens=new Ire(e,this.stream),this.topTerm=e.top[1];let{from:s}=r[0];this.stacks=[Jd.start(this,e.top[0],s)],this.fragments=i.length&&this.stream.end-s>e.bufferLength*4?new jre(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,i=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[l]=e;for(;l.forceReduce()&&l.stack.length&&l.stack[l.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let l=0;l<e.length;l++){let c=e[l];for(;;){if(this.tokens.mainToken=null,c.pos>n)i.push(c);else{if(this.advanceStack(c,i,e))continue;{r||(r=[],s=[]),r.push(c);let u=this.tokens.getMainToken(c);s.push(u.value,u.end)}}break}}if(!i.length){let l=r&&Vre(r);if(l)return hi&&console.log("Finish with "+this.stackID(l)),this.stackToTree(l);if(this.parser.strict)throw hi&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&r){let l=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,i);if(l)return hi&&console.log("Force-finish "+this.stackID(l)),this.stackToTree(l.forceAll())}if(this.recovering){let l=this.recovering==1?1:this.recovering*3;if(i.length>l)for(i.sort((c,u)=>u.score-c.score);i.length>l;)i.pop();i.some(c=>c.reducePos>n)&&this.recovering--}else if(i.length>1){e:for(let l=0;l<i.length-1;l++){let c=i[l];for(let u=l+1;u<i.length;u++){let h=i[u];if(c.sameState(h)||c.buffer.length>500&&h.buffer.length>500)if((c.score-h.score||c.buffer.length-h.buffer.length)>0)i.splice(u--,1);else{i.splice(l--,1);continue e}}}i.length>12&&(i.sort((l,c)=>c.score-l.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let l=1;l<i.length;l++)i[l].pos<this.minStackPos&&(this.minStackPos=i[l].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,i){let r=e.pos,{parser:s}=this,l=hi?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,d=h?e.curContext.hash:0;for(let m=this.fragments.nodeAt(r);m;){let g=this.parser.nodeSet.types[m.type.id]==m.type?s.getGoto(e.state,m.type.id):-1;if(g>-1&&m.length&&(!h||(m.prop(Qe.contextHash)||0)==d))return e.useNode(m,g),hi&&console.log(l+this.stackID(e)+` (via reuse of ${s.getName(m.type.id)})`),!0;if(!(m instanceof Ft)||m.children.length==0||m.positions[0]>0)break;let v=m.children[0];if(v instanceof Ft&&m.positions[0]==0)m=v;else break}}let c=s.stateSlot(e.state,4);if(c>0)return e.reduce(c),hi&&console.log(l+this.stackID(e)+` (via always-reduce ${s.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let u=this.tokens.getActions(e);for(let h=0;h<u.length;){let d=u[h++],m=u[h++],g=u[h++],v=h==u.length||!i,x=v?e:e.split(),w=this.tokens.mainToken;if(x.apply(d,m,w?w.start:x.pos,g),hi&&console.log(l+this.stackID(x)+` (via ${(d&65536)==0?"shift":`reduce of ${s.getName(d&65535)}`} for ${s.getName(m)} @ ${r}${x==e?"":", split"})`),v)return!0;x.pos>r?n.push(x):i.push(x)}return!1}advanceFully(e,n){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return W5(e,n),!0}}runRecovery(e,n,i){let r=null,s=!1;for(let l=0;l<e.length;l++){let c=e[l],u=n[l<<1],h=n[(l<<1)+1],d=hi?this.stackID(c)+" -> ":"";if(c.deadEnd&&(s||(s=!0,c.restart(),hi&&console.log(d+this.stackID(c)+" (restarted)"),this.advanceFully(c,i))))continue;let m=c.split(),g=d;for(let v=0;v<10&&m.forceReduce()&&(hi&&console.log(g+this.stackID(m)+" (via force-reduce)"),!this.advanceFully(m,i));v++)hi&&(g=this.stackID(m)+" -> ");for(let v of c.recoverByInsert(u))hi&&console.log(d+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,i);this.stream.end>c.pos?(h==c.pos&&(h++,u=0),c.recoverByDelete(u,h),hi&&console.log(d+this.stackID(c)+` (via recover-delete ${this.parser.getName(u)})`),W5(c,i)):(!r||r.score<m.score)&&(r=m)}return r}stackToTree(e){return e.close(),Ft.build({buffer:ep.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(vw||(vw=new WeakMap)).get(e);return n||vw.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function W5(t,e){for(let n=0;n<e.length;n++){let i=e[n];if(i.pos==t.pos&&i.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class Hre{constructor(e,n,i){this.source=e,this.flags=n,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}const bw=t=>t;class Ure{constructor(e){this.start=e.start,this.shift=e.shift||bw,this.reduce=e.reduce||bw,this.reuse=e.reuse||bw,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class tp extends eq{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let c=0;c<e.repeatNodeCount;c++)n.push("");let i=Object.keys(e.topRules).map(c=>e.topRules[c][1]),r=[];for(let c=0;c<n.length;c++)r.push([]);function s(c,u,h){r[c].push([u,u.deserialize(String(h))])}if(e.nodeProps)for(let c of e.nodeProps){let u=c[0];typeof u=="string"&&(u=Qe[u]);for(let h=1;h<c.length;){let d=c[h++];if(d>=0)s(d,u,c[h++]);else{let m=c[h+-d];for(let g=-d;g>0;g--)s(c[h++],u,m);h++}}}this.nodeSet=new nC(n.map((c,u)=>ti.define({name:u>=this.minRepeatTerm?void 0:c,id:u,props:r[u],top:i.indexOf(u)>-1,error:u==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(u)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=W6;let l=Xh(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;c<this.specializerSpecs.length;c++)this.specialized[c]=this.specializerSpecs[c].term;this.specializers=this.specializerSpecs.map(K5),this.states=Xh(e.states,Uint32Array),this.data=Xh(e.stateData),this.goto=Xh(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(c=>typeof c=="number"?new bo(l,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,i){let r=new Pre(this,e,n,i);for(let s of this.wrappers)r=s(r,e,n,i);return r}getGoto(e,n,i=!1){let r=this.goto;if(n>=r[0])return-1;for(let s=r[n+1];;){let l=r[s++],c=l&1,u=r[s++];if(c&&i)return u;for(let h=s+(l>>1);s<h;s++)if(r[s]==e)return u;if(c)return-1}}hasAction(e,n){let i=this.data;for(let r=0;r<2;r++)for(let s=this.stateSlot(e,r?2:1),l;;s+=3){if((l=i[s])==65535)if(i[s+1]==1)l=i[s=Xr(i,s+2)];else{if(i[s+1]==2)return Xr(i,s+2);break}if(l==n||l==0)return Xr(i,s+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,i=>i==n?!0:null)}allActions(e,n){let i=this.stateSlot(e,4),r=i?n(i):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Xr(this.data,s+2);else break;r=n(Xr(this.data,s+1))}return r}nextStates(e){let n=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Xr(this.data,i+2);else break;if((this.data[i+2]&1)==0){let r=this.data[i+1];n.some((s,l)=>l&1&&s==r)||n.push(this.data[i],r)}}return n}configure(e){let n=Object.assign(Object.create(tp.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=i}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(i=>{let r=e.tokenizers.find(s=>s.from==i);return r?r.to:i})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((i,r)=>{let s=e.specializers.find(c=>c.from==i.external);if(!s)return i;let l=Object.assign(Object.assign({},i),{external:s.to});return n.specializers[r]=K5(l),l})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),i=n.map(()=>!1);if(e)for(let s of e.split(" ")){let l=n.indexOf(s);l>=0&&(i[l]=!0)}let r=null;for(let s=0;s<n.length;s++)if(!i[s])for(let l=this.dialects[n[s]],c;(c=this.data[l++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[c]=1;return new Hre(e,i,r)}static deserialize(e){return new tp(e)}}function Xr(t,e){return t[e]|t[e+1]<<16}function Vre(t){let e=null;for(let n of t){let i=n.p.stoppedAt;(n.pos==n.p.stream.end||i!=null&&n.pos>i)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function K5(t){if(t.external){let e=t.extend?1:0;return(n,i)=>t.external(n,i)<<1|e}return t.get}const Jl=63,Z5=64,Fre=1,$re=2,CB=3,Gre=4,kB=5,Yre=6,Qre=7,AB=65,Xre=66,Wre=8,Kre=9,Zre=10,Jre=11,ese=12,_B=13,tse=19,nse=20,ise=29,rse=33,sse=34,ase=47,lse=0,wC=1,IS=2,Du=3,PS=4;class Da{constructor(e,n,i){this.parent=e,this.depth=n,this.type=i,this.hash=(e?e.hash+e.hash<<8:0)+n+(n<<4)+i}}Da.top=new Da(null,-1,lse);function ru(t,e){for(let n=0,i=e-t.pos-1;;i--,n++){let r=t.peek(i);if(ss(r)||r==-1)return n}}function HS(t){return t==32||t==9}function ss(t){return t==10||t==13}function OB(t){return HS(t)||ss(t)}function Ha(t){return t<0||OB(t)}const ose=new Ure({start:Da.top,reduce(t,e){return t.type==Du&&(e==nse||e==sse)?t.parent:t},shift(t,e,n,i){if(e==CB)return new Da(t,ru(i,i.pos),wC);if(e==AB||e==kB)return new Da(t,ru(i,i.pos),IS);if(e==Jl)return t.parent;if(e==tse||e==rse)return new Da(t,0,Du);if(e==_B&&t.type==PS)return t.parent;if(e==ase){let r=/[1-9]/.exec(i.read(i.pos,n.pos));if(r)return new Da(t,t.depth+ +r[0],PS)}return t},hash(t){return t.hash}});function No(t,e,n=0){return t.peek(n)==e&&t.peek(n+1)==e&&t.peek(n+2)==e&&Ha(t.peek(n+3))}const cse=new $p((t,e)=>{if(t.next==-1&&e.canShift(Z5))return t.acceptToken(Z5);let n=t.peek(-1);if((ss(n)||n<0)&&e.context.type!=Du){if(No(t,45))if(e.canShift(Jl))t.acceptToken(Jl);else return t.acceptToken(Fre,3);if(No(t,46))if(e.canShift(Jl))t.acceptToken(Jl);else return t.acceptToken($re,3);let i=0;for(;t.next==32;)i++,t.advance();(i<e.context.depth||i==e.context.depth&&e.context.type==wC&&(t.next!=45||!Ha(t.peek(1))))&&t.next!=-1&&!ss(t.next)&&t.next!=35&&t.acceptToken(Jl,-i)}},{contextual:!0}),use=new $p((t,e)=>{if(e.context.type==Du){t.next==63&&(t.advance(),Ha(t.next)&&t.acceptToken(Qre));return}if(t.next==45)t.advance(),Ha(t.next)&&t.acceptToken(e.context.type==wC&&e.context.depth==ru(t,t.pos-1)?Gre:CB);else if(t.next==63)t.advance(),Ha(t.next)&&t.acceptToken(e.context.type==IS&&e.context.depth==ru(t,t.pos-1)?Yre:kB);else{let n=t.pos;for(;;)if(HS(t.next)){if(t.pos==n)return;t.advance()}else if(t.next==33)EB(t);else if(t.next==38)US(t);else if(t.next==42){US(t);break}else if(t.next==39||t.next==34){if(SC(t,!0))break;return}else if(t.next==91||t.next==123){if(!hse(t))return;break}else{TB(t,!0,!1,0);break}for(;HS(t.next);)t.advance();if(t.next==58){if(t.pos==n&&e.canShift(ise))return;let i=t.peek(1);Ha(i)&&t.acceptTokenTo(e.context.type==IS&&e.context.depth==ru(t,n)?Xre:AB,n)}}},{contextual:!0});function fse(t){return t>32&&t<127&&t!=34&&t!=37&&t!=44&&t!=60&&t!=62&&t!=92&&t!=94&&t!=96&&t!=123&&t!=124&&t!=125}function J5(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function e4(t,e){return t.next==37?(t.advance(),J5(t.next)&&t.advance(),J5(t.next)&&t.advance(),!0):fse(t.next)||e&&t.next==44?(t.advance(),!0):!1}function EB(t){if(t.advance(),t.next==60){for(t.advance();;)if(!e4(t,!0)){t.next==62&&t.advance();break}}else for(;e4(t,!1););}function US(t){for(t.advance();!Ha(t.next)&&np(t.next)!="f";)t.advance()}function SC(t,e){let n=t.next,i=!1,r=t.pos;for(t.advance();;){let s=t.next;if(s<0)break;if(t.advance(),s==n)if(s==39)if(t.next==39)t.advance();else break;else break;else if(s==92&&n==34)t.next>=0&&t.advance();else if(ss(s)){if(e)return!1;i=!0}else if(e&&t.pos>=r+1024)return!1}return!i}function hse(t){for(let e=[],n=t.pos+1024;;)if(t.next==91||t.next==123)e.push(t.next),t.advance();else if(t.next==39||t.next==34){if(!SC(t,!0))return!1}else if(t.next==93||t.next==125){if(e[e.length-1]!=t.next-2)return!1;if(e.pop(),t.advance(),!e.length)return!0}else{if(t.next<0||t.pos>n||ss(t.next))return!1;t.advance()}}const dse="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function np(t){return t<33?"u":t>125?"s":dse[t-33]}function xw(t,e){let n=np(t);return n!="u"&&!(e&&n=="f")}function TB(t,e,n,i){if(np(t.next)=="s"||(t.next==63||t.next==58||t.next==45)&&xw(t.peek(1),n))t.advance();else return!1;let r=t.pos;for(;;){let s=t.next,l=0,c=i+1;for(;OB(s);){if(ss(s)){if(e)return!1;c=0}else c++;s=t.peek(++l)}if(!(s>=0&&(s==58?xw(t.peek(l+1),n):s==35?t.peek(l-1)!=32:xw(s,n)))||!n&&c<=i||c==0&&!n&&(No(t,45,l)||No(t,46,l)))break;if(e&&np(s)=="f")return!1;for(let h=l;h>=0;h--)t.advance();if(e&&t.pos>r+1024)return!1}return!0}const pse=new $p((t,e)=>{if(t.next==33)EB(t),t.acceptToken(ese);else if(t.next==38||t.next==42){let n=t.next==38?Zre:Jre;US(t),t.acceptToken(n)}else t.next==39||t.next==34?(SC(t,!1),t.acceptToken(Kre)):TB(t,!1,e.context.type==Du,e.context.depth)&&t.acceptToken(Wre)}),mse=new $p((t,e)=>{let n=e.context.type==PS?e.context.depth:-1,i=t.pos;e:for(;;){let r=0,s=t.next;for(;s==32;)s=t.peek(++r);if(!r&&(No(t,45,r)||No(t,46,r))||!ss(s)&&(n<0&&(n=Math.max(e.context.depth+1,r)),r<n))break;for(;;){if(t.next<0)break e;let l=ss(t.next);if(t.advance(),l)continue e;i=t.pos}}t.acceptTokenTo(_B,i)}),gse=tq({DirectiveName:le.keyword,DirectiveContent:le.attributeValue,"DirectiveEnd DocEnd":le.meta,QuotedLiteral:le.string,BlockLiteralHeader:le.special(le.string),BlockLiteralContent:le.content,Literal:le.content,"Key/Literal Key/QuotedLiteral":le.definition(le.propertyName),"Anchor Alias":le.labelName,Tag:le.typeName,Comment:le.lineComment,": , -":le.separator,"?":le.punctuation,"[ ]":le.squareBracket,"{ }":le.brace}),yse=tp.deserialize({version:14,states:"5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*PQdO'#CrO*nQdO'#CtOOQO'#Dw'#DwO+]Q`O'#CxO+hQdO'#CwO+rQ`O'#CwOOQO'#Cv'#CvO+wQdO'#CvOOQO'#Cq'#CqO,UQ`O,59[O,^QfO,59[OOQR,59[,59[OOQO'#Cx'#CxO,eQ`O'#DPO,pQdO'#DPOOQO'#Dx'#DxO,zQdO'#DxO-XQ`O,59jO-aQfO,59jOOQR,59j,59jOOQR'#DS'#DSO-hQcO,59mO-sQgO'#DVO.TQ`O'#DVO.YQcO,59pOOQR'#DX'#DXO#|QfO'#DWO.hQcO'#DWOOQR,59v,59vO.yOWO,59vO/OOaO,59vO/WOaO,59vO/cQgO'#D_OOQR,59x,59xO0VQgO'#DaOOQR,59z,59zOOQP,59|,59|O0yOaO,59|O1ROaO,59|O1aOqO,59|OOQP-E7h-E7hO1oQgO,59XOOQP,59X,59XO2PQaO'#DeO2_QgO'#DeO2oQgO'#DkOOQP'#Dk'#DkQ)jQaOOO3PQdO'#CsOOQO,59^,59^O3kQdO'#CuOOQO,59`,59`OOQO,59c,59cO4VQdO,59cO4aQdO'#CzO4kQ`O'#CzOOQO,59b,59bOOQU,5:Q,5:QOOQR1G.v1G.vO4pQ`O1G.vOOQU-E7d-E7dO4xQdO,59kOOQO,59k,59kO5SQdO'#DQO5^Q`O'#DQOOQO,5:d,5:dOOQU,5:R,5:ROOQR1G/U1G/UO5cQ`O1G/UOOQU-E7e-E7eO5kQgO'#DhO5xQcO1G/XOOQR1G/X1G/XOOQR,59q,59qO6TQgO,59qO6eQdO'#DiO6lQgO'#DiO7PQcO1G/[OOQR1G/[1G/[OOQR,59r,59rO#|QfO,59rOOQR1G/b1G/bO7_OWO1G/bO7dOaO1G/bOOQR,59y,59yOOQR,59{,59{OOQP1G/h1G/hO7lOaO1G/hO7tOaO1G/hO8POaO1G/hOOQP1G.s1G.sO8_QgO,5:POOQP,5:P,5:POOQP,5:V,5:VOOQP-E7i-E7iOOQO,59_,59_OOQO,59a,59aOOQO1G.}1G.}OOQO,59f,59fO8oQdO,59fOOQR7+$b7+$bP,XQ`O'#DfOOQO1G/V1G/VOOQO,59l,59lO8yQdO,59lOOQR7+$p7+$pP9TQ`O'#DgOOQR'#DT'#DTOOQR,5:S,5:SOOQR-E7f-E7fOOQR7+$s7+$sOOQR1G/]1G/]O9YQgO'#DYO9jQ`O'#DYOOQR,5:T,5:TO#|QfO'#DZO9oQcO'#DZOOQR-E7g-E7gOOQR7+$v7+$vOOQR1G/^1G/^OOQR7+$|7+$|O:QOWO7+$|OOQP7+%S7+%SO:VOaO7+%SO:_OaO7+%SOOQP1G/k1G/kOOQO1G/Q1G/QOOQO1G/W1G/WOOQR,59t,59tO:jQgO,59tOOQR,59u,59uO#|QfO,59uOOQR<<Hh<<HhOOQP<<Hn<<HnO:zOaO<<HnOOQR1G/`1G/`OOQR1G/a1G/aOOQPAN>YAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:ose,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[gse],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[cse,use,pse,mse,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),vse=Id.define({name:"yaml",parser:yse.configure({props:[sq.add({Stream:t=>{for(let e=t.node.resolve(t.pos,-1);e&&e.to>=t.pos;e=e.parent){if(e.name=="BlockLiteralContent"&&e.from<e.to)return t.baseIndentFor(e);if(e.name=="BlockLiteral")return t.baseIndentFor(e)+t.unit;if(e.name=="BlockSequence"||e.name=="BlockMapping")return t.column(e.from,1);if(e.name=="QuotedLiteral")return null;if(e.name=="Literal"){let n=t.column(e.from,1);if(n==t.lineIndent(e.from,1))return n;if(e.to>t.pos)return null}}return null},FlowMapping:l5({closing:"}"}),FlowSequence:l5({closing:"]"})}),oq.add({"FlowMapping FlowSequence":Kee,"Item Pair BlockLiteral":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function bse(){return new Pee(vse)}const xse=()=>{const{error:t,isCliMode:e,yamlInput:n,setYamlInput:i,parseAndSetSchema:r,savingStatus:s,lastUpdateSource:l,theme:c,currentModelSlug:u}=en(),[h,d]=Y.useState(n),m=Y.useRef(null),g=Y.useRef(null),v=Y.useRef(!0);Y.useEffect(()=>{if(!g.current?.view)return;const k=g.current.view,A=k.state.doc.toString();k.dispatch({changes:{from:0,to:A.length,insert:n},annotations:Vt.addToHistory.of(!1)}),d(n)},[u]),Y.useEffect(()=>{if(!g.current?.view)return;const k=g.current.view,A=k.state.doc.toString();if(v.current&&n){k.dispatch({changes:{from:0,to:A.length,insert:n},annotations:Vt.addToHistory.of(!1)}),d(n),v.current=!1;return}l!=="user"&&A!==n&&(k.dispatch({changes:{from:0,to:A.length,insert:n},userEvent:"remote-edit"}),d(n))},[n,l]);const x=Y.useCallback(k=>{d(k),!(!k||k.trim()==="")&&(m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{i(k),r(k)},300))},[i,r]),w=()=>{g.current?.view&&uC(g.current.view)},C=()=>{g.current?.view&&Fd(g.current.view)};return S.jsxs("div",{className:"flex-1 flex flex-col gap-3 overflow-hidden p-4 pt-2 h-full sidebar-content",children:[S.jsxs("div",{className:"flex items-center justify-between px-1",children:[e?S.jsxs("div",{className:"flex items-center gap-4",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-blue-500 animate-pulse"}),S.jsx("span",{className:`text-[10px] font-bold uppercase tracking-widest ${c==="dark"?"text-slate-500":"text-slate-400"}`,children:"Auto-sync active"})]}),S.jsxs("div",{className:"flex items-center gap-1.5 min-w-[60px]",children:[s==="saving"&&S.jsxs("div",{className:"flex items-center gap-1 text-slate-400 animate-pulse",children:[S.jsx(EW,{size:10,className:"animate-spin"}),S.jsx("span",{className:"text-[9px] font-bold uppercase",children:"Saving"})]}),s==="saved"&&S.jsxs("div",{className:"flex items-center gap-1 text-emerald-500",children:[S.jsx(cW,{size:10}),S.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider",children:"Saved"})]}),s==="error"&&S.jsxs("div",{className:"flex items-center gap-1 text-red-500",children:[S.jsx(td,{size:10}),S.jsx("span",{className:"text-[9px] font-bold uppercase",children:"Error"})]})]})]}):S.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 bg-blue-500/10 border border-blue-500/30 rounded-md",children:[S.jsx(td,{size:12,className:"text-blue-400"}),S.jsx("span",{className:"text-[10px] text-blue-300 font-medium uppercase tracking-tight",children:"Sandbox Mode"})]}),S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsxs("div",{className:`flex rounded-lg p-0.5 border ${c==="dark"?"bg-slate-800/50 border-slate-700/50":"bg-slate-100 border-slate-200"}`,children:[S.jsx("button",{onClick:w,className:`p-1.5 rounded-md transition-all active:scale-95 ${c==="dark"?"text-slate-400 hover:bg-slate-700 hover:text-slate-100":"text-slate-500 hover:bg-white hover:text-blue-600 hover:shadow-sm"}`,title:"Undo (Ctrl+Z)",children:S.jsx(JW,{size:14})}),S.jsx("div",{className:`w-px h-4 self-center mx-0.5 ${c==="dark"?"bg-slate-700/50":"bg-slate-200"}`}),S.jsx("button",{onClick:C,className:`p-1.5 rounded-md transition-all active:scale-95 ${c==="dark"?"text-slate-400 hover:bg-slate-700 hover:text-slate-100":"text-slate-500 hover:bg-white hover:text-blue-600 hover:shadow-sm"}`,title:"Redo (Ctrl+Y)",children:S.jsx(VW,{size:14})})]}),S.jsxs("div",{className:"flex items-center gap-1 text-slate-400 dark:text-slate-600 cursor-help",title:"Pro Tip: Use Ctrl+Z to undo visual changes!",children:[S.jsx(xW,{size:12}),S.jsx("span",{className:"text-[9px] font-bold uppercase tracking-tighter",children:"Undo Active"})]})]})]}),S.jsxs("div",{className:`relative flex-1 flex flex-col min-h-0 border rounded-md overflow-hidden transition-colors ${c==="dark"?"border-slate-700 bg-[#282c34]":"border-slate-200 bg-white"}`,children:[S.jsx(SB,{ref:g,value:h,height:"100%",theme:c==="dark"?wB:"light",extensions:[bse()],onChange:x,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},className:"flex-1 text-sm overflow-auto"}),t&&h===n&&S.jsxs("div",{className:"absolute bottom-4 left-4 right-4 p-3 bg-red-900/90 border border-red-500/50 rounded-md text-red-100 text-xs flex gap-2 items-start z-10 shadow-2xl backdrop-blur-sm animate-in fade-in slide-in-from-bottom-2",children:[S.jsx(td,{size:14,className:"shrink-0 mt-0.5 text-red-400"}),S.jsx("span",{children:t})]})]}),S.jsx("div",{className:"flex justify-between items-center pt-1 shrink-0",children:S.jsx("div",{className:"text-[10px] text-slate-500 italic",children:e?"Changes are automatically reflected and saved to file.":"Changes are reflected instantly but reset on reload."})})]})},wse=()=>{const{availableFiles:t,currentModelSlug:e,setCurrentModel:n,isSidebarOpen:i,theme:r}=en();if(!i||t.length<=0)return null;const s=e||t[0]?.slug;return S.jsxs("div",{className:"px-4 mb-4",children:[S.jsx("div",{className:"flex items-center justify-between mb-1.5 px-1",children:S.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-slate-500",children:"Current Model"})}),S.jsxs("div",{className:"relative group",children:[S.jsx("select",{value:s,onChange:l=>n(l.target.value),className:`w-full pl-9 pr-8 py-2 rounded-md text-sm appearance-none focus:outline-none focus:ring-1 focus:ring-blue-500/50 transition-all shadow-sm cursor-pointer ${r==="dark"?"bg-slate-800 border-slate-700 text-slate-100 hover:bg-slate-750":"bg-white border-slate-200 text-slate-900 hover:bg-slate-50 shadow-slate-200/50"}`,children:t.map(l=>S.jsx("option",{value:l.slug,className:r==="light"?"bg-white text-slate-900":"bg-slate-800 text-slate-100",children:l.name},l.slug))}),S.jsx(Ba,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-blue-500 pointer-events-none"}),S.jsx(qa,{size:14,className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none transition-colors ${r==="dark"?"text-slate-500 group-hover:text-slate-300":"text-slate-400 group-hover:text-slate-600"}`})]})]})},MB=""+new URL("../favicon.svg",import.meta.url).href,Sse=()=>{const{isSidebarOpen:t,setIsSidebarOpen:e,isPresentationMode:n,setIsPresentationMode:i,showER:r,setShowER:s,showLineage:l,setShowLineage:c,showAnnotations:u,setShowAnnotations:h,addTable:d,addDomain:m,addAnnotation:g,calculateAutoLayout:v,theme:x,toggleTheme:w,getSelectedTable:C,getSelectedDomain:k}=en(),{screenToFlowPosition:A}=Bu(),[O,E]=Y.useState(!1),M=C(),T=k(),N=()=>{const V=A({x:window.innerWidth/2,y:window.innerHeight/2});m(V.x-300,V.y-200)},I=()=>{const V=A({x:window.innerWidth/2,y:window.innerHeight/2});d(V.x-160,V.y-125)},q=()=>{const V=M||T,D=A({x:window.innerWidth/2,y:window.innerHeight/2});u||h(!0),V?g({x:50,y:-50},V.id,M?"table":"domain"):g({x:D.x-60,y:D.y-40})},H=(V,D="text-blue-500")=>`
|
|
52
52
|
flex items-center justify-center w-10 h-10 rounded-xl transition-all relative group
|
|
53
53
|
${V?`bg-blue-600/10 ${D} shadow-inner`:x==="dark"?"text-slate-500 hover:text-slate-300 hover:bg-slate-800/30":"text-slate-400 hover:text-slate-600 hover:bg-slate-100"}
|
|
54
|
-
`,B=({text:V})=>S.jsxs("div",{className:"absolute left-14 px-2 py-1 bg-slate-800 text-white text-[10px] font-bold rounded opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity whitespace-nowrap z-[60] border border-slate-700 shadow-xl",children:[V,S.jsx("div",{className:"absolute top-1/2 -left-1 -translate-y-1/2 border-4 border-transparent border-r-slate-800"})]}),$=({keys:V,label:D})=>S.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-slate-100 dark:border-slate-800 last:border-0",children:[S.jsx("span",{className:"text-xs font-medium text-slate-500",children:D}),S.jsx("div",{className:"flex gap-1",children:V.map(P=>S.jsx("kbd",{className:"px-1.5 py-0.5 bg-slate-100 dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded text-[10px] font-bold font-mono text-slate-600 dark:text-slate-300 min-w-[20px] text-center shadow-sm",children:P},P))})]});return S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:`w-14 h-full flex flex-col items-center py-4 border-l transition-colors z-50 ${x==="dark"?"bg-slate-950 border-slate-800":"bg-slate-50 border-slate-200"}`,children:[S.jsx("button",{onClick:()=>e(!t),className:`mb-6 p-2 rounded-xl transition-all ${x==="dark"?"hover:bg-slate-800 text-slate-400 hover:text-white":"hover:bg-white hover:shadow-md text-slate-500 hover:text-slate-900"}`,children:t?S.jsx(Sz,{size:20}):S.jsx("img",{src:MB,alt:"Logo",className:"w-6 h-6 rounded-md shadow-lg"})}),S.jsxs("div",{className:"flex flex-col items-center mb-4 gap-2",children:[S.jsx("div",{className:"text-[8px] font-bold text-slate-500 uppercase tracking-tighter opacity-80 mb-1",children:"View"}),S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("button",{onClick:()=>s(!r),className:H(r,"text-emerald-500"),children:[S.jsx(BW,{size:20}),S.jsx(B,{text:r?"Hide ER":"Show ER"})]}),S.jsxs("button",{onClick:()=>c(!l),className:H(l,"text-blue-500"),children:[S.jsx(z2,{size:20}),S.jsx(B,{text:l?"Hide Lineage":"Show Lineage"})]}),S.jsxs("button",{onClick:()=>h(!u),className:H(u,"text-amber-500"),children:[S.jsx(ko,{size:20}),S.jsx(B,{text:u?"Hide Annotations":"Show Annotations"})]})]})]}),S.jsx("div",{className:`w-8 border-t mb-4 ${x==="dark"?"border-slate-800":"border-slate-200"}`}),S.jsxs("div",{className:"flex flex-col items-center mb-4 gap-2",children:[S.jsx("div",{className:"text-[8px] font-bold text-slate-500 uppercase tracking-tighter opacity-80 mb-1",children:"Add"}),S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("button",{onClick:N,className:H(!1,"text-blue-400"),children:[S.jsx(Az,{size:20}),S.jsx(B,{text:"Add Domain (D)"})]}),S.jsxs("button",{onClick:I,className:H(!1,"text-emerald-400"),children:[S.jsx(gW,{size:20}),S.jsx(B,{text:"Add Table (T)"})]}),S.jsxs("button",{onClick:q,className:H(!1,"text-amber-400"),children:[S.jsxs("div",{className:"relative",children:[S.jsx(ko,{size:20}),S.jsx(Fw,{size:10,className:"absolute -bottom-1 -right-1 text-amber-500 font-bold stroke-[3px]"})]}),S.jsx(B,{text:"Add Sticky Note (S)"})]})]})]}),S.jsx("div",{className:`w-8 border-t mb-6 ${x==="dark"?"border-slate-800":"border-slate-200"}`}),S.jsxs("div",{className:"mt-auto flex flex-col gap-2",children:[S.jsxs("button",{onClick:()=>i(!0),className:H(n,"text-purple-500"),children:[S.jsx(PW,{size:20}),S.jsx(B,{text:"Presentation Mode"})]}),S.jsxs("button",{onClick:()=>v(),className:H(!1),children:[S.jsx(SW,{size:20}),S.jsx(B,{text:"Auto Layout"})]}),S.jsxs("button",{onClick:()=>E(!0),className:H(O),children:[S.jsx(Cz,{size:20}),S.jsx(B,{text:"Shortcut Guide"})]}),S.jsxs("button",{onClick:w,className:H(!1),children:[x==="dark"?S.jsx(QW,{size:20}):S.jsx(zW,{size:20}),S.jsx(B,{text:x==="dark"?"Light Mode":"Dark Mode"})]})]})]}),O&&S.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center p-4 animate-in fade-in duration-200",children:[S.jsx("div",{className:"absolute inset-0 bg-slate-950/40 backdrop-blur-sm",onClick:()=>E(!1)}),S.jsxs("div",{className:`relative w-full max-w-sm shadow-2xl rounded-2xl border p-6 animate-in zoom-in-95 duration-200 ${x==="dark"?"bg-slate-900 border-slate-700":"bg-white border-slate-200"}`,children:[S.jsxs("div",{className:"flex items-center justify-between mb-6",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg",children:S.jsx(hW,{size:18,className:"text-blue-500"})}),S.jsx("h2",{className:"font-bold text-base",children:"Shortcut Guide"})]}),S.jsx("button",{onClick:()=>E(!1),className:"p-1 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-full transition-colors text-slate-400",children:S.jsx(Vu,{size:20})})]}),S.jsxs("div",{className:"space-y-6",children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 mb-3",children:"Quick Create"}),S.jsx($,{label:"New Table",keys:["T"]}),S.jsx($,{label:"New Domain",keys:["D"]}),S.jsx($,{label:"New Sticky Note",keys:["S"]})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 mb-3",children:"Canvas Control"}),S.jsx($,{label:"Pan / Scroll",keys:["↑","↓","←","→"]}),S.jsx($,{label:"Clear Selection",keys:["Esc"]}),S.jsx($,{label:"Delete Selected",keys:["Del","⌫"]})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 mb-3",children:"Navigation"}),S.jsx($,{label:"Find Entities",keys:["/"]}),S.jsx($,{label:"Exit Fullscreen",keys:["Esc"]})]})]}),S.jsx("div",{className:"mt-8 pt-4 border-t border-slate-100 dark:border-slate-800 flex justify-center",children:S.jsx("p",{className:"text-[10px] text-slate-400 italic",children:"Pro-tip: Focus the canvas to use shortcuts."})})]})]})]})},Cse=()=>{const{isSidebarOpen:t,isCliMode:e,theme:n,savingStatus:i}=en();return S.jsxs("div",{className:`relative h-full flex flex-row border-r transition-all duration-300 ease-in-out shadow-2xl z-50 ${t?"w-[456px]":"w-14"} ${n==="dark"?"bg-slate-900 border-slate-800":"bg-white border-slate-200"}`,children:[S.jsxs("div",{className:`flex-1 flex flex-col min-w-0 overflow-hidden transition-all duration-300 sidebar-content ${n==="dark"?"bg-slate-900":"bg-white"} ${t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}`,style:{width:t?"400px":"0px"},children:[S.jsxs("div",{className:`p-4 border-b flex items-center justify-between ${n==="dark"?"border-slate-800":"border-slate-100"}`,children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("img",{src:MB,alt:"Modscape Logo",className:"w-5 h-5 rounded-md"}),S.jsx("h1",{className:`text-base font-bold tracking-tight ${n==="dark"?"text-white":"text-slate-900"}`,children:"Modscape"}),e&&S.jsx("span",{className:"px-1.5 py-0.5 bg-emerald-500/10 border border-emerald-500/30 text-emerald-500 text-[10px] font-bold rounded uppercase ml-1 animate-pulse",title:"Connected & Syncing",children:"Live"})]}),i==="saving"&&S.jsx("span",{className:"text-[10px] text-slate-500 animate-pulse uppercase font-bold tracking-widest",children:"Saving..."})]}),S.jsx("div",{className:"mt-4",children:S.jsx(wse,{})}),S.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden mt-4",children:[S.jsx("div",{className:"px-4 py-2",children:S.jsx("h3",{className:"text-[10px] font-bold uppercase tracking-widest text-slate-500",children:"YAML Editor"})}),S.jsx(xse,{})]}),S.jsx("div",{className:`p-3 border-t flex items-center justify-between ${n==="dark"?"border-slate-800 bg-slate-950/20":"border-slate-100 bg-slate-50/50"}`,children:S.jsx("p",{className:"text-[10px] text-slate-500 font-medium px-1",children:"Modscape v1.1.5"})})]}),S.jsx(Sse,{})]})},kse=()=>{const{schema:t,theme:e,setSelectedTableId:n,setFocusNodeId:i}=en(),[r,s]=Y.useState(""),[l,c]=Y.useState(new Set),u=m=>{const g=new Set(l);g.has(m)?g.delete(m):g.add(m),c(g)},h=m=>{n(m),i(m)},d=Y.useMemo(()=>{if(!t)return{domains:[],unassigned:[]};const m={},g=new Set;t.domains?.forEach(w=>{m[w.id]=[]}),t.tables.forEach(w=>{const C=t.domains?.find(A=>A.tables.includes(w.id));(w.name.toLowerCase().includes(r.toLowerCase())||w.id.toLowerCase().includes(r.toLowerCase()))&&C&&(m[C.id].push(w),g.add(w.id))});const v=(t.domains||[]).filter(w=>{const C=m[w.id].length>0,k=w.name.toLowerCase().includes(r.toLowerCase())||w.id.toLowerCase().includes(r.toLowerCase());return C||k&&r!==""}).map(w=>({...w,tables:m[w.id]})),x=t.tables.filter(w=>(w.name.toLowerCase().includes(r.toLowerCase())||w.id.toLowerCase().includes(r.toLowerCase()))&&!g.has(w.id)&&!t.domains?.some(k=>k.tables.includes(w.id)));return{domains:v,unassigned:x}},[t,r]);return S.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-4",children:[S.jsxs("div",{className:"relative mb-4 shrink-0",children:[S.jsx(q2,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),S.jsx("input",{type:"text",value:r,onChange:m=>s(m.target.value),placeholder:"Search tables...",className:`w-full pl-9 pr-4 py-2 rounded-md text-sm transition-all shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500/50 ${e==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-200 text-slate-900 shadow-slate-200/50"}`})]}),S.jsxs("div",{className:"flex-1 space-y-4 overflow-auto pr-1",children:[d.domains.map(m=>{const g=l.has(m.id);return S.jsxs("section",{className:"flex flex-col",children:[S.jsxs("div",{className:`flex items-center justify-between group px-1 py-1.5 cursor-pointer rounded transition-colors ${e==="dark"?"hover:bg-slate-800/30":"hover:bg-slate-100"}`,onClick:()=>u(m.id),children:[S.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[g?S.jsx(Vw,{size:12,className:"text-slate-500"}):S.jsx(qa,{size:12,className:"text-slate-500"}),S.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:m.color||"#3b82f6"}}),S.jsx("h3",{className:`text-[10px] font-bold uppercase tracking-wider truncate ${e==="dark"?"text-slate-300":"text-slate-600"}`,children:m.name}),S.jsx("span",{className:`text-[9px] font-medium px-1.5 py-0.5 rounded-full ${e==="dark"?"text-slate-600 bg-slate-800/50":"text-slate-400 bg-slate-100"}`,children:m.tables.length})]}),S.jsx("button",{onClick:v=>{v.stopPropagation(),h(m.id)},className:"opacity-0 group-hover:opacity-100 p-1 hover:text-blue-500 text-slate-500 transition-all",children:S.jsx(ed,{size:12})})]}),!g&&S.jsxs("div",{className:`ml-4 mt-1 space-y-0.5 border-l pl-2 ${e==="dark"?"border-slate-800":"border-slate-100"}`,children:[m.tables.map(v=>S.jsxs("button",{onClick:()=>h(v.id),className:`w-full flex items-center justify-between group p-1.5 text-xs rounded border border-transparent transition-all text-left ${e==="dark"?"hover:bg-slate-800/50 text-slate-400 hover:text-slate-200":"hover:bg-blue-50 text-slate-500 hover:text-blue-600"}`,children:[S.jsx("span",{className:"truncate",children:v.name}),S.jsx(ed,{size:10,className:"opacity-0 group-hover:opacity-100"})]},v.id)),m.tables.length===0&&S.jsx("div",{className:"p-2 text-[10px] text-slate-500 italic",children:"No tables"})]})]},m.id)}),d.unassigned.length>0&&S.jsxs("section",{className:"flex flex-col",children:[S.jsx("div",{className:`flex items-center justify-between group px-1 py-1.5 cursor-pointer rounded transition-colors ${e==="dark"?"hover:bg-slate-800/30":"hover:bg-slate-100"}`,onClick:()=>u("unassigned"),children:S.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[l.has("unassigned")?S.jsx(Vw,{size:12,className:"text-slate-500"}):S.jsx(qa,{size:12,className:"text-slate-500"}),S.jsx(Cz,{size:12,className:"text-slate-500 shrink-0"}),S.jsx("h3",{className:`text-[10px] font-bold uppercase tracking-wider truncate ${e==="dark"?"text-slate-500":"text-slate-400"}`,children:"Unassigned"}),S.jsx("span",{className:`text-[9px] font-medium px-1.5 py-0.5 rounded-full ${e==="dark"?"text-slate-600 bg-slate-800/50":"text-slate-400 bg-slate-100"}`,children:d.unassigned.length})]})}),!l.has("unassigned")&&S.jsx("div",{className:`ml-4 mt-1 space-y-0.5 border-l pl-2 ${e==="dark"?"border-slate-800":"border-slate-100"}`,children:d.unassigned.map(m=>S.jsxs("button",{onClick:()=>h(m.id),className:`w-full flex items-center justify-between group p-1.5 text-xs rounded border border-transparent transition-all text-left ${e==="dark"?"hover:bg-slate-800/50 text-slate-400 hover:text-slate-200":"hover:bg-blue-50 text-slate-500 hover:text-blue-600"}`,children:[S.jsx("span",{className:"truncate",children:m.name}),S.jsx(ed,{size:10,className:"opacity-0 group-hover:opacity-100"})]},m.id))})]})]})]})},Ase=t=>{const e={},n=(i,r,s,l,c)=>{e[i]||(e[i]=[]),e[i].push({from:i,to:r,type:s,id:l,metadata:c}),e[r]||(e[r]=[]),e[r].push({from:r,to:i,type:s,id:l,metadata:c})};return t.relationships?.forEach((i,r)=>{n(i.from.table,i.to.table,"er",`e-${r}`,i)}),t.tables.forEach(i=>{i.lineage?.upstream&&i.lineage.upstream.forEach((r,s)=>{n(r,i.id,"lineage",`lin-${r}-${i.id}-${s}`,{direction:"upstream"})})}),e},_se=(t,e,n)=>{if(e===n)return[];const i=Ase(t),r=[e],s=new Set([e]),l={};for(;r.length>0;){const c=r.shift();if(c===n){const h=[];let d=n;for(;d!==e;){const m=l[d];h.unshift(m),d=m.from}return h}const u=i[c]||[];for(const h of u)s.has(h.to)||(s.add(h.to),l[h.to]={from:c,to:h.to,edge:h},r.push(h.to))}return null},Ose=()=>{const{schema:t,theme:e,setPathFinderResult:n,setFocusNodeId:i}=en(),[r,s]=Y.useState(""),[l,c]=Y.useState(""),[u,h]=Y.useState(null),[d,m]=Y.useState(!1),g=Y.useMemo(()=>t?.tables||[],[t]),v=()=>{if(!t||!r||!l)return;const w=_se(t,r,l);if(h(w),m(!0),w){const C=Array.from(new Set([r,...w.map(A=>A.to)])),k=w.map(A=>A.edge.id);n({nodeIds:C,edgeIds:k})}else n(null)},x=()=>{h(null),m(!1),n(null)};return S.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-4",children:[S.jsxs("div",{className:"space-y-4 mb-6",children:[S.jsxs("div",{children:[S.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-widest block mb-1.5",children:"From Table"}),S.jsxs("select",{value:r,onChange:w=>s(w.target.value),className:`w-full p-2 rounded-md text-sm border shadow-sm focus:ring-1 focus:ring-blue-500/50 outline-none ${e==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-200 text-slate-900"}`,children:[S.jsx("option",{value:"",children:"Select source..."}),g.map(w=>S.jsx("option",{value:w.id,children:w.name},w.id))]})]}),S.jsxs("div",{children:[S.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-widest block mb-1.5",children:"To Table"}),S.jsxs("select",{value:l,onChange:w=>c(w.target.value),className:`w-full p-2 rounded-md text-sm border shadow-sm focus:ring-1 focus:ring-blue-500/50 outline-none ${e==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-200 text-slate-900"}`,children:[S.jsx("option",{value:"",children:"Select target..."}),g.map(w=>S.jsx("option",{value:w.id,children:w.name},w.id))]})]}),S.jsxs("div",{className:"flex gap-2 pt-2",children:[S.jsxs("button",{onClick:v,disabled:!r||!l,className:`flex-1 flex items-center justify-center gap-2 py-2 rounded-md text-xs font-bold transition-all ${!r||!l?"bg-slate-100 text-slate-400 cursor-not-allowed":"bg-blue-600 text-white hover:bg-blue-500 shadow-lg shadow-blue-500/20 active:scale-95"}`,children:[S.jsx(q2,{size:14}),"FIND PATH"]}),d&&S.jsx("button",{onClick:x,className:`p-2 rounded-md border transition-all hover:bg-slate-100 dark:hover:bg-slate-800 ${e==="dark"?"border-slate-700 text-slate-400":"border-slate-200 text-slate-500"}`,title:"Clear search results",children:S.jsx(Vu,{size:14})})]})]}),S.jsxs("div",{className:"flex-1 overflow-auto pr-1",children:[d&&!u&&S.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[S.jsx(td,{size:32,className:"text-slate-300 mb-2"}),S.jsx("p",{className:"text-sm text-slate-500 italic",children:"No path found between these tables."})]}),u&&S.jsxs("div",{className:"space-y-1",children:[S.jsx("div",{className:`p-3 rounded-lg border border-l-4 border-l-blue-500 mb-4 ${e==="dark"?"bg-slate-800/30 border-slate-700":"bg-blue-50/50 border-blue-100"}`,children:S.jsxs("p",{className:"text-xs font-medium text-slate-500",children:["Path found with ",S.jsx("span",{className:"font-bold text-blue-500",children:u.length})," steps"]})}),S.jsxs("div",{className:"relative pl-4 space-y-0",children:[S.jsx("div",{className:"absolute left-1 top-2 bottom-2 w-0.5 bg-slate-200 dark:bg-slate-800"}),S.jsxs("div",{className:"relative mb-4",children:[S.jsx("div",{className:"absolute -left-[15px] top-1 w-2.5 h-2.5 rounded-full bg-blue-500 border-2 border-white dark:border-slate-900"}),S.jsx("button",{onClick:()=>i(r),className:"text-xs font-bold hover:text-blue-500 transition-colors",children:g.find(w=>w.id===r)?.name})]}),u.map((w,C)=>S.jsxs("div",{className:"mb-4",children:[S.jsxs("div",{className:`flex items-center gap-2 my-2 py-1 px-2 rounded border w-fit transition-colors ${e==="dark"?"bg-slate-800/50 border-slate-700 text-slate-400":w.edge.type==="er"?"bg-emerald-50 border-emerald-100 text-emerald-700":"bg-blue-50 border-blue-100 text-blue-700"}`,children:[w.edge.type==="er"?S.jsx(Ba,{size:10,className:e==="dark"?"text-emerald-500":"text-emerald-600"}):S.jsx(z2,{size:10,className:e==="dark"?"text-blue-400":"text-blue-600"}),S.jsx("span",{className:"text-[9px] font-bold uppercase tracking-tighter",children:w.edge.type==="er"?`ER (${w.edge.metadata.type})`:"Lineage"})]}),S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"absolute -left-[15px] top-1 w-2.5 h-2.5 rounded-full bg-slate-400 border-2 border-white dark:border-slate-900"}),S.jsx("button",{onClick:()=>i(w.to),className:"text-xs font-bold hover:text-blue-500 transition-colors",children:g.find(k=>k.id===w.to)?.name})]})]},C))]})]})]})]})},Ese=()=>{const{schema:t,theme:e,setSelectedAnnotationId:n,setFocusNodeId:i}=en(),[r,s]=Y.useState(""),l=Y.useMemo(()=>t?.annotations?t.annotations.filter(u=>u.text.toLowerCase().includes(r.toLowerCase())):[],[t,r]),c=u=>{n(u),i(u)};return S.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-4",children:[S.jsxs("div",{className:"relative mb-4 shrink-0",children:[S.jsx(q2,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),S.jsx("input",{type:"text",value:r,onChange:u=>s(u.target.value),placeholder:"Search notes...",className:`w-full pl-9 pr-4 py-2 rounded-md text-sm transition-all shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500/50 ${e==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-200 text-slate-900 shadow-slate-200/50"}`})]}),S.jsxs("div",{className:"flex-1 space-y-2 overflow-auto pr-1",children:[l.length===0&&r&&S.jsxs("div",{className:"text-center py-10 text-slate-500 italic text-sm",children:['No notes matching "',r,'"']}),l.map(u=>S.jsxs("button",{onClick:()=>c(u.id),className:`w-full p-3 text-left rounded-lg border transition-all group relative ${e==="dark"?"bg-slate-800/40 border-slate-700 hover:border-blue-500/50 hover:bg-slate-800/60":"bg-white border-slate-200 hover:border-blue-300 hover:bg-blue-50/30 shadow-sm"}`,children:[S.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[S.jsx(ko,{size:12,className:u.type==="callout"?"text-blue-400":"text-amber-400"}),S.jsx("span",{className:"text-[10px] font-bold uppercase tracking-tighter text-slate-500",children:u.type==="callout"?"Callout":"Sticky Note"}),S.jsx(ed,{size:12,className:"ml-auto opacity-0 group-hover:opacity-100 transition-opacity text-blue-500"})]}),S.jsx("p",{className:`text-xs line-clamp-3 leading-relaxed ${e==="dark"?"text-slate-300":"text-slate-600"}`,children:u.text}),u.targetId&&S.jsxs("div",{className:"mt-2 flex items-center gap-1.5 opacity-60",children:[S.jsx("div",{className:"w-1 h-1 rounded-full bg-slate-400"}),S.jsxs("span",{className:"text-[9px] font-medium truncate italic",children:["Attached to ",u.targetId]})]})]},u.id)),!r&&l.length===0&&S.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center opacity-40",children:[S.jsx(kz,{size:48,className:"mb-4 text-slate-400"}),S.jsx("p",{className:"text-sm font-medium",children:"No annotations in this model yet."})]})]})]})},Tse=()=>{const{isRightPanelOpen:t,setIsRightPanelOpen:e,activeRightPanelTab:n,setActiveRightPanelTab:i,theme:r}=en(),s=c=>`
|
|
54
|
+
`,B=({text:V})=>S.jsxs("div",{className:"absolute left-14 px-2 py-1 bg-slate-800 text-white text-[10px] font-bold rounded opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity whitespace-nowrap z-[60] border border-slate-700 shadow-xl",children:[V,S.jsx("div",{className:"absolute top-1/2 -left-1 -translate-y-1/2 border-4 border-transparent border-r-slate-800"})]}),$=({keys:V,label:D})=>S.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-slate-100 dark:border-slate-800 last:border-0",children:[S.jsx("span",{className:"text-xs font-medium text-slate-500",children:D}),S.jsx("div",{className:"flex gap-1",children:V.map(P=>S.jsx("kbd",{className:"px-1.5 py-0.5 bg-slate-100 dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded text-[10px] font-bold font-mono text-slate-600 dark:text-slate-300 min-w-[20px] text-center shadow-sm",children:P},P))})]});return S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:`w-14 h-full flex flex-col items-center py-4 border-l transition-colors z-50 ${x==="dark"?"bg-slate-950 border-slate-800":"bg-slate-50 border-slate-200"}`,children:[S.jsx("button",{onClick:()=>e(!t),className:`mb-6 p-2 rounded-xl transition-all ${x==="dark"?"hover:bg-slate-800 text-slate-400 hover:text-white":"hover:bg-white hover:shadow-md text-slate-500 hover:text-slate-900"}`,children:t?S.jsx(Sz,{size:20}):S.jsx("img",{src:MB,alt:"Logo",className:"w-6 h-6 rounded-md shadow-lg"})}),S.jsxs("div",{className:"flex flex-col items-center mb-4 gap-2",children:[S.jsx("div",{className:"text-[8px] font-bold text-slate-500 uppercase tracking-tighter opacity-80 mb-1",children:"View"}),S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("button",{onClick:()=>s(!r),className:H(r,"text-emerald-500"),children:[S.jsx(BW,{size:20}),S.jsx(B,{text:r?"Hide ER":"Show ER"})]}),S.jsxs("button",{onClick:()=>c(!l),className:H(l,"text-blue-500"),children:[S.jsx(z2,{size:20}),S.jsx(B,{text:l?"Hide Lineage":"Show Lineage"})]}),S.jsxs("button",{onClick:()=>h(!u),className:H(u,"text-amber-500"),children:[S.jsx(ko,{size:20}),S.jsx(B,{text:u?"Hide Annotations":"Show Annotations"})]})]})]}),S.jsx("div",{className:`w-8 border-t mb-4 ${x==="dark"?"border-slate-800":"border-slate-200"}`}),S.jsxs("div",{className:"flex flex-col items-center mb-4 gap-2",children:[S.jsx("div",{className:"text-[8px] font-bold text-slate-500 uppercase tracking-tighter opacity-80 mb-1",children:"Add"}),S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("button",{onClick:N,className:H(!1,"text-blue-400"),children:[S.jsx(Az,{size:20}),S.jsx(B,{text:"Add Domain (D)"})]}),S.jsxs("button",{onClick:I,className:H(!1,"text-emerald-400"),children:[S.jsx(gW,{size:20}),S.jsx(B,{text:"Add Table (T)"})]}),S.jsxs("button",{onClick:q,className:H(!1,"text-amber-400"),children:[S.jsxs("div",{className:"relative",children:[S.jsx(ko,{size:20}),S.jsx(Fw,{size:10,className:"absolute -bottom-1 -right-1 text-amber-500 font-bold stroke-[3px]"})]}),S.jsx(B,{text:"Add Sticky Note (S)"})]})]})]}),S.jsx("div",{className:`w-8 border-t mb-6 ${x==="dark"?"border-slate-800":"border-slate-200"}`}),S.jsxs("div",{className:"mt-auto flex flex-col gap-2",children:[S.jsxs("button",{onClick:()=>i(!0),className:H(n,"text-purple-500"),children:[S.jsx(PW,{size:20}),S.jsx(B,{text:"Presentation Mode"})]}),S.jsxs("button",{onClick:()=>v(),className:H(!1),children:[S.jsx(SW,{size:20}),S.jsx(B,{text:"Auto Layout"})]}),S.jsxs("button",{onClick:()=>E(!0),className:H(O),children:[S.jsx(Cz,{size:20}),S.jsx(B,{text:"Shortcut Guide"})]}),S.jsxs("button",{onClick:w,className:H(!1),children:[x==="dark"?S.jsx(QW,{size:20}):S.jsx(zW,{size:20}),S.jsx(B,{text:x==="dark"?"Light Mode":"Dark Mode"})]})]})]}),O&&S.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center p-4 animate-in fade-in duration-200",children:[S.jsx("div",{className:"absolute inset-0 bg-slate-950/40 backdrop-blur-sm",onClick:()=>E(!1)}),S.jsxs("div",{className:`relative w-full max-w-sm shadow-2xl rounded-2xl border p-6 animate-in zoom-in-95 duration-200 ${x==="dark"?"bg-slate-900 border-slate-700":"bg-white border-slate-200"}`,children:[S.jsxs("div",{className:"flex items-center justify-between mb-6",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg",children:S.jsx(hW,{size:18,className:"text-blue-500"})}),S.jsx("h2",{className:"font-bold text-base",children:"Shortcut Guide"})]}),S.jsx("button",{onClick:()=>E(!1),className:"p-1 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-full transition-colors text-slate-400",children:S.jsx(Vu,{size:20})})]}),S.jsxs("div",{className:"space-y-6",children:[S.jsxs("section",{children:[S.jsx("h3",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 mb-3",children:"Quick Create"}),S.jsx($,{label:"New Table",keys:["T"]}),S.jsx($,{label:"New Domain",keys:["D"]}),S.jsx($,{label:"New Sticky Note",keys:["S"]})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 mb-3",children:"Canvas Control"}),S.jsx($,{label:"Pan / Scroll",keys:["↑","↓","←","→"]}),S.jsx($,{label:"Clear Selection",keys:["Esc"]}),S.jsx($,{label:"Delete Selected",keys:["Del","⌫"]})]}),S.jsxs("section",{children:[S.jsx("h3",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 mb-3",children:"Navigation"}),S.jsx($,{label:"Find Entities",keys:["/"]}),S.jsx($,{label:"Exit Fullscreen",keys:["Esc"]})]})]}),S.jsx("div",{className:"mt-8 pt-4 border-t border-slate-100 dark:border-slate-800 flex justify-center",children:S.jsx("p",{className:"text-[10px] text-slate-400 italic",children:"Pro-tip: Focus the canvas to use shortcuts."})})]})]})]})},Cse=()=>{const{isSidebarOpen:t,isCliMode:e,theme:n,savingStatus:i}=en();return S.jsxs("div",{className:`relative h-full flex flex-row border-r transition-all duration-300 ease-in-out shadow-2xl z-50 ${t?"w-[456px]":"w-14"} ${n==="dark"?"bg-slate-900 border-slate-800":"bg-white border-slate-200"}`,children:[S.jsxs("div",{className:`flex-1 flex flex-col min-w-0 overflow-hidden transition-all duration-300 sidebar-content ${n==="dark"?"bg-slate-900":"bg-white"} ${t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}`,style:{width:t?"400px":"0px"},children:[S.jsxs("div",{className:`p-4 border-b flex items-center justify-between ${n==="dark"?"border-slate-800":"border-slate-100"}`,children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("img",{src:MB,alt:"Modscape Logo",className:"w-5 h-5 rounded-md"}),S.jsx("h1",{className:`text-base font-bold tracking-tight ${n==="dark"?"text-white":"text-slate-900"}`,children:"Modscape"}),e&&S.jsx("span",{className:"px-1.5 py-0.5 bg-emerald-500/10 border border-emerald-500/30 text-emerald-500 text-[10px] font-bold rounded uppercase ml-1 animate-pulse",title:"Connected & Syncing",children:"Live"})]}),i==="saving"&&S.jsx("span",{className:"text-[10px] text-slate-500 animate-pulse uppercase font-bold tracking-widest",children:"Saving..."})]}),S.jsx("div",{className:"mt-4",children:S.jsx(wse,{})}),S.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden mt-4",children:[S.jsx("div",{className:"px-4 py-2",children:S.jsx("h3",{className:"text-[10px] font-bold uppercase tracking-widest text-slate-500",children:"YAML Editor"})}),S.jsx(xse,{})]}),S.jsx("div",{className:`p-3 border-t flex items-center justify-between ${n==="dark"?"border-slate-800 bg-slate-950/20":"border-slate-100 bg-slate-50/50"}`,children:S.jsx("p",{className:"text-[10px] text-slate-500 font-medium px-1",children:"Modscape v1.1.7"})})]}),S.jsx(Sse,{})]})},kse=()=>{const{schema:t,theme:e,setSelectedTableId:n,setFocusNodeId:i}=en(),[r,s]=Y.useState(""),[l,c]=Y.useState(new Set),u=m=>{const g=new Set(l);g.has(m)?g.delete(m):g.add(m),c(g)},h=m=>{n(m),i(m)},d=Y.useMemo(()=>{if(!t)return{domains:[],unassigned:[]};const m={},g=new Set;t.domains?.forEach(w=>{m[w.id]=[]}),t.tables.forEach(w=>{const C=t.domains?.find(A=>A.tables.includes(w.id));(w.name.toLowerCase().includes(r.toLowerCase())||w.id.toLowerCase().includes(r.toLowerCase()))&&C&&(m[C.id].push(w),g.add(w.id))});const v=(t.domains||[]).filter(w=>{const C=m[w.id].length>0,k=w.name.toLowerCase().includes(r.toLowerCase())||w.id.toLowerCase().includes(r.toLowerCase());return C||k&&r!==""}).map(w=>({...w,tables:m[w.id]})),x=t.tables.filter(w=>(w.name.toLowerCase().includes(r.toLowerCase())||w.id.toLowerCase().includes(r.toLowerCase()))&&!g.has(w.id)&&!t.domains?.some(k=>k.tables.includes(w.id)));return{domains:v,unassigned:x}},[t,r]);return S.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-4",children:[S.jsxs("div",{className:"relative mb-4 shrink-0",children:[S.jsx(q2,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),S.jsx("input",{type:"text",value:r,onChange:m=>s(m.target.value),placeholder:"Search tables...",className:`w-full pl-9 pr-4 py-2 rounded-md text-sm transition-all shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500/50 ${e==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-200 text-slate-900 shadow-slate-200/50"}`})]}),S.jsxs("div",{className:"flex-1 space-y-4 overflow-auto pr-1",children:[d.domains.map(m=>{const g=l.has(m.id);return S.jsxs("section",{className:"flex flex-col",children:[S.jsxs("div",{className:`flex items-center justify-between group px-1 py-1.5 cursor-pointer rounded transition-colors ${e==="dark"?"hover:bg-slate-800/30":"hover:bg-slate-100"}`,onClick:()=>u(m.id),children:[S.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[g?S.jsx(Vw,{size:12,className:"text-slate-500"}):S.jsx(qa,{size:12,className:"text-slate-500"}),S.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:m.color||"#3b82f6"}}),S.jsx("h3",{className:`text-[10px] font-bold uppercase tracking-wider truncate ${e==="dark"?"text-slate-300":"text-slate-600"}`,children:m.name}),S.jsx("span",{className:`text-[9px] font-medium px-1.5 py-0.5 rounded-full ${e==="dark"?"text-slate-600 bg-slate-800/50":"text-slate-400 bg-slate-100"}`,children:m.tables.length})]}),S.jsx("button",{onClick:v=>{v.stopPropagation(),h(m.id)},className:"opacity-0 group-hover:opacity-100 p-1 hover:text-blue-500 text-slate-500 transition-all",children:S.jsx(ed,{size:12})})]}),!g&&S.jsxs("div",{className:`ml-4 mt-1 space-y-0.5 border-l pl-2 ${e==="dark"?"border-slate-800":"border-slate-100"}`,children:[m.tables.map(v=>S.jsxs("button",{onClick:()=>h(v.id),className:`w-full flex items-center justify-between group p-1.5 text-xs rounded border border-transparent transition-all text-left ${e==="dark"?"hover:bg-slate-800/50 text-slate-400 hover:text-slate-200":"hover:bg-blue-50 text-slate-500 hover:text-blue-600"}`,children:[S.jsx("span",{className:"truncate",children:v.name}),S.jsx(ed,{size:10,className:"opacity-0 group-hover:opacity-100"})]},v.id)),m.tables.length===0&&S.jsx("div",{className:"p-2 text-[10px] text-slate-500 italic",children:"No tables"})]})]},m.id)}),d.unassigned.length>0&&S.jsxs("section",{className:"flex flex-col",children:[S.jsx("div",{className:`flex items-center justify-between group px-1 py-1.5 cursor-pointer rounded transition-colors ${e==="dark"?"hover:bg-slate-800/30":"hover:bg-slate-100"}`,onClick:()=>u("unassigned"),children:S.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[l.has("unassigned")?S.jsx(Vw,{size:12,className:"text-slate-500"}):S.jsx(qa,{size:12,className:"text-slate-500"}),S.jsx(Cz,{size:12,className:"text-slate-500 shrink-0"}),S.jsx("h3",{className:`text-[10px] font-bold uppercase tracking-wider truncate ${e==="dark"?"text-slate-500":"text-slate-400"}`,children:"Unassigned"}),S.jsx("span",{className:`text-[9px] font-medium px-1.5 py-0.5 rounded-full ${e==="dark"?"text-slate-600 bg-slate-800/50":"text-slate-400 bg-slate-100"}`,children:d.unassigned.length})]})}),!l.has("unassigned")&&S.jsx("div",{className:`ml-4 mt-1 space-y-0.5 border-l pl-2 ${e==="dark"?"border-slate-800":"border-slate-100"}`,children:d.unassigned.map(m=>S.jsxs("button",{onClick:()=>h(m.id),className:`w-full flex items-center justify-between group p-1.5 text-xs rounded border border-transparent transition-all text-left ${e==="dark"?"hover:bg-slate-800/50 text-slate-400 hover:text-slate-200":"hover:bg-blue-50 text-slate-500 hover:text-blue-600"}`,children:[S.jsx("span",{className:"truncate",children:m.name}),S.jsx(ed,{size:10,className:"opacity-0 group-hover:opacity-100"})]},m.id))})]})]})]})},Ase=t=>{const e={},n=(i,r,s,l,c)=>{e[i]||(e[i]=[]),e[i].push({from:i,to:r,type:s,id:l,metadata:c}),e[r]||(e[r]=[]),e[r].push({from:r,to:i,type:s,id:l,metadata:c})};return t.relationships?.forEach((i,r)=>{n(i.from.table,i.to.table,"er",`e-${r}`,i)}),t.tables.forEach(i=>{i.lineage?.upstream&&i.lineage.upstream.forEach((r,s)=>{n(r,i.id,"lineage",`lin-${r}-${i.id}-${s}`,{direction:"upstream"})})}),e},_se=(t,e,n)=>{if(e===n)return[];const i=Ase(t),r=[e],s=new Set([e]),l={};for(;r.length>0;){const c=r.shift();if(c===n){const h=[];let d=n;for(;d!==e;){const m=l[d];h.unshift(m),d=m.from}return h}const u=i[c]||[];for(const h of u)s.has(h.to)||(s.add(h.to),l[h.to]={from:c,to:h.to,edge:h},r.push(h.to))}return null},Ose=()=>{const{schema:t,theme:e,setPathFinderResult:n,setFocusNodeId:i}=en(),[r,s]=Y.useState(""),[l,c]=Y.useState(""),[u,h]=Y.useState(null),[d,m]=Y.useState(!1),g=Y.useMemo(()=>t?.tables||[],[t]),v=()=>{if(!t||!r||!l)return;const w=_se(t,r,l);if(h(w),m(!0),w){const C=Array.from(new Set([r,...w.map(A=>A.to)])),k=w.map(A=>A.edge.id);n({nodeIds:C,edgeIds:k})}else n(null)},x=()=>{h(null),m(!1),n(null)};return S.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-4",children:[S.jsxs("div",{className:"space-y-4 mb-6",children:[S.jsxs("div",{children:[S.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-widest block mb-1.5",children:"From Table"}),S.jsxs("select",{value:r,onChange:w=>s(w.target.value),className:`w-full p-2 rounded-md text-sm border shadow-sm focus:ring-1 focus:ring-blue-500/50 outline-none ${e==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-200 text-slate-900"}`,children:[S.jsx("option",{value:"",children:"Select source..."}),g.map(w=>S.jsx("option",{value:w.id,children:w.name},w.id))]})]}),S.jsxs("div",{children:[S.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-widest block mb-1.5",children:"To Table"}),S.jsxs("select",{value:l,onChange:w=>c(w.target.value),className:`w-full p-2 rounded-md text-sm border shadow-sm focus:ring-1 focus:ring-blue-500/50 outline-none ${e==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-200 text-slate-900"}`,children:[S.jsx("option",{value:"",children:"Select target..."}),g.map(w=>S.jsx("option",{value:w.id,children:w.name},w.id))]})]}),S.jsxs("div",{className:"flex gap-2 pt-2",children:[S.jsxs("button",{onClick:v,disabled:!r||!l,className:`flex-1 flex items-center justify-center gap-2 py-2 rounded-md text-xs font-bold transition-all ${!r||!l?"bg-slate-100 text-slate-400 cursor-not-allowed":"bg-blue-600 text-white hover:bg-blue-500 shadow-lg shadow-blue-500/20 active:scale-95"}`,children:[S.jsx(q2,{size:14}),"FIND PATH"]}),d&&S.jsx("button",{onClick:x,className:`p-2 rounded-md border transition-all hover:bg-slate-100 dark:hover:bg-slate-800 ${e==="dark"?"border-slate-700 text-slate-400":"border-slate-200 text-slate-500"}`,title:"Clear search results",children:S.jsx(Vu,{size:14})})]})]}),S.jsxs("div",{className:"flex-1 overflow-auto pr-1",children:[d&&!u&&S.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[S.jsx(td,{size:32,className:"text-slate-300 mb-2"}),S.jsx("p",{className:"text-sm text-slate-500 italic",children:"No path found between these tables."})]}),u&&S.jsxs("div",{className:"space-y-1",children:[S.jsx("div",{className:`p-3 rounded-lg border border-l-4 border-l-blue-500 mb-4 ${e==="dark"?"bg-slate-800/30 border-slate-700":"bg-blue-50/50 border-blue-100"}`,children:S.jsxs("p",{className:"text-xs font-medium text-slate-500",children:["Path found with ",S.jsx("span",{className:"font-bold text-blue-500",children:u.length})," steps"]})}),S.jsxs("div",{className:"relative pl-4 space-y-0",children:[S.jsx("div",{className:"absolute left-1 top-2 bottom-2 w-0.5 bg-slate-200 dark:bg-slate-800"}),S.jsxs("div",{className:"relative mb-4",children:[S.jsx("div",{className:"absolute -left-[15px] top-1 w-2.5 h-2.5 rounded-full bg-blue-500 border-2 border-white dark:border-slate-900"}),S.jsx("button",{onClick:()=>i(r),className:"text-xs font-bold hover:text-blue-500 transition-colors",children:g.find(w=>w.id===r)?.name})]}),u.map((w,C)=>S.jsxs("div",{className:"mb-4",children:[S.jsxs("div",{className:`flex items-center gap-2 my-2 py-1 px-2 rounded border w-fit transition-colors ${e==="dark"?"bg-slate-800/50 border-slate-700 text-slate-400":w.edge.type==="er"?"bg-emerald-50 border-emerald-100 text-emerald-700":"bg-blue-50 border-blue-100 text-blue-700"}`,children:[w.edge.type==="er"?S.jsx(Ba,{size:10,className:e==="dark"?"text-emerald-500":"text-emerald-600"}):S.jsx(z2,{size:10,className:e==="dark"?"text-blue-400":"text-blue-600"}),S.jsx("span",{className:"text-[9px] font-bold uppercase tracking-tighter",children:w.edge.type==="er"?`ER (${w.edge.metadata.type})`:"Lineage"})]}),S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"absolute -left-[15px] top-1 w-2.5 h-2.5 rounded-full bg-slate-400 border-2 border-white dark:border-slate-900"}),S.jsx("button",{onClick:()=>i(w.to),className:"text-xs font-bold hover:text-blue-500 transition-colors",children:g.find(k=>k.id===w.to)?.name})]})]},C))]})]})]})]})},Ese=()=>{const{schema:t,theme:e,setSelectedAnnotationId:n,setFocusNodeId:i}=en(),[r,s]=Y.useState(""),l=Y.useMemo(()=>t?.annotations?t.annotations.filter(u=>u.text.toLowerCase().includes(r.toLowerCase())):[],[t,r]),c=u=>{n(u),i(u)};return S.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-4",children:[S.jsxs("div",{className:"relative mb-4 shrink-0",children:[S.jsx(q2,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),S.jsx("input",{type:"text",value:r,onChange:u=>s(u.target.value),placeholder:"Search notes...",className:`w-full pl-9 pr-4 py-2 rounded-md text-sm transition-all shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500/50 ${e==="dark"?"bg-slate-800 border-slate-700 text-slate-100":"bg-white border-slate-200 text-slate-900 shadow-slate-200/50"}`})]}),S.jsxs("div",{className:"flex-1 space-y-2 overflow-auto pr-1",children:[l.length===0&&r&&S.jsxs("div",{className:"text-center py-10 text-slate-500 italic text-sm",children:['No notes matching "',r,'"']}),l.map(u=>S.jsxs("button",{onClick:()=>c(u.id),className:`w-full p-3 text-left rounded-lg border transition-all group relative ${e==="dark"?"bg-slate-800/40 border-slate-700 hover:border-blue-500/50 hover:bg-slate-800/60":"bg-white border-slate-200 hover:border-blue-300 hover:bg-blue-50/30 shadow-sm"}`,children:[S.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[S.jsx(ko,{size:12,className:u.type==="callout"?"text-blue-400":"text-amber-400"}),S.jsx("span",{className:"text-[10px] font-bold uppercase tracking-tighter text-slate-500",children:u.type==="callout"?"Callout":"Sticky Note"}),S.jsx(ed,{size:12,className:"ml-auto opacity-0 group-hover:opacity-100 transition-opacity text-blue-500"})]}),S.jsx("p",{className:`text-xs line-clamp-3 leading-relaxed ${e==="dark"?"text-slate-300":"text-slate-600"}`,children:u.text}),u.targetId&&S.jsxs("div",{className:"mt-2 flex items-center gap-1.5 opacity-60",children:[S.jsx("div",{className:"w-1 h-1 rounded-full bg-slate-400"}),S.jsxs("span",{className:"text-[9px] font-medium truncate italic",children:["Attached to ",u.targetId]})]})]},u.id)),!r&&l.length===0&&S.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center opacity-40",children:[S.jsx(kz,{size:48,className:"mb-4 text-slate-400"}),S.jsx("p",{className:"text-sm font-medium",children:"No annotations in this model yet."})]})]})]})},Tse=()=>{const{isRightPanelOpen:t,setIsRightPanelOpen:e,activeRightPanelTab:n,setActiveRightPanelTab:i,theme:r}=en(),s=c=>`
|
|
55
55
|
flex items-center justify-center w-10 h-10 rounded-xl transition-all relative group
|
|
56
56
|
${c?"bg-blue-600/10 text-blue-500 shadow-inner":r==="dark"?"text-slate-500 hover:text-slate-300 hover:bg-slate-800/30":"text-slate-400 hover:text-slate-600 hover:bg-slate-100"}
|
|
57
57
|
`,l=({text:c})=>S.jsxs("div",{className:"absolute right-14 px-2 py-1 bg-slate-800 text-white text-[10px] font-bold rounded opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity whitespace-nowrap z-[60] border border-slate-700 shadow-xl",children:[c,S.jsx("div",{className:"absolute top-1/2 -right-1 -translate-y-1/2 border-4 border-transparent border-l-slate-800"})]});return S.jsxs("div",{className:`relative h-full flex flex-row transition-all duration-300 ease-in-out shadow-2xl z-50 ${t?"w-[456px]":"w-14"}`,children:[S.jsxs("div",{className:`w-14 h-full flex flex-col items-center py-4 border-l transition-colors z-50 ${r==="dark"?"bg-slate-950 border-slate-800":"bg-slate-50 border-slate-200"}`,children:[S.jsx("button",{onClick:()=>e(!t),className:`mb-6 p-2 rounded-xl transition-all ${r==="dark"?"hover:bg-slate-800 text-slate-400 hover:text-white":"hover:bg-white hover:shadow-md text-slate-500 hover:text-slate-900"}`,children:t?S.jsx(Vw,{size:20}):S.jsx(Sz,{size:20})}),S.jsxs("div",{className:"flex flex-col gap-2 mb-6",children:[S.jsxs("button",{onClick:()=>{i("tables"),e(!0)},className:s(n==="tables"&&t),children:[S.jsx(_W,{size:20}),S.jsx(l,{text:"Tables & Entities"})]}),S.jsxs("button",{onClick:()=>{i("path"),e(!0)},className:s(n==="path"&&t),children:[S.jsx($W,{size:20}),S.jsx(l,{text:"Path Finder"})]}),S.jsxs("button",{onClick:()=>{i("notes"),e(!0)},className:s(n==="notes"&&t),children:[S.jsx(kz,{size:20}),S.jsx(l,{text:"Note Search"})]})]})]}),S.jsxs("div",{className:`flex-1 flex flex-col min-w-0 overflow-hidden transition-all duration-300 sidebar-content ${r==="dark"?"bg-slate-900":"bg-white"} ${t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}`,style:{width:t?"400px":"0px"},children:[S.jsx("div",{className:`p-4 border-b flex items-center justify-between ${r==="dark"?"border-slate-800":"border-slate-100"}`,children:S.jsxs("h2",{className:`text-sm font-bold tracking-tight uppercase ${r==="dark"?"text-white":"text-slate-900"}`,children:[n==="tables"&&"Tables",n==="path"&&"Path Finder",n==="notes"&&"Note Search"]})}),n==="tables"&&S.jsx(kse,{}),n==="path"&&S.jsx(Ose,{}),n==="notes"&&S.jsx(Ese,{})]})]})};function Mse(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const n=document.implementation.createHTMLDocument(),i=n.createElement("base"),r=n.createElement("a");return n.head.appendChild(i),n.body.appendChild(r),e&&(i.href=e),r.href=t,r.href}const Nse=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function Gs(t){const e=[];for(let n=0,i=t.length;n<i;n++)e.push(t[n]);return e}let Yl=null;function NB(t={}){return Yl||(t.includeStyleProperties?(Yl=t.includeStyleProperties,Yl):(Yl=Gs(window.getComputedStyle(document.documentElement)),Yl))}function ip(t,e){const i=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return i?parseFloat(i.replace("px","")):0}function Rse(t){const e=ip(t,"border-left-width"),n=ip(t,"border-right-width");return t.clientWidth+e+n}function Dse(t){const e=ip(t,"border-top-width"),n=ip(t,"border-bottom-width");return t.clientHeight+e+n}function RB(t,e={}){const n=e.width||Rse(t),i=e.height||Dse(t);return{width:n,height:i}}function Lse(){let t,e;try{e=process}catch{}const n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const di=16384;function zse(t){(t.width>di||t.height>di)&&(t.width>di&&t.height>di?t.width>t.height?(t.height*=di/t.width,t.width=di):(t.width*=di/t.height,t.height=di):t.width>di?(t.height*=di/t.width,t.width=di):(t.width*=di/t.height,t.height=di))}function rp(t){return new Promise((e,n)=>{const i=new Image;i.onload=()=>{i.decode().then(()=>{requestAnimationFrame(()=>e(i))})},i.onerror=n,i.crossOrigin="anonymous",i.decoding="async",i.src=t})}async function qse(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function Bse(t,e,n){const i="http://www.w3.org/2000/svg",r=document.createElementNS(i,"svg"),s=document.createElementNS(i,"foreignObject");return r.setAttribute("width",`${e}`),r.setAttribute("height",`${n}`),r.setAttribute("viewBox",`0 0 ${e} ${n}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),r.appendChild(s),s.appendChild(t),qse(r)}const Zn=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||Zn(n,e)};function jse(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function Ise(t,e){return NB(e).map(n=>{const i=t.getPropertyValue(n),r=t.getPropertyPriority(n);return`${n}: ${i}${r?" !important":""};`}).join(" ")}function Pse(t,e,n,i){const r=`.${t}:${e}`,s=n.cssText?jse(n):Ise(n,i);return document.createTextNode(`${r}{${s}}`)}function t4(t,e,n,i){const r=window.getComputedStyle(t,n),s=r.getPropertyValue("content");if(s===""||s==="none")return;const l=Nse();try{e.className=`${e.className} ${l}`}catch{return}const c=document.createElement("style");c.appendChild(Pse(l,n,r,i)),e.appendChild(c)}function Hse(t,e,n){t4(t,e,":before",n),t4(t,e,":after",n)}const n4="application/font-woff",i4="image/jpeg",Use={woff:n4,woff2:n4,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:i4,jpeg:i4,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Vse(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function CC(t){const e=Vse(t).toLowerCase();return Use[e]||""}function Fse(t){return t.split(/,/)[1]}function VS(t){return t.search(/^(data:)/)!==-1}function $se(t,e){return`data:${e};base64,${t}`}async function DB(t,e,n){const i=await fetch(t,e);if(i.status===404)throw new Error(`Resource "${i.url}" not found`);const r=await i.blob();return new Promise((s,l)=>{const c=new FileReader;c.onerror=l,c.onloadend=()=>{try{s(n({res:i,result:c.result}))}catch(u){l(u)}},c.readAsDataURL(r)})}const ww={};function Gse(t,e,n){let i=t.replace(/\?.*/,"");return n&&(i=t),/ttf|otf|eot|woff2?/i.test(i)&&(i=i.replace(/.*\//,"")),e?`[${e}]${i}`:i}async function kC(t,e,n){const i=Gse(t,e,n.includeQueryParams);if(ww[i]!=null)return ww[i];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let r;try{const s=await DB(t,n.fetchRequestInit,({res:l,result:c})=>(e||(e=l.headers.get("Content-Type")||""),Fse(c)));r=$se(s,e)}catch(s){r=n.imagePlaceholder||"";let l=`Failed to fetch resource: ${t}`;s&&(l=typeof s=="string"?s:s.message),l&&console.warn(l)}return ww[i]=r,r}async function Yse(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):rp(e)}async function Qse(t,e){if(t.currentSrc){const s=document.createElement("canvas"),l=s.getContext("2d");s.width=t.clientWidth,s.height=t.clientHeight,l?.drawImage(t,0,0,s.width,s.height);const c=s.toDataURL();return rp(c)}const n=t.poster,i=CC(n),r=await kC(n,i,e);return rp(r)}async function Xse(t,e){var n;try{if(!((n=t?.contentDocument)===null||n===void 0)&&n.body)return await Gp(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function Wse(t,e){return Zn(t,HTMLCanvasElement)?Yse(t):Zn(t,HTMLVideoElement)?Qse(t,e):Zn(t,HTMLIFrameElement)?Xse(t,e):t.cloneNode(LB(t))}const Kse=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",LB=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function Zse(t,e,n){var i,r;if(LB(e))return e;let s=[];return Kse(t)&&t.assignedNodes?s=Gs(t.assignedNodes()):Zn(t,HTMLIFrameElement)&&(!((i=t.contentDocument)===null||i===void 0)&&i.body)?s=Gs(t.contentDocument.body.childNodes):s=Gs(((r=t.shadowRoot)!==null&&r!==void 0?r:t).childNodes),s.length===0||Zn(t,HTMLVideoElement)||await s.reduce((l,c)=>l.then(()=>Gp(c,n)).then(u=>{u&&e.appendChild(u)}),Promise.resolve()),e}function Jse(t,e,n){const i=e.style;if(!i)return;const r=window.getComputedStyle(t);r.cssText?(i.cssText=r.cssText,i.transformOrigin=r.transformOrigin):NB(n).forEach(s=>{let l=r.getPropertyValue(s);s==="font-size"&&l.endsWith("px")&&(l=`${Math.floor(parseFloat(l.substring(0,l.length-2)))-.1}px`),Zn(t,HTMLIFrameElement)&&s==="display"&&l==="inline"&&(l="block"),s==="d"&&e.getAttribute("d")&&(l=`path(${e.getAttribute("d")})`),i.setProperty(s,l,r.getPropertyPriority(s))})}function eae(t,e){Zn(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),Zn(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function tae(t,e){if(Zn(t,HTMLSelectElement)){const i=Array.from(e.children).find(r=>t.value===r.getAttribute("value"));i&&i.setAttribute("selected","")}}function nae(t,e,n){return Zn(e,Element)&&(Jse(t,e,n),Hse(t,e,n),eae(t,e),tae(t,e)),e}async function iae(t,e){const n=t.querySelectorAll?t.querySelectorAll("use"):[];if(n.length===0)return t;const i={};for(let s=0;s<n.length;s++){const c=n[s].getAttribute("xlink:href");if(c){const u=t.querySelector(c),h=document.querySelector(c);!u&&h&&!i[c]&&(i[c]=await Gp(h,e,!0))}}const r=Object.values(i);if(r.length){const s="http://www.w3.org/1999/xhtml",l=document.createElementNS(s,"svg");l.setAttribute("xmlns",s),l.style.position="absolute",l.style.width="0",l.style.height="0",l.style.overflow="hidden",l.style.display="none";const c=document.createElementNS(s,"defs");l.appendChild(c);for(let u=0;u<r.length;u++)c.appendChild(r[u]);t.appendChild(l)}return t}async function Gp(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(i=>Wse(i,e)).then(i=>Zse(t,i,e)).then(i=>nae(t,i,e)).then(i=>iae(i,e))}const zB=/url\((['"]?)([^'"]+?)\1\)/g,rae=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,sae=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function aae(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function lae(t){const e=[];return t.replace(zB,(n,i,r)=>(e.push(r),n)),e.filter(n=>!VS(n))}async function oae(t,e,n,i,r){try{const s=n?Mse(e,n):e,l=CC(e);let c;return r||(c=await kC(s,l,i)),t.replace(aae(e),`$1${c}$3`)}catch{}return t}function cae(t,{preferredFontFormat:e}){return e?t.replace(sae,n=>{for(;;){const[i,,r]=rae.exec(n)||[];if(!r)return"";if(r===e)return`src: ${i};`}}):t}function qB(t){return t.search(zB)!==-1}async function BB(t,e,n){if(!qB(t))return t;const i=cae(t,n);return lae(i).reduce((s,l)=>s.then(c=>oae(c,l,e,n)),Promise.resolve(i))}async function Ql(t,e,n){var i;const r=(i=e.style)===null||i===void 0?void 0:i.getPropertyValue(t);if(r){const s=await BB(r,null,n);return e.style.setProperty(t,s,e.style.getPropertyPriority(t)),!0}return!1}async function uae(t,e){await Ql("background",t,e)||await Ql("background-image",t,e),await Ql("mask",t,e)||await Ql("-webkit-mask",t,e)||await Ql("mask-image",t,e)||await Ql("-webkit-mask-image",t,e)}async function fae(t,e){const n=Zn(t,HTMLImageElement);if(!(n&&!VS(t.src))&&!(Zn(t,SVGImageElement)&&!VS(t.href.baseVal)))return;const i=n?t.src:t.href.baseVal,r=await kC(i,CC(i),e);await new Promise((s,l)=>{t.onload=s,t.onerror=e.onImageErrorHandler?(...u)=>{try{s(e.onImageErrorHandler(...u))}catch(h){l(h)}}:l;const c=t;c.decode&&(c.decode=s),c.loading==="lazy"&&(c.loading="eager"),n?(t.srcset="",t.src=r):t.href.baseVal=r})}async function hae(t,e){const i=Gs(t.childNodes).map(r=>jB(r,e));await Promise.all(i).then(()=>t)}async function jB(t,e){Zn(t,Element)&&(await uae(t,e),await fae(t,e),await hae(t,e))}function dae(t,e){const{style:n}=t;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width=`${e.width}px`),e.height&&(n.height=`${e.height}px`);const i=e.style;return i!=null&&Object.keys(i).forEach(r=>{n[r]=i[r]}),t}const r4={};async function s4(t){let e=r4[t];if(e!=null)return e;const i=await(await fetch(t)).text();return e={url:t,cssText:i},r4[t]=e,e}async function a4(t,e){let n=t.cssText;const i=/url\(["']?([^"')]+)["']?\)/g,s=(n.match(/url\([^)]+\)/g)||[]).map(async l=>{let c=l.replace(i,"$1");return c.startsWith("https://")||(c=new URL(c,t.url).href),DB(c,e.fetchRequestInit,({result:u})=>(n=n.replace(l,`url(${u})`),[l,u]))});return Promise.all(s).then(()=>n)}function l4(t){if(t==null)return[];const e=[],n=/(\/\*[\s\S]*?\*\/)/gi;let i=t.replace(n,"");const r=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const u=r.exec(i);if(u===null)break;e.push(u[0])}i=i.replace(r,"");const s=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,l="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(l,"gi");for(;;){let u=s.exec(i);if(u===null){if(u=c.exec(i),u===null)break;s.lastIndex=c.lastIndex}else c.lastIndex=s.lastIndex;e.push(u[0])}return e}async function pae(t,e){const n=[],i=[];return t.forEach(r=>{if("cssRules"in r)try{Gs(r.cssRules||[]).forEach((s,l)=>{if(s.type===CSSRule.IMPORT_RULE){let c=l+1;const u=s.href,h=s4(u).then(d=>a4(d,e)).then(d=>l4(d).forEach(m=>{try{r.insertRule(m,m.startsWith("@import")?c+=1:r.cssRules.length)}catch(g){console.error("Error inserting rule from remote css",{rule:m,error:g})}})).catch(d=>{console.error("Error loading remote css",d.toString())});i.push(h)}})}catch(s){const l=t.find(c=>c.href==null)||document.styleSheets[0];r.href!=null&&i.push(s4(r.href).then(c=>a4(c,e)).then(c=>l4(c).forEach(u=>{l.insertRule(u,l.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",s)}}),Promise.all(i).then(()=>(t.forEach(r=>{if("cssRules"in r)try{Gs(r.cssRules||[]).forEach(s=>{n.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${r.href}`,s)}}),n))}function mae(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>qB(e.style.getPropertyValue("src")))}async function gae(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=Gs(t.ownerDocument.styleSheets),i=await pae(n,e);return mae(i)}function IB(t){return t.trim().replace(/["']/g,"")}function yae(t){const e=new Set;function n(i){(i.style.fontFamily||getComputedStyle(i).fontFamily).split(",").forEach(s=>{e.add(IB(s))}),Array.from(i.children).forEach(s=>{s instanceof HTMLElement&&n(s)})}return n(t),e}async function vae(t,e){const n=await gae(t,e),i=yae(t);return(await Promise.all(n.filter(s=>i.has(IB(s.style.fontFamily))).map(s=>{const l=s.parentStyleSheet?s.parentStyleSheet.href:null;return BB(s.cssText,l,e)}))).join(`
|