@power-maverick/tool-erd-generator 0.1.16 → 0.1.18
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.
- package/dist/_basePickBy.js +1 -0
- package/dist/_baseUniq.js +1 -0
- package/dist/arc.js +1 -1
- package/dist/architectureDiagram-VXUJARFQ.js +36 -0
- package/dist/blockDiagram-VD42YOAC.js +122 -0
- package/dist/c4Diagram-YG6GDRKO.js +10 -0
- package/dist/channel.js +1 -1
- package/dist/chunk-4BX2VUAB.js +1 -0
- package/dist/chunk-55IACEB6.js +1 -0
- package/dist/chunk-B4BG7PRW.js +165 -0
- package/dist/chunk-DI55MBZ5.js +220 -0
- package/dist/chunk-FMBD7UC4.js +15 -0
- package/dist/chunk-QN33PNHL.js +1 -0
- package/dist/chunk-QZHKN3VN.js +1 -0
- package/dist/chunk-TZMSLE5B.js +1 -0
- package/dist/classDiagram-2ON5EDUG.js +1 -0
- package/dist/classDiagram-v2-WZHVMYZB.js +1 -0
- package/dist/clone.js +1 -1
- package/dist/cose-bilkent-S5V4N54A.js +1 -0
- package/dist/cytoscape.esm.js +331 -0
- package/dist/dagre-6UL2VRFP.js +4 -0
- package/dist/defaultLocale.js +1 -0
- package/dist/diagram-PSM6KHXK.js +24 -0
- package/dist/diagram-QEK2KX5R.js +43 -0
- package/dist/diagram-S2PKOQOG.js +24 -0
- package/dist/erDiagram-Q2GNP2WA.js +60 -0
- package/dist/flowDiagram-NV44I4VS.js +162 -0
- package/dist/ganttDiagram-LVOFAZNH.js +267 -0
- package/dist/gitGraphDiagram-NY62KEGX.js +65 -0
- package/dist/graph.js +1 -1
- package/dist/index.js +1 -1
- package/dist/infoDiagram-ER5ION4S.js +2 -0
- package/dist/journeyDiagram-XKPGCS4Q.js +139 -0
- package/dist/kanban-definition-3W4ZIXB7.js +89 -0
- package/dist/layout.js +1 -1
- package/dist/linear.js +1 -1
- package/dist/mermaid.core.js +222 -57
- package/dist/mindmap-definition-VGOIOE7T.js +68 -0
- package/dist/pieDiagram-ADFJNKIX.js +30 -0
- package/dist/quadrantDiagram-AYHSOK5B.js +7 -0
- package/dist/requirementDiagram-UZGBJVZJ.js +64 -0
- package/dist/sankeyDiagram-TZEHDZUN.js +10 -0
- package/dist/sequenceDiagram-WL72ISMW.js +145 -0
- package/dist/stateDiagram-FKZM4ZOC.js +1 -0
- package/dist/stateDiagram-v2-4FDKWEC3.js +1 -0
- package/dist/timeline-definition-IT6M3QCI.js +61 -0
- package/dist/treemap-KMMF4GRG.js +128 -0
- package/dist/xychartDiagram-PRI3JC2R.js +7 -0
- package/npm-shrinkwrap.json +3410 -0
- package/package.json +4 -3
- package/dist/Tableau10.js +0 -1
- package/dist/array.js +0 -1
- package/dist/blockDiagram-68f4deed.js +0 -118
- package/dist/c4Diagram-15b5d702.js +0 -10
- package/dist/classDiagram-d40c83e7.js +0 -2
- package/dist/classDiagram-v2-d5a6b087.js +0 -2
- package/dist/createText-d213de94.js +0 -7
- package/dist/edges-332bd1c7.js +0 -4
- package/dist/erDiagram-880f2ed8.js +0 -51
- package/dist/flowDb-7c981674.js +0 -10
- package/dist/flowDiagram-cbd28bf7.js +0 -4
- package/dist/flowDiagram-v2-ffc7f31a.js +0 -1
- package/dist/flowchart-elk-definition-36e2d292.js +0 -139
- package/dist/ganttDiagram-04f9e578.js +0 -257
- package/dist/gitGraphDiagram-21fc4d3e.js +0 -70
- package/dist/index-6079d271.js +0 -1
- package/dist/infoDiagram-4a4f5b27.js +0 -7
- package/dist/journeyDiagram-29694f62.js +0 -139
- package/dist/line.js +0 -1
- package/dist/mindmap-definition-ac74a2e8.js +0 -425
- package/dist/path.js +0 -1
- package/dist/pieDiagram-421022e6.js +0 -35
- package/dist/quadrantDiagram-0957ecba.js +0 -7
- package/dist/requirementDiagram-23d650b8.js +0 -52
- package/dist/sankeyDiagram-23345273.js +0 -8
- package/dist/sequenceDiagram-17ac3bff.js +0 -122
- package/dist/stateDiagram-9c5f0230.js +0 -1
- package/dist/stateDiagram-v2-51a3dcff.js +0 -1
- package/dist/styles-2ab5d517.js +0 -116
- package/dist/styles-5f03d8d2.js +0 -160
- package/dist/styles-edf9a4b0.js +0 -207
- package/dist/svgDrawCommon-3ba9043b.js +0 -1
- package/dist/timeline-definition-7e6b55e7.js +0 -61
- package/dist/xychartDiagram-b6496bcd.js +0 -7
package/dist/index.js
CHANGED
|
@@ -45,4 +45,4 @@ Error generating stack: `+i.message+`
|
|
|
45
45
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(o){return o instanceof this?o:new this(o)}static concat(o,...u){const c=new this(o);return u.forEach(f=>c.set(f)),c}static accessor(o){const c=(this[Tc]=this[Tc]={accessors:{}}).accessors,f=this.prototype;function p(m){const v=Dr(m);c[v]||(Pm(f,m),c[v]=!0)}return k.isArray(o)?o.forEach(p):p(o),this}};rt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);k.reduceDescriptors(rt.prototype,({value:s},o)=>{let u=o[0].toUpperCase()+o.slice(1);return{get:()=>s,set(c){this[u]=c}}});k.freezeMethods(rt);function ss(s,o){const u=this||Ir,c=o||u,f=rt.from(c.headers);let p=c.data;return k.forEach(s,function(v){p=v.call(u,p,f.normalize(),o?o.status:void 0)}),f.normalize(),p}function ef(s){return!!(s&&s.__CANCEL__)}function Kn(s,o,u){Y.call(this,s??"canceled",Y.ERR_CANCELED,o,u),this.name="CanceledError"}k.inherits(Kn,Y,{__CANCEL__:!0});function tf(s,o,u){const c=u.config.validateStatus;!u.status||!c||c(u.status)?s(u):o(new Y("Request failed with status code "+u.status,[Y.ERR_BAD_REQUEST,Y.ERR_BAD_RESPONSE][Math.floor(u.status/100)-4],u.config,u.request,u))}function Rm(s){const o=/^([-+\w]{1,25})(:?\/\/|:)/.exec(s);return o&&o[1]||""}function _m(s,o){s=s||10;const u=new Array(s),c=new Array(s);let f=0,p=0,m;return o=o!==void 0?o:1e3,function(C){const N=Date.now(),x=c[p];m||(m=N),u[f]=C,c[f]=N;let z=p,U=0;for(;z!==f;)U+=u[z++],z=z%s;if(f=(f+1)%s,f===p&&(p=(p+1)%s),N-m<o)return;const Z=x&&N-x;return Z?Math.round(U*1e3/Z):void 0}}function Om(s,o){let u=0,c=1e3/o,f,p;const m=(N,x=Date.now())=>{u=x,f=null,p&&(clearTimeout(p),p=null),s(...N)};return[(...N)=>{const x=Date.now(),z=x-u;z>=c?m(N,x):(f=N,p||(p=setTimeout(()=>{p=null,m(f)},c-z)))},()=>f&&m(f)]}const ti=(s,o,u=3)=>{let c=0;const f=_m(50,250);return Om(p=>{const m=p.loaded,v=p.lengthComputable?p.total:void 0,C=m-c,N=f(C),x=m<=v;c=m;const z={loaded:m,total:v,progress:v?m/v:void 0,bytes:C,rate:N||void 0,estimated:N&&v&&x?(v-m)/N:void 0,event:p,lengthComputable:v!=null,[o?"download":"upload"]:!0};s(z)},u)},Pc=(s,o)=>{const u=s!=null;return[c=>o[0]({lengthComputable:u,total:s,loaded:c}),o[1]]},Rc=s=>(...o)=>k.asap(()=>s(...o)),Lm=We.hasStandardBrowserEnv?((s,o)=>u=>(u=new URL(u,We.origin),s.protocol===u.protocol&&s.host===u.host&&(o||s.port===u.port)))(new URL(We.origin),We.navigator&&/(msie|trident)/i.test(We.navigator.userAgent)):()=>!0,Am=We.hasStandardBrowserEnv?{write(s,o,u,c,f,p){const m=[s+"="+encodeURIComponent(o)];k.isNumber(u)&&m.push("expires="+new Date(u).toGMTString()),k.isString(c)&&m.push("path="+c),k.isString(f)&&m.push("domain="+f),p===!0&&m.push("secure"),document.cookie=m.join("; ")},read(s){const o=document.cookie.match(new RegExp("(^|;\\s*)("+s+")=([^;]*)"));return o?decodeURIComponent(o[3]):null},remove(s){this.write(s,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function zm(s){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s)}function Dm(s,o){return o?s.replace(/\/?\/$/,"")+"/"+o.replace(/^\/+/,""):s}function nf(s,o,u){let c=!zm(o);return s&&(c||u==!1)?Dm(s,o):o}const _c=s=>s instanceof rt?{...s}:s;function wn(s,o){o=o||{};const u={};function c(N,x,z,U){return k.isPlainObject(N)&&k.isPlainObject(x)?k.merge.call({caseless:U},N,x):k.isPlainObject(x)?k.merge({},x):k.isArray(x)?x.slice():x}function f(N,x,z,U){if(k.isUndefined(x)){if(!k.isUndefined(N))return c(void 0,N,z,U)}else return c(N,x,z,U)}function p(N,x){if(!k.isUndefined(x))return c(void 0,x)}function m(N,x){if(k.isUndefined(x)){if(!k.isUndefined(N))return c(void 0,N)}else return c(void 0,x)}function v(N,x,z){if(z in o)return c(N,x);if(z in s)return c(void 0,N)}const C={url:p,method:p,data:p,baseURL:m,transformRequest:m,transformResponse:m,paramsSerializer:m,timeout:m,timeoutMessage:m,withCredentials:m,withXSRFToken:m,adapter:m,responseType:m,xsrfCookieName:m,xsrfHeaderName:m,onUploadProgress:m,onDownloadProgress:m,decompress:m,maxContentLength:m,maxBodyLength:m,beforeRedirect:m,transport:m,httpAgent:m,httpsAgent:m,cancelToken:m,socketPath:m,responseEncoding:m,validateStatus:v,headers:(N,x,z)=>f(_c(N),_c(x),z,!0)};return k.forEach(Object.keys({...s,...o}),function(x){const z=C[x]||f,U=z(s[x],o[x],x);k.isUndefined(U)&&z!==v||(u[x]=U)}),u}const rf=s=>{const o=wn({},s);let{data:u,withXSRFToken:c,xsrfHeaderName:f,xsrfCookieName:p,headers:m,auth:v}=o;if(o.headers=m=rt.from(m),o.url=Yc(nf(o.baseURL,o.url,o.allowAbsoluteUrls),s.params,s.paramsSerializer),v&&m.set("Authorization","Basic "+btoa((v.username||"")+":"+(v.password?unescape(encodeURIComponent(v.password)):""))),k.isFormData(u)){if(We.hasStandardBrowserEnv||We.hasStandardBrowserWebWorkerEnv)m.setContentType(void 0);else if(k.isFunction(u.getHeaders)){const C=u.getHeaders(),N=["content-type","content-length"];Object.entries(C).forEach(([x,z])=>{N.includes(x.toLowerCase())&&m.set(x,z)})}}if(We.hasStandardBrowserEnv&&(c&&k.isFunction(c)&&(c=c(o)),c||c!==!1&&Lm(o.url))){const C=f&&p&&Am.read(p);C&&m.set(f,C)}return o},jm=typeof XMLHttpRequest<"u",Fm=jm&&function(s){return new Promise(function(u,c){const f=rf(s);let p=f.data;const m=rt.from(f.headers).normalize();let{responseType:v,onUploadProgress:C,onDownloadProgress:N}=f,x,z,U,Z,R;function j(){Z&&Z(),R&&R(),f.cancelToken&&f.cancelToken.unsubscribe(x),f.signal&&f.signal.removeEventListener("abort",x)}let L=new XMLHttpRequest;L.open(f.method.toUpperCase(),f.url,!0),L.timeout=f.timeout;function oe(){if(!L)return;const re=rt.from("getAllResponseHeaders"in L&&L.getAllResponseHeaders()),he={data:!v||v==="text"||v==="json"?L.responseText:L.response,status:L.status,statusText:L.statusText,headers:re,config:s,request:L};tf(function(se){u(se),j()},function(se){c(se),j()},he),L=null}"onloadend"in L?L.onloadend=oe:L.onreadystatechange=function(){!L||L.readyState!==4||L.status===0&&!(L.responseURL&&L.responseURL.indexOf("file:")===0)||setTimeout(oe)},L.onabort=function(){L&&(c(new Y("Request aborted",Y.ECONNABORTED,s,L)),L=null)},L.onerror=function(te){const he=te&&te.message?te.message:"Network Error",de=new Y(he,Y.ERR_NETWORK,s,L);de.event=te||null,c(de),L=null},L.ontimeout=function(){let te=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded";const he=f.transitional||Zc;f.timeoutErrorMessage&&(te=f.timeoutErrorMessage),c(new Y(te,he.clarifyTimeoutError?Y.ETIMEDOUT:Y.ECONNABORTED,s,L)),L=null},p===void 0&&m.setContentType(null),"setRequestHeader"in L&&k.forEach(m.toJSON(),function(te,he){L.setRequestHeader(he,te)}),k.isUndefined(f.withCredentials)||(L.withCredentials=!!f.withCredentials),v&&v!=="json"&&(L.responseType=f.responseType),N&&([U,R]=ti(N,!0),L.addEventListener("progress",U)),C&&L.upload&&([z,Z]=ti(C),L.upload.addEventListener("progress",z),L.upload.addEventListener("loadend",Z)),(f.cancelToken||f.signal)&&(x=re=>{L&&(c(!re||re.type?new Kn(null,s,L):re),L.abort(),L=null)},f.cancelToken&&f.cancelToken.subscribe(x),f.signal&&(f.signal.aborted?x():f.signal.addEventListener("abort",x)));const ce=Rm(f.url);if(ce&&We.protocols.indexOf(ce)===-1){c(new Y("Unsupported protocol "+ce+":",Y.ERR_BAD_REQUEST,s));return}L.send(p||null)})},Mm=(s,o)=>{const{length:u}=s=s?s.filter(Boolean):[];if(o||u){let c=new AbortController,f;const p=function(N){if(!f){f=!0,v();const x=N instanceof Error?N:this.reason;c.abort(x instanceof Y?x:new Kn(x instanceof Error?x.message:x))}};let m=o&&setTimeout(()=>{m=null,p(new Y(`timeout ${o} of ms exceeded`,Y.ETIMEDOUT))},o);const v=()=>{s&&(m&&clearTimeout(m),m=null,s.forEach(N=>{N.unsubscribe?N.unsubscribe(p):N.removeEventListener("abort",p)}),s=null)};s.forEach(N=>N.addEventListener("abort",p));const{signal:C}=c;return C.unsubscribe=()=>k.asap(v),C}},Im=function*(s,o){let u=s.byteLength;if(u<o){yield s;return}let c=0,f;for(;c<u;)f=c+o,yield s.slice(c,f),c=f},Um=async function*(s,o){for await(const u of $m(s))yield*Im(u,o)},$m=async function*(s){if(s[Symbol.asyncIterator]){yield*s;return}const o=s.getReader();try{for(;;){const{done:u,value:c}=await o.read();if(u)break;yield c}}finally{await o.cancel()}},Oc=(s,o,u,c)=>{const f=Um(s,o);let p=0,m,v=C=>{m||(m=!0,c&&c(C))};return new ReadableStream({async pull(C){try{const{done:N,value:x}=await f.next();if(N){v(),C.close();return}let z=x.byteLength;if(u){let U=p+=z;u(U)}C.enqueue(new Uint8Array(x))}catch(N){throw v(N),N}},cancel(C){return v(C),f.return()}},{highWaterMark:2})},Lc=64*1024,{isFunction:Xl}=k,Bm=(({Request:s,Response:o})=>({Request:s,Response:o}))(k.global),{ReadableStream:Ac,TextEncoder:zc}=k.global,Dc=(s,...o)=>{try{return!!s(...o)}catch{return!1}},Hm=s=>{s=k.merge.call({skipUndefined:!0},Bm,s);const{fetch:o,Request:u,Response:c}=s,f=o?Xl(o):typeof fetch=="function",p=Xl(u),m=Xl(c);if(!f)return!1;const v=f&&Xl(Ac),C=f&&(typeof zc=="function"?(R=>j=>R.encode(j))(new zc):async R=>new Uint8Array(await new u(R).arrayBuffer())),N=p&&v&&Dc(()=>{let R=!1;const j=new u(We.origin,{body:new Ac,method:"POST",get duplex(){return R=!0,"half"}}).headers.has("Content-Type");return R&&!j}),x=m&&v&&Dc(()=>k.isReadableStream(new c("").body)),z={stream:x&&(R=>R.body)};f&&["text","arrayBuffer","blob","formData","stream"].forEach(R=>{!z[R]&&(z[R]=(j,L)=>{let oe=j&&j[R];if(oe)return oe.call(j);throw new Y(`Response type '${R}' is not supported`,Y.ERR_NOT_SUPPORT,L)})});const U=async R=>{if(R==null)return 0;if(k.isBlob(R))return R.size;if(k.isSpecCompliantForm(R))return(await new u(We.origin,{method:"POST",body:R}).arrayBuffer()).byteLength;if(k.isArrayBufferView(R)||k.isArrayBuffer(R))return R.byteLength;if(k.isURLSearchParams(R)&&(R=R+""),k.isString(R))return(await C(R)).byteLength},Z=async(R,j)=>{const L=k.toFiniteNumber(R.getContentLength());return L??U(j)};return async R=>{let{url:j,method:L,data:oe,signal:ce,cancelToken:re,timeout:te,onDownloadProgress:he,onUploadProgress:de,responseType:se,headers:_e,withCredentials:Qe="same-origin",fetchOptions:Je}=rf(R),Ie=o||fetch;se=se?(se+"").toLowerCase():"text";let je=Mm([ce,re&&re.toAbortSignal()],te),xe=null;const Ce=je&&je.unsubscribe&&(()=>{je.unsubscribe()});let qe;try{if(de&&N&&L!=="get"&&L!=="head"&&(qe=await Z(_e,oe))!==0){let g=new u(j,{method:"POST",body:oe,duplex:"half"}),T;if(k.isFormData(oe)&&(T=g.headers.get("content-type"))&&_e.setContentType(T),g.body){const[J,X]=Pc(qe,ti(Rc(de)));oe=Oc(g.body,Lc,J,X)}}k.isString(Qe)||(Qe=Qe?"include":"omit");const fe=p&&"credentials"in u.prototype,W={...Je,signal:je,method:L.toUpperCase(),headers:_e.normalize().toJSON(),body:oe,duplex:"half",credentials:fe?Qe:void 0};xe=p&&new u(j,W);let _=await(p?Ie(xe,Je):Ie(j,W));const H=x&&(se==="stream"||se==="response");if(x&&(he||H&&Ce)){const g={};["status","statusText","headers"].forEach(ee=>{g[ee]=_[ee]});const T=k.toFiniteNumber(_.headers.get("content-length")),[J,X]=he&&Pc(T,ti(Rc(he),!0))||[];_=new c(Oc(_.body,Lc,J,()=>{X&&X(),Ce&&Ce()}),g)}se=se||"text";let F=await z[k.findKey(z,se)||"text"](_,R);return!H&&Ce&&Ce(),await new Promise((g,T)=>{tf(g,T,{data:F,headers:rt.from(_.headers),status:_.status,statusText:_.statusText,config:R,request:xe})})}catch(fe){throw Ce&&Ce(),fe&&fe.name==="TypeError"&&/Load failed|fetch/i.test(fe.message)?Object.assign(new Y("Network Error",Y.ERR_NETWORK,R,xe),{cause:fe.cause||fe}):Y.from(fe,fe&&fe.code,R,xe)}}},Vm=new Map,lf=s=>{let o=s?s.env:{};const{fetch:u,Request:c,Response:f}=o,p=[c,f,u];let m=p.length,v=m,C,N,x=Vm;for(;v--;)C=p[v],N=x.get(C),N===void 0&&x.set(C,N=v?new Map:Hm(o)),x=N;return N};lf();const ds={http:om,xhr:Fm,fetch:{get:lf}};k.forEach(ds,(s,o)=>{if(s){try{Object.defineProperty(s,"name",{value:o})}catch{}Object.defineProperty(s,"adapterName",{value:o})}});const jc=s=>`- ${s}`,Wm=s=>k.isFunction(s)||s===null||s===!1,of={getAdapter:(s,o)=>{s=k.isArray(s)?s:[s];const{length:u}=s;let c,f;const p={};for(let m=0;m<u;m++){c=s[m];let v;if(f=c,!Wm(c)&&(f=ds[(v=String(c)).toLowerCase()],f===void 0))throw new Y(`Unknown adapter '${v}'`);if(f&&(k.isFunction(f)||(f=f.get(o))))break;p[v||"#"+m]=f}if(!f){const m=Object.entries(p).map(([C,N])=>`adapter ${C} `+(N===!1?"is not supported by the environment":"is not available in the build"));let v=u?m.length>1?`since :
|
|
46
46
|
`+m.map(jc).join(`
|
|
47
47
|
`):" "+jc(m[0]):"as no adapter specified";throw new Y("There is no suitable adapter to dispatch the request "+v,"ERR_NOT_SUPPORT")}return f},adapters:ds};function us(s){if(s.cancelToken&&s.cancelToken.throwIfRequested(),s.signal&&s.signal.aborted)throw new Kn(null,s)}function Fc(s){return us(s),s.headers=rt.from(s.headers),s.data=ss.call(s,s.transformRequest),["post","put","patch"].indexOf(s.method)!==-1&&s.headers.setContentType("application/x-www-form-urlencoded",!1),of.getAdapter(s.adapter||Ir.adapter,s)(s).then(function(c){return us(s),c.data=ss.call(s,s.transformResponse,c),c.headers=rt.from(c.headers),c},function(c){return ef(c)||(us(s),c&&c.response&&(c.response.data=ss.call(s,s.transformResponse,c.response),c.response.headers=rt.from(c.response.headers))),Promise.reject(c)})}const sf="1.12.2",oi={};["object","boolean","number","function","string","symbol"].forEach((s,o)=>{oi[s]=function(c){return typeof c===s||"a"+(o<1?"n ":" ")+s}});const Mc={};oi.transitional=function(o,u,c){function f(p,m){return"[Axios v"+sf+"] Transitional option '"+p+"'"+m+(c?". "+c:"")}return(p,m,v)=>{if(o===!1)throw new Y(f(m," has been removed"+(u?" in "+u:"")),Y.ERR_DEPRECATED);return u&&!Mc[m]&&(Mc[m]=!0,console.warn(f(m," has been deprecated since v"+u+" and will be removed in the near future"))),o?o(p,m,v):!0}};oi.spelling=function(o){return(u,c)=>(console.warn(`${c} is likely a misspelling of ${o}`),!0)};function Qm(s,o,u){if(typeof s!="object")throw new Y("options must be an object",Y.ERR_BAD_OPTION_VALUE);const c=Object.keys(s);let f=c.length;for(;f-- >0;){const p=c[f],m=o[p];if(m){const v=s[p],C=v===void 0||m(v,p,s);if(C!==!0)throw new Y("option "+p+" must be "+C,Y.ERR_BAD_OPTION_VALUE);continue}if(u!==!0)throw new Y("Unknown option "+p,Y.ERR_BAD_OPTION)}}const ei={assertOptions:Qm,validators:oi},Rt=ei.validators;let vn=class{constructor(o){this.defaults=o||{},this.interceptors={request:new Nc,response:new Nc}}async request(o,u){try{return await this._request(o,u)}catch(c){if(c instanceof Error){let f={};Error.captureStackTrace?Error.captureStackTrace(f):f=new Error;const p=f.stack?f.stack.replace(/^.+\n/,""):"";try{c.stack?p&&!String(c.stack).endsWith(p.replace(/^.+\n.+\n/,""))&&(c.stack+=`
|
|
48
|
-
`+p):c.stack=p}catch{}}throw c}}_request(o,u){typeof o=="string"?(u=u||{},u.url=o):u=o||{},u=wn(this.defaults,u);const{transitional:c,paramsSerializer:f,headers:p}=u;c!==void 0&&ei.assertOptions(c,{silentJSONParsing:Rt.transitional(Rt.boolean),forcedJSONParsing:Rt.transitional(Rt.boolean),clarifyTimeoutError:Rt.transitional(Rt.boolean)},!1),f!=null&&(k.isFunction(f)?u.paramsSerializer={serialize:f}:ei.assertOptions(f,{encode:Rt.function,serialize:Rt.function},!0)),u.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?u.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:u.allowAbsoluteUrls=!0),ei.assertOptions(u,{baseUrl:Rt.spelling("baseURL"),withXsrfToken:Rt.spelling("withXSRFToken")},!0),u.method=(u.method||this.defaults.method||"get").toLowerCase();let m=p&&k.merge(p.common,p[u.method]);p&&k.forEach(["delete","get","head","post","put","patch","common"],R=>{delete p[R]}),u.headers=rt.concat(m,p);const v=[];let C=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(u)===!1||(C=C&&j.synchronous,v.unshift(j.fulfilled,j.rejected))});const N=[];this.interceptors.response.forEach(function(j){N.push(j.fulfilled,j.rejected)});let x,z=0,U;if(!C){const R=[Fc.bind(this),void 0];for(R.unshift(...v),R.push(...N),U=R.length,x=Promise.resolve(u);z<U;)x=x.then(R[z++],R[z++]);return x}U=v.length;let Z=u;for(;z<U;){const R=v[z++],j=v[z++];try{Z=R(Z)}catch(L){j.call(this,L);break}}try{x=Fc.call(this,Z)}catch(R){return Promise.reject(R)}for(z=0,U=N.length;z<U;)x=x.then(N[z++],N[z++]);return x}getUri(o){o=wn(this.defaults,o);const u=nf(o.baseURL,o.url,o.allowAbsoluteUrls);return Yc(u,o.params,o.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(o){vn.prototype[o]=function(u,c){return this.request(wn(c||{},{method:o,url:u,data:(c||{}).data}))}});k.forEach(["post","put","patch"],function(o){function u(c){return function(p,m,v){return this.request(wn(v||{},{method:o,headers:c?{"Content-Type":"multipart/form-data"}:{},url:p,data:m}))}}vn.prototype[o]=u(),vn.prototype[o+"Form"]=u(!0)});let qm=class uf{constructor(o){if(typeof o!="function")throw new TypeError("executor must be a function.");let u;this.promise=new Promise(function(p){u=p});const c=this;this.promise.then(f=>{if(!c._listeners)return;let p=c._listeners.length;for(;p-- >0;)c._listeners[p](f);c._listeners=null}),this.promise.then=f=>{let p;const m=new Promise(v=>{c.subscribe(v),p=v}).then(f);return m.cancel=function(){c.unsubscribe(p)},m},o(function(p,m,v){c.reason||(c.reason=new Kn(p,m,v),u(c.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(o){if(this.reason){o(this.reason);return}this._listeners?this._listeners.push(o):this._listeners=[o]}unsubscribe(o){if(!this._listeners)return;const u=this._listeners.indexOf(o);u!==-1&&this._listeners.splice(u,1)}toAbortSignal(){const o=new AbortController,u=c=>{o.abort(c)};return this.subscribe(u),o.signal.unsubscribe=()=>this.unsubscribe(u),o.signal}static source(){let o;return{token:new uf(function(f){o=f}),cancel:o}}};function Km(s){return function(u){return s.apply(null,u)}}function Gm(s){return k.isObject(s)&&s.isAxiosError===!0}const ps={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ps).forEach(([s,o])=>{ps[o]=s});function af(s){const o=new vn(s),u=Uc(vn.prototype.request,o);return k.extend(u,vn.prototype,o,{allOwnKeys:!0}),k.extend(u,o,null,{allOwnKeys:!0}),u.create=function(f){return af(wn(s,f))},u}const Pe=af(Ir);Pe.Axios=vn;Pe.CanceledError=Kn;Pe.CancelToken=qm;Pe.isCancel=ef;Pe.VERSION=sf;Pe.toFormData=ii;Pe.AxiosError=Y;Pe.Cancel=Pe.CanceledError;Pe.all=function(o){return Promise.all(o)};Pe.spread=Km;Pe.isAxiosError=Gm;Pe.mergeConfig=wn;Pe.AxiosHeaders=rt;Pe.formToJSON=s=>bc(k.isHTMLForm(s)?new FormData(s):s);Pe.getAdapter=of.getAdapter;Pe.HttpStatusCode=ps;Pe.default=Pe;const{Axios:bm,AxiosError:eh,CanceledError:th,isCancel:nh,CancelToken:rh,VERSION:lh,all:ih,Cancel:oh,isAxiosError:sh,spread:uh,toFormData:ah,AxiosHeaders:ch,HttpStatusCode:fh,formToJSON:dh,getAdapter:ph,mergeConfig:mh}=Pe;class Yl{constructor(o){yn(this,"axiosInstance");this.axiosInstance=o}async getOData(o,u){try{return u?(await window.dataverseAPI.queryData(o)).value:(await this.axiosInstance.get("/"+o)).data.value}catch(c){throw console.error("Error fetching OData:",c),c}}}class Ic{constructor(o,u){yn(this,"axiosInstance");yn(this,"environmentUrl");yn(this,"apiVersion");yn(this,"isPPTB");this.environmentUrl=o.environmentUrl.replace(/\/$/,""),this.apiVersion=o.apiVersion||"9.2",this.isPPTB=u,this.axiosInstance=Pe.create({baseURL:`${this.environmentUrl}/api/data/v${this.apiVersion}`,headers:{Authorization:`Bearer ${o.accessToken}`,Accept:"application/json","Content-Type":"application/json","OData-MaxVersion":"4.0","OData-Version":"4.0"}})}async fetchSolution(o){var u,c,f;try{const p=new Yl(this.axiosInstance),m=await p.getOData(`solutions?$filter=uniquename eq '${o}'&$select=solutionid,friendlyname,uniquename,_publisherid_value,version&$expand=publisherid($select=customizationprefix)`,this.isPPTB);if(console.log("Solution Metadata",m),!m||m.length===0)throw new Error(`Solution '${o}' not found`);const v=m[0];console.log("Solution Data",v);const C=((u=v.publisherid)==null?void 0:u.customizationprefix)??"unknown",N=await p.getOData(`solutioncomponents?$filter=_solutionid_value eq ${v.solutionid} and componenttype eq 1&$select=objectid`,this.isPPTB);console.log("Component List",N);const x=N.map(U=>U.objectid);console.log("Table IDs",x);const z=await this.fetchTables(x);return console.log("Tables",z),{uniqueName:v.uniquename,displayName:v.friendlyname,version:v.version,publisherPrefix:C,tables:z}}catch(p){throw p.response?new Error(`Dataverse API error: ${p.response.status} - ${((f=(c=p.response.data)==null?void 0:c.error)==null?void 0:f.message)||p.message}`):p}}async fetchTables(o){const u=[];for(const c of o)try{const f=await this.fetchTable(c);f&&u.push(f)}catch(f){console.warn(`Failed to fetch table ${c}:`,f)}return u}async fetchTable(o){try{const u=new Yl(this.axiosInstance),c=await window.dataverseAPI.getEntityMetadata(o,!1,["LogicalName","DisplayName","SchemaName","PrimaryIdAttribute","PrimaryNameAttribute","TableType","IsIntersect"]);console.log("Entity Metadata",c);const f=await u.getOData(`EntityDefinitions(${o})/Attributes?$select=LogicalName,DisplayName,AttributeType,IsPrimaryId,IsPrimaryName,RequiredLevel`,this.isPPTB);console.log("Entity Attributes",f);const p=f.map(v=>{var C,N,x,z;return{logicalName:v.LogicalName,displayName:((N=(C=v.DisplayName)==null?void 0:C.UserLocalizedLabel)==null?void 0:N.Label)||v.LogicalName,type:this.mapAttributeType(v.AttributeType),isPrimaryId:v.IsPrimaryId||!1,isPrimaryName:v.IsPrimaryName||!1,isRequired:((x=v.RequiredLevel)==null?void 0:x.Value)==="ApplicationRequired"||((z=v.RequiredLevel)==null?void 0:z.Value)==="SystemRequired"}}),m=await this.fetchRelationships(o,c.LogicalName);return{logicalName:c.LogicalName,displayName:c.LogicalName,schemaName:c.SchemaName,primaryIdAttribute:c.PrimaryIdAttribute,primaryNameAttribute:c.PrimaryNameAttribute,isIntersect:c.IsIntersect||!1,tableType:c.TableType,attributes:p,relationships:m}}catch(u){return console.warn(`Failed to fetch table metadata for ${o}:`,u),null}}async fetchRelationships(o,u){const c=[],f=new Yl(this.axiosInstance);try{const p=await f.getOData(`EntityDefinitions(${o})/OneToManyRelationships?$select=SchemaName,ReferencedEntity,ReferencingEntity,ReferencingAttribute`,this.isPPTB);console.log("One-to-Many Relationships",p);for(const C of p)C.ReferencedEntity===u&&c.push({schemaName:C.SchemaName,type:"OneToMany",relatedTable:C.ReferencingEntity,lookupAttribute:C.ReferencingAttribute});const m=await f.getOData(`EntityDefinitions(${o})/ManyToOneRelationships?$select=SchemaName,ReferencedEntity,ReferencingEntity,ReferencingAttribute`,this.isPPTB);console.log("Many-to-One Relationships",m);for(const C of m)C.ReferencingEntity===u&&c.push({schemaName:C.SchemaName,type:"ManyToOne",relatedTable:C.ReferencedEntity,lookupAttribute:C.ReferencingAttribute});const v=await f.getOData(`EntityDefinitions(${o})/ManyToManyRelationships?$select=SchemaName,Entity1LogicalName,Entity2LogicalName,IntersectEntityName`,this.isPPTB);console.log("Many-to-Many Relationships",v);for(const C of v){const N=C.Entity1LogicalName===u;c.push({schemaName:C.SchemaName,type:"ManyToMany",relatedTable:N?C.Entity2LogicalName:C.Entity1LogicalName,intersectTable:C.IntersectEntityName})}}catch(p){console.warn(`Failed to fetch relationships for ${u}:`,p)}return c}mapAttributeType(o){return{String:"string",Memo:"string",Integer:"int",BigInt:"int",Decimal:"decimal",Double:"decimal",Money:"money",DateTime:"datetime",Boolean:"boolean",Lookup:"lookup",Customer:"lookup",Owner:"lookup",Picklist:"picklist",State:"picklist",Status:"picklist",Uniqueidentifier:"guid"}[o]||"string"}async listSolutions(){var o,u;try{const f=await new Yl(this.axiosInstance).getOData("solutions?$select=uniquename,friendlyname,version&$filter=isvisible eq true&$orderby=friendlyname asc",this.isPPTB);return console.log("Solutions",f),f.map(p=>({uniqueName:p.uniquename,displayName:p.friendlyname,version:p.version}))}catch(c){throw c.response?new Error(`Dataverse API error: ${c.response.status} - ${((u=(o=c.response.data)==null?void 0:o.error)==null?void 0:u.message)||c.message}`):c}}}function Jm(){const[s,o]=Ve.useState(!1),[u,c]=Ve.useState(""),[f,p]=Ve.useState(""),[m,v]=Ve.useState([]),[C,N]=Ve.useState(""),[x,z]=Ve.useState("mermaid"),[U,Z]=Ve.useState(!0),[R,j]=Ve.useState(""),[L,oe]=Ve.useState(""),[ce,re]=Ve.useState("text"),[te,he]=Ve.useState(!0),[de,se]=Ve.useState(!0),[_e,Qe]=Ve.useState(10);Ve.useEffect(()=>{(async()=>{if(typeof window.acquireVsCodeApi<"u"){o(!1),Z(!0);const _=H=>{const F=H.data;F.command==="setCredentials"&&(c(F.environmentUrl),p(F.accessToken),Z(!1))};return window.addEventListener("message",_),()=>{window.removeEventListener("message",_)}}else if(window.toolboxAPI){o(!0);try{const _=await window.toolboxAPI.connections.getActiveConnection();c((_==null?void 0:_.url)||"")}catch(_){console.error("Failed to get tool context:",_)}Z(!1)}else j("Not running in supported environment (DVDT or PPTB)"),Z(!1)})()},[]),Ve.useEffect(()=>{u&&Je()},[u]);const Je=async()=>{try{const _=await new Ic({environmentUrl:u,accessToken:f},s).listSolutions();v(_)}catch(W){Ie(`Failed to load solutions: ${W.message}`)}},Ie=W=>{j(W),setTimeout(()=>j(""),5e3)},je=async()=>{if(!C){Ie("Please select a solution first");return}try{Z(!0);const _=await new Ic({environmentUrl:u,accessToken:f},s).fetchSolution(C),F=new Sp({format:x,includeAttributes:te,includeRelationships:de,maxAttributesPerTable:_e}).generate(_);oe(F),s&&await window.toolboxAPI.utils.showNotification({title:"Success",body:"ERD generated successfully",type:"success"})}catch(W){Ie(`Failed to generate ERD: ${W.message}`)}finally{Z(!1)}},xe=async()=>{if(!L)return;const _=`${C}-erd.${{mermaid:"mmd",plantuml:"puml",graphviz:"dot"}[x]}`;try{s&&await window.toolboxAPI.utils.saveFile(_,L)&&await window.toolboxAPI.utils.showNotification({title:"Success",body:"File saved successfully",type:"success"})}catch(H){Ie(`Failed to save file: ${H.message}`)}},Ce=async()=>{if(L)try{s&&(await window.toolboxAPI.utils.copyToClipboard(L),await window.toolboxAPI.utils.showNotification({title:"Success",body:"Copied to clipboard",type:"success"}))}catch(W){Ie(`Failed to copy: ${W.message}`)}},qe=async()=>{if(window.mermaid)return;const W=await wp(()=>import("./mermaid.core.js").then(H=>H.b8),[]),_=W.default??W;_.initialize({startOnLoad:!1,theme:"default",themeVariables:{primaryColor:"#0e639c",primaryTextColor:"#fff",primaryBorderColor:"#0a4f7c",lineColor:"#0e639c",secondaryColor:"#f3f4f6",tertiaryColor:"#e5e7eb"}}),window.mermaid=_},fe=()=>L?ce==="visual"&&x==="mermaid"?Q.jsx("div",{className:"mermaid",ref:W=>{(async()=>{if(W)try{W.textContent=L,await qe(),window.mermaid&&window.mermaid.init(void 0,W)}catch(_){console.error("Mermaid rendering error:",_)}})()}}):Q.jsx("pre",{className:"diagram-text",children:L}):null;return U?Q.jsx("div",{className:"container",children:Q.jsx("div",{className:"loading",children:"Loading..."})}):Q.jsxs("div",{className:"container",children:[Q.jsxs("header",{className:"header",children:[Q.jsx("h1",{children:"🗺️ Dataverse ERD Generator"}),Q.jsx("p",{children:"Generate Entity Relationship Diagrams from your Dataverse solutions"})]}),R&&Q.jsx("div",{className:"error",children:R}),Q.jsxs("div",{className:"card",children:[Q.jsxs("div",{className:"info-message",children:[Q.jsx("strong",{children:"✓ Connected to Dataverse"}),Q.jsx("br",{}),"Environment: ",Q.jsx("span",{children:u||"Not connected"})]}),Q.jsxs("div",{className:"form-group",children:[Q.jsx("label",{htmlFor:"solutionSelect",children:"Select a Solution"}),Q.jsxs("select",{id:"solutionSelect",value:C,onChange:W=>N(W.target.value),disabled:m.length===0,children:[Q.jsx("option",{value:"",children:"-- Select a Solution --"}),m.map(W=>Q.jsxs("option",{value:W.uniqueName,children:[W.displayName," (",W.version,")"]},W.uniqueName))]})]}),Q.jsxs("div",{className:"generate-section",children:[Q.jsx("h2",{children:"Generate ERD"}),Q.jsxs("div",{className:"format-selector",children:[Q.jsx("label",{style:{fontWeight:600,marginRight:"10px"},children:"Output Format:"}),Q.jsx("button",{className:`format-btn ${x==="mermaid"?"active":""}`,onClick:()=>z("mermaid"),children:"Mermaid"}),Q.jsx("button",{className:`format-btn ${x==="plantuml"?"active":""}`,onClick:()=>z("plantuml"),children:"PlantUML"}),Q.jsx("button",{className:`format-btn ${x==="graphviz"?"active":""}`,onClick:()=>z("graphviz"),children:"Graphviz"})]}),Q.jsxs("div",{className:"config-section",children:[Q.jsx("h3",{children:"Configuration"}),Q.jsxs("div",{className:"config-group",children:[Q.jsxs("label",{children:[Q.jsx("input",{type:"checkbox",checked:te,onChange:W=>he(W.target.checked)}),Q.jsx("span",{children:"Include Attributes"})]}),Q.jsx("div",{className:"config-help",children:"Show table columns/fields in the diagram"})]}),Q.jsxs("div",{className:"config-group",children:[Q.jsxs("label",{children:[Q.jsx("input",{type:"checkbox",checked:de,onChange:W=>se(W.target.checked)}),Q.jsx("span",{children:"Include Relationships"})]}),Q.jsx("div",{className:"config-help",children:"Show relationships between tables"})]}),Q.jsxs("div",{className:"config-group",children:[Q.jsxs("div",{className:"config-label-group",children:[Q.jsx("label",{htmlFor:"maxAttributesInput",children:"Max Attributes per Table:"}),Q.jsx("input",{type:"number",id:"maxAttributesInput",value:_e,onChange:W=>Qe(parseInt(W.target.value)||0),min:"0",max:"100"})]}),Q.jsx("div",{className:"config-help",children:"Maximum number of attributes to display per table (0 = show all)"})]})]}),Q.jsx("button",{className:"btn btn-primary",onClick:je,disabled:!C||U,children:"Generate ERD"})]})]}),L&&Q.jsxs("div",{className:"card",children:[Q.jsx("h2",{children:"Generated ERD"}),Q.jsxs("div",{className:"diagram-controls",children:[x==="mermaid"&&Q.jsx("button",{className:"btn btn-secondary",onClick:()=>re(ce==="visual"?"text":"visual"),children:ce==="visual"?"📝 Show Text":"🎨 Show Visual"}),Q.jsx("button",{className:"btn btn-secondary",onClick:xe,children:"📥 Download Source"}),Q.jsx("button",{className:"btn btn-secondary",onClick:Ce,children:"📋 Copy to Clipboard"})]}),Q.jsx("div",{className:"diagram-container",children:fe()})]})]})}yp.createRoot(document.getElementById("root")).render(Q.jsx(Ve.StrictMode,{children:Q.jsx(Jm,{})}));export{wp as _};
|
|
48
|
+
`+p):c.stack=p}catch{}}throw c}}_request(o,u){typeof o=="string"?(u=u||{},u.url=o):u=o||{},u=wn(this.defaults,u);const{transitional:c,paramsSerializer:f,headers:p}=u;c!==void 0&&ei.assertOptions(c,{silentJSONParsing:Rt.transitional(Rt.boolean),forcedJSONParsing:Rt.transitional(Rt.boolean),clarifyTimeoutError:Rt.transitional(Rt.boolean)},!1),f!=null&&(k.isFunction(f)?u.paramsSerializer={serialize:f}:ei.assertOptions(f,{encode:Rt.function,serialize:Rt.function},!0)),u.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?u.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:u.allowAbsoluteUrls=!0),ei.assertOptions(u,{baseUrl:Rt.spelling("baseURL"),withXsrfToken:Rt.spelling("withXSRFToken")},!0),u.method=(u.method||this.defaults.method||"get").toLowerCase();let m=p&&k.merge(p.common,p[u.method]);p&&k.forEach(["delete","get","head","post","put","patch","common"],R=>{delete p[R]}),u.headers=rt.concat(m,p);const v=[];let C=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(u)===!1||(C=C&&j.synchronous,v.unshift(j.fulfilled,j.rejected))});const N=[];this.interceptors.response.forEach(function(j){N.push(j.fulfilled,j.rejected)});let x,z=0,U;if(!C){const R=[Fc.bind(this),void 0];for(R.unshift(...v),R.push(...N),U=R.length,x=Promise.resolve(u);z<U;)x=x.then(R[z++],R[z++]);return x}U=v.length;let Z=u;for(;z<U;){const R=v[z++],j=v[z++];try{Z=R(Z)}catch(L){j.call(this,L);break}}try{x=Fc.call(this,Z)}catch(R){return Promise.reject(R)}for(z=0,U=N.length;z<U;)x=x.then(N[z++],N[z++]);return x}getUri(o){o=wn(this.defaults,o);const u=nf(o.baseURL,o.url,o.allowAbsoluteUrls);return Yc(u,o.params,o.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(o){vn.prototype[o]=function(u,c){return this.request(wn(c||{},{method:o,url:u,data:(c||{}).data}))}});k.forEach(["post","put","patch"],function(o){function u(c){return function(p,m,v){return this.request(wn(v||{},{method:o,headers:c?{"Content-Type":"multipart/form-data"}:{},url:p,data:m}))}}vn.prototype[o]=u(),vn.prototype[o+"Form"]=u(!0)});let qm=class uf{constructor(o){if(typeof o!="function")throw new TypeError("executor must be a function.");let u;this.promise=new Promise(function(p){u=p});const c=this;this.promise.then(f=>{if(!c._listeners)return;let p=c._listeners.length;for(;p-- >0;)c._listeners[p](f);c._listeners=null}),this.promise.then=f=>{let p;const m=new Promise(v=>{c.subscribe(v),p=v}).then(f);return m.cancel=function(){c.unsubscribe(p)},m},o(function(p,m,v){c.reason||(c.reason=new Kn(p,m,v),u(c.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(o){if(this.reason){o(this.reason);return}this._listeners?this._listeners.push(o):this._listeners=[o]}unsubscribe(o){if(!this._listeners)return;const u=this._listeners.indexOf(o);u!==-1&&this._listeners.splice(u,1)}toAbortSignal(){const o=new AbortController,u=c=>{o.abort(c)};return this.subscribe(u),o.signal.unsubscribe=()=>this.unsubscribe(u),o.signal}static source(){let o;return{token:new uf(function(f){o=f}),cancel:o}}};function Km(s){return function(u){return s.apply(null,u)}}function Gm(s){return k.isObject(s)&&s.isAxiosError===!0}const ps={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ps).forEach(([s,o])=>{ps[o]=s});function af(s){const o=new vn(s),u=Uc(vn.prototype.request,o);return k.extend(u,vn.prototype,o,{allOwnKeys:!0}),k.extend(u,o,null,{allOwnKeys:!0}),u.create=function(f){return af(wn(s,f))},u}const Pe=af(Ir);Pe.Axios=vn;Pe.CanceledError=Kn;Pe.CancelToken=qm;Pe.isCancel=ef;Pe.VERSION=sf;Pe.toFormData=ii;Pe.AxiosError=Y;Pe.Cancel=Pe.CanceledError;Pe.all=function(o){return Promise.all(o)};Pe.spread=Km;Pe.isAxiosError=Gm;Pe.mergeConfig=wn;Pe.AxiosHeaders=rt;Pe.formToJSON=s=>bc(k.isHTMLForm(s)?new FormData(s):s);Pe.getAdapter=of.getAdapter;Pe.HttpStatusCode=ps;Pe.default=Pe;const{Axios:bm,AxiosError:eh,CanceledError:th,isCancel:nh,CancelToken:rh,VERSION:lh,all:ih,Cancel:oh,isAxiosError:sh,spread:uh,toFormData:ah,AxiosHeaders:ch,HttpStatusCode:fh,formToJSON:dh,getAdapter:ph,mergeConfig:mh}=Pe;class Yl{constructor(o){yn(this,"axiosInstance");this.axiosInstance=o}async getOData(o,u){try{return u?(await window.dataverseAPI.queryData(o)).value:(await this.axiosInstance.get("/"+o)).data.value}catch(c){throw console.error("Error fetching OData:",c),c}}}class Ic{constructor(o,u){yn(this,"axiosInstance");yn(this,"environmentUrl");yn(this,"apiVersion");yn(this,"isPPTB");this.environmentUrl=o.environmentUrl.replace(/\/$/,""),this.apiVersion=o.apiVersion||"9.2",this.isPPTB=u,this.axiosInstance=Pe.create({baseURL:`${this.environmentUrl}/api/data/v${this.apiVersion}`,headers:{Authorization:`Bearer ${o.accessToken}`,Accept:"application/json","Content-Type":"application/json","OData-MaxVersion":"4.0","OData-Version":"4.0"}})}async fetchSolution(o){var u,c,f;try{const p=new Yl(this.axiosInstance),m=await p.getOData(`solutions?$filter=uniquename eq '${o}'&$select=solutionid,friendlyname,uniquename,_publisherid_value,version&$expand=publisherid($select=customizationprefix)`,this.isPPTB);if(console.log("Solution Metadata",m),!m||m.length===0)throw new Error(`Solution '${o}' not found`);const v=m[0];console.log("Solution Data",v);const C=((u=v.publisherid)==null?void 0:u.customizationprefix)??"unknown",N=await p.getOData(`solutioncomponents?$filter=_solutionid_value eq ${v.solutionid} and componenttype eq 1&$select=objectid`,this.isPPTB);console.log("Component List",N);const x=N.map(U=>U.objectid);console.log("Table IDs",x);const z=await this.fetchTables(x);return console.log("Tables",z),{uniqueName:v.uniquename,displayName:v.friendlyname,version:v.version,publisherPrefix:C,tables:z}}catch(p){throw p.response?new Error(`Dataverse API error: ${p.response.status} - ${((f=(c=p.response.data)==null?void 0:c.error)==null?void 0:f.message)||p.message}`):p}}async fetchTables(o){const u=[];for(const c of o)try{const f=await this.fetchTable(c);f&&u.push(f)}catch(f){console.warn(`Failed to fetch table ${c}:`,f)}return u}async fetchTable(o){try{const u=new Yl(this.axiosInstance),c=await window.dataverseAPI.getEntityMetadata(o,!1,["LogicalName","DisplayName","SchemaName","PrimaryIdAttribute","PrimaryNameAttribute","TableType","IsIntersect"]);console.log("Entity Metadata",c);const f=await u.getOData(`EntityDefinitions(${o})/Attributes?$select=LogicalName,DisplayName,AttributeType,IsPrimaryId,IsPrimaryName,RequiredLevel`,this.isPPTB);console.log("Entity Attributes",f);const p=f.map(v=>{var C,N,x,z;return{logicalName:v.LogicalName,displayName:((N=(C=v.DisplayName)==null?void 0:C.UserLocalizedLabel)==null?void 0:N.Label)||v.LogicalName,type:this.mapAttributeType(v.AttributeType),isPrimaryId:v.IsPrimaryId||!1,isPrimaryName:v.IsPrimaryName||!1,isRequired:((x=v.RequiredLevel)==null?void 0:x.Value)==="ApplicationRequired"||((z=v.RequiredLevel)==null?void 0:z.Value)==="SystemRequired"}}),m=await this.fetchRelationships(o,c.LogicalName);return{logicalName:c.LogicalName,displayName:c.LogicalName,schemaName:c.SchemaName,primaryIdAttribute:c.PrimaryIdAttribute,primaryNameAttribute:c.PrimaryNameAttribute,isIntersect:c.IsIntersect||!1,tableType:c.TableType,attributes:p,relationships:m}}catch(u){return console.warn(`Failed to fetch table metadata for ${o}:`,u),null}}async fetchRelationships(o,u){const c=[],f=new Yl(this.axiosInstance);try{const p=await f.getOData(`EntityDefinitions(${o})/OneToManyRelationships?$select=SchemaName,ReferencedEntity,ReferencingEntity,ReferencingAttribute`,this.isPPTB);console.log("One-to-Many Relationships",p);for(const C of p)C.ReferencedEntity===u&&c.push({schemaName:C.SchemaName,type:"OneToMany",relatedTable:C.ReferencingEntity,lookupAttribute:C.ReferencingAttribute});const m=await f.getOData(`EntityDefinitions(${o})/ManyToOneRelationships?$select=SchemaName,ReferencedEntity,ReferencingEntity,ReferencingAttribute`,this.isPPTB);console.log("Many-to-One Relationships",m);for(const C of m)C.ReferencingEntity===u&&c.push({schemaName:C.SchemaName,type:"ManyToOne",relatedTable:C.ReferencedEntity,lookupAttribute:C.ReferencingAttribute});const v=await f.getOData(`EntityDefinitions(${o})/ManyToManyRelationships?$select=SchemaName,Entity1LogicalName,Entity2LogicalName,IntersectEntityName`,this.isPPTB);console.log("Many-to-Many Relationships",v);for(const C of v){const N=C.Entity1LogicalName===u;c.push({schemaName:C.SchemaName,type:"ManyToMany",relatedTable:N?C.Entity2LogicalName:C.Entity1LogicalName,intersectTable:C.IntersectEntityName})}}catch(p){console.warn(`Failed to fetch relationships for ${u}:`,p)}return c}mapAttributeType(o){return{String:"string",Memo:"string",Integer:"int",BigInt:"int",Decimal:"decimal",Double:"decimal",Money:"money",DateTime:"datetime",Boolean:"boolean",Lookup:"lookup",Customer:"lookup",Owner:"lookup",Picklist:"picklist",State:"picklist",Status:"picklist",Uniqueidentifier:"guid"}[o]||"string"}async listSolutions(){var o,u;try{const f=await new Yl(this.axiosInstance).getOData("solutions?$select=uniquename,friendlyname,version&$filter=isvisible eq true&$orderby=friendlyname asc",this.isPPTB);return console.log("Solutions",f),f.map(p=>({uniqueName:p.uniquename,displayName:p.friendlyname,version:p.version}))}catch(c){throw c.response?new Error(`Dataverse API error: ${c.response.status} - ${((u=(o=c.response.data)==null?void 0:o.error)==null?void 0:u.message)||c.message}`):c}}}function Jm(){const[s,o]=Ve.useState(!1),[u,c]=Ve.useState(""),[f,p]=Ve.useState(""),[m,v]=Ve.useState([]),[C,N]=Ve.useState(""),[x,z]=Ve.useState("mermaid"),[U,Z]=Ve.useState(!0),[R,j]=Ve.useState(""),[L,oe]=Ve.useState(""),[ce,re]=Ve.useState("text"),[te,he]=Ve.useState(!0),[de,se]=Ve.useState(!0),[_e,Qe]=Ve.useState(10);Ve.useEffect(()=>{(async()=>{if(typeof window.acquireVsCodeApi<"u"){o(!1),Z(!0);const _=H=>{const F=H.data;F.command==="setCredentials"&&(c(F.environmentUrl),p(F.accessToken),Z(!1))};return window.addEventListener("message",_),()=>{window.removeEventListener("message",_)}}else if(window.toolboxAPI){o(!0);try{const _=await window.toolboxAPI.connections.getActiveConnection();c((_==null?void 0:_.url)||"")}catch(_){console.error("Failed to get tool context:",_)}Z(!1)}else j("Not running in supported environment (DVDT or PPTB)"),Z(!1)})()},[]),Ve.useEffect(()=>{u&&Je()},[u]);const Je=async()=>{try{const _=await new Ic({environmentUrl:u,accessToken:f},s).listSolutions();v(_)}catch(W){Ie(`Failed to load solutions: ${W.message}`)}},Ie=W=>{j(W),setTimeout(()=>j(""),5e3)},je=async()=>{if(!C){Ie("Please select a solution first");return}try{Z(!0);const _=await new Ic({environmentUrl:u,accessToken:f},s).fetchSolution(C),F=new Sp({format:x,includeAttributes:te,includeRelationships:de,maxAttributesPerTable:_e}).generate(_);oe(F),s&&await window.toolboxAPI.utils.showNotification({title:"Success",body:"ERD generated successfully",type:"success"})}catch(W){Ie(`Failed to generate ERD: ${W.message}`)}finally{Z(!1)}},xe=async()=>{if(!L)return;const _=`${C}-erd.${{mermaid:"mmd",plantuml:"puml",graphviz:"dot"}[x]}`;try{s&&await window.toolboxAPI.utils.saveFile(_,L)&&await window.toolboxAPI.utils.showNotification({title:"Success",body:"File saved successfully",type:"success"})}catch(H){Ie(`Failed to save file: ${H.message}`)}},Ce=async()=>{if(L)try{s&&(await window.toolboxAPI.utils.copyToClipboard(L),await window.toolboxAPI.utils.showNotification({title:"Success",body:"Copied to clipboard",type:"success"}))}catch(W){Ie(`Failed to copy: ${W.message}`)}},qe=async()=>{if(window.mermaid)return;const W=await wp(()=>import("./mermaid.core.js").then(H=>H.bD),[]),_=W.default??W;_.initialize({startOnLoad:!1,theme:"default",themeVariables:{primaryColor:"#0e639c",primaryTextColor:"#fff",primaryBorderColor:"#0a4f7c",lineColor:"#0e639c",secondaryColor:"#f3f4f6",tertiaryColor:"#e5e7eb"}}),window.mermaid=_},fe=()=>L?ce==="visual"&&x==="mermaid"?Q.jsx("div",{className:"mermaid",ref:W=>{(async()=>{if(W)try{W.textContent=L,await qe(),window.mermaid&&window.mermaid.init(void 0,W)}catch(_){console.error("Mermaid rendering error:",_)}})()}}):Q.jsx("pre",{className:"diagram-text",children:L}):null;return U?Q.jsx("div",{className:"container",children:Q.jsx("div",{className:"loading",children:"Loading..."})}):Q.jsxs("div",{className:"container",children:[Q.jsxs("header",{className:"header",children:[Q.jsx("h1",{children:"🗺️ Dataverse ERD Generator"}),Q.jsx("p",{children:"Generate Entity Relationship Diagrams from your Dataverse solutions"})]}),R&&Q.jsx("div",{className:"error",children:R}),Q.jsxs("div",{className:"card",children:[Q.jsxs("div",{className:"info-message",children:[Q.jsx("strong",{children:"✓ Connected to Dataverse"}),Q.jsx("br",{}),"Environment: ",Q.jsx("span",{children:u||"Not connected"})]}),Q.jsxs("div",{className:"form-group",children:[Q.jsx("label",{htmlFor:"solutionSelect",children:"Select a Solution"}),Q.jsxs("select",{id:"solutionSelect",value:C,onChange:W=>N(W.target.value),disabled:m.length===0,children:[Q.jsx("option",{value:"",children:"-- Select a Solution --"}),m.map(W=>Q.jsxs("option",{value:W.uniqueName,children:[W.displayName," (",W.version,")"]},W.uniqueName))]})]}),Q.jsxs("div",{className:"generate-section",children:[Q.jsx("h2",{children:"Generate ERD"}),Q.jsxs("div",{className:"format-selector",children:[Q.jsx("label",{style:{fontWeight:600,marginRight:"10px"},children:"Output Format:"}),Q.jsx("button",{className:`format-btn ${x==="mermaid"?"active":""}`,onClick:()=>z("mermaid"),children:"Mermaid"}),Q.jsx("button",{className:`format-btn ${x==="plantuml"?"active":""}`,onClick:()=>z("plantuml"),children:"PlantUML"}),Q.jsx("button",{className:`format-btn ${x==="graphviz"?"active":""}`,onClick:()=>z("graphviz"),children:"Graphviz"})]}),Q.jsxs("div",{className:"config-section",children:[Q.jsx("h3",{children:"Configuration"}),Q.jsxs("div",{className:"config-group",children:[Q.jsxs("label",{children:[Q.jsx("input",{type:"checkbox",checked:te,onChange:W=>he(W.target.checked)}),Q.jsx("span",{children:"Include Attributes"})]}),Q.jsx("div",{className:"config-help",children:"Show table columns/fields in the diagram"})]}),Q.jsxs("div",{className:"config-group",children:[Q.jsxs("label",{children:[Q.jsx("input",{type:"checkbox",checked:de,onChange:W=>se(W.target.checked)}),Q.jsx("span",{children:"Include Relationships"})]}),Q.jsx("div",{className:"config-help",children:"Show relationships between tables"})]}),Q.jsxs("div",{className:"config-group",children:[Q.jsxs("div",{className:"config-label-group",children:[Q.jsx("label",{htmlFor:"maxAttributesInput",children:"Max Attributes per Table:"}),Q.jsx("input",{type:"number",id:"maxAttributesInput",value:_e,onChange:W=>Qe(parseInt(W.target.value)||0),min:"0",max:"100"})]}),Q.jsx("div",{className:"config-help",children:"Maximum number of attributes to display per table (0 = show all)"})]})]}),Q.jsx("button",{className:"btn btn-primary",onClick:je,disabled:!C||U,children:"Generate ERD"})]})]}),L&&Q.jsxs("div",{className:"card",children:[Q.jsx("h2",{children:"Generated ERD"}),Q.jsxs("div",{className:"diagram-controls",children:[x==="mermaid"&&Q.jsx("button",{className:"btn btn-secondary",onClick:()=>re(ce==="visual"?"text":"visual"),children:ce==="visual"?"📝 Show Text":"🎨 Show Visual"}),Q.jsx("button",{className:"btn btn-secondary",onClick:xe,children:"📥 Download Source"}),Q.jsx("button",{className:"btn btn-secondary",onClick:Ce,children:"📋 Copy to Clipboard"})]}),Q.jsx("div",{className:"diagram-container",children:fe()})]})]})}yp.createRoot(document.getElementById("root")).render(Q.jsx(Ve.StrictMode,{children:Q.jsx(Jm,{})}));export{wp as _};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e,l as s,H as n,e as i,I as p}from"./mermaid.core.js";import{p as g}from"./treemap-KMMF4GRG.js";import"./index.js";import"./_baseUniq.js";import"./_basePickBy.js";import"./clone.js";var v={parse:e(async r=>{const a=await g("info",r);s.debug(a)},"parse")},d={version:p.version+""},m=e(()=>d.version,"getVersion"),c={getVersion:m},l=e((r,a,o)=>{s.debug(`rendering info diagram
|
|
2
|
+
`+r);const t=n(a);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${o}`)},"draw"),f={draw:l},z={parser:v,db:c,renderer:f};export{z as diagram};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import{a as gt,g as lt,f as mt,d as xt}from"./chunk-TZMSLE5B.js";import{g as kt}from"./chunk-FMBD7UC4.js";import{_ as n,g as _t,s as vt,a as bt,b as wt,q as Tt,p as St,c as R,d as X,e as $t,y as Mt}from"./mermaid.core.js";import{d as et}from"./arc.js";import"./index.js";var U=(function(){var t=n(function(h,i,a,l){for(a=a||{},l=h.length;l--;a[h[l]]=i);return a},"o"),e=[6,8,10,11,12,14,16,17,18],s=[1,9],c=[1,10],r=[1,11],f=[1,12],u=[1,13],y=[1,14],g={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:n(function(i,a,l,d,p,o,b){var k=o.length-1;switch(p){case 1:return o[k-1];case 2:this.$=[];break;case 3:o[k-1].push(o[k]),this.$=o[k-1];break;case 4:case 5:this.$=o[k];break;case 6:case 7:this.$=[];break;case 8:d.setDiagramTitle(o[k].substr(6)),this.$=o[k].substr(6);break;case 9:this.$=o[k].trim(),d.setAccTitle(this.$);break;case 10:case 11:this.$=o[k].trim(),d.setAccDescription(this.$);break;case 12:d.addSection(o[k].substr(8)),this.$=o[k].substr(8);break;case 13:d.addTask(o[k-1],o[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:s,12:c,14:r,16:f,17:u,18:y},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:s,12:c,14:r,16:f,17:u,18:y},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:n(function(i,a){if(a.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=a,l}},"parseError"),parse:n(function(i){var a=this,l=[0],d=[],p=[null],o=[],b=this.table,k="",C=0,K=0,dt=2,Q=1,yt=o.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(i,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;o.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,p.length=p.length-w,o.length=o.length-w}n(pt,"popStack");function D(){var w;return w=d.pop()||_.lex()||Q,typeof w!="number"&&(w instanceof Array&&(d=w,w=d.pop()),w=a.symbols_[w]||w),w}n(D,"lex");for(var v,A,T,q,F={},N,M,tt,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((v===null||typeof v>"u")&&(v=D()),T=b[A]&&b[A][v]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in b[A])this.terminals_[N]&&N>dt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`:
|
|
2
|
+
`+_.showPosition()+`
|
|
3
|
+
Expecting `+z.join(", ")+", got '"+(this.terminals_[v]||v)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(v==Q?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[v]||v,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+v);switch(T[0]){case 1:l.push(v),p.push(_.yytext),o.push(_.yylloc),l.push(T[1]),v=null,K=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=p[p.length-M],F._$={first_line:o[o.length-(M||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(M||1)].first_column,last_column:o[o.length-1].last_column},ft&&(F._$.range=[o[o.length-(M||1)].range[0],o[o.length-1].range[1]]),q=this.performAction.apply(F,[k,K,C,I.yy,T[1],p,o].concat(yt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),p=p.slice(0,-1*M),o=o.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),p.push(F.$),o.push(F._$),tt=b[l[l.length-2]][l[l.length-1]],l.push(tt);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:n(function(a,l){if(this.yy.parser)this.yy.parser.parseError(a,l);else throw new Error(a)},"parseError"),setInput:n(function(i,a){return this.yy=a||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:n(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var a=i.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:n(function(i){var a=i.length,l=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===d.length?this.yylloc.first_column:0)+d[d.length-l.length].length-l[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n(function(i){this.unput(this.match.slice(i))},"less"),pastInput:n(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n(function(){var i=this.pastInput(),a=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
|
|
5
|
+
`+a+"^"},"showPosition"),test_match:n(function(i,a){var l,d,p;if(this.options.backtrack_lexer&&(p={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(p.yylloc.range=this.yylloc.range.slice(0))),d=i[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],l=this.performAction.call(this,this.yy,this,a,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),l)return l;if(this._backtrack){for(var o in p)this[o]=p[o];return!1}return!1},"test_match"),next:n(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,a,l,d;this._more||(this.yytext="",this.match="");for(var p=this._currentRules(),o=0;o<p.length;o++)if(l=this._input.match(this.rules[p[o]]),l&&(!a||l[0].length>a[0].length)){if(a=l,d=o,this.options.backtrack_lexer){if(i=this.test_match(l,p[o]),i!==!1)return i;if(this._backtrack){a=!1;continue}else return!1}else if(!this.options.flex)break}return a?(i=this.test_match(a,p[d]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:n(function(){var a=this.next();return a||this.lex()},"lex"),begin:n(function(a){this.conditionStack.push(a)},"begin"),popState:n(function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:n(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:n(function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},"topState"),pushState:n(function(a){this.begin(a)},"pushState"),stateStackSize:n(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:n(function(a,l,d,p){switch(d){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),14;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 18;case 16:return 19;case 17:return":";case 18:return 6;case 19:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18,19],inclusive:!0}}};return h})();g.lexer=m;function x(){this.yy={}}return n(x,"Parser"),x.prototype=g,g.Parser=x,new x})();U.parser=U;var Et=U,V="",Z=[],L=[],B=[],Ct=n(function(){Z.length=0,L.length=0,V="",B.length=0,Mt()},"clear"),Pt=n(function(t){V=t,Z.push(t)},"addSection"),It=n(function(){return Z},"getSections"),At=n(function(){let t=it();const e=100;let s=0;for(;!t&&s<e;)t=it(),s++;return L.push(...B),L},"getTasks"),Ft=n(function(){const t=[];return L.forEach(s=>{s.people&&t.push(...s.people)}),[...new Set(t)].sort()},"updateActors"),Vt=n(function(t,e){const s=e.substr(1).split(":");let c=0,r=[];s.length===1?(c=Number(s[0]),r=[]):(c=Number(s[0]),r=s[1].split(","));const f=r.map(y=>y.trim()),u={section:V,type:V,people:f,task:t,score:c};B.push(u)},"addTask"),Rt=n(function(t){const e={section:V,type:V,description:t,task:t,classes:[]};L.push(e)},"addTaskOrg"),it=n(function(){const t=n(function(s){return B[s].processed},"compileTask");let e=!0;for(const[s,c]of B.entries())t(s),e=e&&c.processed;return e},"compileTasks"),Lt=n(function(){return Ft()},"getActors"),rt={getConfig:n(()=>R().journey,"getConfig"),clear:Ct,setDiagramTitle:St,getDiagramTitle:Tt,setAccTitle:wt,getAccTitle:bt,setAccDescription:vt,getAccDescription:_t,addSection:Pt,getSections:It,getTasks:At,addTask:Vt,addTaskOrg:Rt,getActors:Lt},Bt=n(t=>`.label {
|
|
7
|
+
font-family: ${t.fontFamily};
|
|
8
|
+
color: ${t.textColor};
|
|
9
|
+
}
|
|
10
|
+
.mouth {
|
|
11
|
+
stroke: #666;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
line {
|
|
15
|
+
stroke: ${t.textColor}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.legend {
|
|
19
|
+
fill: ${t.textColor};
|
|
20
|
+
font-family: ${t.fontFamily};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.label text {
|
|
24
|
+
fill: #333;
|
|
25
|
+
}
|
|
26
|
+
.label {
|
|
27
|
+
color: ${t.textColor}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.face {
|
|
31
|
+
${t.faceColor?`fill: ${t.faceColor}`:"fill: #FFF8DC"};
|
|
32
|
+
stroke: #999;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.node rect,
|
|
36
|
+
.node circle,
|
|
37
|
+
.node ellipse,
|
|
38
|
+
.node polygon,
|
|
39
|
+
.node path {
|
|
40
|
+
fill: ${t.mainBkg};
|
|
41
|
+
stroke: ${t.nodeBorder};
|
|
42
|
+
stroke-width: 1px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.node .label {
|
|
46
|
+
text-align: center;
|
|
47
|
+
}
|
|
48
|
+
.node.clickable {
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.arrowheadPath {
|
|
53
|
+
fill: ${t.arrowheadColor};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.edgePath .path {
|
|
57
|
+
stroke: ${t.lineColor};
|
|
58
|
+
stroke-width: 1.5px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.flowchart-link {
|
|
62
|
+
stroke: ${t.lineColor};
|
|
63
|
+
fill: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.edgeLabel {
|
|
67
|
+
background-color: ${t.edgeLabelBackground};
|
|
68
|
+
rect {
|
|
69
|
+
opacity: 0.5;
|
|
70
|
+
}
|
|
71
|
+
text-align: center;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.cluster rect {
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.cluster text {
|
|
78
|
+
fill: ${t.titleColor};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
div.mermaidTooltip {
|
|
82
|
+
position: absolute;
|
|
83
|
+
text-align: center;
|
|
84
|
+
max-width: 200px;
|
|
85
|
+
padding: 2px;
|
|
86
|
+
font-family: ${t.fontFamily};
|
|
87
|
+
font-size: 12px;
|
|
88
|
+
background: ${t.tertiaryColor};
|
|
89
|
+
border: 1px solid ${t.border2};
|
|
90
|
+
border-radius: 2px;
|
|
91
|
+
pointer-events: none;
|
|
92
|
+
z-index: 100;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.task-type-0, .section-type-0 {
|
|
96
|
+
${t.fillType0?`fill: ${t.fillType0}`:""};
|
|
97
|
+
}
|
|
98
|
+
.task-type-1, .section-type-1 {
|
|
99
|
+
${t.fillType0?`fill: ${t.fillType1}`:""};
|
|
100
|
+
}
|
|
101
|
+
.task-type-2, .section-type-2 {
|
|
102
|
+
${t.fillType0?`fill: ${t.fillType2}`:""};
|
|
103
|
+
}
|
|
104
|
+
.task-type-3, .section-type-3 {
|
|
105
|
+
${t.fillType0?`fill: ${t.fillType3}`:""};
|
|
106
|
+
}
|
|
107
|
+
.task-type-4, .section-type-4 {
|
|
108
|
+
${t.fillType0?`fill: ${t.fillType4}`:""};
|
|
109
|
+
}
|
|
110
|
+
.task-type-5, .section-type-5 {
|
|
111
|
+
${t.fillType0?`fill: ${t.fillType5}`:""};
|
|
112
|
+
}
|
|
113
|
+
.task-type-6, .section-type-6 {
|
|
114
|
+
${t.fillType0?`fill: ${t.fillType6}`:""};
|
|
115
|
+
}
|
|
116
|
+
.task-type-7, .section-type-7 {
|
|
117
|
+
${t.fillType0?`fill: ${t.fillType7}`:""};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.actor-0 {
|
|
121
|
+
${t.actor0?`fill: ${t.actor0}`:""};
|
|
122
|
+
}
|
|
123
|
+
.actor-1 {
|
|
124
|
+
${t.actor1?`fill: ${t.actor1}`:""};
|
|
125
|
+
}
|
|
126
|
+
.actor-2 {
|
|
127
|
+
${t.actor2?`fill: ${t.actor2}`:""};
|
|
128
|
+
}
|
|
129
|
+
.actor-3 {
|
|
130
|
+
${t.actor3?`fill: ${t.actor3}`:""};
|
|
131
|
+
}
|
|
132
|
+
.actor-4 {
|
|
133
|
+
${t.actor4?`fill: ${t.actor4}`:""};
|
|
134
|
+
}
|
|
135
|
+
.actor-5 {
|
|
136
|
+
${t.actor5?`fill: ${t.actor5}`:""};
|
|
137
|
+
}
|
|
138
|
+
${kt()}
|
|
139
|
+
`,"getStyles"),jt=Bt,J=n(function(t,e){return xt(t,e)},"drawRect"),Nt=n(function(t,e){const c=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),r=t.append("g");r.append("circle").attr("cx",e.cx-15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),r.append("circle").attr("cx",e.cx+15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function f(g){const m=et().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);g.append("path").attr("class","mouth").attr("d",m).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}n(f,"smile");function u(g){const m=et().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);g.append("path").attr("class","mouth").attr("d",m).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}n(u,"sad");function y(g){g.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return n(y,"ambivalent"),e.score>3?f(r):e.score<3?u(r):y(r),c},"drawFace"),ot=n(function(t,e){const s=t.append("circle");return s.attr("cx",e.cx),s.attr("cy",e.cy),s.attr("class","actor-"+e.pos),s.attr("fill",e.fill),s.attr("stroke",e.stroke),s.attr("r",e.r),s.class!==void 0&&s.attr("class",s.class),e.title!==void 0&&s.append("title").text(e.title),s},"drawCircle"),ct=n(function(t,e){return mt(t,e)},"drawText"),zt=n(function(t,e){function s(r,f,u,y,g){return r+","+f+" "+(r+u)+","+f+" "+(r+u)+","+(f+y-g)+" "+(r+u-g*1.2)+","+(f+y)+" "+r+","+(f+y)}n(s,"genPoints");const c=t.append("polygon");c.attr("points",s(e.x,e.y,50,20,7)),c.attr("class","labelBox"),e.y=e.y+e.labelMargin,e.x=e.x+.5*e.labelMargin,ct(t,e)},"drawLabel"),Wt=n(function(t,e,s){const c=t.append("g"),r=lt();r.x=e.x,r.y=e.y,r.fill=e.fill,r.width=s.width*e.taskCount+s.diagramMarginX*(e.taskCount-1),r.height=s.height,r.class="journey-section section-type-"+e.num,r.rx=3,r.ry=3,J(c,r),ht(s)(e.text,c,r.x,r.y,r.width,r.height,{class:"journey-section section-type-"+e.num},s,e.colour)},"drawSection"),nt=-1,Ot=n(function(t,e,s){const c=e.x+s.width/2,r=t.append("g");nt++,r.append("line").attr("id","task"+nt).attr("x1",c).attr("y1",e.y).attr("x2",c).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Nt(r,{cx:c,cy:300+(5-e.score)*30,score:e.score});const u=lt();u.x=e.x,u.y=e.y,u.fill=e.fill,u.width=s.width,u.height=s.height,u.class="task task-type-"+e.num,u.rx=3,u.ry=3,J(r,u);let y=e.x+14;e.people.forEach(g=>{const m=e.actors[g].color,x={cx:y,cy:e.y,r:7,fill:m,stroke:"#000",title:g,pos:e.actors[g].position};ot(r,x),y+=10}),ht(s)(e.task,r,u.x,u.y,u.width,u.height,{class:"task"},s,e.colour)},"drawTask"),Yt=n(function(t,e){gt(t,e)},"drawBackgroundRect"),ht=(function(){function t(r,f,u,y,g,m,x,h){const i=f.append("text").attr("x",u+g/2).attr("y",y+m/2+5).style("font-color",h).style("text-anchor","middle").text(r);c(i,x)}n(t,"byText");function e(r,f,u,y,g,m,x,h,i){const{taskFontSize:a,taskFontFamily:l}=h,d=r.split(/<br\s*\/?>/gi);for(let p=0;p<d.length;p++){const o=p*a-a*(d.length-1)/2,b=f.append("text").attr("x",u+g/2).attr("y",y).attr("fill",i).style("text-anchor","middle").style("font-size",a).style("font-family",l);b.append("tspan").attr("x",u+g/2).attr("dy",o).text(d[p]),b.attr("y",y+m/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),c(b,x)}}n(e,"byTspan");function s(r,f,u,y,g,m,x,h){const i=f.append("switch"),l=i.append("foreignObject").attr("x",u).attr("y",y).attr("width",g).attr("height",m).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");l.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(r),e(r,i,u,y,g,m,x,h),c(l,x)}n(s,"byFo");function c(r,f){for(const u in f)u in f&&r.attr(u,f[u])}return n(c,"_setTextAttrs"),function(r){return r.textPlacement==="fo"?s:r.textPlacement==="old"?t:e}})(),qt=n(function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},"initGraphics"),j={drawRect:J,drawCircle:ot,drawSection:Wt,drawText:ct,drawLabel:zt,drawTask:Ot,drawBackgroundRect:Yt,initGraphics:qt},Ht=n(function(t){Object.keys(t).forEach(function(s){$[s]=t[s]})},"setConf"),E={},W=0;function ut(t){const e=R().journey,s=e.maxLabelWidth;W=0;let c=60;Object.keys(E).forEach(r=>{const f=E[r].color,u={cx:20,cy:c,r:7,fill:f,stroke:"#000",pos:E[r].position};j.drawCircle(t,u);let y=t.append("text").attr("visibility","hidden").text(r);const g=y.node().getBoundingClientRect().width;y.remove();let m=[];if(g<=s)m=[r];else{const x=r.split(" ");let h="";y=t.append("text").attr("visibility","hidden"),x.forEach(i=>{const a=h?`${h} ${i}`:i;if(y.text(a),y.node().getBoundingClientRect().width>s){if(h&&m.push(h),h=i,y.text(i),y.node().getBoundingClientRect().width>s){let d="";for(const p of i)d+=p,y.text(d+"-"),y.node().getBoundingClientRect().width>s&&(m.push(d.slice(0,-1)+"-"),d=p);h=d}}else h=a}),h&&m.push(h),y.remove()}m.forEach((x,h)=>{const i={x:40,y:c+7+h*20,fill:"#666",text:x,textMargin:e.boxTextMargin??5},l=j.drawText(t,i).node().getBoundingClientRect().width;l>W&&l>e.leftMargin-l&&(W=l)}),c+=Math.max(20,m.length*20)})}n(ut,"drawActorLegend");var $=R().journey,P=0,Xt=n(function(t,e,s,c){const r=R(),f=r.journey.titleColor,u=r.journey.titleFontSize,y=r.journey.titleFontFamily,g=r.securityLevel;let m;g==="sandbox"&&(m=X("#i"+e));const x=g==="sandbox"?X(m.nodes()[0].contentDocument.body):X("body");S.init();const h=x.select("#"+e);j.initGraphics(h);const i=c.db.getTasks(),a=c.db.getDiagramTitle(),l=c.db.getActors();for(const C in E)delete E[C];let d=0;l.forEach(C=>{E[C]={color:$.actorColours[d%$.actorColours.length],position:d},d++}),ut(h),P=$.leftMargin+W,S.insert(0,0,P,Object.keys(E).length*50),Gt(h,i,0);const p=S.getBounds();a&&h.append("text").text(a).attr("x",P).attr("font-size",u).attr("font-weight","bold").attr("y",25).attr("fill",f).attr("font-family",y);const o=p.stopy-p.starty+2*$.diagramMarginY,b=P+p.stopx+2*$.diagramMarginX;$t(h,o,b,$.useMaxWidth),h.append("line").attr("x1",P).attr("y1",$.height*4).attr("x2",b-P-4).attr("y2",$.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)");const k=a?70:0;h.attr("viewBox",`${p.startx} -25 ${b} ${o+k}`),h.attr("preserveAspectRatio","xMinYMin meet"),h.attr("height",o+k+25)},"draw"),S={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:n(function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},"init"),updateVal:n(function(t,e,s,c){t[e]===void 0?t[e]=s:t[e]=c(s,t[e])},"updateVal"),updateBounds:n(function(t,e,s,c){const r=R().journey,f=this;let u=0;function y(g){return n(function(x){u++;const h=f.sequenceItems.length-u+1;f.updateVal(x,"starty",e-h*r.boxMargin,Math.min),f.updateVal(x,"stopy",c+h*r.boxMargin,Math.max),f.updateVal(S.data,"startx",t-h*r.boxMargin,Math.min),f.updateVal(S.data,"stopx",s+h*r.boxMargin,Math.max),g!=="activation"&&(f.updateVal(x,"startx",t-h*r.boxMargin,Math.min),f.updateVal(x,"stopx",s+h*r.boxMargin,Math.max),f.updateVal(S.data,"starty",e-h*r.boxMargin,Math.min),f.updateVal(S.data,"stopy",c+h*r.boxMargin,Math.max))},"updateItemBounds")}n(y,"updateFn"),this.sequenceItems.forEach(y())},"updateBounds"),insert:n(function(t,e,s,c){const r=Math.min(t,s),f=Math.max(t,s),u=Math.min(e,c),y=Math.max(e,c);this.updateVal(S.data,"startx",r,Math.min),this.updateVal(S.data,"starty",u,Math.min),this.updateVal(S.data,"stopx",f,Math.max),this.updateVal(S.data,"stopy",y,Math.max),this.updateBounds(r,u,f,y)},"insert"),bumpVerticalPos:n(function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},"bumpVerticalPos"),getVerticalPos:n(function(){return this.verticalPos},"getVerticalPos"),getBounds:n(function(){return this.data},"getBounds")},G=$.sectionFills,st=$.sectionColours,Gt=n(function(t,e,s){const c=R().journey;let r="";const f=c.height*2+c.diagramMarginY,u=s+f;let y=0,g="#CCC",m="black",x=0;for(const[h,i]of e.entries()){if(r!==i.section){g=G[y%G.length],x=y%G.length,m=st[y%st.length];let l=0;const d=i.section;for(let o=h;o<e.length&&e[o].section==d;o++)l=l+1;const p={x:h*c.taskMargin+h*c.width+P,y:50,text:i.section,fill:g,num:x,colour:m,taskCount:l};j.drawSection(t,p,c),r=i.section,y++}const a=i.people.reduce((l,d)=>(E[d]&&(l[d]=E[d]),l),{});i.x=h*c.taskMargin+h*c.width+P,i.y=u,i.width=c.diagramMarginX,i.height=c.diagramMarginY,i.colour=m,i.fill=g,i.num=x,i.actors=a,j.drawTask(t,i,c),S.insert(i.x,i.y,i.x+i.width+c.taskMargin,450)}},"drawTasks"),at={setConf:Ht,draw:Xt},Dt={parser:Et,db:rt,renderer:at,styles:jt,init:n(t=>{at.setConf(t.journey),rt.clear()},"init")};export{Dt as diagram};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import{_ as c,l as te,c as W,H as fe,af as ye,ag as be,ah as me,V as _e,F as K,i as G,t as Ee,J as ke,W as Se,X as le,Y as ce}from"./mermaid.core.js";import{g as Ne}from"./chunk-FMBD7UC4.js";import"./index.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],E=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],H=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],M=[1,35],U=[1,36],A=[1,6,7,11,13,16,17,20,23],j=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:E,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:E,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:E,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:H}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:E,18:17,19:18,20:f,23:h},t(P,[2,14],{7:M,11:U}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:H}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:j}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:M,11:U}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:j}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),b=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);b.setInput(s,T.yy),T.yy.lexer=b,T.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var q=b.yylloc;e.push(q);var de=b.options&&b.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||b.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var k,R,v,Q,F={},X,I,oe,Y;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((k===null||typeof k>"u")&&(k=ae()),v=B[R]&&B[R][k]),typeof v>"u"||!v.length||!v[0]){var Z="";Y=[];for(X in B[R])this.terminals_[X]&&X>ue&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Z="Parse error on line "+(z+1)+`:
|
|
2
|
+
`+b.showPosition()+`
|
|
3
|
+
Expecting `+Y.join(", ")+", got '"+(this.terminals_[k]||k)+"'":Z="Parse error on line "+(z+1)+": Unexpected "+(k==re?"end of input":"'"+(this.terminals_[k]||k)+"'"),this.parseError(Z,{text:b.match,token:this.terminals_[k]||k,line:b.yylineno,loc:q,expected:Y})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+k);switch(v[0]){case 1:a.push(k),u.push(b.yytext),e.push(b.yylloc),a.push(v[1]),k=null,ie=b.yyleng,l=b.yytext,z=b.yylineno,q=b.yylloc;break;case 2:if(I=this.productions_[v[1]][1],F.$=u[u.length-I],F._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(F._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),Q=this.performAction.apply(F,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof Q<"u")return Q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(F.$),e.push(F._$),oe=B[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},m=(function(){var _={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
|
|
5
|
+
`+n+"^"},"showPosition"),test_match:c(function(s,n){var a,o,u;if(this.options.backtrack_lexer&&(u={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(u.yylloc.range=this.yylloc.range.slice(0))),o=s[0].match(/(?:\r\n?|\n).*/g),o&&(this.yylineno+=o.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:o?o[o.length-1].length-o[o.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+s[0].length},this.yytext+=s[0],this.match+=s[0],this.matches=s,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(s[0].length),this.matched+=s[0],a=this.performAction.call(this,this.yy,this,n,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a)return a;if(this._backtrack){for(var e in u)this[e]=u[e];return!1}return!1},"test_match"),next:c(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var s,n,a,o;this._more||(this.yytext="",this.match="");for(var u=this._currentRules(),e=0;e<u.length;e++)if(a=this._input.match(this.rules[u[e]]),a&&(!n||a[0].length>n[0].length)){if(n=a,o=e,this.options.backtrack_lexer){if(s=this.test_match(a,u[e]),s!==!1)return s;if(this._backtrack){n=!1;continue}else return!1}else if(!this.options.flex)break}return n?(s=this.test_match(n,u[o]),s!==!1?s:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:c(function(){var n=this.next();return n||this.lex()},"lex"),begin:c(function(n){this.conditionStack.push(n)},"begin"),popState:c(function(){var n=this.conditionStack.length-1;return n>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:c(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:c(function(n){return n=this.conditionStack.length-1-Math.abs(n||0),n>=0?this.conditionStack[n]:"INITIAL"},"topState"),pushState:c(function(n){this.begin(n)},"pushState"),stateStackSize:c(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:c(function(n,a,o,u){switch(o){case 0:return this.pushState("shapeData"),a.yytext="",24;case 1:return this.pushState("shapeDataStr"),24;case 2:return this.popState(),24;case 3:const e=/\n\s*/g;return a.yytext=a.yytext.replace(e,"<br/>"),24;case 4:return 24;case 5:this.popState();break;case 6:return n.getLogger().trace("Found comment",a.yytext),6;case 7:return 8;case 8:this.begin("CLASS");break;case 9:return this.popState(),17;case 10:this.popState();break;case 11:n.getLogger().trace("Begin icon"),this.begin("ICON");break;case 12:return n.getLogger().trace("SPACELINE"),6;case 13:return 7;case 14:return 16;case 15:n.getLogger().trace("end icon"),this.popState();break;case 16:return n.getLogger().trace("Exploding node"),this.begin("NODE"),20;case 17:return n.getLogger().trace("Cloud"),this.begin("NODE"),20;case 18:return n.getLogger().trace("Explosion Bang"),this.begin("NODE"),20;case 19:return n.getLogger().trace("Cloud Bang"),this.begin("NODE"),20;case 20:return this.begin("NODE"),20;case 21:return this.begin("NODE"),20;case 22:return this.begin("NODE"),20;case 23:return this.begin("NODE"),20;case 24:return 13;case 25:return 23;case 26:return 11;case 27:this.begin("NSTR2");break;case 28:return"NODE_DESCR";case 29:this.popState();break;case 30:n.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 31:return n.getLogger().trace("description:",a.yytext),"NODE_DESCR";case 32:this.popState();break;case 33:return this.popState(),n.getLogger().trace("node end ))"),"NODE_DEND";case 34:return this.popState(),n.getLogger().trace("node end )"),"NODE_DEND";case 35:return this.popState(),n.getLogger().trace("node end ...",a.yytext),"NODE_DEND";case 36:return this.popState(),n.getLogger().trace("node end (("),"NODE_DEND";case 37:return this.popState(),n.getLogger().trace("node end (-"),"NODE_DEND";case 38:return this.popState(),n.getLogger().trace("node end (-"),"NODE_DEND";case 39:return this.popState(),n.getLogger().trace("node end (("),"NODE_DEND";case 40:return this.popState(),n.getLogger().trace("node end (("),"NODE_DEND";case 41:return n.getLogger().trace("Long description:",a.yytext),21;case 42:return n.getLogger().trace("Long description:",a.yytext),21}},"anonymous"),rules:[/^(?:@\{)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^\"]+)/i,/^(?:[^}^"]+)/i,/^(?:\})/i,/^(?:\s*%%.*)/i,/^(?:kanban\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}@]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{shapeDataEndBracket:{rules:[],inclusive:!1},shapeDataStr:{rules:[2,3],inclusive:!1},shapeData:{rules:[1,4,5],inclusive:!1},CLASS:{rules:[9,10],inclusive:!1},ICON:{rules:[14,15],inclusive:!1},NSTR2:{rules:[28,29],inclusive:!1},NSTR:{rules:[31,32],inclusive:!1},NODE:{rules:[27,30,33,34,35,36,37,38,39,40,41,42],inclusive:!1},INITIAL:{rules:[0,6,7,8,11,12,13,16,17,18,19,20,21,22,23,24,25,26],inclusive:!0}}};return _})();V.lexer=m;function O(){this.yy={}}return c(O,"Parser"),O.prototype=V,V.Parser=O,new O})();$.parser=$;var xe=$,D=[],ne=[],ee=0,se={},ve=c(()=>{D=[],ne=[],ee=0,se={}},"clear"),De=c(t=>{if(D.length===0)return null;const g=D[0].level;let d=null;for(let r=D.length-1;r>=0;r--)if(D[r].level===g&&!d&&(d=D[r]),D[r].level<g)throw new Error('Items without section detected, found section ("'+D[r].label+'")');return t===(d==null?void 0:d.level)?null:d},"getSection"),he=c(function(){return ne},"getSections"),Le=c(function(){const t=[],g=[],d=he(),r=W();for(const p of d){const E={id:p.id,label:G(p.label??"",r),isGroup:!0,ticket:p.ticket,shape:"kanbanSection",level:p.level,look:r.look};g.push(E);const f=D.filter(h=>h.parentId===p.id);for(const h of f){const L={id:h.id,parentId:p.id,label:G(h.label??"",r),isGroup:!1,ticket:h==null?void 0:h.ticket,priority:h==null?void 0:h.priority,assigned:h==null?void 0:h.assigned,icon:h==null?void 0:h.icon,shape:"kanbanItem",level:h.level,rx:5,ry:5,cssStyles:["text-align: left"]};g.push(L)}}return{nodes:g,edges:t,other:{},config:W()}},"getData"),Oe=c((t,g,d,r,p)=>{var C,w;const E=W();let f=((C=E.mindmap)==null?void 0:C.padding)??K.mindmap.padding;switch(r){case y.ROUNDED_RECT:case y.RECT:case y.HEXAGON:f*=2}const h={id:G(g,E)||"kbn"+ee++,level:t,label:G(d,E),width:((w=E.mindmap)==null?void 0:w.maxNodeWidth)??K.mindmap.maxNodeWidth,padding:f,isGroup:!1};if(p!==void 0){let N;p.includes(`
|
|
7
|
+
`)?N=p+`
|
|
8
|
+
`:N=`{
|
|
9
|
+
`+p+`
|
|
10
|
+
}`;const i=Ee(N,{schema:ke});if(i.shape&&(i.shape!==i.shape.toLowerCase()||i.shape.includes("_")))throw new Error(`No such shape: ${i.shape}. Shape names should be lowercase.`);i!=null&&i.shape&&i.shape==="kanbanItem"&&(h.shape=i==null?void 0:i.shape),i!=null&&i.label&&(h.label=i==null?void 0:i.label),i!=null&&i.icon&&(h.icon=i==null?void 0:i.icon.toString()),i!=null&&i.assigned&&(h.assigned=i==null?void 0:i.assigned.toString()),i!=null&&i.ticket&&(h.ticket=i==null?void 0:i.ticket.toString()),i!=null&&i.priority&&(h.priority=i==null?void 0:i.priority)}const L=De(t);L?h.parentId=L.id||"kbn"+ee++:ne.push(h),D.push(h)},"addNode"),y={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},Ie=c((t,g)=>{switch(te.debug("In get type",t,g),t){case"[":return y.RECT;case"(":return g===")"?y.ROUNDED_RECT:y.CLOUD;case"((":return y.CIRCLE;case")":return y.CLOUD;case"))":return y.BANG;case"{{":return y.HEXAGON;default:return y.DEFAULT}},"getType"),Ce=c((t,g)=>{se[t]=g},"setElementForId"),we=c(t=>{if(!t)return;const g=W(),d=D[D.length-1];t.icon&&(d.icon=G(t.icon,g)),t.class&&(d.cssClasses=G(t.class,g))},"decorateNode"),Ae=c(t=>{switch(t){case y.DEFAULT:return"no-border";case y.RECT:return"rect";case y.ROUNDED_RECT:return"rounded-rect";case y.CIRCLE:return"circle";case y.CLOUD:return"cloud";case y.BANG:return"bang";case y.HEXAGON:return"hexgon";default:return"no-border"}},"type2Str"),Te=c(()=>te,"getLogger"),Re=c(t=>se[t],"getElementById"),Pe={clear:ve,addNode:Oe,getSections:he,getData:Le,nodeType:y,getType:Ie,setElementForId:Ce,decorateNode:we,type2Str:Ae,getLogger:Te,getElementById:Re},Ve=Pe,Be=c(async(t,g,d,r)=>{var M,U,A,j,V;te.debug(`Rendering kanban diagram
|
|
11
|
+
`+t);const E=r.db.getData(),f=W();f.htmlLabels=!1;const h=fe(g),L=h.append("g");L.attr("class","sections");const C=h.append("g");C.attr("class","items");const w=E.nodes.filter(m=>m.isGroup);let N=0;const i=10,H=[];let x=25;for(const m of w){const O=((M=f==null?void 0:f.kanban)==null?void 0:M.sectionWidth)||200;N=N+1,m.x=O*N+(N-1)*i/2,m.width=O,m.y=0,m.height=O*3,m.rx=5,m.ry=5,m.cssClasses=m.cssClasses+" section-"+N;const _=await ye(L,m);x=Math.max(x,(U=_==null?void 0:_.labelBBox)==null?void 0:U.height),H.push(_)}let P=0;for(const m of w){const O=H[P];P=P+1;const _=((A=f==null?void 0:f.kanban)==null?void 0:A.sectionWidth)||200,s=-_*3/2+x;let n=s;const a=E.nodes.filter(e=>e.parentId===m.id);for(const e of a){if(e.isGroup)throw new Error("Groups within groups are not allowed in Kanban diagrams");e.x=m.x,e.width=_-1.5*i;const l=(await be(C,e,{config:f})).node().getBBox();e.y=n+l.height/2,await me(e),n=e.y+l.height/2+i/2}const o=O.cluster.select("rect"),u=Math.max(n-s+3*i,50)+(x-25);o.attr("height",u)}_e(void 0,h,((j=f.mindmap)==null?void 0:j.padding)??K.kanban.padding,((V=f.mindmap)==null?void 0:V.useMaxWidth)??K.kanban.useMaxWidth)},"draw"),Fe={draw:Be},Ge=c(t=>{let g="";for(let r=0;r<t.THEME_COLOR_LIMIT;r++)t["lineColor"+r]=t["lineColor"+r]||t["cScaleInv"+r],Se(t["lineColor"+r])?t["lineColor"+r]=le(t["lineColor"+r],20):t["lineColor"+r]=ce(t["lineColor"+r],20);const d=c((r,p)=>t.darkMode?ce(r,p):le(r,p),"adjuster");for(let r=0;r<t.THEME_COLOR_LIMIT;r++){const p=""+(17-3*r);g+=`
|
|
12
|
+
.section-${r-1} rect, .section-${r-1} path, .section-${r-1} circle, .section-${r-1} polygon, .section-${r-1} path {
|
|
13
|
+
fill: ${d(t["cScale"+r],10)};
|
|
14
|
+
stroke: ${d(t["cScale"+r],10)};
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
.section-${r-1} text {
|
|
18
|
+
fill: ${t["cScaleLabel"+r]};
|
|
19
|
+
}
|
|
20
|
+
.node-icon-${r-1} {
|
|
21
|
+
font-size: 40px;
|
|
22
|
+
color: ${t["cScaleLabel"+r]};
|
|
23
|
+
}
|
|
24
|
+
.section-edge-${r-1}{
|
|
25
|
+
stroke: ${t["cScale"+r]};
|
|
26
|
+
}
|
|
27
|
+
.edge-depth-${r-1}{
|
|
28
|
+
stroke-width: ${p};
|
|
29
|
+
}
|
|
30
|
+
.section-${r-1} line {
|
|
31
|
+
stroke: ${t["cScaleInv"+r]} ;
|
|
32
|
+
stroke-width: 3;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.disabled, .disabled circle, .disabled text {
|
|
36
|
+
fill: lightgray;
|
|
37
|
+
}
|
|
38
|
+
.disabled text {
|
|
39
|
+
fill: #efefef;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.node rect,
|
|
43
|
+
.node circle,
|
|
44
|
+
.node ellipse,
|
|
45
|
+
.node polygon,
|
|
46
|
+
.node path {
|
|
47
|
+
fill: ${t.background};
|
|
48
|
+
stroke: ${t.nodeBorder};
|
|
49
|
+
stroke-width: 1px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.kanban-ticket-link {
|
|
53
|
+
fill: ${t.background};
|
|
54
|
+
stroke: ${t.nodeBorder};
|
|
55
|
+
text-decoration: underline;
|
|
56
|
+
}
|
|
57
|
+
`}return g},"genSections"),He=c(t=>`
|
|
58
|
+
.edge {
|
|
59
|
+
stroke-width: 3;
|
|
60
|
+
}
|
|
61
|
+
${Ge(t)}
|
|
62
|
+
.section-root rect, .section-root path, .section-root circle, .section-root polygon {
|
|
63
|
+
fill: ${t.git0};
|
|
64
|
+
}
|
|
65
|
+
.section-root text {
|
|
66
|
+
fill: ${t.gitBranchLabel0};
|
|
67
|
+
}
|
|
68
|
+
.icon-container {
|
|
69
|
+
height:100%;
|
|
70
|
+
display: flex;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
align-items: center;
|
|
73
|
+
}
|
|
74
|
+
.edge {
|
|
75
|
+
fill: none;
|
|
76
|
+
}
|
|
77
|
+
.cluster-label, .label {
|
|
78
|
+
color: ${t.textColor};
|
|
79
|
+
fill: ${t.textColor};
|
|
80
|
+
}
|
|
81
|
+
.kanban-label {
|
|
82
|
+
dy: 1em;
|
|
83
|
+
alignment-baseline: middle;
|
|
84
|
+
text-anchor: middle;
|
|
85
|
+
dominant-baseline: middle;
|
|
86
|
+
text-align: center;
|
|
87
|
+
}
|
|
88
|
+
${Ne()}
|
|
89
|
+
`,"getStyles"),Me=He,ze={db:Ve,renderer:Fe,parser:xe,styles:Me};export{ze as diagram};
|
package/dist/layout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as F,b as gn,c as zn,d as L,k as Xn,e as Un,g as Hn,j as P,l as xn,m as En,n as kn,t as jn,o as yn,p as Jn,q as Kn,G as x,f as s,h as w,i as g,r as M,v as y,s as Y}from"./graph.js";import{a7 as A,a8 as Zn,a9 as Qn,aa as Nn,ab as B,ac as Ln,ad as ne,ae as _n,af as J,ag as ee,ah as re,ai as K,aj as te,ak as Cn,al as ie,am as ae,an as H}from"./mermaid.core.js";var oe=/\s/;function ue(n){for(var e=n.length;e--&&oe.test(n.charAt(e)););return e}var de=/^\s+/;function fe(n){return n&&n.slice(0,ue(n)+1).replace(de,"")}var un=NaN,se=/^[-+]0x[0-9a-f]+$/i,ce=/^0b[01]+$/i,he=/^0o[0-7]+$/i,le=parseInt;function ve(n){if(typeof n=="number")return n;if(F(n))return un;if(A(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=A(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=fe(n);var r=ce.test(n);return r||he.test(n)?le(n.slice(2),r?2:8):se.test(n)?un:+n}var dn=1/0,pe=17976931348623157e292;function S(n){if(!n)return n===0?n:0;if(n=ve(n),n===dn||n===-dn){var e=n<0?-1:1;return e*pe}return n===n?n:0}function we(n){var e=S(n),r=e%1;return e===e?r?e-r:e:0}function _(n){var e=n==null?0:n.length;return e?gn(n):[]}function me(n){return Zn(Qn(n,void 0,_),n+"")}var be=1,ge=4;function xe(n){return zn(n,be|ge)}var In=Object.prototype,Ee=In.hasOwnProperty,ke=Nn(function(n,e){n=Object(n);var r=-1,t=e.length,i=t>2?e[2]:void 0;for(i&&B(e[0],e[1],i)&&(t=1);++r<t;)for(var o=e[r],a=Ln(o),u=-1,d=a.length;++u<d;){var f=a[u],c=n[f];(c===void 0||ne(c,In[f])&&!Ee.call(n,f))&&(n[f]=o[f])}return n});function G(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}function ye(n){return function(e,r,t){var i=Object(e);if(!_n(e)){var o=L(r);e=Xn(e),r=function(u){return o(i[u],u,i)}}var a=n(e,r,t);return a>-1?i[o?e[a]:a]:void 0}}var Ne=Math.max;function Le(n,e,r){var t=n==null?0:n.length;if(!t)return-1;var i=r==null?0:we(r);return i<0&&(i=Ne(t+i,0)),Un(n,L(e),i)}var Z=ye(Le);function Rn(n,e){var r=-1,t=_n(n)?Array(n.length):[];return Hn(n,function(i,o,a){t[++r]=e(i,o,a)}),t}function m(n,e){var r=J(n)?P:Rn;return r(n,L(e))}function _e(n,e){return n==null?n:ee(n,xn(e),Ln)}function Ce(n,e){return n&&En(n,xn(e))}function Ie(n,e){return n>e}function Tn(n,e){return n<e}function $(n,e){var r={};return e=L(e),En(n,function(t,i,o){re(r,i,e(t,i,o))}),r}function Q(n,e,r){for(var t=-1,i=n.length;++t<i;){var o=n[t],a=e(o);if(a!=null&&(u===void 0?a===a&&!F(a):r(a,u)))var u=a,d=o}return d}function E(n){return n&&n.length?Q(n,K,Ie):void 0}function R(n){return n&&n.length?Q(n,K,Tn):void 0}function nn(n,e){return n&&n.length?Q(n,L(e),Tn):void 0}function Re(n,e,r,t){if(!A(n))return n;e=kn(e,n);for(var i=-1,o=e.length,a=o-1,u=n;u!=null&&++i<o;){var d=jn(e[i]),f=r;if(d==="__proto__"||d==="constructor"||d==="prototype")return n;if(i!=a){var c=u[d];f=void 0,f===void 0&&(f=A(c)?c:te(e[i+1])?[]:{})}Cn(u,d,f),u=u[d]}return n}function Te(n,e,r){for(var t=-1,i=e.length,o={};++t<i;){var a=e[t],u=yn(n,a);r(u,a)&&Re(o,kn(a,n),u)}return o}function Me(n,e){var r=n.length;for(n.sort(e);r--;)n[r]=n[r].value;return n}function Oe(n,e){if(n!==e){var r=n!==void 0,t=n===null,i=n===n,o=F(n),a=e!==void 0,u=e===null,d=e===e,f=F(e);if(!u&&!f&&!o&&n>e||o&&a&&d&&!u&&!f||t&&a&&d||!r&&d||!i)return 1;if(!t&&!o&&!f&&n<e||f&&r&&i&&!t&&!o||u&&r&&i||!a&&i||!d)return-1}return 0}function Pe(n,e,r){for(var t=-1,i=n.criteria,o=e.criteria,a=i.length,u=r.length;++t<a;){var d=Oe(i[t],o[t]);if(d){if(t>=u)return d;var f=r[t];return d*(f=="desc"?-1:1)}}return n.index-e.index}function Se(n,e,r){e.length?e=P(e,function(o){return J(o)?function(a){return yn(a,o.length===1?o[0]:o)}:o}):e=[K];var t=-1;e=P(e,ie(L));var i=Rn(n,function(o,a,u){var d=P(e,function(f){return f(o)});return{criteria:d,index:++t,value:o}});return Me(i,function(o,a){return Pe(o,a,r)})}function Fe(n,e){return Te(n,e,function(r,t){return Jn(n,t)})}var V=me(function(n,e){return n==null?{}:Fe(n,e)}),Ae=Math.ceil,Be=Math.max;function Ge(n,e,r,t){for(var i=-1,o=Be(Ae((e-n)/(r||1)),0),a=Array(o);o--;)a[++i]=n,n+=r;return a}function Ve(n){return function(e,r,t){return t&&typeof t!="number"&&B(e,r,t)&&(r=t=void 0),e=S(e),r===void 0?(r=e,e=0):r=S(r),t=t===void 0?e<r?1:-1:S(t),Ge(e,r,t)}}var N=Ve(),O=Nn(function(n,e){if(n==null)return[];var r=e.length;return r>1&&B(n,e[0],e[1])?e=[]:r>2&&B(e[0],e[1],e[2])&&(e=[e[0]]),Se(n,gn(e),[])}),Ye=0;function en(n){var e=++Ye;return Kn(n)+e}function $e(n,e,r){for(var t=-1,i=n.length,o=e.length,a={};++t<i;){var u=t<o?e[t]:void 0;r(a,n[t],u)}return a}function De(n,e){return $e(n||[],e||[],Cn)}class qe{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,r=e._prev;if(r!==e)return fn(r),r}enqueue(e){var r=this._sentinel;e._prev&&e._next&&fn(e),e._next=r._next,r._next._prev=e,r._next=e,e._prev=r}toString(){for(var e=[],r=this._sentinel,t=r._prev;t!==r;)e.push(JSON.stringify(t,We)),t=t._prev;return"["+e.join(", ")+"]"}}function fn(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function We(n,e){if(n!=="_next"&&n!=="_prev")return e}var ze=ae(1);function Xe(n,e){if(n.nodeCount()<=1)return[];var r=He(n,e||ze),t=Ue(r.graph,r.buckets,r.zeroIdx);return _(m(t,function(i){return n.outEdges(i.v,i.w)}))}function Ue(n,e,r){for(var t=[],i=e[e.length-1],o=e[0],a;n.nodeCount();){for(;a=o.dequeue();)q(n,e,r,a);for(;a=i.dequeue();)q(n,e,r,a);if(n.nodeCount()){for(var u=e.length-2;u>0;--u)if(a=e[u].dequeue(),a){t=t.concat(q(n,e,r,a,!0));break}}}return t}function q(n,e,r,t,i){var o=i?[]:void 0;return s(n.inEdges(t.v),function(a){var u=n.edge(a),d=n.node(a.v);i&&o.push({v:a.v,w:a.w}),d.out-=u,j(e,r,d)}),s(n.outEdges(t.v),function(a){var u=n.edge(a),d=a.w,f=n.node(d);f.in-=u,j(e,r,f)}),n.removeNode(t.v),o}function He(n,e){var r=new x,t=0,i=0;s(n.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),s(n.edges(),function(u){var d=r.edge(u.v,u.w)||0,f=e(u),c=d+f;r.setEdge(u.v,u.w,c),i=Math.max(i,r.node(u.v).out+=f),t=Math.max(t,r.node(u.w).in+=f)});var o=N(i+t+3).map(function(){return new qe}),a=t+1;return s(r.nodes(),function(u){j(o,a,r.node(u))}),{graph:r,buckets:o,zeroIdx:a}}function j(n,e,r){r.out?r.in?n[r.out-r.in+e].enqueue(r):n[n.length-1].enqueue(r):n[0].enqueue(r)}function je(n){var e=n.graph().acyclicer==="greedy"?Xe(n,r(n)):Je(n);s(e,function(t){var i=n.edge(t);n.removeEdge(t),i.forwardName=t.name,i.reversed=!0,n.setEdge(t.w,t.v,i,en("rev"))});function r(t){return function(i){return t.edge(i).weight}}}function Je(n){var e=[],r={},t={};function i(o){w(t,o)||(t[o]=!0,r[o]=!0,s(n.outEdges(o),function(a){w(r,a.w)?e.push(a):i(a.w)}),delete r[o])}return s(n.nodes(),i),e}function Ke(n){s(n.edges(),function(e){var r=n.edge(e);if(r.reversed){n.removeEdge(e);var t=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(e.w,e.v,r,t)}})}function C(n,e,r,t){var i;do i=en(t);while(n.hasNode(i));return r.dummy=e,n.setNode(i,r),i}function Ze(n){var e=new x().setGraph(n.graph());return s(n.nodes(),function(r){e.setNode(r,n.node(r))}),s(n.edges(),function(r){var t=e.edge(r.v,r.w)||{weight:0,minlen:1},i=n.edge(r);e.setEdge(r.v,r.w,{weight:t.weight+i.weight,minlen:Math.max(t.minlen,i.minlen)})}),e}function Mn(n){var e=new x({multigraph:n.isMultigraph()}).setGraph(n.graph());return s(n.nodes(),function(r){n.children(r).length||e.setNode(r,n.node(r))}),s(n.edges(),function(r){e.setEdge(r,n.edge(r))}),e}function sn(n,e){var r=n.x,t=n.y,i=e.x-r,o=e.y-t,a=n.width/2,u=n.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var d,f;return Math.abs(o)*a>Math.abs(i)*u?(o<0&&(u=-u),d=u*i/o,f=u):(i<0&&(a=-a),d=a,f=a*o/i),{x:r+d,y:t+f}}function D(n){var e=m(N(On(n)+1),function(){return[]});return s(n.nodes(),function(r){var t=n.node(r),i=t.rank;g(i)||(e[i][t.order]=r)}),e}function Qe(n){var e=R(m(n.nodes(),function(r){return n.node(r).rank}));s(n.nodes(),function(r){var t=n.node(r);w(t,"rank")&&(t.rank-=e)})}function nr(n){var e=R(m(n.nodes(),function(o){return n.node(o).rank})),r=[];s(n.nodes(),function(o){var a=n.node(o).rank-e;r[a]||(r[a]=[]),r[a].push(o)});var t=0,i=n.graph().nodeRankFactor;s(r,function(o,a){g(o)&&a%i!==0?--t:t&&s(o,function(u){n.node(u).rank+=t})})}function cn(n,e,r,t){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=t),C(n,"border",i,e)}function On(n){return E(m(n.nodes(),function(e){var r=n.node(e).rank;if(!g(r))return r}))}function er(n,e){var r={lhs:[],rhs:[]};return s(n,function(t){e(t)?r.lhs.push(t):r.rhs.push(t)}),r}function rr(n,e){return e()}function tr(n){function e(r){var t=n.children(r),i=n.node(r);if(t.length&&s(t,e),w(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;o<a;++o)hn(n,"borderLeft","_bl",r,i,o),hn(n,"borderRight","_br",r,i,o)}}s(n.children(),e)}function hn(n,e,r,t,i,o){var a={width:0,height:0,rank:o,borderType:e},u=i[e][o-1],d=C(n,"border",a,r);i[e][o]=d,n.setParent(d,t),u&&n.setEdge(u,d,{weight:1})}function ir(n){var e=n.graph().rankdir.toLowerCase();(e==="lr"||e==="rl")&&Pn(n)}function ar(n){var e=n.graph().rankdir.toLowerCase();(e==="bt"||e==="rl")&&or(n),(e==="lr"||e==="rl")&&(ur(n),Pn(n))}function Pn(n){s(n.nodes(),function(e){ln(n.node(e))}),s(n.edges(),function(e){ln(n.edge(e))})}function ln(n){var e=n.width;n.width=n.height,n.height=e}function or(n){s(n.nodes(),function(e){W(n.node(e))}),s(n.edges(),function(e){var r=n.edge(e);s(r.points,W),w(r,"y")&&W(r)})}function W(n){n.y=-n.y}function ur(n){s(n.nodes(),function(e){z(n.node(e))}),s(n.edges(),function(e){var r=n.edge(e);s(r.points,z),w(r,"x")&&z(r)})}function z(n){var e=n.x;n.x=n.y,n.y=e}function dr(n){n.graph().dummyChains=[],s(n.edges(),function(e){fr(n,e)})}function fr(n,e){var r=e.v,t=n.node(r).rank,i=e.w,o=n.node(i).rank,a=e.name,u=n.edge(e),d=u.labelRank;if(o!==t+1){n.removeEdge(e);var f,c,h;for(h=0,++t;t<o;++h,++t)u.points=[],c={width:0,height:0,edgeLabel:u,edgeObj:e,rank:t},f=C(n,"edge",c,"_d"),t===d&&(c.width=u.width,c.height=u.height,c.dummy="edge-label",c.labelpos=u.labelpos),n.setEdge(r,f,{weight:u.weight},a),h===0&&n.graph().dummyChains.push(f),r=f;n.setEdge(r,i,{weight:u.weight},a)}}function sr(n){s(n.graph().dummyChains,function(e){var r=n.node(e),t=r.edgeLabel,i;for(n.setEdge(r.edgeObj,t);r.dummy;)i=n.successors(e)[0],n.removeNode(e),t.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height),e=i,r=n.node(e)})}function rn(n){var e={};function r(t){var i=n.node(t);if(w(e,t))return i.rank;e[t]=!0;var o=R(m(n.outEdges(t),function(a){return r(a.w)-n.edge(a).minlen}));return(o===Number.POSITIVE_INFINITY||o===void 0||o===null)&&(o=0),i.rank=o}s(n.sources(),r)}function T(n,e){return n.node(e.w).rank-n.node(e.v).rank-n.edge(e).minlen}function Sn(n){var e=new x({directed:!1}),r=n.nodes()[0],t=n.nodeCount();e.setNode(r,{});for(var i,o;cr(e,n)<t;)i=hr(e,n),o=e.hasNode(i.v)?T(n,i):-T(n,i),lr(e,n,o);return e}function cr(n,e){function r(t){s(e.nodeEdges(t),function(i){var o=i.v,a=t===o?i.w:o;!n.hasNode(a)&&!T(e,i)&&(n.setNode(a,{}),n.setEdge(t,a,{}),r(a))})}return s(n.nodes(),r),n.nodeCount()}function hr(n,e){return nn(e.edges(),function(r){if(n.hasNode(r.v)!==n.hasNode(r.w))return T(e,r)})}function lr(n,e,r){s(n.nodes(),function(t){e.node(t).rank+=r})}function vr(){}vr.prototype=new Error;function Fn(n,e,r){J(e)||(e=[e]);var t=(n.isDirected()?n.successors:n.neighbors).bind(n),i=[],o={};return s(e,function(a){if(!n.hasNode(a))throw new Error("Graph does not have node: "+a);An(n,a,r==="post",o,t,i)}),i}function An(n,e,r,t,i,o){w(t,e)||(t[e]=!0,r||o.push(e),s(i(e),function(a){An(n,a,r,t,i,o)}),r&&o.push(e))}function pr(n,e){return Fn(n,e,"post")}function wr(n,e){return Fn(n,e,"pre")}k.initLowLimValues=an;k.initCutValues=tn;k.calcCutValue=Bn;k.leaveEdge=Vn;k.enterEdge=Yn;k.exchangeEdges=$n;function k(n){n=Ze(n),rn(n);var e=Sn(n);an(e),tn(e,n);for(var r,t;r=Vn(e);)t=Yn(e,n,r),$n(e,n,r,t)}function tn(n,e){var r=pr(n,n.nodes());r=r.slice(0,r.length-1),s(r,function(t){mr(n,e,t)})}function mr(n,e,r){var t=n.node(r),i=t.parent;n.edge(r,i).cutvalue=Bn(n,e,r)}function Bn(n,e,r){var t=n.node(r),i=t.parent,o=!0,a=e.edge(r,i),u=0;return a||(o=!1,a=e.edge(i,r)),u=a.weight,s(e.nodeEdges(r),function(d){var f=d.v===r,c=f?d.w:d.v;if(c!==i){var h=f===o,l=e.edge(d).weight;if(u+=h?l:-l,gr(n,r,c)){var v=n.edge(r,c).cutvalue;u+=h?-v:v}}}),u}function an(n,e){arguments.length<2&&(e=n.nodes()[0]),Gn(n,{},1,e)}function Gn(n,e,r,t,i){var o=r,a=n.node(t);return e[t]=!0,s(n.neighbors(t),function(u){w(e,u)||(r=Gn(n,e,r,u,t))}),a.low=o,a.lim=r++,i?a.parent=i:delete a.parent,r}function Vn(n){return Z(n.edges(),function(e){return n.edge(e).cutvalue<0})}function Yn(n,e,r){var t=r.v,i=r.w;e.hasEdge(t,i)||(t=r.w,i=r.v);var o=n.node(t),a=n.node(i),u=o,d=!1;o.lim>a.lim&&(u=a,d=!0);var f=M(e.edges(),function(c){return d===vn(n,n.node(c.v),u)&&d!==vn(n,n.node(c.w),u)});return nn(f,function(c){return T(e,c)})}function $n(n,e,r,t){var i=r.v,o=r.w;n.removeEdge(i,o),n.setEdge(t.v,t.w,{}),an(n),tn(n,e),br(n,e)}function br(n,e){var r=Z(n.nodes(),function(i){return!e.node(i).parent}),t=wr(n,r);t=t.slice(1),s(t,function(i){var o=n.node(i).parent,a=e.edge(i,o),u=!1;a||(a=e.edge(o,i),u=!0),e.node(i).rank=e.node(o).rank+(u?a.minlen:-a.minlen)})}function gr(n,e,r){return n.hasEdge(e,r)}function vn(n,e,r){return r.low<=e.lim&&e.lim<=r.lim}function xr(n){switch(n.graph().ranker){case"network-simplex":pn(n);break;case"tight-tree":kr(n);break;case"longest-path":Er(n);break;default:pn(n)}}var Er=rn;function kr(n){rn(n),Sn(n)}function pn(n){k(n)}function yr(n){var e=C(n,"root",{},"_root"),r=Nr(n),t=E(y(r))-1,i=2*t+1;n.graph().nestingRoot=e,s(n.edges(),function(a){n.edge(a).minlen*=i});var o=Lr(n)+1;s(n.children(),function(a){Dn(n,e,i,o,t,r,a)}),n.graph().nodeRankFactor=i}function Dn(n,e,r,t,i,o,a){var u=n.children(a);if(!u.length){a!==e&&n.setEdge(e,a,{weight:0,minlen:r});return}var d=cn(n,"_bt"),f=cn(n,"_bb"),c=n.node(a);n.setParent(d,a),c.borderTop=d,n.setParent(f,a),c.borderBottom=f,s(u,function(h){Dn(n,e,r,t,i,o,h);var l=n.node(h),v=l.borderTop?l.borderTop:h,p=l.borderBottom?l.borderBottom:h,b=l.borderTop?t:2*t,I=v!==p?1:i-o[a]+1;n.setEdge(d,v,{weight:b,minlen:I,nestingEdge:!0}),n.setEdge(p,f,{weight:b,minlen:I,nestingEdge:!0})}),n.parent(a)||n.setEdge(e,d,{weight:0,minlen:i+o[a]})}function Nr(n){var e={};function r(t,i){var o=n.children(t);o&&o.length&&s(o,function(a){r(a,i+1)}),e[t]=i}return s(n.children(),function(t){r(t,1)}),e}function Lr(n){return Y(n.edges(),function(e,r){return e+n.edge(r).weight},0)}function _r(n){var e=n.graph();n.removeNode(e.nestingRoot),delete e.nestingRoot,s(n.edges(),function(r){var t=n.edge(r);t.nestingEdge&&n.removeEdge(r)})}function Cr(n,e,r){var t={},i;s(r,function(o){for(var a=n.parent(o),u,d;a;){if(u=n.parent(a),u?(d=t[u],t[u]=a):(d=i,i=a),d&&d!==a){e.setEdge(d,a);return}a=u}})}function Ir(n,e,r){var t=Rr(n),i=new x({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return n.node(o)});return s(n.nodes(),function(o){var a=n.node(o),u=n.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(i.setNode(o),i.setParent(o,u||t),s(n[r](o),function(d){var f=d.v===o?d.w:d.v,c=i.edge(f,o),h=g(c)?0:c.weight;i.setEdge(f,o,{weight:n.edge(d).weight+h})}),w(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))}),i}function Rr(n){for(var e;n.hasNode(e=en("_root")););return e}function Tr(n,e){for(var r=0,t=1;t<e.length;++t)r+=Mr(n,e[t-1],e[t]);return r}function Mr(n,e,r){for(var t=De(r,m(r,function(f,c){return c})),i=_(m(e,function(f){return O(m(n.outEdges(f),function(c){return{pos:t[c.w],weight:n.edge(c).weight}}),"pos")})),o=1;o<r.length;)o<<=1;var a=2*o-1;o-=1;var u=m(new Array(a),function(){return 0}),d=0;return s(i.forEach(function(f){var c=f.pos+o;u[c]+=f.weight;for(var h=0;c>0;)c%2&&(h+=u[c+1]),c=c-1>>1,u[c]+=f.weight;d+=f.weight*h})),d}function Or(n){var e={},r=M(n.nodes(),function(u){return!n.children(u).length}),t=E(m(r,function(u){return n.node(u).rank})),i=m(N(t+1),function(){return[]});function o(u){if(!w(e,u)){e[u]=!0;var d=n.node(u);i[d.rank].push(u),s(n.successors(u),o)}}var a=O(r,function(u){return n.node(u).rank});return s(a,o),i}function Pr(n,e){return m(e,function(r){var t=n.inEdges(r);if(t.length){var i=Y(t,function(o,a){var u=n.edge(a),d=n.node(a.v);return{sum:o.sum+u.weight*d.order,weight:o.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function Sr(n,e){var r={};s(n,function(i,o){var a=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:o};g(i.barycenter)||(a.barycenter=i.barycenter,a.weight=i.weight)}),s(e.edges(),function(i){var o=r[i.v],a=r[i.w];!g(o)&&!g(a)&&(a.indegree++,o.out.push(r[i.w]))});var t=M(r,function(i){return!i.indegree});return Fr(t)}function Fr(n){var e=[];function r(o){return function(a){a.merged||(g(a.barycenter)||g(o.barycenter)||a.barycenter>=o.barycenter)&&Ar(o,a)}}function t(o){return function(a){a.in.push(o),--a.indegree===0&&n.push(a)}}for(;n.length;){var i=n.pop();e.push(i),s(i.in.reverse(),r(i)),s(i.out,t(i))}return m(M(e,function(o){return!o.merged}),function(o){return V(o,["vs","i","barycenter","weight"])})}function Ar(n,e){var r=0,t=0;n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.vs=e.vs.concat(n.vs),n.barycenter=r/t,n.weight=t,n.i=Math.min(e.i,n.i),e.merged=!0}function Br(n,e){var r=er(n,function(c){return w(c,"barycenter")}),t=r.lhs,i=O(r.rhs,function(c){return-c.i}),o=[],a=0,u=0,d=0;t.sort(Gr(!!e)),d=wn(o,i,d),s(t,function(c){d+=c.vs.length,o.push(c.vs),a+=c.barycenter*c.weight,u+=c.weight,d=wn(o,i,d)});var f={vs:_(o)};return u&&(f.barycenter=a/u,f.weight=u),f}function wn(n,e,r){for(var t;e.length&&(t=G(e)).i<=r;)e.pop(),n.push(t.vs),r++;return r}function Gr(n){return function(e,r){return e.barycenter<r.barycenter?-1:e.barycenter>r.barycenter?1:n?r.i-e.i:e.i-r.i}}function qn(n,e,r,t){var i=n.children(e),o=n.node(e),a=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,d={};a&&(i=M(i,function(p){return p!==a&&p!==u}));var f=Pr(n,i);s(f,function(p){if(n.children(p.v).length){var b=qn(n,p.v,r,t);d[p.v]=b,w(b,"barycenter")&&Yr(p,b)}});var c=Sr(f,r);Vr(c,d);var h=Br(c,t);if(a&&(h.vs=_([a,h.vs,u]),n.predecessors(a).length)){var l=n.node(n.predecessors(a)[0]),v=n.node(n.predecessors(u)[0]);w(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+l.order+v.order)/(h.weight+2),h.weight+=2}return h}function Vr(n,e){s(n,function(r){r.vs=_(r.vs.map(function(t){return e[t]?e[t].vs:t}))})}function Yr(n,e){g(n.barycenter)?(n.barycenter=e.barycenter,n.weight=e.weight):(n.barycenter=(n.barycenter*n.weight+e.barycenter*e.weight)/(n.weight+e.weight),n.weight+=e.weight)}function $r(n){var e=On(n),r=mn(n,N(1,e+1),"inEdges"),t=mn(n,N(e-1,-1,-1),"outEdges"),i=Or(n);bn(n,i);for(var o=Number.POSITIVE_INFINITY,a,u=0,d=0;d<4;++u,++d){Dr(u%2?r:t,u%4>=2),i=D(n);var f=Tr(n,i);f<o&&(d=0,a=xe(i),o=f)}bn(n,a)}function mn(n,e,r){return m(e,function(t){return Ir(n,t,r)})}function Dr(n,e){var r=new x;s(n,function(t){var i=t.graph().root,o=qn(t,i,r,e);s(o.vs,function(a,u){t.node(a).order=u}),Cr(t,r,o.vs)})}function bn(n,e){s(e,function(r){s(r,function(t,i){n.node(t).order=i})})}function qr(n){var e=zr(n);s(n.graph().dummyChains,function(r){for(var t=n.node(r),i=t.edgeObj,o=Wr(n,e,i.v,i.w),a=o.path,u=o.lca,d=0,f=a[d],c=!0;r!==i.w;){if(t=n.node(r),c){for(;(f=a[d])!==u&&n.node(f).maxRank<t.rank;)d++;f===u&&(c=!1)}if(!c){for(;d<a.length-1&&n.node(f=a[d+1]).minRank<=t.rank;)d++;f=a[d]}n.setParent(r,f),r=n.successors(r)[0]}})}function Wr(n,e,r,t){var i=[],o=[],a=Math.min(e[r].low,e[t].low),u=Math.max(e[r].lim,e[t].lim),d,f;d=r;do d=n.parent(d),i.push(d);while(d&&(e[d].low>a||u>e[d].lim));for(f=d,d=t;(d=n.parent(d))!==f;)o.push(d);return{path:i.concat(o.reverse()),lca:f}}function zr(n){var e={},r=0;function t(i){var o=r;s(n.children(i),t),e[i]={low:o,lim:r++}}return s(n.children(),t),e}function Xr(n,e){var r={};function t(i,o){var a=0,u=0,d=i.length,f=G(o);return s(o,function(c,h){var l=Hr(n,c),v=l?n.node(l).order:d;(l||c===f)&&(s(o.slice(u,h+1),function(p){s(n.predecessors(p),function(b){var I=n.node(b),on=I.order;(on<a||v<on)&&!(I.dummy&&n.node(p).dummy)&&Wn(r,b,p)})}),u=h+1,a=v)}),o}return Y(e,t),r}function Ur(n,e){var r={};function t(o,a,u,d,f){var c;s(N(a,u),function(h){c=o[h],n.node(c).dummy&&s(n.predecessors(c),function(l){var v=n.node(l);v.dummy&&(v.order<d||v.order>f)&&Wn(r,l,c)})})}function i(o,a){var u=-1,d,f=0;return s(a,function(c,h){if(n.node(c).dummy==="border"){var l=n.predecessors(c);l.length&&(d=n.node(l[0]).order,t(a,f,h,u,d),f=h,u=d)}t(a,f,a.length,d,o.length)}),a}return Y(e,i),r}function Hr(n,e){if(n.node(e).dummy)return Z(n.predecessors(e),function(r){return n.node(r).dummy})}function Wn(n,e,r){if(e>r){var t=e;e=r,r=t}var i=n[e];i||(n[e]=i={}),i[r]=!0}function jr(n,e,r){if(e>r){var t=e;e=r,r=t}return w(n[e],r)}function Jr(n,e,r,t){var i={},o={},a={};return s(e,function(u){s(u,function(d,f){i[d]=d,o[d]=d,a[d]=f})}),s(e,function(u){var d=-1;s(u,function(f){var c=t(f);if(c.length){c=O(c,function(b){return a[b]});for(var h=(c.length-1)/2,l=Math.floor(h),v=Math.ceil(h);l<=v;++l){var p=c[l];o[f]===f&&d<a[p]&&!jr(r,f,p)&&(o[p]=f,o[f]=i[f]=i[p],d=a[p])}}})}),{root:i,align:o}}function Kr(n,e,r,t,i){var o={},a=Zr(n,e,r,i),u=i?"borderLeft":"borderRight";function d(h,l){for(var v=a.nodes(),p=v.pop(),b={};p;)b[p]?h(p):(b[p]=!0,v.push(p),v=v.concat(l(p))),p=v.pop()}function f(h){o[h]=a.inEdges(h).reduce(function(l,v){return Math.max(l,o[v.v]+a.edge(v))},0)}function c(h){var l=a.outEdges(h).reduce(function(p,b){return Math.min(p,o[b.w]-a.edge(b))},Number.POSITIVE_INFINITY),v=n.node(h);l!==Number.POSITIVE_INFINITY&&v.borderType!==u&&(o[h]=Math.max(o[h],l))}return d(f,a.predecessors.bind(a)),d(c,a.successors.bind(a)),s(t,function(h){o[h]=o[r[h]]}),o}function Zr(n,e,r,t){var i=new x,o=n.graph(),a=tt(o.nodesep,o.edgesep,t);return s(e,function(u){var d;s(u,function(f){var c=r[f];if(i.setNode(c),d){var h=r[d],l=i.edge(h,c);i.setEdge(h,c,Math.max(a(n,f,d),l||0))}d=f})}),i}function Qr(n,e){return nn(y(e),function(r){var t=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return _e(r,function(o,a){var u=it(n,a)/2;t=Math.max(o+u,t),i=Math.min(o-u,i)}),t-i})}function nt(n,e){var r=y(e),t=R(r),i=E(r);s(["u","d"],function(o){s(["l","r"],function(a){var u=o+a,d=n[u],f;if(d!==e){var c=y(d);f=a==="l"?t-R(c):i-E(c),f&&(n[u]=$(d,function(h){return h+f}))}})})}function et(n,e){return $(n.ul,function(r,t){if(e)return n[e.toLowerCase()][t];var i=O(m(n,t));return(i[1]+i[2])/2})}function rt(n){var e=D(n),r=H(Xr(n,e),Ur(n,e)),t={},i;s(["u","d"],function(a){i=a==="u"?e:y(e).reverse(),s(["l","r"],function(u){u==="r"&&(i=m(i,function(h){return y(h).reverse()}));var d=(a==="u"?n.predecessors:n.successors).bind(n),f=Jr(n,i,r,d),c=Kr(n,i,f.root,f.align,u==="r");u==="r"&&(c=$(c,function(h){return-h})),t[a+u]=c})});var o=Qr(n,t);return nt(t,o),et(t,n.graph().align)}function tt(n,e,r){return function(t,i,o){var a=t.node(i),u=t.node(o),d=0,f;if(d+=a.width/2,w(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":f=-a.width/2;break;case"r":f=a.width/2;break}if(f&&(d+=r?f:-f),f=0,d+=(a.dummy?e:n)/2,d+=(u.dummy?e:n)/2,d+=u.width/2,w(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":f=u.width/2;break;case"r":f=-u.width/2;break}return f&&(d+=r?f:-f),f=0,d}}function it(n,e){return n.node(e).width}function at(n){n=Mn(n),ot(n),Ce(rt(n),function(e,r){n.node(r).x=e})}function ot(n){var e=D(n),r=n.graph().ranksep,t=0;s(e,function(i){var o=E(m(i,function(a){return n.node(a).height}));s(i,function(a){n.node(a).y=t+o/2}),t+=o+r})}function Ot(n,e){var r=rr;r("layout",function(){var t=r(" buildLayoutGraph",function(){return mt(n)});r(" runLayout",function(){ut(t,r)}),r(" updateInputGraph",function(){dt(n,t)})})}function ut(n,e){e(" makeSpaceForEdgeLabels",function(){bt(n)}),e(" removeSelfEdges",function(){Ct(n)}),e(" acyclic",function(){je(n)}),e(" nestingGraph.run",function(){yr(n)}),e(" rank",function(){xr(Mn(n))}),e(" injectEdgeLabelProxies",function(){gt(n)}),e(" removeEmptyRanks",function(){nr(n)}),e(" nestingGraph.cleanup",function(){_r(n)}),e(" normalizeRanks",function(){Qe(n)}),e(" assignRankMinMax",function(){xt(n)}),e(" removeEdgeLabelProxies",function(){Et(n)}),e(" normalize.run",function(){dr(n)}),e(" parentDummyChains",function(){qr(n)}),e(" addBorderSegments",function(){tr(n)}),e(" order",function(){$r(n)}),e(" insertSelfEdges",function(){It(n)}),e(" adjustCoordinateSystem",function(){ir(n)}),e(" position",function(){at(n)}),e(" positionSelfEdges",function(){Rt(n)}),e(" removeBorderNodes",function(){_t(n)}),e(" normalize.undo",function(){sr(n)}),e(" fixupEdgeLabelCoords",function(){Nt(n)}),e(" undoCoordinateSystem",function(){ar(n)}),e(" translateGraph",function(){kt(n)}),e(" assignNodeIntersects",function(){yt(n)}),e(" reversePoints",function(){Lt(n)}),e(" acyclic.undo",function(){Ke(n)})}function dt(n,e){s(n.nodes(),function(r){var t=n.node(r),i=e.node(r);t&&(t.x=i.x,t.y=i.y,e.children(r).length&&(t.width=i.width,t.height=i.height))}),s(n.edges(),function(r){var t=n.edge(r),i=e.edge(r);t.points=i.points,w(i,"x")&&(t.x=i.x,t.y=i.y)}),n.graph().width=e.graph().width,n.graph().height=e.graph().height}var ft=["nodesep","edgesep","ranksep","marginx","marginy"],st={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},ct=["acyclicer","ranker","rankdir","align"],ht=["width","height"],lt={width:0,height:0},vt=["minlen","weight","width","height","labeloffset"],pt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},wt=["labelpos"];function mt(n){var e=new x({multigraph:!0,compound:!0}),r=U(n.graph());return e.setGraph(H({},st,X(r,ft),V(r,ct))),s(n.nodes(),function(t){var i=U(n.node(t));e.setNode(t,ke(X(i,ht),lt)),e.setParent(t,n.parent(t))}),s(n.edges(),function(t){var i=U(n.edge(t));e.setEdge(t,H({},pt,X(i,vt),V(i,wt)))}),e}function bt(n){var e=n.graph();e.ranksep/=2,s(n.edges(),function(r){var t=n.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function gt(n){s(n.edges(),function(e){var r=n.edge(e);if(r.width&&r.height){var t=n.node(e.v),i=n.node(e.w),o={rank:(i.rank-t.rank)/2+t.rank,e};C(n,"edge-proxy",o,"_ep")}})}function xt(n){var e=0;s(n.nodes(),function(r){var t=n.node(r);t.borderTop&&(t.minRank=n.node(t.borderTop).rank,t.maxRank=n.node(t.borderBottom).rank,e=E(e,t.maxRank))}),n.graph().maxRank=e}function Et(n){s(n.nodes(),function(e){var r=n.node(e);r.dummy==="edge-proxy"&&(n.edge(r.e).labelRank=r.rank,n.removeNode(e))})}function kt(n){var e=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,i=0,o=n.graph(),a=o.marginx||0,u=o.marginy||0;function d(f){var c=f.x,h=f.y,l=f.width,v=f.height;e=Math.min(e,c-l/2),r=Math.max(r,c+l/2),t=Math.min(t,h-v/2),i=Math.max(i,h+v/2)}s(n.nodes(),function(f){d(n.node(f))}),s(n.edges(),function(f){var c=n.edge(f);w(c,"x")&&d(c)}),e-=a,t-=u,s(n.nodes(),function(f){var c=n.node(f);c.x-=e,c.y-=t}),s(n.edges(),function(f){var c=n.edge(f);s(c.points,function(h){h.x-=e,h.y-=t}),w(c,"x")&&(c.x-=e),w(c,"y")&&(c.y-=t)}),o.width=r-e+a,o.height=i-t+u}function yt(n){s(n.edges(),function(e){var r=n.edge(e),t=n.node(e.v),i=n.node(e.w),o,a;r.points?(o=r.points[0],a=r.points[r.points.length-1]):(r.points=[],o=i,a=t),r.points.unshift(sn(t,o)),r.points.push(sn(i,a))})}function Nt(n){s(n.edges(),function(e){var r=n.edge(e);if(w(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Lt(n){s(n.edges(),function(e){var r=n.edge(e);r.reversed&&r.points.reverse()})}function _t(n){s(n.nodes(),function(e){if(n.children(e).length){var r=n.node(e),t=n.node(r.borderTop),i=n.node(r.borderBottom),o=n.node(G(r.borderLeft)),a=n.node(G(r.borderRight));r.width=Math.abs(a.x-o.x),r.height=Math.abs(i.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),s(n.nodes(),function(e){n.node(e).dummy==="border"&&n.removeNode(e)})}function Ct(n){s(n.edges(),function(e){if(e.v===e.w){var r=n.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:n.edge(e)}),n.removeEdge(e)}})}function It(n){var e=D(n);s(e,function(r){var t=0;s(r,function(i,o){var a=n.node(i);a.order=o+t,s(a.selfEdges,function(u){C(n,"selfedge",{width:u.label.width,height:u.label.height,rank:a.rank,order:o+ ++t,e:u.e,label:u.label},"_se")}),delete a.selfEdges})})}function Rt(n){s(n.nodes(),function(e){var r=n.node(e);if(r.dummy==="selfedge"){var t=n.node(r.e.v),i=t.x+t.width/2,o=t.y,a=r.x-i,u=t.height/2;n.setEdge(r.e,r.label),n.removeNode(e),r.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{x:i+a,y:o},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],r.label.x=r.x,r.label.y=r.y}})}function X(n,e){return $(V(n,e),Number)}function U(n){var e={};return s(n,function(r,t){e[t.toLowerCase()]=r}),e}export{ke as d,Ot as l,m,V as p,N as r,en as u};
|
|
1
|
+
import{G as g}from"./graph.js";import{b as Te,p as ce,q as le,g as X,e as ee,l as F,o as Ie,s as Me,c as Se,u as je,d as f,i as m,f as _,v as x,r as M}from"./_baseUniq.js";import{f as O,b as he,a as Fe,c as Ve,d as Ae,t as V,m as w,e as P,h as ve,g as z,l as T,i as Be}from"./_basePickBy.js";import{b8 as Ge,b9 as Ye,ba as De,aT as qe,bb as We,aX as pe,aW as we,bc as $e,aS as q,aA as Xe,aZ as ze,aC as Ue,bd as W}from"./mermaid.core.js";function He(e){return Ge(Ye(e,void 0,O),e+"")}var Ze=1,Je=4;function Ke(e){return Te(e,Ze|Je)}function Qe(e,n){return e==null?e:De(e,ce(n),qe)}function en(e,n){return e&&le(e,ce(n))}function nn(e,n){return e>n}function S(e,n){var r={};return n=X(n),le(e,function(t,a,i){We(r,a,n(t,a,i))}),r}function y(e){return e&&e.length?he(e,pe,nn):void 0}function U(e,n){return e&&e.length?he(e,X(n),Fe):void 0}function rn(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}function tn(e,n){if(e!==n){var r=e!==void 0,t=e===null,a=e===e,i=ee(e),o=n!==void 0,u=n===null,d=n===n,s=ee(n);if(!u&&!s&&!i&&e>n||i&&o&&d&&!u&&!s||t&&o&&d||!r&&d||!a)return 1;if(!t&&!i&&!s&&e<n||s&&r&&a&&!t&&!i||u&&r&&a||!o&&a||!d)return-1}return 0}function an(e,n,r){for(var t=-1,a=e.criteria,i=n.criteria,o=a.length,u=r.length;++t<o;){var d=tn(a[t],i[t]);if(d){if(t>=u)return d;var s=r[t];return d*(s=="desc"?-1:1)}}return e.index-n.index}function on(e,n,r){n.length?n=F(n,function(i){return we(i)?function(o){return Ie(o,i.length===1?i[0]:i)}:i}):n=[pe];var t=-1;n=F(n,$e(X));var a=Ve(e,function(i,o,u){var d=F(n,function(s){return s(i)});return{criteria:d,index:++t,value:i}});return rn(a,function(i,o){return an(i,o,r)})}function un(e,n){return Ae(e,n,function(r,t){return Me(e,t)})}var I=He(function(e,n){return e==null?{}:un(e,n)}),dn=Math.ceil,sn=Math.max;function fn(e,n,r,t){for(var a=-1,i=sn(dn((n-e)/(r||1)),0),o=Array(i);i--;)o[++a]=e,e+=r;return o}function cn(e){return function(n,r,t){return t&&typeof t!="number"&&q(n,r,t)&&(r=t=void 0),n=V(n),r===void 0?(r=n,n=0):r=V(r),t=t===void 0?n<r?1:-1:V(t),fn(n,r,t)}}var E=cn(),R=Xe(function(e,n){if(e==null)return[];var r=n.length;return r>1&&q(e,n[0],n[1])?n=[]:r>2&&q(n[0],n[1],n[2])&&(n=[n[0]]),on(e,Se(n),[])}),ln=0;function H(e){var n=++ln;return je(e)+n}function hn(e,n,r){for(var t=-1,a=e.length,i=n.length,o={};++t<a;){var u=t<i?n[t]:void 0;r(o,e[t],u)}return o}function vn(e,n){return hn(e||[],n||[],ze)}class pn{constructor(){var n={};n._next=n._prev=n,this._sentinel=n}dequeue(){var n=this._sentinel,r=n._prev;if(r!==n)return ne(r),r}enqueue(n){var r=this._sentinel;n._prev&&n._next&&ne(n),n._next=r._next,r._next._prev=n,r._next=n,n._prev=r}toString(){for(var n=[],r=this._sentinel,t=r._prev;t!==r;)n.push(JSON.stringify(t,wn)),t=t._prev;return"["+n.join(", ")+"]"}}function ne(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function wn(e,n){if(e!=="_next"&&e!=="_prev")return n}var bn=Ue(1);function mn(e,n){if(e.nodeCount()<=1)return[];var r=yn(e,n||bn),t=gn(r.graph,r.buckets,r.zeroIdx);return O(w(t,function(a){return e.outEdges(a.v,a.w)}))}function gn(e,n,r){for(var t=[],a=n[n.length-1],i=n[0],o;e.nodeCount();){for(;o=i.dequeue();)A(e,n,r,o);for(;o=a.dequeue();)A(e,n,r,o);if(e.nodeCount()){for(var u=n.length-2;u>0;--u)if(o=n[u].dequeue(),o){t=t.concat(A(e,n,r,o,!0));break}}}return t}function A(e,n,r,t,a){var i=a?[]:void 0;return f(e.inEdges(t.v),function(o){var u=e.edge(o),d=e.node(o.v);a&&i.push({v:o.v,w:o.w}),d.out-=u,$(n,r,d)}),f(e.outEdges(t.v),function(o){var u=e.edge(o),d=o.w,s=e.node(d);s.in-=u,$(n,r,s)}),e.removeNode(t.v),i}function yn(e,n){var r=new g,t=0,a=0;f(e.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),f(e.edges(),function(u){var d=r.edge(u.v,u.w)||0,s=n(u),c=d+s;r.setEdge(u.v,u.w,c),a=Math.max(a,r.node(u.v).out+=s),t=Math.max(t,r.node(u.w).in+=s)});var i=E(a+t+3).map(function(){return new pn}),o=t+1;return f(r.nodes(),function(u){$(i,o,r.node(u))}),{graph:r,buckets:i,zeroIdx:o}}function $(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function kn(e){var n=e.graph().acyclicer==="greedy"?mn(e,r(e)):xn(e);f(n,function(t){var a=e.edge(t);e.removeEdge(t),a.forwardName=t.name,a.reversed=!0,e.setEdge(t.w,t.v,a,H("rev"))});function r(t){return function(a){return t.edge(a).weight}}}function xn(e){var n=[],r={},t={};function a(i){Object.prototype.hasOwnProperty.call(t,i)||(t[i]=!0,r[i]=!0,f(e.outEdges(i),function(o){Object.prototype.hasOwnProperty.call(r,o.w)?n.push(o):a(o.w)}),delete r[i])}return f(e.nodes(),a),n}function En(e){f(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function L(e,n,r,t){var a;do a=H(t);while(e.hasNode(a));return r.dummy=n,e.setNode(a,r),a}function On(e){var n=new g().setGraph(e.graph());return f(e.nodes(),function(r){n.setNode(r,e.node(r))}),f(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},a=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+a.weight,minlen:Math.max(t.minlen,a.minlen)})}),n}function be(e){var n=new g({multigraph:e.isMultigraph()}).setGraph(e.graph());return f(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),f(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function re(e,n){var r=e.x,t=e.y,a=n.x-r,i=n.y-t,o=e.width/2,u=e.height/2;if(!a&&!i)throw new Error("Not possible to find intersection inside of the rectangle");var d,s;return Math.abs(i)*o>Math.abs(a)*u?(i<0&&(u=-u),d=u*a/i,s=u):(a<0&&(o=-o),d=o,s=o*i/a),{x:r+d,y:t+s}}function j(e){var n=w(E(me(e)+1),function(){return[]});return f(e.nodes(),function(r){var t=e.node(r),a=t.rank;m(a)||(n[a][t.order]=r)}),n}function Ln(e){var n=P(w(e.nodes(),function(r){return e.node(r).rank}));f(e.nodes(),function(r){var t=e.node(r);ve(t,"rank")&&(t.rank-=n)})}function Nn(e){var n=P(w(e.nodes(),function(i){return e.node(i).rank})),r=[];f(e.nodes(),function(i){var o=e.node(i).rank-n;r[o]||(r[o]=[]),r[o].push(i)});var t=0,a=e.graph().nodeRankFactor;f(r,function(i,o){m(i)&&o%a!==0?--t:t&&f(i,function(u){e.node(u).rank+=t})})}function te(e,n,r,t){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=t),L(e,"border",a,n)}function me(e){return y(w(e.nodes(),function(n){var r=e.node(n).rank;if(!m(r))return r}))}function Pn(e,n){var r={lhs:[],rhs:[]};return f(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function Cn(e,n){return n()}function _n(e){function n(r){var t=e.children(r),a=e.node(r);if(t.length&&f(t,n),Object.prototype.hasOwnProperty.call(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var i=a.minRank,o=a.maxRank+1;i<o;++i)ae(e,"borderLeft","_bl",r,a,i),ae(e,"borderRight","_br",r,a,i)}}f(e.children(),n)}function ae(e,n,r,t,a,i){var o={width:0,height:0,rank:i,borderType:n},u=a[n][i-1],d=L(e,"border",o,r);a[n][i]=d,e.setParent(d,t),u&&e.setEdge(u,d,{weight:1})}function Rn(e){var n=e.graph().rankdir.toLowerCase();(n==="lr"||n==="rl")&&ge(e)}function Tn(e){var n=e.graph().rankdir.toLowerCase();(n==="bt"||n==="rl")&&In(e),(n==="lr"||n==="rl")&&(Mn(e),ge(e))}function ge(e){f(e.nodes(),function(n){ie(e.node(n))}),f(e.edges(),function(n){ie(e.edge(n))})}function ie(e){var n=e.width;e.width=e.height,e.height=n}function In(e){f(e.nodes(),function(n){B(e.node(n))}),f(e.edges(),function(n){var r=e.edge(n);f(r.points,B),Object.prototype.hasOwnProperty.call(r,"y")&&B(r)})}function B(e){e.y=-e.y}function Mn(e){f(e.nodes(),function(n){G(e.node(n))}),f(e.edges(),function(n){var r=e.edge(n);f(r.points,G),Object.prototype.hasOwnProperty.call(r,"x")&&G(r)})}function G(e){var n=e.x;e.x=e.y,e.y=n}function Sn(e){e.graph().dummyChains=[],f(e.edges(),function(n){jn(e,n)})}function jn(e,n){var r=n.v,t=e.node(r).rank,a=n.w,i=e.node(a).rank,o=n.name,u=e.edge(n),d=u.labelRank;if(i!==t+1){e.removeEdge(n);var s=void 0,c,l;for(l=0,++t;t<i;++l,++t)u.points=[],s={width:0,height:0,edgeLabel:u,edgeObj:n,rank:t},c=L(e,"edge",s,"_d"),t===d&&(s.width=u.width,s.height=u.height,s.dummy="edge-label",s.labelpos=u.labelpos),e.setEdge(r,c,{weight:u.weight},o),l===0&&e.graph().dummyChains.push(c),r=c;e.setEdge(r,a,{weight:u.weight},o)}}function Fn(e){f(e.graph().dummyChains,function(n){var r=e.node(n),t=r.edgeLabel,a;for(e.setEdge(r.edgeObj,t);r.dummy;)a=e.successors(n)[0],e.removeNode(n),t.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height),n=a,r=e.node(n)})}function Z(e){var n={};function r(t){var a=e.node(t);if(Object.prototype.hasOwnProperty.call(n,t))return a.rank;n[t]=!0;var i=P(w(e.outEdges(t),function(o){return r(o.w)-e.edge(o).minlen}));return(i===Number.POSITIVE_INFINITY||i===void 0||i===null)&&(i=0),a.rank=i}f(e.sources(),r)}function C(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function ye(e){var n=new g({directed:!1}),r=e.nodes()[0],t=e.nodeCount();n.setNode(r,{});for(var a,i;Vn(n,e)<t;)a=An(n,e),i=n.hasNode(a.v)?C(e,a):-C(e,a),Bn(n,e,i);return n}function Vn(e,n){function r(t){f(n.nodeEdges(t),function(a){var i=a.v,o=t===i?a.w:i;!e.hasNode(o)&&!C(n,a)&&(e.setNode(o,{}),e.setEdge(t,o,{}),r(o))})}return f(e.nodes(),r),e.nodeCount()}function An(e,n){return U(n.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return C(n,r)})}function Bn(e,n,r){f(e.nodes(),function(t){n.node(t).rank+=r})}function Gn(){}Gn.prototype=new Error;function ke(e,n,r){we(n)||(n=[n]);var t=(e.isDirected()?e.successors:e.neighbors).bind(e),a=[],i={};return f(n,function(o){if(!e.hasNode(o))throw new Error("Graph does not have node: "+o);xe(e,o,r==="post",i,t,a)}),a}function xe(e,n,r,t,a,i){Object.prototype.hasOwnProperty.call(t,n)||(t[n]=!0,r||i.push(n),f(a(n),function(o){xe(e,o,r,t,a,i)}),r&&i.push(n))}function Yn(e,n){return ke(e,n,"post")}function Dn(e,n){return ke(e,n,"pre")}k.initLowLimValues=K;k.initCutValues=J;k.calcCutValue=Ee;k.leaveEdge=Le;k.enterEdge=Ne;k.exchangeEdges=Pe;function k(e){e=On(e),Z(e);var n=ye(e);K(n),J(n,e);for(var r,t;r=Le(n);)t=Ne(n,e,r),Pe(n,e,r,t)}function J(e,n){var r=Yn(e,e.nodes());r=r.slice(0,r.length-1),f(r,function(t){qn(e,n,t)})}function qn(e,n,r){var t=e.node(r),a=t.parent;e.edge(r,a).cutvalue=Ee(e,n,r)}function Ee(e,n,r){var t=e.node(r),a=t.parent,i=!0,o=n.edge(r,a),u=0;return o||(i=!1,o=n.edge(a,r)),u=o.weight,f(n.nodeEdges(r),function(d){var s=d.v===r,c=s?d.w:d.v;if(c!==a){var l=s===i,h=n.edge(d).weight;if(u+=l?h:-h,$n(e,r,c)){var v=e.edge(r,c).cutvalue;u+=l?-v:v}}}),u}function K(e,n){arguments.length<2&&(n=e.nodes()[0]),Oe(e,{},1,n)}function Oe(e,n,r,t,a){var i=r,o=e.node(t);return n[t]=!0,f(e.neighbors(t),function(u){Object.prototype.hasOwnProperty.call(n,u)||(r=Oe(e,n,r,u,t))}),o.low=i,o.lim=r++,a?o.parent=a:delete o.parent,r}function Le(e){return z(e.edges(),function(n){return e.edge(n).cutvalue<0})}function Ne(e,n,r){var t=r.v,a=r.w;n.hasEdge(t,a)||(t=r.w,a=r.v);var i=e.node(t),o=e.node(a),u=i,d=!1;i.lim>o.lim&&(u=o,d=!0);var s=_(n.edges(),function(c){return d===oe(e,e.node(c.v),u)&&d!==oe(e,e.node(c.w),u)});return U(s,function(c){return C(n,c)})}function Pe(e,n,r,t){var a=r.v,i=r.w;e.removeEdge(a,i),e.setEdge(t.v,t.w,{}),K(e),J(e,n),Wn(e,n)}function Wn(e,n){var r=z(e.nodes(),function(a){return!n.node(a).parent}),t=Dn(e,r);t=t.slice(1),f(t,function(a){var i=e.node(a).parent,o=n.edge(a,i),u=!1;o||(o=n.edge(i,a),u=!0),n.node(a).rank=n.node(i).rank+(u?o.minlen:-o.minlen)})}function $n(e,n,r){return e.hasEdge(n,r)}function oe(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function Xn(e){switch(e.graph().ranker){case"network-simplex":ue(e);break;case"tight-tree":Un(e);break;case"longest-path":zn(e);break;default:ue(e)}}var zn=Z;function Un(e){Z(e),ye(e)}function ue(e){k(e)}function Hn(e){var n=L(e,"root",{},"_root"),r=Zn(e),t=y(x(r))-1,a=2*t+1;e.graph().nestingRoot=n,f(e.edges(),function(o){e.edge(o).minlen*=a});var i=Jn(e)+1;f(e.children(),function(o){Ce(e,n,a,i,t,r,o)}),e.graph().nodeRankFactor=a}function Ce(e,n,r,t,a,i,o){var u=e.children(o);if(!u.length){o!==n&&e.setEdge(n,o,{weight:0,minlen:r});return}var d=te(e,"_bt"),s=te(e,"_bb"),c=e.node(o);e.setParent(d,o),c.borderTop=d,e.setParent(s,o),c.borderBottom=s,f(u,function(l){Ce(e,n,r,t,a,i,l);var h=e.node(l),v=h.borderTop?h.borderTop:l,p=h.borderBottom?h.borderBottom:l,b=h.borderTop?t:2*t,N=v!==p?1:a-i[o]+1;e.setEdge(d,v,{weight:b,minlen:N,nestingEdge:!0}),e.setEdge(p,s,{weight:b,minlen:N,nestingEdge:!0})}),e.parent(o)||e.setEdge(n,d,{weight:0,minlen:a+i[o]})}function Zn(e){var n={};function r(t,a){var i=e.children(t);i&&i.length&&f(i,function(o){r(o,a+1)}),n[t]=a}return f(e.children(),function(t){r(t,1)}),n}function Jn(e){return M(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function Kn(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,f(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function Qn(e,n,r){var t={},a;f(r,function(i){for(var o=e.parent(i),u,d;o;){if(u=e.parent(o),u?(d=t[u],t[u]=o):(d=a,a=o),d&&d!==o){n.setEdge(d,o);return}o=u}})}function er(e,n,r){var t=nr(e),a=new g({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(i){return e.node(i)});return f(e.nodes(),function(i){var o=e.node(i),u=e.parent(i);(o.rank===n||o.minRank<=n&&n<=o.maxRank)&&(a.setNode(i),a.setParent(i,u||t),f(e[r](i),function(d){var s=d.v===i?d.w:d.v,c=a.edge(s,i),l=m(c)?0:c.weight;a.setEdge(s,i,{weight:e.edge(d).weight+l})}),Object.prototype.hasOwnProperty.call(o,"minRank")&&a.setNode(i,{borderLeft:o.borderLeft[n],borderRight:o.borderRight[n]}))}),a}function nr(e){for(var n;e.hasNode(n=H("_root")););return n}function rr(e,n){for(var r=0,t=1;t<n.length;++t)r+=tr(e,n[t-1],n[t]);return r}function tr(e,n,r){for(var t=vn(r,w(r,function(s,c){return c})),a=O(w(n,function(s){return R(w(e.outEdges(s),function(c){return{pos:t[c.w],weight:e.edge(c).weight}}),"pos")})),i=1;i<r.length;)i<<=1;var o=2*i-1;i-=1;var u=w(new Array(o),function(){return 0}),d=0;return f(a.forEach(function(s){var c=s.pos+i;u[c]+=s.weight;for(var l=0;c>0;)c%2&&(l+=u[c+1]),c=c-1>>1,u[c]+=s.weight;d+=s.weight*l})),d}function ar(e){var n={},r=_(e.nodes(),function(u){return!e.children(u).length}),t=y(w(r,function(u){return e.node(u).rank})),a=w(E(t+1),function(){return[]});function i(u){if(!ve(n,u)){n[u]=!0;var d=e.node(u);a[d.rank].push(u),f(e.successors(u),i)}}var o=R(r,function(u){return e.node(u).rank});return f(o,i),a}function ir(e,n){return w(n,function(r){var t=e.inEdges(r);if(t.length){var a=M(t,function(i,o){var u=e.edge(o),d=e.node(o.v);return{sum:i.sum+u.weight*d.order,weight:i.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:r}})}function or(e,n){var r={};f(e,function(a,i){var o=r[a.v]={indegree:0,in:[],out:[],vs:[a.v],i};m(a.barycenter)||(o.barycenter=a.barycenter,o.weight=a.weight)}),f(n.edges(),function(a){var i=r[a.v],o=r[a.w];!m(i)&&!m(o)&&(o.indegree++,i.out.push(r[a.w]))});var t=_(r,function(a){return!a.indegree});return ur(t)}function ur(e){var n=[];function r(i){return function(o){o.merged||(m(o.barycenter)||m(i.barycenter)||o.barycenter>=i.barycenter)&&dr(i,o)}}function t(i){return function(o){o.in.push(i),--o.indegree===0&&e.push(o)}}for(;e.length;){var a=e.pop();n.push(a),f(a.in.reverse(),r(a)),f(a.out,t(a))}return w(_(n,function(i){return!i.merged}),function(i){return I(i,["vs","i","barycenter","weight"])})}function dr(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function sr(e,n){var r=Pn(e,function(c){return Object.prototype.hasOwnProperty.call(c,"barycenter")}),t=r.lhs,a=R(r.rhs,function(c){return-c.i}),i=[],o=0,u=0,d=0;t.sort(fr(!!n)),d=de(i,a,d),f(t,function(c){d+=c.vs.length,i.push(c.vs),o+=c.barycenter*c.weight,u+=c.weight,d=de(i,a,d)});var s={vs:O(i)};return u&&(s.barycenter=o/u,s.weight=u),s}function de(e,n,r){for(var t;n.length&&(t=T(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function fr(e){return function(n,r){return n.barycenter<r.barycenter?-1:n.barycenter>r.barycenter?1:e?r.i-n.i:n.i-r.i}}function _e(e,n,r,t){var a=e.children(n),i=e.node(n),o=i?i.borderLeft:void 0,u=i?i.borderRight:void 0,d={};o&&(a=_(a,function(p){return p!==o&&p!==u}));var s=ir(e,a);f(s,function(p){if(e.children(p.v).length){var b=_e(e,p.v,r,t);d[p.v]=b,Object.prototype.hasOwnProperty.call(b,"barycenter")&&lr(p,b)}});var c=or(s,r);cr(c,d);var l=sr(c,t);if(o&&(l.vs=O([o,l.vs,u]),e.predecessors(o).length)){var h=e.node(e.predecessors(o)[0]),v=e.node(e.predecessors(u)[0]);Object.prototype.hasOwnProperty.call(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+v.order)/(l.weight+2),l.weight+=2}return l}function cr(e,n){f(e,function(r){r.vs=O(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function lr(e,n){m(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function hr(e){var n=me(e),r=se(e,E(1,n+1),"inEdges"),t=se(e,E(n-1,-1,-1),"outEdges"),a=ar(e);fe(e,a);for(var i=Number.POSITIVE_INFINITY,o,u=0,d=0;d<4;++u,++d){vr(u%2?r:t,u%4>=2),a=j(e);var s=rr(e,a);s<i&&(d=0,o=Ke(a),i=s)}fe(e,o)}function se(e,n,r){return w(n,function(t){return er(e,t,r)})}function vr(e,n){var r=new g;f(e,function(t){var a=t.graph().root,i=_e(t,a,r,n);f(i.vs,function(o,u){t.node(o).order=u}),Qn(t,r,i.vs)})}function fe(e,n){f(n,function(r){f(r,function(t,a){e.node(t).order=a})})}function pr(e){var n=br(e);f(e.graph().dummyChains,function(r){for(var t=e.node(r),a=t.edgeObj,i=wr(e,n,a.v,a.w),o=i.path,u=i.lca,d=0,s=o[d],c=!0;r!==a.w;){if(t=e.node(r),c){for(;(s=o[d])!==u&&e.node(s).maxRank<t.rank;)d++;s===u&&(c=!1)}if(!c){for(;d<o.length-1&&e.node(s=o[d+1]).minRank<=t.rank;)d++;s=o[d]}e.setParent(r,s),r=e.successors(r)[0]}})}function wr(e,n,r,t){var a=[],i=[],o=Math.min(n[r].low,n[t].low),u=Math.max(n[r].lim,n[t].lim),d,s;d=r;do d=e.parent(d),a.push(d);while(d&&(n[d].low>o||u>n[d].lim));for(s=d,d=t;(d=e.parent(d))!==s;)i.push(d);return{path:a.concat(i.reverse()),lca:s}}function br(e){var n={},r=0;function t(a){var i=r;f(e.children(a),t),n[a]={low:i,lim:r++}}return f(e.children(),t),n}function mr(e,n){var r={};function t(a,i){var o=0,u=0,d=a.length,s=T(i);return f(i,function(c,l){var h=yr(e,c),v=h?e.node(h).order:d;(h||c===s)&&(f(i.slice(u,l+1),function(p){f(e.predecessors(p),function(b){var N=e.node(b),Q=N.order;(Q<o||v<Q)&&!(N.dummy&&e.node(p).dummy)&&Re(r,b,p)})}),u=l+1,o=v)}),i}return M(n,t),r}function gr(e,n){var r={};function t(i,o,u,d,s){var c;f(E(o,u),function(l){c=i[l],e.node(c).dummy&&f(e.predecessors(c),function(h){var v=e.node(h);v.dummy&&(v.order<d||v.order>s)&&Re(r,h,c)})})}function a(i,o){var u=-1,d,s=0;return f(o,function(c,l){if(e.node(c).dummy==="border"){var h=e.predecessors(c);h.length&&(d=e.node(h[0]).order,t(o,s,l,u,d),s=l,u=d)}t(o,s,o.length,d,i.length)}),o}return M(n,a),r}function yr(e,n){if(e.node(n).dummy)return z(e.predecessors(n),function(r){return e.node(r).dummy})}function Re(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var a=e[n];Object.defineProperty(a,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function kr(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function xr(e,n,r,t){var a={},i={},o={};return f(n,function(u){f(u,function(d,s){a[d]=d,i[d]=d,o[d]=s})}),f(n,function(u){var d=-1;f(u,function(s){var c=t(s);if(c.length){c=R(c,function(b){return o[b]});for(var l=(c.length-1)/2,h=Math.floor(l),v=Math.ceil(l);h<=v;++h){var p=c[h];i[s]===s&&d<o[p]&&!kr(r,s,p)&&(i[p]=s,i[s]=a[s]=a[p],d=o[p])}}})}),{root:a,align:i}}function Er(e,n,r,t,a){var i={},o=Or(e,n,r,a),u=a?"borderLeft":"borderRight";function d(l,h){for(var v=o.nodes(),p=v.pop(),b={};p;)b[p]?l(p):(b[p]=!0,v.push(p),v=v.concat(h(p))),p=v.pop()}function s(l){i[l]=o.inEdges(l).reduce(function(h,v){return Math.max(h,i[v.v]+o.edge(v))},0)}function c(l){var h=o.outEdges(l).reduce(function(p,b){return Math.min(p,i[b.w]-o.edge(b))},Number.POSITIVE_INFINITY),v=e.node(l);h!==Number.POSITIVE_INFINITY&&v.borderType!==u&&(i[l]=Math.max(i[l],h))}return d(s,o.predecessors.bind(o)),d(c,o.successors.bind(o)),f(t,function(l){i[l]=i[r[l]]}),i}function Or(e,n,r,t){var a=new g,i=e.graph(),o=_r(i.nodesep,i.edgesep,t);return f(n,function(u){var d;f(u,function(s){var c=r[s];if(a.setNode(c),d){var l=r[d],h=a.edge(l,c);a.setEdge(l,c,Math.max(o(e,s,d),h||0))}d=s})}),a}function Lr(e,n){return U(x(n),function(r){var t=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return Qe(r,function(i,o){var u=Rr(e,o)/2;t=Math.max(i+u,t),a=Math.min(i-u,a)}),t-a})}function Nr(e,n){var r=x(n),t=P(r),a=y(r);f(["u","d"],function(i){f(["l","r"],function(o){var u=i+o,d=e[u],s;if(d!==n){var c=x(d);s=o==="l"?t-P(c):a-y(c),s&&(e[u]=S(d,function(l){return l+s}))}})})}function Pr(e,n){return S(e.ul,function(r,t){if(n)return e[n.toLowerCase()][t];var a=R(w(e,t));return(a[1]+a[2])/2})}function Cr(e){var n=j(e),r=W(mr(e,n),gr(e,n)),t={},a;f(["u","d"],function(o){a=o==="u"?n:x(n).reverse(),f(["l","r"],function(u){u==="r"&&(a=w(a,function(l){return x(l).reverse()}));var d=(o==="u"?e.predecessors:e.successors).bind(e),s=xr(e,a,r,d),c=Er(e,a,s.root,s.align,u==="r");u==="r"&&(c=S(c,function(l){return-l})),t[o+u]=c})});var i=Lr(e,t);return Nr(t,i),Pr(t,e.graph().align)}function _r(e,n,r){return function(t,a,i){var o=t.node(a),u=t.node(i),d=0,s;if(d+=o.width/2,Object.prototype.hasOwnProperty.call(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":s=-o.width/2;break;case"r":s=o.width/2;break}if(s&&(d+=r?s:-s),s=0,d+=(o.dummy?n:e)/2,d+=(u.dummy?n:e)/2,d+=u.width/2,Object.prototype.hasOwnProperty.call(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":s=u.width/2;break;case"r":s=-u.width/2;break}return s&&(d+=r?s:-s),s=0,d}}function Rr(e,n){return e.node(n).width}function Tr(e){e=be(e),Ir(e),en(Cr(e),function(n,r){e.node(r).x=n})}function Ir(e){var n=j(e),r=e.graph().ranksep,t=0;f(n,function(a){var i=y(w(a,function(o){return e.node(o).height}));f(a,function(o){e.node(o).y=t+i/2}),t+=i+r})}function ot(e,n){var r=Cn;r("layout",()=>{var t=r(" buildLayoutGraph",()=>qr(e));r(" runLayout",()=>Mr(t,r)),r(" updateInputGraph",()=>Sr(e,t))})}function Mr(e,n){n(" makeSpaceForEdgeLabels",()=>Wr(e)),n(" removeSelfEdges",()=>Qr(e)),n(" acyclic",()=>kn(e)),n(" nestingGraph.run",()=>Hn(e)),n(" rank",()=>Xn(be(e))),n(" injectEdgeLabelProxies",()=>$r(e)),n(" removeEmptyRanks",()=>Nn(e)),n(" nestingGraph.cleanup",()=>Kn(e)),n(" normalizeRanks",()=>Ln(e)),n(" assignRankMinMax",()=>Xr(e)),n(" removeEdgeLabelProxies",()=>zr(e)),n(" normalize.run",()=>Sn(e)),n(" parentDummyChains",()=>pr(e)),n(" addBorderSegments",()=>_n(e)),n(" order",()=>hr(e)),n(" insertSelfEdges",()=>et(e)),n(" adjustCoordinateSystem",()=>Rn(e)),n(" position",()=>Tr(e)),n(" positionSelfEdges",()=>nt(e)),n(" removeBorderNodes",()=>Kr(e)),n(" normalize.undo",()=>Fn(e)),n(" fixupEdgeLabelCoords",()=>Zr(e)),n(" undoCoordinateSystem",()=>Tn(e)),n(" translateGraph",()=>Ur(e)),n(" assignNodeIntersects",()=>Hr(e)),n(" reversePoints",()=>Jr(e)),n(" acyclic.undo",()=>En(e))}function Sr(e,n){f(e.nodes(),function(r){var t=e.node(r),a=n.node(r);t&&(t.x=a.x,t.y=a.y,n.children(r).length&&(t.width=a.width,t.height=a.height))}),f(e.edges(),function(r){var t=e.edge(r),a=n.edge(r);t.points=a.points,Object.prototype.hasOwnProperty.call(a,"x")&&(t.x=a.x,t.y=a.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var jr=["nodesep","edgesep","ranksep","marginx","marginy"],Fr={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Vr=["acyclicer","ranker","rankdir","align"],Ar=["width","height"],Br={width:0,height:0},Gr=["minlen","weight","width","height","labeloffset"],Yr={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Dr=["labelpos"];function qr(e){var n=new g({multigraph:!0,compound:!0}),r=D(e.graph());return n.setGraph(W({},Fr,Y(r,jr),I(r,Vr))),f(e.nodes(),function(t){var a=D(e.node(t));n.setNode(t,Be(Y(a,Ar),Br)),n.setParent(t,e.parent(t))}),f(e.edges(),function(t){var a=D(e.edge(t));n.setEdge(t,W({},Yr,Y(a,Gr),I(a,Dr)))}),n}function Wr(e){var n=e.graph();n.ranksep/=2,f(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function $r(e){f(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),a=e.node(n.w),i={rank:(a.rank-t.rank)/2+t.rank,e:n};L(e,"edge-proxy",i,"_ep")}})}function Xr(e){var n=0;f(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=y(n,t.maxRank))}),e.graph().maxRank=n}function zr(e){f(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function Ur(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,a=0,i=e.graph(),o=i.marginx||0,u=i.marginy||0;function d(s){var c=s.x,l=s.y,h=s.width,v=s.height;n=Math.min(n,c-h/2),r=Math.max(r,c+h/2),t=Math.min(t,l-v/2),a=Math.max(a,l+v/2)}f(e.nodes(),function(s){d(e.node(s))}),f(e.edges(),function(s){var c=e.edge(s);Object.prototype.hasOwnProperty.call(c,"x")&&d(c)}),n-=o,t-=u,f(e.nodes(),function(s){var c=e.node(s);c.x-=n,c.y-=t}),f(e.edges(),function(s){var c=e.edge(s);f(c.points,function(l){l.x-=n,l.y-=t}),Object.prototype.hasOwnProperty.call(c,"x")&&(c.x-=n),Object.prototype.hasOwnProperty.call(c,"y")&&(c.y-=t)}),i.width=r-n+o,i.height=a-t+u}function Hr(e){f(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),a=e.node(n.w),i,o;r.points?(i=r.points[0],o=r.points[r.points.length-1]):(r.points=[],i=a,o=t),r.points.unshift(re(t,i)),r.points.push(re(a,o))})}function Zr(e){f(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Jr(e){f(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function Kr(e){f(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),a=e.node(r.borderBottom),i=e.node(T(r.borderLeft)),o=e.node(T(r.borderRight));r.width=Math.abs(o.x-i.x),r.height=Math.abs(a.y-t.y),r.x=i.x+r.width/2,r.y=t.y+r.height/2}}),f(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function Qr(e){f(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function et(e){var n=j(e);f(n,function(r){var t=0;f(r,function(a,i){var o=e.node(a);o.order=i+t,f(o.selfEdges,function(u){L(e,"selfedge",{width:u.label.width,height:u.label.height,rank:o.rank,order:i+ ++t,e:u.e,label:u.label},"_se")}),delete o.selfEdges})})}function nt(e){f(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),a=t.x+t.width/2,i=t.y,o=r.x-a,u=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:a+2*o/3,y:i-u},{x:a+5*o/6,y:i-u},{x:a+o,y:i},{x:a+5*o/6,y:i+u},{x:a+2*o/3,y:i+u}],r.label.x=r.x,r.label.y=r.y}})}function Y(e,n){return S(I(e,n),Number)}function D(e){var n={};return f(e,function(r,t){n[t.toLowerCase()]=r}),n}export{ot as l};
|