@pickaxeproject/react 4.5.4 → 5.0.0
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/cjs/components/Pickaxe/Chat/Input.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/Questions/Submit.js +1 -1
- package/dist/cjs/node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.js +1 -1
- package/dist/cjs/node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.js +1 -1
- package/dist/cjs/node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js +1 -1
- package/dist/cjs/node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js +1 -1
- package/dist/esm/components/Pickaxe/Chat/Input.js +1 -1
- package/dist/esm/components/Pickaxe/Form/Questions/Submit.js +1 -1
- package/dist/esm/node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.js +1 -1
- package/dist/esm/node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.js +1 -1
- package/dist/esm/node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js +1 -1
- package/dist/esm/node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),s=require("react");require("../../../node_modules/.pnpm/regenerator-runtime@0.14.1/node_modules/regenerator-runtime/runtime.js");var n=require("react-speech-recognition"),r=require("../../../hooks/pickaxe/usePickaxeContext.js"),i=require("../../../hooks/pickaxe/useResponseContext.js"),o=require("../../../hooks/studio/useStyleInput.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),l=require("../../../hooks/pickaxe/useConversation.js"),c=require("../../../hooks/pickaxe/useDimensionContext.js"),u=require("../Addons/Auth/hooks/useAuthContext.js"),d=require("../../../hooks/pickaxe/useSubmit.js"),f=require("../Addons/Document/hooks/useDocument.js"),p=require("../Addons/Scroll/hooks/useScroll.js"),g=require("../Addons/Artifact/hooks/useArtifactContext.js"),h=require("../../../hooks/core/useHover.js"),m=require("../../../hooks/core/useMediaQuery.js"),v=require("../../../common/documents.js"),b=require("eventsource-parser"),j=require("../../Icons/attach-vertical.svg.js"),x=require("../../Icons/arrow-right.svg.js"),y=require("../../Icons/microphone.svg.js"),O=require("../../Icons/stop.svg.js"),k=require("../Addons/Document/List.js"),w=require("../../Core/Textarea.js"),S=require("../../Core/ErrorAlert.js"),C=require("../../../common/error.js"),N=require("../../../common/cn.js");function q(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var I=q(n);const A=s.forwardRef((({resubmitPrompt:q,onFocus:A,onBlur:_,onInputHeightChange:E,initSmitheryAuthData:R},D)=>{var T,H,F;const{origin:L,pickaxeId:P,sessionId:W,sender:M,senderType:$,deploymentId:z,deploymentType:J,pickaxe:B,styles:V,colors:U,locale:G,forceMobile:K,isNewChat:Q,isRtl:Y,isEmailLogin:X,isShowFeedbackMessage:Z,setIsNewChat:ee,setIsShowIceBreaker:te,onGenerateComplete:se}=r.usePickaxeContext(),{token:ne,isLoggedOut:re,isSent:ie}=u.useAuthContext(),{messages:oe,limits:ae,isGenerating:le,setMessages:ce,setStatus:ue,setLimitData:de,setError:fe}=i.useResponseContext(),{documents:pe,isUploading:ge,documentError:he,onFileUpload:me,setDocuments:ve,setDocumentError:be}=f.useDocument(),{scrollStartSession:je,scrollEndSession:xe,scrollToBottom:ye}=p.useScroll({auto:!0}),{artifacts:Oe,currentPopupType:ke,setArtifacts:we,setCurrentArtifact:Se}=g.useArtifactContext(),{height:Ce}=c.useDimensionContext(),Ne=l.useConversation(),qe=d.useSubmit(),[Ie,Ae]=s.useState(""),[_e,Ee]=s.useState(!1),[Re,De]=s.useState(!1),Te=s.useRef(null),He=s.useRef(""),Fe=s.useRef(null),Le=s.useRef(null),Pe=s.useRef(null),We=s.useRef(null),Me=Math.max(.2*Ce,100),{transcript:$e,listening:ze,resetTranscript:Je,browserSupportsSpeechRecognition:Be}=n.useSpeechRecognition(),[Ve]=m.useMediaQuery("(max-width: 480px)"),Ue=h.useHover(),{isHover:Ge}=Ue,Ke=e.__rest(Ue,["isHover"]),Qe=h.useHover(),{isHover:Ye}=Qe,Xe=e.__rest(Qe,["isHover"]),Ze=h.useHover(),{isHover:et}=Ze,tt=e.__rest(Ze,["isHover"]),[st,nt]=s.useState(!1),rt=a.useStyleFontSize(),it=o.useStyleInput(),ot=null===(T=null==B?void 0:B.documentuploadtype)||void 0===T?void 0:T.startsWith("enduserupload"),at=Be&&(null==B?void 0:B.enablevoicetotext),lt="chat-input"===J&&Q&&!ie,ct="chat-input"===J&&X&&re&&ie,ut=_e||Re,dt=s.useMemo((()=>{var e,t,s;return!!Q&&(!!B&&(!Ne.isLoading&&(!((null!==(t=null===(e=Ne.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&(!!(null===(s=B.icebreakers)||void 0===s?void 0:s.length)&&(!Z&&!lt)))))}),[B,Q,Z,lt,Ne.data,Ne.isLoading]),ft=s.useMemo((()=>{if(le||ge)return!1;const e=pe.length>0&&pe.every((e=>"finished"===e.status));return!(!Ie.trim()&&!e)&&pe.every((e=>"finished"===e.status||e.isInsertedAsRaw))}),[le,ge,Ie,pe]);s.useImperativeHandle(D,(()=>({onSubmit:pt}))),s.useEffect((()=>{te(dt)}),[dt]),s.useEffect((()=>{var e;if(q){const t=Array.from(oe),s=null===(e=t[t.length-2].parts.find((e=>"text"===e.type)))||void 0===e?void 0:e.content;pt(s,!0)}}),[q]),s.useEffect((()=>{if(!We.current||!E)return;const e=new ResizeObserver((e=>{for(const t of e)E(t.contentRect.height)}));return e.observe(We.current),()=>{e.disconnect()}}),[E]),s.useEffect((()=>{if(!ze)return;const e=He.current?`${He.current} `:"";Ae(`${e}${$e}`)}),[$e,ze]),s.useEffect((()=>{if(!Le.current)return;(()=>{if(!Le.current)return;let e=Le.current.scrollHeight>52;Ie.includes("\n")||pe.length?e=!0:Ie.trim()||(e=!1),Ee(e)})()}),[Ie,pe]),s.useEffect((()=>{const e=Le.current,t=Pe.current;if(!e||!t||_e||Ie.includes("\n"))return void De(!1);const s=window.getComputedStyle(e),n=`${s.fontStyle} ${s.fontVariant} ${s.fontWeight} ${s.fontSize} / ${s.lineHeight} ${s.fontFamily}`,r=document.createElement("span");Object.assign(r.style,{font:n,letterSpacing:s.letterSpacing,position:"absolute",visibility:"hidden",whiteSpace:"nowrap",top:"0",left:"0"}),r.textContent=Ie,document.body.appendChild(r);const i=r.offsetWidth;r.remove();const o=parseFloat(s.paddingLeft)||0,a=parseFloat(s.paddingRight)||0,l=e.clientWidth-o-a-t.offsetWidth;De(i>l)}),[Ie,_e]);const pt=(t,s=!1)=>e.__awaiter(void 0,void 0,void 0,(function*(){var e,n;try{if(le||ge)return;const r=pe.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)).map((e=>e.documentId)).filter(Boolean),i=r.length>0,o=null!=t?t:Ie;if(!o&&!i)return;fe(""),be(""),de(null),Ae(""),ee(!1),ue("fetching"),je(),ye();const a=null!==(n=null===(e=null==B?void 0:B.documentuploadtype)||void 0===e?void 0:e.startsWith("enduserupload"))&&void 0!==n&&n&&r.length>0,l=[...s?Array.from(oe.slice(0,oe.length-1)):Array.from(oe),...s?[]:[{id:oe.length+1,role:"user",parts:[{type:"text",content:o,isVisible:!0}],documentIds:a?r:[]}],{id:oe.length+(s?0:2),role:"assistant",parts:[],documentIds:[]}];ce(l),ye(),a&&ve([]);const c=(yield qe.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign({origin:L,pickaxeId:P,sessionId:W,senderType:$,value:o},a&&{documentIds:r}),M&&{sender:M}),ne&&{studioSessionToken:ne}),z&&{deploymentId:z}))).body;if(!c)throw new Error("Streaming error");const u=l.length-1,d=new TextDecoder;Fe.current=c.getReader();const f=[];let p="",g=!0,h=!1,m=[...null!=Oe?Oe:[]];const v=b.createParser({onEvent:e=>{var t,s;if("delta"===e.event){const n=JSON.parse(e.data);if("data-error"===n.type&&R){const e=n.data.error;if("string"==typeof e){if(/['"]type['"]\s*:\s*['"]unauthorized_smithery['"]/.test(e)){const t=e.match(/['"]qualifiedName['"]\s*:\s*['"]([^'"]+)['"]/),s=e.match(/['"]serverId['"]\s*:\s*['"]([^'"]+)['"]/),n=e.match(/['"]name['"]\s*:\s*['"]([^'"]+)['"]/);t&&t[1]&&s&&s[1]&&n&&n[1]&&(g=!1,R({smitheryId:t[1],serverId:s[1],name:n[1]}))}}else if("object"==typeof e&&null!==e){const t=e;"unauthorized_smithery"===t.type&&t.qualifiedName&&t.serverId&&t.name&&(g=!1,R({smitheryId:t.qualifiedName,serverId:t.serverId,name:t.name}))}}else if("text-start"===n.type)p="",f.push({type:"text",content:"",isVisible:null===(t=n.isVisible)||void 0===t||t}),ce([...l.slice(0,u),Object.assign(Object.assign({},l[l.length-1]),{id:oe.length+1,role:"assistant",parts:f})]);else if("text-delta"===n.type)p+=n.delta,f[f.length-1].content=p,ce([...l.slice(0,u),Object.assign(Object.assign({},l[l.length-1]),{id:oe.length+1,role:"assistant",parts:f})]);else if("text-end"===n.type)p="";else if("reasoning-start"===n.type)p="",f.push({type:"reasoning",content:"",isVisible:null===(s=n.isVisible)||void 0===s||s}),ce([...l.slice(0,u),Object.assign(Object.assign({},l[l.length-1]),{id:oe.length+1,role:"assistant",parts:f})]);else if("reasoning-delta"===n.type)p+=n.delta,f[f.length-1].content=p,ce([...l.slice(0,u),Object.assign(Object.assign({},l[l.length-1]),{id:oe.length+1,role:"assistant",parts:f})]);else if("reasoning-end"===n.type)p="";else if(n.type.startsWith("data-")){const e=n;f.push({type:e.type,content:JSON.stringify(e.data),isVisible:!0}),ce([...l.slice(0,u),Object.assign(Object.assign({},l[l.length-1]),{id:oe.length+1,role:"assistant",parts:f})])}}else if("artifact_created"===e.event){const t=JSON.parse(e.data);m=m.filter((e=>!(e.id===t.id&&e.version===t.version))),m.push(Object.assign(Object.assign({},t),{content:"",status:"streaming"})),we(m),ke.startsWith("inline")||Se({id:t.id,version:t.version})}else if("artifact_updated"===e.event){const t=JSON.parse(e.data);m=m.filter((e=>!(e.id===t.id&&e.version===t.version))),m.push(Object.assign(Object.assign({},t),{content:"",status:"updating"})),we(m),ke.startsWith("inline")||Se({id:t.id,version:t.version})}else if("artifact_rewrite"===e.event){const t=JSON.parse(e.data);m=m.filter((e=>!(e.id===t.id&&e.version===t.version))),m.push(Object.assign(Object.assign({},t),{content:"",status:"streaming"})),we(m),ke.startsWith("inline")||Se({id:t.id,version:t.version})}else if("artifact_content"===e.event){const t=JSON.parse(e.data),s=t.token.replace(/\u200B/g,"");m=m.map((e=>e.id===t.id&&e.version===t.version?Object.assign(Object.assign({},e),{content:e.content+s,status:"streaming"}):e)),we(m)}else if("artifact_finished"===e.event){const t=JSON.parse(e.data);we(m.map((e=>e.id===t.id?Object.assign(Object.assign({},e),{status:"finished"}):e)))}else if("error"===e.event){const t=JSON.parse(e.data);fe(t.error||"Something went wrong, please try again.")}else"stop"===e.event&&(g=!1)}});for(;g&&Fe.current;){const{value:e,done:t}=yield Fe.current.read();if(t){g=!1;break}const s=d.decode(e);s&&(h||(ue("streaming"),h=!0),v.feed(s))}null==se||se(W)}catch(e){if("AbortError"===e.name)return;let t=C.default(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const s=Object.entries(ae).find((([e])=>t.includes(e)));s?de(s[1]):fe(t)}finally{ye(),ue("idle"),xe(),Fe.current=null}}));return ct?null:t.jsx("div",Object.assign({className:N.default("z-1 absolute bottom-0 left-0 flex w-full flex-col items-center",!lt&&"px-4 pb-8"),dir:Y?"rtl":"ltr"},{children:t.jsxs("div",Object.assign({className:"flex w-full max-w-[800px] flex-col"},{children:[t.jsxs("div",Object.assign({ref:We,className:N.default("relative flex flex-col w-full justify-end gap-y-3 py-[3px]","block"===V.formFieldStyle&&"shadow"),style:Object.assign(Object.assign(Object.assign({},it),st&&{backgroundColor:"#EEEEEE"}),{maxHeight:`${Me}px`,overflowY:"auto"}),onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),nt(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),nt(!1)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),nt(!0)},onDrop:t=>e.__awaiter(void 0,void 0,void 0,(function*(){t.preventDefault(),t.stopPropagation(),nt(!1);const e=Array.from(t.dataTransfer.files||[]);e.length>0&&(ee(!1),yield me(e))}))},{children:[ze&&t.jsxs("div",Object.assign({className:"absolute left-4 top-1/2 flex -translate-y-1/2 select-none items-center gap-x-2"},{children:[t.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-c-secondary",style:{backgroundColor:null!==(H=U.accent)&&void 0!==H?H:"#ff0000"}}),t.jsx("span",Object.assign({className:"text-sm text-c-secondary font-semilight",style:{color:U.text+"90"}},{children:"Listening..."}))]})),!le&&pe.length>0&&t.jsx(k.default,{className:"p-4 pb-0",isDisabled:le}),t.jsx(w.default,Object.assign({ref:Le,className:N.default(rt.i1,"py-3.5 max-h-60 px-4 w-full border-transparent bg-transparent",!Ie.trim()&&!Ie.includes("\n")&&"overflow-hidden text-ellipsis whitespace-nowrap placeholder:whitespace-normal placeholder:overflow-visible",Y?"text-right":"text-left",ut&&"mb-12",ze&&"text-transparent"),value:Ie,placeholder:null!==(F=null==B?void 0:B.placeholdertext)&&void 0!==F?F:Y?"بماذا تريد أن تتحدث؟":"What do you want to talk about?",onChange:e=>{if(Ae(e),E){const t=(e.match(/\n/g)||[]).length+1;if(!e)return void E(0);if(t>=11)return;let s=0;t>1&&(s=50),E(24*(t-1)+s)}},onKeyDown:e=>{K||Ve||"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ge||le||pt()))},onPaste:t=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=Array.from(t.clipboardData.files||[]);e.length>0&&(t.preventDefault(),ee(!1),yield me(e))}))},A&&{onFocus:A},_&&{onBlur:_},{dir:Y?"rtl":"ltr"})),t.jsx("div",Object.assign({ref:Pe,className:N.default("flex items-center gap-2 absolute right-0 z-2 transition-all duration-200 ease-in-out",ut?"mb-2.5":"top-1/2 -translate-y-1/2"),style:Object.assign(Object.assign({},!ut&&it.backgroundColor&&{backgroundColor:it.backgroundColor}),{borderTopRightRadius:V.cornerRadius+"px",borderBottomRightRadius:V.cornerRadius+"px"})},{children:le?t.jsx("button",Object.assign({className:"flex h-8 w-8 items-center mr-2 justify-center rounded-full outline-none transition-colors duration-200 ease-in-out",onClick:()=>{Fe.current&&(Fe.current.cancel(),Fe.current=null),ue("idle")},style:{backgroundColor:U.accent,color:U.accentText}},{children:t.jsx(O.default,{className:"h-4 w-4 shrink-0"})})):ze?t.jsx("button",Object.assign({className:"flex h-8 w-8 items-center mr-2 justify-center rounded-full outline-none transition-colors duration-200 ease-in-out",onClick:I.default.stopListening,style:{backgroundColor:U.accent,color:U.accentText}},{children:t.jsx(O.default,{className:"h-4 w-4 shrink-0"})})):t.jsxs(t.Fragment,{children:[ot&&t.jsxs("button",Object.assign({className:"flex h-8 w-8 items-center justify-center rounded-full outline-none transition-colors duration-200 ease-in-out disabled:cursor-default",style:{backgroundColor:Ye?U.accent+"10":void 0,color:Ye?U.accent:U.accent+"80"},disabled:ge||le,onClick:()=>{var e;return null===(e=Te.current)||void 0===e?void 0:e.click()}},Xe,{children:[t.jsx("input",{id:"file-upload",ref:Te,type:"file",accept:[...v.allowedFileMimeTypes,...v.allowedImageMimeTypes,...v.additionalAllowedFileExtensions].join(", "),multiple:!0,hidden:!0,className:"hidden",onChange:t=>e.__awaiter(void 0,void 0,void 0,(function*(){ee(!1),yield me(Array.from(t.target.files||[])),t.target.value=""}))}),t.jsx(j.default,{className:"h-6 w-6 shrink-0"})]})),at&&t.jsx("button",Object.assign({className:"disabled:cursor-default flex h-8 w-8 items-center justify-center rounded-full outline-none transition-colors duration-200 ease-in-out",style:{backgroundColor:ze?U.accent:et?U.accent+"10":void 0,color:ze?U.accentText:et?U.accent:U.accent+"80"},disabled:ge||le,onClick:()=>{ze?I.default.stopListening():(He.current=Ie,Je(),I.default.startListening({continuous:!0,interimResults:!0,language:G||"en-US"}))}},tt,{children:t.jsx(y.default,{className:"h-5 w-5 shrink-0"})})),t.jsx("button",Object.assign({className:"flex h-8 w-8 items-center mr-2 justify-center rounded-full outline-none transition-colors duration-200 ease-in-out disabled:cursor-default",style:{backgroundColor:Ge||ft?U.accent:U.accent+"10",color:Ge||ft?U.accentText:U.accent+"80"},disabled:!ft,onClick:()=>pt()},Ke,{children:t.jsx(x.default,{className:N.default("h-6 w-6 shrink-0",Y&&"scale-x-[-1] transform")})}))]})}))]})),he&&t.jsx(S.default,{error:he,className:"mt-3"})]}))}))}));A.displayName="Input",exports.default=A;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),s=require("react");require("../../../node_modules/.pnpm/regenerator-runtime@0.14.1/node_modules/regenerator-runtime/runtime.js");var n=require("react-speech-recognition"),r=require("../../../hooks/pickaxe/usePickaxeContext.js"),i=require("../../../hooks/pickaxe/useResponseContext.js"),o=require("../../../hooks/studio/useStyleInput.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),l=require("../../../hooks/pickaxe/useConversation.js"),c=require("../../../hooks/pickaxe/useDimensionContext.js"),u=require("../Addons/Auth/hooks/useAuthContext.js"),d=require("../Addons/Document/hooks/useDocument.js"),f=require("../Addons/Scroll/hooks/useScroll.js"),p=require("../Addons/Artifact/hooks/useArtifactContext.js"),g=require("../../../hooks/core/useHover.js"),h=require("../../../hooks/core/useMediaQuery.js"),m=require("../../../common/documents.js"),v=require("eventsource-parser"),b=require("../../Icons/attach-vertical.svg.js"),y=require("../../Icons/arrow-right.svg.js"),x=require("../../Icons/microphone.svg.js"),j=require("../../Icons/stop.svg.js"),w=require("../Addons/Document/List.js"),S=require("../../Core/Textarea.js"),O=require("../../Core/ErrorAlert.js"),k=require("../../../common/error.js"),C=require("../../../common/cn.js");function N(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _=N(n);const I=s.forwardRef((({resubmitPrompt:N,onFocus:I,onBlur:E,onInputHeightChange:A,initSmitheryAuthData:T},q)=>{var R,P,D;const{origin:L,pickaxeId:H,sessionId:F,sender:M,senderType:$,deploymentId:W,deploymentType:B,pickaxe:J,styles:U,colors:z,locale:K,forceMobile:X,isNewChat:V,isRtl:G,isEmailLogin:Q,isShowFeedbackMessage:Y,setIsNewChat:Z,setIsShowIceBreaker:ee,onGenerateComplete:te}=r.usePickaxeContext(),{token:se,isLoggedOut:ne,isSent:re}=u.useAuthContext(),{messages:ie,limits:oe,isGenerating:ae,setMessages:le,setStatus:ce,setLimitData:ue,setError:de}=i.useResponseContext(),{documents:fe,isUploading:pe,documentError:ge,onFileUpload:he,setDocuments:me,setDocumentError:ve}=d.useDocument(),{scrollStartSession:be,scrollEndSession:ye,scrollToBottom:xe}=f.useScroll({auto:!0}),{artifacts:je,currentPopupType:we,setArtifacts:Se,setCurrentArtifact:Oe}=p.useArtifactContext(),{height:ke}=c.useDimensionContext(),Ce=l.useConversation(),[Ne,_e]=s.useState(""),[Ie,Ee]=s.useState(!1),[Ae,Te]=s.useState(!1),qe=s.useRef(null),Re=s.useRef(""),Pe=s.useRef(null),De=s.useRef(null),Le=s.useRef(null),He=s.useRef(null),Fe=s.useRef(null),Me=Math.max(.2*ke,100),{transcript:$e,listening:We,resetTranscript:Be,browserSupportsSpeechRecognition:Je}=n.useSpeechRecognition(),[Ue]=h.useMediaQuery("(max-width: 480px)"),ze=g.useHover(),{isHover:Ke}=ze,Xe=e.__rest(ze,["isHover"]),Ve=g.useHover(),{isHover:Ge}=Ve,Qe=e.__rest(Ve,["isHover"]),Ye=g.useHover(),{isHover:Ze}=Ye,et=e.__rest(Ye,["isHover"]),[tt,st]=s.useState(!1),nt=a.useStyleFontSize(),rt=o.useStyleInput(),it=null===(R=null==J?void 0:J.documentuploadtype)||void 0===R?void 0:R.startsWith("enduserupload"),ot=Je&&(null==J?void 0:J.enablevoicetotext),at="chat-input"===B&&V&&!re,lt="chat-input"===B&&Q&&ne&&re,ct=Ie||Ae,ut=s.useMemo((()=>{var e,t,s;return!!V&&(!!J&&(!Ce.isLoading&&(!((null!==(t=null===(e=Ce.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&(!!(null===(s=J.icebreakers)||void 0===s?void 0:s.length)&&(!Y&&!at)))))}),[J,V,Y,at,Ce.data,Ce.isLoading]),dt=s.useMemo((()=>{if(ae||pe)return!1;const e=fe.length>0&&fe.every((e=>"finished"===e.status));return!(!Ne.trim()&&!e)&&fe.every((e=>"finished"===e.status||e.isInsertedAsRaw))}),[ae,pe,Ne,fe]);s.useImperativeHandle(q,(()=>({onSubmit:ft}))),s.useEffect((()=>{ee(ut)}),[ut]),s.useEffect((()=>{var e;if(N){const t=Array.from(ie),s=null===(e=t[t.length-2].parts.find((e=>"text"===e.type)))||void 0===e?void 0:e.content;ft(s,!0)}}),[N]),s.useEffect((()=>{if(!He.current||!A)return;const e=new ResizeObserver((e=>{for(const t of e)A(t.contentRect.height)}));return e.observe(He.current),()=>{e.disconnect()}}),[A]),s.useEffect((()=>{if(!We)return;const e=Re.current?`${Re.current} `:"";_e(`${e}${$e}`)}),[$e,We]),s.useEffect((()=>{if(!De.current)return;(()=>{if(!De.current)return;let e=De.current.scrollHeight>52;Ne.includes("\n")||fe.length?e=!0:Ne.trim()||(e=!1),Ee(e)})()}),[Ne,fe]),s.useEffect((()=>{const e=De.current,t=Le.current;if(!e||!t||Ie||Ne.includes("\n"))return void Te(!1);const s=window.getComputedStyle(e),n=`${s.fontStyle} ${s.fontVariant} ${s.fontWeight} ${s.fontSize} / ${s.lineHeight} ${s.fontFamily}`,r=document.createElement("span");Object.assign(r.style,{font:n,letterSpacing:s.letterSpacing,position:"absolute",visibility:"hidden",whiteSpace:"nowrap",top:"0",left:"0"}),r.textContent=Ne,document.body.appendChild(r);const i=r.offsetWidth;r.remove();const o=parseFloat(s.paddingLeft)||0,a=parseFloat(s.paddingRight)||0,l=e.clientWidth-o-a-t.offsetWidth;Te(i>l)}),[Ne,Ie]);const ft=(t,s=!1)=>e.__awaiter(void 0,void 0,void 0,(function*(){var e,n,r;try{if(ae||pe)return;const i=fe.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)).map((e=>e.documentId)).filter(Boolean),o=i.length>0,a=null!=t?t:Ne;if(!a&&!o)return;de(""),ve(""),ue(null),_e(""),Z(!1),ce("fetching"),be(),xe();const l=null!==(n=null===(e=null==J?void 0:J.documentuploadtype)||void 0===e?void 0:e.startsWith("enduserupload"))&&void 0!==n&&n&&i.length>0,c=[...s?Array.from(ie.slice(0,ie.length-1)):Array.from(ie),...s?[]:[{id:ie.length+1,role:"user",parts:[{type:"text",content:a,isVisible:!0}],documentIds:l?i:[]}],{id:ie.length+(s?0:2),role:"assistant",parts:[],documentIds:[]}];le(c),xe(),l&&me([]);const u=yield fetch(`${process.env.NEXT_PUBLIC_PICKAXE_API_URL}/submit`,{method:"POST",headers:Object.assign({"Content-Type":"application/json"},process.env.NEXT_PUBLIC_PICKAXE_SESSION_TOKEN&&{"x-pickaxe-session-token":process.env.NEXT_PUBLIC_PICKAXE_SESSION_TOKEN}),body:JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign({origin:L,pickaxeId:H,sessionId:F,senderType:$,value:a},l&&{documentIds:i}),M&&{sender:M}),se&&{studioSessionToken:se}),W&&{deploymentId:W}))}),d=yield u.json();if(console.log("SubmitData: ",d),!d.success)throw new Error(d.error||"Failed to start generation");const f=d.submissionId;ce("streaming"),Fe.current=new AbortController;const p=c.length-1,g=[];let h=[...null!=je?je:[]],m=0,b=!1,y="";for(;!b;)try{const e=yield fetch(`${process.env.NEXT_PUBLIC_PICKAXE_API_URL}/stream/${f}?index=${m}`,{signal:null===(r=Fe.current)||void 0===r?void 0:r.signal,headers:{"Cache-Control":"no-cache",Connection:"keep-alive"}});if(!e.body)throw new Error("No response body");const t=e.body.getReader();Pe.current=t;const s=new TextDecoder,n=v.createParser({onEvent:e=>{var t,s;if(e.event&&"ping"!==e.event&&m++,"stop"!==e.event){if("error"===e.event){const t=JSON.parse(e.data);return de(t.error||"Something went wrong."),void(b=!0)}if("delta"===e.event){const n=JSON.parse(e.data);if("data-error"===n.type&&T){const e=n.data.error;if("string"==typeof e){if(/['"]type['"]\s*:\s*['"]unauthorized_smithery['"]/.test(e)){const t=e.match(/['"]qualifiedName['"]\s*:\s*['"]([^'"]+)['"]/),s=e.match(/['"]serverId['"]\s*:\s*['"]([^'"]+)['"]/),n=e.match(/['"]name['"]\s*:\s*['"]([^'"]+)['"]/);if(t&&t[1]&&s&&s[1]&&n&&n[1])throw b=!0,T({smitheryId:t[1],serverId:s[1],name:n[1]}),new Error("STOP_STREAM")}}else if("object"==typeof e&&null!==e){const t=e;if("unauthorized_smithery"===t.type&&t.qualifiedName&&t.serverId&&t.name)throw b=!0,T({smitheryId:t.qualifiedName,serverId:t.serverId,name:t.name}),new Error("STOP_STREAM")}}else if("text-start"===n.type)y="",g.push({type:"text",content:"",isVisible:null===(t=n.isVisible)||void 0===t||t});else if("text-delta"===n.type)y+=n.delta,g[g.length-1].content=y;else if("text-end"===n.type)y="";else if("reasoning-start"===n.type)y="",g.push({type:"reasoning",content:"",isVisible:null===(s=n.isVisible)||void 0===s||s});else if("reasoning-delta"===n.type)y+=n.delta,g[g.length-1].content=y;else if("reasoning-end"===n.type)y="";else if(n.type.startsWith("data-")){const e=n;g.push({type:e.type,content:JSON.stringify(e.data),isVisible:!0})}le([...c.slice(0,p),Object.assign(Object.assign({},c[c.length-1]),{id:ie.length+1,role:"assistant",parts:g})])}else if("artifact_created"===e.event){const t=JSON.parse(e.data);h=h.filter((e=>!(e.id===t.id&&e.version===t.version))),h.push(Object.assign(Object.assign({},t),{content:"",status:"streaming"})),Se([...h]),we.startsWith("inline")||Oe({id:t.id,version:t.version})}else if("artifact_updated"===e.event){const t=JSON.parse(e.data);h=h.filter((e=>!(e.id===t.id&&e.version===t.version))),h.push(Object.assign(Object.assign({},t),{content:"",status:"updating"})),Se(h),we.startsWith("inline")||Oe({id:t.id,version:t.version})}else if("artifact_rewrite"===e.event){const t=JSON.parse(e.data);h=h.filter((e=>!(e.id===t.id&&e.version===t.version))),h.push(Object.assign(Object.assign({},t),{content:"",status:"streaming"})),Se(h),we.startsWith("inline")||Oe({id:t.id,version:t.version})}else if("artifact_content"===e.event){const t=JSON.parse(e.data),s=t.token.replace(/\u200B/g,"");h=h.map((e=>e.id===t.id&&e.version===t.version?Object.assign(Object.assign({},e),{content:e.content+s,status:"streaming"}):e)),Se(h)}else if("artifact_finished"===e.event){const t=JSON.parse(e.data);Se(h.map((e=>e.id===t.id?Object.assign(Object.assign({},e),{status:"finished"}):e)))}else if("error"===e.event){const t=JSON.parse(e.data);de(t.error||"Something went wrong, please try again.")}else"stop"===e.event&&(b=!0)}else b=!0}});for(;;){const{value:e,done:r}=yield t.read();if(r)break;n.feed(s.decode(e))}b||(yield new Promise((e=>setTimeout(e,1e3))))}catch(e){if("STOP_STREAM"===e.message||"AbortError"===e.name)return void(b=!0);console.warn("Stream connection lost, retrying...",e),yield new Promise((e=>setTimeout(e,1e3)))}null==te||te(F)}catch(e){let t=k.default(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const s=Object.entries(oe).find((([e])=>t.includes(e)));s?ue(s[1]):de(t)}finally{xe(),ce("idle"),ye(),Pe.current=null}}));return lt?null:t.jsx("div",Object.assign({className:C.default("z-1 absolute bottom-0 left-0 flex w-full flex-col items-center",!at&&"px-4 pb-8"),dir:G?"rtl":"ltr"},{children:t.jsxs("div",Object.assign({className:"flex w-full max-w-[800px] flex-col"},{children:[t.jsxs("div",Object.assign({ref:He,className:C.default("relative flex flex-col w-full justify-end gap-y-3 py-[3px]","block"===U.formFieldStyle&&"shadow"),style:Object.assign(Object.assign(Object.assign({},rt),tt&&{backgroundColor:"#EEEEEE"}),{maxHeight:`${Me}px`,overflowY:"auto"}),onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),st(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),st(!1)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),st(!0)},onDrop:t=>e.__awaiter(void 0,void 0,void 0,(function*(){t.preventDefault(),t.stopPropagation(),st(!1);const e=Array.from(t.dataTransfer.files||[]);e.length>0&&(Z(!1),yield he(e))}))},{children:[We&&t.jsxs("div",Object.assign({className:"absolute left-4 top-1/2 flex -translate-y-1/2 select-none items-center gap-x-2"},{children:[t.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-c-secondary",style:{backgroundColor:null!==(P=z.accent)&&void 0!==P?P:"#ff0000"}}),t.jsx("span",Object.assign({className:"text-sm text-c-secondary font-semilight",style:{color:z.text+"90"}},{children:"Listening..."}))]})),!ae&&fe.length>0&&t.jsx(w.default,{className:"p-4 pb-0",isDisabled:ae}),t.jsx(S.default,Object.assign({ref:De,className:C.default(nt.i1,"py-3.5 max-h-60 px-4 w-full border-transparent bg-transparent",!Ne.trim()&&!Ne.includes("\n")&&"overflow-hidden text-ellipsis whitespace-nowrap placeholder:whitespace-normal placeholder:overflow-visible",G?"text-right":"text-left",ct&&"mb-12",We&&"text-transparent"),value:Ne,placeholder:null!==(D=null==J?void 0:J.placeholdertext)&&void 0!==D?D:G?"بماذا تريد أن تتحدث؟":"What do you want to talk about?",onChange:e=>{if(_e(e),A){const t=(e.match(/\n/g)||[]).length+1;if(!e)return void A(0);if(t>=11)return;let s=0;t>1&&(s=50),A(24*(t-1)+s)}},onKeyDown:e=>{X||Ue||"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),pe||ae||ft()))},onPaste:t=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=Array.from(t.clipboardData.files||[]);e.length>0&&(t.preventDefault(),Z(!1),yield he(e))}))},I&&{onFocus:I},E&&{onBlur:E},{dir:G?"rtl":"ltr"})),t.jsx("div",Object.assign({ref:Le,className:C.default("flex items-center gap-2 absolute right-0 z-2 transition-all duration-200 ease-in-out",ct?"mb-2.5":"top-1/2 -translate-y-1/2"),style:Object.assign(Object.assign({},!ct&&rt.backgroundColor&&{backgroundColor:rt.backgroundColor}),{borderTopRightRadius:U.cornerRadius+"px",borderBottomRightRadius:U.cornerRadius+"px"})},{children:ae?t.jsx("button",Object.assign({className:"flex h-8 w-8 items-center mr-2 justify-center rounded-full outline-none transition-colors duration-200 ease-in-out",onClick:()=>{Fe.current&&(Fe.current.abort(),Fe.current=null),Pe.current&&(Pe.current.cancel(),Pe.current=null),ce("idle")},style:{backgroundColor:z.accent,color:z.accentText}},{children:t.jsx(j.default,{className:"h-4 w-4 shrink-0"})})):We?t.jsx("button",Object.assign({className:"flex h-8 w-8 items-center mr-2 justify-center rounded-full outline-none transition-colors duration-200 ease-in-out",onClick:_.default.stopListening,style:{backgroundColor:z.accent,color:z.accentText}},{children:t.jsx(j.default,{className:"h-4 w-4 shrink-0"})})):t.jsxs(t.Fragment,{children:[it&&t.jsxs("button",Object.assign({className:"flex h-8 w-8 items-center justify-center rounded-full outline-none transition-colors duration-200 ease-in-out disabled:cursor-default",style:{backgroundColor:Ge?z.accent+"10":void 0,color:Ge?z.accent:z.accent+"80"},disabled:pe||ae,onClick:()=>{var e;return null===(e=qe.current)||void 0===e?void 0:e.click()}},Qe,{children:[t.jsx("input",{id:"file-upload",ref:qe,type:"file",accept:[...m.allowedFileMimeTypes,...m.allowedImageMimeTypes,...m.additionalAllowedFileExtensions].join(", "),multiple:!0,hidden:!0,className:"hidden",onChange:t=>e.__awaiter(void 0,void 0,void 0,(function*(){Z(!1),yield he(Array.from(t.target.files||[])),t.target.value=""}))}),t.jsx(b.default,{className:"h-6 w-6 shrink-0"})]})),ot&&t.jsx("button",Object.assign({className:"disabled:cursor-default flex h-8 w-8 items-center justify-center rounded-full outline-none transition-colors duration-200 ease-in-out",style:{backgroundColor:We?z.accent:Ze?z.accent+"10":void 0,color:We?z.accentText:Ze?z.accent:z.accent+"80"},disabled:pe||ae,onClick:()=>{We?_.default.stopListening():(Re.current=Ne,Be(),_.default.startListening({continuous:!0,interimResults:!0,language:K||"en-US"}))}},et,{children:t.jsx(x.default,{className:"h-5 w-5 shrink-0"})})),t.jsx("button",Object.assign({className:"flex h-8 w-8 items-center mr-2 justify-center rounded-full outline-none transition-colors duration-200 ease-in-out disabled:cursor-default",style:{backgroundColor:Ke||dt?z.accent:z.accent+"10",color:Ke||dt?z.accentText:z.accent+"80"},disabled:!dt,onClick:()=>ft()},Xe,{children:t.jsx(y.default,{className:C.default("h-6 w-6 shrink-0",G&&"scale-x-[-1] transform")})}))]})}))]})),ge&&t.jsx(O.default,{error:ge,className:"mt-3"})]}))}))}));I.displayName="Input",exports.default=I;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),s=require("react"),n=require("../../../../hooks/pickaxe/usePickaxeContext.js"),i=require("../../Addons/Auth/hooks/useAuthContext.js"),o=require("../../../../hooks/pickaxe/useResponseContext.js"),r=require("../../Addons/Document/hooks/useDocument.js"),a=require("../../Addons/Scroll/hooks/useScroll.js"),l=require("../../Addons/Artifact/hooks/useArtifactContext.js"),d=require("../../../../common/utils.js"),c=require("@nem035/gpt-3-encoder"),u=require("eventsource-parser"),p=require("../../common/PickaxeBranding.js"),m=require("../../common/PickaxeButton.js"),g=require("../../../../common/error.js");exports.default=({questions:f,resetQuestions:h})=>{var v;const{origin:b,pickaxeId:x,sender:y,senderType:j,deploymentId:O,pickaxe:w,misc:C,translations:S,isRtl:k,setSessionId:I,setIsNewChat:_,onGenerateComplete:P}=n.usePickaxeContext(),{token:A}=i.useAuthContext(),{limits:N,isGenerating:q,setResponse:E,setMessages:T,setStatus:U,setLimitData:L,setError:D,setIsSwitchedToChat:R}=o.useResponseContext(),{documents:J,websiteLink:B,isUploading:K,onWebsiteUpload:W,setDocuments:X,setDocumentError:V}=r.useDocument(),{scrollStartSession:M,scrollEndSession:$,scrollToTarget:F}=a.useScroll({auto:!(null==w?void 0:w.enablechatresponses)}),{artifacts:G,currentPopupType:Q,setArtifacts:Y,setCurrentArtifact:z}=l.useArtifactContext(),[H,Z]=s.useState(!1),ee=s.useRef(null),te=s.useMemo((()=>f.some((e=>("Short Answer"===e.type||"Long Answer"===e.type||"long"===e.type||"short"===e.type||"Checkbox"===e.type||"Knowledge Upload"===e.type||e.id.includes("documentupload"))&&e.input.length>0))),[f]);return t.jsxs("div",Object.assign({className:"mt-4 flex flex-wrap justify-between gap-4 items-center",dir:k?"rtl":"ltr"},{children:[t.jsxs("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:[t.jsx(m.default,Object.assign({className:"px-5 min-h-[42px]",isDisabled:K||q||H,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){var e,t,s;try{if(q||K||H)return;D(""),V(""),L(null),E(null);const n=["Multiple Choice","Checkbox"];for(const e of f){if(c.encode(e.input).length>e.maxLength&&!n.includes(e.type))throw new Error("One or more of your responses is too long!");if(e.isRequired&&!e.input.trim()&&"userinput:documentupload"!==e.id)throw new Error("You must fill out all required fields.")}const i=J.filter((e=>"finished"===e.status)),o=J.map((e=>e.name)),r=null!==(t=null===(e=null==w?void 0:w.documentuploadtype)||void 0===e?void 0:e.startsWith("enduserupload"))&&void 0!==t&&t,a=f.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),l=d.extractUrlsFromText(B).filter((e=>!o.includes(e)));if(l.length){const e=l[l.length-1];Z(!0);const t=yield W(e);t&&(i.push(t),yield new Promise((e=>setTimeout(e,5e3)))),Z(!1)}else if(a&&r&&!i.length)return void V("Please paste a valid website/video link or drag a file to add to the knowledge base.");const p=i.map((e=>e.documentId)).filter(Boolean),m=r&&p.length>0;let g={};f.forEach((e=>{g[e.id]="Knowledge Upload"===e.type||e.id.includes("documentupload")?i.map((e=>e.name)).join(",")||"":e.input})),U("fetching"),M(),F();const h=yield fetch(`${process.env.NEXT_PUBLIC_PICKAXE_API_URL}/submit`,{method:"POST",headers:Object.assign({"Content-Type":"application/json"},process.env.NEXT_PUBLIC_PICKAXE_SESSION_TOKEN&&{"x-pickaxe-session-token":process.env.NEXT_PUBLIC_PICKAXE_SESSION_TOKEN}),body:JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign({origin:b,pickaxeId:x,senderType:j,valueObj:g},m&&{documentIds:p}),y&&{sender:y}),A&&{studioSessionToken:A}),O&&{deploymentId:O}))}),v=yield h.json();if(!v.success)throw new Error(v.error||"Failed to start generation");const C=v.submissionId,S=v.sessionId,k={sessionId:S,documentIds:m?p:[],question:{inputs:f.map((e=>({id:e.id,question:e.main,answer:e.input}))),responseParts:[]},messageCount:0,sentAt:new Date};E(k),(null==w?void 0:w.enablechatresponses)&&(I(S),_(!1),R(!0),T([{id:0,role:"assistant",parts:[],documentIds:[]}])),m&&X([]),U("streaming"),ee.current=new AbortController;const N=[];let $=[...null!=G?G:[]],te=0,se=!1,ne="";for(;!se;)try{const e=yield fetch(`${process.env.NEXT_PUBLIC_PICKAXE_API_URL}/stream/${C}?index=${te}`,{signal:null===(s=ee.current)||void 0===s?void 0:s.signal,headers:{"Cache-Control":"no-cache",Connection:"keep-alive"}});if(!e.body)throw new Error("No response body");const t=e.body.getReader(),n=new TextDecoder,i=u.createParser({onEvent:e=>{var t,s;if(e.event&&"ping"!==e.event&&te++,"stop"!==e.event){if("error"===e.event){const t=JSON.parse(e.data);return D(t.error||"Something went wrong."),void(se=!0)}if("delta"===e.event){const n=JSON.parse(e.data);if("text-start"===n.type)ne="",N.push({type:"text",content:"",isVisible:null===(t=n.isVisible)||void 0===t||t});else if("text-delta"===n.type)ne+=n.delta,N[N.length-1].content=ne;else if("text-end"===n.type)ne="";else if("reasoning-start"===n.type)ne="",N.push({type:"reasoning",content:"",isVisible:null===(s=n.isVisible)||void 0===s||s});else if("reasoning-delta"===n.type)ne+=n.delta,N[N.length-1].content=ne;else if("reasoning-end"===n.type)ne="";else if(n.type.startsWith("data-")){const e=n;N.push({type:e.type,content:JSON.stringify(e.data),isVisible:!0})}const i=Object.assign(Object.assign({},k),{question:Object.assign(Object.assign({},k.question),{responseParts:[...N]})});E(i),(null==w?void 0:w.enablechatresponses)&&T([{id:0,role:"assistant",parts:[...N],documentIds:[]}])}else if("artifact_created"===e.event){const t=JSON.parse(e.data);$=$.filter((e=>!(e.id===t.id&&e.version===t.version))),$.push(Object.assign(Object.assign({},t),{content:"",status:"streaming"})),Y([...$]),Q.startsWith("inline")||z({id:t.id,version:t.version})}else if("artifact_updated"===e.event){const t=JSON.parse(e.data);$=$.filter((e=>!(e.id===t.id&&e.version===t.version))),$.push(Object.assign(Object.assign({},t),{content:"",status:"updating"})),Y([...$]),Q.startsWith("inline")||z({id:t.id,version:t.version})}else if("artifact_rewrite"===e.event){const t=JSON.parse(e.data);$=$.filter((e=>!(e.id===t.id&&e.version===t.version))),$.push(Object.assign(Object.assign({},t),{content:"",status:"streaming"})),Y([...$]),Q.startsWith("inline")||z({id:t.id,version:t.version})}else if("artifact_content"===e.event){const t=JSON.parse(e.data),s=t.token.replace(/\u200B/g,"");$=$.map((e=>e.id===t.id&&e.version===t.version?Object.assign(Object.assign({},e),{content:e.content+s,status:"streaming"}):e)),Y([...$])}else if("artifact_finished"===e.event){const t=JSON.parse(e.data);Y($.map((e=>e.id===t.id?Object.assign(Object.assign({},e),{status:"finished"}):e)))}}else se=!0}});for(;;){const{value:e,done:s}=yield t.read();if(s)break;i.feed(n.decode(e))}se||(yield new Promise((e=>setTimeout(e,1e3))))}catch(e){if("AbortError"===e.name)return void(se=!0);console.warn("Stream connection lost, retrying...",e),yield new Promise((e=>setTimeout(e,1e3)))}null==P||P(S)}catch(e){let t=g.default(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const s=Object.entries(N).find((([e])=>t.includes(e)));s?L(s[1]):D(t),F()}finally{U("idle"),Z(!1),$()}}))},{children:H?(null==S?void 0:S.processing)||"Processing...":K?(null==S?void 0:S.uploading)||"Uploading...":q?(null==S?void 0:S.loading)||"Loading...":null!==(v=null==w?void 0:w.submittext)&&void 0!==v?v:"Submit"})),te&&t.jsx(m.default,Object.assign({variant:"transparent-text",className:"min-h-[42px] px-5",isDisabled:K||q||H,onClick:h},{children:(null==S?void 0:S["clear-form"])||"Clear form"}))]})),!C.isWhiteLabel&&t.jsx(p.default,{containerClassName:"justify-end"})]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("../../../../../_virtual/_commonjsHelpers.js"),r=require("../../../../../_virtual/cose-base.js"),i=require("../../../layout-base@1.0.2/node_modules/layout-base/layout-base.js");r.__module.exports,exports.__require=function(){return t||(t=1,o=r.__module,r.__module.exports,e.commonjsGlobal,n=function(t){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.i=function(t){return t},r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}([function(e,r){e.exports=t},function(t,e,r){var i=r(0).FDLayoutConstants;function o(){}for(var n in i)o[n]=i[n];o.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,o.DEFAULT_RADIAL_SEPARATION=i.DEFAULT_EDGE_LENGTH,o.DEFAULT_COMPONENT_SEPERATION=60,o.TILE=!0,o.TILING_PADDING_VERTICAL=10,o.TILING_PADDING_HORIZONTAL=10,o.TREE_REDUCTION_ON_INCREMENTAL=!1,t.exports=o},function(t,e,r){var i=r(0).FDLayoutEdge;function o(t,e,r){i.call(this,t,e,r)}for(var n in o.prototype=Object.create(i.prototype),i)o[n]=i[n];t.exports=o},function(t,e,r){var i=r(0).LGraph;function o(t,e,r){i.call(this,t,e,r)}for(var n in o.prototype=Object.create(i.prototype),i)o[n]=i[n];t.exports=o},function(t,e,r){var i=r(0).LGraphManager;function o(t){i.call(this,t)}for(var n in o.prototype=Object.create(i.prototype),i)o[n]=i[n];t.exports=o},function(t,e,r){var i=r(0).FDLayoutNode,o=r(0).IMath;function n(t,e,r,o){i.call(this,t,e,r,o)}for(var a in n.prototype=Object.create(i.prototype),i)n[a]=i[a];n.prototype.move=function(){var t=this.graphManager.getLayout();this.displacementX=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*o.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*o.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),t.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},n.prototype.propogateDisplacementToChildren=function(t,e){for(var r,i=this.getChild().getNodes(),o=0;o<i.length;o++)null==(r=i[o]).getChild()?(r.moveBy(t,e),r.displacementX+=t,r.displacementY+=e):r.propogateDisplacementToChildren(t,e)},n.prototype.setPred1=function(t){this.pred1=t},n.prototype.getPred1=function(){return pred1},n.prototype.getPred2=function(){return pred2},n.prototype.setNext=function(t){this.next=t},n.prototype.getNext=function(){return next},n.prototype.setProcessed=function(t){this.processed=t},n.prototype.isProcessed=function(){return processed},t.exports=n},function(t,e,r){var i=r(0).FDLayout,o=r(4),n=r(3),a=r(5),s=r(2),h=r(1),d=r(0).FDLayoutConstants,g=r(0).LayoutConstants,l=r(0).Point,p=r(0).PointD,c=r(0).Layout,u=r(0).Integer,f=r(0).IGeometry,v=r(0).LGraph,T=r(0).Transform;function E(){i.call(this),this.toBeTiled={}}for(var m in E.prototype=Object.create(i.prototype),i)E[m]=i[m];E.prototype.newGraphManager=function(){var t=new o(this);return this.graphManager=t,t},E.prototype.newGraph=function(t){return new n(null,this.graphManager,t)},E.prototype.newNode=function(t){return new a(this.graphManager,t)},E.prototype.newEdge=function(t){return new s(null,null,t)},E.prototype.initParameters=function(){i.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=d.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=d.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=d.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},E.prototype.layout=function(){return g.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},E.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)h.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),e=new Set(this.getAllNodes()),r=this.nodesWithGravity.filter((function(t){return e.has(t)})),this.graphManager.setAllNodesToApplyGravitation(r));else{var t=this.getFlatForest();if(t.length>0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),r=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(r),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},E.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var r=!this.isTreeGrowing&&!this.isGrowthFinished,i=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(r,i),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},E.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},r=0;r<t.length;r++){var i=t[r].rect,o=t[r].id;e[o]={id:o,x:i.getCenterX(),y:i.getCenterY(),w:i.width,h:i.height}}return e},E.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if("during"===d.ANIMATE)this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},E.prototype.calculateNodesToApplyGravitationTo=function(){var t,e,r=[],i=this.graphManager.getGraphs(),o=i.length;for(e=0;e<o;e++)(t=i[e]).updateConnected(),t.isConnected||(r=r.concat(t.getNodes()));return r},E.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e,r=new Set;for(e=0;e<t.length;e++){var i=t[e];if(!r.has(i)){var o=i.getSource(),n=i.getTarget();if(o==n)i.getBendpoints().push(new p),i.getBendpoints().push(new p),this.createDummyNodesForBendpoints(i),r.add(i);else{var a=[];if(a=(a=a.concat(o.getEdgeListToNode(n))).concat(n.getEdgeListToNode(o)),!r.has(a[0])){var s;if(a.length>1)for(s=0;s<a.length;s++){var h=a[s];h.getBendpoints().push(new p),this.createDummyNodesForBendpoints(h)}a.forEach((function(t){r.add(t)}))}}}if(r.size==t.length)break}},E.prototype.positionNodesRadially=function(t){for(var e=new l(0,0),r=Math.ceil(Math.sqrt(t.length)),i=0,o=0,n=0,a=new p(0,0),s=0;s<t.length;s++){s%r==0&&(n=0,o=i,0!=s&&(o+=h.DEFAULT_COMPONENT_SEPERATION),i=0);var d=t[s],u=c.findCenterOfTree(d);e.x=n,e.y=o,(a=E.radialLayout(d,u,e)).y>i&&(i=Math.floor(a.y)),n=Math.floor(a.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(g.WORLD_CENTER_X-a.x/2,g.WORLD_CENTER_Y-a.y/2))},E.radialLayout=function(t,e,r){var i=Math.max(this.maxDiagonalInTree(t),h.DEFAULT_RADIAL_SEPARATION);E.branchRadialLayout(e,null,0,359,0,i);var o=v.calculateBounds(t),n=new T;n.setDeviceOrgX(o.getMinX()),n.setDeviceOrgY(o.getMinY()),n.setWorldOrgX(r.x),n.setWorldOrgY(r.y);for(var a=0;a<t.length;a++)t[a].transform(n);var s=new p(o.getMaxX(),o.getMaxY());return n.inverseTransformPoint(s)},E.branchRadialLayout=function(t,e,r,i,o,n){var a=(i-r+1)/2;a<0&&(a+=180);var s=(a+r)%360*f.TWO_PI/360,h=o*Math.cos(s),d=o*Math.sin(s);t.setCenter(h,d);var g=[],l=(g=g.concat(t.getEdges())).length;null!=e&&l--;for(var p,c=0,u=g.length,v=t.getEdgesBetween(e);v.length>1;){var T=v[0];v.splice(0,1);var m=g.indexOf(T);m>=0&&g.splice(m,1),u--,l--}p=null!=e?(g.indexOf(v[0])+1)%u:0;for(var y=Math.abs(i-r)/l,N=p;c!=l;N=++N%u){var w=g[N].getOtherEnd(t);if(w!=e){var A=(r+c*y)%360,C=(A+y)%360;E.branchRadialLayout(w,t,A,C,o+n,n),c++}}},E.maxDiagonalInTree=function(t){for(var e=u.MIN_VALUE,r=0;r<t.length;r++){var i=t[r].getDiagonal();i>e&&(e=i)}return e},E.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},E.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var r=[],i=this.graphManager.getAllNodes(),o=0;o<i.length;o++){var n=(s=i[o]).getParent();0!==this.getNodeDegreeWithChildren(s)||null!=n.id&&this.getToBeTiled(n)||r.push(s)}for(o=0;o<r.length;o++){var s,h=(s=r[o]).getParent().id;void 0===e[h]&&(e[h]=[]),e[h]=e[h].concat(s)}Object.keys(e).forEach((function(r){if(e[r].length>1){var i="DummyCompound_"+r;t.memberGroups[i]=e[r];var o=e[r][0].getParent(),n=new a(t.graphManager);n.id=i,n.paddingLeft=o.paddingLeft||0,n.paddingRight=o.paddingRight||0,n.paddingBottom=o.paddingBottom||0,n.paddingTop=o.paddingTop||0,t.idToDummyNode[i]=n;var s=t.getGraphManager().add(t.newGraph(),n),h=o.getChild();h.add(n);for(var d=0;d<e[r].length;d++){var g=e[r][d];h.remove(g),s.add(g)}}}))},E.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var r=0;r<this.compoundOrder.length;r++)e[this.compoundOrder[r].id]=this.compoundOrder[r],t[this.compoundOrder[r].id]=[].concat(this.compoundOrder[r].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[r].getChild()),this.compoundOrder[r].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},E.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach((function(r){var i=t.idToDummyNode[r];e[r]=t.tileNodes(t.memberGroups[r],i.paddingLeft+i.paddingRight),i.rect.width=e[r].width,i.rect.height=e[r].height}))},E.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],r=e.id,i=e.paddingLeft,o=e.paddingTop;this.adjustLocations(this.tiledMemberPack[r],e.rect.x,e.rect.y,i,o)}},E.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach((function(r){var i=t.idToDummyNode[r],o=i.paddingLeft,n=i.paddingTop;t.adjustLocations(e[r],i.rect.x,i.rect.y,o,n)}))},E.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var r=t.getChild();if(null==r)return this.toBeTiled[e]=!1,!1;for(var i=r.getNodes(),o=0;o<i.length;o++){var n=i[o];if(this.getNodeDegree(n)>0)return this.toBeTiled[e]=!1,!1;if(null!=n.getChild()){if(!this.getToBeTiled(n))return this.toBeTiled[e]=!1,!1}else this.toBeTiled[n.id]=!1}return this.toBeTiled[e]=!0,!0},E.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),r=0,i=0;i<e.length;i++){var o=e[i];o.getSource().id!==o.getTarget().id&&(r+=1)}return r},E.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(null==t.getChild())return e;for(var r=t.getChild().getNodes(),i=0;i<r.length;i++){var o=r[i];e+=this.getNodeDegreeWithChildren(o)}return e},E.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},E.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var r=t[e];null!=r.getChild()&&this.fillCompexOrderByDFS(r.getChild().getNodes()),this.getToBeTiled(r)&&this.compoundOrder.push(r)}},E.prototype.adjustLocations=function(t,e,r,i,o){r+=o;for(var n=e+=i,a=0;a<t.rows.length;a++){var s=t.rows[a];e=n;for(var h=0,d=0;d<s.length;d++){var g=s[d];g.rect.x=e,g.rect.y=r,e+=g.rect.width+t.horizontalPadding,g.rect.height>h&&(h=g.rect.height)}r+=h+t.verticalPadding}},E.prototype.tileCompoundMembers=function(t,e){var r=this;this.tiledMemberPack=[],Object.keys(t).forEach((function(i){var o=e[i];r.tiledMemberPack[i]=r.tileNodes(t[i],o.paddingLeft+o.paddingRight),o.rect.width=r.tiledMemberPack[i].width,o.rect.height=r.tiledMemberPack[i].height}))},E.prototype.tileNodes=function(t,e){var r={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:h.TILING_PADDING_VERTICAL,horizontalPadding:h.TILING_PADDING_HORIZONTAL};t.sort((function(t,e){return t.rect.width*t.rect.height>e.rect.width*e.rect.height?-1:t.rect.width*t.rect.height<e.rect.width*e.rect.height?1:0}));for(var i=0;i<t.length;i++){var o=t[i];0==r.rows.length?this.insertNodeToRow(r,o,0,e):this.canAddHorizontal(r,o.rect.width,o.rect.height)?this.insertNodeToRow(r,o,this.getShortestRowIndex(r),e):this.insertNodeToRow(r,o,r.rows.length,e),this.shiftToLastRow(r)}return r},E.prototype.insertNodeToRow=function(t,e,r,i){var o=i;r==t.rows.length&&(t.rows.push([]),t.rowWidth.push(o),t.rowHeight.push(0));var n=t.rowWidth[r]+e.rect.width;t.rows[r].length>0&&(n+=t.horizontalPadding),t.rowWidth[r]=n,t.width<n&&(t.width=n);var a=e.rect.height;r>0&&(a+=t.verticalPadding);var s=0;a>t.rowHeight[r]&&(s=t.rowHeight[r],t.rowHeight[r]=a,s=t.rowHeight[r]-s),t.height+=s,t.rows[r].push(e)},E.prototype.getShortestRowIndex=function(t){for(var e=-1,r=Number.MAX_VALUE,i=0;i<t.rows.length;i++)t.rowWidth[i]<r&&(e=i,r=t.rowWidth[i]);return e},E.prototype.getLongestRowIndex=function(t){for(var e=-1,r=Number.MIN_VALUE,i=0;i<t.rows.length;i++)t.rowWidth[i]>r&&(e=i,r=t.rowWidth[i]);return e},E.prototype.canAddHorizontal=function(t,e,r){var i=this.getShortestRowIndex(t);if(i<0)return!0;var o=t.rowWidth[i];if(o+t.horizontalPadding+e<=t.width)return!0;var n,a,s=0;return t.rowHeight[i]<r&&i>0&&(s=r+t.verticalPadding-t.rowHeight[i]),n=t.width-o>=e+t.horizontalPadding?(t.height+s)/(o+e+t.horizontalPadding):(t.height+s)/t.width,s=r+t.verticalPadding,(a=t.width<e?(t.height+s)/e:(t.height+s)/t.width)<1&&(a=1/a),n<1&&(n=1/n),n<a},E.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),r=t.rowWidth.length-1,i=t.rows[e],o=i[i.length-1],n=o.width+t.horizontalPadding;if(t.width-t.rowWidth[r]>n&&e!=r){i.splice(-1,1),t.rows[r].push(o),t.rowWidth[e]=t.rowWidth[e]-n,t.rowWidth[r]=t.rowWidth[r]+n,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var a=Number.MIN_VALUE,s=0;s<i.length;s++)i[s].height>a&&(a=i[s].height);e>0&&(a+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[r];t.rowHeight[e]=a,t.rowHeight[r]<o.height+t.verticalPadding&&(t.rowHeight[r]=o.height+t.verticalPadding);var d=t.rowHeight[e]+t.rowHeight[r];t.height+=d-h,this.shiftToLastRow(t)}},E.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},E.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},E.prototype.reduceTrees=function(){for(var t,e=[],r=!0;r;){var i=this.graphManager.getAllNodes(),o=[];r=!1;for(var n=0;n<i.length;n++)1!=(t=i[n]).getEdges().length||t.getEdges()[0].isInterGraph||null!=t.getChild()||(o.push([t,t.getEdges()[0],t.getOwner()]),r=!0);if(1==r){for(var a=[],s=0;s<o.length;s++)1==o[s][0].getEdges().length&&(a.push(o[s]),o[s][0].getOwner().remove(o[s][0]));e.push(a),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},E.prototype.growTree=function(t){for(var e,r=t[t.length-1],i=0;i<r.length;i++)e=r[i],this.findPlaceforPrunedNode(e),e[2].add(e[0]),e[2].add(e[1],e[1].source,e[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},E.prototype.findPlaceforPrunedNode=function(t){var e,r,i=t[0],o=(r=i==t[1].source?t[1].target:t[1].source).startX,n=r.finishX,a=r.startY,s=r.finishY,h=[0,0,0,0];if(a>0)for(var g=o;g<=n;g++)h[0]+=this.grid[g][a-1].length+this.grid[g][a].length-1;if(n<this.grid.length-1)for(g=a;g<=s;g++)h[1]+=this.grid[n+1][g].length+this.grid[n][g].length-1;if(s<this.grid[0].length-1)for(g=o;g<=n;g++)h[2]+=this.grid[g][s+1].length+this.grid[g][s].length-1;if(o>0)for(g=a;g<=s;g++)h[3]+=this.grid[o-1][g].length+this.grid[o][g].length-1;for(var l,p,c=u.MAX_VALUE,f=0;f<h.length;f++)h[f]<c?(c=h[f],l=1,p=f):h[f]==c&&l++;if(3==l&&0==c)0==h[0]&&0==h[1]&&0==h[2]?e=1:0==h[0]&&0==h[1]&&0==h[3]?e=0:0==h[0]&&0==h[2]&&0==h[3]?e=3:0==h[1]&&0==h[2]&&0==h[3]&&(e=2);else if(2==l&&0==c){var v=Math.floor(2*Math.random());e=0==h[0]&&0==h[1]?0==v?0:1:0==h[0]&&0==h[2]?0==v?0:2:0==h[0]&&0==h[3]?0==v?0:3:0==h[1]&&0==h[2]?0==v?1:2:0==h[1]&&0==h[3]?0==v?1:3:0==v?2:3}else e=4==l&&0==c?v=Math.floor(4*Math.random()):p;0==e?i.setCenter(r.getCenterX(),r.getCenterY()-r.getHeight()/2-d.DEFAULT_EDGE_LENGTH-i.getHeight()/2):1==e?i.setCenter(r.getCenterX()+r.getWidth()/2+d.DEFAULT_EDGE_LENGTH+i.getWidth()/2,r.getCenterY()):2==e?i.setCenter(r.getCenterX(),r.getCenterY()+r.getHeight()/2+d.DEFAULT_EDGE_LENGTH+i.getHeight()/2):i.setCenter(r.getCenterX()-r.getWidth()/2-d.DEFAULT_EDGE_LENGTH-i.getWidth()/2,r.getCenterY())},t.exports=E},function(t,e,r){var i={};i.layoutBase=r(0),i.CoSEConstants=r(1),i.CoSEEdge=r(2),i.CoSEGraph=r(3),i.CoSEGraphManager=r(4),i.CoSELayout=r(6),i.CoSENode=r(5),t.exports=i}])},o.exports=n(i.__require())),r.__module.exports;var o,n};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("../../../../../_virtual/_commonjsHelpers.js"),r=require("../../../../../_virtual/cose-base2.js"),i=require("../../../layout-base@1.0.2/node_modules/layout-base/layout-base.js");r.__module.exports,exports.__require=function(){return t||(t=1,o=r.__module,r.__module.exports,e.commonjsGlobal,n=function(t){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.i=function(t){return t},r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}([function(e,r){e.exports=t},function(t,e,r){var i=r(0).FDLayoutConstants;function o(){}for(var n in i)o[n]=i[n];o.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,o.DEFAULT_RADIAL_SEPARATION=i.DEFAULT_EDGE_LENGTH,o.DEFAULT_COMPONENT_SEPERATION=60,o.TILE=!0,o.TILING_PADDING_VERTICAL=10,o.TILING_PADDING_HORIZONTAL=10,o.TREE_REDUCTION_ON_INCREMENTAL=!1,t.exports=o},function(t,e,r){var i=r(0).FDLayoutEdge;function o(t,e,r){i.call(this,t,e,r)}for(var n in o.prototype=Object.create(i.prototype),i)o[n]=i[n];t.exports=o},function(t,e,r){var i=r(0).LGraph;function o(t,e,r){i.call(this,t,e,r)}for(var n in o.prototype=Object.create(i.prototype),i)o[n]=i[n];t.exports=o},function(t,e,r){var i=r(0).LGraphManager;function o(t){i.call(this,t)}for(var n in o.prototype=Object.create(i.prototype),i)o[n]=i[n];t.exports=o},function(t,e,r){var i=r(0).FDLayoutNode,o=r(0).IMath;function n(t,e,r,o){i.call(this,t,e,r,o)}for(var a in n.prototype=Object.create(i.prototype),i)n[a]=i[a];n.prototype.move=function(){var t=this.graphManager.getLayout();this.displacementX=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*o.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*o.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),t.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},n.prototype.propogateDisplacementToChildren=function(t,e){for(var r,i=this.getChild().getNodes(),o=0;o<i.length;o++)null==(r=i[o]).getChild()?(r.moveBy(t,e),r.displacementX+=t,r.displacementY+=e):r.propogateDisplacementToChildren(t,e)},n.prototype.setPred1=function(t){this.pred1=t},n.prototype.getPred1=function(){return pred1},n.prototype.getPred2=function(){return pred2},n.prototype.setNext=function(t){this.next=t},n.prototype.getNext=function(){return next},n.prototype.setProcessed=function(t){this.processed=t},n.prototype.isProcessed=function(){return processed},t.exports=n},function(t,e,r){var i=r(0).FDLayout,o=r(4),n=r(3),a=r(5),s=r(2),h=r(1),d=r(0).FDLayoutConstants,g=r(0).LayoutConstants,l=r(0).Point,p=r(0).PointD,c=r(0).Layout,u=r(0).Integer,f=r(0).IGeometry,v=r(0).LGraph,T=r(0).Transform;function E(){i.call(this),this.toBeTiled={}}for(var m in E.prototype=Object.create(i.prototype),i)E[m]=i[m];E.prototype.newGraphManager=function(){var t=new o(this);return this.graphManager=t,t},E.prototype.newGraph=function(t){return new n(null,this.graphManager,t)},E.prototype.newNode=function(t){return new a(this.graphManager,t)},E.prototype.newEdge=function(t){return new s(null,null,t)},E.prototype.initParameters=function(){i.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=d.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=d.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=d.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},E.prototype.layout=function(){return g.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},E.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)h.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),e=new Set(this.getAllNodes()),r=this.nodesWithGravity.filter((function(t){return e.has(t)})),this.graphManager.setAllNodesToApplyGravitation(r));else{var t=this.getFlatForest();if(t.length>0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),r=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(r),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},E.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var r=!this.isTreeGrowing&&!this.isGrowthFinished,i=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(r,i),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},E.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},r=0;r<t.length;r++){var i=t[r].rect,o=t[r].id;e[o]={id:o,x:i.getCenterX(),y:i.getCenterY(),w:i.width,h:i.height}}return e},E.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if("during"===d.ANIMATE)this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},E.prototype.calculateNodesToApplyGravitationTo=function(){var t,e,r=[],i=this.graphManager.getGraphs(),o=i.length;for(e=0;e<o;e++)(t=i[e]).updateConnected(),t.isConnected||(r=r.concat(t.getNodes()));return r},E.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e,r=new Set;for(e=0;e<t.length;e++){var i=t[e];if(!r.has(i)){var o=i.getSource(),n=i.getTarget();if(o==n)i.getBendpoints().push(new p),i.getBendpoints().push(new p),this.createDummyNodesForBendpoints(i),r.add(i);else{var a=[];if(a=(a=a.concat(o.getEdgeListToNode(n))).concat(n.getEdgeListToNode(o)),!r.has(a[0])){var s;if(a.length>1)for(s=0;s<a.length;s++){var h=a[s];h.getBendpoints().push(new p),this.createDummyNodesForBendpoints(h)}a.forEach((function(t){r.add(t)}))}}}if(r.size==t.length)break}},E.prototype.positionNodesRadially=function(t){for(var e=new l(0,0),r=Math.ceil(Math.sqrt(t.length)),i=0,o=0,n=0,a=new p(0,0),s=0;s<t.length;s++){s%r==0&&(n=0,o=i,0!=s&&(o+=h.DEFAULT_COMPONENT_SEPERATION),i=0);var d=t[s],u=c.findCenterOfTree(d);e.x=n,e.y=o,(a=E.radialLayout(d,u,e)).y>i&&(i=Math.floor(a.y)),n=Math.floor(a.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(g.WORLD_CENTER_X-a.x/2,g.WORLD_CENTER_Y-a.y/2))},E.radialLayout=function(t,e,r){var i=Math.max(this.maxDiagonalInTree(t),h.DEFAULT_RADIAL_SEPARATION);E.branchRadialLayout(e,null,0,359,0,i);var o=v.calculateBounds(t),n=new T;n.setDeviceOrgX(o.getMinX()),n.setDeviceOrgY(o.getMinY()),n.setWorldOrgX(r.x),n.setWorldOrgY(r.y);for(var a=0;a<t.length;a++)t[a].transform(n);var s=new p(o.getMaxX(),o.getMaxY());return n.inverseTransformPoint(s)},E.branchRadialLayout=function(t,e,r,i,o,n){var a=(i-r+1)/2;a<0&&(a+=180);var s=(a+r)%360*f.TWO_PI/360,h=o*Math.cos(s),d=o*Math.sin(s);t.setCenter(h,d);var g=[],l=(g=g.concat(t.getEdges())).length;null!=e&&l--;for(var p,c=0,u=g.length,v=t.getEdgesBetween(e);v.length>1;){var T=v[0];v.splice(0,1);var m=g.indexOf(T);m>=0&&g.splice(m,1),u--,l--}p=null!=e?(g.indexOf(v[0])+1)%u:0;for(var y=Math.abs(i-r)/l,N=p;c!=l;N=++N%u){var w=g[N].getOtherEnd(t);if(w!=e){var A=(r+c*y)%360,C=(A+y)%360;E.branchRadialLayout(w,t,A,C,o+n,n),c++}}},E.maxDiagonalInTree=function(t){for(var e=u.MIN_VALUE,r=0;r<t.length;r++){var i=t[r].getDiagonal();i>e&&(e=i)}return e},E.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},E.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var r=[],i=this.graphManager.getAllNodes(),o=0;o<i.length;o++){var n=(s=i[o]).getParent();0!==this.getNodeDegreeWithChildren(s)||null!=n.id&&this.getToBeTiled(n)||r.push(s)}for(o=0;o<r.length;o++){var s,h=(s=r[o]).getParent().id;void 0===e[h]&&(e[h]=[]),e[h]=e[h].concat(s)}Object.keys(e).forEach((function(r){if(e[r].length>1){var i="DummyCompound_"+r;t.memberGroups[i]=e[r];var o=e[r][0].getParent(),n=new a(t.graphManager);n.id=i,n.paddingLeft=o.paddingLeft||0,n.paddingRight=o.paddingRight||0,n.paddingBottom=o.paddingBottom||0,n.paddingTop=o.paddingTop||0,t.idToDummyNode[i]=n;var s=t.getGraphManager().add(t.newGraph(),n),h=o.getChild();h.add(n);for(var d=0;d<e[r].length;d++){var g=e[r][d];h.remove(g),s.add(g)}}}))},E.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var r=0;r<this.compoundOrder.length;r++)e[this.compoundOrder[r].id]=this.compoundOrder[r],t[this.compoundOrder[r].id]=[].concat(this.compoundOrder[r].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[r].getChild()),this.compoundOrder[r].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},E.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach((function(r){var i=t.idToDummyNode[r];e[r]=t.tileNodes(t.memberGroups[r],i.paddingLeft+i.paddingRight),i.rect.width=e[r].width,i.rect.height=e[r].height}))},E.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],r=e.id,i=e.paddingLeft,o=e.paddingTop;this.adjustLocations(this.tiledMemberPack[r],e.rect.x,e.rect.y,i,o)}},E.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach((function(r){var i=t.idToDummyNode[r],o=i.paddingLeft,n=i.paddingTop;t.adjustLocations(e[r],i.rect.x,i.rect.y,o,n)}))},E.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var r=t.getChild();if(null==r)return this.toBeTiled[e]=!1,!1;for(var i=r.getNodes(),o=0;o<i.length;o++){var n=i[o];if(this.getNodeDegree(n)>0)return this.toBeTiled[e]=!1,!1;if(null!=n.getChild()){if(!this.getToBeTiled(n))return this.toBeTiled[e]=!1,!1}else this.toBeTiled[n.id]=!1}return this.toBeTiled[e]=!0,!0},E.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),r=0,i=0;i<e.length;i++){var o=e[i];o.getSource().id!==o.getTarget().id&&(r+=1)}return r},E.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(null==t.getChild())return e;for(var r=t.getChild().getNodes(),i=0;i<r.length;i++){var o=r[i];e+=this.getNodeDegreeWithChildren(o)}return e},E.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},E.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var r=t[e];null!=r.getChild()&&this.fillCompexOrderByDFS(r.getChild().getNodes()),this.getToBeTiled(r)&&this.compoundOrder.push(r)}},E.prototype.adjustLocations=function(t,e,r,i,o){r+=o;for(var n=e+=i,a=0;a<t.rows.length;a++){var s=t.rows[a];e=n;for(var h=0,d=0;d<s.length;d++){var g=s[d];g.rect.x=e,g.rect.y=r,e+=g.rect.width+t.horizontalPadding,g.rect.height>h&&(h=g.rect.height)}r+=h+t.verticalPadding}},E.prototype.tileCompoundMembers=function(t,e){var r=this;this.tiledMemberPack=[],Object.keys(t).forEach((function(i){var o=e[i];r.tiledMemberPack[i]=r.tileNodes(t[i],o.paddingLeft+o.paddingRight),o.rect.width=r.tiledMemberPack[i].width,o.rect.height=r.tiledMemberPack[i].height}))},E.prototype.tileNodes=function(t,e){var r={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:h.TILING_PADDING_VERTICAL,horizontalPadding:h.TILING_PADDING_HORIZONTAL};t.sort((function(t,e){return t.rect.width*t.rect.height>e.rect.width*e.rect.height?-1:t.rect.width*t.rect.height<e.rect.width*e.rect.height?1:0}));for(var i=0;i<t.length;i++){var o=t[i];0==r.rows.length?this.insertNodeToRow(r,o,0,e):this.canAddHorizontal(r,o.rect.width,o.rect.height)?this.insertNodeToRow(r,o,this.getShortestRowIndex(r),e):this.insertNodeToRow(r,o,r.rows.length,e),this.shiftToLastRow(r)}return r},E.prototype.insertNodeToRow=function(t,e,r,i){var o=i;r==t.rows.length&&(t.rows.push([]),t.rowWidth.push(o),t.rowHeight.push(0));var n=t.rowWidth[r]+e.rect.width;t.rows[r].length>0&&(n+=t.horizontalPadding),t.rowWidth[r]=n,t.width<n&&(t.width=n);var a=e.rect.height;r>0&&(a+=t.verticalPadding);var s=0;a>t.rowHeight[r]&&(s=t.rowHeight[r],t.rowHeight[r]=a,s=t.rowHeight[r]-s),t.height+=s,t.rows[r].push(e)},E.prototype.getShortestRowIndex=function(t){for(var e=-1,r=Number.MAX_VALUE,i=0;i<t.rows.length;i++)t.rowWidth[i]<r&&(e=i,r=t.rowWidth[i]);return e},E.prototype.getLongestRowIndex=function(t){for(var e=-1,r=Number.MIN_VALUE,i=0;i<t.rows.length;i++)t.rowWidth[i]>r&&(e=i,r=t.rowWidth[i]);return e},E.prototype.canAddHorizontal=function(t,e,r){var i=this.getShortestRowIndex(t);if(i<0)return!0;var o=t.rowWidth[i];if(o+t.horizontalPadding+e<=t.width)return!0;var n,a,s=0;return t.rowHeight[i]<r&&i>0&&(s=r+t.verticalPadding-t.rowHeight[i]),n=t.width-o>=e+t.horizontalPadding?(t.height+s)/(o+e+t.horizontalPadding):(t.height+s)/t.width,s=r+t.verticalPadding,(a=t.width<e?(t.height+s)/e:(t.height+s)/t.width)<1&&(a=1/a),n<1&&(n=1/n),n<a},E.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),r=t.rowWidth.length-1,i=t.rows[e],o=i[i.length-1],n=o.width+t.horizontalPadding;if(t.width-t.rowWidth[r]>n&&e!=r){i.splice(-1,1),t.rows[r].push(o),t.rowWidth[e]=t.rowWidth[e]-n,t.rowWidth[r]=t.rowWidth[r]+n,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var a=Number.MIN_VALUE,s=0;s<i.length;s++)i[s].height>a&&(a=i[s].height);e>0&&(a+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[r];t.rowHeight[e]=a,t.rowHeight[r]<o.height+t.verticalPadding&&(t.rowHeight[r]=o.height+t.verticalPadding);var d=t.rowHeight[e]+t.rowHeight[r];t.height+=d-h,this.shiftToLastRow(t)}},E.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},E.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},E.prototype.reduceTrees=function(){for(var t,e=[],r=!0;r;){var i=this.graphManager.getAllNodes(),o=[];r=!1;for(var n=0;n<i.length;n++)1!=(t=i[n]).getEdges().length||t.getEdges()[0].isInterGraph||null!=t.getChild()||(o.push([t,t.getEdges()[0],t.getOwner()]),r=!0);if(1==r){for(var a=[],s=0;s<o.length;s++)1==o[s][0].getEdges().length&&(a.push(o[s]),o[s][0].getOwner().remove(o[s][0]));e.push(a),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},E.prototype.growTree=function(t){for(var e,r=t[t.length-1],i=0;i<r.length;i++)e=r[i],this.findPlaceforPrunedNode(e),e[2].add(e[0]),e[2].add(e[1],e[1].source,e[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},E.prototype.findPlaceforPrunedNode=function(t){var e,r,i=t[0],o=(r=i==t[1].source?t[1].target:t[1].source).startX,n=r.finishX,a=r.startY,s=r.finishY,h=[0,0,0,0];if(a>0)for(var g=o;g<=n;g++)h[0]+=this.grid[g][a-1].length+this.grid[g][a].length-1;if(n<this.grid.length-1)for(g=a;g<=s;g++)h[1]+=this.grid[n+1][g].length+this.grid[n][g].length-1;if(s<this.grid[0].length-1)for(g=o;g<=n;g++)h[2]+=this.grid[g][s+1].length+this.grid[g][s].length-1;if(o>0)for(g=a;g<=s;g++)h[3]+=this.grid[o-1][g].length+this.grid[o][g].length-1;for(var l,p,c=u.MAX_VALUE,f=0;f<h.length;f++)h[f]<c?(c=h[f],l=1,p=f):h[f]==c&&l++;if(3==l&&0==c)0==h[0]&&0==h[1]&&0==h[2]?e=1:0==h[0]&&0==h[1]&&0==h[3]?e=0:0==h[0]&&0==h[2]&&0==h[3]?e=3:0==h[1]&&0==h[2]&&0==h[3]&&(e=2);else if(2==l&&0==c){var v=Math.floor(2*Math.random());e=0==h[0]&&0==h[1]?0==v?0:1:0==h[0]&&0==h[2]?0==v?0:2:0==h[0]&&0==h[3]?0==v?0:3:0==h[1]&&0==h[2]?0==v?1:2:0==h[1]&&0==h[3]?0==v?1:3:0==v?2:3}else e=4==l&&0==c?v=Math.floor(4*Math.random()):p;0==e?i.setCenter(r.getCenterX(),r.getCenterY()-r.getHeight()/2-d.DEFAULT_EDGE_LENGTH-i.getHeight()/2):1==e?i.setCenter(r.getCenterX()+r.getWidth()/2+d.DEFAULT_EDGE_LENGTH+i.getWidth()/2,r.getCenterY()):2==e?i.setCenter(r.getCenterX(),r.getCenterY()+r.getHeight()/2+d.DEFAULT_EDGE_LENGTH+i.getHeight()/2):i.setCenter(r.getCenterX()-r.getWidth()/2-d.DEFAULT_EDGE_LENGTH-i.getWidth()/2,r.getCenterY())},t.exports=E},function(t,e,r){var i={};i.layoutBase=r(0),i.CoSEConstants=r(1),i.CoSEEdge=r(2),i.CoSEGraph=r(3),i.CoSEGraphManager=r(4),i.CoSELayout=r(6),i.CoSENode=r(5),t.exports=i}])},o.exports=n(i.__require())),r.__module.exports;var o,n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("../../../../../_virtual/_commonjsHelpers.js"),i=require("../../../../../_virtual/cose-base2.js"),o=require("../../../layout-base@2.0.1/node_modules/layout-base/layout-base.js");i.__module.exports,exports.__require=function(){return t||(t=1,n=i.__module,i.__module.exports,e.commonjsGlobal,r=function(t){return e={45:(t,e,i)=>{var o={};o.layoutBase=i(551),o.CoSEConstants=i(806),o.CoSEEdge=i(767),o.CoSEGraph=i(880),o.CoSEGraphManager=i(578),o.CoSELayout=i(765),o.CoSENode=i(991),o.ConstraintHandler=i(902),t.exports=o},806:(t,e,i)=>{var o=i(551).FDLayoutConstants;function n(){}for(var r in o)n[r]=o[r];n.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,n.DEFAULT_RADIAL_SEPARATION=o.DEFAULT_EDGE_LENGTH,n.DEFAULT_COMPONENT_SEPERATION=60,n.TILE=!0,n.TILING_PADDING_VERTICAL=10,n.TILING_PADDING_HORIZONTAL=10,n.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,n.ENFORCE_CONSTRAINTS=!0,n.APPLY_LAYOUT=!0,n.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,n.TREE_REDUCTION_ON_INCREMENTAL=!0,n.PURE_INCREMENTAL=n.DEFAULT_INCREMENTAL,t.exports=n},767:(t,e,i)=>{var o=i(551).FDLayoutEdge;function n(t,e,i){o.call(this,t,e,i)}for(var r in n.prototype=Object.create(o.prototype),o)n[r]=o[r];t.exports=n},880:(t,e,i)=>{var o=i(551).LGraph;function n(t,e,i){o.call(this,t,e,i)}for(var r in n.prototype=Object.create(o.prototype),o)n[r]=o[r];t.exports=n},578:(t,e,i)=>{var o=i(551).LGraphManager;function n(t){o.call(this,t)}for(var r in n.prototype=Object.create(o.prototype),o)n[r]=o[r];t.exports=n},765:(t,e,i)=>{var o=i(551).FDLayout,n=i(578),r=i(880),a=i(991),s=i(767),h=i(806),l=i(902),d=i(551).FDLayoutConstants,g=i(551).LayoutConstants,c=i(551).Point,p=i(551).PointD,f=i(551).DimensionD,u=i(551).Layout,m=i(551).Integer,v=i(551).IGeometry,T=i(551).LGraph,N=i(551).Transform,E=i(551).LinkedList;function y(){o.call(this),this.toBeTiled={},this.constraints={}}for(var C in y.prototype=Object.create(o.prototype),o)y[C]=o[C];y.prototype.newGraphManager=function(){var t=new n(this);return this.graphManager=t,t},y.prototype.newGraph=function(t){return new r(null,this.graphManager,t)},y.prototype.newNode=function(t){return new a(this.graphManager,t)},y.prototype.newEdge=function(t){return new s(null,null,t)},y.prototype.initParameters=function(){o.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},y.prototype.initSpringEmbedder=function(){o.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},y.prototype.layout=function(){return g.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},y.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)h.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),e=new Set(this.getAllNodes()),i=this.nodesWithGravity.filter((function(t){return e.has(t)})),this.graphManager.setAllNodesToApplyGravitation(i));else{var t=this.getFlatForest();if(t.length>0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),i=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(i),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(l.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),h.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),h.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),h.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var i=!this.isTreeGrowing&&!this.isGrowthFinished,o=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(i,o),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},i=0;i<t.length;i++){var o=t[i].rect,n=t[i].id;e[n]={id:n,x:o.getCenterX(),y:o.getCenterY(),w:o.width,h:o.height}}return e},y.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if("during"===d.ANIMATE)this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},y.prototype.moveNodes=function(){for(var t=this.getAllNodes(),e=0;e<t.length;e++)t[e].calculateDisplacement();for(Object.keys(this.constraints).length>0&&this.updateDisplacements(),e=0;e<t.length;e++)t[e].move()},y.prototype.initConstraintVariables=function(){var t=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var e=this.graphManager.getAllNodes(),i=0;i<e.length;i++){var o=e[i];this.idToNodeMap.set(o.id,o)}var n=function e(i){for(var o,n=i.getChild().getNodes(),r=0,a=0;a<n.length;a++)null==(o=n[a]).getChild()?t.fixedNodeSet.has(o.id)&&(r+=100):r+=e(o);return r};if(this.constraints.fixedNodeConstraint)for(this.constraints.fixedNodeConstraint.forEach((function(e){t.fixedNodeSet.add(e.nodeId)})),e=this.graphManager.getAllNodes(),i=0;i<e.length;i++)if(null!=(o=e[i]).getChild()){var r=n(o);r>0&&(o.fixedNodeWeight=r)}if(this.constraints.relativePlacementConstraint){var a=new Map,s=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach((function(e){t.fixedNodesOnHorizontal.add(e),t.fixedNodesOnVertical.add(e)})),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical){var l=this.constraints.alignmentConstraint.vertical;for(i=0;i<l.length;i++)this.dummyToNodeForVerticalAlignment.set("dummy"+i,[]),l[i].forEach((function(e){a.set(e,"dummy"+i),t.dummyToNodeForVerticalAlignment.get("dummy"+i).push(e),t.fixedNodeSet.has(e)&&t.fixedNodesOnHorizontal.add("dummy"+i)}))}if(this.constraints.alignmentConstraint.horizontal){var d=this.constraints.alignmentConstraint.horizontal;for(i=0;i<d.length;i++)this.dummyToNodeForHorizontalAlignment.set("dummy"+i,[]),d[i].forEach((function(e){s.set(e,"dummy"+i),t.dummyToNodeForHorizontalAlignment.get("dummy"+i).push(e),t.fixedNodeSet.has(e)&&t.fixedNodesOnVertical.add("dummy"+i)}))}}if(h.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(t){var e,i,o;for(o=t.length-1;o>=2*t.length/3;o--)e=Math.floor(Math.random()*(o+1)),i=t[o],t[o]=t[e],t[e]=i;return t},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach((function(e){if(e.left){var i=a.has(e.left)?a.get(e.left):e.left,o=a.has(e.right)?a.get(e.right):e.right;t.nodesInRelativeHorizontal.includes(i)||(t.nodesInRelativeHorizontal.push(i),t.nodeToRelativeConstraintMapHorizontal.set(i,[]),t.dummyToNodeForVerticalAlignment.has(i)?t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(i)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(i).getCenterX())),t.nodesInRelativeHorizontal.includes(o)||(t.nodesInRelativeHorizontal.push(o),t.nodeToRelativeConstraintMapHorizontal.set(o,[]),t.dummyToNodeForVerticalAlignment.has(o)?t.nodeToTempPositionMapHorizontal.set(o,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(o)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(o,t.idToNodeMap.get(o).getCenterX())),t.nodeToRelativeConstraintMapHorizontal.get(i).push({right:o,gap:e.gap}),t.nodeToRelativeConstraintMapHorizontal.get(o).push({left:i,gap:e.gap})}else{var n=s.has(e.top)?s.get(e.top):e.top,r=s.has(e.bottom)?s.get(e.bottom):e.bottom;t.nodesInRelativeVertical.includes(n)||(t.nodesInRelativeVertical.push(n),t.nodeToRelativeConstraintMapVertical.set(n,[]),t.dummyToNodeForHorizontalAlignment.has(n)?t.nodeToTempPositionMapVertical.set(n,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(n)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(n,t.idToNodeMap.get(n).getCenterY())),t.nodesInRelativeVertical.includes(r)||(t.nodesInRelativeVertical.push(r),t.nodeToRelativeConstraintMapVertical.set(r,[]),t.dummyToNodeForHorizontalAlignment.has(r)?t.nodeToTempPositionMapVertical.set(r,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(r)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(r,t.idToNodeMap.get(r).getCenterY())),t.nodeToRelativeConstraintMapVertical.get(n).push({bottom:r,gap:e.gap}),t.nodeToRelativeConstraintMapVertical.get(r).push({top:n,gap:e.gap})}}));else{var g=new Map,c=new Map;this.constraints.relativePlacementConstraint.forEach((function(t){if(t.left){var e=a.has(t.left)?a.get(t.left):t.left,i=a.has(t.right)?a.get(t.right):t.right;g.has(e)?g.get(e).push(i):g.set(e,[i]),g.has(i)?g.get(i).push(e):g.set(i,[e])}else{var o=s.has(t.top)?s.get(t.top):t.top,n=s.has(t.bottom)?s.get(t.bottom):t.bottom;c.has(o)?c.get(o).push(n):c.set(o,[n]),c.has(n)?c.get(n).push(o):c.set(n,[o])}}));var p=function(t,e){var i=[],o=[],n=new E,r=new Set,a=0;return t.forEach((function(s,h){if(!r.has(h)){i[a]=[],o[a]=!1;var l=h;for(n.push(l),r.add(l),i[a].push(l);0!=n.length;)l=n.shift(),e.has(l)&&(o[a]=!0),t.get(l).forEach((function(t){r.has(t)||(n.push(t),r.add(t),i[a].push(t))}));a++}})),{components:i,isFixed:o}},f=p(g,t.fixedNodesOnHorizontal);this.componentsOnHorizontal=f.components,this.fixedComponentsOnHorizontal=f.isFixed;var u=p(c,t.fixedNodesOnVertical);this.componentsOnVertical=u.components,this.fixedComponentsOnVertical=u.isFixed}}},y.prototype.updateDisplacements=function(){var t=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach((function(e){var i=t.idToNodeMap.get(e.nodeId);i.displacementX=0,i.displacementY=0})),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var e=this.constraints.alignmentConstraint.vertical,i=0;i<e.length;i++){for(var o=0,n=0;n<e[i].length;n++){if(this.fixedNodeSet.has(e[i][n])){o=0;break}o+=this.idToNodeMap.get(e[i][n]).displacementX}var r=o/e[i].length;for(n=0;n<e[i].length;n++)this.idToNodeMap.get(e[i][n]).displacementX=r}if(this.constraints.alignmentConstraint.horizontal){var a=this.constraints.alignmentConstraint.horizontal;for(i=0;i<a.length;i++){var s=0;for(n=0;n<a[i].length;n++){if(this.fixedNodeSet.has(a[i][n])){s=0;break}s+=this.idToNodeMap.get(a[i][n]).displacementY}var l=s/a[i].length;for(n=0;n<a[i].length;n++)this.idToNodeMap.get(a[i][n]).displacementY=l}}}if(this.constraints.relativePlacementConstraint)if(h.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach((function(e){if(!t.fixedNodesOnHorizontal.has(e)){var i=0;i=t.dummyToNodeForVerticalAlignment.has(e)?t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(e)[0]).displacementX:t.idToNodeMap.get(e).displacementX,t.nodeToRelativeConstraintMapHorizontal.get(e).forEach((function(o){var n;o.right?(n=t.nodeToTempPositionMapHorizontal.get(o.right)-t.nodeToTempPositionMapHorizontal.get(e)-i)<o.gap&&(i-=o.gap-n):(n=t.nodeToTempPositionMapHorizontal.get(e)-t.nodeToTempPositionMapHorizontal.get(o.left)+i)<o.gap&&(i+=o.gap-n)})),t.nodeToTempPositionMapHorizontal.set(e,t.nodeToTempPositionMapHorizontal.get(e)+i),t.dummyToNodeForVerticalAlignment.has(e)?t.dummyToNodeForVerticalAlignment.get(e).forEach((function(e){t.idToNodeMap.get(e).displacementX=i})):t.idToNodeMap.get(e).displacementX=i}})),this.nodesInRelativeVertical.forEach((function(e){if(!t.fixedNodesOnHorizontal.has(e)){var i=0;i=t.dummyToNodeForHorizontalAlignment.has(e)?t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(e)[0]).displacementY:t.idToNodeMap.get(e).displacementY,t.nodeToRelativeConstraintMapVertical.get(e).forEach((function(o){var n;o.bottom?(n=t.nodeToTempPositionMapVertical.get(o.bottom)-t.nodeToTempPositionMapVertical.get(e)-i)<o.gap&&(i-=o.gap-n):(n=t.nodeToTempPositionMapVertical.get(e)-t.nodeToTempPositionMapVertical.get(o.top)+i)<o.gap&&(i+=o.gap-n)})),t.nodeToTempPositionMapVertical.set(e,t.nodeToTempPositionMapVertical.get(e)+i),t.dummyToNodeForHorizontalAlignment.has(e)?t.dummyToNodeForHorizontalAlignment.get(e).forEach((function(e){t.idToNodeMap.get(e).displacementY=i})):t.idToNodeMap.get(e).displacementY=i}}));else{for(i=0;i<this.componentsOnHorizontal.length;i++){var d=this.componentsOnHorizontal[i];if(this.fixedComponentsOnHorizontal[i])for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?this.dummyToNodeForVerticalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementX=0})):this.idToNodeMap.get(d[n]).displacementX=0;else{var g=0,c=0;for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?(g+=(f=this.dummyToNodeForVerticalAlignment.get(d[n])).length*this.idToNodeMap.get(f[0]).displacementX,c+=f.length):(g+=this.idToNodeMap.get(d[n]).displacementX,c++);var p=g/c;for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?this.dummyToNodeForVerticalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementX=p})):this.idToNodeMap.get(d[n]).displacementX=p}}for(i=0;i<this.componentsOnVertical.length;i++)if(d=this.componentsOnVertical[i],this.fixedComponentsOnVertical[i])for(n=0;n<d.length;n++)this.dummyToNodeForHorizontalAlignment.has(d[n])?this.dummyToNodeForHorizontalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementY=0})):this.idToNodeMap.get(d[n]).displacementY=0;else{for(g=0,c=0,n=0;n<d.length;n++){var f;this.dummyToNodeForHorizontalAlignment.has(d[n])?(g+=(f=this.dummyToNodeForHorizontalAlignment.get(d[n])).length*this.idToNodeMap.get(f[0]).displacementY,c+=f.length):(g+=this.idToNodeMap.get(d[n]).displacementY,c++)}for(p=g/c,n=0;n<d.length;n++)this.dummyToNodeForHorizontalAlignment.has(d[n])?this.dummyToNodeForHorizontalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementY=p})):this.idToNodeMap.get(d[n]).displacementY=p}}},y.prototype.calculateNodesToApplyGravitationTo=function(){var t,e,i=[],o=this.graphManager.getGraphs(),n=o.length;for(e=0;e<n;e++)(t=o[e]).updateConnected(),t.isConnected||(i=i.concat(t.getNodes()));return i},y.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e,i=new Set;for(e=0;e<t.length;e++){var o=t[e];if(!i.has(o)){var n=o.getSource(),r=o.getTarget();if(n==r)o.getBendpoints().push(new p),o.getBendpoints().push(new p),this.createDummyNodesForBendpoints(o),i.add(o);else{var a=[];if(a=(a=a.concat(n.getEdgeListToNode(r))).concat(r.getEdgeListToNode(n)),!i.has(a[0])){var s;if(a.length>1)for(s=0;s<a.length;s++){var h=a[s];h.getBendpoints().push(new p),this.createDummyNodesForBendpoints(h)}a.forEach((function(t){i.add(t)}))}}}if(i.size==t.length)break}},y.prototype.positionNodesRadially=function(t){for(var e=new c(0,0),i=Math.ceil(Math.sqrt(t.length)),o=0,n=0,r=0,a=new p(0,0),s=0;s<t.length;s++){s%i==0&&(r=0,n=o,0!=s&&(n+=h.DEFAULT_COMPONENT_SEPERATION),o=0);var l=t[s],d=u.findCenterOfTree(l);e.x=r,e.y=n,(a=y.radialLayout(l,d,e)).y>o&&(o=Math.floor(a.y)),r=Math.floor(a.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(g.WORLD_CENTER_X-a.x/2,g.WORLD_CENTER_Y-a.y/2))},y.radialLayout=function(t,e,i){var o=Math.max(this.maxDiagonalInTree(t),h.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(e,null,0,359,0,o);var n=T.calculateBounds(t),r=new N;r.setDeviceOrgX(n.getMinX()),r.setDeviceOrgY(n.getMinY()),r.setWorldOrgX(i.x),r.setWorldOrgY(i.y);for(var a=0;a<t.length;a++)t[a].transform(r);var s=new p(n.getMaxX(),n.getMaxY());return r.inverseTransformPoint(s)},y.branchRadialLayout=function(t,e,i,o,n,r){var a=(o-i+1)/2;a<0&&(a+=180);var s=(a+i)%360*v.TWO_PI/360,h=n*Math.cos(s),l=n*Math.sin(s);t.setCenter(h,l);var d=[],g=(d=d.concat(t.getEdges())).length;null!=e&&g--;for(var c,p=0,f=d.length,u=t.getEdgesBetween(e);u.length>1;){var m=u[0];u.splice(0,1);var T=d.indexOf(m);T>=0&&d.splice(T,1),f--,g--}c=null!=e?(d.indexOf(u[0])+1)%f:0;for(var N=Math.abs(o-i)/g,E=c;p!=g;E=++E%f){var C=d[E].getOtherEnd(t);if(C!=e){var M=(i+p*N)%360,w=(M+N)%360;y.branchRadialLayout(C,t,M,w,n+r,r),p++}}},y.maxDiagonalInTree=function(t){for(var e=m.MIN_VALUE,i=0;i<t.length;i++){var o=t[i].getDiagonal();o>e&&(e=o)}return e},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var i=[],o=this.graphManager.getAllNodes(),n=0;n<o.length;n++){var r=(s=o[n]).getParent();0!==this.getNodeDegreeWithChildren(s)||null!=r.id&&this.getToBeTiled(r)||i.push(s)}for(n=0;n<i.length;n++){var s,h=(s=i[n]).getParent().id;void 0===e[h]&&(e[h]=[]),e[h]=e[h].concat(s)}Object.keys(e).forEach((function(i){if(e[i].length>1){var o="DummyCompound_"+i;t.memberGroups[o]=e[i];var n=e[i][0].getParent(),r=new a(t.graphManager);r.id=o,r.paddingLeft=n.paddingLeft||0,r.paddingRight=n.paddingRight||0,r.paddingBottom=n.paddingBottom||0,r.paddingTop=n.paddingTop||0,t.idToDummyNode[o]=r;var s=t.getGraphManager().add(t.newGraph(),r),h=n.getChild();h.add(r);for(var l=0;l<e[i].length;l++){var d=e[i][l];h.remove(d),s.add(d)}}}))},y.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var i=0;i<this.compoundOrder.length;i++)e[this.compoundOrder[i].id]=this.compoundOrder[i],t[this.compoundOrder[i].id]=[].concat(this.compoundOrder[i].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[i].getChild()),this.compoundOrder[i].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},y.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach((function(i){var o=t.idToDummyNode[i];if(e[i]=t.tileNodes(t.memberGroups[i],o.paddingLeft+o.paddingRight),o.rect.width=e[i].width,o.rect.height=e[i].height,o.setCenter(e[i].centerX,e[i].centerY),o.labelMarginLeft=0,o.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var n=o.rect.width,r=o.rect.height;o.labelWidth&&("left"==o.labelPosHorizontal?(o.rect.x-=o.labelWidth,o.setWidth(n+o.labelWidth),o.labelMarginLeft=o.labelWidth):"center"==o.labelPosHorizontal&&o.labelWidth>n?(o.rect.x-=(o.labelWidth-n)/2,o.setWidth(o.labelWidth),o.labelMarginLeft=(o.labelWidth-n)/2):"right"==o.labelPosHorizontal&&o.setWidth(n+o.labelWidth)),o.labelHeight&&("top"==o.labelPosVertical?(o.rect.y-=o.labelHeight,o.setHeight(r+o.labelHeight),o.labelMarginTop=o.labelHeight):"center"==o.labelPosVertical&&o.labelHeight>r?(o.rect.y-=(o.labelHeight-r)/2,o.setHeight(o.labelHeight),o.labelMarginTop=(o.labelHeight-r)/2):"bottom"==o.labelPosVertical&&o.setHeight(r+o.labelHeight))}}))},y.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],i=e.id,o=e.paddingLeft,n=e.paddingTop,r=e.labelMarginLeft,a=e.labelMarginTop;this.adjustLocations(this.tiledMemberPack[i],e.rect.x,e.rect.y,o,n,r,a)}},y.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach((function(i){var o=t.idToDummyNode[i],n=o.paddingLeft,r=o.paddingTop,a=o.labelMarginLeft,s=o.labelMarginTop;t.adjustLocations(e[i],o.rect.x,o.rect.y,n,r,a,s)}))},y.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var i=t.getChild();if(null==i)return this.toBeTiled[e]=!1,!1;for(var o=i.getNodes(),n=0;n<o.length;n++){var r=o[n];if(this.getNodeDegree(r)>0)return this.toBeTiled[e]=!1,!1;if(null!=r.getChild()){if(!this.getToBeTiled(r))return this.toBeTiled[e]=!1,!1}else this.toBeTiled[r.id]=!1}return this.toBeTiled[e]=!0,!0},y.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),i=0,o=0;o<e.length;o++){var n=e[o];n.getSource().id!==n.getTarget().id&&(i+=1)}return i},y.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(null==t.getChild())return e;for(var i=t.getChild().getNodes(),o=0;o<i.length;o++){var n=i[o];e+=this.getNodeDegreeWithChildren(n)}return e},y.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},y.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var i=t[e];null!=i.getChild()&&this.fillCompexOrderByDFS(i.getChild().getNodes()),this.getToBeTiled(i)&&this.compoundOrder.push(i)}},y.prototype.adjustLocations=function(t,e,i,o,n,r,a){i+=n+a;for(var s=e+=o+r,h=0;h<t.rows.length;h++){var l=t.rows[h];e=s;for(var d=0,g=0;g<l.length;g++){var c=l[g];c.rect.x=e,c.rect.y=i,e+=c.rect.width+t.horizontalPadding,c.rect.height>d&&(d=c.rect.height)}i+=d+t.verticalPadding}},y.prototype.tileCompoundMembers=function(t,e){var i=this;this.tiledMemberPack=[],Object.keys(t).forEach((function(o){var n=e[o];if(i.tiledMemberPack[o]=i.tileNodes(t[o],n.paddingLeft+n.paddingRight),n.rect.width=i.tiledMemberPack[o].width,n.rect.height=i.tiledMemberPack[o].height,n.setCenter(i.tiledMemberPack[o].centerX,i.tiledMemberPack[o].centerY),n.labelMarginLeft=0,n.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var r=n.rect.width,a=n.rect.height;n.labelWidth&&("left"==n.labelPosHorizontal?(n.rect.x-=n.labelWidth,n.setWidth(r+n.labelWidth),n.labelMarginLeft=n.labelWidth):"center"==n.labelPosHorizontal&&n.labelWidth>r?(n.rect.x-=(n.labelWidth-r)/2,n.setWidth(n.labelWidth),n.labelMarginLeft=(n.labelWidth-r)/2):"right"==n.labelPosHorizontal&&n.setWidth(r+n.labelWidth)),n.labelHeight&&("top"==n.labelPosVertical?(n.rect.y-=n.labelHeight,n.setHeight(a+n.labelHeight),n.labelMarginTop=n.labelHeight):"center"==n.labelPosVertical&&n.labelHeight>a?(n.rect.y-=(n.labelHeight-a)/2,n.setHeight(n.labelHeight),n.labelMarginTop=(n.labelHeight-a)/2):"bottom"==n.labelPosVertical&&n.setHeight(a+n.labelHeight))}}))},y.prototype.tileNodes=function(t,e){var i=this.tileNodesByFavoringDim(t,e,!0),o=this.tileNodesByFavoringDim(t,e,!1),n=this.getOrgRatio(i);return this.getOrgRatio(o)<n?o:i},y.prototype.getOrgRatio=function(t){var e=t.width/t.height;return e<1&&(e=1/e),e},y.prototype.calcIdealRowWidth=function(t,e){var i=h.TILING_PADDING_VERTICAL,o=h.TILING_PADDING_HORIZONTAL,n=t.length,r=0,a=0,s=0;t.forEach((function(t){r+=t.getWidth(),a+=t.getHeight(),t.getWidth()>s&&(s=t.getWidth())}));var l,d=r/n,g=a/n,c=Math.pow(i-o,2)+4*(d+o)*(g+i)*n,p=(o-i+Math.sqrt(c))/(2*(d+o));e?(l=Math.ceil(p))==p&&l++:l=Math.floor(p);var f=l*(d+o)-o;return s>f&&(f=s),f+=2*o},y.prototype.tileNodesByFavoringDim=function(t,e,i){var o=h.TILING_PADDING_VERTICAL,n=h.TILING_PADDING_HORIZONTAL,r=h.TILING_COMPARE_BY,a={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:o,horizontalPadding:n,centerX:0,centerY:0};r&&(a.idealRowWidth=this.calcIdealRowWidth(t,i));var s=function(t){return t.rect.width*t.rect.height},l=function(t,e){return s(e)-s(t)};t.sort((function(t,e){var i=l;return a.idealRowWidth?(i=r)(t.id,e.id):i(t,e)}));for(var d=0,g=0,c=0;c<t.length;c++)d+=(p=t[c]).getCenterX(),g+=p.getCenterY();for(a.centerX=d/t.length,a.centerY=g/t.length,c=0;c<t.length;c++){var p=t[c];if(0==a.rows.length)this.insertNodeToRow(a,p,0,e);else if(this.canAddHorizontal(a,p.rect.width,p.rect.height)){var f=a.rows.length-1;a.idealRowWidth||(f=this.getShortestRowIndex(a)),this.insertNodeToRow(a,p,f,e)}else this.insertNodeToRow(a,p,a.rows.length,e);this.shiftToLastRow(a)}return a},y.prototype.insertNodeToRow=function(t,e,i,o){var n=o;i==t.rows.length&&(t.rows.push([]),t.rowWidth.push(n),t.rowHeight.push(0));var r=t.rowWidth[i]+e.rect.width;t.rows[i].length>0&&(r+=t.horizontalPadding),t.rowWidth[i]=r,t.width<r&&(t.width=r);var a=e.rect.height;i>0&&(a+=t.verticalPadding);var s=0;a>t.rowHeight[i]&&(s=t.rowHeight[i],t.rowHeight[i]=a,s=t.rowHeight[i]-s),t.height+=s,t.rows[i].push(e)},y.prototype.getShortestRowIndex=function(t){for(var e=-1,i=Number.MAX_VALUE,o=0;o<t.rows.length;o++)t.rowWidth[o]<i&&(e=o,i=t.rowWidth[o]);return e},y.prototype.getLongestRowIndex=function(t){for(var e=-1,i=Number.MIN_VALUE,o=0;o<t.rows.length;o++)t.rowWidth[o]>i&&(e=o,i=t.rowWidth[o]);return e},y.prototype.canAddHorizontal=function(t,e,i){if(t.idealRowWidth){var o=t.rows.length-1;return t.rowWidth[o]+e+t.horizontalPadding<=t.idealRowWidth}var n=this.getShortestRowIndex(t);if(n<0)return!0;var r=t.rowWidth[n];if(r+t.horizontalPadding+e<=t.width)return!0;var a,s,h=0;return t.rowHeight[n]<i&&n>0&&(h=i+t.verticalPadding-t.rowHeight[n]),a=t.width-r>=e+t.horizontalPadding?(t.height+h)/(r+e+t.horizontalPadding):(t.height+h)/t.width,h=i+t.verticalPadding,(s=t.width<e?(t.height+h)/e:(t.height+h)/t.width)<1&&(s=1/s),a<1&&(a=1/a),a<s},y.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),i=t.rowWidth.length-1,o=t.rows[e],n=o[o.length-1],r=n.width+t.horizontalPadding;if(t.width-t.rowWidth[i]>r&&e!=i){o.splice(-1,1),t.rows[i].push(n),t.rowWidth[e]=t.rowWidth[e]-r,t.rowWidth[i]=t.rowWidth[i]+r,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var a=Number.MIN_VALUE,s=0;s<o.length;s++)o[s].height>a&&(a=o[s].height);e>0&&(a+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[i];t.rowHeight[e]=a,t.rowHeight[i]<n.height+t.verticalPadding&&(t.rowHeight[i]=n.height+t.verticalPadding);var l=t.rowHeight[e]+t.rowHeight[i];t.height+=l-h,this.shiftToLastRow(t)}},y.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},y.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},y.prototype.reduceTrees=function(){for(var t,e=[],i=!0;i;){var o=this.graphManager.getAllNodes(),n=[];i=!1;for(var r=0;r<o.length;r++)if(1==(t=o[r]).getEdges().length&&!t.getEdges()[0].isInterGraph&&null==t.getChild()){if(h.PURE_INCREMENTAL){var a=t.getEdges()[0].getOtherEnd(t),s=new f(t.getCenterX()-a.getCenterX(),t.getCenterY()-a.getCenterY());n.push([t,t.getEdges()[0],t.getOwner(),s])}else n.push([t,t.getEdges()[0],t.getOwner()]);i=!0}if(1==i){for(var l=[],d=0;d<n.length;d++)1==n[d][0].getEdges().length&&(l.push(n[d]),n[d][0].getOwner().remove(n[d][0]));e.push(l),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},y.prototype.growTree=function(t){for(var e,i=t[t.length-1],o=0;o<i.length;o++)e=i[o],this.findPlaceforPrunedNode(e),e[2].add(e[0]),e[2].add(e[1],e[1].source,e[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},y.prototype.findPlaceforPrunedNode=function(t){var e,i,o=t[0];if(i=o==t[1].source?t[1].target:t[1].source,h.PURE_INCREMENTAL)o.setCenter(i.getCenterX()+t[3].getWidth(),i.getCenterY()+t[3].getHeight());else{var n=i.startX,r=i.finishX,a=i.startY,s=i.finishY,l=[0,0,0,0];if(a>0)for(var g=n;g<=r;g++)l[0]+=this.grid[g][a-1].length+this.grid[g][a].length-1;if(r<this.grid.length-1)for(g=a;g<=s;g++)l[1]+=this.grid[r+1][g].length+this.grid[r][g].length-1;if(s<this.grid[0].length-1)for(g=n;g<=r;g++)l[2]+=this.grid[g][s+1].length+this.grid[g][s].length-1;if(n>0)for(g=a;g<=s;g++)l[3]+=this.grid[n-1][g].length+this.grid[n][g].length-1;for(var c,p,f=m.MAX_VALUE,u=0;u<l.length;u++)l[u]<f?(f=l[u],c=1,p=u):l[u]==f&&c++;if(3==c&&0==f)0==l[0]&&0==l[1]&&0==l[2]?e=1:0==l[0]&&0==l[1]&&0==l[3]?e=0:0==l[0]&&0==l[2]&&0==l[3]?e=3:0==l[1]&&0==l[2]&&0==l[3]&&(e=2);else if(2==c&&0==f){var v=Math.floor(2*Math.random());e=0==l[0]&&0==l[1]?0==v?0:1:0==l[0]&&0==l[2]?0==v?0:2:0==l[0]&&0==l[3]?0==v?0:3:0==l[1]&&0==l[2]?0==v?1:2:0==l[1]&&0==l[3]?0==v?1:3:0==v?2:3}else e=4==c&&0==f?v=Math.floor(4*Math.random()):p;0==e?o.setCenter(i.getCenterX(),i.getCenterY()-i.getHeight()/2-d.DEFAULT_EDGE_LENGTH-o.getHeight()/2):1==e?o.setCenter(i.getCenterX()+i.getWidth()/2+d.DEFAULT_EDGE_LENGTH+o.getWidth()/2,i.getCenterY()):2==e?o.setCenter(i.getCenterX(),i.getCenterY()+i.getHeight()/2+d.DEFAULT_EDGE_LENGTH+o.getHeight()/2):o.setCenter(i.getCenterX()-i.getWidth()/2-d.DEFAULT_EDGE_LENGTH-o.getWidth()/2,i.getCenterY())}},t.exports=y},991:(t,e,i)=>{var o=i(551).FDLayoutNode,n=i(551).IMath;function r(t,e,i,n){o.call(this,t,e,i,n)}for(var a in r.prototype=Object.create(o.prototype),o)r[a]=o[a];r.prototype.calculateDisplacement=function(){var t=this.graphManager.getLayout();null!=this.getChild()&&this.fixedNodeWeight?(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*n.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*n.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},r.prototype.propogateDisplacementToChildren=function(t,e){for(var i,o=this.getChild().getNodes(),n=0;n<o.length;n++)null==(i=o[n]).getChild()?(i.displacementX+=t,i.displacementY+=e):i.propogateDisplacementToChildren(t,e)},r.prototype.move=function(){var t=this.graphManager.getLayout();null!=this.child&&0!=this.child.getNodes().length||(this.moveBy(this.displacementX,this.displacementY),t.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY)),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},r.prototype.setPred1=function(t){this.pred1=t},r.prototype.getPred1=function(){return pred1},r.prototype.getPred2=function(){return pred2},r.prototype.setNext=function(t){this.next=t},r.prototype.getNext=function(){return next},r.prototype.setProcessed=function(t){this.processed=t},r.prototype.isProcessed=function(){return processed},t.exports=r},902:(t,e,i)=>{function o(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}var n=i(806),r=i(551).LinkedList,a=i(551).Matrix,s=i(551).SVD;function h(){}h.handleConstraints=function(t){var e={};e.fixedNodeConstraint=t.constraints.fixedNodeConstraint,e.alignmentConstraint=t.constraints.alignmentConstraint,e.relativePlacementConstraint=t.constraints.relativePlacementConstraint;for(var i=new Map,h=new Map,l=[],d=[],g=t.getAllNodes(),c=0,p=0;p<g.length;p++){var f=g[p];null==f.getChild()&&(h.set(f.id,c++),l.push(f.getCenterX()),d.push(f.getCenterY()),i.set(f.id,f))}e.relativePlacementConstraint&&e.relativePlacementConstraint.forEach((function(t){t.gap||0==t.gap||(t.left?t.gap=n.DEFAULT_EDGE_LENGTH+i.get(t.left).getWidth()/2+i.get(t.right).getWidth()/2:t.gap=n.DEFAULT_EDGE_LENGTH+i.get(t.top).getHeight()/2+i.get(t.bottom).getHeight()/2)}));var u=function(t){var e=0,i=0;return t.forEach((function(t){e+=l[h.get(t)],i+=d[h.get(t)]})),{x:e/t.size,y:i/t.size}},m=function(t,e,i,n,a){var s=new Map;t.forEach((function(t,e){s.set(e,0)})),t.forEach((function(t,e){t.forEach((function(t){s.set(t.id,s.get(t.id)+1)}))}));var g=new Map,c=new Map,p=new r;s.forEach((function(t,o){0==t?(p.push(o),i||("horizontal"==e?g.set(o,h.has(o)?l[h.get(o)]:n.get(o)):g.set(o,h.has(o)?d[h.get(o)]:n.get(o)))):g.set(o,Number.NEGATIVE_INFINITY),i&&c.set(o,new Set([o]))})),i&&a.forEach((function(t){var o=[];if(t.forEach((function(t){i.has(t)&&o.push(t)})),o.length>0){var r=0;o.forEach((function(t){"horizontal"==e?(g.set(t,h.has(t)?l[h.get(t)]:n.get(t)),r+=g.get(t)):(g.set(t,h.has(t)?d[h.get(t)]:n.get(t)),r+=g.get(t))})),r/=o.length,t.forEach((function(t){i.has(t)||g.set(t,r)}))}else{var a=0;t.forEach((function(t){a+="horizontal"==e?h.has(t)?l[h.get(t)]:n.get(t):h.has(t)?d[h.get(t)]:n.get(t)})),a/=t.length,t.forEach((function(t){g.set(t,a)}))}}));for(var f=function(){var o=p.shift();t.get(o).forEach((function(t){if(g.get(t.id)<g.get(o)+t.gap)if(i&&i.has(t.id)){var r=void 0;if(r="horizontal"==e?h.has(t.id)?l[h.get(t.id)]:n.get(t.id):h.has(t.id)?d[h.get(t.id)]:n.get(t.id),g.set(t.id,r),r<g.get(o)+t.gap){var a=g.get(o)+t.gap-r;c.get(o).forEach((function(t){g.set(t,g.get(t)-a)}))}}else g.set(t.id,g.get(o)+t.gap);s.set(t.id,s.get(t.id)-1),0==s.get(t.id)&&p.push(t.id),i&&c.set(t.id,function(t,e){var i=new Set(t),o=!0,n=!1,r=void 0;try{for(var a,s=e[Symbol.iterator]();!(o=(a=s.next()).done);o=!0){var h=a.value;i.add(h)}}catch(t){n=!0,r=t}finally{try{!o&&s.return&&s.return()}finally{if(n)throw r}}return i}(c.get(o),c.get(t.id)))}))};0!=p.length;)f();if(i){var u=new Set;t.forEach((function(t,e){0==t.length&&u.add(e)}));var m=[];c.forEach((function(t,e){if(u.has(e)){var n=!1,r=!0,a=!1,s=void 0;try{for(var h,l=t[Symbol.iterator]();!(r=(h=l.next()).done);r=!0){var d=h.value;i.has(d)&&(n=!0)}}catch(t){a=!0,s=t}finally{try{!r&&l.return&&l.return()}finally{if(a)throw s}}if(!n){var g=!1,c=void 0;m.forEach((function(e,i){e.has([].concat(o(t))[0])&&(g=!0,c=i)})),g?t.forEach((function(t){m[c].add(t)})):m.push(new Set(t))}}})),m.forEach((function(t,i){var o=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,c=!0,p=!1,f=void 0;try{for(var u,m=t[Symbol.iterator]();!(c=(u=m.next()).done);c=!0){var v=u.value,T=void 0;T="horizontal"==e?h.has(v)?l[h.get(v)]:n.get(v):h.has(v)?d[h.get(v)]:n.get(v);var N=g.get(v);T<o&&(o=T),T>a&&(a=T),N<r&&(r=N),N>s&&(s=N)}}catch(t){p=!0,f=t}finally{try{!c&&m.return&&m.return()}finally{if(p)throw f}}var E=(o+a)/2-(r+s)/2,y=!0,C=!1,M=void 0;try{for(var w,A=t[Symbol.iterator]();!(y=(w=A.next()).done);y=!0){var I=w.value;g.set(I,g.get(I)+E)}}catch(t){C=!0,M=t}finally{try{!y&&A.return&&A.return()}finally{if(C)throw M}}}))}return g},v=function(t){var e=0,i=0,o=0,n=0;if(t.forEach((function(t){t.left?l[h.get(t.left)]-l[h.get(t.right)]>=0?e++:i++:d[h.get(t.top)]-d[h.get(t.bottom)]>=0?o++:n++})),e>i&&o>n)for(var r=0;r<h.size;r++)l[r]=-1*l[r],d[r]=-1*d[r];else if(e>i)for(var a=0;a<h.size;a++)l[a]=-1*l[a];else if(o>n)for(var s=0;s<h.size;s++)d[s]=-1*d[s]},T=function(t){var e=[],i=new r,o=new Set,n=0;return t.forEach((function(r,a){if(!o.has(a)){e[n]=[];var s=a;for(i.push(s),o.add(s),e[n].push(s);0!=i.length;)s=i.shift(),t.get(s).forEach((function(t){o.has(t.id)||(i.push(t.id),o.add(t.id),e[n].push(t.id))}));n++}})),e},N=function(t){var e=new Map;return t.forEach((function(t,i){e.set(i,[])})),t.forEach((function(t,i){t.forEach((function(t){e.get(i).push(t),e.get(t.id).push({id:i,gap:t.gap,direction:t.direction})}))})),e},E=function(t){var e=new Map;return t.forEach((function(t,i){e.set(i,[])})),t.forEach((function(t,i){t.forEach((function(t){e.get(t.id).push({id:i,gap:t.gap,direction:t.direction})}))})),e},y=[],C=[],M=!1,w=!1,A=new Set,I=new Map,L=new Map,_=[];if(e.fixedNodeConstraint&&e.fixedNodeConstraint.forEach((function(t){A.add(t.nodeId)})),e.relativePlacementConstraint&&(e.relativePlacementConstraint.forEach((function(t){t.left?(I.has(t.left)?I.get(t.left).push({id:t.right,gap:t.gap,direction:"horizontal"}):I.set(t.left,[{id:t.right,gap:t.gap,direction:"horizontal"}]),I.has(t.right)||I.set(t.right,[])):(I.has(t.top)?I.get(t.top).push({id:t.bottom,gap:t.gap,direction:"vertical"}):I.set(t.top,[{id:t.bottom,gap:t.gap,direction:"vertical"}]),I.has(t.bottom)||I.set(t.bottom,[]))})),L=N(I),_=T(L)),n.TRANSFORM_ON_CONSTRAINT_HANDLING){if(e.fixedNodeConstraint&&e.fixedNodeConstraint.length>1)e.fixedNodeConstraint.forEach((function(t,e){y[e]=[t.position.x,t.position.y],C[e]=[l[h.get(t.nodeId)],d[h.get(t.nodeId)]]})),M=!0;else if(e.alignmentConstraint)!function(){var t=0;if(e.alignmentConstraint.vertical){for(var i=e.alignmentConstraint.vertical,n=function(e){var n=new Set;i[e].forEach((function(t){n.add(t)}));var r=new Set([].concat(o(n)).filter((function(t){return A.has(t)}))),a=void 0;a=r.size>0?l[h.get(r.values().next().value)]:u(n).x,i[e].forEach((function(e){y[t]=[a,d[h.get(e)]],C[t]=[l[h.get(e)],d[h.get(e)]],t++}))},r=0;r<i.length;r++)n(r);M=!0}if(e.alignmentConstraint.horizontal){for(var a=e.alignmentConstraint.horizontal,s=function(e){var i=new Set;a[e].forEach((function(t){i.add(t)}));var n=new Set([].concat(o(i)).filter((function(t){return A.has(t)}))),r=void 0;r=n.size>0?l[h.get(n.values().next().value)]:u(i).y,a[e].forEach((function(e){y[t]=[l[h.get(e)],r],C[t]=[l[h.get(e)],d[h.get(e)]],t++}))},g=0;g<a.length;g++)s(g);M=!0}e.relativePlacementConstraint&&(w=!0)}();else if(e.relativePlacementConstraint){for(var b=0,F=0,O=0;O<_.length;O++)_[O].length>b&&(b=_[O].length,F=O);if(b<L.size/2)v(e.relativePlacementConstraint),M=!1,w=!1;else{var R=new Map,P=new Map,x=[];_[F].forEach((function(t){I.get(t).forEach((function(e){"horizontal"==e.direction?(R.has(t)?R.get(t).push(e):R.set(t,[e]),R.has(e.id)||R.set(e.id,[]),x.push({left:t,right:e.id})):(P.has(t)?P.get(t).push(e):P.set(t,[e]),P.has(e.id)||P.set(e.id,[]),x.push({top:t,bottom:e.id}))}))})),v(x),w=!1;var D=m(R,"horizontal"),H=m(P,"vertical");_[F].forEach((function(t,e){C[e]=[l[h.get(t)],d[h.get(t)]],y[e]=[],D.has(t)?y[e][0]=D.get(t):y[e][0]=l[h.get(t)],H.has(t)?y[e][1]=H.get(t):y[e][1]=d[h.get(t)]})),M=!0}}if(M){for(var G,z=a.transpose(y),S=a.transpose(C),V=0;V<z.length;V++)z[V]=a.multGamma(z[V]),S[V]=a.multGamma(S[V]);var W=a.multMat(z,a.transpose(S)),Y=s.svd(W);G=a.multMat(Y.V,a.transpose(Y.U));for(var X=0;X<h.size;X++){var U=[l[X],d[X]],B=[G[0][0],G[1][0]],k=[G[0][1],G[1][1]];l[X]=a.dotProduct(U,B),d[X]=a.dotProduct(U,k)}w&&v(e.relativePlacementConstraint)}}if(n.ENFORCE_CONSTRAINTS){if(e.fixedNodeConstraint&&e.fixedNodeConstraint.length>0){var j={x:0,y:0};e.fixedNodeConstraint.forEach((function(t,e){var i,o,n={x:l[h.get(t.nodeId)],y:d[h.get(t.nodeId)]},r=t.position,a=(o=n,{x:(i=r).x-o.x,y:i.y-o.y});j.x+=a.x,j.y+=a.y})),j.x/=e.fixedNodeConstraint.length,j.y/=e.fixedNodeConstraint.length,l.forEach((function(t,e){l[e]+=j.x})),d.forEach((function(t,e){d[e]+=j.y})),e.fixedNodeConstraint.forEach((function(t){l[h.get(t.nodeId)]=t.position.x,d[h.get(t.nodeId)]=t.position.y}))}if(e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var Z=e.alignmentConstraint.vertical,q=function(t){var e=new Set;Z[t].forEach((function(t){e.add(t)}));var i=new Set([].concat(o(e)).filter((function(t){return A.has(t)}))),n=void 0;n=i.size>0?l[h.get(i.values().next().value)]:u(e).x,e.forEach((function(t){A.has(t)||(l[h.get(t)]=n)}))},K=0;K<Z.length;K++)q(K);if(e.alignmentConstraint.horizontal)for(var Q=e.alignmentConstraint.horizontal,J=function(t){var e=new Set;Q[t].forEach((function(t){e.add(t)}));var i=new Set([].concat(o(e)).filter((function(t){return A.has(t)}))),n=void 0;n=i.size>0?d[h.get(i.values().next().value)]:u(e).y,e.forEach((function(t){A.has(t)||(d[h.get(t)]=n)}))},$=0;$<Q.length;$++)J($)}e.relativePlacementConstraint&&function(){var t=new Map,i=new Map,o=new Map,n=new Map,r=new Map,a=new Map,s=new Set,g=new Set;if(A.forEach((function(t){s.add(t),g.add(t)})),e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var c=e.alignmentConstraint.vertical,p=function(e){o.set("dummy"+e,[]),c[e].forEach((function(i){t.set(i,"dummy"+e),o.get("dummy"+e).push(i),A.has(i)&&s.add("dummy"+e)})),r.set("dummy"+e,l[h.get(c[e][0])])},f=0;f<c.length;f++)p(f);if(e.alignmentConstraint.horizontal)for(var u=e.alignmentConstraint.horizontal,v=function(t){n.set("dummy"+t,[]),u[t].forEach((function(e){i.set(e,"dummy"+t),n.get("dummy"+t).push(e),A.has(e)&&g.add("dummy"+t)})),a.set("dummy"+t,d[h.get(u[t][0])])},y=0;y<u.length;y++)v(y)}var C=new Map,M=new Map,w=function(e){I.get(e).forEach((function(o){var n=void 0,r=void 0;"horizontal"==o.direction?(n=t.get(e)?t.get(e):e,r=t.get(o.id)?{id:t.get(o.id),gap:o.gap,direction:o.direction}:o,C.has(n)?C.get(n).push(r):C.set(n,[r]),C.has(r.id)||C.set(r.id,[])):(n=i.get(e)?i.get(e):e,r=i.get(o.id)?{id:i.get(o.id),gap:o.gap,direction:o.direction}:o,M.has(n)?M.get(n).push(r):M.set(n,[r]),M.has(r.id)||M.set(r.id,[]))}))},L=!0,_=!1,b=void 0;try{for(var F,O=I.keys()[Symbol.iterator]();!(L=(F=O.next()).done);L=!0)w(F.value)}catch(t){_=!0,b=t}finally{try{!L&&O.return&&O.return()}finally{if(_)throw b}}var R=N(C),P=N(M),x=T(R),D=T(P),H=E(C),G=E(M),z=[],S=[];x.forEach((function(t,e){z[e]=[],t.forEach((function(t){0==H.get(t).length&&z[e].push(t)}))})),D.forEach((function(t,e){S[e]=[],t.forEach((function(t){0==G.get(t).length&&S[e].push(t)}))}));var V=m(C,"horizontal",s,r,z),W=m(M,"vertical",g,a,S),Y=function(t){o.get(t)?o.get(t).forEach((function(e){l[h.get(e)]=V.get(t)})):l[h.get(t)]=V.get(t)},X=!0,U=!1,B=void 0;try{for(var k,j=V.keys()[Symbol.iterator]();!(X=(k=j.next()).done);X=!0)Y(k.value)}catch(t){U=!0,B=t}finally{try{!X&&j.return&&j.return()}finally{if(U)throw B}}var Z=function(t){n.get(t)?n.get(t).forEach((function(e){d[h.get(e)]=W.get(t)})):d[h.get(t)]=W.get(t)},q=!0,K=!1,Q=void 0;try{for(var J,$=W.keys()[Symbol.iterator]();!(q=(J=$.next()).done);q=!0)Z(J.value)}catch(t){K=!0,Q=t}finally{try{!q&&$.return&&$.return()}finally{if(K)throw Q}}}()}for(var tt=0;tt<g.length;tt++){var et=g[tt];null==et.getChild()&&et.setCenter(l[h.get(et.id)],d[h.get(et.id)])}},t.exports=h},551:e=>{e.exports=t}},i={},o=function t(o){var n=i[o];if(void 0!==n)return n.exports;var r=i[o]={exports:{}};return e[o](r,r.exports,t),r.exports}(45),o;var e,i,o},n.exports=r(o.__require())),i.__module.exports;var n,r};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("../../../../../_virtual/_commonjsHelpers.js"),i=require("../../../../../_virtual/cose-base.js"),o=require("../../../layout-base@2.0.1/node_modules/layout-base/layout-base.js");i.__module.exports,exports.__require=function(){return t||(t=1,n=i.__module,i.__module.exports,e.commonjsGlobal,r=function(t){return e={45:(t,e,i)=>{var o={};o.layoutBase=i(551),o.CoSEConstants=i(806),o.CoSEEdge=i(767),o.CoSEGraph=i(880),o.CoSEGraphManager=i(578),o.CoSELayout=i(765),o.CoSENode=i(991),o.ConstraintHandler=i(902),t.exports=o},806:(t,e,i)=>{var o=i(551).FDLayoutConstants;function n(){}for(var r in o)n[r]=o[r];n.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,n.DEFAULT_RADIAL_SEPARATION=o.DEFAULT_EDGE_LENGTH,n.DEFAULT_COMPONENT_SEPERATION=60,n.TILE=!0,n.TILING_PADDING_VERTICAL=10,n.TILING_PADDING_HORIZONTAL=10,n.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,n.ENFORCE_CONSTRAINTS=!0,n.APPLY_LAYOUT=!0,n.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,n.TREE_REDUCTION_ON_INCREMENTAL=!0,n.PURE_INCREMENTAL=n.DEFAULT_INCREMENTAL,t.exports=n},767:(t,e,i)=>{var o=i(551).FDLayoutEdge;function n(t,e,i){o.call(this,t,e,i)}for(var r in n.prototype=Object.create(o.prototype),o)n[r]=o[r];t.exports=n},880:(t,e,i)=>{var o=i(551).LGraph;function n(t,e,i){o.call(this,t,e,i)}for(var r in n.prototype=Object.create(o.prototype),o)n[r]=o[r];t.exports=n},578:(t,e,i)=>{var o=i(551).LGraphManager;function n(t){o.call(this,t)}for(var r in n.prototype=Object.create(o.prototype),o)n[r]=o[r];t.exports=n},765:(t,e,i)=>{var o=i(551).FDLayout,n=i(578),r=i(880),a=i(991),s=i(767),h=i(806),l=i(902),d=i(551).FDLayoutConstants,g=i(551).LayoutConstants,c=i(551).Point,p=i(551).PointD,f=i(551).DimensionD,u=i(551).Layout,m=i(551).Integer,v=i(551).IGeometry,T=i(551).LGraph,N=i(551).Transform,E=i(551).LinkedList;function y(){o.call(this),this.toBeTiled={},this.constraints={}}for(var C in y.prototype=Object.create(o.prototype),o)y[C]=o[C];y.prototype.newGraphManager=function(){var t=new n(this);return this.graphManager=t,t},y.prototype.newGraph=function(t){return new r(null,this.graphManager,t)},y.prototype.newNode=function(t){return new a(this.graphManager,t)},y.prototype.newEdge=function(t){return new s(null,null,t)},y.prototype.initParameters=function(){o.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},y.prototype.initSpringEmbedder=function(){o.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},y.prototype.layout=function(){return g.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},y.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)h.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),e=new Set(this.getAllNodes()),i=this.nodesWithGravity.filter((function(t){return e.has(t)})),this.graphManager.setAllNodesToApplyGravitation(i));else{var t=this.getFlatForest();if(t.length>0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),i=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(i),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(l.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),h.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),h.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),h.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var i=!this.isTreeGrowing&&!this.isGrowthFinished,o=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(i,o),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},i=0;i<t.length;i++){var o=t[i].rect,n=t[i].id;e[n]={id:n,x:o.getCenterX(),y:o.getCenterY(),w:o.width,h:o.height}}return e},y.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if("during"===d.ANIMATE)this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},y.prototype.moveNodes=function(){for(var t=this.getAllNodes(),e=0;e<t.length;e++)t[e].calculateDisplacement();for(Object.keys(this.constraints).length>0&&this.updateDisplacements(),e=0;e<t.length;e++)t[e].move()},y.prototype.initConstraintVariables=function(){var t=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var e=this.graphManager.getAllNodes(),i=0;i<e.length;i++){var o=e[i];this.idToNodeMap.set(o.id,o)}var n=function e(i){for(var o,n=i.getChild().getNodes(),r=0,a=0;a<n.length;a++)null==(o=n[a]).getChild()?t.fixedNodeSet.has(o.id)&&(r+=100):r+=e(o);return r};if(this.constraints.fixedNodeConstraint)for(this.constraints.fixedNodeConstraint.forEach((function(e){t.fixedNodeSet.add(e.nodeId)})),e=this.graphManager.getAllNodes(),i=0;i<e.length;i++)if(null!=(o=e[i]).getChild()){var r=n(o);r>0&&(o.fixedNodeWeight=r)}if(this.constraints.relativePlacementConstraint){var a=new Map,s=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach((function(e){t.fixedNodesOnHorizontal.add(e),t.fixedNodesOnVertical.add(e)})),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical){var l=this.constraints.alignmentConstraint.vertical;for(i=0;i<l.length;i++)this.dummyToNodeForVerticalAlignment.set("dummy"+i,[]),l[i].forEach((function(e){a.set(e,"dummy"+i),t.dummyToNodeForVerticalAlignment.get("dummy"+i).push(e),t.fixedNodeSet.has(e)&&t.fixedNodesOnHorizontal.add("dummy"+i)}))}if(this.constraints.alignmentConstraint.horizontal){var d=this.constraints.alignmentConstraint.horizontal;for(i=0;i<d.length;i++)this.dummyToNodeForHorizontalAlignment.set("dummy"+i,[]),d[i].forEach((function(e){s.set(e,"dummy"+i),t.dummyToNodeForHorizontalAlignment.get("dummy"+i).push(e),t.fixedNodeSet.has(e)&&t.fixedNodesOnVertical.add("dummy"+i)}))}}if(h.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(t){var e,i,o;for(o=t.length-1;o>=2*t.length/3;o--)e=Math.floor(Math.random()*(o+1)),i=t[o],t[o]=t[e],t[e]=i;return t},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach((function(e){if(e.left){var i=a.has(e.left)?a.get(e.left):e.left,o=a.has(e.right)?a.get(e.right):e.right;t.nodesInRelativeHorizontal.includes(i)||(t.nodesInRelativeHorizontal.push(i),t.nodeToRelativeConstraintMapHorizontal.set(i,[]),t.dummyToNodeForVerticalAlignment.has(i)?t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(i)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(i).getCenterX())),t.nodesInRelativeHorizontal.includes(o)||(t.nodesInRelativeHorizontal.push(o),t.nodeToRelativeConstraintMapHorizontal.set(o,[]),t.dummyToNodeForVerticalAlignment.has(o)?t.nodeToTempPositionMapHorizontal.set(o,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(o)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(o,t.idToNodeMap.get(o).getCenterX())),t.nodeToRelativeConstraintMapHorizontal.get(i).push({right:o,gap:e.gap}),t.nodeToRelativeConstraintMapHorizontal.get(o).push({left:i,gap:e.gap})}else{var n=s.has(e.top)?s.get(e.top):e.top,r=s.has(e.bottom)?s.get(e.bottom):e.bottom;t.nodesInRelativeVertical.includes(n)||(t.nodesInRelativeVertical.push(n),t.nodeToRelativeConstraintMapVertical.set(n,[]),t.dummyToNodeForHorizontalAlignment.has(n)?t.nodeToTempPositionMapVertical.set(n,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(n)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(n,t.idToNodeMap.get(n).getCenterY())),t.nodesInRelativeVertical.includes(r)||(t.nodesInRelativeVertical.push(r),t.nodeToRelativeConstraintMapVertical.set(r,[]),t.dummyToNodeForHorizontalAlignment.has(r)?t.nodeToTempPositionMapVertical.set(r,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(r)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(r,t.idToNodeMap.get(r).getCenterY())),t.nodeToRelativeConstraintMapVertical.get(n).push({bottom:r,gap:e.gap}),t.nodeToRelativeConstraintMapVertical.get(r).push({top:n,gap:e.gap})}}));else{var g=new Map,c=new Map;this.constraints.relativePlacementConstraint.forEach((function(t){if(t.left){var e=a.has(t.left)?a.get(t.left):t.left,i=a.has(t.right)?a.get(t.right):t.right;g.has(e)?g.get(e).push(i):g.set(e,[i]),g.has(i)?g.get(i).push(e):g.set(i,[e])}else{var o=s.has(t.top)?s.get(t.top):t.top,n=s.has(t.bottom)?s.get(t.bottom):t.bottom;c.has(o)?c.get(o).push(n):c.set(o,[n]),c.has(n)?c.get(n).push(o):c.set(n,[o])}}));var p=function(t,e){var i=[],o=[],n=new E,r=new Set,a=0;return t.forEach((function(s,h){if(!r.has(h)){i[a]=[],o[a]=!1;var l=h;for(n.push(l),r.add(l),i[a].push(l);0!=n.length;)l=n.shift(),e.has(l)&&(o[a]=!0),t.get(l).forEach((function(t){r.has(t)||(n.push(t),r.add(t),i[a].push(t))}));a++}})),{components:i,isFixed:o}},f=p(g,t.fixedNodesOnHorizontal);this.componentsOnHorizontal=f.components,this.fixedComponentsOnHorizontal=f.isFixed;var u=p(c,t.fixedNodesOnVertical);this.componentsOnVertical=u.components,this.fixedComponentsOnVertical=u.isFixed}}},y.prototype.updateDisplacements=function(){var t=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach((function(e){var i=t.idToNodeMap.get(e.nodeId);i.displacementX=0,i.displacementY=0})),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var e=this.constraints.alignmentConstraint.vertical,i=0;i<e.length;i++){for(var o=0,n=0;n<e[i].length;n++){if(this.fixedNodeSet.has(e[i][n])){o=0;break}o+=this.idToNodeMap.get(e[i][n]).displacementX}var r=o/e[i].length;for(n=0;n<e[i].length;n++)this.idToNodeMap.get(e[i][n]).displacementX=r}if(this.constraints.alignmentConstraint.horizontal){var a=this.constraints.alignmentConstraint.horizontal;for(i=0;i<a.length;i++){var s=0;for(n=0;n<a[i].length;n++){if(this.fixedNodeSet.has(a[i][n])){s=0;break}s+=this.idToNodeMap.get(a[i][n]).displacementY}var l=s/a[i].length;for(n=0;n<a[i].length;n++)this.idToNodeMap.get(a[i][n]).displacementY=l}}}if(this.constraints.relativePlacementConstraint)if(h.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach((function(e){if(!t.fixedNodesOnHorizontal.has(e)){var i=0;i=t.dummyToNodeForVerticalAlignment.has(e)?t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(e)[0]).displacementX:t.idToNodeMap.get(e).displacementX,t.nodeToRelativeConstraintMapHorizontal.get(e).forEach((function(o){var n;o.right?(n=t.nodeToTempPositionMapHorizontal.get(o.right)-t.nodeToTempPositionMapHorizontal.get(e)-i)<o.gap&&(i-=o.gap-n):(n=t.nodeToTempPositionMapHorizontal.get(e)-t.nodeToTempPositionMapHorizontal.get(o.left)+i)<o.gap&&(i+=o.gap-n)})),t.nodeToTempPositionMapHorizontal.set(e,t.nodeToTempPositionMapHorizontal.get(e)+i),t.dummyToNodeForVerticalAlignment.has(e)?t.dummyToNodeForVerticalAlignment.get(e).forEach((function(e){t.idToNodeMap.get(e).displacementX=i})):t.idToNodeMap.get(e).displacementX=i}})),this.nodesInRelativeVertical.forEach((function(e){if(!t.fixedNodesOnHorizontal.has(e)){var i=0;i=t.dummyToNodeForHorizontalAlignment.has(e)?t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(e)[0]).displacementY:t.idToNodeMap.get(e).displacementY,t.nodeToRelativeConstraintMapVertical.get(e).forEach((function(o){var n;o.bottom?(n=t.nodeToTempPositionMapVertical.get(o.bottom)-t.nodeToTempPositionMapVertical.get(e)-i)<o.gap&&(i-=o.gap-n):(n=t.nodeToTempPositionMapVertical.get(e)-t.nodeToTempPositionMapVertical.get(o.top)+i)<o.gap&&(i+=o.gap-n)})),t.nodeToTempPositionMapVertical.set(e,t.nodeToTempPositionMapVertical.get(e)+i),t.dummyToNodeForHorizontalAlignment.has(e)?t.dummyToNodeForHorizontalAlignment.get(e).forEach((function(e){t.idToNodeMap.get(e).displacementY=i})):t.idToNodeMap.get(e).displacementY=i}}));else{for(i=0;i<this.componentsOnHorizontal.length;i++){var d=this.componentsOnHorizontal[i];if(this.fixedComponentsOnHorizontal[i])for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?this.dummyToNodeForVerticalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementX=0})):this.idToNodeMap.get(d[n]).displacementX=0;else{var g=0,c=0;for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?(g+=(f=this.dummyToNodeForVerticalAlignment.get(d[n])).length*this.idToNodeMap.get(f[0]).displacementX,c+=f.length):(g+=this.idToNodeMap.get(d[n]).displacementX,c++);var p=g/c;for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?this.dummyToNodeForVerticalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementX=p})):this.idToNodeMap.get(d[n]).displacementX=p}}for(i=0;i<this.componentsOnVertical.length;i++)if(d=this.componentsOnVertical[i],this.fixedComponentsOnVertical[i])for(n=0;n<d.length;n++)this.dummyToNodeForHorizontalAlignment.has(d[n])?this.dummyToNodeForHorizontalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementY=0})):this.idToNodeMap.get(d[n]).displacementY=0;else{for(g=0,c=0,n=0;n<d.length;n++){var f;this.dummyToNodeForHorizontalAlignment.has(d[n])?(g+=(f=this.dummyToNodeForHorizontalAlignment.get(d[n])).length*this.idToNodeMap.get(f[0]).displacementY,c+=f.length):(g+=this.idToNodeMap.get(d[n]).displacementY,c++)}for(p=g/c,n=0;n<d.length;n++)this.dummyToNodeForHorizontalAlignment.has(d[n])?this.dummyToNodeForHorizontalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementY=p})):this.idToNodeMap.get(d[n]).displacementY=p}}},y.prototype.calculateNodesToApplyGravitationTo=function(){var t,e,i=[],o=this.graphManager.getGraphs(),n=o.length;for(e=0;e<n;e++)(t=o[e]).updateConnected(),t.isConnected||(i=i.concat(t.getNodes()));return i},y.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e,i=new Set;for(e=0;e<t.length;e++){var o=t[e];if(!i.has(o)){var n=o.getSource(),r=o.getTarget();if(n==r)o.getBendpoints().push(new p),o.getBendpoints().push(new p),this.createDummyNodesForBendpoints(o),i.add(o);else{var a=[];if(a=(a=a.concat(n.getEdgeListToNode(r))).concat(r.getEdgeListToNode(n)),!i.has(a[0])){var s;if(a.length>1)for(s=0;s<a.length;s++){var h=a[s];h.getBendpoints().push(new p),this.createDummyNodesForBendpoints(h)}a.forEach((function(t){i.add(t)}))}}}if(i.size==t.length)break}},y.prototype.positionNodesRadially=function(t){for(var e=new c(0,0),i=Math.ceil(Math.sqrt(t.length)),o=0,n=0,r=0,a=new p(0,0),s=0;s<t.length;s++){s%i==0&&(r=0,n=o,0!=s&&(n+=h.DEFAULT_COMPONENT_SEPERATION),o=0);var l=t[s],d=u.findCenterOfTree(l);e.x=r,e.y=n,(a=y.radialLayout(l,d,e)).y>o&&(o=Math.floor(a.y)),r=Math.floor(a.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(g.WORLD_CENTER_X-a.x/2,g.WORLD_CENTER_Y-a.y/2))},y.radialLayout=function(t,e,i){var o=Math.max(this.maxDiagonalInTree(t),h.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(e,null,0,359,0,o);var n=T.calculateBounds(t),r=new N;r.setDeviceOrgX(n.getMinX()),r.setDeviceOrgY(n.getMinY()),r.setWorldOrgX(i.x),r.setWorldOrgY(i.y);for(var a=0;a<t.length;a++)t[a].transform(r);var s=new p(n.getMaxX(),n.getMaxY());return r.inverseTransformPoint(s)},y.branchRadialLayout=function(t,e,i,o,n,r){var a=(o-i+1)/2;a<0&&(a+=180);var s=(a+i)%360*v.TWO_PI/360,h=n*Math.cos(s),l=n*Math.sin(s);t.setCenter(h,l);var d=[],g=(d=d.concat(t.getEdges())).length;null!=e&&g--;for(var c,p=0,f=d.length,u=t.getEdgesBetween(e);u.length>1;){var m=u[0];u.splice(0,1);var T=d.indexOf(m);T>=0&&d.splice(T,1),f--,g--}c=null!=e?(d.indexOf(u[0])+1)%f:0;for(var N=Math.abs(o-i)/g,E=c;p!=g;E=++E%f){var C=d[E].getOtherEnd(t);if(C!=e){var M=(i+p*N)%360,w=(M+N)%360;y.branchRadialLayout(C,t,M,w,n+r,r),p++}}},y.maxDiagonalInTree=function(t){for(var e=m.MIN_VALUE,i=0;i<t.length;i++){var o=t[i].getDiagonal();o>e&&(e=o)}return e},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var i=[],o=this.graphManager.getAllNodes(),n=0;n<o.length;n++){var r=(s=o[n]).getParent();0!==this.getNodeDegreeWithChildren(s)||null!=r.id&&this.getToBeTiled(r)||i.push(s)}for(n=0;n<i.length;n++){var s,h=(s=i[n]).getParent().id;void 0===e[h]&&(e[h]=[]),e[h]=e[h].concat(s)}Object.keys(e).forEach((function(i){if(e[i].length>1){var o="DummyCompound_"+i;t.memberGroups[o]=e[i];var n=e[i][0].getParent(),r=new a(t.graphManager);r.id=o,r.paddingLeft=n.paddingLeft||0,r.paddingRight=n.paddingRight||0,r.paddingBottom=n.paddingBottom||0,r.paddingTop=n.paddingTop||0,t.idToDummyNode[o]=r;var s=t.getGraphManager().add(t.newGraph(),r),h=n.getChild();h.add(r);for(var l=0;l<e[i].length;l++){var d=e[i][l];h.remove(d),s.add(d)}}}))},y.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var i=0;i<this.compoundOrder.length;i++)e[this.compoundOrder[i].id]=this.compoundOrder[i],t[this.compoundOrder[i].id]=[].concat(this.compoundOrder[i].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[i].getChild()),this.compoundOrder[i].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},y.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach((function(i){var o=t.idToDummyNode[i];if(e[i]=t.tileNodes(t.memberGroups[i],o.paddingLeft+o.paddingRight),o.rect.width=e[i].width,o.rect.height=e[i].height,o.setCenter(e[i].centerX,e[i].centerY),o.labelMarginLeft=0,o.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var n=o.rect.width,r=o.rect.height;o.labelWidth&&("left"==o.labelPosHorizontal?(o.rect.x-=o.labelWidth,o.setWidth(n+o.labelWidth),o.labelMarginLeft=o.labelWidth):"center"==o.labelPosHorizontal&&o.labelWidth>n?(o.rect.x-=(o.labelWidth-n)/2,o.setWidth(o.labelWidth),o.labelMarginLeft=(o.labelWidth-n)/2):"right"==o.labelPosHorizontal&&o.setWidth(n+o.labelWidth)),o.labelHeight&&("top"==o.labelPosVertical?(o.rect.y-=o.labelHeight,o.setHeight(r+o.labelHeight),o.labelMarginTop=o.labelHeight):"center"==o.labelPosVertical&&o.labelHeight>r?(o.rect.y-=(o.labelHeight-r)/2,o.setHeight(o.labelHeight),o.labelMarginTop=(o.labelHeight-r)/2):"bottom"==o.labelPosVertical&&o.setHeight(r+o.labelHeight))}}))},y.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],i=e.id,o=e.paddingLeft,n=e.paddingTop,r=e.labelMarginLeft,a=e.labelMarginTop;this.adjustLocations(this.tiledMemberPack[i],e.rect.x,e.rect.y,o,n,r,a)}},y.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach((function(i){var o=t.idToDummyNode[i],n=o.paddingLeft,r=o.paddingTop,a=o.labelMarginLeft,s=o.labelMarginTop;t.adjustLocations(e[i],o.rect.x,o.rect.y,n,r,a,s)}))},y.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var i=t.getChild();if(null==i)return this.toBeTiled[e]=!1,!1;for(var o=i.getNodes(),n=0;n<o.length;n++){var r=o[n];if(this.getNodeDegree(r)>0)return this.toBeTiled[e]=!1,!1;if(null!=r.getChild()){if(!this.getToBeTiled(r))return this.toBeTiled[e]=!1,!1}else this.toBeTiled[r.id]=!1}return this.toBeTiled[e]=!0,!0},y.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),i=0,o=0;o<e.length;o++){var n=e[o];n.getSource().id!==n.getTarget().id&&(i+=1)}return i},y.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(null==t.getChild())return e;for(var i=t.getChild().getNodes(),o=0;o<i.length;o++){var n=i[o];e+=this.getNodeDegreeWithChildren(n)}return e},y.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},y.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var i=t[e];null!=i.getChild()&&this.fillCompexOrderByDFS(i.getChild().getNodes()),this.getToBeTiled(i)&&this.compoundOrder.push(i)}},y.prototype.adjustLocations=function(t,e,i,o,n,r,a){i+=n+a;for(var s=e+=o+r,h=0;h<t.rows.length;h++){var l=t.rows[h];e=s;for(var d=0,g=0;g<l.length;g++){var c=l[g];c.rect.x=e,c.rect.y=i,e+=c.rect.width+t.horizontalPadding,c.rect.height>d&&(d=c.rect.height)}i+=d+t.verticalPadding}},y.prototype.tileCompoundMembers=function(t,e){var i=this;this.tiledMemberPack=[],Object.keys(t).forEach((function(o){var n=e[o];if(i.tiledMemberPack[o]=i.tileNodes(t[o],n.paddingLeft+n.paddingRight),n.rect.width=i.tiledMemberPack[o].width,n.rect.height=i.tiledMemberPack[o].height,n.setCenter(i.tiledMemberPack[o].centerX,i.tiledMemberPack[o].centerY),n.labelMarginLeft=0,n.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var r=n.rect.width,a=n.rect.height;n.labelWidth&&("left"==n.labelPosHorizontal?(n.rect.x-=n.labelWidth,n.setWidth(r+n.labelWidth),n.labelMarginLeft=n.labelWidth):"center"==n.labelPosHorizontal&&n.labelWidth>r?(n.rect.x-=(n.labelWidth-r)/2,n.setWidth(n.labelWidth),n.labelMarginLeft=(n.labelWidth-r)/2):"right"==n.labelPosHorizontal&&n.setWidth(r+n.labelWidth)),n.labelHeight&&("top"==n.labelPosVertical?(n.rect.y-=n.labelHeight,n.setHeight(a+n.labelHeight),n.labelMarginTop=n.labelHeight):"center"==n.labelPosVertical&&n.labelHeight>a?(n.rect.y-=(n.labelHeight-a)/2,n.setHeight(n.labelHeight),n.labelMarginTop=(n.labelHeight-a)/2):"bottom"==n.labelPosVertical&&n.setHeight(a+n.labelHeight))}}))},y.prototype.tileNodes=function(t,e){var i=this.tileNodesByFavoringDim(t,e,!0),o=this.tileNodesByFavoringDim(t,e,!1),n=this.getOrgRatio(i);return this.getOrgRatio(o)<n?o:i},y.prototype.getOrgRatio=function(t){var e=t.width/t.height;return e<1&&(e=1/e),e},y.prototype.calcIdealRowWidth=function(t,e){var i=h.TILING_PADDING_VERTICAL,o=h.TILING_PADDING_HORIZONTAL,n=t.length,r=0,a=0,s=0;t.forEach((function(t){r+=t.getWidth(),a+=t.getHeight(),t.getWidth()>s&&(s=t.getWidth())}));var l,d=r/n,g=a/n,c=Math.pow(i-o,2)+4*(d+o)*(g+i)*n,p=(o-i+Math.sqrt(c))/(2*(d+o));e?(l=Math.ceil(p))==p&&l++:l=Math.floor(p);var f=l*(d+o)-o;return s>f&&(f=s),f+=2*o},y.prototype.tileNodesByFavoringDim=function(t,e,i){var o=h.TILING_PADDING_VERTICAL,n=h.TILING_PADDING_HORIZONTAL,r=h.TILING_COMPARE_BY,a={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:o,horizontalPadding:n,centerX:0,centerY:0};r&&(a.idealRowWidth=this.calcIdealRowWidth(t,i));var s=function(t){return t.rect.width*t.rect.height},l=function(t,e){return s(e)-s(t)};t.sort((function(t,e){var i=l;return a.idealRowWidth?(i=r)(t.id,e.id):i(t,e)}));for(var d=0,g=0,c=0;c<t.length;c++)d+=(p=t[c]).getCenterX(),g+=p.getCenterY();for(a.centerX=d/t.length,a.centerY=g/t.length,c=0;c<t.length;c++){var p=t[c];if(0==a.rows.length)this.insertNodeToRow(a,p,0,e);else if(this.canAddHorizontal(a,p.rect.width,p.rect.height)){var f=a.rows.length-1;a.idealRowWidth||(f=this.getShortestRowIndex(a)),this.insertNodeToRow(a,p,f,e)}else this.insertNodeToRow(a,p,a.rows.length,e);this.shiftToLastRow(a)}return a},y.prototype.insertNodeToRow=function(t,e,i,o){var n=o;i==t.rows.length&&(t.rows.push([]),t.rowWidth.push(n),t.rowHeight.push(0));var r=t.rowWidth[i]+e.rect.width;t.rows[i].length>0&&(r+=t.horizontalPadding),t.rowWidth[i]=r,t.width<r&&(t.width=r);var a=e.rect.height;i>0&&(a+=t.verticalPadding);var s=0;a>t.rowHeight[i]&&(s=t.rowHeight[i],t.rowHeight[i]=a,s=t.rowHeight[i]-s),t.height+=s,t.rows[i].push(e)},y.prototype.getShortestRowIndex=function(t){for(var e=-1,i=Number.MAX_VALUE,o=0;o<t.rows.length;o++)t.rowWidth[o]<i&&(e=o,i=t.rowWidth[o]);return e},y.prototype.getLongestRowIndex=function(t){for(var e=-1,i=Number.MIN_VALUE,o=0;o<t.rows.length;o++)t.rowWidth[o]>i&&(e=o,i=t.rowWidth[o]);return e},y.prototype.canAddHorizontal=function(t,e,i){if(t.idealRowWidth){var o=t.rows.length-1;return t.rowWidth[o]+e+t.horizontalPadding<=t.idealRowWidth}var n=this.getShortestRowIndex(t);if(n<0)return!0;var r=t.rowWidth[n];if(r+t.horizontalPadding+e<=t.width)return!0;var a,s,h=0;return t.rowHeight[n]<i&&n>0&&(h=i+t.verticalPadding-t.rowHeight[n]),a=t.width-r>=e+t.horizontalPadding?(t.height+h)/(r+e+t.horizontalPadding):(t.height+h)/t.width,h=i+t.verticalPadding,(s=t.width<e?(t.height+h)/e:(t.height+h)/t.width)<1&&(s=1/s),a<1&&(a=1/a),a<s},y.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),i=t.rowWidth.length-1,o=t.rows[e],n=o[o.length-1],r=n.width+t.horizontalPadding;if(t.width-t.rowWidth[i]>r&&e!=i){o.splice(-1,1),t.rows[i].push(n),t.rowWidth[e]=t.rowWidth[e]-r,t.rowWidth[i]=t.rowWidth[i]+r,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var a=Number.MIN_VALUE,s=0;s<o.length;s++)o[s].height>a&&(a=o[s].height);e>0&&(a+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[i];t.rowHeight[e]=a,t.rowHeight[i]<n.height+t.verticalPadding&&(t.rowHeight[i]=n.height+t.verticalPadding);var l=t.rowHeight[e]+t.rowHeight[i];t.height+=l-h,this.shiftToLastRow(t)}},y.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},y.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},y.prototype.reduceTrees=function(){for(var t,e=[],i=!0;i;){var o=this.graphManager.getAllNodes(),n=[];i=!1;for(var r=0;r<o.length;r++)if(1==(t=o[r]).getEdges().length&&!t.getEdges()[0].isInterGraph&&null==t.getChild()){if(h.PURE_INCREMENTAL){var a=t.getEdges()[0].getOtherEnd(t),s=new f(t.getCenterX()-a.getCenterX(),t.getCenterY()-a.getCenterY());n.push([t,t.getEdges()[0],t.getOwner(),s])}else n.push([t,t.getEdges()[0],t.getOwner()]);i=!0}if(1==i){for(var l=[],d=0;d<n.length;d++)1==n[d][0].getEdges().length&&(l.push(n[d]),n[d][0].getOwner().remove(n[d][0]));e.push(l),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},y.prototype.growTree=function(t){for(var e,i=t[t.length-1],o=0;o<i.length;o++)e=i[o],this.findPlaceforPrunedNode(e),e[2].add(e[0]),e[2].add(e[1],e[1].source,e[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},y.prototype.findPlaceforPrunedNode=function(t){var e,i,o=t[0];if(i=o==t[1].source?t[1].target:t[1].source,h.PURE_INCREMENTAL)o.setCenter(i.getCenterX()+t[3].getWidth(),i.getCenterY()+t[3].getHeight());else{var n=i.startX,r=i.finishX,a=i.startY,s=i.finishY,l=[0,0,0,0];if(a>0)for(var g=n;g<=r;g++)l[0]+=this.grid[g][a-1].length+this.grid[g][a].length-1;if(r<this.grid.length-1)for(g=a;g<=s;g++)l[1]+=this.grid[r+1][g].length+this.grid[r][g].length-1;if(s<this.grid[0].length-1)for(g=n;g<=r;g++)l[2]+=this.grid[g][s+1].length+this.grid[g][s].length-1;if(n>0)for(g=a;g<=s;g++)l[3]+=this.grid[n-1][g].length+this.grid[n][g].length-1;for(var c,p,f=m.MAX_VALUE,u=0;u<l.length;u++)l[u]<f?(f=l[u],c=1,p=u):l[u]==f&&c++;if(3==c&&0==f)0==l[0]&&0==l[1]&&0==l[2]?e=1:0==l[0]&&0==l[1]&&0==l[3]?e=0:0==l[0]&&0==l[2]&&0==l[3]?e=3:0==l[1]&&0==l[2]&&0==l[3]&&(e=2);else if(2==c&&0==f){var v=Math.floor(2*Math.random());e=0==l[0]&&0==l[1]?0==v?0:1:0==l[0]&&0==l[2]?0==v?0:2:0==l[0]&&0==l[3]?0==v?0:3:0==l[1]&&0==l[2]?0==v?1:2:0==l[1]&&0==l[3]?0==v?1:3:0==v?2:3}else e=4==c&&0==f?v=Math.floor(4*Math.random()):p;0==e?o.setCenter(i.getCenterX(),i.getCenterY()-i.getHeight()/2-d.DEFAULT_EDGE_LENGTH-o.getHeight()/2):1==e?o.setCenter(i.getCenterX()+i.getWidth()/2+d.DEFAULT_EDGE_LENGTH+o.getWidth()/2,i.getCenterY()):2==e?o.setCenter(i.getCenterX(),i.getCenterY()+i.getHeight()/2+d.DEFAULT_EDGE_LENGTH+o.getHeight()/2):o.setCenter(i.getCenterX()-i.getWidth()/2-d.DEFAULT_EDGE_LENGTH-o.getWidth()/2,i.getCenterY())}},t.exports=y},991:(t,e,i)=>{var o=i(551).FDLayoutNode,n=i(551).IMath;function r(t,e,i,n){o.call(this,t,e,i,n)}for(var a in r.prototype=Object.create(o.prototype),o)r[a]=o[a];r.prototype.calculateDisplacement=function(){var t=this.graphManager.getLayout();null!=this.getChild()&&this.fixedNodeWeight?(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*n.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*n.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},r.prototype.propogateDisplacementToChildren=function(t,e){for(var i,o=this.getChild().getNodes(),n=0;n<o.length;n++)null==(i=o[n]).getChild()?(i.displacementX+=t,i.displacementY+=e):i.propogateDisplacementToChildren(t,e)},r.prototype.move=function(){var t=this.graphManager.getLayout();null!=this.child&&0!=this.child.getNodes().length||(this.moveBy(this.displacementX,this.displacementY),t.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY)),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},r.prototype.setPred1=function(t){this.pred1=t},r.prototype.getPred1=function(){return pred1},r.prototype.getPred2=function(){return pred2},r.prototype.setNext=function(t){this.next=t},r.prototype.getNext=function(){return next},r.prototype.setProcessed=function(t){this.processed=t},r.prototype.isProcessed=function(){return processed},t.exports=r},902:(t,e,i)=>{function o(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}var n=i(806),r=i(551).LinkedList,a=i(551).Matrix,s=i(551).SVD;function h(){}h.handleConstraints=function(t){var e={};e.fixedNodeConstraint=t.constraints.fixedNodeConstraint,e.alignmentConstraint=t.constraints.alignmentConstraint,e.relativePlacementConstraint=t.constraints.relativePlacementConstraint;for(var i=new Map,h=new Map,l=[],d=[],g=t.getAllNodes(),c=0,p=0;p<g.length;p++){var f=g[p];null==f.getChild()&&(h.set(f.id,c++),l.push(f.getCenterX()),d.push(f.getCenterY()),i.set(f.id,f))}e.relativePlacementConstraint&&e.relativePlacementConstraint.forEach((function(t){t.gap||0==t.gap||(t.left?t.gap=n.DEFAULT_EDGE_LENGTH+i.get(t.left).getWidth()/2+i.get(t.right).getWidth()/2:t.gap=n.DEFAULT_EDGE_LENGTH+i.get(t.top).getHeight()/2+i.get(t.bottom).getHeight()/2)}));var u=function(t){var e=0,i=0;return t.forEach((function(t){e+=l[h.get(t)],i+=d[h.get(t)]})),{x:e/t.size,y:i/t.size}},m=function(t,e,i,n,a){var s=new Map;t.forEach((function(t,e){s.set(e,0)})),t.forEach((function(t,e){t.forEach((function(t){s.set(t.id,s.get(t.id)+1)}))}));var g=new Map,c=new Map,p=new r;s.forEach((function(t,o){0==t?(p.push(o),i||("horizontal"==e?g.set(o,h.has(o)?l[h.get(o)]:n.get(o)):g.set(o,h.has(o)?d[h.get(o)]:n.get(o)))):g.set(o,Number.NEGATIVE_INFINITY),i&&c.set(o,new Set([o]))})),i&&a.forEach((function(t){var o=[];if(t.forEach((function(t){i.has(t)&&o.push(t)})),o.length>0){var r=0;o.forEach((function(t){"horizontal"==e?(g.set(t,h.has(t)?l[h.get(t)]:n.get(t)),r+=g.get(t)):(g.set(t,h.has(t)?d[h.get(t)]:n.get(t)),r+=g.get(t))})),r/=o.length,t.forEach((function(t){i.has(t)||g.set(t,r)}))}else{var a=0;t.forEach((function(t){a+="horizontal"==e?h.has(t)?l[h.get(t)]:n.get(t):h.has(t)?d[h.get(t)]:n.get(t)})),a/=t.length,t.forEach((function(t){g.set(t,a)}))}}));for(var f=function(){var o=p.shift();t.get(o).forEach((function(t){if(g.get(t.id)<g.get(o)+t.gap)if(i&&i.has(t.id)){var r=void 0;if(r="horizontal"==e?h.has(t.id)?l[h.get(t.id)]:n.get(t.id):h.has(t.id)?d[h.get(t.id)]:n.get(t.id),g.set(t.id,r),r<g.get(o)+t.gap){var a=g.get(o)+t.gap-r;c.get(o).forEach((function(t){g.set(t,g.get(t)-a)}))}}else g.set(t.id,g.get(o)+t.gap);s.set(t.id,s.get(t.id)-1),0==s.get(t.id)&&p.push(t.id),i&&c.set(t.id,function(t,e){var i=new Set(t),o=!0,n=!1,r=void 0;try{for(var a,s=e[Symbol.iterator]();!(o=(a=s.next()).done);o=!0){var h=a.value;i.add(h)}}catch(t){n=!0,r=t}finally{try{!o&&s.return&&s.return()}finally{if(n)throw r}}return i}(c.get(o),c.get(t.id)))}))};0!=p.length;)f();if(i){var u=new Set;t.forEach((function(t,e){0==t.length&&u.add(e)}));var m=[];c.forEach((function(t,e){if(u.has(e)){var n=!1,r=!0,a=!1,s=void 0;try{for(var h,l=t[Symbol.iterator]();!(r=(h=l.next()).done);r=!0){var d=h.value;i.has(d)&&(n=!0)}}catch(t){a=!0,s=t}finally{try{!r&&l.return&&l.return()}finally{if(a)throw s}}if(!n){var g=!1,c=void 0;m.forEach((function(e,i){e.has([].concat(o(t))[0])&&(g=!0,c=i)})),g?t.forEach((function(t){m[c].add(t)})):m.push(new Set(t))}}})),m.forEach((function(t,i){var o=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,c=!0,p=!1,f=void 0;try{for(var u,m=t[Symbol.iterator]();!(c=(u=m.next()).done);c=!0){var v=u.value,T=void 0;T="horizontal"==e?h.has(v)?l[h.get(v)]:n.get(v):h.has(v)?d[h.get(v)]:n.get(v);var N=g.get(v);T<o&&(o=T),T>a&&(a=T),N<r&&(r=N),N>s&&(s=N)}}catch(t){p=!0,f=t}finally{try{!c&&m.return&&m.return()}finally{if(p)throw f}}var E=(o+a)/2-(r+s)/2,y=!0,C=!1,M=void 0;try{for(var w,A=t[Symbol.iterator]();!(y=(w=A.next()).done);y=!0){var I=w.value;g.set(I,g.get(I)+E)}}catch(t){C=!0,M=t}finally{try{!y&&A.return&&A.return()}finally{if(C)throw M}}}))}return g},v=function(t){var e=0,i=0,o=0,n=0;if(t.forEach((function(t){t.left?l[h.get(t.left)]-l[h.get(t.right)]>=0?e++:i++:d[h.get(t.top)]-d[h.get(t.bottom)]>=0?o++:n++})),e>i&&o>n)for(var r=0;r<h.size;r++)l[r]=-1*l[r],d[r]=-1*d[r];else if(e>i)for(var a=0;a<h.size;a++)l[a]=-1*l[a];else if(o>n)for(var s=0;s<h.size;s++)d[s]=-1*d[s]},T=function(t){var e=[],i=new r,o=new Set,n=0;return t.forEach((function(r,a){if(!o.has(a)){e[n]=[];var s=a;for(i.push(s),o.add(s),e[n].push(s);0!=i.length;)s=i.shift(),t.get(s).forEach((function(t){o.has(t.id)||(i.push(t.id),o.add(t.id),e[n].push(t.id))}));n++}})),e},N=function(t){var e=new Map;return t.forEach((function(t,i){e.set(i,[])})),t.forEach((function(t,i){t.forEach((function(t){e.get(i).push(t),e.get(t.id).push({id:i,gap:t.gap,direction:t.direction})}))})),e},E=function(t){var e=new Map;return t.forEach((function(t,i){e.set(i,[])})),t.forEach((function(t,i){t.forEach((function(t){e.get(t.id).push({id:i,gap:t.gap,direction:t.direction})}))})),e},y=[],C=[],M=!1,w=!1,A=new Set,I=new Map,L=new Map,_=[];if(e.fixedNodeConstraint&&e.fixedNodeConstraint.forEach((function(t){A.add(t.nodeId)})),e.relativePlacementConstraint&&(e.relativePlacementConstraint.forEach((function(t){t.left?(I.has(t.left)?I.get(t.left).push({id:t.right,gap:t.gap,direction:"horizontal"}):I.set(t.left,[{id:t.right,gap:t.gap,direction:"horizontal"}]),I.has(t.right)||I.set(t.right,[])):(I.has(t.top)?I.get(t.top).push({id:t.bottom,gap:t.gap,direction:"vertical"}):I.set(t.top,[{id:t.bottom,gap:t.gap,direction:"vertical"}]),I.has(t.bottom)||I.set(t.bottom,[]))})),L=N(I),_=T(L)),n.TRANSFORM_ON_CONSTRAINT_HANDLING){if(e.fixedNodeConstraint&&e.fixedNodeConstraint.length>1)e.fixedNodeConstraint.forEach((function(t,e){y[e]=[t.position.x,t.position.y],C[e]=[l[h.get(t.nodeId)],d[h.get(t.nodeId)]]})),M=!0;else if(e.alignmentConstraint)!function(){var t=0;if(e.alignmentConstraint.vertical){for(var i=e.alignmentConstraint.vertical,n=function(e){var n=new Set;i[e].forEach((function(t){n.add(t)}));var r=new Set([].concat(o(n)).filter((function(t){return A.has(t)}))),a=void 0;a=r.size>0?l[h.get(r.values().next().value)]:u(n).x,i[e].forEach((function(e){y[t]=[a,d[h.get(e)]],C[t]=[l[h.get(e)],d[h.get(e)]],t++}))},r=0;r<i.length;r++)n(r);M=!0}if(e.alignmentConstraint.horizontal){for(var a=e.alignmentConstraint.horizontal,s=function(e){var i=new Set;a[e].forEach((function(t){i.add(t)}));var n=new Set([].concat(o(i)).filter((function(t){return A.has(t)}))),r=void 0;r=n.size>0?l[h.get(n.values().next().value)]:u(i).y,a[e].forEach((function(e){y[t]=[l[h.get(e)],r],C[t]=[l[h.get(e)],d[h.get(e)]],t++}))},g=0;g<a.length;g++)s(g);M=!0}e.relativePlacementConstraint&&(w=!0)}();else if(e.relativePlacementConstraint){for(var b=0,F=0,O=0;O<_.length;O++)_[O].length>b&&(b=_[O].length,F=O);if(b<L.size/2)v(e.relativePlacementConstraint),M=!1,w=!1;else{var R=new Map,P=new Map,x=[];_[F].forEach((function(t){I.get(t).forEach((function(e){"horizontal"==e.direction?(R.has(t)?R.get(t).push(e):R.set(t,[e]),R.has(e.id)||R.set(e.id,[]),x.push({left:t,right:e.id})):(P.has(t)?P.get(t).push(e):P.set(t,[e]),P.has(e.id)||P.set(e.id,[]),x.push({top:t,bottom:e.id}))}))})),v(x),w=!1;var D=m(R,"horizontal"),H=m(P,"vertical");_[F].forEach((function(t,e){C[e]=[l[h.get(t)],d[h.get(t)]],y[e]=[],D.has(t)?y[e][0]=D.get(t):y[e][0]=l[h.get(t)],H.has(t)?y[e][1]=H.get(t):y[e][1]=d[h.get(t)]})),M=!0}}if(M){for(var G,z=a.transpose(y),S=a.transpose(C),V=0;V<z.length;V++)z[V]=a.multGamma(z[V]),S[V]=a.multGamma(S[V]);var W=a.multMat(z,a.transpose(S)),Y=s.svd(W);G=a.multMat(Y.V,a.transpose(Y.U));for(var X=0;X<h.size;X++){var U=[l[X],d[X]],B=[G[0][0],G[1][0]],k=[G[0][1],G[1][1]];l[X]=a.dotProduct(U,B),d[X]=a.dotProduct(U,k)}w&&v(e.relativePlacementConstraint)}}if(n.ENFORCE_CONSTRAINTS){if(e.fixedNodeConstraint&&e.fixedNodeConstraint.length>0){var j={x:0,y:0};e.fixedNodeConstraint.forEach((function(t,e){var i,o,n={x:l[h.get(t.nodeId)],y:d[h.get(t.nodeId)]},r=t.position,a=(o=n,{x:(i=r).x-o.x,y:i.y-o.y});j.x+=a.x,j.y+=a.y})),j.x/=e.fixedNodeConstraint.length,j.y/=e.fixedNodeConstraint.length,l.forEach((function(t,e){l[e]+=j.x})),d.forEach((function(t,e){d[e]+=j.y})),e.fixedNodeConstraint.forEach((function(t){l[h.get(t.nodeId)]=t.position.x,d[h.get(t.nodeId)]=t.position.y}))}if(e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var Z=e.alignmentConstraint.vertical,q=function(t){var e=new Set;Z[t].forEach((function(t){e.add(t)}));var i=new Set([].concat(o(e)).filter((function(t){return A.has(t)}))),n=void 0;n=i.size>0?l[h.get(i.values().next().value)]:u(e).x,e.forEach((function(t){A.has(t)||(l[h.get(t)]=n)}))},K=0;K<Z.length;K++)q(K);if(e.alignmentConstraint.horizontal)for(var Q=e.alignmentConstraint.horizontal,J=function(t){var e=new Set;Q[t].forEach((function(t){e.add(t)}));var i=new Set([].concat(o(e)).filter((function(t){return A.has(t)}))),n=void 0;n=i.size>0?d[h.get(i.values().next().value)]:u(e).y,e.forEach((function(t){A.has(t)||(d[h.get(t)]=n)}))},$=0;$<Q.length;$++)J($)}e.relativePlacementConstraint&&function(){var t=new Map,i=new Map,o=new Map,n=new Map,r=new Map,a=new Map,s=new Set,g=new Set;if(A.forEach((function(t){s.add(t),g.add(t)})),e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var c=e.alignmentConstraint.vertical,p=function(e){o.set("dummy"+e,[]),c[e].forEach((function(i){t.set(i,"dummy"+e),o.get("dummy"+e).push(i),A.has(i)&&s.add("dummy"+e)})),r.set("dummy"+e,l[h.get(c[e][0])])},f=0;f<c.length;f++)p(f);if(e.alignmentConstraint.horizontal)for(var u=e.alignmentConstraint.horizontal,v=function(t){n.set("dummy"+t,[]),u[t].forEach((function(e){i.set(e,"dummy"+t),n.get("dummy"+t).push(e),A.has(e)&&g.add("dummy"+t)})),a.set("dummy"+t,d[h.get(u[t][0])])},y=0;y<u.length;y++)v(y)}var C=new Map,M=new Map,w=function(e){I.get(e).forEach((function(o){var n=void 0,r=void 0;"horizontal"==o.direction?(n=t.get(e)?t.get(e):e,r=t.get(o.id)?{id:t.get(o.id),gap:o.gap,direction:o.direction}:o,C.has(n)?C.get(n).push(r):C.set(n,[r]),C.has(r.id)||C.set(r.id,[])):(n=i.get(e)?i.get(e):e,r=i.get(o.id)?{id:i.get(o.id),gap:o.gap,direction:o.direction}:o,M.has(n)?M.get(n).push(r):M.set(n,[r]),M.has(r.id)||M.set(r.id,[]))}))},L=!0,_=!1,b=void 0;try{for(var F,O=I.keys()[Symbol.iterator]();!(L=(F=O.next()).done);L=!0)w(F.value)}catch(t){_=!0,b=t}finally{try{!L&&O.return&&O.return()}finally{if(_)throw b}}var R=N(C),P=N(M),x=T(R),D=T(P),H=E(C),G=E(M),z=[],S=[];x.forEach((function(t,e){z[e]=[],t.forEach((function(t){0==H.get(t).length&&z[e].push(t)}))})),D.forEach((function(t,e){S[e]=[],t.forEach((function(t){0==G.get(t).length&&S[e].push(t)}))}));var V=m(C,"horizontal",s,r,z),W=m(M,"vertical",g,a,S),Y=function(t){o.get(t)?o.get(t).forEach((function(e){l[h.get(e)]=V.get(t)})):l[h.get(t)]=V.get(t)},X=!0,U=!1,B=void 0;try{for(var k,j=V.keys()[Symbol.iterator]();!(X=(k=j.next()).done);X=!0)Y(k.value)}catch(t){U=!0,B=t}finally{try{!X&&j.return&&j.return()}finally{if(U)throw B}}var Z=function(t){n.get(t)?n.get(t).forEach((function(e){d[h.get(e)]=W.get(t)})):d[h.get(t)]=W.get(t)},q=!0,K=!1,Q=void 0;try{for(var J,$=W.keys()[Symbol.iterator]();!(q=(J=$.next()).done);q=!0)Z(J.value)}catch(t){K=!0,Q=t}finally{try{!q&&$.return&&$.return()}finally{if(K)throw Q}}}()}for(var tt=0;tt<g.length;tt++){var et=g[tt];null==et.getChild()&&et.setCenter(l[h.get(et.id)],d[h.get(et.id)])}},t.exports=h},551:e=>{e.exports=t}},i={},o=function t(o){var n=i[o];if(void 0!==n)return n.exports;var r=i[o]={exports:{}};return e[o](r,r.exports,t),r.exports}(45),o;var e,i,o},n.exports=r(o.__require())),i.__module.exports;var n,r};
|