libre-webui 0.38.0 → 0.39.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/README.md +1 -0
- package/backend/dist/persistence/postgresMigrationRegistry.d.ts.map +1 -1
- package/backend/dist/persistence/postgresMigrationRegistry.js +2 -0
- package/backend/dist/persistence/postgresMigrationRegistry.js.map +1 -1
- package/backend/dist/persistence/postgresWorkRunThinkMigration.d.ts +9 -0
- package/backend/dist/persistence/postgresWorkRunThinkMigration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresWorkRunThinkMigration.js +39 -0
- package/backend/dist/persistence/postgresWorkRunThinkMigration.js.map +1 -0
- package/backend/dist/persistence/sqliteMigrations.d.ts.map +1 -1
- package/backend/dist/persistence/sqliteMigrations.js +20 -0
- package/backend/dist/persistence/sqliteMigrations.js.map +1 -1
- package/backend/dist/persistence/sqliteToPostgresMigration.d.ts.map +1 -1
- package/backend/dist/persistence/sqliteToPostgresMigration.js +1 -0
- package/backend/dist/persistence/sqliteToPostgresMigration.js.map +1 -1
- package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts.map +1 -1
- package/backend/dist/platform/workPersistence/postgresWorkPersistence.js +3 -2
- package/backend/dist/platform/workPersistence/postgresWorkPersistence.js.map +1 -1
- package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts.map +1 -1
- package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js +3 -3
- package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js.map +1 -1
- package/backend/dist/platform/workPersistence/types.d.ts +5 -0
- package/backend/dist/platform/workPersistence/types.d.ts.map +1 -1
- package/backend/dist/platform/workPersistence/types.js.map +1 -1
- package/backend/dist/routes/work.d.ts.map +1 -1
- package/backend/dist/routes/work.js +17 -2
- package/backend/dist/routes/work.js.map +1 -1
- package/backend/dist/services/agentCliService.d.ts.map +1 -1
- package/backend/dist/services/agentCliService.js +1 -0
- package/backend/dist/services/agentCliService.js.map +1 -1
- package/backend/dist/services/followUpService.d.ts +4 -1
- package/backend/dist/services/followUpService.d.ts.map +1 -1
- package/backend/dist/services/followUpService.js +23 -2
- package/backend/dist/services/followUpService.js.map +1 -1
- package/backend/dist/services/pluginService.d.ts.map +1 -1
- package/backend/dist/services/pluginService.js +10 -6
- package/backend/dist/services/pluginService.js.map +1 -1
- package/backend/dist/services/workAgentService.d.ts.map +1 -1
- package/backend/dist/services/workAgentService.js +3 -0
- package/backend/dist/services/workAgentService.js.map +1 -1
- package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
- package/backend/dist/services/workModelProviderService.js +43 -13
- package/backend/dist/services/workModelProviderService.js.map +1 -1
- package/backend/dist/services/workTaskService.d.ts +3 -2
- package/backend/dist/services/workTaskService.d.ts.map +1 -1
- package/backend/dist/services/workTaskService.js +10 -6
- package/backend/dist/services/workTaskService.js.map +1 -1
- package/backend/dist/types/work.d.ts +3 -0
- package/backend/dist/types/work.d.ts.map +1 -1
- package/backend/dist/types/work.js.map +1 -1
- package/backend/dist/utils/bedrockMantle.d.ts +46 -0
- package/backend/dist/utils/bedrockMantle.d.ts.map +1 -0
- package/backend/dist/utils/bedrockMantle.js +206 -0
- package/backend/dist/utils/bedrockMantle.js.map +1 -0
- package/backend/dist/utils/pluginChatAdapter.d.ts +36 -0
- package/backend/dist/utils/pluginChatAdapter.d.ts.map +1 -1
- package/backend/dist/utils/pluginChatAdapter.js +122 -47
- package/backend/dist/utils/pluginChatAdapter.js.map +1 -1
- package/backend/dist/utils/pluginDefinitionTrust.d.ts.map +1 -1
- package/backend/dist/utils/pluginDefinitionTrust.js +3 -2
- package/backend/dist/utils/pluginDefinitionTrust.js.map +1 -1
- package/backend/dist/utils/pluginValidation.d.ts +1 -1
- package/backend/dist/utils/pluginValidation.d.ts.map +1 -1
- package/backend/dist/utils/pluginValidation.js +11 -0
- package/backend/dist/utils/pluginValidation.js.map +1 -1
- package/backend/package.json +3 -3
- package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
- package/frontend/dist/artifact-runtime/babel.js +170 -170
- package/frontend/dist/artifact-runtime/framer-motion.js +3 -3
- package/frontend/dist/artifact-runtime/lucide-react.js +1 -1
- package/frontend/dist/artifact-runtime/mathjs.js +1 -1
- package/frontend/dist/artifact-runtime/mermaid.js +1 -1
- package/frontend/dist/artifact-runtime/plotly.js +1 -1
- package/frontend/dist/artifact-runtime/react.js +3 -3
- package/frontend/dist/assets/index-D99DS5c6.js +57 -0
- package/frontend/dist/assets/index-Dz1JufgZ.css +1 -0
- package/frontend/dist/assets/{markdown-math-D1Bj3pDB.css → markdown-math-DzFXvcrH.css} +1 -1
- package/frontend/dist/index.html +32 -32
- package/frontend/dist/js/{ArtifactContainer-BWTN4QSW.js → ArtifactContainer-Cn7X9HGm.js} +1 -1
- package/frontend/dist/js/{ArtifactDemoPage-CCh7lQEw.js → ArtifactDemoPage-Ddpy2O_v.js} +1 -1
- package/frontend/dist/js/{ArtifactSandboxFrame-D1ntMsqe.js → ArtifactSandboxFrame-CdsAqv8H.js} +1 -1
- package/frontend/dist/js/{ArtifactSlideOutPanel-zPEBPoMh.js → ArtifactSlideOutPanel-cVd9X80o.js} +1 -1
- package/frontend/dist/js/{AutomationModal-DN98Eyym.js → AutomationModal-B4UaWjkk.js} +1 -1
- package/frontend/dist/js/{AutomationsPage-3DBwRKME.js → AutomationsPage-huCrvLUp.js} +1 -1
- package/frontend/dist/js/{AvatarUpload-D5_wGUb5.js → AvatarUpload-CG-w6Mpt.js} +1 -1
- package/frontend/dist/js/{Button-CTwi9N3d.js → Button-j68Q8KVh.js} +1 -1
- package/frontend/dist/js/{CalendarPage-CUbGH3Tl.js → CalendarPage-CZXT1w99.js} +1 -1
- package/frontend/dist/js/ChannelsPage-DbtdHnSL.js +1 -0
- package/frontend/dist/js/ChatPage-BZE65kiq.js +14 -0
- package/frontend/dist/js/ConnectModels-DD4bLgdq.js +1 -0
- package/frontend/dist/js/{EvaluationsPage-BaND2qQM.js → EvaluationsPage-Dq53LaXd.js} +1 -1
- package/frontend/dist/js/{FirstTimeSetup-D8ktLJKO.js → FirstTimeSetup-BoJIfuQT.js} +1 -1
- package/frontend/dist/js/{GalleryPage-DXQLoU0l.js → GalleryPage-DKwqeB2A.js} +1 -1
- package/frontend/dist/js/{HomePage-WVug1vWc.js → HomePage-C8bCJfls.js} +1 -1
- package/frontend/dist/js/{LanguageSwitcher-DHHTrDBR.js → LanguageSwitcher-B_YyU5JG.js} +1 -1
- package/frontend/dist/js/{Logo-D1o5k_wt.js → Logo-DnfVtjgj.js} +1 -1
- package/frontend/dist/js/{LogoMark-lnmc98jv.js → LogoMark-BzObGdA9.js} +1 -1
- package/frontend/dist/js/{ModelManagerModals-BPALNMDH.js → ModelManagerModals-BzjZ-QwL.js} +1 -1
- package/frontend/dist/js/{NotesPage-CRzX2Wa8.js → NotesPage-CnaAp_w_.js} +1 -1
- package/frontend/dist/js/{OptimizedSyntaxHighlighter-CzzV6ONG.js → OptimizedSyntaxHighlighter-B0g8cxZQ.js} +1 -1
- package/frontend/dist/js/OptimizedSyntaxHighlighter-B_BbHeO1.js +1 -0
- package/frontend/dist/js/{PasswordStrengthMeter-BGrHWG0B.js → PasswordStrengthMeter-DI4RDv67.js} +1 -1
- package/frontend/dist/js/{PersonasPage-BRU9151f.js → PersonasPage-CH3GUKph.js} +1 -1
- package/frontend/dist/js/{PluginUsagePage-BlhYZq1l.js → PluginUsagePage-d54K2gAj.js} +1 -1
- package/frontend/dist/js/{RichMessageContent-OGBLO64L.js → RichMessageContent-BfYbVBFz.js} +2 -2
- package/frontend/dist/js/RichMessageContent-CDxxs3Tt.js +1 -0
- package/frontend/dist/js/SettingsModal-BvtJcvow.js +19 -0
- package/frontend/dist/js/{SettingsToggle-Du2FSUPO.js → SettingsToggle-DrJ0Bapi.js} +1 -1
- package/frontend/dist/js/{ShareDialog-DEhxnLfn.js → ShareDialog-DaSxkTKS.js} +1 -1
- package/frontend/dist/js/{StrandsPage-DWnUKSb0.js → StrandsPage-BQwz0mWq.js} +1 -1
- package/frontend/dist/js/{SystemPage-cqq8lSxB.js → SystemPage-BqNZoFxR.js} +1 -1
- package/frontend/dist/js/{TurnstileWidget-CVepEMEQ.js → TurnstileWidget-tI50c7Kc.js} +1 -1
- package/frontend/dist/js/{UserManagementPage-2yHv89ZA.js → UserManagementPage-UvPjA9RP.js} +1 -1
- package/frontend/dist/js/{UserManagementPanel-NZmoTk6V.js → UserManagementPanel-C3T1ReJJ.js} +1 -1
- package/frontend/dist/js/{WhatsNewModal-5SwIdmU1.js → WhatsNewModal-CLcU2Ugk.js} +1 -1
- package/frontend/dist/js/WorkPage-BpjGn--1.js +8 -0
- package/frontend/dist/js/{api-CnJYEbRz.js → api-BrHW-VGd.js} +1 -1
- package/frontend/dist/js/api-K_hhqPdx.js +1 -0
- package/frontend/dist/js/{appNavigation-BXNRwrN-.js → appNavigation-B6xYIgLi.js} +1 -1
- package/frontend/dist/js/appStore-DkRdQQeY.js +2 -0
- package/frontend/dist/js/appVersion-BVtSqLVj.js +1 -0
- package/frontend/dist/js/{ar-Bp843BgG.js → ar-XTZGEtBr.js} +1 -1
- package/frontend/dist/js/authStore-DBS6Kbvh.js +1 -0
- package/frontend/dist/js/{authStore-DwaPsICv.js → authStore-DjAsRpNL.js} +3 -3
- package/frontend/dist/js/{bn-DmSGkklY.js → bn-JiK7ZWmy.js} +1 -1
- package/frontend/dist/js/{chatStore-j8bGpkeT.js → chatStore-DpVxt9VX.js} +3 -3
- package/frontend/dist/js/{client-DQy1iGRM.js → client-DppLngAs.js} +2 -2
- package/frontend/dist/js/{config-BbrsmDn2.js → config-4_s8hdqO.js} +1 -1
- package/frontend/dist/js/{cs-BcauIRyG.js → cs-D8ju18CO.js} +1 -1
- package/frontend/dist/js/{da-CJ14DPJ_.js → da-BJWcAoUc.js} +1 -1
- package/frontend/dist/js/{de-ajswyAhq.js → de-CLJLmy69.js} +1 -1
- package/frontend/dist/js/{es-rlf8FsMZ.js → es-BvqHEL-3.js} +1 -1
- package/frontend/dist/js/{evaluationsApi-KVsH7yXe.js → evaluationsApi-DyuW7IJ_.js} +1 -1
- package/frontend/dist/js/{fr-BwkM1wie.js → fr-B8ZoZomI.js} +1 -1
- package/frontend/dist/js/{hi-B3eId9-I.js → hi-AzJLALo-.js} +1 -1
- package/frontend/dist/js/{id-BcgPFJh2.js → id-DZYGQhvC.js} +1 -1
- package/frontend/dist/js/{is-Crvd3K7f.js → is-Da_kvtzW.js} +1 -1
- package/frontend/dist/js/{it-DrLx24hb.js → it-B90zSlqn.js} +1 -1
- package/frontend/dist/js/{ja-DZMcf-oB.js → ja-DU_K1GOr.js} +1 -1
- package/frontend/dist/js/{ko-Cm0NiOE8.js → ko-DicfoO-e.js} +1 -1
- package/frontend/dist/js/{markdown-CZ1tYEW8.js → markdown-DU84620G.js} +1 -1
- package/frontend/dist/js/{markdown-core-KjS96SYW.js → markdown-core-Cyql92Hg.js} +1 -1
- package/frontend/dist/js/{markdown-html-DQEwrWcf.js → markdown-html-CUc2fCgY.js} +1 -1
- package/frontend/dist/js/{markdown-math-CKi32S5d.js → markdown-math-DxPfMKvO.js} +1 -1
- package/frontend/dist/js/{markdownHtml-lrXhxBhK.js → markdownHtml-KhS0cFNH.js} +1 -1
- package/frontend/dist/js/markdownMath-CsfRQAcz.js +1 -0
- package/frontend/dist/js/{messageCodeStyles-CDnMKLgo.js → messageCodeStyles-CuQPkfEK.js} +1 -1
- package/frontend/dist/js/{ms-ymaG59hx.js → ms-CfH7wjUY.js} +1 -1
- package/frontend/dist/js/{nl-CdIdeA9d.js → nl-ELlOz-B3.js} +1 -1
- package/frontend/dist/js/{pl-CuO0b605.js → pl-33dayyUk.js} +1 -1
- package/frontend/dist/js/{pt-Vy413FG5.js → pt-aIXSQPCT.js} +1 -1
- package/frontend/dist/js/react-vendor-CR5VJ85Q.js +9 -0
- package/frontend/dist/js/{router-vendor-HZm4FR0A.js → router-vendor-DqMnEJWK.js} +1 -1
- package/frontend/dist/js/{ru-D0zOEVrL.js → ru-BSvGtBtW.js} +1 -1
- package/frontend/dist/js/{standalone-DbyFjvTU.js → standalone-D_lg5NC9.js} +1 -1
- package/frontend/dist/js/{strandsApi-SeoX_IsY.js → strandsApi-BFbeEpAY.js} +1 -1
- package/frontend/dist/js/{sv-JoS4krpk.js → sv-B7KOz81W.js} +1 -1
- package/frontend/dist/js/{syntax-highlight-DNc3FFCa.js → syntax-highlight-D7dQ5s5-.js} +1 -1
- package/frontend/dist/js/{teamEventStream-CZYdpbVw.js → teamEventStream-DsAS6P4m.js} +1 -1
- package/frontend/dist/js/{th-afhelaqR.js → th-DgpjGxvA.js} +1 -1
- package/frontend/dist/js/{tr-BhSy9UrR.js → tr-BQTbl2h-.js} +1 -1
- package/frontend/dist/js/{ui-CW3gJ4Kl.js → ui-Aq8MP7Ph.js} +2 -2
- package/frontend/dist/js/{ui-vendor-_fvLnmDx.js → ui-vendor-DVTj_sKN.js} +1 -1
- package/frontend/dist/js/{uk-CibXypnZ.js → uk-JLymloot.js} +1 -1
- package/frontend/dist/js/{useChat-CBySqLqR.js → useChat-D3ZAGz70.js} +1 -1
- package/frontend/dist/js/{useDialogFocus-DbW0oA9H.js → useDialogFocus-zSGHkpE4.js} +1 -1
- package/frontend/dist/js/useDictation-B6l8QzeM.js +1 -0
- package/frontend/dist/js/{useQuery-hWmQjdLu.js → useQuery-BTKpXudI.js} +1 -1
- package/frontend/dist/js/{useTranslation-UHEMTEHd.js → useTranslation-Boi0fB1B.js} +1 -1
- package/frontend/dist/js/{utils-DaXuqmQm.js → utils-B-Bhh1pF.js} +1 -1
- package/frontend/dist/js/{utils-vendor-CvhktdS_.js → utils-vendor-DPJG-EG_.js} +1 -1
- package/frontend/dist/js/{vi-Cg0WKHtb.js → vi-BXdLOJ8q.js} +1 -1
- package/frontend/dist/js/workApi-D1xtiG3Q.js +1 -0
- package/frontend/dist/js/{workApi-BqkCbCLQ.js → workApi-UPxumrEF.js} +1 -1
- package/frontend/dist/js/{zh-DTqys9TE.js → zh-gdUf9sXa.js} +1 -1
- package/package.json +3 -3
- package/plugins/anthropic.json +3 -1
- package/plugins/bedrock.json +86 -0
- package/plugins/openrouter.json +2 -0
- package/frontend/dist/assets/index-CJHJxwjA.js +0 -68
- package/frontend/dist/assets/index-DSHdOZRK.css +0 -1
- package/frontend/dist/js/ChannelsPage-B1hC1rRS.js +0 -1
- package/frontend/dist/js/ChatPage-B7mEg5z2.js +0 -14
- package/frontend/dist/js/ConnectModels-Cby89_Mc.js +0 -1
- package/frontend/dist/js/OptimizedSyntaxHighlighter-ajqwyBQm.js +0 -1
- package/frontend/dist/js/RichMessageContent-FiuPwDG7.js +0 -1
- package/frontend/dist/js/SettingsModal-sLkxG-lW.js +0 -19
- package/frontend/dist/js/WorkPage-BIuaVNEC.js +0 -8
- package/frontend/dist/js/api-C2k0OqEk.js +0 -1
- package/frontend/dist/js/appStore-DULGAJnH.js +0 -2
- package/frontend/dist/js/appVersion-DooVk4c_.js +0 -1
- package/frontend/dist/js/authStore-CaLdzyAr.js +0 -1
- package/frontend/dist/js/markdownMath-B0BpyFBS.js +0 -1
- package/frontend/dist/js/react-vendor-wiHys0m2.js +0 -9
- package/frontend/dist/js/useDictation-DEAp64eu.js +0 -1
- package/frontend/dist/js/workApi-gpxrWwCm.js +0 -1
|
@@ -556,7 +556,7 @@ ${i.join(`
|
|
|
556
556
|
L0,20`)},`requirement_arrow`),requirement_contains:p((e,t,n)=>{let r=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-requirement_containsStart`).attr(`refX`,0).attr(`refY`,10).attr(`markerWidth`,20).attr(`markerHeight`,20).attr(`orient`,`auto`).append(`g`);r.append(`circle`).attr(`cx`,10).attr(`cy`,10).attr(`r`,9).attr(`fill`,`none`),r.append(`line`).attr(`x1`,1).attr(`x2`,19).attr(`y1`,10).attr(`y2`,10),r.append(`line`).attr(`y1`,1).attr(`y2`,19).attr(`x1`,10).attr(`x2`,10)},`requirement_contains`),requirement_arrow_neo:p((e,t,n)=>{let{themeVariables:r}=Zo(),{strokeWidth:i}=r;e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-requirement_arrowEnd`).attr(`refX`,20).attr(`refY`,10).attr(`markerWidth`,20).attr(`markerHeight`,20).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).attr(`stroke-width`,`${i}`).attr(`viewBox`,`0 0 25 20`).append(`path`).attr(`d`,`M0,0
|
|
557
557
|
L20,10
|
|
558
558
|
M20,10
|
|
559
|
-
L0,20`).attr(`stroke-linejoin`,`miter`)},`requirement_arrow_neo`),requirement_contains_neo:p((e,t,n)=>{let{themeVariables:r}=Zo(),{strokeWidth:i}=r,a=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-requirement_containsStart`).attr(`refX`,0).attr(`refY`,10).attr(`markerWidth`,20).attr(`markerHeight`,20).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`g`);a.append(`circle`).attr(`cx`,10).attr(`cy`,10).attr(`r`,9).attr(`fill`,`none`),a.append(`line`).attr(`x1`,1).attr(`x2`,19).attr(`y1`,10).attr(`y2`,10),a.append(`line`).attr(`y1`,1).attr(`y2`,19).attr(`x1`,10).attr(`x2`,10),a.selectAll(`*`).attr(`stroke-width`,`${i}`)},`requirement_contains_neo`)},H_=HSe})),WSe=l({render:()=>GSe}),GSe,KSe=o((()=>{GSe=()=>{throw Error(`The ELK layout is not bundled with Libre WebUI artifacts; use the dagre layout.`)}})),W_,qSe=o((()=>{W_=typeof global==`object`&&global&&global.Object===Object&&global})),JSe,G_,K_=o((()=>{qSe(),JSe=typeof self==`object`&&self&&self.Object===Object&&self,G_=W_||JSe||Function(`return this`)()})),q_,J_=o((()=>{K_(),q_=G_.Symbol}));function YSe(e){var t=XSe.call(e,X_),n=e[X_];try{e[X_]=void 0;var r=!0}catch{}var i=ZSe.call(e);return r&&(t?e[X_]=n:delete e[X_]),i}var Y_,XSe,ZSe,X_,QSe=o((()=>{J_(),Y_=Object.prototype,XSe=Y_.hasOwnProperty,ZSe=Y_.toString,X_=q_?q_.toStringTag:void 0}));function $Se(e){return eCe.call(e)}var eCe,tCe=o((()=>{eCe=Object.prototype.toString}));function Z_(e){return e==null?e===void 0?rCe:nCe:Q_&&Q_ in Object(e)?YSe(e):$Se(e)}var nCe,rCe,Q_,$_=o((()=>{J_(),QSe(),tCe(),nCe=`[object Null]`,rCe=`[object Undefined]`,Q_=q_?q_.toStringTag:void 0}));function ev(e){return typeof e==`object`&&!!e}var tv=o((()=>{}));function nv(e){return typeof e==`symbol`||ev(e)&&Z_(e)==iCe}var iCe,rv=o((()=>{$_(),tv(),iCe=`[object Symbol]`}));function iv(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var av=o((()=>{})),ov,sv=o((()=>{ov=Array.isArray}));function aCe(e){if(typeof e==`string`)return e;if(ov(e))return iv(e,aCe)+``;if(nv(e))return lv?lv.call(e):``;var t=e+``;return t==`0`&&1/e==-oCe?`-0`:t}var oCe,cv,lv,sCe=o((()=>{J_(),av(),sv(),rv(),oCe=1/0,cv=q_?q_.prototype:void 0,lv=cv?cv.toString:void 0}));function cCe(e){for(var t=e.length;t--&&lCe.test(e.charAt(t)););return t}var lCe,uCe=o((()=>{lCe=/\s/}));function dCe(e){return e&&e.slice(0,cCe(e)+1).replace(fCe,``)}var fCe,pCe=o((()=>{uCe(),fCe=/^\s+/}));function uv(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var dv=o((()=>{}));function mCe(e){if(typeof e==`number`)return e;if(nv(e))return fv;if(uv(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=uv(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=dCe(e);var n=gCe.test(e);return n||_Ce.test(e)?vCe(e.slice(2),n?2:8):hCe.test(e)?fv:+e}var fv,hCe,gCe,_Ce,vCe,yCe=o((()=>{pCe(),dv(),rv(),fv=NaN,hCe=/^[-+]0x[0-9a-f]+$/i,gCe=/^0b[01]+$/i,_Ce=/^0o[0-7]+$/i,vCe=parseInt}));function pv(e){return e?(e=mCe(e),e===mv||e===-mv?(e<0?-1:1)*bCe:e===e?e:0):e===0?e:0}var mv,bCe,hv=o((()=>{yCe(),mv=1/0,bCe=17976931348623157e292}));function gv(e){var t=pv(e),n=t%1;return t===t?n?t-n:t:0}var _v=o((()=>{hv()}));function vv(e){return e}var yv=o((()=>{}));function bv(e){if(!uv(e))return!1;var t=Z_(e);return t==SCe||t==CCe||t==xCe||t==wCe}var xCe,SCe,CCe,wCe,xv=o((()=>{$_(),dv(),xCe=`[object AsyncFunction]`,SCe=`[object Function]`,CCe=`[object GeneratorFunction]`,wCe=`[object Proxy]`})),Sv,TCe=o((()=>{K_(),Sv=G_[`__core-js_shared__`]}));function ECe(e){return!!Cv&&Cv in e}var Cv,DCe=o((()=>{TCe(),Cv=function(){var e=/[^.]+$/.exec(Sv&&Sv.keys&&Sv.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}()}));function wv(e){if(e!=null){try{return OCe.call(e)}catch{}try{return e+``}catch{}}return``}var OCe,kCe=o((()=>{OCe=Function.prototype.toString}));function ACe(e){return!uv(e)||ECe(e)?!1:(bv(e)?LCe:MCe).test(wv(e))}var jCe,MCe,NCe,PCe,FCe,ICe,LCe,RCe=o((()=>{xv(),DCe(),dv(),kCe(),jCe=/[\\^$.*+?()[\]{}|]/g,MCe=/^\[object .+?Constructor\]$/,NCe=Function.prototype,PCe=Object.prototype,FCe=NCe.toString,ICe=PCe.hasOwnProperty,LCe=RegExp(`^`+FCe.call(ICe).replace(jCe,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`)}));function zCe(e,t){return e?.[t]}var BCe=o((()=>{}));function Tv(e,t){var n=zCe(e,t);return ACe(n)?n:void 0}var Ev=o((()=>{RCe(),BCe()})),Dv,VCe=o((()=>{Ev(),K_(),Dv=Tv(G_,`WeakMap`)})),Ov,HCe,UCe=o((()=>{dv(),Ov=Object.create,HCe=function(){function e(){}return function(t){if(!uv(t))return{};if(Ov)return Ov(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}()}));function WCe(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var GCe=o((()=>{}));function kv(){}var KCe=o((()=>{}));function qCe(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}var Av=o((()=>{}));function JCe(e){var t=0,n=0;return function(){var r=ZCe(),i=XCe-(r-n);if(n=r,i>0){if(++t>=YCe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var YCe,XCe,ZCe,QCe=o((()=>{YCe=800,XCe=16,ZCe=Date.now}));function jv(e){return function(){return e}}var $Ce=o((()=>{})),Mv,ewe=o((()=>{Ev(),Mv=function(){try{var e=Tv(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),twe,nwe=o((()=>{$Ce(),ewe(),yv(),twe=Mv?function(e,t){return Mv(e,`toString`,{configurable:!0,enumerable:!1,value:jv(t),writable:!0})}:vv})),Nv,Pv=o((()=>{nwe(),QCe(),Nv=JCe(twe)}));function rwe(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var Fv=o((()=>{}));function iwe(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}var Iv=o((()=>{}));function awe(e){return e!==e}var owe=o((()=>{}));function swe(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var cwe=o((()=>{}));function Lv(e,t,n){return t===t?swe(e,t,n):iwe(e,awe,n)}var Rv=o((()=>{Iv(),owe(),cwe()}));function lwe(e,t){return!!(e!=null&&e.length)&&Lv(e,t,0)>-1}var zv=o((()=>{Rv()}));function Bv(e,t){var n=typeof e;return t??=uwe,!!t&&(n==`number`||n!=`symbol`&&dwe.test(e))&&e>-1&&e%1==0&&e<t}var uwe,dwe,Vv=o((()=>{uwe=9007199254740991,dwe=/^(?:0|[1-9]\d*)$/}));function Hv(e,t,n){t==`__proto__`&&Mv?Mv(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Uv=o((()=>{ewe()}));function Wv(e,t){return e===t||e!==e&&t!==t}var Gv=o((()=>{}));function Kv(e,t,n){var r=e[t];(!(fwe.call(e,t)&&Wv(r,n))||n===void 0&&!(t in e))&&Hv(e,t,n)}var fwe,qv=o((()=>{Uv(),Gv(),fwe=Object.prototype.hasOwnProperty}));function Jv(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],l=r?r(n[s],e[s],s,n,e):void 0;l===void 0&&(l=e[s]),i?Hv(n,s,l):Kv(n,s,l)}return n}var Yv=o((()=>{qv(),Uv()}));function pwe(e,t,n){return t=Xv(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Xv(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),WCe(e,this,s)}}var Xv,mwe=o((()=>{GCe(),Xv=Math.max}));function Zv(e,t){return Nv(pwe(e,t,vv),e+``)}var Qv=o((()=>{yv(),mwe(),Pv()}));function hwe(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=gwe}var gwe,$v=o((()=>{gwe=9007199254740991}));function ey(e){return e!=null&&hwe(e.length)&&!bv(e)}var ty=o((()=>{xv(),$v()}));function ny(e,t,n){if(!uv(n))return!1;var r=typeof t;return(r==`number`?ey(n)&&Bv(t,n.length):r==`string`&&t in n)?Wv(n[t],e):!1}var ry=o((()=>{Gv(),ty(),Vv(),dv()}));function _we(e){return Zv(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&ny(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var iy=o((()=>{Qv(),ry()}));function ay(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||vwe)}var vwe,oy=o((()=>{vwe=Object.prototype}));function ywe(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var bwe=o((()=>{}));function xwe(e){return ev(e)&&Z_(e)==Swe}var Swe,Cwe=o((()=>{$_(),tv(),Swe=`[object Arguments]`})),sy,wwe,Twe,cy,ly=o((()=>{Cwe(),tv(),sy=Object.prototype,wwe=sy.hasOwnProperty,Twe=sy.propertyIsEnumerable,cy=xwe(function(){return arguments}())?xwe:function(e){return ev(e)&&wwe.call(e,`callee`)&&!Twe.call(e,`callee`)}}));function Ewe(){return!1}var Dwe=o((()=>{})),uy,dy,fy,py,my=o((()=>{K_(),Dwe(),uy=typeof exports==`object`&&exports&&!exports.nodeType&&exports,dy=uy&&typeof module==`object`&&module&&!module.nodeType&&module,fy=dy&&dy.exports===uy?G_.Buffer:void 0,py=(fy?fy.isBuffer:void 0)||Ewe}));function Owe(e){return ev(e)&&hwe(e.length)&&!!hy[Z_(e)]}var kwe,Awe,jwe,Mwe,Nwe,Pwe,Fwe,Iwe,Lwe,Rwe,zwe,Bwe,Vwe,Hwe,Uwe,Wwe,Gwe,Kwe,qwe,Jwe,Ywe,Xwe,Zwe,Qwe,hy,$we=o((()=>{$_(),$v(),tv(),kwe=`[object Arguments]`,Awe=`[object Array]`,jwe=`[object Boolean]`,Mwe=`[object Date]`,Nwe=`[object Error]`,Pwe=`[object Function]`,Fwe=`[object Map]`,Iwe=`[object Number]`,Lwe=`[object Object]`,Rwe=`[object RegExp]`,zwe=`[object Set]`,Bwe=`[object String]`,Vwe=`[object WeakMap]`,Hwe=`[object ArrayBuffer]`,Uwe=`[object DataView]`,Wwe=`[object Float32Array]`,Gwe=`[object Float64Array]`,Kwe=`[object Int8Array]`,qwe=`[object Int16Array]`,Jwe=`[object Int32Array]`,Ywe=`[object Uint8Array]`,Xwe=`[object Uint8ClampedArray]`,Zwe=`[object Uint16Array]`,Qwe=`[object Uint32Array]`,hy={},hy[Wwe]=hy[Gwe]=hy[Kwe]=hy[qwe]=hy[Jwe]=hy[Ywe]=hy[Xwe]=hy[Zwe]=hy[Qwe]=!0,hy[kwe]=hy[Awe]=hy[Hwe]=hy[jwe]=hy[Uwe]=hy[Mwe]=hy[Nwe]=hy[Pwe]=hy[Fwe]=hy[Iwe]=hy[Lwe]=hy[Rwe]=hy[zwe]=hy[Bwe]=hy[Vwe]=!1}));function gy(e){return function(t){return e(t)}}var _y=o((()=>{})),vy,yy,by,xy,Sy=o((()=>{qSe(),vy=typeof exports==`object`&&exports&&!exports.nodeType&&exports,yy=vy&&typeof module==`object`&&module&&!module.nodeType&&module,by=yy&&yy.exports===vy&&W_.process,xy=function(){try{return yy&&yy.require&&yy.require(`util`).types||by&&by.binding&&by.binding(`util`)}catch{}}()})),Cy,wy,Ty=o((()=>{$we(),_y(),Sy(),Cy=xy&&xy.isTypedArray,wy=Cy?gy(Cy):Owe}));function eTe(e,t){var n=ov(e),r=!n&&cy(e),i=!n&&!r&&py(e),a=!n&&!r&&!i&&wy(e),o=n||r||i||a,s=o?ywe(e.length,String):[],l=s.length;for(var u in e)(t||tTe.call(e,u))&&!(o&&(u==`length`||i&&(u==`offset`||u==`parent`)||a&&(u==`buffer`||u==`byteLength`||u==`byteOffset`)||Bv(u,l)))&&s.push(u);return s}var tTe,nTe=o((()=>{bwe(),ly(),sv(),my(),Vv(),Ty(),tTe=Object.prototype.hasOwnProperty}));function rTe(e,t){return function(n){return e(t(n))}}var iTe=o((()=>{})),aTe,oTe=o((()=>{iTe(),aTe=rTe(Object.keys,Object)}));function sTe(e){if(!ay(e))return aTe(e);var t=[];for(var n in Object(e))cTe.call(e,n)&&n!=`constructor`&&t.push(n);return t}var cTe,Ey=o((()=>{oy(),oTe(),cTe=Object.prototype.hasOwnProperty}));function Dy(e){return ey(e)?eTe(e):sTe(e)}var Oy=o((()=>{nTe(),Ey(),ty()})),lTe,ky,uTe=o((()=>{qv(),Yv(),iy(),ty(),oy(),Oy(),lTe=Object.prototype.hasOwnProperty,ky=_we(function(e,t){if(ay(t)||ey(t)){Jv(t,Dy(t),e);return}for(var n in t)lTe.call(t,n)&&Kv(e,n,t[n])})}));function dTe(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var fTe=o((()=>{}));function pTe(e){if(!uv(e))return dTe(e);var t=ay(e),n=[];for(var r in e)(r!=`constructor`||!t&&mTe.call(e,r))&&n.push(r);return n}var mTe,hTe=o((()=>{dv(),oy(),fTe(),mTe=Object.prototype.hasOwnProperty}));function Ay(e){return ey(e)?eTe(e,!0):pTe(e)}var jy=o((()=>{nTe(),hTe(),ty()}));function My(e,t){if(ov(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||nv(e)?!0:_Te.test(e)||!gTe.test(e)||t!=null&&e in Object(t)}var gTe,_Te,Ny=o((()=>{sv(),rv(),gTe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_Te=/^\w*$/})),Py,Fy=o((()=>{Ev(),Py=Tv(Object,`create`)}));function vTe(){this.__data__=Py?Py(null):{},this.size=0}var yTe=o((()=>{Fy()}));function bTe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var xTe=o((()=>{}));function STe(e){var t=this.__data__;if(Py){var n=t[e];return n===CTe?void 0:n}return wTe.call(t,e)?t[e]:void 0}var CTe,wTe,TTe=o((()=>{Fy(),CTe=`__lodash_hash_undefined__`,wTe=Object.prototype.hasOwnProperty}));function ETe(e){var t=this.__data__;return Py?t[e]!==void 0:DTe.call(t,e)}var DTe,OTe=o((()=>{Fy(),DTe=Object.prototype.hasOwnProperty}));function kTe(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=Py&&t===void 0?ATe:t,this}var ATe,jTe=o((()=>{Fy(),ATe=`__lodash_hash_undefined__`}));function Iy(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var MTe=o((()=>{yTe(),xTe(),TTe(),OTe(),jTe(),Iy.prototype.clear=vTe,Iy.prototype.delete=bTe,Iy.prototype.get=STe,Iy.prototype.has=ETe,Iy.prototype.set=kTe}));function NTe(){this.__data__=[],this.size=0}var PTe=o((()=>{}));function Ly(e,t){for(var n=e.length;n--;)if(Wv(e[n][0],t))return n;return-1}var Ry=o((()=>{Gv()}));function FTe(e){var t=this.__data__,n=Ly(t,e);return n<0?!1:(n==t.length-1?t.pop():ITe.call(t,n,1),--this.size,!0)}var ITe,LTe=o((()=>{Ry(),ITe=Array.prototype.splice}));function RTe(e){var t=this.__data__,n=Ly(t,e);return n<0?void 0:t[n][1]}var zTe=o((()=>{Ry()}));function BTe(e){return Ly(this.__data__,e)>-1}var VTe=o((()=>{Ry()}));function HTe(e,t){var n=this.__data__,r=Ly(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var UTe=o((()=>{Ry()}));function zy(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var By=o((()=>{PTe(),LTe(),zTe(),VTe(),UTe(),zy.prototype.clear=NTe,zy.prototype.delete=FTe,zy.prototype.get=RTe,zy.prototype.has=BTe,zy.prototype.set=HTe})),Vy,Hy=o((()=>{Ev(),K_(),Vy=Tv(G_,`Map`)}));function WTe(){this.size=0,this.__data__={hash:new Iy,map:new(Vy||zy),string:new Iy}}var GTe=o((()=>{MTe(),By(),Hy()}));function KTe(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}var qTe=o((()=>{}));function Uy(e,t){var n=e.__data__;return KTe(t)?n[typeof t==`string`?`string`:`hash`]:n.map}var Wy=o((()=>{qTe()}));function JTe(e){var t=Uy(this,e).delete(e);return this.size-=+!!t,t}var YTe=o((()=>{Wy()}));function XTe(e){return Uy(this,e).get(e)}var ZTe=o((()=>{Wy()}));function QTe(e){return Uy(this,e).has(e)}var $Te=o((()=>{Wy()}));function eEe(e,t){var n=Uy(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var tEe=o((()=>{Wy()}));function Gy(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var Ky=o((()=>{GTe(),YTe(),ZTe(),$Te(),tEe(),Gy.prototype.clear=WTe,Gy.prototype.delete=JTe,Gy.prototype.get=XTe,Gy.prototype.has=QTe,Gy.prototype.set=eEe}));function qy(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(nEe);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(qy.Cache||Gy),n}var nEe,rEe=o((()=>{Ky(),nEe=`Expected a function`,qy.Cache=Gy}));function iEe(e){var t=qy(e,function(e){return n.size===aEe&&n.clear(),e}),n=t.cache;return t}var aEe,oEe=o((()=>{rEe(),aEe=500})),sEe,cEe,lEe,uEe=o((()=>{oEe(),sEe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,cEe=/\\(\\)?/g,lEe=iEe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(sEe,function(e,n,r,i){t.push(r?i.replace(cEe,`$1`):n||e)}),t})}));function dEe(e){return e==null?``:aCe(e)}var Jy=o((()=>{sCe()}));function Yy(e,t){return ov(e)?e:My(e,t)?[e]:lEe(dEe(e))}var Xy=o((()=>{sv(),Ny(),uEe(),Jy()}));function Zy(e){if(typeof e==`string`||nv(e))return e;var t=e+``;return t==`0`&&1/e==-fEe?`-0`:t}var fEe,Qy=o((()=>{rv(),fEe=1/0}));function $y(e,t){t=Yy(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Zy(t[n++])];return n&&n==r?e:void 0}var eb=o((()=>{Xy(),Qy()}));function pEe(e,t,n){var r=e==null?void 0:$y(e,t);return r===void 0?n:r}var mEe=o((()=>{eb()}));function tb(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var nb=o((()=>{}));function hEe(e){return ov(e)||cy(e)||!!(rb&&e&&e[rb])}var rb,gEe=o((()=>{J_(),ly(),sv(),rb=q_?q_.isConcatSpreadable:void 0}));function ib(e,t,n,r,i){var a=-1,o=e.length;for(n||=hEe,i||=[];++a<o;){var s=e[a];t>0&&n(s)?t>1?ib(s,t-1,n,r,i):tb(i,s):r||(i[i.length]=s)}return i}var ab=o((()=>{nb(),gEe()}));function ob(e){return e!=null&&e.length?ib(e,1):[]}var _Ee=o((()=>{ab()}));function vEe(e){return Nv(pwe(e,void 0,ob),e+``)}var yEe=o((()=>{_Ee(),mwe(),Pv()})),sb,cb=o((()=>{iTe(),sb=rTe(Object.getPrototypeOf,Object)}));function bEe(e){if(!ev(e)||Z_(e)!=xEe)return!1;var t=sb(e);if(t===null)return!0;var n=wEe.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&lb.call(n)==TEe}var xEe,SEe,CEe,lb,wEe,TEe,EEe=o((()=>{$_(),cb(),tv(),xEe=`[object Object]`,SEe=Function.prototype,CEe=Object.prototype,lb=SEe.toString,wEe=CEe.hasOwnProperty,TEe=lb.call(Object)}));function DEe(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}var ub=o((()=>{})),OEe=o((()=>{}));function kEe(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}var AEe=o((()=>{}));function jEe(){this.__data__=new zy,this.size=0}var MEe=o((()=>{By()}));function NEe(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var PEe=o((()=>{}));function FEe(e){return this.__data__.get(e)}var IEe=o((()=>{}));function LEe(e){return this.__data__.has(e)}var REe=o((()=>{}));function zEe(e,t){var n=this.__data__;if(n instanceof zy){var r=n.__data__;if(!Vy||r.length<BEe-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Gy(r)}return n.set(e,t),this.size=n.size,this}var BEe,VEe=o((()=>{By(),Hy(),Ky(),BEe=200}));function db(e){var t=this.__data__=new zy(e);this.size=t.size}var fb=o((()=>{By(),MEe(),PEe(),IEe(),REe(),VEe(),db.prototype.clear=jEe,db.prototype.delete=NEe,db.prototype.get=FEe,db.prototype.has=LEe,db.prototype.set=zEe}));function HEe(e,t){return e&&Jv(t,Dy(t),e)}var UEe=o((()=>{Yv(),Oy()}));function WEe(e,t){return e&&Jv(t,Ay(t),e)}var GEe=o((()=>{Yv(),jy()}));function KEe(e,t){if(t)return e.slice();var n=e.length,r=gb?gb(n):new e.constructor(n);return e.copy(r),r}var pb,mb,hb,gb,qEe=o((()=>{K_(),pb=typeof exports==`object`&&exports&&!exports.nodeType&&exports,mb=pb&&typeof module==`object`&&module&&!module.nodeType&&module,hb=mb&&mb.exports===pb?G_.Buffer:void 0,gb=hb?hb.allocUnsafe:void 0}));function _b(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}var vb=o((()=>{}));function JEe(){return[]}var yb=o((()=>{})),YEe,bb,xb,Sb=o((()=>{vb(),yb(),YEe=Object.prototype.propertyIsEnumerable,bb=Object.getOwnPropertySymbols,xb=bb?function(e){return e==null?[]:(e=Object(e),_b(bb(e),function(t){return YEe.call(e,t)}))}:JEe}));function XEe(e,t){return Jv(e,xb(e),t)}var ZEe=o((()=>{Yv(),Sb()})),Cb,QEe=o((()=>{nb(),cb(),Sb(),yb(),Cb=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)tb(t,xb(e)),e=sb(e);return t}:JEe}));function $Ee(e,t){return Jv(e,Cb(e),t)}var eDe=o((()=>{Yv(),QEe()}));function tDe(e,t,n){var r=t(e);return ov(e)?r:tb(r,n(e))}var nDe=o((()=>{nb(),sv()}));function wb(e){return tDe(e,Dy,xb)}var rDe=o((()=>{nDe(),Sb(),Oy()}));function iDe(e){return tDe(e,Ay,Cb)}var Tb=o((()=>{nDe(),QEe(),jy()})),Eb,aDe=o((()=>{Ev(),K_(),Eb=Tv(G_,`DataView`)})),Db,oDe=o((()=>{Ev(),K_(),Db=Tv(G_,`Promise`)})),Ob,sDe=o((()=>{Ev(),K_(),Ob=Tv(G_,`Set`)})),kb,cDe,Ab,jb,Mb,Nb,lDe,uDe,dDe,fDe,pDe,Pb,Fb,Ib=o((()=>{aDe(),Hy(),oDe(),sDe(),VCe(),$_(),kCe(),kb=`[object Map]`,cDe=`[object Object]`,Ab=`[object Promise]`,jb=`[object Set]`,Mb=`[object WeakMap]`,Nb=`[object DataView]`,lDe=wv(Eb),uDe=wv(Vy),dDe=wv(Db),fDe=wv(Ob),pDe=wv(Dv),Pb=Z_,(Eb&&Pb(new Eb(new ArrayBuffer(1)))!=Nb||Vy&&Pb(new Vy)!=kb||Db&&Pb(Db.resolve())!=Ab||Ob&&Pb(new Ob)!=jb||Dv&&Pb(new Dv)!=Mb)&&(Pb=function(e){var t=Z_(e),n=t==cDe?e.constructor:void 0,r=n?wv(n):``;if(r)switch(r){case lDe:return Nb;case uDe:return kb;case dDe:return Ab;case fDe:return jb;case pDe:return Mb}return t}),Fb=Pb}));function mDe(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&hDe.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}var hDe,gDe=o((()=>{hDe=Object.prototype.hasOwnProperty})),Lb,_De=o((()=>{K_(),Lb=G_.Uint8Array}));function Rb(e){var t=new e.constructor(e.byteLength);return new Lb(t).set(new Lb(e)),t}var zb=o((()=>{_De()}));function vDe(e,t){var n=t?Rb(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var yDe=o((()=>{zb()}));function bDe(e){var t=new e.constructor(e.source,xDe.exec(e));return t.lastIndex=e.lastIndex,t}var xDe,SDe=o((()=>{xDe=/\w*$/}));function CDe(e){return Vb?Object(Vb.call(e)):{}}var Bb,Vb,wDe=o((()=>{J_(),Bb=q_?q_.prototype:void 0,Vb=Bb?Bb.valueOf:void 0}));function TDe(e,t){var n=t?Rb(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var EDe=o((()=>{zb()}));function DDe(e,t,n){var r=e.constructor;switch(t){case IDe:return Rb(e);case ODe:case kDe:return new r(+e);case LDe:return vDe(e,n);case RDe:case zDe:case BDe:case VDe:case HDe:case UDe:case WDe:case GDe:case KDe:return TDe(e,n);case ADe:return new r;case jDe:case PDe:return new r(e);case MDe:return bDe(e);case NDe:return new r;case FDe:return CDe(e)}}var ODe,kDe,ADe,jDe,MDe,NDe,PDe,FDe,IDe,LDe,RDe,zDe,BDe,VDe,HDe,UDe,WDe,GDe,KDe,qDe=o((()=>{zb(),yDe(),SDe(),wDe(),EDe(),ODe=`[object Boolean]`,kDe=`[object Date]`,ADe=`[object Map]`,jDe=`[object Number]`,MDe=`[object RegExp]`,NDe=`[object Set]`,PDe=`[object String]`,FDe=`[object Symbol]`,IDe=`[object ArrayBuffer]`,LDe=`[object DataView]`,RDe=`[object Float32Array]`,zDe=`[object Float64Array]`,BDe=`[object Int8Array]`,VDe=`[object Int16Array]`,HDe=`[object Int32Array]`,UDe=`[object Uint8Array]`,WDe=`[object Uint8ClampedArray]`,GDe=`[object Uint16Array]`,KDe=`[object Uint32Array]`}));function JDe(e){return typeof e.constructor==`function`&&!ay(e)?HCe(sb(e)):{}}var YDe=o((()=>{UCe(),cb(),oy()}));function XDe(e){return ev(e)&&Fb(e)==ZDe}var ZDe,QDe=o((()=>{Ib(),tv(),ZDe=`[object Map]`})),Hb,$De,eOe=o((()=>{QDe(),_y(),Sy(),Hb=xy&&xy.isMap,$De=Hb?gy(Hb):XDe}));function tOe(e){return ev(e)&&Fb(e)==nOe}var nOe,rOe=o((()=>{Ib(),tv(),nOe=`[object Set]`})),Ub,iOe,aOe=o((()=>{rOe(),_y(),Sy(),Ub=xy&&xy.isSet,iOe=Ub?gy(Ub):tOe}));function Wb(e,t,n,r,i,a){var o,s=t&oOe,l=t&sOe,u=t&cOe;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!uv(e))return e;var d=ov(e);if(d){if(o=mDe(e),!s)return qCe(e,o)}else{var f=Fb(e),p=f==Kb||f==pOe;if(py(e))return KEe(e,s);if(f==qb||f==Gb||p&&!i){if(o=l||p?{}:JDe(e),!s)return l?$Ee(e,WEe(o,e)):XEe(e,HEe(o,e))}else{if(!Jb[f])return i?e:{};o=DDe(e,f,s)}}a||=new db;var m=a.get(e);if(m)return m;a.set(e,o),iOe(e)?e.forEach(function(r){o.add(Wb(r,t,n,r,e,a))}):$De(e)&&e.forEach(function(r,i){o.set(i,Wb(r,t,n,i,e,a))});var h=d?void 0:(u?l?iDe:wb:l?Ay:Dy)(e);return rwe(h||e,function(r,i){h&&(i=r,r=e[i]),Kv(o,i,Wb(r,t,n,i,e,a))}),o}var oOe,sOe,cOe,Gb,lOe,uOe,dOe,fOe,Kb,pOe,mOe,hOe,qb,gOe,_Oe,vOe,yOe,bOe,xOe,SOe,COe,wOe,TOe,EOe,DOe,OOe,kOe,AOe,jOe,Jb,Yb=o((()=>{fb(),Fv(),qv(),UEe(),GEe(),qEe(),Av(),ZEe(),eDe(),rDe(),Tb(),Ib(),gDe(),qDe(),YDe(),sv(),my(),eOe(),dv(),aOe(),Oy(),jy(),oOe=1,sOe=2,cOe=4,Gb=`[object Arguments]`,lOe=`[object Array]`,uOe=`[object Boolean]`,dOe=`[object Date]`,fOe=`[object Error]`,Kb=`[object Function]`,pOe=`[object GeneratorFunction]`,mOe=`[object Map]`,hOe=`[object Number]`,qb=`[object Object]`,gOe=`[object RegExp]`,_Oe=`[object Set]`,vOe=`[object String]`,yOe=`[object Symbol]`,bOe=`[object WeakMap]`,xOe=`[object ArrayBuffer]`,SOe=`[object DataView]`,COe=`[object Float32Array]`,wOe=`[object Float64Array]`,TOe=`[object Int8Array]`,EOe=`[object Int16Array]`,DOe=`[object Int32Array]`,OOe=`[object Uint8Array]`,kOe=`[object Uint8ClampedArray]`,AOe=`[object Uint16Array]`,jOe=`[object Uint32Array]`,Jb={},Jb[Gb]=Jb[lOe]=Jb[xOe]=Jb[SOe]=Jb[uOe]=Jb[dOe]=Jb[COe]=Jb[wOe]=Jb[TOe]=Jb[EOe]=Jb[DOe]=Jb[mOe]=Jb[hOe]=Jb[qb]=Jb[gOe]=Jb[_Oe]=Jb[vOe]=Jb[yOe]=Jb[OOe]=Jb[kOe]=Jb[AOe]=Jb[jOe]=!0,Jb[fOe]=Jb[Kb]=Jb[bOe]=!1}));function Xb(e){return Wb(e,MOe)}var MOe,NOe=o((()=>{Yb(),MOe=4}));function POe(e){return Wb(e,FOe|IOe)}var FOe,IOe,LOe=o((()=>{Yb(),FOe=1,IOe=4}));function Zb(e){for(var t=-1,n=e==null?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i}var ROe=o((()=>{}));function zOe(e){return this.__data__.set(e,BOe),this}var BOe,VOe=o((()=>{BOe=`__lodash_hash_undefined__`}));function HOe(e){return this.__data__.has(e)}var UOe=o((()=>{}));function Qb(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Gy;++t<n;)this.add(e[t])}var $b=o((()=>{Ky(),VOe(),UOe(),Qb.prototype.add=Qb.prototype.push=zOe,Qb.prototype.has=HOe}));function WOe(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var ex=o((()=>{}));function tx(e,t){return e.has(t)}var nx=o((()=>{}));function GOe(e,t,n,r,i,a){var o=n&KOe,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var u=a.get(e),d=a.get(t);if(u&&d)return u==t&&d==e;var f=-1,p=!0,m=n&qOe?new Qb:void 0;for(a.set(e,t),a.set(t,e);++f<s;){var h=e[f],g=t[f];if(r)var _=o?r(g,h,f,t,e,a):r(h,g,f,e,t,a);if(_!==void 0){if(_)continue;p=!1;break}if(m){if(!WOe(t,function(e,t){if(!tx(m,t)&&(h===e||i(h,e,n,r,a)))return m.push(t)})){p=!1;break}}else if(!(h===g||i(h,g,n,r,a))){p=!1;break}}return a.delete(e),a.delete(t),p}var KOe,qOe,JOe=o((()=>{$b(),ex(),nx(),KOe=1,qOe=2}));function YOe(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}var XOe=o((()=>{}));function rx(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var ix=o((()=>{}));function ZOe(e,t,n,r,i,a,o){switch(n){case uke:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case lke:return!(e.byteLength!=t.byteLength||!a(new Lb(e),new Lb(t)));case eke:case tke:case ike:return Wv(+e,+t);case nke:return e.name==t.name&&e.message==t.message;case ake:case ske:return e==t+``;case rke:var s=YOe;case oke:var l=r&QOe;if(s||=rx,e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;r|=$Oe,o.set(e,t);var d=GOe(s(e),s(t),r,i,a,o);return o.delete(e),d;case cke:if(ox)return ox.call(e)==ox.call(t)}return!1}var QOe,$Oe,eke,tke,nke,rke,ike,ake,oke,ske,cke,lke,uke,ax,ox,dke=o((()=>{J_(),_De(),Gv(),JOe(),XOe(),ix(),QOe=1,$Oe=2,eke=`[object Boolean]`,tke=`[object Date]`,nke=`[object Error]`,rke=`[object Map]`,ike=`[object Number]`,ake=`[object RegExp]`,oke=`[object Set]`,ske=`[object String]`,cke=`[object Symbol]`,lke=`[object ArrayBuffer]`,uke=`[object DataView]`,ax=q_?q_.prototype:void 0,ox=ax?ax.valueOf:void 0}));function fke(e,t,n,r,i,a){var o=n&pke,s=wb(e),l=s.length;if(l!=wb(t).length&&!o)return!1;for(var u=l;u--;){var d=s[u];if(!(o?d in t:mke.call(t,d)))return!1}var f=a.get(e),p=a.get(t);if(f&&p)return f==t&&p==e;var m=!0;a.set(e,t),a.set(t,e);for(var h=o;++u<l;){d=s[u];var g=e[d],_=t[d];if(r)var v=o?r(_,g,d,t,e,a):r(g,_,d,e,t,a);if(!(v===void 0?g===_||i(g,_,n,r,a):v)){m=!1;break}h||=d==`constructor`}if(m&&!h){var y=e.constructor,b=t.constructor;y!=b&&`constructor`in e&&`constructor`in t&&!(typeof y==`function`&&y instanceof y&&typeof b==`function`&&b instanceof b)&&(m=!1)}return a.delete(e),a.delete(t),m}var pke,mke,hke=o((()=>{rDe(),pke=1,mke=Object.prototype.hasOwnProperty}));function gke(e,t,n,r,i,a){var o=ov(e),s=ov(t),l=o?cx:Fb(e),u=s?cx:Fb(t);l=l==sx?lx:l,u=u==sx?lx:u;var d=l==lx,f=u==lx,p=l==u;if(p&&py(e)){if(!py(t))return!1;o=!0,d=!1}if(p&&!d)return a||=new db,o||wy(e)?GOe(e,t,n,r,i,a):ZOe(e,t,l,n,r,i,a);if(!(n&_ke)){var m=d&&ux.call(e,`__wrapped__`),h=f&&ux.call(t,`__wrapped__`);if(m||h){var g=m?e.value():e,_=h?t.value():t;return a||=new db,i(g,_,n,r,a)}}return p?(a||=new db,fke(e,t,n,r,i,a)):!1}var _ke,sx,cx,lx,ux,vke=o((()=>{fb(),JOe(),dke(),hke(),Ib(),sv(),my(),Ty(),_ke=1,sx=`[object Arguments]`,cx=`[object Array]`,lx=`[object Object]`,ux=Object.prototype.hasOwnProperty}));function dx(e,t,n,r,i){return e===t?!0:e==null||t==null||!ev(e)&&!ev(t)?e!==e&&t!==t:gke(e,t,n,r,dx,i)}var yke=o((()=>{vke(),tv()}));function bke(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=n[i];var l=s[0],u=e[l],d=s[1];if(o&&s[2]){if(u===void 0&&!(l in e))return!1}else{var f=new db;if(r)var p=r(u,d,l,e,t,f);if(!(p===void 0?dx(d,u,xke|Ske,r,f):p))return!1}}return!0}var xke,Ske,Cke=o((()=>{fb(),yke(),xke=1,Ske=2}));function wke(e){return e===e&&!uv(e)}var Tke=o((()=>{dv()}));function Eke(e){for(var t=Dy(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,wke(i)]}return t}var Dke=o((()=>{Tke(),Oy()}));function Oke(e,t){return function(n){return n!=null&&n[e]===t&&(t!==void 0||e in Object(n))}}var kke=o((()=>{}));function Ake(e){var t=Eke(e);return t.length==1&&t[0][2]?Oke(t[0][0],t[0][1]):function(n){return n===e||bke(n,e,t)}}var jke=o((()=>{Cke(),Dke(),kke()}));function Mke(e,t){return e!=null&&t in Object(e)}var Nke=o((()=>{}));function Pke(e,t,n){t=Yy(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=Zy(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&hwe(i)&&Bv(o,i)&&(ov(e)||cy(e)))}var Fke=o((()=>{Xy(),ly(),sv(),Vv(),$v(),Qy()}));function Ike(e,t){return e!=null&&Pke(e,t,Mke)}var Lke=o((()=>{Nke(),Fke()}));function Rke(e,t){return My(e)&&wke(t)?Oke(Zy(e),t):function(n){var r=pEe(n,e);return r===void 0&&r===t?Ike(n,e):dx(t,r,zke|Bke)}}var zke,Bke,Vke=o((()=>{yke(),mEe(),Lke(),Ny(),Tke(),kke(),Qy(),zke=1,Bke=2}));function Hke(e){return function(t){return t?.[e]}}var Uke=o((()=>{}));function Wke(e){return function(t){return $y(t,e)}}var Gke=o((()=>{eb()}));function Kke(e){return My(e)?Hke(Zy(e)):Wke(e)}var qke=o((()=>{Uke(),Gke(),Ny(),Qy()}));function fx(e){return typeof e==`function`?e:e==null?vv:typeof e==`object`?ov(e)?Rke(e[0],e[1]):Ake(e):Kke(e)}var px=o((()=>{jke(),Vke(),yv(),sv(),qke()}));function Jke(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var Yke=o((()=>{}));function Xke(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var l=o[e?s:++i];if(n(a[l],l,a)===!1)break}return t}}var Zke=o((()=>{})),mx,Qke=o((()=>{Zke(),mx=Xke()}));function $ke(e,t){return e&&mx(e,t,Dy)}var hx=o((()=>{Qke(),Oy()}));function eAe(e,t){return function(n,r){if(n==null)return n;if(!ey(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var tAe=o((()=>{ty()})),gx,_x=o((()=>{hx(),tAe(),gx=eAe($ke)}));function nAe(e,t,n,r){return gx(e,function(e,i,a){t(r,e,n(e),a)}),r}var rAe=o((()=>{_x()}));function iAe(e,t){return function(n,r){var i=ov(n)?Jke:nAe,a=t?t():{};return i(n,e,fx(r,2),a)}}var aAe=o((()=>{Yke(),rAe(),px(),sv()})),vx,oAe=o((()=>{K_(),vx=function(){return G_.Date.now()}})),yx,sAe,bx,cAe=o((()=>{Qv(),Gv(),ry(),jy(),yx=Object.prototype,sAe=yx.hasOwnProperty,bx=Zv(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&ny(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=Ay(a),s=-1,l=o.length;++s<l;){var u=o[s],d=e[u];(d===void 0||Wv(d,yx[u])&&!sAe.call(e,u))&&(e[u]=a[u])}return e})}));function xx(e,t,n){(n!==void 0&&!Wv(e[t],n)||n===void 0&&!(t in e))&&Hv(e,t,n)}var lAe=o((()=>{Uv(),Gv()}));function Sx(e){return ev(e)&&ey(e)}var Cx=o((()=>{ty(),tv()}));function wx(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}var uAe=o((()=>{}));function dAe(e){return Jv(e,Ay(e))}var fAe=o((()=>{Yv(),jy()}));function pAe(e,t,n,r,i,a,o){var s=wx(e,n),l=wx(t,n),u=o.get(l);if(u){xx(e,n,u);return}var d=a?a(s,l,n+``,e,t,o):void 0,f=d===void 0;if(f){var p=ov(l),m=!p&&py(l),h=!p&&!m&&wy(l);d=l,p||m||h?ov(s)?d=s:Sx(s)?d=qCe(s):m?(f=!1,d=KEe(l,!0)):h?(f=!1,d=TDe(l,!0)):d=[]:bEe(l)||cy(l)?(d=s,cy(s)?d=dAe(s):(!uv(s)||bv(s))&&(d=JDe(l))):f=!1}f&&(o.set(l,d),i(d,l,r,a,o),o.delete(l)),xx(e,n,d)}var mAe=o((()=>{lAe(),qEe(),EDe(),Av(),YDe(),ly(),sv(),Cx(),my(),xv(),dv(),EEe(),Ty(),uAe(),fAe()}));function hAe(e,t,n,r,i){e!==t&&mx(t,function(a,o){if(i||=new db,uv(a))pAe(e,t,o,n,hAe,r,i);else{var s=r?r(wx(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),xx(e,o,s)}},Ay)}var gAe=o((()=>{fb(),lAe(),Qke(),mAe(),dv(),jy(),uAe()}));function _Ae(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var Tx=o((()=>{}));function vAe(e,t,n,r){var i=-1,a=lwe,o=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=iv(t,gy(n))),r?(a=_Ae,o=!1):t.length>=yAe&&(a=tx,o=!1,t=new Qb(t));outer:for(;++i<s;){var d=e[i],f=n==null?d:n(d);if(d=r||d!==0?d:0,o&&f===f){for(var p=u;p--;)if(t[p]===f)continue outer;l.push(d)}else a(t,f,r)||l.push(d)}return l}var yAe,bAe=o((()=>{$b(),zv(),Tx(),av(),_y(),nx(),yAe=200})),Ex,xAe=o((()=>{bAe(),ab(),Qv(),Cx(),Ex=Zv(function(e,t){return Sx(e)?vAe(e,ib(t,1,Sx,!0)):[]})}));function Dx(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var SAe=o((()=>{}));function Ox(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===void 0?1:gv(t),DEe(e,t<0?0:t,r)):[]}var CAe=o((()=>{ub(),_v()}));function kx(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===void 0?1:gv(t),t=r-t,DEe(e,0,t<0?0:t)):[]}var wAe=o((()=>{ub(),_v()}));function Ax(e){return typeof e==`function`?e:vv}var jx=o((()=>{yv()}));function Mx(e,t){return(ov(e)?rwe:gx)(e,Ax(t))}var TAe=o((()=>{Fv(),_x(),jx(),sv()})),EAe=o((()=>{TAe()}));function DAe(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}var OAe=o((()=>{}));function kAe(e,t){var n=!0;return gx(e,function(e,r,i){return n=!!t(e,r,i),n}),n}var AAe=o((()=>{_x()}));function Nx(e,t,n){var r=ov(e)?DAe:kAe;return n&&ny(e,t,n)&&(t=void 0),r(e,fx(t,3))}var jAe=o((()=>{OAe(),AAe(),px(),sv(),ry()}));function MAe(e,t){var n=[];return gx(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}var NAe=o((()=>{_x()}));function Px(e,t){return(ov(e)?_b:MAe)(e,fx(t,3))}var PAe=o((()=>{vb(),NAe(),px(),sv()}));function FAe(e){return function(t,n,r){var i=Object(t);if(!ey(t)){var a=fx(n,3);t=Dy(t),n=function(e){return a(i[e],e,i)}}var o=e(t,n,r);return o>-1?i[a?t[o]:o]:void 0}}var IAe=o((()=>{px(),ty(),Oy()}));function LAe(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:gv(n);return i<0&&(i=RAe(r+i,0)),iwe(e,fx(t,3),i)}var RAe,zAe=o((()=>{Iv(),px(),_v(),RAe=Math.max})),Fx,BAe=o((()=>{IAe(),zAe(),Fx=FAe(LAe)}));function Ix(e){return e&&e.length?e[0]:void 0}var VAe=o((()=>{})),HAe=o((()=>{VAe()}));function UAe(e,t){var n=-1,r=ey(e)?Array(e.length):[];return gx(e,function(e,i,a){r[++n]=t(e,i,a)}),r}var WAe=o((()=>{_x(),ty()}));function Lx(e,t){return(ov(e)?iv:UAe)(e,fx(t,3))}var GAe=o((()=>{av(),px(),WAe(),sv()}));function Rx(e,t){return ib(Lx(e,t),1)}var KAe=o((()=>{ab(),GAe()}));function qAe(e,t){return e==null?e:mx(e,Ax(t),Ay)}var JAe=o((()=>{Qke(),jx(),jy()}));function YAe(e,t){return e&&$ke(e,Ax(t))}var XAe=o((()=>{hx(),jx()})),ZAe,QAe,$Ae=o((()=>{Uv(),aAe(),ZAe=Object.prototype.hasOwnProperty,QAe=iAe(function(e,t,n){ZAe.call(e,n)?e[n].push(t):Hv(e,n,[t])})}));function eje(e,t){return e>t}var tje=o((()=>{}));function nje(e,t){return e!=null&&rje.call(e,t)}var rje,ije=o((()=>{rje=Object.prototype.hasOwnProperty}));function zx(e,t){return e!=null&&Pke(e,t,nje)}var aje=o((()=>{ije(),Fke()}));function Bx(e){return typeof e==`string`||!ov(e)&&ev(e)&&Z_(e)==oje}var oje,Vx=o((()=>{$_(),sv(),tv(),oje=`[object String]`}));function sje(e,t){return iv(t,function(t){return e[t]})}var cje=o((()=>{av()}));function Hx(e){return e==null?[]:sje(e,Dy(e))}var lje=o((()=>{cje(),Oy()}));function Ux(e,t,n,r){e=ey(e)?e:Hx(e),n=n&&!r?gv(n):0;var i=e.length;return n<0&&(n=uje(i+n,0)),Bx(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Lv(e,t,n)>-1}var uje,dje=o((()=>{Rv(),ty(),Vx(),_v(),lje(),uje=Math.max}));function fje(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:gv(n);return i<0&&(i=pje(r+i,0)),Lv(e,t,i)}var pje,mje=o((()=>{Rv(),_v(),pje=Math.max}));function Wx(e){if(e==null)return!0;if(ey(e)&&(ov(e)||typeof e==`string`||typeof e.splice==`function`||py(e)||wy(e)||cy(e)))return!e.length;var t=Fb(e);if(t==hje||t==gje)return!e.size;if(ay(e))return!sTe(e).length;for(var n in e)if(_je.call(e,n))return!1;return!0}var hje,gje,_je,vje=o((()=>{Ey(),Ib(),ly(),sv(),ty(),my(),oy(),Ty(),hje=`[object Map]`,gje=`[object Set]`,_je=Object.prototype.hasOwnProperty}));function yje(e){return ev(e)&&Z_(e)==bje}var bje,xje=o((()=>{$_(),tv(),bje=`[object RegExp]`})),Gx,Kx,Sje=o((()=>{xje(),_y(),Sy(),Gx=xy&&xy.isRegExp,Kx=Gx?gy(Gx):yje}));function qx(e){return e===void 0}var Cje=o((()=>{}));function wje(e,t){return e<t}var Jx=o((()=>{}));function Yx(e,t){var n={};return t=fx(t,3),$ke(e,function(e,r,i){Hv(n,r,t(e,r,i))}),n}var Tje=o((()=>{Uv(),hx(),px()}));function Xx(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],o=t(a);if(o!=null&&(s===void 0?o===o&&!nv(o):n(o,s)))var s=o,l=a}return l}var Zx=o((()=>{rv()}));function Qx(e){return e&&e.length?Xx(e,vv,eje):void 0}var Eje=o((()=>{Zx(),tje(),yv()})),$x,Dje=o((()=>{gAe(),iy(),$x=_we(function(e,t,n){hAe(e,t,n)})}));function eS(e){return e&&e.length?Xx(e,vv,wje):void 0}var Oje=o((()=>{Zx(),Jx(),yv()}));function tS(e,t){return e&&e.length?Xx(e,fx(t,2),wje):void 0}var kje=o((()=>{Zx(),px(),Jx()}));function Aje(e){if(typeof e!=`function`)throw TypeError(jje);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var jje,Mje=o((()=>{jje=`Expected a function`}));function Nje(e,t,n,r){if(!uv(e))return e;t=Yy(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var l=Zy(t[i]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(i!=o){var d=s[l];u=r?r(d,l,s):void 0,u===void 0&&(u=uv(d)?d:Bv(t[i+1])?[]:{})}Kv(s,l,u),s=s[l]}return e}var Pje=o((()=>{qv(),Xy(),Vv(),dv(),Qy()}));function Fje(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=$y(e,o);n(s,o)&&Nje(a,Yy(o,e),s)}return a}var Ije=o((()=>{eb(),Pje(),Xy()}));function nS(e,t){if(e==null)return{};var n=iv(iDe(e),function(e){return[e]});return t=fx(t),Fje(e,n,function(e,n){return t(e,n[0])})}var Lje=o((()=>{av(),px(),Ije(),Tb()}));function Rje(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}var zje=o((()=>{}));function Bje(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=nv(e),o=t!==void 0,s=t===null,l=t===t,u=nv(t);if(!s&&!u&&!a&&e>t||a&&o&&l&&!s&&!u||r&&o&&l||!n&&l||!i)return 1;if(!r&&!a&&!u&&e<t||u&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!l)return-1}return 0}var Vje=o((()=>{rv()}));function Hje(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var l=Bje(i[r],a[r]);if(l)return r>=s?l:l*(n[r]==`desc`?-1:1)}return e.index-t.index}var Uje=o((()=>{Vje()}));function Wje(e,t,n){t=t.length?iv(t,function(e){return ov(e)?function(t){return $y(t,e.length===1?e[0]:e)}:e}):[vv];var r=-1;return t=iv(t,gy(fx)),Rje(UAe(e,function(e,n,i){return{criteria:iv(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return Hje(e,t,n)})}var Gje=o((()=>{av(),eb(),px(),WAe(),zje(),_y(),Uje(),yv(),sv()})),Kje=o((()=>{Uke()})),rS,qje,Jje,Yje,iS,aS,Xje,oS,sS,cS,Zje,lS,uS,Qje,$je,eMe,tMe=o((()=>{rS=`\\ud800-\\udfff`,qje=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Jje=`\\ufe0e\\ufe0f`,Yje=`[`+rS+`]`,iS=`[`+qje+`]`,aS=`\\ud83c[\\udffb-\\udfff]`,Xje=`(?:`+iS+`|`+aS+`)`,oS=`[^`+rS+`]`,sS=`(?:\\ud83c[\\udde6-\\uddff]){2}`,cS=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Zje=`\\u200d`,lS=Xje+`?`,uS=`[`+Jje+`]?`,Qje=`(?:`+Zje+`(?:`+[oS,sS,cS].join(`|`)+`)`+uS+lS+`)*`,$je=uS+lS+Qje,eMe=`(?:`+[oS+iS+`?`,iS,sS,cS,Yje].join(`|`)+`)`,RegExp(aS+`(?=`+aS+`)|`+eMe+$je,`g`)})),nMe=o((()=>{Kje(),OEe(),tMe()}));function rMe(e,t){return Fje(e,t,function(t,n){return Ike(e,n)})}var iMe=o((()=>{Ije(),Lke()})),dS,aMe=o((()=>{iMe(),yEe(),dS=vEe(function(e,t){return e==null?{}:rMe(e,t)})}));function oMe(e,t,n,r){for(var i=-1,a=cMe(sMe((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}var sMe,cMe,lMe=o((()=>{sMe=Math.ceil,cMe=Math.max}));function uMe(e){return function(t,n,r){return r&&typeof r!=`number`&&ny(t,n,r)&&(n=r=void 0),t=pv(t),n===void 0?(n=t,t=0):n=pv(n),r=r===void 0?t<n?1:-1:pv(r),oMe(t,n,r,e)}}var dMe=o((()=>{lMe(),ry(),hv()})),fS,fMe=o((()=>{dMe(),fS=uMe()}));function pMe(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}var mMe=o((()=>{}));function pS(e,t,n){var r=ov(e)?kEe:pMe,i=arguments.length<3;return r(e,fx(t,4),n,i,gx)}var hMe=o((()=>{AEe(),_x(),px(),mMe(),sv()}));function mS(e,t){return(ov(e)?_b:MAe)(e,Aje(fx(t,3)))}var gMe=o((()=>{vb(),NAe(),px(),sv(),Mje()})),_Me=o((()=>{Ey(),Ib(),ty(),Vx(),nMe()}));function vMe(e,t){var n;return gx(e,function(e,r,i){return n=t(e,r,i),!n}),!!n}var yMe=o((()=>{_x()}));function bMe(e,t,n){var r=ov(e)?WOe:vMe;return n&&ny(e,t,n)&&(t=void 0),r(e,fx(t,3))}var xMe=o((()=>{ex(),px(),yMe(),sv(),ry()})),hS,SMe=o((()=>{ab(),Gje(),Qv(),ry(),hS=Zv(function(e,t){if(e==null)return[];var n=t.length;return n>1&&ny(e,t[0],t[1])?t=[]:n>2&&ny(t[0],t[1],t[2])&&(t=[t[0]]),Wje(e,ib(t,1),[])})})),CMe,wMe=o((()=>{sDe(),KCe(),ix(),CMe=Ob&&1/rx(new Ob([,-0]))[1]==1/0?function(e){return new Ob(e)}:kv}));function TMe(e,t,n){var r=-1,i=lwe,a=e.length,o=!0,s=[],l=s;if(n)o=!1,i=_Ae;else if(a>=EMe){var u=t?null:CMe(e);if(u)return rx(u);o=!1,i=tx,l=new Qb}else l=t?[]:s;outer:for(;++r<a;){var d=e[r],f=t?t(d):d;if(d=n||d!==0?d:0,o&&f===f){for(var p=l.length;p--;)if(l[p]===f)continue outer;t&&l.push(f),s.push(d)}else i(l,f,n)||(l!==s&&l.push(f),s.push(d))}return s}var EMe,gS=o((()=>{$b(),zv(),Tx(),nx(),wMe(),ix(),EMe=200})),DMe,OMe=o((()=>{ab(),Qv(),gS(),Cx(),DMe=Zv(function(e){return TMe(ib(e,1,Sx,!0))})}));function _S(e){return e&&e.length?TMe(e):[]}var kMe=o((()=>{gS()}));function vS(e){var t=++AMe;return dEe(e)+t}var AMe,jMe=o((()=>{Jy(),AMe=0}));function MMe(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}var NMe=o((()=>{}));function PMe(e,t){return MMe(e||[],t||[],Kv)}var FMe=o((()=>{qv(),NMe()})),yS=o((()=>{rv(),sCe(),_v(),yv(),VCe(),UCe(),dv(),K_(),GCe(),KCe(),sv(),tv(),Av(),QCe(),Pv(),Fv(),zv(),Vv(),uTe(),Yv(),iy(),jy(),Oy(),mEe(),yEe(),Qv(),$_(),EEe(),Uv(),Qy(),Jy(),ub(),OEe(),AEe(),yCe(),ry(),NOe(),LOe(),Yb(),ROe(),nb(),ab(),av(),px(),$Ce(),aAe(),UEe(),oAe(),cAe(),gAe(),xAe(),bAe(),Cx(),SAe(),CAe(),wAe(),EAe(),Zke(),tAe(),jx(),Ib(),XOe(),Gv(),jAe(),PAe(),BAe(),zAe(),hx(),IAe(),Iv(),HAe(),KAe(),GAe(),_Ee(),TAe(),JAe(),XAe(),vb(),xv(),$Ae(),tje(),aje(),Lke(),VAe(),hv(),dje(),mje(),$b(),Tx(),_y(),nx(),Xy(),eb(),_x(),ty(),ly(),Sy(),my(),vje(),yke(),$v(),eOe(),Cke(),Dke(),RCe(),TCe(),Dwe(),Sje(),aOe(),Vx(),Ty(),Cje(),owe(),Jx(),Tje(),jke(),Vke(),Eje(),Zx(),rEe(),Dje(),Oje(),kje(),Mje(),J_(),ix(),lje(),Tb(),Lje(),Gje(),OAe(),ex(),nMe(),aMe(),qke(),Rv(),Vje(),fMe(),dMe(),hMe(),mMe(),gMe(),Pje(),_Me(),xMe(),SMe(),yb(),cje(),bwe(),uEe(),fAe(),cb(),pCe(),uCe(),OMe(),gS(),kMe(),jMe(),Uke(),FMe(),NMe()}));function IMe(e,t){e[t]?e[t]++:e[t]=1}function LMe(e,t){--e[t]||delete e[t]}function bS(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+CS+a+CS+(qx(r)?zMe:r)}function RMe(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function xS(e,t){return bS(e,t.v,t.w,t.name)}var zMe,SS,CS,wS,BMe=o((()=>{yS(),zMe=`\0`,SS=`\0`,CS=``,wS=class{constructor(e={}){this._isDirected=!Object.prototype.hasOwnProperty.call(e,`directed`)||e.directed,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,`compound`)?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=jv(void 0),this._defaultEdgeLabelFn=jv(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[SS]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return bv(e)||(e=jv(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Dy(this._nodes)}sources(){var e=this;return Px(this.nodes(),function(t){return Wx(e._in[t])})}sinks(){var e=this;return Px(this.nodes(),function(t){return Wx(e._out[t])})}setNodes(e,t){var n=arguments,r=this;return Mx(e,function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=SS,this._children[e]={},this._children[SS][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],Mx(this.children(e),e=>{this.setParent(e)}),delete this._children[e]),Mx(Dy(this._in[e]),t),delete this._in[e],delete this._preds[e],Mx(Dy(this._out[e]),t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(qx(t))t=SS;else{t+=``;for(var n=t;!qx(n);n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==SS)return t}}children(e){if(qx(e)&&(e=SS),this._isCompound){var t=this._children[e];if(t)return Dy(t)}else if(e===SS)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return Dy(t)}successors(e){var t=this._sucs[e];if(t)return Dy(t)}neighbors(e){var t=this.predecessors(e);if(t)return DMe(t,this.successors(e))}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Mx(this._nodes,function(n,r){e(r)&&t.setNode(r,n)}),Mx(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&Mx(t.nodes(),function(e){t.setParent(e,i(e))}),t}setDefaultEdgeLabel(e){return bv(e)||(e=jv(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Hx(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return pS(e,function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,r,i=!1,a=arguments[0];typeof a==`object`&&a&&`v`in a?(e=a.v,t=a.w,n=a.name,arguments.length===2&&(r=arguments[1],i=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),e=``+e,t=``+t,qx(n)||(n=``+n);var o=bS(this._isDirected,e,t,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return i&&(this._edgeLabels[o]=r),this;if(!qx(n)&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[o]=i?r:this._defaultEdgeLabelFn(e,t,n);var s=RMe(this._isDirected,e,t,n);return e=s.v,t=s.w,Object.freeze(s),this._edgeObjs[o]=s,IMe(this._preds[t],e),IMe(this._sucs[e],t),this._in[t][o]=s,this._out[e][o]=s,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?xS(this._isDirected,arguments[0]):bS(this._isDirected,e,t,n);return this._edgeLabels[r]}hasEdge(e,t,n){var r=arguments.length===1?xS(this._isDirected,arguments[0]):bS(this._isDirected,e,t,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?xS(this._isDirected,arguments[0]):bS(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],LMe(this._preds[t],e),LMe(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=Hx(n);return t?Px(r,function(e){return e.v===t}):r}}outEdges(e,t){var n=this._out[e];if(n){var r=Hx(n);return t?Px(r,function(e){return e.w===t}):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}},wS.prototype._nodeCount=0,wS.prototype._edgeCount=0})),TS=o((()=>{BMe()})),VMe=l({captureNodeSizes:()=>GMe,shouldCaptureSizes:()=>HMe});function ES(){if(!(typeof globalThis>`u`))return globalThis}function HMe(){return!!ES()?.mermaidCaptureSizes}function UMe(){return typeof location>`u`?`browser-dev`:`${location.pathname}${location.search}`}function WMe(e,t){let n=ES();if(!n)return;let r=t.node(),i=((r&&`ownerSVGElement`in r?r.ownerSVGElement:null)??r)?.id??`(unknown)`;n.mermaidCapturedSizes??=[];let a={svgId:i,sizes:e};n.mermaidCapturedSizes.push(a),n.mermaidLastCapturedSizes=a}function GMe(e,t){let n=[];for(let e of t.nodes)e.isGroup||n.push({id:e.id,width:e.width??0,height:e.height??0});n.length!==0&&WMe({metadata:{captureVersion:KMe,capturedAt:new Date().toISOString(),capturedFrom:UMe()},nodes:n},e)}var KMe,qMe=o((()=>{h(),KMe=1,p(ES,`getCaptureGlobal`),p(HMe,`shouldCaptureSizes`),p(UMe,`capturedFromLocation`),p(WMe,`emitCapturedSizes`),p(GMe,`captureNodeSizes`)}));function DS(e,{edgePathsClass:t=`edges edgePaths`}={}){let n=e.insert(`g`).attr(`class`,`root`);return{clusters:n.insert(`g`).attr(`class`,`clusters`),edgePaths:n.insert(`g`).attr(`class`,t),edgeLabels:n.insert(`g`).attr(`class`,`edgeLabels`),nodes:n.insert(`g`).attr(`class`,`nodes`),rootGroups:n}}async function JMe(e,t,n){if(t.label){let{shapeSvg:r,bbox:i}=await Fg(e,n===void 0?t:{...t,width:n});t.labelBBox={width:i.width,height:i.height},r.remove()}else t.labelBBox={width:0,height:0}}async function OS(e,t,n){let r=await g_(e,t,n),i=r.node()?.getBBox()??{width:0,height:0};return t.width=i.width,t.height=i.height,r}function YMe(e,t,n){let r=e,i=new Set;for(;r;){if(r.dir)return r.dir;if(!r.parentId||i.has(r.parentId))break;i.add(r.parentId),r=t.get(r.parentId)}return n}async function XMe(e,t,n={}){let r=new wS({multigraph:!0,compound:!0}),i=[...t.edges],a=Ns(),o=DS(e),{edgeLabels:s,nodes:l}=o,u=new Map,d=new Map(t.nodes.map(e=>[e.id,e])),f=t.direction,p=e.node()!=null;await Promise.all(t.nodes.map(async e=>{if(e.isGroup){if(p){let t=n.unwrapGroupLabels&&e.labelType!==`markdown`;await JMe(l,e,t?1/0:void 0)}r.setNode(e.id,{...e})}else{if(p){let t=await OS(l,e,{config:a,dir:YMe(e,d,f)});u.set(e.id,t)}r.setNode(e.id,{...e})}}));for(let e of i)p&&F_(e)&&await L_(s,e),r.setEdge(e.start,e.end,{...e},e.id),t.edges.some(t=>t.id===e.id)||t.edges.push(e);if(globalThis.mermaidCaptureSizes){let{captureNodeSizes:n}=await Ht(async()=>{let{captureNodeSizes:e}=await Promise.resolve().then(()=>(qMe(),VMe));return{captureNodeSizes:e}},void 0);n(e,t)}return{graph:r,groups:o,nodeElements:u}}function kS({prepareLayout:e,measureLayout:t,runLayoutCore:n,paintLayout:r,afterPaint:i,paintOptions:a}){let o=t??QMe;return p(async function(t,s,l,u){let d=s.select(`g`);(l?.insertMarkers??H_)(d,t.markers,t.type,t.diagramId),ZMe();let f={element:d,helpers:l,options:u};f.preparedLayout=await e?.(t,f);let p=await o(t,f),m=await n(t,f),h={...f,measure:p};r?await r(t,h,m):await $Me(t,h,a),await i?.(t,h,m)},`render`)}function ZMe(){_Se(),ISe(),DSe(),sNe()}async function QMe(e,{element:t},n){return await XMe(t,e,n)}async function $Me(e,t,n={}){let{measure:r}=t,{groups:i}=r;for(let r of n.getNodes?.(e,t)??e.nodes)n.skipNode?.(r,t)||await eNe(i,r,t,n);let a=nNe(e.nodes);for(let r of e.edges)rNe(r,n)||await iNe(i,r,a,e,n,t)}async function eNe(e,t,n,r){t.clusterNode?y_(t):tNe(t,n,r)?await C_(e.clusters,t):y_(t)}function tNe(e,t,n){return e.isGroup===!0&&(n.isCluster?.(e,t)??!0)}function nNe(e){let t=new Map;for(let n of e)n?.id&&t.set(n.id,n);return t}function rNe(e,t){return e.isLayoutOnly||!!t.skipEdge?.(e)}async function iNe(e,t,n,r,i,a){let o=V_(e.edgePaths,{...t},i.clusterDb??new Map,r.type,AS(t.start,t,n,a,i),AS(t.end,t,n,a,i),r.diagramId,aNe(t,i));F_(t)&&(N_.has(t.id)||await L_(e.edgeLabels,t),oNe(t,o))}function AS(e,t,n,r,i){return i.getEdgeNode?.(e,t,r)??(e?n.get(e)??{}:{})}function aNe(e,t){return typeof t.skipIntersect==`function`?t.skipIntersect(e):t.skipIntersect??!1}function oNe(e,t){let n=t?.updatedPath??t?.originalPath,r=Zo(),{subGraphTitleTotalMargin:i}=__({flowchart:r.flowchart??{}});if(e.label){let r=N_.get(e.id),a=e.x,o=e.y;if(n){let r=ym.calcLabelPosition(n);y.debug(`Moving label `+e.label+` from (`,a,`,`,o,`) to (`,r.x,`,`,r.y,`) abc88`),t?.updatedPath&&(a=r.x,o=r.y)}r.attr(`transform`,`translate(${a}, ${o+i/2})`)}if(e?.startLabelLeft){let t=P_.get(e.id).startLeft,r=e?.x,i=e?.y;if(n){let t=ym.calcTerminalLabelPosition(e.arrowTypeStart?10:0,`start_left`,n);r=t.x,i=t.y}t.attr(`transform`,`translate(${r}, ${i})`)}if(e.startLabelRight){let t=P_.get(e.id).startRight,r=e.x,i=e.y;if(n){let t=ym.calcTerminalLabelPosition(e.arrowTypeStart?10:0,`start_right`,n);r=t.x,i=t.y}t.attr(`transform`,`translate(${r}, ${i})`)}if(e.endLabelLeft){let t=P_.get(e.id).endLeft,r=e.x,i=e.y;if(n){let t=ym.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,`end_left`,n);r=t.x,i=t.y}t.attr(`transform`,`translate(${r}, ${i})`)}if(e.endLabelRight){let t=P_.get(e.id).endRight,r=e.x,i=e.y;if(n){let t=ym.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,`end_right`,n);r=t.x,i=t.y}t.attr(`transform`,`translate(${r}, ${i})`)}}var jS,MS,NS,sNe,PS,cNe,FS,IS,lNe,LS,RS,uNe,zS,BS,VS,HS,dNe,fNe=o((()=>{w_(),U_(),b_(),h_(),Sm(),Vs(),S(),h(),TS(),Ut(),p(DS,`createLayoutElementGroups`),p(JMe,`measureGroupLabel`),p(OS,`insertMeasuredNode`),p(YMe,`resolveNodeDir`),p(XMe,`createGraphWithElements`),jS=new Map,MS=new Map,NS=new Map,sNe=p(()=>{MS.clear(),NS.clear(),jS.clear()},`clear`),PS=p((e,t)=>{let n=MS.get(t)||[];return y.trace(`In isDescendant`,t,` `,e,` = `,n.includes(e)),n.includes(e)},`isDescendant`),cNe=p((e,t)=>{let n=MS.get(t)||[];return y.info(`Descendants of `,t,` is `,n),y.info(`Edge is `,e),e.v===t||e.w===t?!1:n?n.includes(e.v)||PS(e.v,t)||PS(e.w,t)||n.includes(e.w):(y.debug(`Tilt, `,t,`,not in descendants`),!1)},`edgeInCluster`),FS=p((e,t,n,r)=>{y.debug(`Copying children of `,e,`root`,r,`data`,t.node(e),r);let i=t.children(e)||[];e!==r&&i.push(e),y.debug(`Copying (nodes) clusterId`,e,`nodes`,i),i.forEach(i=>{if(t.children(i).length>0)FS(i,t,n,r);else{let a=t.node(i);y.info(`cp `,i,` to `,r,` with parent `,e),n.setNode(i,a),r!==t.parent(i)&&(y.debug(`Setting parent`,i,t.parent(i)),n.setParent(i,t.parent(i))),e!==r&&i!==e?(y.debug(`Setting parent`,i,e),n.setParent(i,e)):(y.info(`In copy `,e,`root`,r,`data`,t.node(e),r),y.debug(`Not Setting parent for node=`,i,`cluster!==rootId`,e!==r,`node!==clusterId`,i!==e));let o=t.edges(i);y.debug(`Copying Edges`,o),o.forEach(i=>{y.info(`Edge`,i);let a=t.edge(i.v,i.w,i.name);y.info(`Edge data`,a,r);try{cNe(i,r)?(y.info(`Copying as `,i.v,i.w,a,i.name),n.setEdge(i.v,i.w,a,i.name),y.info(`newGraph edges `,n.edges(),n.edge(n.edges()[0]))):y.info(`Skipping copy of edge `,i.v,`-->`,i.w,` rootId: `,r,` clusterId:`,e)}catch(e){y.error(e)}})}y.debug(`Removing node`,i),t.removeNode(i)})},`copy`),IS=p((e,t)=>{let n=t.children(e),r=[...n];for(let i of n)NS.set(i,e),r=[...r,...IS(i,t)];return r},`extractDescendants`),lNe=p((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),i=e.edges().filter(e=>e.v===n||e.w===n),a=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),o=i.map(e=>({v:e.v,w:e.w}));return a.filter(e=>o.some(t=>e.v===t.v&&e.w===t.w))},`findCommonEdges`),LS=p((e,t,n)=>{let r=t.children(e);if(y.trace(`Searching children of id `,e,r),r.length<1)return e;let i;for(let e of r){let r=LS(e,t,n),a=lNe(t,n,r);if(r){if(a.length>0)i=r;else return r}}return i},`findNonClusterChild`),RS=p(e=>!jS.has(e)||!jS.get(e).externalConnections?e:jS.has(e)?jS.get(e).id:e,`getAnchorId`),uNe=p((e,t)=>{if(!e||t>10){y.debug(`Opting out, no graph `);return}y.debug(`Opting in, graph `),e.nodes().forEach(function(t){e.children(t).length>0&&(y.debug(`Cluster identified`,t,` Replacement id in edges: `,LS(t,e,t)),MS.set(t,IS(t,e)),jS.set(t,{id:LS(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let n=e.children(t),r=e.edges();n.length>0?(y.debug(`Cluster identified`,t,MS),r.forEach(e=>{PS(e.v,t)^PS(e.w,t)&&(y.debug(`Edge: `,e,` leaves cluster `,t),y.debug(`Descendants of XXX `,t,`: `,MS.get(t)),jS.get(t).externalConnections=!0)})):y.debug(`Not a cluster `,t,MS)});for(let t of jS.keys()){let n=jS.get(t).id,r=e.parent(n);r!==t&&jS.has(r)&&!jS.get(r).externalConnections&&(jS.get(t).id=r);let i=e.edges().some(e=>e.v===t);if(n&&jS.get(t)?.externalConnections&&i&&HS(e,n,t)){let r=dNe(e,t,e.parent(n));r&&(jS.get(t).id=r)}}e.edges().forEach(function(t){let n=e.edge(t);y.debug(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(t)),y.debug(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(e.edge(t)));let r=t.v,i=t.w;if(y.debug(`Fix XXX`,jS,`ids:`,t.v,t.w,`Translating: `,jS.get(t.v),` --- `,jS.get(t.w)),jS.get(t.v)||jS.get(t.w)){if(y.debug(`Fixing and trying - removing XXX`,t.v,t.w,t.name),r=RS(t.v),i=RS(t.w),e.removeEdge(t.v,t.w,t.name),r!==t.v){let i=e.parent(r);jS.get(i).externalConnections=!0,n.fromCluster=t.v}if(i!==t.w){let r=e.parent(i);jS.get(r).externalConnections=!0,n.toCluster=t.w}y.debug(`Fix Replacing with XXX`,r,i,t.name),e.setEdge(r,i,n,t.name)}}),zS(e,0),y.trace(jS)},`adjustClustersAndEdges`),zS=p((e,t)=>{if(t>10){y.error(`Bailing out`);return}let n=e.nodes(),r=!1;for(let t of n){let n=e.children(t);r||=n.length>0}if(!r){y.debug(`Done, no node has children`,e.nodes());return}y.debug(`Nodes = `,n,t);for(let r of n)if(y.debug(`Extracting node`,r,jS,jS.has(r)&&!jS.get(r).externalConnections,!e.parent(r),e.node(r),e.children(`D`),` Depth `,t),!jS.has(r))y.debug(`Not a cluster`,r,t);else if(!jS.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){y.debug(`Cluster without external connections, without a parent and with children`,r,t);let n=e.graph().rankdir===`TB`?`LR`:`TB`;jS.get(r)?.clusterData?.dir&&(n=jS.get(r).clusterData.dir,y.debug(`Fixing dir`,jS.get(r).clusterData.dir,n));let i=new wS({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});FS(r,e,i,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:jS.get(r).clusterData,label:jS.get(r).label,graph:i})}else y.debug(`Cluster ** `,r,` **not meeting the criteria !externalConnections:`,!jS.get(r).externalConnections,` no parent: `,!e.parent(r),` children `,e.children(r)&&e.children(r).length>0,e.children(`D`),t),y.debug(jS);n=e.nodes(),y.debug(`New list of nodes`,n);for(let r of n){let n=e.node(r);y.debug(` Now next level`,r,n),n?.clusterNode&&zS(n.graph,t+1)}},`extractor`),BS=p((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(t=>{let r=BS(e,e.children(t));n=[...n,...r]}),n},`sorter`),VS=p(e=>BS(e,e.children()),`sortNodesByHierarchy`),HS=p((e,t,n)=>{let r=e.parent(t);for(;r&&r!==n;){let t=jS.get(r);if(t&&!t.externalConnections)return!0;r=e.parent(r)}return!1},`isNodeInExtractableCluster`),dNe=p((e,t,n)=>{let r=e.children(t)??[];for(let i of r){if(i===n||PS(i,n))continue;let r=LS(i,e,t);if(r&&!HS(e,r,t))return r}return null},`findSafeAnchorNode`),p(kS,`createCommonLayoutRenderer`),p(ZMe,`clearLayoutRenderState`),p(QMe,`defaultMeasureLayout`),p($Me,`paintLayoutData`),p(eNe,`paintLayoutNode`),p(tNe,`shouldPaintAsCluster`),p(nNe,`buildNodeLookup`),p(rNe,`shouldSkipPaintEdge`),p(iNe,`paintLayoutEdge`),p(AS,`getRenderedNode`),p(aNe,`shouldSkipIntersect`),p(oNe,`positionRenderedEdgeLabel`)}));function pNe(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function mNe(e,t){if(e!==`_next`&&e!==`_prev`)return t}var hNe,gNe=o((()=>{hNe=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return pNe(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&pNe(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,mNe)),n=n._prev;return`[`+e.join(`, `)+`]`}}}));function _Ne(e,t){if(e.nodeCount()<=1)return[];var n=yNe(e,t||bNe);return ob(Lx(vNe(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function vNe(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)US(e,t,n,o);for(;o=i.dequeue();)US(e,t,n,o);if(e.nodeCount()){for(var s=t.length-2;s>0;--s)if(o=t[s].dequeue(),o){r=r.concat(US(e,t,n,o,!0));break}}}return r}function US(e,t,n,r,i){var a=i?[]:void 0;return Mx(e.inEdges(r.v),function(r){var o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,WS(t,n,s)}),Mx(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,WS(t,n,o)}),e.removeNode(r.v),a}function yNe(e,t){var n=new wS,r=0,i=0;Mx(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),Mx(e.edges(),function(e){var a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s),i=Math.max(i,n.node(e.v).out+=o),r=Math.max(r,n.node(e.w).in+=o)});var a=fS(i+r+3).map(function(){return new hNe}),o=r+1;return Mx(n.nodes(),function(e){WS(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function WS(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}var bNe,xNe=o((()=>{yS(),TS(),gNe(),bNe=jv(1)}));function SNe(e){Mx(e.graph().acyclicer===`greedy`?_Ne(e,t(e)):CNe(e),function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,vS(`rev`))});function t(e){return function(t){return e.edge(t).weight}}}function CNe(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,Mx(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return Mx(e.nodes(),i),t}function wNe(e){Mx(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}var TNe=o((()=>{yS(),xNe()}));function GS(e,t,n,r){var i;do i=vS(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function ENe(e){var t=new wS().setGraph(e.graph());return Mx(e.nodes(),function(n){t.setNode(n,e.node(n))}),Mx(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function DNe(e){var t=new wS({multigraph:e.isMultigraph()}).setGraph(e.graph());return Mx(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),Mx(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function ONe(e,t){var n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);var l,u;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),l=s*i/a,u=s):(i<0&&(o=-o),l=o,u=o*a/i),{x:n+l,y:r+u}}function KS(e){var t=Lx(fS(MNe(e)+1),function(){return[]});return Mx(e.nodes(),function(n){var r=e.node(n),i=r.rank;qx(i)||(t[i][r.order]=n)}),t}function kNe(e){var t=eS(Lx(e.nodes(),function(t){return e.node(t).rank}));Mx(e.nodes(),function(n){var r=e.node(n);zx(r,`rank`)&&(r.rank-=t)})}function ANe(e){var t=eS(Lx(e.nodes(),function(t){return e.node(t).rank})),n=[];Mx(e.nodes(),function(r){var i=e.node(r).rank-t;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=e.graph().nodeRankFactor;Mx(n,function(t,n){qx(t)&&n%i!==0?--r:r&&Mx(t,function(t){e.node(t).rank+=r})})}function jNe(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),GS(e,`border`,i,t)}function MNe(e){return Qx(Lx(e.nodes(),function(t){var n=e.node(t).rank;if(!qx(n))return n}))}function NNe(e,t){var n={lhs:[],rhs:[]};return Mx(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function PNe(e,t){var n=vx();try{return t()}finally{console.log(e+` time: `+(vx()-n)+`ms`)}}function FNe(e,t){return t()}var qS=o((()=>{yS(),TS()}));function INe(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&Mx(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)LNe(e,`borderLeft`,`_bl`,n,i,a),LNe(e,`borderRight`,`_br`,n,i,a)}}Mx(e.children(),t)}function LNe(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],l=GS(e,`border`,o,n);i[t][a]=l,e.setParent(l,r),s&&e.setEdge(s,l,{weight:1})}var RNe=o((()=>{yS(),qS()}));function zNe(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&VNe(e)}function BNe(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&UNe(e),(t===`lr`||t===`rl`)&&(WNe(e),VNe(e))}function VNe(e){Mx(e.nodes(),function(t){HNe(e.node(t))}),Mx(e.edges(),function(t){HNe(e.edge(t))})}function HNe(e){var t=e.width;e.width=e.height,e.height=t}function UNe(e){Mx(e.nodes(),function(t){JS(e.node(t))}),Mx(e.edges(),function(t){var n=e.edge(t);Mx(n.points,JS),Object.prototype.hasOwnProperty.call(n,`y`)&&JS(n)})}function JS(e){e.y=-e.y}function WNe(e){Mx(e.nodes(),function(t){YS(e.node(t))}),Mx(e.edges(),function(t){var n=e.edge(t);Mx(n.points,YS),Object.prototype.hasOwnProperty.call(n,`x`)&&YS(n)})}function YS(e){var t=e.x;e.x=e.y,e.y=t}var GNe=o((()=>{yS()}));function KNe(e){e.graph().dummyChains=[],Mx(e.edges(),function(t){qNe(e,t)})}function qNe(e,t){var n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),l=s.labelRank;if(a!==r+1){e.removeEdge(t);var u=void 0,d,f=0;for(++r;r<a;++f,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},d=GS(e,`edge`,u,`_d`),r===l&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,d,{weight:s.weight},o),f===0&&e.graph().dummyChains.push(d),n=d;e.setEdge(n,i,{weight:s.weight},o)}}function JNe(e){Mx(e.graph().dummyChains,function(t){var n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}var YNe=o((()=>{yS(),qS()}));function XS(e){var t={};function n(r){var i=e.node(r);if(Object.prototype.hasOwnProperty.call(t,r))return i.rank;t[r]=!0;var a=eS(Lx(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}Mx(e.sources(),n)}function ZS(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var QS=o((()=>{yS()}));function XNe(e){var t=new wS({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;ZNe(t,e)<r;)i=QNe(t,e),a=t.hasNode(i.v)?ZS(e,i):-ZS(e,i),$Ne(t,e,a);return t}function ZNe(e,t){function n(r){Mx(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!ZS(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return Mx(e.nodes(),n),e.nodeCount()}function QNe(e,t){return tS(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return ZS(t,n)})}function $Ne(e,t,n){Mx(e.nodes(),function(e){t.node(e).rank+=n})}var ePe=o((()=>{yS(),TS(),QS()})),tPe=o((()=>{yS()})),nPe=o((()=>{tPe()})),rPe=o((()=>{yS()})),iPe=o((()=>{yS()})),aPe=o((()=>{iPe()}));function oPe(e,t,n){ov(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return Mx(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);sPe(e,t,n===`post`,a,r,i)}),i}function sPe(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),Mx(i(t),function(t){sPe(e,t,n,r,i,a)}),n&&a.push(t))}var cPe=o((()=>{yS()}));function lPe(e,t){return oPe(e,t,`post`)}var uPe=o((()=>{cPe()}));function dPe(e,t){return oPe(e,t,`pre`)}var fPe=o((()=>{cPe()})),pPe=o((()=>{BMe()})),mPe=o((()=>{tPe(),nPe(),rPe(),aPe(),uPe(),fPe(),pPe(),iPe()}));function $S(e){e=ENe(e),XS(e);var t=XNe(e);tC(t),eC(t,e);for(var n,r;n=vPe(t);)r=yPe(t,e,n),bPe(t,e,n,r)}function eC(e,t){var n=lPe(e,e.nodes());n=n.slice(0,n.length-1),Mx(n,function(n){hPe(e,t,n)})}function hPe(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=gPe(e,t,n)}function gPe(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,Mx(t.nodeEdges(n),function(a){var s=a.v===n,l=s?a.w:a.v;if(l!==r){var u=s===i,d=t.edge(a).weight;if(o+=u?d:-d,SPe(e,n,l)){var f=e.edge(n,l).cutvalue;o+=u?-f:f}}}),o}function tC(e,t){arguments.length<2&&(t=e.nodes()[0]),_Pe(e,{},1,t)}function _Pe(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,Mx(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=_Pe(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function vPe(e){return Fx(e.edges(),function(t){return e.edge(t).cutvalue<0})}function yPe(e,t,n){var r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);var a=e.node(r),o=e.node(i),s=a,l=!1;return a.lim>o.lim&&(s=o,l=!0),tS(Px(t.edges(),function(t){return l===CPe(e,e.node(t.v),s)&&l!==CPe(e,e.node(t.w),s)}),function(e){return ZS(t,e)})}function bPe(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),tC(e),eC(e,t),xPe(e,t)}function xPe(e,t){var n=dPe(e,Fx(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),Mx(n,function(n){var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function SPe(e,t,n){return e.hasEdge(t,n)}function CPe(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var wPe=o((()=>{yS(),mPe(),qS(),ePe(),QS(),$S.initLowLimValues=tC,$S.initCutValues=eC,$S.calcCutValue=gPe,$S.leaveEdge=vPe,$S.enterEdge=yPe,$S.exchangeEdges=bPe}));function TPe(e){switch(e.graph().ranker){case`network-simplex`:DPe(e);break;case`tight-tree`:EPe(e);break;case`longest-path`:OPe(e);break;default:DPe(e)}}function EPe(e){XS(e),XNe(e)}function DPe(e){$S(e)}var OPe,kPe=o((()=>{ePe(),wPe(),QS(),OPe=XS}));function APe(e){var t=GS(e,`root`,{},`_root`),n=MPe(e),r=Qx(Hx(n))-1,i=2*r+1;e.graph().nestingRoot=t,Mx(e.edges(),function(t){e.edge(t).minlen*=i});var a=NPe(e)+1;Mx(e.children(),function(o){jPe(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function jPe(e,t,n,r,i,a,o){var s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}var l=jNe(e,`_bt`),u=jNe(e,`_bb`),d=e.node(o);e.setParent(l,o),d.borderTop=l,e.setParent(u,o),d.borderBottom=u,Mx(s,function(s){jPe(e,t,n,r,i,a,s);var d=e.node(s),f=d.borderTop?d.borderTop:s,p=d.borderBottom?d.borderBottom:s,m=d.borderTop?r:2*r,h=f===p?i-a[o]+1:1;e.setEdge(l,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,u,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,l,{weight:0,minlen:i+a[o]})}function MPe(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&Mx(a,function(e){n(e,i+1)}),t[r]=i}return Mx(e.children(),function(e){n(e,1)}),t}function NPe(e){return pS(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function PPe(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,Mx(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}var FPe=o((()=>{yS(),qS()}));function IPe(e,t,n){var r={},i;Mx(n,function(n){for(var a=e.parent(n),o,s;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}var LPe=o((()=>{yS()}));function RPe(e,t,n){var r=zPe(e),i=new wS({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return Mx(e.nodes(),function(a){var o=e.node(a),s=e.parent(a);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||r),Mx(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=qx(r)?0:r.weight;i.setEdge(n,a,{weight:e.edge(t).weight+o})}),Object.prototype.hasOwnProperty.call(o,`minRank`)&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function zPe(e){for(var t;e.hasNode(t=vS(`_root`)););return t}var BPe=o((()=>{yS(),TS()}));function VPe(e,t){for(var n=0,r=1;r<t.length;++r)n+=HPe(e,t[r-1],t[r]);return n}function HPe(e,t,n){for(var r=PMe(n,Lx(n,function(e,t){return t})),i=ob(Lx(t,function(t){return hS(Lx(e.outEdges(t),function(t){return{pos:r[t.w],weight:e.edge(t).weight}}),`pos`)})),a=1;a<n.length;)a<<=1;var o=2*a-1;--a;var s=Lx(Array(o),function(){return 0}),l=0;return Mx(i.forEach(function(e){var t=e.pos+a;s[t]+=e.weight;for(var n=0;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;l+=e.weight*n})),l}var UPe=o((()=>{yS()}));function WPe(e){var t={},n=Px(e.nodes(),function(t){return!e.children(t).length}),r=Qx(Lx(n,function(t){return e.node(t).rank})),i=Lx(fS(r+1),function(){return[]});function a(n){zx(t,n)||(t[n]=!0,i[e.node(n).rank].push(n),Mx(e.successors(n),a))}return Mx(hS(n,function(t){return e.node(t).rank}),a),i}var GPe=o((()=>{yS()}));function KPe(e,t){return Lx(t,function(t){var n=e.inEdges(t);if(n.length){var r=pS(n,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}return{v:t}})}var qPe=o((()=>{yS()}));function JPe(e,t){var n={};return Mx(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};qx(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),Mx(t.edges(),function(e){var t=n[e.v],r=n[e.w];!qx(t)&&!qx(r)&&(r.indegree++,t.out.push(n[e.w]))}),YPe(Px(n,function(e){return!e.indegree}))}function YPe(e){var t=[];function n(e){return function(t){t.merged||(qx(t.barycenter)||qx(e.barycenter)||t.barycenter>=e.barycenter)&&XPe(e,t)}}function r(t){return function(n){n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){var i=e.pop();t.push(i),Mx(i.in.reverse(),n(i)),Mx(i.out,r(i))}return Lx(Px(t,function(e){return!e.merged}),function(e){return dS(e,[`vs`,`i`,`barycenter`,`weight`])})}function XPe(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}var ZPe=o((()=>{yS()}));function QPe(e,t){var n=NNe(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=hS(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,l=0;r.sort(eFe(!!t)),l=$Pe(a,i,l),Mx(r,function(e){l+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,l=$Pe(a,i,l)});var u={vs:ob(a)};return s&&(u.barycenter=o/s,u.weight=s),u}function $Pe(e,t,n){for(var r;t.length&&(r=Dx(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function eFe(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}var tFe=o((()=>{yS(),qS()}));function nFe(e,t,n,r){var i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,l={};o&&(i=Px(i,function(e){return e!==o&&e!==s}));var u=KPe(e,i);Mx(u,function(t){if(e.children(t.v).length){var i=nFe(e,t.v,n,r);l[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&iFe(t,i)}});var d=JPe(u,n);rFe(d,l);var f=QPe(d,r);if(o&&(f.vs=ob([o,f.vs,s]),e.predecessors(o).length)){var p=e.node(e.predecessors(o)[0]),m=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(f,`barycenter`)||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+m.order)/(f.weight+2),f.weight+=2}return f}function rFe(e,t){Mx(e,function(e){e.vs=ob(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function iFe(e,t){qx(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}var aFe=o((()=>{yS(),qPe(),ZPe(),tFe()}));function oFe(e){var t=MNe(e),n=sFe(e,fS(1,t+1),`inEdges`),r=sFe(e,fS(t-1,-1,-1),`outEdges`),i=WPe(e);lFe(e,i);for(var a=1/0,o,s=0,l=0;l<4;++s,++l){cFe(s%2?n:r,s%4>=2),i=KS(e);var u=VPe(e,i);u<a&&(l=0,o=POe(i),a=u)}lFe(e,o)}function sFe(e,t,n){return Lx(t,function(t){return RPe(e,t,n)})}function cFe(e,t){var n=new wS;Mx(e,function(e){var r=e.graph().root,i=nFe(e,r,n,t);Mx(i.vs,function(t,n){e.node(t).order=n}),IPe(e,n,i.vs)})}function lFe(e,t){Mx(t,function(t){Mx(t,function(t,n){e.node(t).order=n})})}var uFe=o((()=>{yS(),TS(),qS(),LPe(),BPe(),UPe(),GPe(),aFe()}));function dFe(e){var t=pFe(e);Mx(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=fFe(e,t,i.v,i.w),o=a.path,s=a.lca,l=0,u=o[l],d=!0;n!==i.w;){if(r=e.node(n),d){for(;(u=o[l])!==s&&e.node(u).maxRank<r.rank;)l++;u===s&&(d=!1)}if(!d){for(;l<o.length-1&&e.node(u=o[l+1]).minRank<=r.rank;)l++;u=o[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function fFe(e,t,n,r){var i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),l=n,u;do l=e.parent(l),i.push(l);while(l&&(t[l].low>o||s>t[l].lim));for(u=l,l=r;(l=e.parent(l))!==u;)a.push(l);return{path:i.concat(a.reverse()),lca:u}}function pFe(e){var t={},n=0;function r(i){var a=n;Mx(e.children(i),r),t[i]={low:a,lim:n++}}return Mx(e.children(),r),t}var mFe=o((()=>{yS()}));function hFe(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=Dx(r);return Mx(r,function(t,l){var u=_Fe(e,t),d=u?e.node(u).order:o;(u||t===s)&&(Mx(r.slice(a,l+1),function(t){Mx(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||d<o)&&!(a.dummy&&e.node(t).dummy)&&vFe(n,r,t)})}),a=l+1,i=d)}),r}return pS(t,r),n}function gFe(e,t){var n={};function r(t,r,i,a,o){var s;Mx(fS(r,i),function(r){s=t[r],e.node(s).dummy&&Mx(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&vFe(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return Mx(n,function(s,l){if(e.node(s).dummy===`border`){var u=e.predecessors(s);u.length&&(a=e.node(u[0]).order,r(n,o,l,i,a),o=l,i=a)}r(n,o,n.length,a,t.length)}),n}return pS(t,i),n}function _Fe(e,t){if(e.node(t).dummy)return Fx(e.predecessors(t),function(t){return e.node(t).dummy})}function vFe(e,t,n){if(t>n){var r=t;t=n,n=r}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[t];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function yFe(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function bFe(e,t,n,r){var i={},a={},o={};return Mx(t,function(e){Mx(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),Mx(t,function(e){var t=-1;Mx(e,function(e){var s=r(e);if(s.length){s=hS(s,function(e){return o[e]});for(var l=(s.length-1)/2,u=Math.floor(l),d=Math.ceil(l);u<=d;++u){var f=s[u];a[e]===e&&t<o[f]&&!yFe(n,e,f)&&(a[f]=e,a[e]=i[e]=i[f],t=o[f])}}})}),{root:i,align:a}}function xFe(e,t,n,r,i){var a={},o=SFe(e,t,n,i),s=i?`borderLeft`:`borderRight`;function l(e,t){for(var n=o.nodes(),r=n.pop(),i={};r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function u(e){a[e]=o.inEdges(e).reduce(function(e,t){return Math.max(e,a[t.v]+o.edge(t))},0)}function d(t){var n=o.outEdges(t).reduce(function(e,t){return Math.min(e,a[t.w]-o.edge(t))},1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return l(u,o.predecessors.bind(o)),l(d,o.successors.bind(o)),Mx(r,function(e){a[e]=a[n[e]]}),a}function SFe(e,t,n,r){var i=new wS,a=e.graph(),o=DFe(a.nodesep,a.edgesep,r);return Mx(t,function(t){var r;Mx(t,function(t){var a=n[t];if(i.setNode(a),r){var s=n[r],l=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),l||0))}r=t})}),i}function CFe(e,t){return tS(Hx(t),function(t){var n=-1/0,r=1/0;return qAe(t,function(t,i){var a=OFe(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function wFe(e,t){var n=Hx(t),r=eS(n),i=Qx(n);Mx([`u`,`d`],function(n){Mx([`l`,`r`],function(a){var o=n+a,s=e[o],l;if(s!==t){var u=Hx(s);l=a===`l`?r-eS(u):i-Qx(u),l&&(e[o]=Yx(s,function(e){return e+l}))}})})}function TFe(e,t){return Yx(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=hS(Lx(e,r));return(i[1]+i[2])/2})}function EFe(e){var t=KS(e),n=$x(hFe(e,t),gFe(e,t)),r={},i;return Mx([`u`,`d`],function(a){i=a===`u`?t:Hx(t).reverse(),Mx([`l`,`r`],function(t){t===`r`&&(i=Lx(i,function(e){return Hx(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=bFe(e,i,n,o),l=xFe(e,i,s.root,s.align,t===`r`);t===`r`&&(l=Yx(l,function(e){return-e})),r[a+t]=l})}),wFe(r,CFe(e,r)),TFe(r,e.graph().align)}function DFe(e,t,n){return function(r,i,a){var o=r.node(i),s=r.node(a),l=0,u;if(l+=o.width/2,Object.prototype.hasOwnProperty.call(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:u=-o.width/2;break;case`r`:u=o.width/2}if(u&&(l+=n?u:-u),u=0,l+=(o.dummy?t:e)/2,l+=(s.dummy?t:e)/2,l+=s.width/2,Object.prototype.hasOwnProperty.call(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:u=s.width/2;break;case`r`:u=-s.width/2}return u&&(l+=n?u:-u),u=0,l}}function OFe(e,t){return e.node(t).width}var kFe=o((()=>{yS(),TS(),qS()}));function AFe(e){e=DNe(e),jFe(e),YAe(EFe(e),function(t,n){e.node(n).x=t})}function jFe(e){var t=KS(e),n=e.graph().ranksep,r=0;Mx(t,function(t){var i=Qx(Lx(t,function(t){return e.node(t).height}));Mx(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}var MFe=o((()=>{yS(),qS(),kFe()}));function NFe(e,t){var n=t&&t.debugTiming?PNe:FNe;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>IFe(e));n(` runLayout`,()=>PFe(t,n)),n(` updateInputGraph`,()=>FFe(e,t))})}function PFe(e,t){t(` makeSpaceForEdgeLabels`,()=>LFe(e)),t(` removeSelfEdges`,()=>KFe(e)),t(` acyclic`,()=>SNe(e)),t(` nestingGraph.run`,()=>APe(e)),t(` rank`,()=>TPe(DNe(e))),t(` injectEdgeLabelProxies`,()=>RFe(e)),t(` removeEmptyRanks`,()=>ANe(e)),t(` nestingGraph.cleanup`,()=>PPe(e)),t(` normalizeRanks`,()=>kNe(e)),t(` assignRankMinMax`,()=>zFe(e)),t(` removeEdgeLabelProxies`,()=>BFe(e)),t(` normalize.run`,()=>KNe(e)),t(` parentDummyChains`,()=>dFe(e)),t(` addBorderSegments`,()=>INe(e)),t(` order`,()=>oFe(e)),t(` insertSelfEdges`,()=>qFe(e)),t(` adjustCoordinateSystem`,()=>zNe(e)),t(` position`,()=>AFe(e)),t(` positionSelfEdges`,()=>JFe(e)),t(` removeBorderNodes`,()=>GFe(e)),t(` normalize.undo`,()=>JNe(e)),t(` fixupEdgeLabelCoords`,()=>UFe(e)),t(` undoCoordinateSystem`,()=>BNe(e)),t(` translateGraph`,()=>VFe(e)),t(` assignNodeIntersects`,()=>HFe(e)),t(` reversePoints`,()=>WFe(e)),t(` acyclic.undo`,()=>wNe(e))}function FFe(e,t){Mx(e.nodes(),function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))}),Mx(e.edges(),function(n){var r=e.edge(n),i=t.edge(n);r.points=i.points,Object.prototype.hasOwnProperty.call(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}function IFe(e){var t=new wS({multigraph:!0,compound:!0}),n=rC(e.graph());return t.setGraph($x({},XFe,nC(n,YFe),dS(n,ZFe))),Mx(e.nodes(),function(n){var r=rC(e.node(n));t.setNode(n,bx(nC(r,QFe),$Fe)),t.setParent(n,e.parent(n))}),Mx(e.edges(),function(n){var r=rC(e.edge(n));t.setEdge(n,$x({},tIe,nC(r,eIe),dS(r,nIe)))}),t}function LFe(e){var t=e.graph();t.ranksep/=2,Mx(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function RFe(e){Mx(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);GS(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function zFe(e){var t=0;Mx(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Qx(t,r.maxRank))}),e.graph().maxRank=t}function BFe(e){Mx(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function VFe(e){var t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function l(e){var a=e.x,o=e.y,s=e.width,l=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-l/2),i=Math.max(i,o+l/2)}Mx(e.nodes(),function(t){l(e.node(t))}),Mx(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&l(n)}),t-=o,r-=s,Mx(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),Mx(e.edges(),function(n){var i=e.edge(n);Mx(i.points,function(e){e.x-=t,e.y-=r}),Object.prototype.hasOwnProperty.call(i,`x`)&&(i.x-=t),Object.prototype.hasOwnProperty.call(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function HFe(e){Mx(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(ONe(r,a)),n.points.push(ONe(i,o))})}function UFe(e){Mx(e.edges(),function(t){var n=e.edge(t);if(Object.prototype.hasOwnProperty.call(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function WFe(e){Mx(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function GFe(e){Mx(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(Dx(n.borderLeft)),o=e.node(Dx(n.borderRight));n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),Mx(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function KFe(e){Mx(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function qFe(e){Mx(KS(e),function(t){var n=0;Mx(t,function(t,r){var i=e.node(t);i.order=r+n,Mx(i.selfEdges,function(t){GS(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function JFe(e){Mx(e.nodes(),function(t){var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function nC(e,t){return Yx(dS(e,t),Number)}function rC(e){var t={};return Mx(e,function(e,n){t[n.toLowerCase()]=e}),t}var YFe,XFe,ZFe,QFe,$Fe,eIe,tIe,nIe,rIe=o((()=>{yS(),TS(),RNe(),GNe(),TNe(),YNe(),kPe(),FPe(),uFe(),mFe(),MFe(),qS(),YFe=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],XFe={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},ZFe=[`acyclicer`,`ranker`,`rankdir`,`align`],QFe=[`width`,`height`],$Fe={width:0,height:0},eIe=[`minlen`,`weight`,`width`,`height`,`labeloffset`],tIe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},nIe=[`labelpos`]})),iIe=o((()=>{TNe(),rIe(),YNe(),kPe()})),aIe=l({applyDagreLayoutResult:()=>uC,getEdgesToRender:()=>oC,measureDagreLayout:()=>fC,prepareLayoutForDagre:()=>dC,render:()=>hIe,runDagreLayoutCore:()=>pC}),iC,aC,oIe,sIe,cIe,lIe,uIe,oC,sC,cC,dIe,lC,fIe,uC,pIe,mIe,dC,fC,pC,hIe,gIe=o((()=>{fNe(),w_(),U_(),b_(),h_(),Zf(),Th(),up(),Sm(),Vs(),S(),h(),iIe(),TS(),iC=p((e,t,n)=>Math.max(t,Math.min(n,e)),`clamp`),aC=p((e=`TB`)=>{switch(e){case`BT`:return`bottom`;case`LR`:return`right`;case`RL`:return`left`;default:return`top`}},`getDefaultSelfLoopSide`),oIe=p(e=>e===`flowchart`||e===`flowchart-v2`||e===`stateDiagram`||e===`er`||e===`classDiagram`,`shouldMergeSelfLoopSegments`),sIe=[`x`,`y`,`width`,`height`,`labelBBox`,`intersect`,`calcIntersect`,`diff`,`clusterNode`],cIe=p((e,t,n,r,i)=>{let a=[],o=new Set;if(n.forEach(({start:e,end:t})=>{e!==r&&o.add(e),t!==r&&o.add(t)}),o.forEach(t=>{let n=e.node(t);typeof n?.x==`number`&&typeof n?.y==`number`&&a.push(n)}),a.length===0&&n.forEach(({edge:e})=>{(e.points??[]).forEach(e=>{typeof e?.x==`number`&&typeof e?.y==`number`&&a.push(e)})}),a.length===0)return aC(i);let s=a.reduce((e,t)=>({x:e.x+t.x/a.length,y:e.y+t.y/a.length}),{x:0,y:0}),l=s.x-t.x,u=s.y-t.y;return Math.abs(l)>Math.abs(u)?l>0?`right`:`left`:Math.abs(u)>0?u>0?`bottom`:`top`:aC(i)},`getSelfLoopSide`),lIe=p((e,t=`top`,n=0,r=0)=>{let i=e.x,a=e.y-n,o=e.width/2,s=e.height/2,l=Math.max(36,Math.min(100,e.width*.8)),u=iC(Math.max(r,e.width*.35),36,l),d=iC(Math.min(e.width,e.height)*.45,24,48);switch(t){case`bottom`:{let e=a+s;return[{x:i-u/2,y:e},{x:i-u/2,y:e+d},{x:i+u/2,y:e+d},{x:i+u/2,y:e}]}case`right`:{let e=i+o;return[{x:e,y:a-u/2},{x:e+d,y:a-u/2},{x:e+d,y:a+u/2},{x:e,y:a+u/2}]}case`left`:{let e=i-o;return[{x:e,y:a-u/2},{x:e-d,y:a-u/2},{x:e-d,y:a+u/2},{x:e,y:a+u/2}]}default:{let e=a-s;return[{x:i-u/2,y:e},{x:i-u/2,y:e-d},{x:i+u/2,y:e-d},{x:i+u/2,y:e}]}}},`getSelfLoopPoints`),uIe=p((e,t,n=`top`,r=0,i={})=>{let a=e.x,o=e.y-r,s=i.width??0,l=i.height??0;switch(n){case`bottom`:return{x:a,y:Math.max(...t.map(e=>e.y))+l/2+4};case`right`:return{x:Math.max(...t.map(e=>e.x))+s/2+4,y:o};case`left`:return{x:Math.min(...t.map(e=>e.x))-s/2-4,y:o};default:return{x:a,y:Math.min(...t.map(e=>e.y))-l/2-4}}},`getSelfLoopLabelPosition`),oC=p((e,t=0,{mergeSelfLoops:n=!0}={})=>{let r=new Map,i=[],a=e.graph()?.rankdir;return e.edges().forEach(t=>{let a=e.edge(t);if(n&&a.selfLoop){let e=a.selfLoop.id;r.has(e)||r.set(e,[]),r.get(e).push({edge:a,start:t.v,end:t.w})}else i.push({edge:a,start:t.v,end:t.w})}),r.forEach(n=>{if(n.length!==3){n.forEach(e=>i.push(e));return}n.sort((e,t)=>e.edge.selfLoop.order-t.edge.selfLoop.order);let[r,o,s]=n,l=r.edge.originalEdge??o.edge.originalEdge??s.edge.originalEdge??o.edge,u=e.node(l.start);if(!u){n.forEach(e=>i.push(e));return}let d={width:o.edge.width,height:o.edge.height},f=cIe(e,u,n,l.start,a),p=lIe(u,f,t,d.width??0),m=uIe(u,p,f,t,d),h={...o.edge,...l,id:l.id,points:p,start:l.start,end:l.end,x:m.x,y:m.y,width:d.width,height:d.height,labelStyle:o.edge.labelStyle,fromCluster:r.edge.fromCluster??o.edge.fromCluster??s.edge.fromCluster,toCluster:r.edge.toCluster??o.edge.toCluster??s.edge.toCluster};delete h.selfLoop,delete h.originalEdge,i.push({edge:h,start:h.start,end:h.end})}),i},`getEdgesToRender`),sC=p(async({element:e,graph:t,diagramType:n,id:r,parentCluster:i,siteConfig:a})=>{let o=t.graph().rankdir;y.trace(`Dir in recursive render - dir:`,o);let{clusters:s,edgePaths:l,edgeLabels:u,nodes:d,rootGroups:f}=DS(e,{edgePathsClass:`edgePaths`});t.nodes()?y.info(`Recursive render XXX`,t.nodes()):y.info(`No nodes found for`,t),t.edges().length>0&&y.info(`Recursive edges`,t.edge(t.edges()[0]));let m=oIe(n);await Promise.all(t.nodes().map(async function(e){let s=t.node(e);if(i!==void 0){let n=JSON.parse(JSON.stringify(i.clusterData));y.trace(`Setting data for parent cluster XXX
|
|
559
|
+
L0,20`).attr(`stroke-linejoin`,`miter`)},`requirement_arrow_neo`),requirement_contains_neo:p((e,t,n)=>{let{themeVariables:r}=Zo(),{strokeWidth:i}=r,a=e.append(`defs`).append(`marker`).attr(`id`,n+`_`+t+`-requirement_containsStart`).attr(`refX`,0).attr(`refY`,10).attr(`markerWidth`,20).attr(`markerHeight`,20).attr(`orient`,`auto`).attr(`markerUnits`,`userSpaceOnUse`).append(`g`);a.append(`circle`).attr(`cx`,10).attr(`cy`,10).attr(`r`,9).attr(`fill`,`none`),a.append(`line`).attr(`x1`,1).attr(`x2`,19).attr(`y1`,10).attr(`y2`,10),a.append(`line`).attr(`y1`,1).attr(`y2`,19).attr(`x1`,10).attr(`x2`,10),a.selectAll(`*`).attr(`stroke-width`,`${i}`)},`requirement_contains_neo`)},H_=HSe})),WSe=l({render:()=>GSe}),GSe,KSe=o((()=>{GSe=()=>{throw Error(`The ELK layout is not bundled with Libre WebUI artifacts; use the dagre layout.`)}})),W_,qSe=o((()=>{W_=typeof global==`object`&&global&&global.Object===Object&&global})),JSe,G_,K_=o((()=>{qSe(),JSe=typeof self==`object`&&self&&self.Object===Object&&self,G_=W_||JSe||Function(`return this`)()})),q_,J_=o((()=>{K_(),q_=G_.Symbol}));function YSe(e){var t=XSe.call(e,X_),n=e[X_];try{e[X_]=void 0;var r=!0}catch{}var i=ZSe.call(e);return r&&(t?e[X_]=n:delete e[X_]),i}var Y_,XSe,ZSe,X_,QSe=o((()=>{J_(),Y_=Object.prototype,XSe=Y_.hasOwnProperty,ZSe=Y_.toString,X_=q_?q_.toStringTag:void 0}));function $Se(e){return eCe.call(e)}var eCe,tCe=o((()=>{eCe=Object.prototype.toString}));function Z_(e){return e==null?e===void 0?rCe:nCe:Q_&&Q_ in Object(e)?YSe(e):$Se(e)}var nCe,rCe,Q_,$_=o((()=>{J_(),QSe(),tCe(),nCe=`[object Null]`,rCe=`[object Undefined]`,Q_=q_?q_.toStringTag:void 0}));function ev(e){return typeof e==`object`&&!!e}var tv=o((()=>{}));function nv(e){return typeof e==`symbol`||ev(e)&&Z_(e)==iCe}var iCe,rv=o((()=>{$_(),tv(),iCe=`[object Symbol]`}));function iv(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var av=o((()=>{})),ov,sv=o((()=>{ov=Array.isArray}));function aCe(e){if(typeof e==`string`)return e;if(ov(e))return iv(e,aCe)+``;if(nv(e))return lv?lv.call(e):``;var t=e+``;return t==`0`&&1/e==-oCe?`-0`:t}var oCe,cv,lv,sCe=o((()=>{J_(),av(),sv(),rv(),oCe=1/0,cv=q_?q_.prototype:void 0,lv=cv?cv.toString:void 0}));function cCe(e){for(var t=e.length;t--&&lCe.test(e.charAt(t)););return t}var lCe,uCe=o((()=>{lCe=/\s/}));function dCe(e){return e&&e.slice(0,cCe(e)+1).replace(fCe,``)}var fCe,pCe=o((()=>{uCe(),fCe=/^\s+/}));function uv(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var dv=o((()=>{}));function mCe(e){if(typeof e==`number`)return e;if(nv(e))return fv;if(uv(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=uv(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=dCe(e);var n=gCe.test(e);return n||_Ce.test(e)?vCe(e.slice(2),n?2:8):hCe.test(e)?fv:+e}var fv,hCe,gCe,_Ce,vCe,yCe=o((()=>{pCe(),dv(),rv(),fv=NaN,hCe=/^[-+]0x[0-9a-f]+$/i,gCe=/^0b[01]+$/i,_Ce=/^0o[0-7]+$/i,vCe=parseInt}));function pv(e){return e?(e=mCe(e),e===mv||e===-mv?(e<0?-1:1)*bCe:e===e?e:0):e===0?e:0}var mv,bCe,hv=o((()=>{yCe(),mv=1/0,bCe=17976931348623157e292}));function gv(e){var t=pv(e),n=t%1;return t===t?n?t-n:t:0}var _v=o((()=>{hv()}));function vv(e){return e}var yv=o((()=>{}));function bv(e){if(!uv(e))return!1;var t=Z_(e);return t==SCe||t==CCe||t==xCe||t==wCe}var xCe,SCe,CCe,wCe,xv=o((()=>{$_(),dv(),xCe=`[object AsyncFunction]`,SCe=`[object Function]`,CCe=`[object GeneratorFunction]`,wCe=`[object Proxy]`})),Sv,TCe=o((()=>{K_(),Sv=G_[`__core-js_shared__`]}));function ECe(e){return!!Cv&&Cv in e}var Cv,DCe=o((()=>{TCe(),Cv=function(){var e=/[^.]+$/.exec(Sv&&Sv.keys&&Sv.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}()}));function wv(e){if(e!=null){try{return OCe.call(e)}catch{}try{return e+``}catch{}}return``}var OCe,kCe=o((()=>{OCe=Function.prototype.toString}));function ACe(e){return!uv(e)||ECe(e)?!1:(bv(e)?LCe:MCe).test(wv(e))}var jCe,MCe,NCe,PCe,FCe,ICe,LCe,RCe=o((()=>{xv(),DCe(),dv(),kCe(),jCe=/[\\^$.*+?()[\]{}|]/g,MCe=/^\[object .+?Constructor\]$/,NCe=Function.prototype,PCe=Object.prototype,FCe=NCe.toString,ICe=PCe.hasOwnProperty,LCe=RegExp(`^`+FCe.call(ICe).replace(jCe,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`)}));function zCe(e,t){return e?.[t]}var BCe=o((()=>{}));function Tv(e,t){var n=zCe(e,t);return ACe(n)?n:void 0}var Ev=o((()=>{RCe(),BCe()})),Dv,VCe=o((()=>{Ev(),K_(),Dv=Tv(G_,`WeakMap`)})),Ov,HCe,UCe=o((()=>{dv(),Ov=Object.create,HCe=function(){function e(){}return function(t){if(!uv(t))return{};if(Ov)return Ov(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}()}));function WCe(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var GCe=o((()=>{}));function kv(){}var KCe=o((()=>{}));function qCe(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}var Av=o((()=>{}));function JCe(e){var t=0,n=0;return function(){var r=ZCe(),i=XCe-(r-n);if(n=r,i>0){if(++t>=YCe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var YCe,XCe,ZCe,QCe=o((()=>{YCe=800,XCe=16,ZCe=Date.now}));function jv(e){return function(){return e}}var $Ce=o((()=>{})),Mv,ewe=o((()=>{Ev(),Mv=function(){try{var e=Tv(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),twe,nwe=o((()=>{$Ce(),ewe(),yv(),twe=Mv?function(e,t){return Mv(e,`toString`,{configurable:!0,enumerable:!1,value:jv(t),writable:!0})}:vv})),Nv,Pv=o((()=>{nwe(),QCe(),Nv=JCe(twe)}));function rwe(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var Fv=o((()=>{}));function iwe(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}var Iv=o((()=>{}));function awe(e){return e!==e}var owe=o((()=>{}));function swe(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var cwe=o((()=>{}));function Lv(e,t,n){return t===t?swe(e,t,n):iwe(e,awe,n)}var Rv=o((()=>{Iv(),owe(),cwe()}));function lwe(e,t){return!!(e!=null&&e.length)&&Lv(e,t,0)>-1}var zv=o((()=>{Rv()}));function Bv(e,t){var n=typeof e;return t??=uwe,!!t&&(n==`number`||n!=`symbol`&&dwe.test(e))&&e>-1&&e%1==0&&e<t}var uwe,dwe,Vv=o((()=>{uwe=9007199254740991,dwe=/^(?:0|[1-9]\d*)$/}));function Hv(e,t,n){t==`__proto__`&&Mv?Mv(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Uv=o((()=>{ewe()}));function Wv(e,t){return e===t||e!==e&&t!==t}var Gv=o((()=>{}));function Kv(e,t,n){var r=e[t];(!(fwe.call(e,t)&&Wv(r,n))||n===void 0&&!(t in e))&&Hv(e,t,n)}var fwe,qv=o((()=>{Uv(),Gv(),fwe=Object.prototype.hasOwnProperty}));function Jv(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],l=r?r(n[s],e[s],s,n,e):void 0;l===void 0&&(l=e[s]),i?Hv(n,s,l):Kv(n,s,l)}return n}var Yv=o((()=>{qv(),Uv()}));function pwe(e,t,n){return t=Xv(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Xv(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),WCe(e,this,s)}}var Xv,mwe=o((()=>{GCe(),Xv=Math.max}));function Zv(e,t){return Nv(pwe(e,t,vv),e+``)}var Qv=o((()=>{yv(),mwe(),Pv()}));function hwe(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=gwe}var gwe,$v=o((()=>{gwe=9007199254740991}));function ey(e){return e!=null&&hwe(e.length)&&!bv(e)}var ty=o((()=>{xv(),$v()}));function ny(e,t,n){if(!uv(n))return!1;var r=typeof t;return(r==`number`?ey(n)&&Bv(t,n.length):r==`string`&&t in n)?Wv(n[t],e):!1}var ry=o((()=>{Gv(),ty(),Vv(),dv()}));function _we(e){return Zv(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&ny(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var iy=o((()=>{Qv(),ry()}));function ay(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||vwe)}var vwe,oy=o((()=>{vwe=Object.prototype}));function ywe(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var bwe=o((()=>{}));function xwe(e){return ev(e)&&Z_(e)==Swe}var Swe,Cwe=o((()=>{$_(),tv(),Swe=`[object Arguments]`})),sy,wwe,Twe,cy,ly=o((()=>{Cwe(),tv(),sy=Object.prototype,wwe=sy.hasOwnProperty,Twe=sy.propertyIsEnumerable,cy=xwe(function(){return arguments}())?xwe:function(e){return ev(e)&&wwe.call(e,`callee`)&&!Twe.call(e,`callee`)}}));function Ewe(){return!1}var Dwe=o((()=>{})),uy,dy,fy,py,my=o((()=>{K_(),Dwe(),uy=typeof exports==`object`&&exports&&!exports.nodeType&&exports,dy=uy&&typeof module==`object`&&module&&!module.nodeType&&module,fy=dy&&dy.exports===uy?G_.Buffer:void 0,py=(fy?fy.isBuffer:void 0)||Ewe}));function Owe(e){return ev(e)&&hwe(e.length)&&!!hy[Z_(e)]}var kwe,Awe,jwe,Mwe,Nwe,Pwe,Fwe,Iwe,Lwe,Rwe,zwe,Bwe,Vwe,Hwe,Uwe,Wwe,Gwe,Kwe,qwe,Jwe,Ywe,Xwe,Zwe,Qwe,hy,$we=o((()=>{$_(),$v(),tv(),kwe=`[object Arguments]`,Awe=`[object Array]`,jwe=`[object Boolean]`,Mwe=`[object Date]`,Nwe=`[object Error]`,Pwe=`[object Function]`,Fwe=`[object Map]`,Iwe=`[object Number]`,Lwe=`[object Object]`,Rwe=`[object RegExp]`,zwe=`[object Set]`,Bwe=`[object String]`,Vwe=`[object WeakMap]`,Hwe=`[object ArrayBuffer]`,Uwe=`[object DataView]`,Wwe=`[object Float32Array]`,Gwe=`[object Float64Array]`,Kwe=`[object Int8Array]`,qwe=`[object Int16Array]`,Jwe=`[object Int32Array]`,Ywe=`[object Uint8Array]`,Xwe=`[object Uint8ClampedArray]`,Zwe=`[object Uint16Array]`,Qwe=`[object Uint32Array]`,hy={},hy[Wwe]=hy[Gwe]=hy[Kwe]=hy[qwe]=hy[Jwe]=hy[Ywe]=hy[Xwe]=hy[Zwe]=hy[Qwe]=!0,hy[kwe]=hy[Awe]=hy[Hwe]=hy[jwe]=hy[Uwe]=hy[Mwe]=hy[Nwe]=hy[Pwe]=hy[Fwe]=hy[Iwe]=hy[Lwe]=hy[Rwe]=hy[zwe]=hy[Bwe]=hy[Vwe]=!1}));function gy(e){return function(t){return e(t)}}var _y=o((()=>{})),vy,yy,by,xy,Sy=o((()=>{qSe(),vy=typeof exports==`object`&&exports&&!exports.nodeType&&exports,yy=vy&&typeof module==`object`&&module&&!module.nodeType&&module,by=yy&&yy.exports===vy&&W_.process,xy=function(){try{return yy&&yy.require&&yy.require(`util`).types||by&&by.binding&&by.binding(`util`)}catch{}}()})),Cy,wy,Ty=o((()=>{$we(),_y(),Sy(),Cy=xy&&xy.isTypedArray,wy=Cy?gy(Cy):Owe}));function eTe(e,t){var n=ov(e),r=!n&&cy(e),i=!n&&!r&&py(e),a=!n&&!r&&!i&&wy(e),o=n||r||i||a,s=o?ywe(e.length,String):[],l=s.length;for(var u in e)(t||tTe.call(e,u))&&!(o&&(u==`length`||i&&(u==`offset`||u==`parent`)||a&&(u==`buffer`||u==`byteLength`||u==`byteOffset`)||Bv(u,l)))&&s.push(u);return s}var tTe,nTe=o((()=>{bwe(),ly(),sv(),my(),Vv(),Ty(),tTe=Object.prototype.hasOwnProperty}));function rTe(e,t){return function(n){return e(t(n))}}var iTe=o((()=>{})),aTe,oTe=o((()=>{iTe(),aTe=rTe(Object.keys,Object)}));function sTe(e){if(!ay(e))return aTe(e);var t=[];for(var n in Object(e))cTe.call(e,n)&&n!=`constructor`&&t.push(n);return t}var cTe,Ey=o((()=>{oy(),oTe(),cTe=Object.prototype.hasOwnProperty}));function Dy(e){return ey(e)?eTe(e):sTe(e)}var Oy=o((()=>{nTe(),Ey(),ty()})),lTe,ky,uTe=o((()=>{qv(),Yv(),iy(),ty(),oy(),Oy(),lTe=Object.prototype.hasOwnProperty,ky=_we(function(e,t){if(ay(t)||ey(t)){Jv(t,Dy(t),e);return}for(var n in t)lTe.call(t,n)&&Kv(e,n,t[n])})}));function dTe(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var fTe=o((()=>{}));function pTe(e){if(!uv(e))return dTe(e);var t=ay(e),n=[];for(var r in e)(r!=`constructor`||!t&&mTe.call(e,r))&&n.push(r);return n}var mTe,hTe=o((()=>{dv(),oy(),fTe(),mTe=Object.prototype.hasOwnProperty}));function Ay(e){return ey(e)?eTe(e,!0):pTe(e)}var jy=o((()=>{nTe(),hTe(),ty()}));function My(e,t){if(ov(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||nv(e)?!0:_Te.test(e)||!gTe.test(e)||t!=null&&e in Object(t)}var gTe,_Te,Ny=o((()=>{sv(),rv(),gTe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_Te=/^\w*$/})),Py,Fy=o((()=>{Ev(),Py=Tv(Object,`create`)}));function vTe(){this.__data__=Py?Py(null):{},this.size=0}var yTe=o((()=>{Fy()}));function bTe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var xTe=o((()=>{}));function STe(e){var t=this.__data__;if(Py){var n=t[e];return n===CTe?void 0:n}return wTe.call(t,e)?t[e]:void 0}var CTe,wTe,TTe=o((()=>{Fy(),CTe=`__lodash_hash_undefined__`,wTe=Object.prototype.hasOwnProperty}));function ETe(e){var t=this.__data__;return Py?t[e]!==void 0:DTe.call(t,e)}var DTe,OTe=o((()=>{Fy(),DTe=Object.prototype.hasOwnProperty}));function kTe(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=Py&&t===void 0?ATe:t,this}var ATe,jTe=o((()=>{Fy(),ATe=`__lodash_hash_undefined__`}));function Iy(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var MTe=o((()=>{yTe(),xTe(),TTe(),OTe(),jTe(),Iy.prototype.clear=vTe,Iy.prototype.delete=bTe,Iy.prototype.get=STe,Iy.prototype.has=ETe,Iy.prototype.set=kTe}));function NTe(){this.__data__=[],this.size=0}var PTe=o((()=>{}));function Ly(e,t){for(var n=e.length;n--;)if(Wv(e[n][0],t))return n;return-1}var Ry=o((()=>{Gv()}));function FTe(e){var t=this.__data__,n=Ly(t,e);return n<0?!1:(n==t.length-1?t.pop():ITe.call(t,n,1),--this.size,!0)}var ITe,LTe=o((()=>{Ry(),ITe=Array.prototype.splice}));function RTe(e){var t=this.__data__,n=Ly(t,e);return n<0?void 0:t[n][1]}var zTe=o((()=>{Ry()}));function BTe(e){return Ly(this.__data__,e)>-1}var VTe=o((()=>{Ry()}));function HTe(e,t){var n=this.__data__,r=Ly(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var UTe=o((()=>{Ry()}));function zy(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var By=o((()=>{PTe(),LTe(),zTe(),VTe(),UTe(),zy.prototype.clear=NTe,zy.prototype.delete=FTe,zy.prototype.get=RTe,zy.prototype.has=BTe,zy.prototype.set=HTe})),Vy,Hy=o((()=>{Ev(),K_(),Vy=Tv(G_,`Map`)}));function WTe(){this.size=0,this.__data__={hash:new Iy,map:new(Vy||zy),string:new Iy}}var GTe=o((()=>{MTe(),By(),Hy()}));function KTe(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}var qTe=o((()=>{}));function Uy(e,t){var n=e.__data__;return KTe(t)?n[typeof t==`string`?`string`:`hash`]:n.map}var Wy=o((()=>{qTe()}));function JTe(e){var t=Uy(this,e).delete(e);return this.size-=+!!t,t}var YTe=o((()=>{Wy()}));function XTe(e){return Uy(this,e).get(e)}var ZTe=o((()=>{Wy()}));function QTe(e){return Uy(this,e).has(e)}var $Te=o((()=>{Wy()}));function eEe(e,t){var n=Uy(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var tEe=o((()=>{Wy()}));function Gy(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var Ky=o((()=>{GTe(),YTe(),ZTe(),$Te(),tEe(),Gy.prototype.clear=WTe,Gy.prototype.delete=JTe,Gy.prototype.get=XTe,Gy.prototype.has=QTe,Gy.prototype.set=eEe}));function qy(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(nEe);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(qy.Cache||Gy),n}var nEe,rEe=o((()=>{Ky(),nEe=`Expected a function`,qy.Cache=Gy}));function iEe(e){var t=qy(e,function(e){return n.size===aEe&&n.clear(),e}),n=t.cache;return t}var aEe,oEe=o((()=>{rEe(),aEe=500})),sEe,cEe,lEe,uEe=o((()=>{oEe(),sEe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,cEe=/\\(\\)?/g,lEe=iEe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(sEe,function(e,n,r,i){t.push(r?i.replace(cEe,`$1`):n||e)}),t})}));function dEe(e){return e==null?``:aCe(e)}var Jy=o((()=>{sCe()}));function Yy(e,t){return ov(e)?e:My(e,t)?[e]:lEe(dEe(e))}var Xy=o((()=>{sv(),Ny(),uEe(),Jy()}));function Zy(e){if(typeof e==`string`||nv(e))return e;var t=e+``;return t==`0`&&1/e==-fEe?`-0`:t}var fEe,Qy=o((()=>{rv(),fEe=1/0}));function $y(e,t){t=Yy(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Zy(t[n++])];return n&&n==r?e:void 0}var eb=o((()=>{Xy(),Qy()}));function pEe(e,t,n){var r=e==null?void 0:$y(e,t);return r===void 0?n:r}var mEe=o((()=>{eb()}));function tb(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var nb=o((()=>{}));function hEe(e){return ov(e)||cy(e)||!!(rb&&e&&e[rb])}var rb,gEe=o((()=>{J_(),ly(),sv(),rb=q_?q_.isConcatSpreadable:void 0}));function ib(e,t,n,r,i){var a=-1,o=e.length;for(n||=hEe,i||=[];++a<o;){var s=e[a];t>0&&n(s)?t>1?ib(s,t-1,n,r,i):tb(i,s):r||(i[i.length]=s)}return i}var ab=o((()=>{nb(),gEe()}));function ob(e){return e!=null&&e.length?ib(e,1):[]}var _Ee=o((()=>{ab()}));function vEe(e){return Nv(pwe(e,void 0,ob),e+``)}var yEe=o((()=>{_Ee(),mwe(),Pv()})),sb,cb=o((()=>{iTe(),sb=rTe(Object.getPrototypeOf,Object)}));function bEe(e){if(!ev(e)||Z_(e)!=xEe)return!1;var t=sb(e);if(t===null)return!0;var n=wEe.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&lb.call(n)==TEe}var xEe,SEe,CEe,lb,wEe,TEe,EEe=o((()=>{$_(),cb(),tv(),xEe=`[object Object]`,SEe=Function.prototype,CEe=Object.prototype,lb=SEe.toString,wEe=CEe.hasOwnProperty,TEe=lb.call(Object)}));function DEe(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}var ub=o((()=>{})),OEe=o((()=>{}));function kEe(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}var AEe=o((()=>{}));function jEe(){this.__data__=new zy,this.size=0}var MEe=o((()=>{By()}));function NEe(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var PEe=o((()=>{}));function FEe(e){return this.__data__.get(e)}var IEe=o((()=>{}));function LEe(e){return this.__data__.has(e)}var REe=o((()=>{}));function zEe(e,t){var n=this.__data__;if(n instanceof zy){var r=n.__data__;if(!Vy||r.length<BEe-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Gy(r)}return n.set(e,t),this.size=n.size,this}var BEe,VEe=o((()=>{By(),Hy(),Ky(),BEe=200}));function db(e){var t=this.__data__=new zy(e);this.size=t.size}var fb=o((()=>{By(),MEe(),PEe(),IEe(),REe(),VEe(),db.prototype.clear=jEe,db.prototype.delete=NEe,db.prototype.get=FEe,db.prototype.has=LEe,db.prototype.set=zEe}));function HEe(e,t){return e&&Jv(t,Dy(t),e)}var UEe=o((()=>{Yv(),Oy()}));function WEe(e,t){return e&&Jv(t,Ay(t),e)}var GEe=o((()=>{Yv(),jy()}));function KEe(e,t){if(t)return e.slice();var n=e.length,r=gb?gb(n):new e.constructor(n);return e.copy(r),r}var pb,mb,hb,gb,qEe=o((()=>{K_(),pb=typeof exports==`object`&&exports&&!exports.nodeType&&exports,mb=pb&&typeof module==`object`&&module&&!module.nodeType&&module,hb=mb&&mb.exports===pb?G_.Buffer:void 0,gb=hb?hb.allocUnsafe:void 0}));function _b(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}var vb=o((()=>{}));function JEe(){return[]}var yb=o((()=>{})),YEe,bb,xb,Sb=o((()=>{vb(),yb(),YEe=Object.prototype.propertyIsEnumerable,bb=Object.getOwnPropertySymbols,xb=bb?function(e){return e==null?[]:(e=Object(e),_b(bb(e),function(t){return YEe.call(e,t)}))}:JEe}));function XEe(e,t){return Jv(e,xb(e),t)}var ZEe=o((()=>{Yv(),Sb()})),Cb,QEe=o((()=>{nb(),cb(),Sb(),yb(),Cb=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)tb(t,xb(e)),e=sb(e);return t}:JEe}));function $Ee(e,t){return Jv(e,Cb(e),t)}var eDe=o((()=>{Yv(),QEe()}));function tDe(e,t,n){var r=t(e);return ov(e)?r:tb(r,n(e))}var nDe=o((()=>{nb(),sv()}));function wb(e){return tDe(e,Dy,xb)}var rDe=o((()=>{nDe(),Sb(),Oy()}));function iDe(e){return tDe(e,Ay,Cb)}var Tb=o((()=>{nDe(),QEe(),jy()})),Eb,aDe=o((()=>{Ev(),K_(),Eb=Tv(G_,`DataView`)})),Db,oDe=o((()=>{Ev(),K_(),Db=Tv(G_,`Promise`)})),Ob,sDe=o((()=>{Ev(),K_(),Ob=Tv(G_,`Set`)})),kb,cDe,Ab,jb,Mb,Nb,lDe,uDe,dDe,fDe,pDe,Pb,Fb,Ib=o((()=>{aDe(),Hy(),oDe(),sDe(),VCe(),$_(),kCe(),kb=`[object Map]`,cDe=`[object Object]`,Ab=`[object Promise]`,jb=`[object Set]`,Mb=`[object WeakMap]`,Nb=`[object DataView]`,lDe=wv(Eb),uDe=wv(Vy),dDe=wv(Db),fDe=wv(Ob),pDe=wv(Dv),Pb=Z_,(Eb&&Pb(new Eb(new ArrayBuffer(1)))!=Nb||Vy&&Pb(new Vy)!=kb||Db&&Pb(Db.resolve())!=Ab||Ob&&Pb(new Ob)!=jb||Dv&&Pb(new Dv)!=Mb)&&(Pb=function(e){var t=Z_(e),n=t==cDe?e.constructor:void 0,r=n?wv(n):``;if(r)switch(r){case lDe:return Nb;case uDe:return kb;case dDe:return Ab;case fDe:return jb;case pDe:return Mb}return t}),Fb=Pb}));function mDe(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&hDe.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}var hDe,gDe=o((()=>{hDe=Object.prototype.hasOwnProperty})),Lb,_De=o((()=>{K_(),Lb=G_.Uint8Array}));function Rb(e){var t=new e.constructor(e.byteLength);return new Lb(t).set(new Lb(e)),t}var zb=o((()=>{_De()}));function vDe(e,t){var n=t?Rb(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var yDe=o((()=>{zb()}));function bDe(e){var t=new e.constructor(e.source,xDe.exec(e));return t.lastIndex=e.lastIndex,t}var xDe,SDe=o((()=>{xDe=/\w*$/}));function CDe(e){return Vb?Object(Vb.call(e)):{}}var Bb,Vb,wDe=o((()=>{J_(),Bb=q_?q_.prototype:void 0,Vb=Bb?Bb.valueOf:void 0}));function TDe(e,t){var n=t?Rb(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var EDe=o((()=>{zb()}));function DDe(e,t,n){var r=e.constructor;switch(t){case IDe:return Rb(e);case ODe:case kDe:return new r(+e);case LDe:return vDe(e,n);case RDe:case zDe:case BDe:case VDe:case HDe:case UDe:case WDe:case GDe:case KDe:return TDe(e,n);case ADe:return new r;case jDe:case PDe:return new r(e);case MDe:return bDe(e);case NDe:return new r;case FDe:return CDe(e)}}var ODe,kDe,ADe,jDe,MDe,NDe,PDe,FDe,IDe,LDe,RDe,zDe,BDe,VDe,HDe,UDe,WDe,GDe,KDe,qDe=o((()=>{zb(),yDe(),SDe(),wDe(),EDe(),ODe=`[object Boolean]`,kDe=`[object Date]`,ADe=`[object Map]`,jDe=`[object Number]`,MDe=`[object RegExp]`,NDe=`[object Set]`,PDe=`[object String]`,FDe=`[object Symbol]`,IDe=`[object ArrayBuffer]`,LDe=`[object DataView]`,RDe=`[object Float32Array]`,zDe=`[object Float64Array]`,BDe=`[object Int8Array]`,VDe=`[object Int16Array]`,HDe=`[object Int32Array]`,UDe=`[object Uint8Array]`,WDe=`[object Uint8ClampedArray]`,GDe=`[object Uint16Array]`,KDe=`[object Uint32Array]`}));function JDe(e){return typeof e.constructor==`function`&&!ay(e)?HCe(sb(e)):{}}var YDe=o((()=>{UCe(),cb(),oy()}));function XDe(e){return ev(e)&&Fb(e)==ZDe}var ZDe,QDe=o((()=>{Ib(),tv(),ZDe=`[object Map]`})),Hb,$De,eOe=o((()=>{QDe(),_y(),Sy(),Hb=xy&&xy.isMap,$De=Hb?gy(Hb):XDe}));function tOe(e){return ev(e)&&Fb(e)==nOe}var nOe,rOe=o((()=>{Ib(),tv(),nOe=`[object Set]`})),Ub,iOe,aOe=o((()=>{rOe(),_y(),Sy(),Ub=xy&&xy.isSet,iOe=Ub?gy(Ub):tOe}));function Wb(e,t,n,r,i,a){var o,s=t&oOe,l=t&sOe,u=t&cOe;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!uv(e))return e;var d=ov(e);if(d){if(o=mDe(e),!s)return qCe(e,o)}else{var f=Fb(e),p=f==Kb||f==pOe;if(py(e))return KEe(e,s);if(f==qb||f==Gb||p&&!i){if(o=l||p?{}:JDe(e),!s)return l?$Ee(e,WEe(o,e)):XEe(e,HEe(o,e))}else{if(!Jb[f])return i?e:{};o=DDe(e,f,s)}}a||=new db;var m=a.get(e);if(m)return m;a.set(e,o),iOe(e)?e.forEach(function(r){o.add(Wb(r,t,n,r,e,a))}):$De(e)&&e.forEach(function(r,i){o.set(i,Wb(r,t,n,i,e,a))});var h=d?void 0:(u?l?iDe:wb:l?Ay:Dy)(e);return rwe(h||e,function(r,i){h&&(i=r,r=e[i]),Kv(o,i,Wb(r,t,n,i,e,a))}),o}var oOe,sOe,cOe,Gb,lOe,uOe,dOe,fOe,Kb,pOe,mOe,hOe,qb,gOe,_Oe,vOe,yOe,bOe,xOe,SOe,COe,wOe,TOe,EOe,DOe,OOe,kOe,AOe,jOe,Jb,Yb=o((()=>{fb(),Fv(),qv(),UEe(),GEe(),qEe(),Av(),ZEe(),eDe(),rDe(),Tb(),Ib(),gDe(),qDe(),YDe(),sv(),my(),eOe(),dv(),aOe(),Oy(),jy(),oOe=1,sOe=2,cOe=4,Gb=`[object Arguments]`,lOe=`[object Array]`,uOe=`[object Boolean]`,dOe=`[object Date]`,fOe=`[object Error]`,Kb=`[object Function]`,pOe=`[object GeneratorFunction]`,mOe=`[object Map]`,hOe=`[object Number]`,qb=`[object Object]`,gOe=`[object RegExp]`,_Oe=`[object Set]`,vOe=`[object String]`,yOe=`[object Symbol]`,bOe=`[object WeakMap]`,xOe=`[object ArrayBuffer]`,SOe=`[object DataView]`,COe=`[object Float32Array]`,wOe=`[object Float64Array]`,TOe=`[object Int8Array]`,EOe=`[object Int16Array]`,DOe=`[object Int32Array]`,OOe=`[object Uint8Array]`,kOe=`[object Uint8ClampedArray]`,AOe=`[object Uint16Array]`,jOe=`[object Uint32Array]`,Jb={},Jb[Gb]=Jb[lOe]=Jb[xOe]=Jb[SOe]=Jb[uOe]=Jb[dOe]=Jb[COe]=Jb[wOe]=Jb[TOe]=Jb[EOe]=Jb[DOe]=Jb[mOe]=Jb[hOe]=Jb[qb]=Jb[gOe]=Jb[_Oe]=Jb[vOe]=Jb[yOe]=Jb[OOe]=Jb[kOe]=Jb[AOe]=Jb[jOe]=!0,Jb[fOe]=Jb[Kb]=Jb[bOe]=!1}));function Xb(e){return Wb(e,MOe)}var MOe,NOe=o((()=>{Yb(),MOe=4}));function POe(e){return Wb(e,FOe|IOe)}var FOe,IOe,LOe=o((()=>{Yb(),FOe=1,IOe=4}));function Zb(e){for(var t=-1,n=e==null?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i}var ROe=o((()=>{}));function zOe(e){return this.__data__.set(e,BOe),this}var BOe,VOe=o((()=>{BOe=`__lodash_hash_undefined__`}));function HOe(e){return this.__data__.has(e)}var UOe=o((()=>{}));function Qb(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Gy;++t<n;)this.add(e[t])}var $b=o((()=>{Ky(),VOe(),UOe(),Qb.prototype.add=Qb.prototype.push=zOe,Qb.prototype.has=HOe}));function WOe(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var ex=o((()=>{}));function tx(e,t){return e.has(t)}var nx=o((()=>{}));function GOe(e,t,n,r,i,a){var o=n&KOe,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var u=a.get(e),d=a.get(t);if(u&&d)return u==t&&d==e;var f=-1,p=!0,m=n&qOe?new Qb:void 0;for(a.set(e,t),a.set(t,e);++f<s;){var h=e[f],g=t[f];if(r)var _=o?r(g,h,f,t,e,a):r(h,g,f,e,t,a);if(_!==void 0){if(_)continue;p=!1;break}if(m){if(!WOe(t,function(e,t){if(!tx(m,t)&&(h===e||i(h,e,n,r,a)))return m.push(t)})){p=!1;break}}else if(!(h===g||i(h,g,n,r,a))){p=!1;break}}return a.delete(e),a.delete(t),p}var KOe,qOe,JOe=o((()=>{$b(),ex(),nx(),KOe=1,qOe=2}));function YOe(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}var XOe=o((()=>{}));function rx(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var ix=o((()=>{}));function ZOe(e,t,n,r,i,a,o){switch(n){case uke:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case lke:return!(e.byteLength!=t.byteLength||!a(new Lb(e),new Lb(t)));case eke:case tke:case ike:return Wv(+e,+t);case nke:return e.name==t.name&&e.message==t.message;case ake:case ske:return e==t+``;case rke:var s=YOe;case oke:var l=r&QOe;if(s||=rx,e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;r|=$Oe,o.set(e,t);var d=GOe(s(e),s(t),r,i,a,o);return o.delete(e),d;case cke:if(ox)return ox.call(e)==ox.call(t)}return!1}var QOe,$Oe,eke,tke,nke,rke,ike,ake,oke,ske,cke,lke,uke,ax,ox,dke=o((()=>{J_(),_De(),Gv(),JOe(),XOe(),ix(),QOe=1,$Oe=2,eke=`[object Boolean]`,tke=`[object Date]`,nke=`[object Error]`,rke=`[object Map]`,ike=`[object Number]`,ake=`[object RegExp]`,oke=`[object Set]`,ske=`[object String]`,cke=`[object Symbol]`,lke=`[object ArrayBuffer]`,uke=`[object DataView]`,ax=q_?q_.prototype:void 0,ox=ax?ax.valueOf:void 0}));function fke(e,t,n,r,i,a){var o=n&pke,s=wb(e),l=s.length;if(l!=wb(t).length&&!o)return!1;for(var u=l;u--;){var d=s[u];if(!(o?d in t:mke.call(t,d)))return!1}var f=a.get(e),p=a.get(t);if(f&&p)return f==t&&p==e;var m=!0;a.set(e,t),a.set(t,e);for(var h=o;++u<l;){d=s[u];var g=e[d],_=t[d];if(r)var v=o?r(_,g,d,t,e,a):r(g,_,d,e,t,a);if(!(v===void 0?g===_||i(g,_,n,r,a):v)){m=!1;break}h||=d==`constructor`}if(m&&!h){var y=e.constructor,b=t.constructor;y!=b&&`constructor`in e&&`constructor`in t&&!(typeof y==`function`&&y instanceof y&&typeof b==`function`&&b instanceof b)&&(m=!1)}return a.delete(e),a.delete(t),m}var pke,mke,hke=o((()=>{rDe(),pke=1,mke=Object.prototype.hasOwnProperty}));function gke(e,t,n,r,i,a){var o=ov(e),s=ov(t),l=o?cx:Fb(e),u=s?cx:Fb(t);l=l==sx?lx:l,u=u==sx?lx:u;var d=l==lx,f=u==lx,p=l==u;if(p&&py(e)){if(!py(t))return!1;o=!0,d=!1}if(p&&!d)return a||=new db,o||wy(e)?GOe(e,t,n,r,i,a):ZOe(e,t,l,n,r,i,a);if(!(n&_ke)){var m=d&&ux.call(e,`__wrapped__`),h=f&&ux.call(t,`__wrapped__`);if(m||h){var g=m?e.value():e,_=h?t.value():t;return a||=new db,i(g,_,n,r,a)}}return p?(a||=new db,fke(e,t,n,r,i,a)):!1}var _ke,sx,cx,lx,ux,vke=o((()=>{fb(),JOe(),dke(),hke(),Ib(),sv(),my(),Ty(),_ke=1,sx=`[object Arguments]`,cx=`[object Array]`,lx=`[object Object]`,ux=Object.prototype.hasOwnProperty}));function dx(e,t,n,r,i){return e===t?!0:e==null||t==null||!ev(e)&&!ev(t)?e!==e&&t!==t:gke(e,t,n,r,dx,i)}var yke=o((()=>{vke(),tv()}));function bke(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=n[i];var l=s[0],u=e[l],d=s[1];if(o&&s[2]){if(u===void 0&&!(l in e))return!1}else{var f=new db;if(r)var p=r(u,d,l,e,t,f);if(!(p===void 0?dx(d,u,xke|Ske,r,f):p))return!1}}return!0}var xke,Ske,Cke=o((()=>{fb(),yke(),xke=1,Ske=2}));function wke(e){return e===e&&!uv(e)}var Tke=o((()=>{dv()}));function Eke(e){for(var t=Dy(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,wke(i)]}return t}var Dke=o((()=>{Tke(),Oy()}));function Oke(e,t){return function(n){return n!=null&&n[e]===t&&(t!==void 0||e in Object(n))}}var kke=o((()=>{}));function Ake(e){var t=Eke(e);return t.length==1&&t[0][2]?Oke(t[0][0],t[0][1]):function(n){return n===e||bke(n,e,t)}}var jke=o((()=>{Cke(),Dke(),kke()}));function Mke(e,t){return e!=null&&t in Object(e)}var Nke=o((()=>{}));function Pke(e,t,n){t=Yy(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=Zy(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&hwe(i)&&Bv(o,i)&&(ov(e)||cy(e)))}var Fke=o((()=>{Xy(),ly(),sv(),Vv(),$v(),Qy()}));function Ike(e,t){return e!=null&&Pke(e,t,Mke)}var Lke=o((()=>{Nke(),Fke()}));function Rke(e,t){return My(e)&&wke(t)?Oke(Zy(e),t):function(n){var r=pEe(n,e);return r===void 0&&r===t?Ike(n,e):dx(t,r,zke|Bke)}}var zke,Bke,Vke=o((()=>{yke(),mEe(),Lke(),Ny(),Tke(),kke(),Qy(),zke=1,Bke=2}));function Hke(e){return function(t){return t?.[e]}}var Uke=o((()=>{}));function Wke(e){return function(t){return $y(t,e)}}var Gke=o((()=>{eb()}));function Kke(e){return My(e)?Hke(Zy(e)):Wke(e)}var qke=o((()=>{Uke(),Gke(),Ny(),Qy()}));function fx(e){return typeof e==`function`?e:e==null?vv:typeof e==`object`?ov(e)?Rke(e[0],e[1]):Ake(e):Kke(e)}var px=o((()=>{jke(),Vke(),yv(),sv(),qke()}));function Jke(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var Yke=o((()=>{}));function Xke(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var l=o[e?s:++i];if(n(a[l],l,a)===!1)break}return t}}var Zke=o((()=>{})),mx,Qke=o((()=>{Zke(),mx=Xke()}));function $ke(e,t){return e&&mx(e,t,Dy)}var hx=o((()=>{Qke(),Oy()}));function eAe(e,t){return function(n,r){if(n==null)return n;if(!ey(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var tAe=o((()=>{ty()})),gx,_x=o((()=>{hx(),tAe(),gx=eAe($ke)}));function nAe(e,t,n,r){return gx(e,function(e,i,a){t(r,e,n(e),a)}),r}var rAe=o((()=>{_x()}));function iAe(e,t){return function(n,r){var i=ov(n)?Jke:nAe,a=t?t():{};return i(n,e,fx(r,2),a)}}var aAe=o((()=>{Yke(),rAe(),px(),sv()})),vx,oAe=o((()=>{K_(),vx=function(){return G_.Date.now()}})),yx,sAe,bx,cAe=o((()=>{Qv(),Gv(),ry(),jy(),yx=Object.prototype,sAe=yx.hasOwnProperty,bx=Zv(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&ny(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=Ay(a),s=-1,l=o.length;++s<l;){var u=o[s],d=e[u];(d===void 0||Wv(d,yx[u])&&!sAe.call(e,u))&&(e[u]=a[u])}return e})}));function xx(e,t,n){(n!==void 0&&!Wv(e[t],n)||n===void 0&&!(t in e))&&Hv(e,t,n)}var lAe=o((()=>{Uv(),Gv()}));function Sx(e){return ev(e)&&ey(e)}var Cx=o((()=>{ty(),tv()}));function wx(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}var uAe=o((()=>{}));function dAe(e){return Jv(e,Ay(e))}var fAe=o((()=>{Yv(),jy()}));function pAe(e,t,n,r,i,a,o){var s=wx(e,n),l=wx(t,n),u=o.get(l);if(u){xx(e,n,u);return}var d=a?a(s,l,n+``,e,t,o):void 0,f=d===void 0;if(f){var p=ov(l),m=!p&&py(l),h=!p&&!m&&wy(l);d=l,p||m||h?ov(s)?d=s:Sx(s)?d=qCe(s):m?(f=!1,d=KEe(l,!0)):h?(f=!1,d=TDe(l,!0)):d=[]:bEe(l)||cy(l)?(d=s,cy(s)?d=dAe(s):(!uv(s)||bv(s))&&(d=JDe(l))):f=!1}f&&(o.set(l,d),i(d,l,r,a,o),o.delete(l)),xx(e,n,d)}var mAe=o((()=>{lAe(),qEe(),EDe(),Av(),YDe(),ly(),sv(),Cx(),my(),xv(),dv(),EEe(),Ty(),uAe(),fAe()}));function hAe(e,t,n,r,i){e!==t&&mx(t,function(a,o){if(i||=new db,uv(a))pAe(e,t,o,n,hAe,r,i);else{var s=r?r(wx(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),xx(e,o,s)}},Ay)}var gAe=o((()=>{fb(),lAe(),Qke(),mAe(),dv(),jy(),uAe()}));function _Ae(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var Tx=o((()=>{}));function vAe(e,t,n,r){var i=-1,a=lwe,o=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=iv(t,gy(n))),r?(a=_Ae,o=!1):t.length>=yAe&&(a=tx,o=!1,t=new Qb(t));outer:for(;++i<s;){var d=e[i],f=n==null?d:n(d);if(d=r||d!==0?d:0,o&&f===f){for(var p=u;p--;)if(t[p]===f)continue outer;l.push(d)}else a(t,f,r)||l.push(d)}return l}var yAe,bAe=o((()=>{$b(),zv(),Tx(),av(),_y(),nx(),yAe=200})),Ex,xAe=o((()=>{bAe(),ab(),Qv(),Cx(),Ex=Zv(function(e,t){return Sx(e)?vAe(e,ib(t,1,Sx,!0)):[]})}));function Dx(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var SAe=o((()=>{}));function Ox(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===void 0?1:gv(t),DEe(e,t<0?0:t,r)):[]}var CAe=o((()=>{ub(),_v()}));function kx(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===void 0?1:gv(t),t=r-t,DEe(e,0,t<0?0:t)):[]}var wAe=o((()=>{ub(),_v()}));function Ax(e){return typeof e==`function`?e:vv}var jx=o((()=>{yv()}));function Mx(e,t){return(ov(e)?rwe:gx)(e,Ax(t))}var TAe=o((()=>{Fv(),_x(),jx(),sv()})),EAe=o((()=>{TAe()}));function DAe(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}var OAe=o((()=>{}));function kAe(e,t){var n=!0;return gx(e,function(e,r,i){return n=!!t(e,r,i),n}),n}var AAe=o((()=>{_x()}));function Nx(e,t,n){var r=ov(e)?DAe:kAe;return n&&ny(e,t,n)&&(t=void 0),r(e,fx(t,3))}var jAe=o((()=>{OAe(),AAe(),px(),sv(),ry()}));function MAe(e,t){var n=[];return gx(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}var NAe=o((()=>{_x()}));function Px(e,t){return(ov(e)?_b:MAe)(e,fx(t,3))}var PAe=o((()=>{vb(),NAe(),px(),sv()}));function FAe(e){return function(t,n,r){var i=Object(t);if(!ey(t)){var a=fx(n,3);t=Dy(t),n=function(e){return a(i[e],e,i)}}var o=e(t,n,r);return o>-1?i[a?t[o]:o]:void 0}}var IAe=o((()=>{px(),ty(),Oy()}));function LAe(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:gv(n);return i<0&&(i=RAe(r+i,0)),iwe(e,fx(t,3),i)}var RAe,zAe=o((()=>{Iv(),px(),_v(),RAe=Math.max})),Fx,BAe=o((()=>{IAe(),zAe(),Fx=FAe(LAe)}));function Ix(e){return e&&e.length?e[0]:void 0}var VAe=o((()=>{})),HAe=o((()=>{VAe()}));function UAe(e,t){var n=-1,r=ey(e)?Array(e.length):[];return gx(e,function(e,i,a){r[++n]=t(e,i,a)}),r}var WAe=o((()=>{_x(),ty()}));function Lx(e,t){return(ov(e)?iv:UAe)(e,fx(t,3))}var GAe=o((()=>{av(),px(),WAe(),sv()}));function Rx(e,t){return ib(Lx(e,t),1)}var KAe=o((()=>{ab(),GAe()}));function qAe(e,t){return e==null?e:mx(e,Ax(t),Ay)}var JAe=o((()=>{Qke(),jx(),jy()}));function YAe(e,t){return e&&$ke(e,Ax(t))}var XAe=o((()=>{hx(),jx()})),ZAe,QAe,$Ae=o((()=>{Uv(),aAe(),ZAe=Object.prototype.hasOwnProperty,QAe=iAe(function(e,t,n){ZAe.call(e,n)?e[n].push(t):Hv(e,n,[t])})}));function eje(e,t){return e>t}var tje=o((()=>{}));function nje(e,t){return e!=null&&rje.call(e,t)}var rje,ije=o((()=>{rje=Object.prototype.hasOwnProperty}));function zx(e,t){return e!=null&&Pke(e,t,nje)}var aje=o((()=>{ije(),Fke()}));function Bx(e){return typeof e==`string`||!ov(e)&&ev(e)&&Z_(e)==oje}var oje,Vx=o((()=>{$_(),sv(),tv(),oje=`[object String]`}));function sje(e,t){return iv(t,function(t){return e[t]})}var cje=o((()=>{av()}));function Hx(e){return e==null?[]:sje(e,Dy(e))}var lje=o((()=>{cje(),Oy()}));function Ux(e,t,n,r){e=ey(e)?e:Hx(e),n=n&&!r?gv(n):0;var i=e.length;return n<0&&(n=uje(i+n,0)),Bx(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Lv(e,t,n)>-1}var uje,dje=o((()=>{Rv(),ty(),Vx(),_v(),lje(),uje=Math.max}));function fje(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:gv(n);return i<0&&(i=pje(r+i,0)),Lv(e,t,i)}var pje,mje=o((()=>{Rv(),_v(),pje=Math.max}));function Wx(e){if(e==null)return!0;if(ey(e)&&(ov(e)||typeof e==`string`||typeof e.splice==`function`||py(e)||wy(e)||cy(e)))return!e.length;var t=Fb(e);if(t==hje||t==gje)return!e.size;if(ay(e))return!sTe(e).length;for(var n in e)if(_je.call(e,n))return!1;return!0}var hje,gje,_je,vje=o((()=>{Ey(),Ib(),ly(),sv(),ty(),my(),oy(),Ty(),hje=`[object Map]`,gje=`[object Set]`,_je=Object.prototype.hasOwnProperty}));function yje(e){return ev(e)&&Z_(e)==bje}var bje,xje=o((()=>{$_(),tv(),bje=`[object RegExp]`})),Gx,Kx,Sje=o((()=>{xje(),_y(),Sy(),Gx=xy&&xy.isRegExp,Kx=Gx?gy(Gx):yje}));function qx(e){return e===void 0}var Cje=o((()=>{}));function wje(e,t){return e<t}var Jx=o((()=>{}));function Yx(e,t){var n={};return t=fx(t,3),$ke(e,function(e,r,i){Hv(n,r,t(e,r,i))}),n}var Tje=o((()=>{Uv(),hx(),px()}));function Xx(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],o=t(a);if(o!=null&&(s===void 0?o===o&&!nv(o):n(o,s)))var s=o,l=a}return l}var Zx=o((()=>{rv()}));function Qx(e){return e&&e.length?Xx(e,vv,eje):void 0}var Eje=o((()=>{Zx(),tje(),yv()})),$x,Dje=o((()=>{gAe(),iy(),$x=_we(function(e,t,n){hAe(e,t,n)})}));function eS(e){return e&&e.length?Xx(e,vv,wje):void 0}var Oje=o((()=>{Zx(),Jx(),yv()}));function tS(e,t){return e&&e.length?Xx(e,fx(t,2),wje):void 0}var kje=o((()=>{Zx(),px(),Jx()}));function Aje(e){if(typeof e!=`function`)throw TypeError(jje);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var jje,Mje=o((()=>{jje=`Expected a function`}));function Nje(e,t,n,r){if(!uv(e))return e;t=Yy(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var l=Zy(t[i]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(i!=o){var d=s[l];u=r?r(d,l,s):void 0,u===void 0&&(u=uv(d)?d:Bv(t[i+1])?[]:{})}Kv(s,l,u),s=s[l]}return e}var Pje=o((()=>{qv(),Xy(),Vv(),dv(),Qy()}));function Fje(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=$y(e,o);n(s,o)&&Nje(a,Yy(o,e),s)}return a}var Ije=o((()=>{eb(),Pje(),Xy()}));function nS(e,t){if(e==null)return{};var n=iv(iDe(e),function(e){return[e]});return t=fx(t),Fje(e,n,function(e,n){return t(e,n[0])})}var Lje=o((()=>{av(),px(),Ije(),Tb()}));function Rje(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}var zje=o((()=>{}));function Bje(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=nv(e),o=t!==void 0,s=t===null,l=t===t,u=nv(t);if(!s&&!u&&!a&&e>t||a&&o&&l&&!s&&!u||r&&o&&l||!n&&l||!i)return 1;if(!r&&!a&&!u&&e<t||u&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!l)return-1}return 0}var Vje=o((()=>{rv()}));function Hje(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var l=Bje(i[r],a[r]);if(l)return r>=s?l:l*(n[r]==`desc`?-1:1)}return e.index-t.index}var Uje=o((()=>{Vje()}));function Wje(e,t,n){t=t.length?iv(t,function(e){return ov(e)?function(t){return $y(t,e.length===1?e[0]:e)}:e}):[vv];var r=-1;return t=iv(t,gy(fx)),Rje(UAe(e,function(e,n,i){return{criteria:iv(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return Hje(e,t,n)})}var Gje=o((()=>{av(),eb(),px(),WAe(),zje(),_y(),Uje(),yv(),sv()})),Kje=o((()=>{Uke()})),rS,qje,Jje,Yje,iS,aS,Xje,oS,sS,cS,Zje,lS,uS,Qje,$je,eMe,tMe=o((()=>{rS=`\\ud800-\\udfff`,qje=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Jje=`\\ufe0e\\ufe0f`,Yje=`[`+rS+`]`,iS=`[`+qje+`]`,aS=`\\ud83c[\\udffb-\\udfff]`,Xje=`(?:`+iS+`|`+aS+`)`,oS=`[^`+rS+`]`,sS=`(?:\\ud83c[\\udde6-\\uddff]){2}`,cS=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Zje=`\\u200d`,lS=Xje+`?`,uS=`[`+Jje+`]?`,Qje=`(?:`+Zje+`(?:`+[oS,sS,cS].join(`|`)+`)`+uS+lS+`)*`,$je=uS+lS+Qje,eMe=`(?:`+[oS+iS+`?`,iS,sS,cS,Yje].join(`|`)+`)`,RegExp(aS+`(?=`+aS+`)|`+eMe+$je,`g`)})),nMe=o((()=>{Kje(),OEe(),tMe()}));function rMe(e,t){return Fje(e,t,function(t,n){return Ike(e,n)})}var iMe=o((()=>{Ije(),Lke()})),dS,aMe=o((()=>{iMe(),yEe(),dS=vEe(function(e,t){return e==null?{}:rMe(e,t)})}));function oMe(e,t,n,r){for(var i=-1,a=cMe(sMe((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}var sMe,cMe,lMe=o((()=>{sMe=Math.ceil,cMe=Math.max}));function uMe(e){return function(t,n,r){return r&&typeof r!=`number`&&ny(t,n,r)&&(n=r=void 0),t=pv(t),n===void 0?(n=t,t=0):n=pv(n),r=r===void 0?t<n?1:-1:pv(r),oMe(t,n,r,e)}}var dMe=o((()=>{lMe(),ry(),hv()})),fS,fMe=o((()=>{dMe(),fS=uMe()}));function pMe(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}var mMe=o((()=>{}));function pS(e,t,n){var r=ov(e)?kEe:pMe,i=arguments.length<3;return r(e,fx(t,4),n,i,gx)}var hMe=o((()=>{AEe(),_x(),px(),mMe(),sv()}));function mS(e,t){return(ov(e)?_b:MAe)(e,Aje(fx(t,3)))}var gMe=o((()=>{vb(),NAe(),px(),sv(),Mje()})),_Me=o((()=>{Ey(),Ib(),ty(),Vx(),nMe()}));function vMe(e,t){var n;return gx(e,function(e,r,i){return n=t(e,r,i),!n}),!!n}var yMe=o((()=>{_x()}));function bMe(e,t,n){var r=ov(e)?WOe:vMe;return n&&ny(e,t,n)&&(t=void 0),r(e,fx(t,3))}var xMe=o((()=>{ex(),px(),yMe(),sv(),ry()})),hS,SMe=o((()=>{ab(),Gje(),Qv(),ry(),hS=Zv(function(e,t){if(e==null)return[];var n=t.length;return n>1&&ny(e,t[0],t[1])?t=[]:n>2&&ny(t[0],t[1],t[2])&&(t=[t[0]]),Wje(e,ib(t,1),[])})})),CMe,wMe=o((()=>{sDe(),KCe(),ix(),CMe=Ob&&1/rx(new Ob([,-0]))[1]==1/0?function(e){return new Ob(e)}:kv}));function TMe(e,t,n){var r=-1,i=lwe,a=e.length,o=!0,s=[],l=s;if(n)o=!1,i=_Ae;else if(a>=EMe){var u=t?null:CMe(e);if(u)return rx(u);o=!1,i=tx,l=new Qb}else l=t?[]:s;outer:for(;++r<a;){var d=e[r],f=t?t(d):d;if(d=n||d!==0?d:0,o&&f===f){for(var p=l.length;p--;)if(l[p]===f)continue outer;t&&l.push(f),s.push(d)}else i(l,f,n)||(l!==s&&l.push(f),s.push(d))}return s}var EMe,gS=o((()=>{$b(),zv(),Tx(),nx(),wMe(),ix(),EMe=200})),DMe,OMe=o((()=>{ab(),Qv(),gS(),Cx(),DMe=Zv(function(e){return TMe(ib(e,1,Sx,!0))})}));function _S(e){return e&&e.length?TMe(e):[]}var kMe=o((()=>{gS()}));function vS(e){var t=++AMe;return dEe(e)+t}var AMe,jMe=o((()=>{Jy(),AMe=0}));function MMe(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}var NMe=o((()=>{}));function PMe(e,t){return MMe(e||[],t||[],Kv)}var FMe=o((()=>{qv(),NMe()})),yS=o((()=>{rv(),sCe(),_v(),yv(),VCe(),UCe(),dv(),K_(),GCe(),KCe(),sv(),tv(),Av(),QCe(),Pv(),Fv(),zv(),Vv(),uTe(),Yv(),iy(),jy(),Oy(),mEe(),yEe(),Qv(),$_(),EEe(),Uv(),Qy(),Jy(),ub(),OEe(),AEe(),yCe(),ry(),NOe(),LOe(),Yb(),ROe(),nb(),ab(),av(),px(),$Ce(),aAe(),UEe(),oAe(),cAe(),gAe(),xAe(),bAe(),Cx(),SAe(),CAe(),wAe(),EAe(),Zke(),tAe(),jx(),Ib(),XOe(),Gv(),jAe(),PAe(),BAe(),zAe(),hx(),IAe(),Iv(),HAe(),KAe(),GAe(),_Ee(),TAe(),JAe(),XAe(),vb(),xv(),$Ae(),tje(),aje(),Lke(),VAe(),hv(),dje(),mje(),$b(),Tx(),_y(),nx(),Xy(),eb(),_x(),ty(),ly(),Sy(),my(),vje(),yke(),$v(),eOe(),Cke(),Dke(),RCe(),TCe(),Dwe(),Sje(),aOe(),Vx(),Ty(),Cje(),owe(),Jx(),Tje(),jke(),Vke(),Eje(),Zx(),rEe(),Dje(),Oje(),kje(),Mje(),J_(),ix(),lje(),Tb(),Lje(),Gje(),OAe(),ex(),nMe(),aMe(),qke(),Rv(),Vje(),fMe(),dMe(),hMe(),mMe(),gMe(),Pje(),_Me(),xMe(),SMe(),yb(),cje(),bwe(),uEe(),fAe(),cb(),pCe(),uCe(),OMe(),gS(),kMe(),jMe(),Uke(),FMe(),NMe()}));function IMe(e,t){e[t]?e[t]++:e[t]=1}function LMe(e,t){--e[t]||delete e[t]}function bS(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+CS+a+CS+(qx(r)?zMe:r)}function RMe(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function xS(e,t){return bS(e,t.v,t.w,t.name)}var zMe,SS,CS,wS,BMe=o((()=>{yS(),zMe=`\0`,SS=`\0`,CS=``,wS=class{constructor(e={}){this._isDirected=!Object.prototype.hasOwnProperty.call(e,`directed`)||e.directed,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,`compound`)?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=jv(void 0),this._defaultEdgeLabelFn=jv(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[SS]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return bv(e)||(e=jv(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Dy(this._nodes)}sources(){var e=this;return Px(this.nodes(),function(t){return Wx(e._in[t])})}sinks(){var e=this;return Px(this.nodes(),function(t){return Wx(e._out[t])})}setNodes(e,t){var n=arguments,r=this;return Mx(e,function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=SS,this._children[e]={},this._children[SS][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],Mx(this.children(e),e=>{this.setParent(e)}),delete this._children[e]),Mx(Dy(this._in[e]),t),delete this._in[e],delete this._preds[e],Mx(Dy(this._out[e]),t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(qx(t))t=SS;else{t+=``;for(var n=t;!qx(n);n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==SS)return t}}children(e){if(qx(e)&&(e=SS),this._isCompound){var t=this._children[e];if(t)return Dy(t)}else if(e===SS)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return Dy(t)}successors(e){var t=this._sucs[e];if(t)return Dy(t)}neighbors(e){var t=this.predecessors(e);if(t)return DMe(t,this.successors(e))}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Mx(this._nodes,function(n,r){e(r)&&t.setNode(r,n)}),Mx(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&Mx(t.nodes(),function(e){t.setParent(e,i(e))}),t}setDefaultEdgeLabel(e){return bv(e)||(e=jv(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Hx(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return pS(e,function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,r,i=!1,a=arguments[0];typeof a==`object`&&a&&`v`in a?(e=a.v,t=a.w,n=a.name,arguments.length===2&&(r=arguments[1],i=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),e=``+e,t=``+t,qx(n)||(n=``+n);var o=bS(this._isDirected,e,t,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return i&&(this._edgeLabels[o]=r),this;if(!qx(n)&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[o]=i?r:this._defaultEdgeLabelFn(e,t,n);var s=RMe(this._isDirected,e,t,n);return e=s.v,t=s.w,Object.freeze(s),this._edgeObjs[o]=s,IMe(this._preds[t],e),IMe(this._sucs[e],t),this._in[t][o]=s,this._out[e][o]=s,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?xS(this._isDirected,arguments[0]):bS(this._isDirected,e,t,n);return this._edgeLabels[r]}hasEdge(e,t,n){var r=arguments.length===1?xS(this._isDirected,arguments[0]):bS(this._isDirected,e,t,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?xS(this._isDirected,arguments[0]):bS(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],LMe(this._preds[t],e),LMe(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=Hx(n);return t?Px(r,function(e){return e.v===t}):r}}outEdges(e,t){var n=this._out[e];if(n){var r=Hx(n);return t?Px(r,function(e){return e.w===t}):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}},wS.prototype._nodeCount=0,wS.prototype._edgeCount=0})),TS=o((()=>{BMe()})),VMe=l({captureNodeSizes:()=>GMe,shouldCaptureSizes:()=>HMe});function ES(){if(typeof globalThis<`u`)return globalThis}function HMe(){return!!ES()?.mermaidCaptureSizes}function UMe(){return typeof location>`u`?`browser-dev`:`${location.pathname}${location.search}`}function WMe(e,t){let n=ES();if(!n)return;let r=t.node(),i=((r&&`ownerSVGElement`in r?r.ownerSVGElement:null)??r)?.id??`(unknown)`;n.mermaidCapturedSizes??=[];let a={svgId:i,sizes:e};n.mermaidCapturedSizes.push(a),n.mermaidLastCapturedSizes=a}function GMe(e,t){let n=[];for(let e of t.nodes)e.isGroup||n.push({id:e.id,width:e.width??0,height:e.height??0});n.length!==0&&WMe({metadata:{captureVersion:KMe,capturedAt:new Date().toISOString(),capturedFrom:UMe()},nodes:n},e)}var KMe,qMe=o((()=>{h(),KMe=1,p(ES,`getCaptureGlobal`),p(HMe,`shouldCaptureSizes`),p(UMe,`capturedFromLocation`),p(WMe,`emitCapturedSizes`),p(GMe,`captureNodeSizes`)}));function DS(e,{edgePathsClass:t=`edges edgePaths`}={}){let n=e.insert(`g`).attr(`class`,`root`);return{clusters:n.insert(`g`).attr(`class`,`clusters`),edgePaths:n.insert(`g`).attr(`class`,t),edgeLabels:n.insert(`g`).attr(`class`,`edgeLabels`),nodes:n.insert(`g`).attr(`class`,`nodes`),rootGroups:n}}async function JMe(e,t,n){if(t.label){let{shapeSvg:r,bbox:i}=await Fg(e,n===void 0?t:{...t,width:n});t.labelBBox={width:i.width,height:i.height},r.remove()}else t.labelBBox={width:0,height:0}}async function OS(e,t,n){let r=await g_(e,t,n),i=r.node()?.getBBox()??{width:0,height:0};return t.width=i.width,t.height=i.height,r}function YMe(e,t,n){let r=e,i=new Set;for(;r;){if(r.dir)return r.dir;if(!r.parentId||i.has(r.parentId))break;i.add(r.parentId),r=t.get(r.parentId)}return n}async function XMe(e,t,n={}){let r=new wS({multigraph:!0,compound:!0}),i=[...t.edges],a=Ns(),o=DS(e),{edgeLabels:s,nodes:l}=o,u=new Map,d=new Map(t.nodes.map(e=>[e.id,e])),f=t.direction,p=e.node()!=null;await Promise.all(t.nodes.map(async e=>{if(e.isGroup){if(p){let t=n.unwrapGroupLabels&&e.labelType!==`markdown`;await JMe(l,e,t?1/0:void 0)}r.setNode(e.id,{...e})}else{if(p){let t=await OS(l,e,{config:a,dir:YMe(e,d,f)});u.set(e.id,t)}r.setNode(e.id,{...e})}}));for(let e of i)p&&F_(e)&&await L_(s,e),r.setEdge(e.start,e.end,{...e},e.id),t.edges.some(t=>t.id===e.id)||t.edges.push(e);if(globalThis.mermaidCaptureSizes){let{captureNodeSizes:n}=await Ht(async()=>{let{captureNodeSizes:e}=await Promise.resolve().then(()=>(qMe(),VMe));return{captureNodeSizes:e}},void 0);n(e,t)}return{graph:r,groups:o,nodeElements:u}}function kS({prepareLayout:e,measureLayout:t,runLayoutCore:n,paintLayout:r,afterPaint:i,paintOptions:a}){let o=t??QMe;return p(async function(t,s,l,u){let d=s.select(`g`);(l?.insertMarkers??H_)(d,t.markers,t.type,t.diagramId),ZMe();let f={element:d,helpers:l,options:u};f.preparedLayout=await e?.(t,f);let p=await o(t,f),m=await n(t,f),h={...f,measure:p};r?await r(t,h,m):await $Me(t,h,a),await i?.(t,h,m)},`render`)}function ZMe(){_Se(),ISe(),DSe(),sNe()}async function QMe(e,{element:t},n){return await XMe(t,e,n)}async function $Me(e,t,n={}){let{measure:r}=t,{groups:i}=r;for(let r of n.getNodes?.(e,t)??e.nodes)n.skipNode?.(r,t)||await eNe(i,r,t,n);let a=nNe(e.nodes);for(let r of e.edges)rNe(r,n)||await iNe(i,r,a,e,n,t)}async function eNe(e,t,n,r){t.clusterNode?y_(t):tNe(t,n,r)?await C_(e.clusters,t):y_(t)}function tNe(e,t,n){return e.isGroup===!0&&(n.isCluster?.(e,t)??!0)}function nNe(e){let t=new Map;for(let n of e)n?.id&&t.set(n.id,n);return t}function rNe(e,t){return e.isLayoutOnly||!!t.skipEdge?.(e)}async function iNe(e,t,n,r,i,a){let o=V_(e.edgePaths,{...t},i.clusterDb??new Map,r.type,AS(t.start,t,n,a,i),AS(t.end,t,n,a,i),r.diagramId,aNe(t,i));F_(t)&&(N_.has(t.id)||await L_(e.edgeLabels,t),oNe(t,o))}function AS(e,t,n,r,i){return i.getEdgeNode?.(e,t,r)??(e?n.get(e)??{}:{})}function aNe(e,t){return typeof t.skipIntersect==`function`?t.skipIntersect(e):t.skipIntersect??!1}function oNe(e,t){let n=t?.updatedPath??t?.originalPath,r=Zo(),{subGraphTitleTotalMargin:i}=__({flowchart:r.flowchart??{}});if(e.label){let r=N_.get(e.id),a=e.x,o=e.y;if(n){let r=ym.calcLabelPosition(n);y.debug(`Moving label `+e.label+` from (`,a,`,`,o,`) to (`,r.x,`,`,r.y,`) abc88`),t?.updatedPath&&(a=r.x,o=r.y)}r.attr(`transform`,`translate(${a}, ${o+i/2})`)}if(e?.startLabelLeft){let t=P_.get(e.id).startLeft,r=e?.x,i=e?.y;if(n){let t=ym.calcTerminalLabelPosition(e.arrowTypeStart?10:0,`start_left`,n);r=t.x,i=t.y}t.attr(`transform`,`translate(${r}, ${i})`)}if(e.startLabelRight){let t=P_.get(e.id).startRight,r=e.x,i=e.y;if(n){let t=ym.calcTerminalLabelPosition(e.arrowTypeStart?10:0,`start_right`,n);r=t.x,i=t.y}t.attr(`transform`,`translate(${r}, ${i})`)}if(e.endLabelLeft){let t=P_.get(e.id).endLeft,r=e.x,i=e.y;if(n){let t=ym.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,`end_left`,n);r=t.x,i=t.y}t.attr(`transform`,`translate(${r}, ${i})`)}if(e.endLabelRight){let t=P_.get(e.id).endRight,r=e.x,i=e.y;if(n){let t=ym.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,`end_right`,n);r=t.x,i=t.y}t.attr(`transform`,`translate(${r}, ${i})`)}}var jS,MS,NS,sNe,PS,cNe,FS,IS,lNe,LS,RS,uNe,zS,BS,VS,HS,dNe,fNe=o((()=>{w_(),U_(),b_(),h_(),Sm(),Vs(),S(),h(),TS(),Ut(),p(DS,`createLayoutElementGroups`),p(JMe,`measureGroupLabel`),p(OS,`insertMeasuredNode`),p(YMe,`resolveNodeDir`),p(XMe,`createGraphWithElements`),jS=new Map,MS=new Map,NS=new Map,sNe=p(()=>{MS.clear(),NS.clear(),jS.clear()},`clear`),PS=p((e,t)=>{let n=MS.get(t)||[];return y.trace(`In isDescendant`,t,` `,e,` = `,n.includes(e)),n.includes(e)},`isDescendant`),cNe=p((e,t)=>{let n=MS.get(t)||[];return y.info(`Descendants of `,t,` is `,n),y.info(`Edge is `,e),e.v===t||e.w===t?!1:n?n.includes(e.v)||PS(e.v,t)||PS(e.w,t)||n.includes(e.w):(y.debug(`Tilt, `,t,`,not in descendants`),!1)},`edgeInCluster`),FS=p((e,t,n,r)=>{y.debug(`Copying children of `,e,`root`,r,`data`,t.node(e),r);let i=t.children(e)||[];e!==r&&i.push(e),y.debug(`Copying (nodes) clusterId`,e,`nodes`,i),i.forEach(i=>{if(t.children(i).length>0)FS(i,t,n,r);else{let a=t.node(i);y.info(`cp `,i,` to `,r,` with parent `,e),n.setNode(i,a),r!==t.parent(i)&&(y.debug(`Setting parent`,i,t.parent(i)),n.setParent(i,t.parent(i))),e!==r&&i!==e?(y.debug(`Setting parent`,i,e),n.setParent(i,e)):(y.info(`In copy `,e,`root`,r,`data`,t.node(e),r),y.debug(`Not Setting parent for node=`,i,`cluster!==rootId`,e!==r,`node!==clusterId`,i!==e));let o=t.edges(i);y.debug(`Copying Edges`,o),o.forEach(i=>{y.info(`Edge`,i);let a=t.edge(i.v,i.w,i.name);y.info(`Edge data`,a,r);try{cNe(i,r)?(y.info(`Copying as `,i.v,i.w,a,i.name),n.setEdge(i.v,i.w,a,i.name),y.info(`newGraph edges `,n.edges(),n.edge(n.edges()[0]))):y.info(`Skipping copy of edge `,i.v,`-->`,i.w,` rootId: `,r,` clusterId:`,e)}catch(e){y.error(e)}})}y.debug(`Removing node`,i),t.removeNode(i)})},`copy`),IS=p((e,t)=>{let n=t.children(e),r=[...n];for(let i of n)NS.set(i,e),r=[...r,...IS(i,t)];return r},`extractDescendants`),lNe=p((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),i=e.edges().filter(e=>e.v===n||e.w===n),a=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),o=i.map(e=>({v:e.v,w:e.w}));return a.filter(e=>o.some(t=>e.v===t.v&&e.w===t.w))},`findCommonEdges`),LS=p((e,t,n)=>{let r=t.children(e);if(y.trace(`Searching children of id `,e,r),r.length<1)return e;let i;for(let e of r){let r=LS(e,t,n),a=lNe(t,n,r);if(r){if(a.length>0)i=r;else return r}}return i},`findNonClusterChild`),RS=p(e=>!jS.has(e)||!jS.get(e).externalConnections?e:jS.has(e)?jS.get(e).id:e,`getAnchorId`),uNe=p((e,t)=>{if(!e||t>10){y.debug(`Opting out, no graph `);return}y.debug(`Opting in, graph `),e.nodes().forEach(function(t){e.children(t).length>0&&(y.debug(`Cluster identified`,t,` Replacement id in edges: `,LS(t,e,t)),MS.set(t,IS(t,e)),jS.set(t,{id:LS(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let n=e.children(t),r=e.edges();n.length>0?(y.debug(`Cluster identified`,t,MS),r.forEach(e=>{PS(e.v,t)^PS(e.w,t)&&(y.debug(`Edge: `,e,` leaves cluster `,t),y.debug(`Descendants of XXX `,t,`: `,MS.get(t)),jS.get(t).externalConnections=!0)})):y.debug(`Not a cluster `,t,MS)});for(let t of jS.keys()){let n=jS.get(t).id,r=e.parent(n);r!==t&&jS.has(r)&&!jS.get(r).externalConnections&&(jS.get(t).id=r);let i=e.edges().some(e=>e.v===t);if(n&&jS.get(t)?.externalConnections&&i&&HS(e,n,t)){let r=dNe(e,t,e.parent(n));r&&(jS.get(t).id=r)}}e.edges().forEach(function(t){let n=e.edge(t);y.debug(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(t)),y.debug(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(e.edge(t)));let r=t.v,i=t.w;if(y.debug(`Fix XXX`,jS,`ids:`,t.v,t.w,`Translating: `,jS.get(t.v),` --- `,jS.get(t.w)),jS.get(t.v)||jS.get(t.w)){if(y.debug(`Fixing and trying - removing XXX`,t.v,t.w,t.name),r=RS(t.v),i=RS(t.w),e.removeEdge(t.v,t.w,t.name),r!==t.v){let i=e.parent(r);jS.get(i).externalConnections=!0,n.fromCluster=t.v}if(i!==t.w){let r=e.parent(i);jS.get(r).externalConnections=!0,n.toCluster=t.w}y.debug(`Fix Replacing with XXX`,r,i,t.name),e.setEdge(r,i,n,t.name)}}),zS(e,0),y.trace(jS)},`adjustClustersAndEdges`),zS=p((e,t)=>{if(t>10){y.error(`Bailing out`);return}let n=e.nodes(),r=!1;for(let t of n){let n=e.children(t);r||=n.length>0}if(!r){y.debug(`Done, no node has children`,e.nodes());return}y.debug(`Nodes = `,n,t);for(let r of n)if(y.debug(`Extracting node`,r,jS,jS.has(r)&&!jS.get(r).externalConnections,!e.parent(r),e.node(r),e.children(`D`),` Depth `,t),!jS.has(r))y.debug(`Not a cluster`,r,t);else if(!jS.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){y.debug(`Cluster without external connections, without a parent and with children`,r,t);let n=e.graph().rankdir===`TB`?`LR`:`TB`;jS.get(r)?.clusterData?.dir&&(n=jS.get(r).clusterData.dir,y.debug(`Fixing dir`,jS.get(r).clusterData.dir,n));let i=new wS({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});FS(r,e,i,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:jS.get(r).clusterData,label:jS.get(r).label,graph:i})}else y.debug(`Cluster ** `,r,` **not meeting the criteria !externalConnections:`,!jS.get(r).externalConnections,` no parent: `,!e.parent(r),` children `,e.children(r)&&e.children(r).length>0,e.children(`D`),t),y.debug(jS);n=e.nodes(),y.debug(`New list of nodes`,n);for(let r of n){let n=e.node(r);y.debug(` Now next level`,r,n),n?.clusterNode&&zS(n.graph,t+1)}},`extractor`),BS=p((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(t=>{let r=BS(e,e.children(t));n=[...n,...r]}),n},`sorter`),VS=p(e=>BS(e,e.children()),`sortNodesByHierarchy`),HS=p((e,t,n)=>{let r=e.parent(t);for(;r&&r!==n;){let t=jS.get(r);if(t&&!t.externalConnections)return!0;r=e.parent(r)}return!1},`isNodeInExtractableCluster`),dNe=p((e,t,n)=>{let r=e.children(t)??[];for(let i of r){if(i===n||PS(i,n))continue;let r=LS(i,e,t);if(r&&!HS(e,r,t))return r}return null},`findSafeAnchorNode`),p(kS,`createCommonLayoutRenderer`),p(ZMe,`clearLayoutRenderState`),p(QMe,`defaultMeasureLayout`),p($Me,`paintLayoutData`),p(eNe,`paintLayoutNode`),p(tNe,`shouldPaintAsCluster`),p(nNe,`buildNodeLookup`),p(rNe,`shouldSkipPaintEdge`),p(iNe,`paintLayoutEdge`),p(AS,`getRenderedNode`),p(aNe,`shouldSkipIntersect`),p(oNe,`positionRenderedEdgeLabel`)}));function pNe(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function mNe(e,t){if(e!==`_next`&&e!==`_prev`)return t}var hNe,gNe=o((()=>{hNe=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return pNe(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&pNe(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,mNe)),n=n._prev;return`[`+e.join(`, `)+`]`}}}));function _Ne(e,t){if(e.nodeCount()<=1)return[];var n=yNe(e,t||bNe);return ob(Lx(vNe(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function vNe(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)US(e,t,n,o);for(;o=i.dequeue();)US(e,t,n,o);if(e.nodeCount()){for(var s=t.length-2;s>0;--s)if(o=t[s].dequeue(),o){r=r.concat(US(e,t,n,o,!0));break}}}return r}function US(e,t,n,r,i){var a=i?[]:void 0;return Mx(e.inEdges(r.v),function(r){var o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,WS(t,n,s)}),Mx(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,WS(t,n,o)}),e.removeNode(r.v),a}function yNe(e,t){var n=new wS,r=0,i=0;Mx(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),Mx(e.edges(),function(e){var a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s),i=Math.max(i,n.node(e.v).out+=o),r=Math.max(r,n.node(e.w).in+=o)});var a=fS(i+r+3).map(function(){return new hNe}),o=r+1;return Mx(n.nodes(),function(e){WS(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function WS(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}var bNe,xNe=o((()=>{yS(),TS(),gNe(),bNe=jv(1)}));function SNe(e){Mx(e.graph().acyclicer===`greedy`?_Ne(e,t(e)):CNe(e),function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,vS(`rev`))});function t(e){return function(t){return e.edge(t).weight}}}function CNe(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,Mx(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return Mx(e.nodes(),i),t}function wNe(e){Mx(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}var TNe=o((()=>{yS(),xNe()}));function GS(e,t,n,r){var i;do i=vS(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function ENe(e){var t=new wS().setGraph(e.graph());return Mx(e.nodes(),function(n){t.setNode(n,e.node(n))}),Mx(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function DNe(e){var t=new wS({multigraph:e.isMultigraph()}).setGraph(e.graph());return Mx(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),Mx(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function ONe(e,t){var n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);var l,u;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),l=s*i/a,u=s):(i<0&&(o=-o),l=o,u=o*a/i),{x:n+l,y:r+u}}function KS(e){var t=Lx(fS(MNe(e)+1),function(){return[]});return Mx(e.nodes(),function(n){var r=e.node(n),i=r.rank;qx(i)||(t[i][r.order]=n)}),t}function kNe(e){var t=eS(Lx(e.nodes(),function(t){return e.node(t).rank}));Mx(e.nodes(),function(n){var r=e.node(n);zx(r,`rank`)&&(r.rank-=t)})}function ANe(e){var t=eS(Lx(e.nodes(),function(t){return e.node(t).rank})),n=[];Mx(e.nodes(),function(r){var i=e.node(r).rank-t;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=e.graph().nodeRankFactor;Mx(n,function(t,n){qx(t)&&n%i!==0?--r:r&&Mx(t,function(t){e.node(t).rank+=r})})}function jNe(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),GS(e,`border`,i,t)}function MNe(e){return Qx(Lx(e.nodes(),function(t){var n=e.node(t).rank;if(!qx(n))return n}))}function NNe(e,t){var n={lhs:[],rhs:[]};return Mx(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function PNe(e,t){var n=vx();try{return t()}finally{console.log(e+` time: `+(vx()-n)+`ms`)}}function FNe(e,t){return t()}var qS=o((()=>{yS(),TS()}));function INe(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&Mx(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)LNe(e,`borderLeft`,`_bl`,n,i,a),LNe(e,`borderRight`,`_br`,n,i,a)}}Mx(e.children(),t)}function LNe(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],l=GS(e,`border`,o,n);i[t][a]=l,e.setParent(l,r),s&&e.setEdge(s,l,{weight:1})}var RNe=o((()=>{yS(),qS()}));function zNe(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&VNe(e)}function BNe(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&UNe(e),(t===`lr`||t===`rl`)&&(WNe(e),VNe(e))}function VNe(e){Mx(e.nodes(),function(t){HNe(e.node(t))}),Mx(e.edges(),function(t){HNe(e.edge(t))})}function HNe(e){var t=e.width;e.width=e.height,e.height=t}function UNe(e){Mx(e.nodes(),function(t){JS(e.node(t))}),Mx(e.edges(),function(t){var n=e.edge(t);Mx(n.points,JS),Object.prototype.hasOwnProperty.call(n,`y`)&&JS(n)})}function JS(e){e.y=-e.y}function WNe(e){Mx(e.nodes(),function(t){YS(e.node(t))}),Mx(e.edges(),function(t){var n=e.edge(t);Mx(n.points,YS),Object.prototype.hasOwnProperty.call(n,`x`)&&YS(n)})}function YS(e){var t=e.x;e.x=e.y,e.y=t}var GNe=o((()=>{yS()}));function KNe(e){e.graph().dummyChains=[],Mx(e.edges(),function(t){qNe(e,t)})}function qNe(e,t){var n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),l=s.labelRank;if(a!==r+1){e.removeEdge(t);var u=void 0,d,f=0;for(++r;r<a;++f,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},d=GS(e,`edge`,u,`_d`),r===l&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,d,{weight:s.weight},o),f===0&&e.graph().dummyChains.push(d),n=d;e.setEdge(n,i,{weight:s.weight},o)}}function JNe(e){Mx(e.graph().dummyChains,function(t){var n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}var YNe=o((()=>{yS(),qS()}));function XS(e){var t={};function n(r){var i=e.node(r);if(Object.prototype.hasOwnProperty.call(t,r))return i.rank;t[r]=!0;var a=eS(Lx(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}Mx(e.sources(),n)}function ZS(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var QS=o((()=>{yS()}));function XNe(e){var t=new wS({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;ZNe(t,e)<r;)i=QNe(t,e),a=t.hasNode(i.v)?ZS(e,i):-ZS(e,i),$Ne(t,e,a);return t}function ZNe(e,t){function n(r){Mx(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!ZS(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return Mx(e.nodes(),n),e.nodeCount()}function QNe(e,t){return tS(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return ZS(t,n)})}function $Ne(e,t,n){Mx(e.nodes(),function(e){t.node(e).rank+=n})}var ePe=o((()=>{yS(),TS(),QS()})),tPe=o((()=>{yS()})),nPe=o((()=>{tPe()})),rPe=o((()=>{yS()})),iPe=o((()=>{yS()})),aPe=o((()=>{iPe()}));function oPe(e,t,n){ov(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return Mx(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);sPe(e,t,n===`post`,a,r,i)}),i}function sPe(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),Mx(i(t),function(t){sPe(e,t,n,r,i,a)}),n&&a.push(t))}var cPe=o((()=>{yS()}));function lPe(e,t){return oPe(e,t,`post`)}var uPe=o((()=>{cPe()}));function dPe(e,t){return oPe(e,t,`pre`)}var fPe=o((()=>{cPe()})),pPe=o((()=>{BMe()})),mPe=o((()=>{tPe(),nPe(),rPe(),aPe(),uPe(),fPe(),pPe(),iPe()}));function $S(e){e=ENe(e),XS(e);var t=XNe(e);tC(t),eC(t,e);for(var n,r;n=vPe(t);)r=yPe(t,e,n),bPe(t,e,n,r)}function eC(e,t){var n=lPe(e,e.nodes());n=n.slice(0,n.length-1),Mx(n,function(n){hPe(e,t,n)})}function hPe(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=gPe(e,t,n)}function gPe(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,Mx(t.nodeEdges(n),function(a){var s=a.v===n,l=s?a.w:a.v;if(l!==r){var u=s===i,d=t.edge(a).weight;if(o+=u?d:-d,SPe(e,n,l)){var f=e.edge(n,l).cutvalue;o+=u?-f:f}}}),o}function tC(e,t){arguments.length<2&&(t=e.nodes()[0]),_Pe(e,{},1,t)}function _Pe(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,Mx(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=_Pe(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function vPe(e){return Fx(e.edges(),function(t){return e.edge(t).cutvalue<0})}function yPe(e,t,n){var r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);var a=e.node(r),o=e.node(i),s=a,l=!1;return a.lim>o.lim&&(s=o,l=!0),tS(Px(t.edges(),function(t){return l===CPe(e,e.node(t.v),s)&&l!==CPe(e,e.node(t.w),s)}),function(e){return ZS(t,e)})}function bPe(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),tC(e),eC(e,t),xPe(e,t)}function xPe(e,t){var n=dPe(e,Fx(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),Mx(n,function(n){var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function SPe(e,t,n){return e.hasEdge(t,n)}function CPe(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var wPe=o((()=>{yS(),mPe(),qS(),ePe(),QS(),$S.initLowLimValues=tC,$S.initCutValues=eC,$S.calcCutValue=gPe,$S.leaveEdge=vPe,$S.enterEdge=yPe,$S.exchangeEdges=bPe}));function TPe(e){switch(e.graph().ranker){case`network-simplex`:DPe(e);break;case`tight-tree`:EPe(e);break;case`longest-path`:OPe(e);break;default:DPe(e)}}function EPe(e){XS(e),XNe(e)}function DPe(e){$S(e)}var OPe,kPe=o((()=>{ePe(),wPe(),QS(),OPe=XS}));function APe(e){var t=GS(e,`root`,{},`_root`),n=MPe(e),r=Qx(Hx(n))-1,i=2*r+1;e.graph().nestingRoot=t,Mx(e.edges(),function(t){e.edge(t).minlen*=i});var a=NPe(e)+1;Mx(e.children(),function(o){jPe(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function jPe(e,t,n,r,i,a,o){var s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}var l=jNe(e,`_bt`),u=jNe(e,`_bb`),d=e.node(o);e.setParent(l,o),d.borderTop=l,e.setParent(u,o),d.borderBottom=u,Mx(s,function(s){jPe(e,t,n,r,i,a,s);var d=e.node(s),f=d.borderTop?d.borderTop:s,p=d.borderBottom?d.borderBottom:s,m=d.borderTop?r:2*r,h=f===p?i-a[o]+1:1;e.setEdge(l,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,u,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,l,{weight:0,minlen:i+a[o]})}function MPe(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&Mx(a,function(e){n(e,i+1)}),t[r]=i}return Mx(e.children(),function(e){n(e,1)}),t}function NPe(e){return pS(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function PPe(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,Mx(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}var FPe=o((()=>{yS(),qS()}));function IPe(e,t,n){var r={},i;Mx(n,function(n){for(var a=e.parent(n),o,s;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}var LPe=o((()=>{yS()}));function RPe(e,t,n){var r=zPe(e),i=new wS({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return Mx(e.nodes(),function(a){var o=e.node(a),s=e.parent(a);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||r),Mx(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=qx(r)?0:r.weight;i.setEdge(n,a,{weight:e.edge(t).weight+o})}),Object.prototype.hasOwnProperty.call(o,`minRank`)&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function zPe(e){for(var t;e.hasNode(t=vS(`_root`)););return t}var BPe=o((()=>{yS(),TS()}));function VPe(e,t){for(var n=0,r=1;r<t.length;++r)n+=HPe(e,t[r-1],t[r]);return n}function HPe(e,t,n){for(var r=PMe(n,Lx(n,function(e,t){return t})),i=ob(Lx(t,function(t){return hS(Lx(e.outEdges(t),function(t){return{pos:r[t.w],weight:e.edge(t).weight}}),`pos`)})),a=1;a<n.length;)a<<=1;var o=2*a-1;--a;var s=Lx(Array(o),function(){return 0}),l=0;return Mx(i.forEach(function(e){var t=e.pos+a;s[t]+=e.weight;for(var n=0;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;l+=e.weight*n})),l}var UPe=o((()=>{yS()}));function WPe(e){var t={},n=Px(e.nodes(),function(t){return!e.children(t).length}),r=Qx(Lx(n,function(t){return e.node(t).rank})),i=Lx(fS(r+1),function(){return[]});function a(n){zx(t,n)||(t[n]=!0,i[e.node(n).rank].push(n),Mx(e.successors(n),a))}return Mx(hS(n,function(t){return e.node(t).rank}),a),i}var GPe=o((()=>{yS()}));function KPe(e,t){return Lx(t,function(t){var n=e.inEdges(t);if(n.length){var r=pS(n,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}return{v:t}})}var qPe=o((()=>{yS()}));function JPe(e,t){var n={};return Mx(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};qx(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),Mx(t.edges(),function(e){var t=n[e.v],r=n[e.w];!qx(t)&&!qx(r)&&(r.indegree++,t.out.push(n[e.w]))}),YPe(Px(n,function(e){return!e.indegree}))}function YPe(e){var t=[];function n(e){return function(t){t.merged||(qx(t.barycenter)||qx(e.barycenter)||t.barycenter>=e.barycenter)&&XPe(e,t)}}function r(t){return function(n){n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){var i=e.pop();t.push(i),Mx(i.in.reverse(),n(i)),Mx(i.out,r(i))}return Lx(Px(t,function(e){return!e.merged}),function(e){return dS(e,[`vs`,`i`,`barycenter`,`weight`])})}function XPe(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}var ZPe=o((()=>{yS()}));function QPe(e,t){var n=NNe(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=hS(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,l=0;r.sort(eFe(!!t)),l=$Pe(a,i,l),Mx(r,function(e){l+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,l=$Pe(a,i,l)});var u={vs:ob(a)};return s&&(u.barycenter=o/s,u.weight=s),u}function $Pe(e,t,n){for(var r;t.length&&(r=Dx(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function eFe(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}var tFe=o((()=>{yS(),qS()}));function nFe(e,t,n,r){var i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,l={};o&&(i=Px(i,function(e){return e!==o&&e!==s}));var u=KPe(e,i);Mx(u,function(t){if(e.children(t.v).length){var i=nFe(e,t.v,n,r);l[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&iFe(t,i)}});var d=JPe(u,n);rFe(d,l);var f=QPe(d,r);if(o&&(f.vs=ob([o,f.vs,s]),e.predecessors(o).length)){var p=e.node(e.predecessors(o)[0]),m=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(f,`barycenter`)||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+m.order)/(f.weight+2),f.weight+=2}return f}function rFe(e,t){Mx(e,function(e){e.vs=ob(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function iFe(e,t){qx(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}var aFe=o((()=>{yS(),qPe(),ZPe(),tFe()}));function oFe(e){var t=MNe(e),n=sFe(e,fS(1,t+1),`inEdges`),r=sFe(e,fS(t-1,-1,-1),`outEdges`),i=WPe(e);lFe(e,i);for(var a=1/0,o,s=0,l=0;l<4;++s,++l){cFe(s%2?n:r,s%4>=2),i=KS(e);var u=VPe(e,i);u<a&&(l=0,o=POe(i),a=u)}lFe(e,o)}function sFe(e,t,n){return Lx(t,function(t){return RPe(e,t,n)})}function cFe(e,t){var n=new wS;Mx(e,function(e){var r=e.graph().root,i=nFe(e,r,n,t);Mx(i.vs,function(t,n){e.node(t).order=n}),IPe(e,n,i.vs)})}function lFe(e,t){Mx(t,function(t){Mx(t,function(t,n){e.node(t).order=n})})}var uFe=o((()=>{yS(),TS(),qS(),LPe(),BPe(),UPe(),GPe(),aFe()}));function dFe(e){var t=pFe(e);Mx(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=fFe(e,t,i.v,i.w),o=a.path,s=a.lca,l=0,u=o[l],d=!0;n!==i.w;){if(r=e.node(n),d){for(;(u=o[l])!==s&&e.node(u).maxRank<r.rank;)l++;u===s&&(d=!1)}if(!d){for(;l<o.length-1&&e.node(u=o[l+1]).minRank<=r.rank;)l++;u=o[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function fFe(e,t,n,r){var i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),l=n,u;do l=e.parent(l),i.push(l);while(l&&(t[l].low>o||s>t[l].lim));for(u=l,l=r;(l=e.parent(l))!==u;)a.push(l);return{path:i.concat(a.reverse()),lca:u}}function pFe(e){var t={},n=0;function r(i){var a=n;Mx(e.children(i),r),t[i]={low:a,lim:n++}}return Mx(e.children(),r),t}var mFe=o((()=>{yS()}));function hFe(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=Dx(r);return Mx(r,function(t,l){var u=_Fe(e,t),d=u?e.node(u).order:o;(u||t===s)&&(Mx(r.slice(a,l+1),function(t){Mx(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||d<o)&&!(a.dummy&&e.node(t).dummy)&&vFe(n,r,t)})}),a=l+1,i=d)}),r}return pS(t,r),n}function gFe(e,t){var n={};function r(t,r,i,a,o){var s;Mx(fS(r,i),function(r){s=t[r],e.node(s).dummy&&Mx(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&vFe(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return Mx(n,function(s,l){if(e.node(s).dummy===`border`){var u=e.predecessors(s);u.length&&(a=e.node(u[0]).order,r(n,o,l,i,a),o=l,i=a)}r(n,o,n.length,a,t.length)}),n}return pS(t,i),n}function _Fe(e,t){if(e.node(t).dummy)return Fx(e.predecessors(t),function(t){return e.node(t).dummy})}function vFe(e,t,n){if(t>n){var r=t;t=n,n=r}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[t];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function yFe(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function bFe(e,t,n,r){var i={},a={},o={};return Mx(t,function(e){Mx(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),Mx(t,function(e){var t=-1;Mx(e,function(e){var s=r(e);if(s.length){s=hS(s,function(e){return o[e]});for(var l=(s.length-1)/2,u=Math.floor(l),d=Math.ceil(l);u<=d;++u){var f=s[u];a[e]===e&&t<o[f]&&!yFe(n,e,f)&&(a[f]=e,a[e]=i[e]=i[f],t=o[f])}}})}),{root:i,align:a}}function xFe(e,t,n,r,i){var a={},o=SFe(e,t,n,i),s=i?`borderLeft`:`borderRight`;function l(e,t){for(var n=o.nodes(),r=n.pop(),i={};r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function u(e){a[e]=o.inEdges(e).reduce(function(e,t){return Math.max(e,a[t.v]+o.edge(t))},0)}function d(t){var n=o.outEdges(t).reduce(function(e,t){return Math.min(e,a[t.w]-o.edge(t))},1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return l(u,o.predecessors.bind(o)),l(d,o.successors.bind(o)),Mx(r,function(e){a[e]=a[n[e]]}),a}function SFe(e,t,n,r){var i=new wS,a=e.graph(),o=DFe(a.nodesep,a.edgesep,r);return Mx(t,function(t){var r;Mx(t,function(t){var a=n[t];if(i.setNode(a),r){var s=n[r],l=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),l||0))}r=t})}),i}function CFe(e,t){return tS(Hx(t),function(t){var n=-1/0,r=1/0;return qAe(t,function(t,i){var a=OFe(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function wFe(e,t){var n=Hx(t),r=eS(n),i=Qx(n);Mx([`u`,`d`],function(n){Mx([`l`,`r`],function(a){var o=n+a,s=e[o],l;if(s!==t){var u=Hx(s);l=a===`l`?r-eS(u):i-Qx(u),l&&(e[o]=Yx(s,function(e){return e+l}))}})})}function TFe(e,t){return Yx(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=hS(Lx(e,r));return(i[1]+i[2])/2})}function EFe(e){var t=KS(e),n=$x(hFe(e,t),gFe(e,t)),r={},i;return Mx([`u`,`d`],function(a){i=a===`u`?t:Hx(t).reverse(),Mx([`l`,`r`],function(t){t===`r`&&(i=Lx(i,function(e){return Hx(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=bFe(e,i,n,o),l=xFe(e,i,s.root,s.align,t===`r`);t===`r`&&(l=Yx(l,function(e){return-e})),r[a+t]=l})}),wFe(r,CFe(e,r)),TFe(r,e.graph().align)}function DFe(e,t,n){return function(r,i,a){var o=r.node(i),s=r.node(a),l=0,u;if(l+=o.width/2,Object.prototype.hasOwnProperty.call(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:u=-o.width/2;break;case`r`:u=o.width/2}if(u&&(l+=n?u:-u),u=0,l+=(o.dummy?t:e)/2,l+=(s.dummy?t:e)/2,l+=s.width/2,Object.prototype.hasOwnProperty.call(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:u=s.width/2;break;case`r`:u=-s.width/2}return u&&(l+=n?u:-u),u=0,l}}function OFe(e,t){return e.node(t).width}var kFe=o((()=>{yS(),TS(),qS()}));function AFe(e){e=DNe(e),jFe(e),YAe(EFe(e),function(t,n){e.node(n).x=t})}function jFe(e){var t=KS(e),n=e.graph().ranksep,r=0;Mx(t,function(t){var i=Qx(Lx(t,function(t){return e.node(t).height}));Mx(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}var MFe=o((()=>{yS(),qS(),kFe()}));function NFe(e,t){var n=t&&t.debugTiming?PNe:FNe;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>IFe(e));n(` runLayout`,()=>PFe(t,n)),n(` updateInputGraph`,()=>FFe(e,t))})}function PFe(e,t){t(` makeSpaceForEdgeLabels`,()=>LFe(e)),t(` removeSelfEdges`,()=>KFe(e)),t(` acyclic`,()=>SNe(e)),t(` nestingGraph.run`,()=>APe(e)),t(` rank`,()=>TPe(DNe(e))),t(` injectEdgeLabelProxies`,()=>RFe(e)),t(` removeEmptyRanks`,()=>ANe(e)),t(` nestingGraph.cleanup`,()=>PPe(e)),t(` normalizeRanks`,()=>kNe(e)),t(` assignRankMinMax`,()=>zFe(e)),t(` removeEdgeLabelProxies`,()=>BFe(e)),t(` normalize.run`,()=>KNe(e)),t(` parentDummyChains`,()=>dFe(e)),t(` addBorderSegments`,()=>INe(e)),t(` order`,()=>oFe(e)),t(` insertSelfEdges`,()=>qFe(e)),t(` adjustCoordinateSystem`,()=>zNe(e)),t(` position`,()=>AFe(e)),t(` positionSelfEdges`,()=>JFe(e)),t(` removeBorderNodes`,()=>GFe(e)),t(` normalize.undo`,()=>JNe(e)),t(` fixupEdgeLabelCoords`,()=>UFe(e)),t(` undoCoordinateSystem`,()=>BNe(e)),t(` translateGraph`,()=>VFe(e)),t(` assignNodeIntersects`,()=>HFe(e)),t(` reversePoints`,()=>WFe(e)),t(` acyclic.undo`,()=>wNe(e))}function FFe(e,t){Mx(e.nodes(),function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))}),Mx(e.edges(),function(n){var r=e.edge(n),i=t.edge(n);r.points=i.points,Object.prototype.hasOwnProperty.call(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}function IFe(e){var t=new wS({multigraph:!0,compound:!0}),n=rC(e.graph());return t.setGraph($x({},XFe,nC(n,YFe),dS(n,ZFe))),Mx(e.nodes(),function(n){var r=rC(e.node(n));t.setNode(n,bx(nC(r,QFe),$Fe)),t.setParent(n,e.parent(n))}),Mx(e.edges(),function(n){var r=rC(e.edge(n));t.setEdge(n,$x({},tIe,nC(r,eIe),dS(r,nIe)))}),t}function LFe(e){var t=e.graph();t.ranksep/=2,Mx(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function RFe(e){Mx(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);GS(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function zFe(e){var t=0;Mx(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Qx(t,r.maxRank))}),e.graph().maxRank=t}function BFe(e){Mx(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function VFe(e){var t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function l(e){var a=e.x,o=e.y,s=e.width,l=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-l/2),i=Math.max(i,o+l/2)}Mx(e.nodes(),function(t){l(e.node(t))}),Mx(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&l(n)}),t-=o,r-=s,Mx(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),Mx(e.edges(),function(n){var i=e.edge(n);Mx(i.points,function(e){e.x-=t,e.y-=r}),Object.prototype.hasOwnProperty.call(i,`x`)&&(i.x-=t),Object.prototype.hasOwnProperty.call(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function HFe(e){Mx(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(ONe(r,a)),n.points.push(ONe(i,o))})}function UFe(e){Mx(e.edges(),function(t){var n=e.edge(t);if(Object.prototype.hasOwnProperty.call(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function WFe(e){Mx(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function GFe(e){Mx(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(Dx(n.borderLeft)),o=e.node(Dx(n.borderRight));n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),Mx(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function KFe(e){Mx(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function qFe(e){Mx(KS(e),function(t){var n=0;Mx(t,function(t,r){var i=e.node(t);i.order=r+n,Mx(i.selfEdges,function(t){GS(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function JFe(e){Mx(e.nodes(),function(t){var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function nC(e,t){return Yx(dS(e,t),Number)}function rC(e){var t={};return Mx(e,function(e,n){t[n.toLowerCase()]=e}),t}var YFe,XFe,ZFe,QFe,$Fe,eIe,tIe,nIe,rIe=o((()=>{yS(),TS(),RNe(),GNe(),TNe(),YNe(),kPe(),FPe(),uFe(),mFe(),MFe(),qS(),YFe=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],XFe={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},ZFe=[`acyclicer`,`ranker`,`rankdir`,`align`],QFe=[`width`,`height`],$Fe={width:0,height:0},eIe=[`minlen`,`weight`,`width`,`height`,`labeloffset`],tIe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},nIe=[`labelpos`]})),iIe=o((()=>{TNe(),rIe(),YNe(),kPe()})),aIe=l({applyDagreLayoutResult:()=>uC,getEdgesToRender:()=>oC,measureDagreLayout:()=>fC,prepareLayoutForDagre:()=>dC,render:()=>hIe,runDagreLayoutCore:()=>pC}),iC,aC,oIe,sIe,cIe,lIe,uIe,oC,sC,cC,dIe,lC,fIe,uC,pIe,mIe,dC,fC,pC,hIe,gIe=o((()=>{fNe(),w_(),U_(),b_(),h_(),Zf(),Th(),up(),Sm(),Vs(),S(),h(),iIe(),TS(),iC=p((e,t,n)=>Math.max(t,Math.min(n,e)),`clamp`),aC=p((e=`TB`)=>{switch(e){case`BT`:return`bottom`;case`LR`:return`right`;case`RL`:return`left`;default:return`top`}},`getDefaultSelfLoopSide`),oIe=p(e=>e===`flowchart`||e===`flowchart-v2`||e===`stateDiagram`||e===`er`||e===`classDiagram`,`shouldMergeSelfLoopSegments`),sIe=[`x`,`y`,`width`,`height`,`labelBBox`,`intersect`,`calcIntersect`,`diff`,`clusterNode`],cIe=p((e,t,n,r,i)=>{let a=[],o=new Set;if(n.forEach(({start:e,end:t})=>{e!==r&&o.add(e),t!==r&&o.add(t)}),o.forEach(t=>{let n=e.node(t);typeof n?.x==`number`&&typeof n?.y==`number`&&a.push(n)}),a.length===0&&n.forEach(({edge:e})=>{(e.points??[]).forEach(e=>{typeof e?.x==`number`&&typeof e?.y==`number`&&a.push(e)})}),a.length===0)return aC(i);let s=a.reduce((e,t)=>({x:e.x+t.x/a.length,y:e.y+t.y/a.length}),{x:0,y:0}),l=s.x-t.x,u=s.y-t.y;return Math.abs(l)>Math.abs(u)?l>0?`right`:`left`:Math.abs(u)>0?u>0?`bottom`:`top`:aC(i)},`getSelfLoopSide`),lIe=p((e,t=`top`,n=0,r=0)=>{let i=e.x,a=e.y-n,o=e.width/2,s=e.height/2,l=Math.max(36,Math.min(100,e.width*.8)),u=iC(Math.max(r,e.width*.35),36,l),d=iC(Math.min(e.width,e.height)*.45,24,48);switch(t){case`bottom`:{let e=a+s;return[{x:i-u/2,y:e},{x:i-u/2,y:e+d},{x:i+u/2,y:e+d},{x:i+u/2,y:e}]}case`right`:{let e=i+o;return[{x:e,y:a-u/2},{x:e+d,y:a-u/2},{x:e+d,y:a+u/2},{x:e,y:a+u/2}]}case`left`:{let e=i-o;return[{x:e,y:a-u/2},{x:e-d,y:a-u/2},{x:e-d,y:a+u/2},{x:e,y:a+u/2}]}default:{let e=a-s;return[{x:i-u/2,y:e},{x:i-u/2,y:e-d},{x:i+u/2,y:e-d},{x:i+u/2,y:e}]}}},`getSelfLoopPoints`),uIe=p((e,t,n=`top`,r=0,i={})=>{let a=e.x,o=e.y-r,s=i.width??0,l=i.height??0;switch(n){case`bottom`:return{x:a,y:Math.max(...t.map(e=>e.y))+l/2+4};case`right`:return{x:Math.max(...t.map(e=>e.x))+s/2+4,y:o};case`left`:return{x:Math.min(...t.map(e=>e.x))-s/2-4,y:o};default:return{x:a,y:Math.min(...t.map(e=>e.y))-l/2-4}}},`getSelfLoopLabelPosition`),oC=p((e,t=0,{mergeSelfLoops:n=!0}={})=>{let r=new Map,i=[],a=e.graph()?.rankdir;return e.edges().forEach(t=>{let a=e.edge(t);if(n&&a.selfLoop){let e=a.selfLoop.id;r.has(e)||r.set(e,[]),r.get(e).push({edge:a,start:t.v,end:t.w})}else i.push({edge:a,start:t.v,end:t.w})}),r.forEach(n=>{if(n.length!==3){n.forEach(e=>i.push(e));return}n.sort((e,t)=>e.edge.selfLoop.order-t.edge.selfLoop.order);let[r,o,s]=n,l=r.edge.originalEdge??o.edge.originalEdge??s.edge.originalEdge??o.edge,u=e.node(l.start);if(!u){n.forEach(e=>i.push(e));return}let d={width:o.edge.width,height:o.edge.height},f=cIe(e,u,n,l.start,a),p=lIe(u,f,t,d.width??0),m=uIe(u,p,f,t,d),h={...o.edge,...l,id:l.id,points:p,start:l.start,end:l.end,x:m.x,y:m.y,width:d.width,height:d.height,labelStyle:o.edge.labelStyle,fromCluster:r.edge.fromCluster??o.edge.fromCluster??s.edge.fromCluster,toCluster:r.edge.toCluster??o.edge.toCluster??s.edge.toCluster};delete h.selfLoop,delete h.originalEdge,i.push({edge:h,start:h.start,end:h.end})}),i},`getEdgesToRender`),sC=p(async({element:e,graph:t,diagramType:n,id:r,parentCluster:i,siteConfig:a})=>{let o=t.graph().rankdir;y.trace(`Dir in recursive render - dir:`,o);let{clusters:s,edgePaths:l,edgeLabels:u,nodes:d,rootGroups:f}=DS(e,{edgePathsClass:`edgePaths`});t.nodes()?y.info(`Recursive render XXX`,t.nodes()):y.info(`No nodes found for`,t),t.edges().length>0&&y.info(`Recursive edges`,t.edge(t.edges()[0]));let m=oIe(n);await Promise.all(t.nodes().map(async function(e){let s=t.node(e);if(i!==void 0){let n=JSON.parse(JSON.stringify(i.clusterData));y.trace(`Setting data for parent cluster XXX
|
|
560
560
|
Node.id = `,e,`
|
|
561
561
|
data=`,n.height,`
|
|
562
562
|
Parent cluster`,i.height),t.setNode(i.id,n),t.parent(e)||(y.trace(`Setting parent`,e,i.id),t.setParent(e,i.id,n))}if(y.info(`(Insert) Node XXX`+e+`: `+JSON.stringify(t.node(e))),s?.clusterNode){y.info(`Cluster identified XBX`,e,s.width,t.node(e));let{ranksep:i,nodesep:o}=t.graph();s.graph.setGraph({...s.graph.graph(),ranksep:i+25,nodesep:o});let l=await mIe({element:d,graph:s.graph,diagramType:n,id:r,parentCluster:t.node(e),siteConfig:a}),u=l.elem;Lg(s,u),s.diff=l.diff||0,y.info(`New compound node after recursive render XAX`,e,`width`,s.width,`height`,s.height),gSe(u,s)}else t.children(e).length>0?(y.trace(`Cluster - the non recursive path XBX`,e,s.id,s,s.width,`Graph:`,t),y.trace(LS(s.id,t)),jS.set(s.id,{id:LS(s.id,t),node:s})):(y.trace(`Node - the non recursive path XAX`,e,d,t.node(e),o),await OS(d,t.node(e),{config:a,dir:o}))})),await p(async()=>{let e=t.edges().map(async function(e){let n=t.edge(e.v,e.w,e.name);if(y.info(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(e)),y.info(`Edge `+e.v+` -> `+e.w+`: `,e,` `,JSON.stringify(t.edge(e))),y.info(`Fix`,jS,`ids:`,e.v,e.w,`Translating: `,jS.get(e.v),jS.get(e.w)),m&&n.selfLoop){if(n.selfLoop.order!==1)return;let e={...n.originalEdge,...n,id:n.selfLoop.id,startLabelLeft:n.originalEdge?.startLabelLeft??n.startLabelLeft,startLabelRight:n.originalEdge?.startLabelRight??n.startLabelRight,endLabelLeft:n.originalEdge?.endLabelLeft??n.endLabelLeft,endLabelRight:n.originalEdge?.endLabelRight??n.endLabelRight};await L_(u,e),n.width=e.width,n.height=e.height,n.labelStyle=e.labelStyle;return}await L_(u,n)});await Promise.all(e)},`processEdges`)();let{subGraphTitleTotalMargin:h}=__(a);return{elem:f,graph:t,groups:{clusters:s,edgePaths:l,edgeLabels:u,nodes:d,rootGroups:f},diagramType:n,id:r,mergeSelfLoops:m,subGraphTitleTotalMargin:h}},`measureDagreGraph`),cC=p(e=>{y.info(`############################################# XXX`),y.info(`### Layout ### XXX`),y.info(`############################################# XXX`),NFe(e)},`runDagreGraphLayout`),dIe=p((e,t,n)=>{let r=e.node(t);if(!r)return;let i={...r};return r?.clusterNode?i.y=(r.y??0)+n:e.children(t).length>0?i.height=(r.height??0)+n:i.y=(r.y??0)+n/2,i},`normalizeDagreNode`),lC=p((e,t)=>{sIe.forEach(n=>{t[n]!==void 0&&(e[n]=t[n])})},`applyDagreNodeLayout`),fIe=p((e,t,n,r)=>({...e,start:e.start??t,end:e.end??n,points:(e.points??[]).map(e=>({...e,y:typeof e.y==`number`?e.y+r:e.y}))}),`normalizeDagreEdge`),uC=p((e,t)=>{let{graph:n,mergeSelfLoops:r,subGraphTitleTotalMargin:i=0}=t,a=new Map(e.nodes.map(e=>[e.id,e]));VS(n).forEach(e=>{let t=dIe(n,e,i);if(!t)return;lC(n.node(e),t);let r=a.get(e);r&&lC(r,t)});let o=i/2;return e.edges=oC(n,o,{mergeSelfLoops:r}).map(({edge:e,start:t,end:n})=>fIe(e,t,n,o)),e},`applyDagreLayoutResult`),pIe=p(async({elem:e,graph:t,groups:{clusters:n,edgePaths:r},diagramType:i,id:a,mergeSelfLoops:o,subGraphTitleTotalMargin:s})=>{let l=0;await Promise.all(VS(t).map(async function(e){let r=t.node(e);if(y.info(`Position XBX => `+e+`: (`+r.x,`,`+r.y,`) width: `,r.width,` height: `,r.height),r?.clusterNode)r.y+=s,y.info(`A tainted cluster node XBX1`,e,r.id,r.width,r.height,r.x,r.y,t.parent(e)),jS.get(r.id).node=r,y_(r);else if(t.children(e).length>0){y.info(`A pure cluster node XBX1`,e,r.id,r.x,r.y,r.width,r.height,t.parent(e)),r.height+=s,t.node(r.parentId);let i=r?.padding/2||0,a=r?.labelBBox?.height||0,o=a-i||0;y.debug(`OffsetY`,o,`labelHeight`,a,`halfPadding`,i),await C_(n,r),jS.get(r.id).node=r}else{let e=t.node(r.parentId);r.y+=s/2,y.info(`A regular node XBX1 - using the padding`,r.id,`parent`,r.parentId,r.width,r.height,r.x,r.y,`offsetY`,r.offsetY,`parent`,e,e?.offsetY,r),y_(r)}}));let u=s/2;return oC(t,u,{mergeSelfLoops:o}).forEach(function({edge:e,start:n,end:o}){y.info(`Edge `+n+` -> `+o+`: `+JSON.stringify(e),e),e.points.forEach(e=>e.y+=u);let s=t.node(n),l=t.node(o),d=V_(r,e,jS,i,s,l,a);R_(e,d)}),t.nodes().forEach(function(e){let n=t.node(e);y.info(e,n.type,n.diff),n.isGroup&&(l=n.diff)}),y.warn(`Returning from recursive render XAX`,e,l),{elem:e,diff:l}},`paintDagreLayoutCore`),mIe=p(async e=>{let t=await sC(e);return cC(t.graph),await pIe(t)},`renderDagreSubgraph`),dC=p(e=>{let t=new wS({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.nodeSpacing||e.config?.flowchart?.nodeSpacing,ranksep:e.config?.rankSpacing||e.rankSpacing||e.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return e.nodes.forEach(e=>{t.setNode(e.id,{...e}),e.parentId&&t.setParent(e.id,e.parentId)}),y.debug(`Edges:`,e.edges),e.edges.forEach(e=>{if(e.start===e.end){let n=e.start,r=n+`---`+n+`---1`,i=n+`---`+n+`---2`,a=t.node(n);t.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:``,label:``,padding:0,shape:`labelRect`,style:``,width:10,height:10}),t.setParent(r,a.parentId),t.setNode(i,{domId:i,id:i,parentId:a.parentId,labelStyle:``,padding:0,shape:`labelRect`,label:``,style:``,width:10,height:10}),t.setParent(i,a.parentId);let o=structuredClone(e),s=structuredClone(e),l=structuredClone(e),u=structuredClone(e);s.originalEdge=o,s.selfLoop={id:o.id,order:0},l.originalEdge=o,l.selfLoop={id:o.id,order:1},u.originalEdge=o,u.selfLoop={id:o.id,order:2},s.label=``,s.arrowTypeEnd=`none`,s.endLabelLeft=``,s.endLabelRight=``,s.startLabelLeft=``,s.id=n+`-cyclic-special-1`,l.startLabelRight=``,l.startLabelLeft=``,l.endLabelLeft=``,l.endLabelRight=``,l.arrowTypeStart=`none`,l.arrowTypeEnd=`none`,l.id=n+`-cyclic-special-mid`,u.label=``,u.startLabelRight=``,u.startLabelLeft=``,u.arrowTypeStart=`none`,a.isGroup&&(s.fromCluster=n,u.toCluster=n),u.id=n+`-cyclic-special-2`,u.arrowTypeStart=`none`,t.setEdge(n,r,s,n+`-cyclic-special-0`),t.setEdge(r,i,l,n+`-cyclic-special-1`),t.setEdge(i,n,u,n+`-cyclic-special-2`)}else t.setEdge(e.start,e.end,{...e},e.id)}),uNe(t),{graph:t}},`prepareLayoutForDagre`),fC=p(async(e,{element:t,preparedLayout:n})=>{let r=n??dC(e),i=Ns(),a=await sC({element:t,graph:r.graph,diagramType:e.type,id:e.diagramId,parentCluster:void 0,siteConfig:i});return r.measuredLayout=a,a},`measureDagreLayout`),pC=p((e,t)=>{let n=t.preparedLayout?.measuredLayout;if(!n)throw Error(`runDagreLayoutCore requires measureDagreLayout to run first`);return cC(n.graph),uC(e,n),n},`runDagreLayoutCore`),hIe=kS({prepareLayout:dC,measureLayout:fC,runLayoutCore:pC,paintOptions:{clusterDb:jS,getNodes:p((e,{measure:t})=>VS(t.graph).map(e=>t.graph.node(e)).filter(Boolean),`getDagrePaintNodes`),getEdgeNode:p((e,t,{measure:n})=>e?n.graph.node(e):void 0,`getDagreEdgeNode`),skipNode:p((e,{measure:t})=>!t.graph.hasNode(e.id),`skipNode`),isCluster:p((e,{measure:t})=>t.graph.hasNode(e.id)&&(t.graph.children(e.id)??[]).length>0,`isCluster`)}})}));function mC(e){let t=[];for(let n=0;n<e.length-1;n++)t.push({a:e[n],b:e[n+1]});return t}function _Ie(e,t,n,r){let i=t.x-e.x,a=t.y-e.y,o=r.x-n.x,s=r.y-n.y,l=i*s-a*o;if(l===0)return null;let u=n.x-e.x,d=n.y-e.y,f=(u*s-d*o)/l,p=(u*a-d*i)/l;return f<=SC||f>=1-SC||p<=SC||p>=1-SC?null:{point:{x:e.x+f*i,y:e.y+f*a},tA:f,tB:p}}function hC(e){return Math.abs(e.b.x-e.a.x)>=Math.abs(e.b.y-e.a.y)}function gC(e,t,n){if(e.curve!==`rounded`)return!1;let r=e.points,i=r[t],a=r[t+1];if(!i||!a)return!1;let o=Math.hypot(a.x-i.x,a.y-i.y),s=n*o,l=t>0?yC(r[t-1],i,a,bC):null;if(l&&s<l.cutLen)return!0;let u=t+2<r.length?yC(i,a,r[t+2],bC):null;return u!==null&&o-s<u.cutLen}function vIe(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=mC(r.points);for(let a=n+1;a<e.length;a++){let n=e[a],o=mC(n.points);for(let[e,a]of i.entries())for(let[i,s]of o.entries()){let o=_Ie(a.a,a.b,s.a,s.b);if(!o||gC(r,e,o.tA)||gC(n,i,o.tB))continue;let l=hC(a);l!==hC(s)&&l?t.push({jumpEdgeId:r.id,otherEdgeId:n.id,segIndex:e,t:o.tA,point:o.point}):t.push({jumpEdgeId:n.id,otherEdgeId:r.id,segIndex:i,t:o.tB,point:o.point})}}}return t}function _C(e){return`${Math.round(e*1e3)/1e3}`}function vC(e){return`${_C(e.x)},${_C(e.y)}`}function yIe(e){let t=e.b.x-e.a.x,n=e.b.y-e.a.y;return Math.abs(t)>=Math.abs(n)?+(t>=0):+(n>=0)}function bIe(e,t){if(e.length<2)return e.map(e=>({...e}));let n=e.map(e=>({...e})),r=t.arrowTypeStart&&k_[t.arrowTypeStart];if(r){let t=e[0],i=e[1],a=Math.atan2(i.y-t.y,i.x-t.x);n[0].x=t.x+r*Math.cos(a),n[0].y=t.y+r*Math.sin(a)}let i=t.arrowTypeEnd&&k_[t.arrowTypeEnd];if(i){let t=e.length,r=e[t-2],a=e[t-1],o=Math.atan2(a.y-r.y,a.x-r.x);n[t-1].x=a.x-i*Math.cos(o),n[t-1].y=a.y-i*Math.sin(o)}return n}function xIe(e,t,n,r,i){let a=e.point.x,o=e.point.y,s={x:a-t*e.r,y:o-n*e.r},l={x:a+t*e.r,y:o+n*e.r},u=[`L${vC(s)}`];return i===`arc`?u.push(`A${_C(e.r)},${_C(e.r)} 0 0 ${r} ${vC(l)}`):u.push(`M${vC(l)}`),u}function yC(e,t,n,r){let i=t.x-e.x,a=t.y-e.y,o=n.x-t.x,s=n.y-t.y,l=Math.hypot(i,a),u=Math.hypot(o,s);if(l<xC||u<xC)return null;let d=i/l,f=a/l,p=o/u,m=s/u,h=d*p+f*m,g=Math.acos(Math.max(-1,Math.min(1,h)));if(g<xC||Math.abs(Math.PI-g)<xC)return null;let _=Math.min(r/Math.sin(g/2),l/2,u/2);return{startX:t.x-d*_,startY:t.y-f*_,endX:t.x+p*_,endY:t.y+m*_,ctrlX:t.x,ctrlY:t.y,cutLen:_}}function SIe(e,t,n){let r=e.points;if(r.length<2)return``;let i=bIe(r,e),a=e.curve===`rounded`,o=mC(i),s=new Map;for(let e of t){let t=o[e.segIndex];if(!t)continue;let r=Math.hypot(t.b.x-t.a.x,t.b.y-t.a.y),i=s.get(e.segIndex)??[];i.push({t:e.t,point:e.point,d:e.t*r,r:n.jumpRadius}),s.set(e.segIndex,i)}let l=[`M${vC(i[0])}`];for(let e=0;e<o.length;e++){let t=o[e],r=Math.hypot(t.b.x-t.a.x,t.b.y-t.a.y),u=r===0?0:(t.b.x-t.a.x)/r,d=r===0?0:(t.b.y-t.a.y)/r,f=yIe(t),p=0;if(a&&e>0){let t=yC(i[e-1],i[e],i[e+1]??i[e],bC);t&&(p=t.cutLen)}let m=r,h=null;a&&e<o.length-1&&(h=yC(i[e],i[e+1],i[e+2]??i[e+1],bC),h&&(m=r-h.cutLen));let g=n.jumpRadius*OIe,_=[...s.get(e)??[]].sort((e,t)=>e.t-t.t).filter(e=>{let t=Math.min(e.d-p,m-e.d)-DIe;return e.r=Math.min(e.r,t),e.r>=g});for(let e=0;e<_.length-1;e++){let t=_[e+1].d-_[e].d;if(_[e].r+_[e+1].r>t){let n=t/2;_[e].r=Math.min(_[e].r,n),_[e+1].r=Math.min(_[e+1].r,n)}}for(let e of _)e.r<g||l.push(...xIe(e,u,d,f,n.jumpStyle));a&&h?(l.push(`L${_C(h.startX)},${_C(h.startY)}`),l.push(`Q${_C(h.ctrlX)},${_C(h.ctrlY)} ${_C(h.endX)},${_C(h.endY)}`)):l.push(`L${vC(t.b)}`)}return l.join(` `)}function CIe(e){return/^[\d\s+,.LMelm-]*$/.test(e)}function wIe(e){return!e||e===`linear`||e===`rounded`||e===`step`||e===`stepBefore`||e===`stepAfter`}function TIe(e){if(!e)return null;try{let t=typeof atob==`function`?atob(e):Buffer.from(e,`base64`).toString(),n=JSON.parse(t);if(!Array.isArray(n))return null;let r=[];for(let e of n)e&&typeof e.x==`number`&&typeof e.y==`number`&&r.push({x:e.x,y:e.y});return r.length>=2?r:null}catch{return null}}function EIe(e,t,n){if(!n.enabled)return;let r=e.node();if(!r)return;let i=new Map;for(let e of t)i.set(e.id,e);let a=new Map;for(let e of r.querySelectorAll(`path[data-id]`)){let t=e.getAttribute(`data-id`);t!==null&&!a.has(t)&&a.set(t,e)}let o=[];for(let e of t){let t=a.get(e.id);if(!t)continue;let n=TIe(t.getAttribute(`data-points`))??e.points;o.push({...e,points:n})}let s=vIe(o);if(s.length===0)return;let l=new Map;for(let e of s){let t=l.get(e.jumpEdgeId)??[];t.push(e),l.set(e.jumpEdgeId,t)}for(let e of o){let t=l.get(e.id);if(!t||t.length===0)continue;let r=i.get(e.id)?.curve;if(r!==void 0&&!wIe(r))continue;let o=a.get(e.id);if(!o||r===void 0&&!CIe(o.getAttribute(`d`)??``))continue;let s=o.getAttribute(`style`)??``,u=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(s),d=u?Number.parseFloat(u[1]):null,f=u?Number.parseFloat(u[2]):null,p=SIe(e,t,n);if(o.setAttribute(`d`,p),d!==null&&f!==null&&typeof o.getTotalLength==`function`){let e=o.getTotalLength(),t=`0 ${d} ${Math.max(0,e-d-f)} ${f}`,n=s.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${t};`).replace(/;\s*;+/g,`;`);o.setAttribute(`style`,n)}}}var bC,xC,DIe,OIe,SC,kIe=o((()=>{U_(),h(),bC=5,xC=1e-5,DIe=2,OIe=.6,SC=1e-6,p(mC,`buildSegmentList`),p(_Ie,`segmentIntersection`),p(hC,`isHorizontalSeg`),p(gC,`crossingSitsInRoundedCorner`),p(vIe,`findEdgeIntersections`),p(_C,`fmt`),p(vC,`pointToString`),p(yIe,`getArcSweepFlag`),p(bIe,`applyMarkerOffsets`),p(xIe,`emitJump`),p(yC,`computeRoundedCorner`),p(SIe,`rewriteEdgePath`),p(CIe,`isStraightPath`),p(wIe,`curveSupportsLineHops`),p(TIe,`decodeDataPoints`),p(EIe,`applyLineJumpsToSvg`)})),AIe=l({render:()=>sRe});function jIe(e,{measure:t}){let n=e.config?.swimlane?.lineHops;if(n===!1)return;let r=n===`gap`?`gap`:`arc`,i=e.edges.filter(e=>Array.isArray(e.points)&&e.points.length>=2).map(e=>({id:e.id,points:e.points,curve:e.curve,arrowTypeStart:e.arrowTypeStart,arrowTypeEnd:e.arrowTypeEnd}));EIe(t.groups.edgePaths,i,{enabled:!0,jumpRadius:6,jumpStyle:r})}function CC(e){return Math.max(e.padding??iT,iT)}function MIe(e){let{x:t,y:n,width:r,height:i}=e,a=e.swimlaneContentTop;if(typeof t!=`number`||typeof n!=`number`||typeof r!=`number`||typeof i!=`number`||typeof a!=`number`||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a)||r<=0||i<=0){delete e.groupTitleRect;return}let o=n-i/2,s=Math.min(a,n+i/2),l=o+Math.min($Le,Math.max(0,s-o));if(l<=o){delete e.groupTitleRect;return}e.groupTitleRect={left:t-r/2,right:t+r/2,top:o,bottom:l}}function NIe(e){let t=e.direction,n=e.nodes??=[];for(let n of e.nodes??[])n.isGroup&&!n.parentId&&(n.shape=`swimlane`,t&&(n.direction=t));let r=n.filter(e=>!e.isGroup&&!e.parentId);if(r.length===0)return;let i=n.find(e=>e.id===rT);i?i.isGroup&&(i.shape=`swimlane`,t&&(i.direction=t)):(i={id:rT,label:``,isGroup:!0,shape:`swimlane`,padding:20,look:e.config?.look,colorIndex:n.reduce((e,t)=>Math.max(e,t.colorIndex??-1),-1)+1,...t?{direction:t}:{}},n.push(i));for(let e of r)e.parentId=rT}function PIe(e){let t=new Map;for(let n of e.nodes??[])t.set(n.id,n);let n=[];for(let t of e.edges??[]){let e=typeof t.start==`string`?t.start:void 0,r=typeof t.end==`string`?t.end:void 0;e&&r&&(t.labelNodeId||n.push({id:t.id,src:e,dst:r,ref:t}))}let r=e.nodes??[],i=r.filter(e=>e.isGroup),a=r.filter(e=>!e.isGroup);return{nodes:[...[...i].reverse(),...a].map(e=>e.id),edges:n,layout:e,nodeById:t}}function FIe(e,t,n,r){let{layout:i}=e,a=e.nodeById,o=r?.layerGap??100,s=r?.nodeGap??40,l=0;for(let e of t.layers){let t=0;for(let r of e){let e=a.get(r);if(!e){t++;continue}e.layer=l,e.order=t;let i=n.x[r]??t*s,u=n.y[r]??l*o;e.x=i,e.y=u,t++}l++}let u=i.nodes??[],d=new Map,f=[];for(let e of u){if(!e?.isGroup)continue;e.parentId||f.push(e);let t=u.filter(t=>t.parentId===e.id),r=1/0,i=-1/0,a=1/0,o=-1/0;for(let e of t){let t=e.x??n.x[e.id],s=e.y??n.y[e.id],l=e.width??0,u=e.height??0;t!=null&&s!=null&&(r=Math.min(r,t-l/2),i=Math.max(i,t+l/2),a=Math.min(a,s-u/2),o=Math.max(o,s+u/2))}if(r===1/0||a===1/0)e.x=e.x??0,e.y=e.y??0,e.width=e.width??0,e.height=e.height??0;else{let t=e.padding??20,n=e.parentId?t:2*CC(e),s=t,l=Math.max(0,i-r)+n,u=Math.max(0,o-a)+s,f=(r+i)/2,p=(a+o)/2;e.x=f,e.y=p,e.width=l,e.height=u,d.set(e.id,{minX:r,maxX:i,minY:a,maxY:o})}}if(f.length>0&&d.size>0){let e=1/0,t=-1/0,n=0;for(let r of f){let i=r.padding??20;i>n&&(n=i);let a=d.get(r.id);a&&(e=Math.min(e,a.minY),t=Math.max(t,a.maxY))}if(e!==1/0&&t!==-1/0){let r=Math.max(0,t-e)+2*Math.max(n,36),i=(e+t)/2;for(let t of f)t.y=i,t.height=r,t.swimlaneContentTop=e;let a=[...f].sort((e,t)=>(e.x??0)-(t.x??0)),o=[],s=[],l=[];for(let e of a){let t=d.get(e.id);if(!t)continue;let n=Math.max(0,t.maxX-t.minX)+2*CC(e),r=(t.minX+t.maxX)/2;o.push(e.id),s.push(r),l.push(n)}let u=o.length;if(u>0){let e=new Map;if(u===1)e.set(o[0],l[0]);else{let t=[];for(let e=0;e<u-1;e++)t.push(s[e+1]-s[e]);let n=Array(u);n[0]=0;for(let e=0;e<u-1;e++)n[e+1]=2*t[e]-n[e];let r=0,i=1/0;for(let e=0;e<u;e++){let t=l[e];e%2==0?r=Math.max(r,t-n[e]):i=Math.min(i,n[e]-t)}let a=r;a=r<=i?(r+i)/2:r;for(let t=0;t<u;t++){let r=n[t]+(t%2==0?a:-a),i=Math.max(l[t],r);e.set(o[t],i)}}for(let t of f){let n=e.get(t.id);n!=null&&(t.width=n),MIe(t)}}}}}function IIe(e){let t=[],n=[],r=new Map;for(let t of e.nodes)r.set(t.id,t);for(let i of e.edges){if(!i.label||i.label.length===0||i.isLayoutOnly||i.labelNodeId)continue;let e=i.start?r.get(i.start):void 0,a=i.end?r.get(i.end):void 0;if(!e||!a){y.warn(eRe,`Edge ${i.id} has missing source or target node`);continue}let o=`edge-label-${i.start}-${i.end}-${i.id}`,s=e.parentId===a.parentId?e.parentId:a.parentId,l={id:o,label:i.label,edgeStart:i.start??``,edgeEnd:i.end??``,shape:`labelRect`,width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:s,isGroup:!1,labelStyle:Array.isArray(i.labelStyle)?i.labelStyle[0]:i.labelStyle??``,...e.dir?{dir:e.dir}:{}};t.push(l),i.labelNodeId=o,i.label=void 0,i.text=void 0;let u={id:`${i.id}-to-label`,start:i.start,end:o,type:`normal`,isLayoutOnly:!0},d={id:`${i.id}-from-label`,start:o,end:i.end,type:`normal`,isLayoutOnly:!0};n.push(u,d)}let i=[...e.nodes,...t],a=[...e.edges,...n];return{...e,nodes:i,edges:a}}function wC(e){let t=e.x??0,n=e.y??0,r=e.width??0,i=e.height??0;return r>0&&i>0?{cx:t,cy:n,rect:VC(t,n,r,i)}:void 0}function TC(e){if(e.isGroup)return;let t=wC(e);if(t)return{id:String(e.id??``),cx:t.cx,cy:t.cy,rect:t.rect}}function EC(e,t,n=aT){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}function DC(e,t,n=aT){return Math.abs(e.x-t.x)<n}function OC(e,t,n=aT){return Math.abs(e.y-t.y)<n}function kC(e,t,n=aT){return OC(e,t,n)&&Math.abs(e.x-t.x)>n}function AC(e,t,n=aT){return DC(e,t,n)&&Math.abs(e.y-t.y)>n}function jC(e,t,n,r){return Math.max(0,Math.min(Math.max(e,t),Math.max(n,r))-Math.max(Math.min(e,t),Math.min(n,r)))}function MC(e,t,n=aT){return e.horizontal&&t.horizontal&&OC(e.a,t.a,n)?jC(e.a.x,e.b.x,t.a.x,t.b.x):e.vertical&&t.vertical&&DC(e.a,t.a,n)?jC(e.a.y,e.b.y,t.a.y,t.b.y):0}function NC(e,t=aT){let n=[];for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1],o=kC(i,a,t),s=AC(i,a,t);(o||s)&&n.push({index:r,a:i,b:a,horizontal:o,vertical:s})}return n}function PC(e,t=aT){let n=NC(e,t),r=0;for(let e=1;e<n.length;e++)n[e-1].horizontal!==n[e].horizontal&&r++;return r}function FC(e,t=aT){let n=[];for(let r of e){let e=n.length>0?n[n.length-1]:void 0;(!e||!EC(e,r,t))&&n.push({x:r.x,y:r.y})}return n}function IC(e,t=aT){if(!e||e.length!==4)return;let[n,r,i,a]=e;return kC(n,r,t)&&AC(r,i,t)&&kC(i,a,t)?{kind:`HVH`,p0:n,p1:r,p2:i,p3:a}:AC(n,r,t)&&kC(r,i,t)&&AC(i,a,t)?{kind:`VHV`,p0:n,p1:r,p2:i,p3:a}:void 0}function LC(e,t,n,r=0){let i=Math.min(e.x,t.x),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y),s=Math.max(e.y,t.y);return a>n.left-r&&i<n.right+r&&s>n.top-r&&o<n.bottom+r}function RC(e,t,n=0){return e.x>t.left+n&&e.x<t.right-n&&e.y>t.top+n&&e.y<t.bottom-n}function LIe(e,t){return e.left<=t.left&&e.right>=t.right&&e.top<=t.top&&e.bottom>=t.bottom}function zC(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function BC(e,t){return{left:e.left-t,right:e.right+t,top:e.top-t,bottom:e.bottom+t}}function VC(e,t,n,r){return{left:e-n/2,right:e+n/2,top:t-r/2,bottom:t+r/2}}function HC(e){return wC(e)?.rect}function UC(e,t){switch(t){case`top`:return{x:e.cx,y:e.rect.top};case`bottom`:return{x:e.cx,y:e.rect.bottom};case`left`:return{x:e.rect.left,y:e.cy};case`right`:return{x:e.rect.right,y:e.cy}}}function WC(e,t,n,r,i,a=aT){let o=t===`left`||t===`right`,s=r===`left`||r===`right`;if(o&&s){if(t===`right`&&r===`left`&&e.x<n.x||t===`left`&&r===`right`&&e.x>n.x){if(OC(e,n,a))return[e,n];let t=(e.x+n.x)/2;return[e,{x:t,y:e.y},{x:t,y:n.y},n]}if(t===r){if(OC(e,n,a))return;let r=t===`left`?Math.min(e.x,n.x)-i:Math.max(e.x,n.x)+i;return[e,{x:r,y:e.y},{x:r,y:n.y},n]}return}if(!o&&!s){if(t===r){if(DC(e,n,a))return;let r=t===`top`?Math.min(e.y,n.y)-i:Math.max(e.y,n.y)+i;return[e,{x:e.x,y:r},{x:n.x,y:r},n]}if(!(t===`bottom`&&r===`top`&&e.y<n.y||t===`top`&&r===`bottom`&&e.y>n.y))return;if(DC(e,n,a))return[e,n];let o=(e.y+n.y)/2;return[e,{x:e.x,y:o},{x:n.x,y:o},n]}if(o&&!s){let i=t===`right`&&n.x>e.x||t===`left`&&n.x<e.x,a=r===`top`&&e.y<n.y||r===`bottom`&&e.y>n.y;return i&&a?[e,{x:n.x,y:e.y},n]:void 0}let l=t===`bottom`&&n.y>e.y||t===`top`&&n.y<e.y,u=r===`left`&&e.x<n.x||r===`right`&&e.x>n.x;return l&&u?[e,{x:e.x,y:n.y},n]:void 0}function GC(e,t,n,r){return t===`left`||t===`right`?[e,{x:r,y:e.y},{x:r,y:n.y},n]:[e,{x:e.x,y:r},{x:n.x,y:r},n]}function KC(e){let t=new Map,n=[];for(let r of e){if(r.isEdgeLabel)continue;let e=TC(r);e&&(t.set(e.id,e),n.push({id:e.id,rect:e.rect}))}return{nodeInfoById:t,realNodeRects:n}}function qC(e){let t=[],n=[];for(let r of e){let e=TC(r);if(!e)continue;let i={id:e.id,rect:e.rect};r.isEdgeLabel?n.push(i):t.push(i)}return{realNodeRects:t,labelNodeRects:n}}function RIe(e,{includeEdgeLabels:t=!0}={}){let n=[];for(let r of e){if(r.isGroup||!t&&r.isEdgeLabel)continue;let e=r.x??0,i=r.y??0,a=r.width??0,o=r.height??0;n.push({nodeId:r.id,...VC(e,i,a,o)})}return n}function JC(e,t,n=aT){let r=e.start,i=e.end;if(!r||!i)return;let a=t.get(r),o=t.get(i);if(a&&o)return{srcId:r,dstId:i,srcInfo:a,dstInfo:o,collinearX:Math.abs(a.cx-o.cx)<n,collinearY:Math.abs(a.cy-o.cy)<n}}function YC(e,t,n,r=[],i=0){for(let a of n)if(!r.includes(a.id)&&LC(e,t,a.rect,-i))return!0;return!1}function XC(e,t,n,r,i=aT,a=1e-6){let o=OC(e,t,i),s=DC(e,t,i),l=OC(n,r,i),u=DC(n,r,i);if(o&&l||s&&u||!(o||s)||!(l||u))return!1;let d=o?{a:e,b:t}:{a:n,b:r},f=s?{a:e,b:t}:{a:n,b:r},p=d.a.y,m=Math.min(d.a.x,d.b.x),h=Math.max(d.a.x,d.b.x),g=f.a.x,_=Math.min(f.a.y,f.b.y),v=Math.max(f.a.y,f.b.y);if(g<m||g>h||p<_||p>v)return!1;let y=Math.abs(g-d.a.x)<a&&Math.abs(p-d.a.y)<a||Math.abs(g-d.b.x)<a&&Math.abs(p-d.b.y)<a,b=Math.abs(g-f.a.x)<a&&Math.abs(p-f.a.y)<a||Math.abs(g-f.b.x)<a&&Math.abs(p-f.b.y)<a;return!(y&&b)}function zIe(e,t,n,r,i=aT){let a=OC(e,t,i),o=DC(e,t,i),s=OC(n,r,i),l=DC(n,r,i);return o&&l&&DC(e,n,i)?jC(e.y,t.y,n.y,r.y)>i:a&&s&&OC(e,n,i)?jC(e.x,t.x,n.x,r.x)>i:!1}function ZC(e,t,n,r,{epsilon:i=aT,skipDegenerateOther:a=!1}={}){for(let o of n){if(o===r||o.isLayoutOnly)continue;let n=o.points;if(!(!n||n.length<2))for(let r=0;r<n.length-1;r++){let o=n[r],s=n[r+1];if(!(a&&EC(o,s,i))&&(XC(e,t,o,s,i)||zIe(e,t,o,s,i)))return!0}}return!1}function QC(e,t,n,r,i=aT){let a=OC(e,t,i),o=DC(e,t,i),s=OC(n,r,i),l=DC(n,r,i);if(!(a&&l||o&&s))return!1;let u=a?{a:e,b:t}:{a:n,b:r},d=a?{a:n,b:r}:{a:e,b:t},f=u.a.y,p=Math.min(u.a.x,u.b.x),m=Math.max(u.a.x,u.b.x),h=d.a.x,g=Math.min(d.a.y,d.b.y),_=Math.max(d.a.y,d.b.y);return h>p+i&&h<m-i&&f>g+i&&f<_-i}function $C(e,t,n){let r=Math.min(t,n),i=Math.max(t,n);return e>r+aT&&e<i-aT}function BIe(e,t,n){return DC(e,t)&&DC(t,n)?$C(t.y,e.y,n.y):OC(e,t)&&OC(t,n)?$C(t.x,e.x,n.x):!1}function VIe(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let i=n[n.length-1],a=e[r],o=r+1<e.length?e[r+1]:void 0;if(i&&o){if(EC(i,o)){r++,t=!0;continue}if(BIe(i,a,o)){t=!0;continue}}n.push(a)}return{points:n,changed:t}}function ew(e){let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[t.length-1],i=e[n];if(!DC(r,i)&&!OC(r,i)){let e=t.length>=2?t[t.length-2]:void 0,n=e&&DC(e,r)?{x:r.x,y:i.y}:{x:i.x,y:r.y};t.push(n)}t.push(i)}let n=[];for(let e of t){let t=n[n.length-1];(!t||!EC(t,e))&&n.push(e)}return n}function tw(e){if(e.length<3)return e;let t=[...e];for(let e=0;e<32;e++){let e=VIe(t);if(t=e.points,!e.changed)break}return t}function nw(e,t,n){let r=e;if(r.isLayoutOnly||!r.points||r.points.length<n)return;let i=r.start?t.get(r.start):void 0,a=r.end?t.get(r.end):void 0;return{edge:r,points:r.points,srcRect:i?HC(i):void 0,dstRect:a?HC(a):void 0}}function HIe(e,t,n){if(OC(e,t,oT))return{x:e.x<n.left?n.left:n.right,y:e.y};if(DC(e,t,oT)){let t=e.y<n.top?n.top:n.bottom;return{x:e.x,y:t}}return{x:Math.min(n.right,Math.max(n.left,e.x)),y:Math.min(n.bottom,Math.max(n.top,e.y))}}function rw(e,t,n){let r=n?1:-1,i=n?0:e.length-1;for(;i>=0&&i<e.length&&RC(e[i],t,tRe);)i+=r;if(i<0||i>=e.length)return e;let a=i-r;if(a<0||a>=e.length)return e;let o=HIe(e[i],e[a],t);return n?[o,...e.slice(i)]:[...e.slice(0,i+1),o]}function UIe(e,t){for(let n of e){let e=nw(n,t,2);if(!e)continue;let r=[...e.points];e.srcRect&&(r=rw(r,e.srcRect,!0)),e.dstRect&&(r=rw(r,e.dstRect,!1)),r=tw(ew(r)),r=fw(r,e.srcRect,e.dstRect),e.edge.points=tw(ew(r))}}function iw(e,t,n,r=!1){if(OC(e,t,oT)){if(t.y<n.top-oT||t.y>n.bottom+oT)return t;if(r){if(e.x<n.left-oT)return{x:n.left,y:e.y};if(e.x>n.right+oT)return{x:n.right,y:e.y}}return{x:Math.abs(t.x-n.left)<=Math.abs(t.x-n.right)?n.left:n.right,y:e.y}}if(DC(e,t,oT)){if(t.x<n.left-oT||t.x>n.right+oT)return t;if(r){if(e.y<n.top-oT)return{x:e.x,y:n.top};if(e.y>n.bottom+oT)return{x:e.x,y:n.bottom}}let i=Math.abs(t.y-n.top)<=Math.abs(t.y-n.bottom);return{x:e.x,y:i?n.top:n.bottom}}return t}function aw(e,t,n){let r=e[t];for(let i=t+n;i>=0&&i<e.length;i+=n){let t=e[i];if(!EC(t,r,oT))return t}return e[t+n]}function ow(e,t){let n=e+sT,r=t-sT;return n<=r?{lo:n,hi:r}:{lo:(e+t)/2,hi:(e+t)/2}}function sw(e,t,n){let{lo:r,hi:i}=ow(t,n);return Math.min(i,Math.max(r,e))}function WIe(e){let t=Math.max(...e.map(e=>e.lo)),n=Math.min(...e.map(e=>e.hi));if(!(t>n))return{lo:t,hi:n}}function cw(e,t){return t===`left`||t===`right`?ow(e.top,e.bottom):ow(e.left,e.right)}function lw(e,t,n){let r=e.y>=n.top-oT&&e.y<=n.bottom+oT,i=e.x>=n.left-oT&&e.x<=n.right+oT;if(OC(e,t,oT)&&r){if(Math.abs(e.x-n.left)<oT)return`left`;if(Math.abs(e.x-n.right)<oT)return`right`}if(DC(e,t,oT)&&i){if(Math.abs(e.y-n.top)<oT)return`top`;if(Math.abs(e.y-n.bottom)<oT)return`bottom`}}function uw(e){return e===`left`||e===`right`}function GIe(e,t,n,r,i){let a=[],o=n?lw(e,t,n):void 0,s=r?lw(t,e,r):void 0;return n&&o&&uw(o)===i&&a.push(cw(n,o)),r&&s&&uw(s)===i&&a.push(cw(r,s)),a.length>0?WIe(a):void 0}function dw(e,t,n,r,i){let a=GIe(e,t,n,r,i);if(!a)return;let o=i?e.y:e.x,s=Math.min(a.hi,Math.max(a.lo,o));if(!(Math.abs(s-o)<oT))return i?[{x:e.x,y:s},{x:t.x,y:s}]:[{x:s,y:e.y},{x:s,y:t.y}]}function fw(e,t,n){if(e.length!==2)return e;let[r,i]=e;return OC(r,i,oT)?dw(r,i,t,n,!0)??e:DC(r,i,oT)?dw(r,i,t,n,!1)??e:e}function KIe(e,t,n){return uw(n)?{x:e.x,y:sw(e.y,t.top,t.bottom)}:{x:sw(e.x,t.left,t.right),y:e.y}}function qIe(e,t,n,r,i,a){let o=e.map(e=>({...e}));for(let s=t;s>=0&&s<e.length;s+=n){let t=e[s];if(a&&!OC(t,r,oT)||!a&&!DC(t,r,oT))break;a?o[s].y=i.y:o[s].x=i.x}return o}function pw(e,t,n){if(e.length<2)return e;let r=n?0:e.length-1,i=n?1:-1,a=e[r],o=aw(e,r,i);if(!o)return e;let s=lw(a,o,t);if(!s)return e;let l=uw(s),u=KIe(a,t,s);return EC(a,u,oT)?e:qIe(e,r,i,a,u,l)}function mw(e,t,n){let r=Math.min(e.x,t.x)>=n.left-oT&&Math.max(e.x,t.x)<=n.right+oT,i=Math.min(e.y,t.y)>=n.top-oT&&Math.max(e.y,t.y)<=n.bottom+oT;if(Math.abs(e.y-n.top)<oT&&Math.abs(t.y-n.top)<oT&&r)return`top`;if(Math.abs(e.y-n.bottom)<oT&&Math.abs(t.y-n.bottom)<oT&&r)return`bottom`;if(Math.abs(e.x-n.left)<oT&&Math.abs(t.x-n.left)<oT&&i)return`left`;if(Math.abs(e.x-n.right)<oT&&Math.abs(t.x-n.right)<oT&&i)return`right`}function hw(e,t,n,r){switch(e){case`top`:return DC(t,n,oT)&&n.y<r.top-oT;case`bottom`:return DC(t,n,oT)&&n.y>r.bottom+oT;case`left`:return OC(t,n,oT)&&n.x<r.left-oT;case`right`:return OC(t,n,oT)&&n.x>r.right+oT}}function gw(e,t,n){if(e.length<3)return e;if(n){let n=mw(e[0],e[1],t);return n&&hw(n,e[1],e[2],t)?e.slice(1):e}let r=e.length-1,i=mw(e[r-1],e[r],t);return i&&hw(i,e[r-1],e[r-2],t)?e.slice(0,r):e}function JIe(e,t,n){let r=e;if(t){let e=aw(r,0,1);if(e){let n=iw(e,r[0],t);n!==r[0]&&(r=[n,...r.slice(1)])}r=gw(r,t,!0)}if(n){let e=r.length-1,t=aw(r,e,-1);if(t){let i=iw(t,r[e],n,!0);i!==r[e]&&(r=[...r.slice(0,e),i])}r=gw(r,n,!1)}let i=fw(r,t,n);return i!==r||r.length===2?i:(t&&(r=pw(r,t,!0)),n&&(r=pw(r,n,!1)),r)}function _w(e,t){for(let n of e){let e=nw(n,t,2);if(!e)continue;let r=JIe(FC(e.points,oT),e.srcRect,e.dstRect);if(r.length<3){e.edge.points=r;continue}let i=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];e.edge.points=i}}function vw(e){return new Map(e.map(e=>[e.id,e]))}function YIe(e,t){let n=e.parentId,r=null;for(;n;){let e=t.get(n);if(!e?.isGroup)break;r=e.id,n=e.parentId}return r}function yw(e,t){let n=0,r=e.parentId;for(;r;){let e=t.get(r);if(!e?.isGroup)break;n++,r=e.parentId}return n}function bw(e){let t=1/0,n=-1/0,r=1/0,i=-1/0;for(let a of e){let e=a.x,o=a.y;if(typeof e!=`number`||typeof o!=`number`)continue;let s=a.width??0,l=a.height??0;t=Math.min(t,e-s/2),n=Math.max(n,e+s/2),r=Math.min(r,o-l/2),i=Math.max(i,o+l/2)}return t===1/0||r===1/0?null:{minX:t,maxX:n,minY:r,maxY:i}}function XIe(e,t){let n=e.padding??20;e.x=(t.minX+t.maxX)/2,e.y=(t.minY+t.maxY)/2,e.width=Math.max(0,t.maxX-t.minX)+n,e.height=Math.max(0,t.maxY-t.minY)+n}function ZIe(e){let t=vw(e),n=e.filter(e=>e.isGroup&&e.parentId).sort((e,n)=>yw(n,t)-yw(e,t));for(let t of n){let n=bw(e.filter(e=>e.parentId===t.id));n&&XIe(t,n)}}function xw(e,t){let n=e.nodes??[],r=e.edges??[],i=n.filter(e=>!e.isGroup),a=1/0,o=-1/0;for(let e of i){let n=e[t];typeof n==`number`&&(a=Math.min(a,n),o=Math.max(o,n))}if(!Number.isFinite(a)||!Number.isFinite(o))return!1;let s=p(e=>a+o-e,`mirror`);for(let e of n){let n=e[t];typeof n==`number`&&(e[t]=s(n));let r=e.groupTitleRect;r&&(e.groupTitleRect=t===`x`?{...r,left:s(r.right),right:s(r.left)}:{...r,top:s(r.bottom),bottom:s(r.top)})}for(let e of r)for(let n of e.points??[])n[t]=s(n[t]);return!0}function QIe(e){return!(e.nodes??[]).some(e=>!e.isGroup)||xw(e,`y`)}function $Ie(e,t=`LR`){let n=e.nodes??[],r=e.edges??[],i=n.filter(e=>!e.isGroup),a=1/0,o=1/0;for(let e of i){let t=e.x??0,n=e.y??0;t<a&&(a=t),n<o&&(o=n)}if(!Number.isFinite(a)||!Number.isFinite(o))return!1;let s=0,l=0;for(let e of i)s+=e.width??0,l+=e.height??0;let u=s/i.length,d=l/i.length,f=d>0?Math.max(1,u/d):1;for(let e of i){let t=e.x??0,n=((e.y??0)-o)*f+36,r=t-a;e.x=n,e.y=r}for(let e of r)if(e.points)for(let t of e.points){let e=t.x,n=(t.y-o)*f+36,r=e-a;t.x=n,t.y=r}ZIe(n);let p=n.filter(e=>e.isGroup&&!e.parentId);if(p.length===0)return t===`RL`&&xw(e,`x`),!0;let m=vw(n),h=new Map;for(let e of n){if(e.isGroup)continue;let t=YIe(e,m);if(!t)continue;let n=h.get(t)??[];n.push(e),h.set(t,n)}let g=0;for(let e of p){let t=e.padding??0;t>g&&(g=t)}let _=[],v=1/0,y=-1/0;for(let e of p){let t=bw(h.get(e.id)??[]);t&&(v=Math.min(v,t.minX),y=Math.max(y,t.maxX),_.push({lane:e,contentTop:t.minY,contentBottom:t.maxY,centerY:(t.minY+t.maxY)/2}))}if(v===1/0||y===-1/0)return!0;let b=Math.max(0,y-v)+2*Math.max(g,10),x=36+b,S=(v+y)/2-b/2-36,C=S+x/2,w=Math.max(g,36);_.sort((e,t)=>e.centerY-t.centerY);for(let e=0;e<_.length;e++){let t=_[e],n,r;if(n=e===0?t.contentTop-w:(_[e-1].contentBottom+t.contentTop)/2,e===_.length-1)r=t.contentBottom+w;else{let n=_[e+1];r=(t.contentBottom+n.contentTop)/2}let i=Math.max(0,r-n),a=(n+r)/2;t.lane.x=C,t.lane.y=a,t.lane.width=x,t.lane.height=i,t.lane.swimlaneContentTop=t.contentTop,t.lane.groupTitleRect={left:S,right:S+36,top:n,bottom:r}}return t===`RL`&&xw(e,`x`),!0}function eLe(e,t){let{nodeInfoById:n,realNodeRects:r}=KC(t);for(let t of e){if(t.isLayoutOnly)continue;let i=t.points;if(!i||i.length<4)continue;let a=IC(FC(i,cT),cT);if(!a)continue;let{p3:o}=a,s=a.kind===`HVH`,l=JC(t,n,cT);if(!l)continue;let{srcId:u,dstId:d,srcInfo:f,dstInfo:p,collinearX:m,collinearY:h}=l;if(m||h)continue;let g,_=f.rect;for(let n of nRe){let i,a,l;if(s){let e=p.cy>f.cy?_.bottom:_.top,t=f.cx+n;if(t<=_.left+cT||t>=_.right-cT)continue;i={x:t,y:e},a={x:t,y:o.y},l={x:o.x,y:o.y}}else{let e=p.cx>f.cx?_.right:_.left,t=f.cy+n;if(t<=_.top+cT||t>=_.bottom-cT)continue;i={x:e,y:t},a={x:o.x,y:t},l={x:o.x,y:o.y}}let m=EC(i,a,cT),h=EC(a,l,cT);if(m&&h||!m&&YC(i,a,r,[u],1)||!h&&YC(a,l,r,[d],1))continue;let v=!m&&ZC(i,a,e,t,{epsilon:cT,skipDegenerateOther:!0}),y=!h&&ZC(a,l,e,t,{epsilon:cT,skipDegenerateOther:!0});if(!(v||y)){g=m?[a,l]:h?[i,a]:[i,a,l];break}}g&&(t.points=g)}}function tLe(e,t){let n=.001,{realNodeRects:r,labelNodeRects:i}=qC(t.values());for(let a of e){if(a.isLayoutOnly)continue;let o=a.points;if(!o||o.length<4)continue;let s=FC(o,n);if(s.length<4)continue;let l=s.length-1,u=s[l],d=s[l-1],f=s[l-2],m=u.x-d.x,h=u.y-d.y,g=Math.hypot(m,h);if(g>=10||g<n)continue;let _=d.x-f.x,v=d.y-f.y;if(Math.hypot(_,v)<n)continue;let y=kC(d,u,n),b=AC(d,u,n),x=kC(f,d,n),S=AC(f,d,n);if(!(y&&S||b&&x))continue;let C=a.end,w=a.start,T=C?t.get(C):void 0;if(!T)continue;let E=T.x??0,D=T.y??0,O=HC(T);if(!O)continue;let k,A;if(S){let e=v<0;k={x:E,y:f.y},A={x:E,y:e?O.bottom:O.top}}else{let e=_>0;k={x:f.x,y:D},A={x:e?O.right:O.left,y:D}}if(YC(k,A,r,C?[C]:[],-2)||YC(k,A,i,[],-2))continue;if(w){let e=t.get(w),n=e?HC(e):void 0;if(n&&RC(k,n,2))continue}let j=p((e,t)=>`${e.x.toFixed(3)},${e.y.toFixed(3)}|${t.x.toFixed(3)},${t.y.toFixed(3)}`,`ownSegmentKey`),M=new Set;for(let e=0;e<s.length-1;e++)M.add(j(s[e],s[e+1]));let N=p((t,r)=>{for(let i of e){if(i===a||i.isLayoutOnly)continue;let e=i.points;if(!(!e||e.length<2))for(let i=0;i<e.length-1;i++){let a=e[i],o=e[i+1];if(!M.has(j(a,o))&&QC(t,r,a,o,n))return!0}}return!1},`segmentCrossesOtherEdge`);if(N(k,A))continue;if(l-3>=0){let e=s[l-3],t=[w,C].filter(e=>!!e);if(YC(e,k,r,t,-2)||N(e,k))continue}let P=[...s.slice(0,l-2),k,A];a.points=P;let F=a.labelNodeId;if(F){let e=t.get(F);if(e){let t=e.width??0,r=e.height??0;if(t>0&&r>0){let i,a,o=-1;for(let e=0;e<P.length-1;e++){let s=P[e],l=P[e+1],u=Math.hypot(l.x-s.x,l.y-s.y),d=OC(s,l,n),f=DC(s,l,n);(d&&u>=t+2||f&&u>=r+2)&&u>o&&(o=u,i=(s.x+l.x)/2,a=(s.y+l.y)/2)}i!==void 0&&a!==void 0&&(e.x=i,e.y=a)}}}}}function nLe(e,t){let n=p((e,t)=>{let n=e.x??0,r=e.y??0,i=t.x-n,a=t.y-r,o=(e.width??0)/2,s=(e.height??0)/2;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),{x:n+(a===0?0:s*i/a),y:r+s}):(i<0&&(o=-o),{x:n+o,y:r+(i===0?0:o*a/i)})},`rectIntersect`),r=p((e,r)=>{let i=FC(e.points??[]);if(i.length<2)return;let a=r?e.start:e.end,o=a?t.get(a):void 0,s=o?HC(o):void 0;if(!o||!a||!s)return;let l=r?i[0]:i[i.length-1],u=r?i[1]:i[i.length-2],d=n(o,l),f=l;if(pT(u,d)&&(f=u),DC(d,f,uT))return{edge:e,edgeId:String(e.id??``),nodeId:a,atStart:r,orientation:`V`,coord:d.x,min:Math.min(d.y,f.y),max:Math.max(d.y,f.y),boundary:d,railEnd:f,rect:s};if(OC(d,f,uT))return{edge:e,edgeId:String(e.id??``),nodeId:a,atStart:r,orientation:`H`,coord:d.y,min:Math.min(d.x,f.x),max:Math.max(d.x,f.x),boundary:d,railEnd:f,rect:s}},`terminalLaneFor`),i=p((e,t)=>Math.max(0,Math.min(e.max,t.max)-Math.max(e.min,t.min)),`projectedOverlapLength`),a=p((e,t)=>e.nodeId!==t.nodeId||e.orientation!==t.orientation?!1:e.orientation===`H`?(Math.abs(e.boundary.x-e.rect.left)<1||Math.abs(e.boundary.x-e.rect.right)<1)&&DC(e.boundary,t.boundary,1):(Math.abs(e.boundary.y-e.rect.top)<1||Math.abs(e.boundary.y-e.rect.bottom)<1)&&OC(e.boundary,t.boundary,1),`sameTerminalFace`),o=p((e,t)=>e.nodeId!==t.nodeId||e.orientation!==t.orientation?!1:i(e,t)>=dT&&Math.abs(e.coord-t.coord)<.5,`exactTerminalLaneConflict`),s=p((e,t)=>{if(e.nodeId!==t.nodeId||e.orientation!==t.orientation||e.orientation!==`H`||e.atStart===t.atStart)return!1;let n=i(e,t);if(n<dT)return!1;let r=e.rect.bottom-e.rect.top;return n<r||n>2*r?!1:a(e,t)&&Math.abs(e.coord-t.coord)<16},`nearTerminalLaneConflict`),l=p((e,t)=>{let n=FC(e.edge.points??[]);if(n.length<2)return;let r=e.orientation===`V`?{x:e.boundary.x+t,y:e.boundary.y}:{x:e.boundary.x,y:e.boundary.y+t},i=e.orientation===`V`?{x:e.railEnd.x+t,y:e.railEnd.y}:{x:e.railEnd.x,y:e.railEnd.y+t};if(!p(()=>Math.abs(e.boundary.y-e.rect.top)<1||Math.abs(e.boundary.y-e.rect.bottom)<1?OC(r,e.boundary,uT)&&r.x>=e.rect.left+1&&r.x<=e.rect.right-1:Math.abs(e.boundary.x-e.rect.left)<1||Math.abs(e.boundary.x-e.rect.right)<1?DC(r,e.boundary,uT)&&r.y>=e.rect.top+1&&r.y<=e.rect.bottom-1:!1,`boundaryStaysOnSameFace`)())return;if(e.atStart){let t=n.length>1&&EC(n[1],e.railEnd,uT),a=n.slice(t?2:1),o=a[0];return o&&!pT(o,i)?void 0:[r,i,...a]}let a=n.length>1&&EC(n[n.length-2],e.railEnd,uT),o=n.slice(0,a?-2:-1),s=o[o.length-1];if(!s||pT(s,i))return[...o,i,r]},`shiftedCandidate`),u=p(e=>{let n=e.edge,r=FC(n.points??[]);if(r.length!==2)return!1;let i=n.start,a=n.end,o=i?t.get(i):void 0,s=a?t.get(a):void 0;if(!o||!s)return!1;let l=o.x??0,u=o.y??0,d=s.x??0,f=s.y??0,[p,m]=r;return OC(p,m,uT)&&Math.abs(u-f)<1&&Math.abs(l-d)>1||DC(p,m,uT)&&Math.abs(l-d)<1&&Math.abs(u-f)>1},`laneIsStraightCollinearConnector`),d=[-7,7,-14,14,-21,21];for(let t=0;t<8;t++){let t=e.filter(e=>!e.isLayoutOnly).flatMap(e=>[r(e,!0),r(e,!1)]).filter(e=>!!e),n=!1;for(let e=0;e<t.length&&!n;e++)for(let i=e+1;i<t.length&&!n;i++){let a=t[e],f=t[i];if(a.edge===f.edge||!(o(a,f)||s(a,f)))continue;let p=!o(a,f),m=[a,f].sort((e,t)=>{let n=u(e),r=u(t);return n===r?Number(!t.atStart)-Number(!e.atStart):Number(n)-Number(r)});for(let e of m){for(let i of d){let a=l(e,i);if(!a)continue;let u=r({...e.edge,points:a},e.atStart);if(u&&!t.some(t=>t.edge!==e.edge&&(o(u,t)||p&&s(u,t)))){e.edge.points=a,n=!0;break}}if(n)break}}if(!n)return}}function rLe(e,t){let{realNodeRects:n,labelNodeRects:r}=qC(t.values()),i=p((t,i)=>{let a=t.start,o=t.end,s=fT(i);if(s.length!==i.length-1)return!1;let l=[a,o].filter(e=>!!e);for(let e of s)if(YC(e.a,e.b,n,l,-2)||YC(e.a,e.b,r,[],-2))return!1;for(let n of e){if(n===t||n.isLayoutOnly)continue;let e=n.points;if(!(!e||e.length<2)){for(let t of s)for(let n of fT(FC(e)))if(MC(t,n,.5)>=dT||QC(t.a,t.b,n.a,n.b,uT))return!1}}return!0},`candidateIsSafe`),a=p((e,t)=>{if(t+4>=e.length)return;let n=e[t],r=e[t+1],i=e[t+2],a=e[t+3],o=e[t+4],s=kC(n,r)&&AC(r,i)&&kC(i,a)&&AC(a,o)&&DC(n,a,uT)&&DC(n,o,uT)&&DC(r,i,uT)&&(r.x-n.x)*(a.x-i.x)<0,l=AC(n,r)&&kC(r,i)&&AC(i,a)&&kC(a,o)&&OC(n,a,uT)&&OC(n,o,uT)&&OC(r,i,uT)&&(r.y-n.y)*(a.y-i.y)<0;if(s||l)return FC([...e.slice(0,t+1),o,...e.slice(t+5)]);if(t+5>=e.length)return;let u=e[t+5],d=AC(n,r)&&kC(r,i)&&AC(i,a)&&kC(a,o)&&AC(o,u)&&DC(n,o,uT)&&DC(n,u,uT)&&DC(i,a,uT)&&(i.x-r.x)*(o.x-a.x)<0,f=kC(n,r)&&AC(r,i)&&kC(i,a)&&AC(a,o)&&kC(o,u)&&OC(n,o,uT)&&OC(n,u,uT)&&OC(i,a,uT)&&(i.y-r.y)*(o.y-a.y)<0;if(d||f)return FC([...e.slice(0,t+1),u,...e.slice(t+6)])},`withoutDogleg`);for(let t=0;t<8;t++){let t=!1;for(let n of e){if(n.isLayoutOnly)continue;let e=FC(n.points??[]);for(let r=0;r<=e.length-5;r++){let o=a(e,r);if(o&&i(n,o)){n.points=o,t=!0;break}}if(t)break}if(!t)return}}function Sw(e,t){let{realNodeRects:n,labelNodeRects:r}=qC(t.values()),i=e.filter(e=>!e.isLayoutOnly),a=p((e,t,n)=>FC(e===t?n??[]:e.points??[]),`pointsFor`),o=p((e,t)=>{let n=0;for(let r=0;r<i.length;r++){let o=fT(a(i[r],e,t));for(let s=r+1;s<i.length;s++){let r=fT(a(i[s],e,t));for(let e of o)for(let t of r)QC(e.a,e.b,t.a,t.b,uT)&&n++}}return n},`strictCrossingCount`),s=p(e=>{let t=fT(e);if(t.length!==3)return;let n=t[1];if(t[0].horizontal!==n.horizontal&&t[2].horizontal!==n.horizontal)return{index:n.index,horizontal:n.horizontal,vertical:n.vertical,segment:n}},`middleRail`),l=p((e,t)=>{let r=[e.start,e.end].filter(e=>!!e);return n.filter(e=>{if(r.includes(e.id))return!1;let n=e.rect;return t.horizontal?jC(t.a.x,t.b.x,n.left,n.right)>=dT&&t.a.y>=n.top-2&&t.a.y<=n.bottom+2:jC(t.a.y,t.b.y,n.top,n.bottom)>=dT&&t.a.x>=n.left-2&&t.a.x<=n.right+2})},`blockingRectsFor`),u=p((e,t,n)=>{let r=e.map(e=>({...e}));if(t.horizontal)r[t.index].y=n,r[t.index+1].y=n;else if(t.vertical)r[t.index].x=n,r[t.index+1].x=n;else return;let i=tw(FC(r));return fT(i).length===i.length-1?i:void 0},`candidateByMovingRail`),d=p((e,t,s)=>{let l=[e.start,e.end].filter(e=>!!e),u=fT(t);if(u.length!==t.length-1)return!1;for(let e of u)if(YC(e.a,e.b,n,l,-2)||YC(e.a,e.b,r,[],-2))return!1;for(let t of i)if(t!==e){for(let e of u)for(let n of fT(a(t)))if(MC(e,n,.5)>=dT)return!1}return o(e,t)<=s},`candidateIsSafe`);for(let e=0;e<8;e++){let e=o(),t=!1;for(let n of i){let r=a(n),i=s(r);if(!i)continue;let o=l(n,i.segment);if(o.length===0)continue;let f=i.horizontal?[Math.min(...o.map(e=>e.rect.top))-20,Math.max(...o.map(e=>e.rect.bottom))+20]:[Math.min(...o.map(e=>e.rect.left))-20,Math.max(...o.map(e=>e.rect.right))+20];for(let a of f){let o=u(r,i.segment,a);if(o&&d(n,o,e)){n.points=o,t=!0;break}}if(t)break}if(!t)return}}function Cw(e,t){let n=p(e=>{let t=e.groupTitleRect;if(!(!t||typeof t.left!=`number`||typeof t.right!=`number`||typeof t.top!=`number`||typeof t.bottom!=`number`||!Number.isFinite(t.left)||!Number.isFinite(t.right)||!Number.isFinite(t.top)||!Number.isFinite(t.bottom)||t.right<=t.left||t.bottom<=t.top))return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},`validTitleRect`),r=p(e=>{if(!e.isGroup||e.parentId)return;let t=e.direction,r=typeof t==`string`?t.toUpperCase():``;if(r===`LR`||r===`RL`||r===`BT`)return;let i=n(e),a=e.y,o=e.height;if(!i||typeof a!=`number`||typeof o!=`number`||!Number.isFinite(a)||!Number.isFinite(o)||o<=0)return;let s=i.right-i.left,l=i.bottom-i.top;if(!(l<=0||s<l))return{node:e,rect:i}},`topLaneTitleFor`),i=p((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return n<=t.top+uT||n>=t.bottom-uT?!1:jC(e.a.x,e.b.x,t.left,t.right)>=dT},`horizontalSegmentIntersectsTitle`),a=[...t.values()].map(r).filter(e=>!!e);if(a.length===0)return;let o=0;for(let t of e){if(t.isLayoutOnly)continue;let e=FC(t.points??[]);for(let t of fT(e))for(let e of a)i(t,e.rect)&&(o=Math.max(o,e.rect.bottom-t.a.y+4))}if(!(o<=uT))for(let e of a){let t=e.node.y,n=e.node.height;typeof t!=`number`||typeof n!=`number`||!Number.isFinite(t)||!Number.isFinite(n)||n<=0||(e.node.y=t-o/2,e.node.height=n+o,e.node.groupTitleRect={...e.rect,top:e.rect.top-o,bottom:e.rect.bottom-o})}}function ww(e,t){let n=p(e=>{let t=e.groupTitleRect;if(!(!t||typeof t.left!=`number`||typeof t.right!=`number`||typeof t.top!=`number`||typeof t.bottom!=`number`||!Number.isFinite(t.left)||!Number.isFinite(t.right)||!Number.isFinite(t.top)||!Number.isFinite(t.bottom)||t.right<=t.left||t.bottom<=t.top))return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},`validTitleRect`),r=p(e=>{if(!e.isGroup||e.parentId||e.direction!==`LR`)return;let t=n(e),r=e.x,i=e.width;if(!t||typeof r!=`number`||typeof i!=`number`||!Number.isFinite(r)||!Number.isFinite(i)||i<=0)return;let a=t.right-t.left,o=t.bottom-t.top;if(!(a<=0||o<a))return{node:e,rect:t}},`leftLaneTitleFor`),i=p((e,t)=>{if(!e.vertical)return!1;let n=e.a.x;return n<=t.left+uT||n>=t.right-uT?!1:jC(e.a.y,e.b.y,t.top,t.bottom)>=dT},`verticalSegmentIntersectsTitle`),a=p((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return n<=t.top+uT||n>=t.bottom-uT?!1:jC(e.a.x,e.b.x,t.left,t.right)>=dT},`horizontalSegmentIntersectsTitle`),o=[...t.values()].map(r).filter(e=>!!e);if(o.length===0)return;let s=0;for(let t of e){if(t.isLayoutOnly)continue;let e=FC(t.points??[]);for(let t of fT(e))for(let e of o)if(i(t,e.rect))s=Math.max(s,e.rect.right-t.a.x+4);else if(a(t,e.rect)){let n=Math.min(t.a.x,t.b.x);s=Math.max(s,e.rect.right-n+4)}}if(!(s<=uT))for(let e of o){let t=e.node.x,n=e.node.width;typeof t!=`number`||typeof n!=`number`||!Number.isFinite(t)||!Number.isFinite(n)||n<=0||(e.node.x=t-s/2,e.node.width=n+s,e.node.groupTitleRect={...e.rect,left:e.rect.left-s,right:e.rect.right-s})}}function iLe(e,t){let{realNodeRects:n}=qC(t.values()),r=e.filter(e=>!e.isLayoutOnly),i=p((e,t=new Map)=>FC(t.get(e)??e.points??[]),`replacementPointsFor`),a=p((e=new Map)=>{let t=0;for(let n=0;n<r.length;n++){let a=fT(i(r[n],e));for(let o=n+1;o<r.length;o++){let n=fT(i(r[o],e));for(let e of a)for(let r of n)QC(e.a,e.b,r.a,r.b,uT)&&t++}}return t},`crossingCount`),o=p((e=new Map)=>r.reduce((t,n)=>t+PC(i(n,e)),0),`totalBends`),s=p(e=>{let t=i(e);if(t.length<4)return;let n=t[t.length-2],r=t[t.length-1];if(kC(n,r,uT)||AC(n,r,uT))return{tailStart:n,terminal:r}},`terminalTailFor`),l=p((e,t)=>{let n=i(e);if(n.length<3)return;let r=n[0],a=n[1],o;if(kC(r,a,uT))o={x:a.x,y:t.tailStart.y};else if(AC(r,a,uT))o={x:t.tailStart.x,y:a.y};else return;let s=tw(FC([r,a,o,t.tailStart,t.terminal]));return fT(s).length===s.length-1?s:void 0},`candidateWithDestinationTail`),u=p((e,t)=>{let r=[e.start,e.end].filter(e=>!!e);for(let e of fT(t))if(YC(e.a,e.b,n,r,-2))return!0;return!1},`pathHasNodeHit`),d=p((e,t,n)=>{for(let a of r)if(a!==e){for(let e of fT(t))for(let t of fT(i(a,n)))if(MC(e,t,.5)>=dT)return!0}return!1},`pathHasSharedTrack`),f=p((e,t,n)=>!u(e,t)&&!d(e,t,n),`candidateIsSafe`),m=p(()=>{let e=new Map;for(let n of r){let r=n.end;if(!r||!t.has(r)||i(n).length<4)continue;let a=e.get(r)??[];a.push(n),e.set(r,a)}return e},`edgesByDestination`);for(let e=0;e<4;e++){let e=a();if(e===0)return;let t=o(),n,r=e,i=t;for(let t of m().values())for(let u=0;u<t.length;u++)for(let d=u+1;d<t.length;d++){let p=t[u],m=t[d],h=s(p),g=s(m);if(!h||!g)continue;let _=l(p,g),v=l(m,h);if(!_||!v)continue;let y=new Map([[p,_],[m,v]]);if(!f(p,_,y)||!f(m,v,y))continue;let b=a(y),x=o(y);b>=e||b>r||b===r&&x>=i||(n=y,r=b,i=x)}if(!n)return;for(let[e,t]of n)e.points=t}}function aLe(e,t){let{realNodeRects:n,labelNodeRects:r}=qC(t.values()),i=e.filter(e=>!e.isLayoutOnly),a=p((e,t=new Map)=>FC(t.get(e)??e.points??[]),`replacementPointsFor`),o=p((e=new Map)=>{let t=0;for(let n=0;n<i.length;n++){let r=fT(a(i[n],e));for(let o=n+1;o<i.length;o++){let n=fT(a(i[o],e));for(let e of r)for(let r of n)QC(e.a,e.b,r.a,r.b,uT)&&t++}}return t},`strictCrossingCount`),s=p((e=new Map)=>i.reduce((t,n)=>t+PC(a(n,e)),0),`totalBends`),l=p(e=>{let n=e.start,r=e.end,i=n?t.get(n):void 0,a=r?t.get(r):void 0,o=i?HC(i):void 0,s=a?HC(a):void 0;return o&&s?{src:o,dst:s}:void 0},`endpointRectsFor`),u=p((e,t,n)=>{if(n.index<=0||n.index+1>=t.length-1)return;let r=l(e);if(r){if(n.vertical){let i=n.a.x,a=Math.min(r.src.left,r.dst.left),o=Math.max(r.src.right,r.dst.right),s=i<a-uT?`left`:i>o+uT?`right`:void 0;return s?{edge:e,points:t,segmentIndex:n.index,axis:`vertical`,side:s,coord:i,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}:void 0}if(n.horizontal){let i=n.a.y,a=Math.min(r.src.top,r.dst.top),o=Math.max(r.src.bottom,r.dst.bottom),s=i<a-uT?`top`:i>o+uT?`bottom`:void 0;return s?{edge:e,points:t,segmentIndex:n.index,axis:`horizontal`,side:s,coord:i,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}:void 0}}},`externalRailForSegment`),d=p(()=>{let e=[];for(let t of i){let n=a(t);for(let r of fT(n)){let i=u(t,n,r);i&&e.push(i)}}return e},`collectExternalRails`),f=p((e,t)=>e.edge!==t.edge&&e.axis===t.axis&&e.side===t.side&&jC(e.min,e.max,t.min,t.max)>=dT,`railsInteract`),m=p(e=>{let t=[],n=new Set;for(let r of e){if(n.has(r))continue;let i=[r],a=[];for(n.add(r);i.length>0;){let t=i.pop();a.push(t);for(let r of e)!n.has(r)&&f(t,r)&&(n.add(r),i.push(r))}a.length>1&&t.push(a)}return t},`connectedComponents`),h=p(e=>{let t=[];for(let n of e)t.some(e=>Math.abs(e-n.coord)<uT)||t.push(n.coord);for(;t.length<e.length;){let n=Math.min(...t),r=Math.max(...t),i=e[0].side;t.push(i===`left`||i===`top`?n-12*(e.length-t.length):r+12*(e.length-t.length))}return t},`uniqueCoordsFor`),g=p(e=>{let t=e.map(e=>e.coord),n=h(e),r=[];if(e.length<=6){let i=Array(n.length).fill(!1),a=[],o=p(()=>{if(a.length===e.length){a.some((e,n)=>Math.abs(e-t[n])>=uT)&&r.push([...a]);return}for(let[e,t]of n.entries())i[e]||(i[e]=!0,a.push(t),o(),a.pop(),i[e]=!1)},`visit`);return o(),r}for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let i=[...t];[i[e],i[n]]=[i[n],i[e]],r.push(i)}return r},`coordinateAssignmentsFor`),_=p((e,t)=>{let n=new Map;for(let[r,i]of e.entries()){let e=t[r],a=n.get(i.edge)??i.points.map(e=>({x:e.x,y:e.y}));i.axis===`vertical`?(a[i.segmentIndex].x=e,a[i.segmentIndex+1].x=e):(a[i.segmentIndex].y=e,a[i.segmentIndex+1].y=e),n.set(i.edge,a)}let r=new Map;for(let[e,t]of n){let n=tw(FC(t));if(fT(n).length!==n.length-1)return;r.set(e,n)}return r},`replacementsForAssignment`),v=p(e=>{for(let[t,i]of e){let e=[t.start,t.end].filter(e=>!!e);for(let t of fT(i))if(YC(t.a,t.b,n,e,-2)||YC(t.a,t.b,r,[],-2))return!1}for(let t=0;t<i.length;t++){let n=i[t],r=e.has(n),o=fT(a(n,e));for(let n=t+1;n<i.length;n++){let t=i[n];if(!r&&!e.has(t))continue;let s=fT(a(t,e));for(let e of o)for(let t of s)if(MC(e,t,.5)>=dT)return!1}}return!0},`candidateIsSafe`);for(let e=0;e<4;e++){let e=o();if(e===0)return;let t,n=e,r=s(),i=1/0;for(let a of m(d()))for(let l of g(a)){let u=_(a,l);if(!u||!v(u))continue;let d=o(u);if(d>=e)continue;let f=s(u),p=a.reduce((e,t,n)=>e+Math.abs(l[n]-t.coord),0);d>n||d===n&&(f>r||f===r&&p>=i)||(t=u,n=d,r=f,i=p)}if(!t)return;for(let[e,n]of t)e.points=n}}function oLe(e,t){let{realNodeRects:n,labelNodeRects:r}=qC(t.values()),i=e.filter(e=>!e.isLayoutOnly),a=p((e,t,n)=>FC(e===t?n??[]:e.points??[]),`pointsFor`),o=p(e=>fT(e).reduce((e,t)=>{let n=t.a.x-t.b.x,r=t.a.y-t.b.y;return e+Math.hypot(n,r)},0),`pathLength`),s=p((e,t)=>{let n=0;for(let r=0;r<i.length;r++){let o=fT(a(i[r],e,t));for(let s=r+1;s<i.length;s++){let r=fT(a(i[s],e,t));for(let e of o)for(let t of r)QC(e.a,e.b,t.a,t.b,uT)&&n++}}return n},`strictCrossingCount`),l=p((e,t)=>{if(e.horizontal){let n=e.a.y;return(Math.abs(n-t.top)<1||Math.abs(n-t.bottom)<1)&&jC(e.a.x,e.b.x,t.left,t.right)>=dT}if(e.vertical){let n=e.a.x;return(Math.abs(n-t.left)<1||Math.abs(n-t.right)<1)&&jC(e.a.y,e.b.y,t.top,t.bottom)>=dT}return!1},`segmentRunsAlongRectBorder`),u=p(e=>{let n=[e.start,e.end].filter(e=>!!e),r=[];for(let e of n){let n=t.get(e),i=n?HC(n):void 0;i&&r.push(i)}return r},`endpointRectsFor`),d=p((e,t)=>{if(t+3>=e.length)return[];let n=e[t],r=e[t+1],i=e[t+2],a=e[t+3],o=kC(n,r,uT)&&AC(r,i,uT)&&kC(i,a,uT),s=AC(n,r,uT)&&kC(r,i,uT)&&AC(i,a,uT);if(!o&&!s||!(o?Math.sign(r.x-n.x)!==Math.sign(a.x-i.x):Math.sign(r.y-n.y)!==Math.sign(a.y-i.y)))return[];let l=DC(n,a,uT)||OC(n,a,uT)?[]:[{x:n.x,y:a.y},{x:a.x,y:n.y}],u=l.length===0?[[...e.slice(0,t+1),...e.slice(t+3)]]:l.map(n=>[...e.slice(0,t+1),n,...e.slice(t+3)]),d=new Set;return u.map(e=>tw(FC(e))).filter(e=>{if(fT(e).length!==e.length-1||!e.some(e=>EC(e,a,uT)))return!1;let t=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join(`|`);return!d.has(t)&&(d.add(t),!0)})},`shortcutCandidatesAt`),f=p((e,t,o)=>{let d=[e.start,e.end].filter(e=>!!e),f=u(e);for(let e of fT(t))if(YC(e.a,e.b,n,d,-2)||YC(e.a,e.b,r,[],-2)||f.some(t=>l(e,t)))return!1;for(let n of i)if(n!==e){for(let e of fT(t))for(let t of fT(a(n)))if(MC(e,t,.5)>=dT)return!1}return s(e,t)<=o},`candidateIsSafe`);for(let e=0;e<8;e++){let e=s(),t,n,r=e,l=1/0,u=1/0;for(let p of i){let i=a(p),m=PC(i,uT),h=o(i);for(let a=0;a<=i.length-4;a++)for(let g of d(i,a)){let i=PC(g,uT),a=o(g);if(!(i<m||i===m&&a<h-uT)||!f(p,g,e))continue;let d=s(p,g);d>r||d===r&&(i>l||i===l&&a>=u)||(t=p,n=g,r=d,l=i,u=a)}}if(!t||!n)return;t.points=n}}function sLe(e,t){let n=[];for(let e of t.values()){if(e.isGroup||e.isEdgeLabel)continue;let t=e.x??0,r=e.y??0,i=HC(e);i&&n.push({id:String(e.id??``),cx:t,cy:r,rect:i})}if(n.length===0)return;let r=new Map(n.map(e=>[e.id,e])),i=n.map(e=>({id:e.id,rect:e.rect})),a=[`top`,`bottom`,`left`,`right`],o={top:Math.min(...n.map(e=>e.rect.top))-20,bottom:Math.max(...n.map(e=>e.rect.bottom))+20,left:Math.min(...n.map(e=>e.rect.left))-20,right:Math.max(...n.map(e=>e.rect.right))+20},s=e.filter(e=>!e.isLayoutOnly),l=new Map(s.map((e,t)=>[e,t])),u=p(e=>{let t=e===`left`||e===`top`?-1:1,n=[];for(let r=0;r<=2;r++)n.push(o[e]+t*20*r);return n},`outwardTracksForSide`),d=p((e,t=new Map)=>FC(t.get(e)??e.points??[]),`replacementPointsFor`),f=p((e,t)=>{let n=0;for(let r of e)for(let e of t)QC(r.a,r.b,e.a,e.b,uT)&&n++;return n},`crossingCountBetweenSegments`),m=p((e,t)=>f(fT(e),fT(t)),`crossingCountBetweenPaths`),h=p((e=new Map)=>{let t=0,n=[],r=new Set,i=[],a=p(e=>{r.has(e)||(r.add(e),i.push(e))},`addEdge`);for(let r=0;r<s.length;r++){let i=s[r],o=d(i,e);for(let l=r+1;l<s.length;l++){let r=s[l],u=m(o,d(r,e));u>0&&(t+=u,n.push({first:i,second:r,count:u}),a(i),a(r))}}return i.sort((e,t)=>(l.get(e)??0)-(l.get(t)??0)),{count:t,pairs:n,edgeSet:r,edges:i}},`crossingSnapshot`),g=p((e,t)=>{let n=new Set(t.keys());if(n.size===0)return e.count;let r=0;for(let t of e.pairs)(n.has(t.first)||n.has(t.second))&&(r+=t.count);let i=0;for(let e=0;e<s.length;e++){let r=s[e],a=n.has(r),o=d(r,t);for(let r=e+1;r<s.length;r++){let e=s[r];(a||n.has(e))&&(i+=m(o,d(e,t)))}}return e.count-r+i},`crossingCountWithReplacements`),_=p(e=>{let t=new Map;for(let n of e.pairs){let e=t.get(n.first)??new Set;e.add(n.second),t.set(n.first,e);let r=t.get(n.second)??new Set;r.add(n.first),t.set(n.second,r)}let n=[],r=new Set;for(let i of e.edges){if(r.has(i))continue;let e=[i],a=[];for(r.add(i);e.length>0;){let n=e.pop();a.push(n);for(let i of t.get(n)??[])r.has(i)||(r.add(i),e.push(i))}a.sort((e,t)=>(l.get(e)??0)-(l.get(t)??0)),a.length>1&&n.push(a)}return n},`crossingComponents`),v=p(e=>[e.start,e.end].filter(e=>!!e),`endpointIdsFor`),y=p(e=>{let t=[];for(let n of _(e)){let e=new Set(n),r=new Set(n.flatMap(e=>v(e))),i=[...n];for(let t of s)e.has(t)||v(t).some(e=>r.has(e))&&i.push(t);i.sort((e,t)=>(l.get(e)??0)-(l.get(t)??0)),t.push(i)}return t},`pairSearchGroups`),b=p((e,t,n)=>g(e,new Map([[t,n]])),`crossingCountWithSingleReplacement`),x=p(e=>{let t=new Map;for(let n of e.pairs)t.set(n.first,(t.get(n.first)??0)+n.count),t.set(n.second,(t.get(n.second)??0)+n.count);return t},`currentCrossingsByEdge`),S=p(e=>e.slice(1).reduce((t,n,r)=>{let i=e[r];return t+Math.abs(n.x-i.x)+Math.abs(n.y-i.y)},0),`pathLength`),C=p((e=new Map)=>s.reduce((t,n)=>t+PC(d(n,e)),0),`totalBends`),w=p((e=new Map)=>s.reduce((t,n)=>t+S(d(n,e)),0),`totalLength`),T=p((e,t,n=new Map)=>{let r=fT(t);for(let t of s)if(t!==e){for(let e of r)for(let r of fT(d(t,n)))if(MC(e,r,.5)>=dT)return!0}return!1},`pathHasSegmentConflict`),E=p((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);for(let e of fT(t))if(YC(e.a,e.b,i,n,-2))return!0;return!1},`pathHitsNode`),D=p((e,t)=>{let n=tw(FC(t));fT(n).length===n.length-1&&e.push(n)},`pushOrthogonalCandidate`),O=p(e=>e===`left`||e===`right`,`sideIsHorizontal`),k=p((e,t,n)=>{switch(t){case`left`:return Math.min(e.x,n.x)-20;case`right`:return Math.max(e.x,n.x)+20;case`top`:return Math.min(e.y,n.y)-20;case`bottom`:return Math.max(e.y,n.y)+20}},`localTrackForSameSide`),A=p((e,t,n,r)=>{let i=n===`left`||n===`top`?-1:1,a=[k(t,n,r),o[n]];for(let o of a)for(let a=0;a<=2;a++)D(e,GC(t,n,r,o+i*20*a))},`addSameSideCandidates`),j=p((e,t,n,r,i)=>{for(let a of u(n))for(let n of u(i))D(e,[t,{x:a,y:t.y},{x:a,y:n},{x:r.x,y:n},r])},`addHorizontalToVerticalCandidates`),M=p((e,t,n,r,i)=>{for(let a of u(n))for(let n of u(i))D(e,[t,{x:t.x,y:a},{x:n,y:a},{x:n,y:r.y},r])},`addVerticalToHorizontalCandidates`),N=p((e,t,n,r,i)=>{let a=[...u(`top`),...u(`bottom`)];for(let o of u(n))for(let n of u(i))for(let i of a)D(e,[t,{x:o,y:t.y},{x:o,y:i},{x:n,y:i},{x:n,y:r.y},r])},`addHorizontalPairCandidates`),P=p((e,t,n,r,i)=>{let a=[...u(`left`),...u(`right`)];for(let o of u(n))for(let n of u(i))for(let i of a)D(e,[t,{x:t.x,y:o},{x:i,y:o},{x:i,y:n},{x:r.x,y:n},r])},`addVerticalPairCandidates`),F=p(e=>{let t=new Set;return e.map(e=>FC(e)).filter(e=>{let n=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join(`|`);return t.has(n)||e.length<2?!1:(t.add(n),!0)})},`dedupeCandidatePaths`),I=p((e,t,n,r)=>{let i=[],a=WC(e,t,n,r,20,uT);a&&D(i,a),t===r&&A(i,e,t,n);let o=O(t),s=O(r);return o&&!s?j(i,e,t,n,r):!o&&s?M(i,e,t,n,r):o?N(i,e,t,n,r):P(i,e,t,n,r),F(i)},`buildCandidatesForSides`),L=p((e,t,n,r)=>{let i=[...u(`left`),...u(`right`)],o=[...u(`top`),...u(`bottom`)];for(let s of a){let a=UC(r,s),l=s===`top`||s===`bottom`?u(s):o;for(let r of i){D(e,[t,n,{x:r,y:n.y},{x:r,y:a.y},a]);for(let i of l)D(e,[t,n,{x:r,y:n.y},{x:r,y:i},{x:a.x,y:i},a])}}},`addVerticalDepartureOuterTrackCandidates`),R=p((e,t,n,r)=>{let i=[...u(`left`),...u(`right`)],o=[...u(`top`),...u(`bottom`)];for(let s of a){let a=UC(r,s),l=s===`left`||s===`right`?u(s):i;for(let r of o){D(e,[t,n,{x:n.x,y:r},{x:a.x,y:r},a]);for(let i of l)D(e,[t,n,{x:n.x,y:r},{x:i,y:r},{x:i,y:a.y},a])}}},`addHorizontalDepartureOuterTrackCandidates`),ee=p(e=>{let t=e.start,n=e.end,i=n?r.get(n):void 0;if(!t||!i)return[];let a=FC(e.points??[]);if(a.length<4)return[];let o=a[0],s=a[1],l=[];return AC(o,s,uT)?L(l,o,s,i):kC(o,s,uT)&&R(l,o,s,i),l},`terminalPreservingOuterTrackCandidates`),z=p(e=>{let t=e.start,n=e.end,i=t?r.get(t):void 0,o=n?r.get(n):void 0;if(!i||!o)return[];let s=[];for(let e of a){let t=UC(i,e);for(let n of a)s.push(...I(t,e,UC(o,n),n))}return s.push(...ee(e)),s},`candidatePathsFor`),B=p(()=>new Map(s.map(e=>[e,fT(d(e))])),`currentSegmentsByEdge`),V=p((e,t,n)=>{let r=new Set;for(let i of s){if(i===e)continue;let a=n.get(i)??fT(d(i));t.some(e=>a.some(t=>MC(e,t,.5)>=dT))&&r.add(i)}return r},`sharedTrackConflictsFor`),te=p((e,t,n,r)=>{let i=new Set;return z(e).map(e=>tw(FC(e))).filter(t=>{if(E(e,t))return!1;let n=t.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join(`|`);return i.has(n)||t.length<2?!1:(i.add(n),!0)}).map(i=>{let a=fT(i),o=0;for(let t of s)t!==e&&(o+=f(a,n.get(t)??fT(d(t))));return{candidate:i,candidateSegments:a,crossings:t.count-(r.get(e)??0)+o,bends:PC(i,uT),totalBends:PC(i),length:S(i)}}).filter(({crossings:e})=>e<=t.count).sort((e,t)=>e.crossings-t.crossings||e.bends-t.bends||e.length-t.length).slice(0,48).map(t=>({path:t.candidate,segments:t.candidateSegments,sharedTrackConflicts:V(e,t.candidateSegments,n),totalBends:t.totalBends,length:t.length}))},`pairCandidatesFor`),ne=p((e,t,n,r,i,a)=>{let o=0;for(let n of e.pairs)(n.first===t||n.second===t||n.first===r||n.second===r)&&(o+=n.count);let l=f(n.segments,i.segments);for(let e of s){if(e===t||e===r)continue;let o=a.get(e)??fT(d(e));l+=f(n.segments,o)+f(i.segments,o)}return e.count-o+l},`pairCrossingCount`),re=p((e,t)=>{for(let n of e.sharedTrackConflicts)if(n!==t)return!1;return!0},`conflictsOnlyWith`),ie=p((e,t)=>e.segments.some(e=>t.segments.some(t=>MC(e,t,.5)>=dT)),`candidatesShareTrack`),ae=p((e,t,n,r)=>re(t,n.edge)&&re(r,e.edge)&&!ie(t,r),`pairCandidatesAreCompatible`),oe=p((e,t,n,r,i)=>{let a=ne(e.current,t.edge,n,r.edge,i,e.baseSegments);if(!(a>=e.current.count))return{replacements:new Map([[t.edge,n.path],[r.edge,i.path]]),crossings:a,bends:e.currentBends-(e.baseBendsByEdge.get(t.edge)??0)-(e.baseBendsByEdge.get(r.edge)??0)+n.totalBends+i.totalBends,length:e.currentLength-(e.baseLengthByEdge.get(t.edge)??0)-(e.baseLengthByEdge.get(r.edge)??0)+n.length+i.length}},`scorePairReplacement`),se=p((e,t)=>e.crossings<t.crossings||e.crossings===t.crossings&&(e.bends<t.bends||e.bends===t.bends&&e.length<t.length),`pairScoreIsBetter`),ce=p((e,t,n,r)=>{let i=r;for(let r of t.candidates)for(let a of n.candidates){if(!ae(t,r,n,a))continue;let o=oe(e,t,r,n,a);o&&se(o,i)&&(i=o)}return i},`bestScoreForOptionPair`),le=p(e=>{let t=C(),n=w(),r=B(),i=x(e),a=new Map(s.map(e=>[e,PC(d(e))])),o=new Map(s.map(e=>[e,S(d(e))])),l=new Map,u=y(e);for(let t of u)for(let n of t){if(l.has(n))continue;let t=te(n,e,r,i);t.length>0&&l.set(n,{edge:n,candidates:t})}let f={replacements:new Map,crossings:e.count,bends:t,length:n},p={current:e,currentBends:t,currentLength:n,baseBendsByEdge:a,baseLengthByEdge:o,baseSegments:r};for(let t of u){let n=new Set(t.filter(t=>e.edgeSet.has(t))),r=t.map(e=>l.get(e)).filter(e=>!!e);for(let e=0;e<r.length;e++){let t=r[e];for(let i=e+1;i<r.length;i++){let e=r[i];(n.has(t.edge)||n.has(e.edge))&&(f=ce(p,t,e,f))}}}return f.replacements.size>0?f.replacements:void 0},`bestPairedReplacement`);for(let e=0;e<4;e++){let e=h(),t=e.count;if(t===0)return;let n,r,i=t,a=1/0;for(let o of e.edges){let s=PC(d(o),uT);for(let l of z(o)){let u=E(o,l),d=!u&&T(o,l),f=b(e,o,l),p=PC(l,uT);u||d||(f<t||f===t&&p<s)&&(f>i||f===i&&p>=a||(n=o,r=l,i=f,a=p))}}if(n&&r){n.points=r;continue}let o=le(e);if(!o)return;for(let[e,t]of o)e.points=t}}function cLe(e,t){let{nodeInfoById:n,realNodeRects:r}=KC(t),i=[`top`,`bottom`,`left`,`right`],a={top:Math.min(...r.map(e=>e.rect.top))-20,bottom:Math.max(...r.map(e=>e.rect.bottom))+20,left:Math.min(...r.map(e=>e.rect.left))-20,right:Math.max(...r.map(e=>e.rect.right))+20},o=p((e,t,n,r)=>{let i=[],o=WC(e,t,n,r,20,mT);return o&&i.push(o),t===r&&i.push(GC(e,t,n,a[t])),i},`buildOrthogonalPathCandidates`),s=p((e,t)=>{for(let n=0;n<e.length-1;n++){let i=e[n],a=e[n+1];if(YC(i,a,r,t,1))return!0}return!1},`pathHitsNode`),l=p((t,n,r=!1)=>{let i=0,a=NC(t,mT),o=n.start,s=n.end;for(let t of e){if(t===n||t.isLayoutOnly)continue;let e=t.start,l=t.end;if(!r&&o&&s&&(e===o||e===s||l===o||l===s))continue;let u=t.points;if(!(!u||u.length<2))for(let e of a)for(let t of NC(u,mT)){if(XC(e.a,e.b,t.a,t.b,mT,mT)){i++;continue}MC(e,t,mT)>=rRe&&i++}}return i},`pathConflictCount`),u=p((e,t)=>{let n=Math.abs(e.y-t.rect.top),r=Math.abs(e.y-t.rect.bottom),i=Math.abs(e.x-t.rect.left),a=Math.abs(e.x-t.rect.right),o=`top`,s=n;return r<s&&(o=`bottom`,s=r),i<s&&(o=`left`,s=i),a<s&&(o=`right`,s=a),o},`nearestSideOfRect`),d=new Map,f=p((e,t,n)=>{let r=d.get(e)??[];r.push({side:t,edgeId:n}),d.set(e,r)},`addFaceClaim`);for(let t of e){if(t.isLayoutOnly)continue;let e=t.points??[];if(e.length<1)continue;let r=t.id??``,i=t.start,a=t.end;if(i){let t=n.get(i);t&&f(i,u(e[0],t),r)}if(a){let t=n.get(a);t&&f(a,u(e[e.length-1],t),r)}}let m=p((e,t,n)=>d.get(e)?.some(e=>e.edgeId!==n&&e.side===t)??!1,`faceIsClaimed`);for(let t of e){if(t.isLayoutOnly)continue;let e=t.points;if(!e||e.length<2)continue;let r=PC(e,mT);if(r<4)continue;let a=t.start,p=t.end;if(!a||!p)continue;let h=n.get(a),g=n.get(p);if(!h||!g)continue;let _=t.id??``,v=l(e,t,!0),y=l(e,t),b,x=v,S=r;for(let e of i){if(m(a,e,_))continue;let n=UC(h,e);for(let r of i){if(m(p,r,_))continue;let i=UC(g,r);for(let u of o(n,e,i,r)){if(s(u,[a,p]))continue;let e=PC(u,mT);if(v>0){let n=l(u,t,!0);if(n>x||n===x&&e>=S)continue;x=n,S=e,b=u;continue}l(u,t)>y||e<S&&(S=e,b=u)}}}if(b){t.points=b;let e=d.get(a);e&&d.set(a,e.filter(e=>e.edgeId!==_));let n=d.get(p);n&&d.set(p,n.filter(e=>e.edgeId!==_)),f(a,u(b[0],h),_),f(p,u(b[b.length-1],g),_)}}}function Tw(e,t){let n=t?0:e.length-1,r=t?1:-1,i=e[n],a=e[n+r];if(!i||!a)return;let o=a.x-i.x,s=a.y-i.y;if(!(Math.abs(o)+Math.abs(s)<hT)){if(Math.abs(s)<=hT){let e=i.x+Math.sign(o)*gT;return{left:Math.min(i.x,e),right:Math.max(i.x,e),top:i.y-_T,bottom:i.y+_T}}if(Math.abs(o)<=hT){let e=i.y+Math.sign(s)*gT;return{left:i.x-_T,right:i.x+_T,top:Math.min(i.y,e),bottom:Math.max(i.y,e)}}return{left:Math.min(i.x,a.x),right:Math.max(i.x,a.x),top:Math.min(i.y,a.y),bottom:Math.max(i.y,a.y)}}}function lLe(e){return{left:Math.min(e.left,e.right),right:Math.max(e.left,e.right),top:Math.min(e.top,e.bottom),bottom:Math.max(e.top,e.bottom)}}function Ew(e,t){let n=FC(t);return[Tw(n,!0),Tw(n,!1)].some(t=>t&&zC(e,lLe(t)))}function Dw(e,t){let n=[];for(let t of e){if(t.isLayoutOnly)continue;let e=t.points;if(!(!e||e.length<2))for(let r=0;r<e.length-1;r++)n.push({edgeId:t.id,p1:e[r],p2:e[r+1]})}let r=[],i=[];for(let e of t.values()){let t=e.isGroup,n=e.parentId;if(t&&!n){let t=HC(e);t&&i.push({id:e.id,rect:t});continue}if(t||e.isEdgeLabel)continue;let a=HC(e);a&&r.push({nodeId:e.id,rect:a})}let a=p((e,t)=>{let n=BC(t,3);for(let{nodeId:t,rect:i}of r)if(t!==e&&zC(n,i))return!0;return!1},`labelOverlapsForeignNode`),o=p((e,t)=>{let r=BC(t,3);for(let t of n)if(t.edgeId!==e&&LC(t.p1,t.p2,r))return!0;return!1},`labelOverlapsForeignEdge`),s=p((e,t,n)=>a(e,n)||o(t,n),`labelOverlapsAnything`),l=[],u=p(e=>{for(let{id:t,rect:n}of i)if(LIe(n,e))return t},`findContainingLane`),d=p((e,t)=>l.some(n=>n.labelId!==e&&zC(t,n.rect)),`overlapsPlacedLabel`);for(let n of e){if(n.isLayoutOnly)continue;let e=n.labelNodeId;if(!e)continue;let r=t.get(e);if(!r)continue;let f=n.points;if(!f||f.length<2)continue;let m=r.width??0,h=r.height??0;if(m<=0||h<=0)continue;let g=[];for(let e=0;e<f.length-1;e++){let t=f[e],n=f[e+1],r=Math.abs(t.x-n.x),i=Math.abs(t.y-n.y);r<hT&&i<hT||r>=hT&&i>=hT||g.push({idx:e,length:r+i,orientation:r>=hT?`horizontal`:`vertical`,midX:(t.x+n.x)/2,midY:(t.y+n.y)/2})}if(g.length===0)continue;let _=g.length>=3?g.filter(e=>e.idx>0&&e.idx<g.length-1):g,v=_.length>0?_:g,y=m>=h?`horizontal`:`vertical`,b=p(e=>[...e].sort((e,t)=>{let n=e.orientation===y;if(n!==(t.orientation===y))return n?-1:1;let r=e.length>=(e.orientation===`horizontal`?m:h)+2;return r===t.length>=(t.orientation===`horizontal`?m:h)+2?t.length-e.length:r?-1:1}),`rankSegments`),x=g[0],S=g[g.length-1],C=[.5,.25,.75,.05,.95,.15,.85,.1,.9],w=p((e,t)=>{let n=f[e.idx],r=f[e.idx+1];return{midX:n.x+(r.x-n.x)*t,midY:n.y+(r.y-n.y)*t}},`anchorAtT`),T=p((e,t,n)=>Math.min(n,Math.max(t,e)),`clamp`),E=p((e,t)=>e.midX>=t.left-hT&&e.midX<=t.right+hT&&e.midY>=t.top-hT&&e.midY<=t.bottom+hT,`pointInsideRectInclusive`),D=p(e=>{let t=VC(e.midX,e.midY,m,h),n=u(t);if(n)return{laneId:n,anchor:e,rect:t};let r=i.find(({rect:t})=>E(e,t));if(!r)return;let a=r.rect.left+m/2+1,o=r.rect.right-m/2-1,s=r.rect.top+h/2+1,l=r.rect.bottom-h/2-1;if(a>o||s>l)return;let d={midX:T(e.midX,a,o),midY:T(e.midY,s,l)},f=VC(d.midX,d.midY,m,h);return E(e,f)?{laneId:r.id,anchor:d,rect:f}:void 0},`placementForAnchor`),O=p((e,t,n)=>e.orientation===`horizontal`?Math.abs(t.midX-n.x):Math.abs(t.midY-n.y),`distanceAlongSegment`),k=p((e,t)=>{let n=(e.orientation===`horizontal`?m/2:h/2)+12;if(e===x){let r=f[e.idx];if(O(e,t,r)+hT<n)return!1}if(e===S){let r=f[e.idx+1];if(O(e,t,r)+hT<n)return!1}return!0},`labelClearsTerminalEndpoints`),A=p(t=>{let r=b(t);for(let t of r)for(let r of C){let i=w(t,r);if(!k(t,i))continue;let a=D(i);if(a&&!Ew(a.rect,f)&&!d(e,a.rect)&&!s(e,n.id,a.rect))return{laneId:a.laneId,anchor:a.anchor}}},`tryPool`),j=p((t,r,i=!1)=>{let s=b(t);for(let t of s){let s={midX:t.midX,midY:t.midY};if(r&&!k(t,s))continue;let l=D(s);if(l&&!Ew(l.rect,f)&&!d(e,l.rect)&&!a(e,l.rect)&&(i||!o(n.id,l.rect)))return{laneId:l.laneId,anchor:l.anchor}}},`findLaneContainingFallback`),M=A(v)??(v.length<g.length?A(g):void 0)??j(g,!0)??j(g,!1)??j(g,!1,!0);if(M){r.x=M.anchor.midX,r.y=M.anchor.midY,r.parentId=M.laneId;let t=VC(M.anchor.midX,M.anchor.midY,m,h),n=l.findIndex(t=>t.labelId===e);n>=0?l[n]={labelId:e,rect:t}:l.push({labelId:e,rect:t})}}}function Ow(e,t){return e<t?`${e}::${t}`:`${t}::${e}`}function uLe(e,t){let{nodeInfoById:n,realNodeRects:r}=KC(t),i=new Map;for(let e of t){let t=e.id;if(!e.isGroup&&e.isEdgeLabel){i.set(t,{w:e.width??0,h:e.height??0});continue}}let a=p((t,n,r,a)=>{let o=Ow(n,r),s=0,l=p(e=>{if(!e)return;let t=i.get(e);if(!t)return;let n=a===`x`?t.w/2:t.h/2;n>s&&(s=n)},`consider`);l(t.labelNodeId);for(let n of e){if(n===t||n.isLayoutOnly)continue;let e=n.start,r=n.end;e&&r&&Ow(e,r)===o&&l(n.labelNodeId)}return s>0?s+iRe:0},`labelClearanceFor`);for(let t of e){if(t.isLayoutOnly)continue;let i=t.points;if(!IC(i,vT))continue;let o=JC(t,n,vT);if(!o)continue;let{srcId:s,dstId:l,srcInfo:u,dstInfo:d,collinearX:f,collinearY:p}=o;if(f===p)continue;let m,h;if(f){let e=d.cy>u.cy;m={x:u.cx,y:e?u.rect.bottom:u.rect.top},h={x:d.cx,y:e?d.rect.top:d.rect.bottom}}else{let e=d.cx>u.cx;m={x:e?u.rect.right:u.rect.left,y:u.cy},h={x:e?d.rect.left:d.rect.right,y:d.cy}}if(YC(m,h,r,[s,l],1))continue;let g=a(t,s,l,f?`x`:`y`),_=g>yT?g:yT,v=[0,_,-_];for(let n of v){let i={...m},a={...h};if(f){if(i.x+=n,a.x+=n,i.x<=u.rect.left||i.x>=u.rect.right||a.x<=d.rect.left||a.x>=d.rect.right)continue}else if(i.y+=n,a.y+=n,i.y<=u.rect.top||i.y>=u.rect.bottom||a.y<=d.rect.top||a.y>=d.rect.bottom)continue;if(!YC(i,a,r,[s,l],1)&&!ZC(i,a,e,t,{epsilon:vT})){t.points=[i,a];break}}}}function kw(e,t){let n=.001,{realNodeRects:r,labelNodeRects:i}=qC(t.values()),a=p((e,t)=>NC(t,n).map(n=>({...n,edge:e,interior:n.index>=1&&n.index<=t.length-3})),`segmentsFor`),o=p(()=>{let t=[];for(let n of e){if(n.isLayoutOnly)continue;let e=n.points;!e||e.length<2||t.push(...a(n,FC(e)))}return t},`allSegments`),s=p((e,t)=>e.horizontal&&t.horizontal?jC(e.a.x,e.b.x,t.a.x,t.b.x)>=8&&Math.abs(e.a.y-t.a.y)<7:e.vertical&&t.vertical?jC(e.a.y,e.b.y,t.a.y,t.b.y)>=8&&Math.abs(e.a.x-t.a.x)<7:!1,`hasCrowdedParallelTrack`),l=p((t,o)=>{let l=t.start,u=t.end,d=a(t,o);if(d.length!==o.length-1)return!1;let f=[l,u].filter(e=>!!e),p=t.labelNodeId?[t.labelNodeId]:[];for(let e of d)if(YC(e.a,e.b,r,f,-2)||YC(e.a,e.b,i,p,-2))return!1;for(let r of e){if(r===t||r.isLayoutOnly)continue;let e=r.points;if(!(!e||e.length<2)){for(let t of d)for(let i of a(r,FC(e)))if(s(t,i)||QC(t.a,t.b,i.a,i.b,n))return!1}}return!0},`candidateIsSafe`),u=p((e,t)=>{let n=FC(e.edge.points??[]);if(n.length<4||e.index>=n.length-1)return;let r=n.map(e=>({...e}));if(e.horizontal)r[e.index].y+=t,r[e.index+1].y+=t;else if(e.vertical)r[e.index].x+=t,r[e.index+1].x+=t;else return;return a(e.edge,r).length===r.length-1?r:void 0},`shiftedCandidate`),d=p((e,t)=>({x:e.x??(t.left+t.right)/2,y:e.y??(t.top+t.bottom)/2}),`nodeCenter`),f=p(e=>{let n=e.edge,r=FC(n.points??[]);if(r.length!==4||e.index!==1)return;let i=n.start?t.get(n.start):void 0,a=n.end?t.get(n.end):void 0,o=i?HC(i):void 0,s=a?HC(a):void 0,l=r.slice(e.index+2);if(i&&a&&o&&s&&l.length!==0)return{sourceCenter:d(i,o),targetCenter:d(a,s),sourceRect:o,tail:l}},`sourceDetourContextFor`),m=p((e,t,r,i,a,o)=>{let s=i.y>=r.y,l=s?a.bottom:a.top,u=l+(s?20:-20);if(s&&e.b.y<=u+n||!s&&e.b.y>=u-n)return;let d=e.a.x+t;return FC([{x:r.x,y:l},{x:r.x,y:u},{x:d,y:u},{x:d,y:e.b.y},...o],n)},`verticalSourceDetour`),h=p((e,t,r,i,a,o)=>{let s=i.x>=r.x,l=s?a.right:a.left,u=l+(s?20:-20);if(s&&e.b.x<=u+n||!s&&e.b.x>=u-n)return;let d=e.a.y+t;return FC([{x:l,y:r.y},{x:u,y:r.y},{x:u,y:d},{x:e.b.x,y:d},...o],n)},`horizontalSourceDetour`),g=p((e,t)=>{let n=f(e);if(n){if(e.vertical)return m(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail);if(e.horizontal)return h(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail)}},`sourceDetourCandidate`),_=[-7,7,-14,14,-21,21];for(let e=0;e<12;e++){let e=o(),t=!1;for(let n=0;n<e.length&&!t;n++)for(let r=n+1;r<e.length&&!t;r++){let i=e[n],a=e[r];if(i.edge===a.edge||!s(i,a))continue;let o=[i,a].filter(e=>e.interior);for(let e of o){for(let n of _){let r=u(e,n);if(r&&l(e.edge,r)){e.edge.points=r,t=!0;break}let i=g(e,n);if(i&&l(e.edge,i)){e.edge.points=i,t=!0;break}}if(t)break}}if(!t)return}}function dLe(e,t,n,r){let i=t.x-e.x,a=t.y-e.y,o=r.x-n.x,s=r.y-n.y,l=i*s-a*o;if(Math.abs(l)<1e-10)return!1;let u=n.x-e.x,d=n.y-e.y,f=(u*s-d*o)/l,p=(u*a-d*i)/l,m=.01;return f>m&&f<.99&&p>m&&p<.99}function fLe(e){let t=e.nodes??[],n=e.edges??[],r=[];if(!n.length||!t.length)return r;let i=RIe(t),a=[];for(let e of n){if(e.isLayoutOnly)continue;let t=e.points;if(!t||t.length<2)continue;let n=e.start,o=e.end,s=e.labelNodeId,l=e.id??`${n}->${o}`;for(let e of i)if(e.nodeId!==n&&e.nodeId!==o&&!(s&&e.nodeId===s)){for(let n=0;n<t.length-1;n++)if(LC(t[n],t[n+1],e,-1)){r.push({type:`edge-node-overlap`,edgeId:l,targetId:e.nodeId,detail:`segment ${n} passes through node "${e.nodeId}"`});break}}for(let e=0;e<t.length-1;e++)a.push({edgeId:l,start:n,end:o,p1:t[e],p2:t[e+1]})}let o=new Set;for(let e=0;e<a.length;e++)for(let t=e+1;t<a.length;t++){let n=a[e],i=a[t];if(n.edgeId!==i.edgeId&&n.start!==i.start&&n.start!==i.end&&n.end!==i.start&&n.end!==i.end&&dLe(n.p1,n.p2,i.p1,i.p2)){let e=n.edgeId<i.edgeId?`${n.edgeId}|${i.edgeId}`:`${i.edgeId}|${n.edgeId}`;o.has(e)||(o.add(e),r.push({type:`edge-edge-crossing`,edgeId:n.edgeId,targetId:i.edgeId,detail:`edges "${n.edgeId}" and "${i.edgeId}" cross`}))}}if(r.length>0){let e=r.filter(e=>e.type===`edge-node-overlap`).length,t=r.filter(e=>e.type===`edge-edge-crossing`).length;y.warn(`[SWIMLANE_VALIDATE] ${r.length} issue(s) detected: ${e} edge-node overlap(s), ${t} edge crossing(s)`);for(let e of r)y.warn(`[SWIMLANE_VALIDATE] ${e.type}: ${e.detail}`)}return r}function pLe(e,t){let n=e.nodes??[],r=e.edges??[],i=n.filter(e=>!e.isGroup);if((t===`LR`||t===`RL`)&&i.length>0&&!$Ie(e,t)||t===`BT`&&i.length>0&&!QIe(e))return;for(let e of r){if(e.isLayoutOnly)continue;let t=e.points;!t||t.length<2||(e.points=tw(ew(t)))}cLe(r,n),uLe(r,n),eLe(r,n);let a=new Map;for(let e of n)a.set(String(e.id),e);Dw(r,a),UIe(r,a),tLe(r,a),kw(r,a),nLe(r,a),rLe(r,a),Sw(r,a),iLe(r,a);let o=p(()=>{sLe(r,a),aLe(r,a),oLe(r,a),Dw(r,a),_w(r,a),Sw(r,a),Dw(r,a),_w(r,a)},`finalizeRenderedEdges`);o(),kw(r,a),o(),Cw(r,a),ww(r,a),Cw(r,a),ww(r,a)}function Aw(e){let t=new Map(e.nodeById),n=new Set,r=[];for(let i of e.edges){if(!t.has(i.src)||!t.has(i.dst))continue;let e=`${i.id}:${i.src}->${i.dst}`;n.has(e)||(n.add(e),r.push(i))}return{nodes:[...t.keys()],edges:r,layout:e.layout,nodeById:t}}function jw(e,t){return e.edges.filter(e=>e.dst===t)}function mLe(e){let t=new Map;for(let n of e.nodes)t.set(n,[]);for(let n of e.edges)t.get(n.src).push(n.dst);return t}function Mw(e){let t=mLe(e);for(let e of t.values())e.sort((e,t)=>e.localeCompare(t));return t}function Nw(e){let t=new Map;for(let n of e.nodes)t.set(n,0);for(let n of e.edges)t.set(n.dst,(t.get(n.dst)??0)+1);return t}function Pw(e){return[...e.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,t)=>e.localeCompare(t))}function Fw(e,t=()=>!0){let n=new Map,r=new Map;for(let t of e.nodes)n.set(t,[]),r.set(t,[]);for(let i of e.edges)t(i)&&(r.get(i.src).push(i.dst),n.get(i.dst).push(i.src));return{preds:n,succs:r}}function Iw(e,t,n,r){let i=0;for(let t of e.nodes)r?.skipGroups&&e.nodeById.get(t)?.isGroup||(i=Math.max(i,n[t]??0));let a=Array.from({length:i+1},()=>[]);for(let i of t)r?.skipGroups&&e.nodeById.get(i)?.isGroup||a[Math.max(0,n[i]??0)].push(i);return a}function Lw(e){let t=Nw(e),n=Pw(t),r=[],i=Mw(e);for(;n.length;){let e=n.shift();r.push(e);for(let r of i.get(e)??[])if(t.set(r,(t.get(r)??0)-1),(t.get(r)??0)===0){let e=0;for(;e<n.length&&n[e]<r;)e++;n.splice(e,0,r)}}return r.length===e.nodes.length?r:null}function Rw(e){let t=new Map,n=0;for(let r of e)t.set(r,n),n++;return t}function zw(e){let t=Array(e.length),n=p((r,i)=>{if(i-r<=1)return 0;let a=r+i>>1,o=n(r,a)+n(a,i),s=r,l=a,u=r;for(;s<a||l<i;)l>=i||s<a&&e[s]<=e[l]?t[u++]=e[s++]:(t[u++]=e[l++],o+=a-s);for(let n=r;n<i;n++)e[n]=t[n];return o},`count`);return n(0,e.length)}function hLe(e){let t=Aw(e),n=new Map;for(let e of t.nodes)n.set(e,[]);for(let e of t.edges)n.get(e.src).push(e);for(let e of n.values())e.sort((e,t)=>e.dst===t.dst?e.id.localeCompare(t.id):e.dst.localeCompare(t.dst));let r=Object.create(null);for(let e of t.nodes)r[e]=0;let i=[],a=p(e=>{r[e]=1;for(let t of n.get(e)??[]){let e=t.dst;r[e]===0?a(e):r[e]===1&&i.push(t)}r[e]=2},`dfs`),o=Nw(t),s=[...t.nodes.filter(e=>(o.get(e)??0)===0),...t.nodes.filter(e=>(o.get(e)??0)!==0)];for(let e of s)r[e]===0&&a(e);let l=new Set(i.map(e=>`${e.id}:${e.src}->${e.dst}`)),u=t.edges.map(e=>l.has(`${e.id}:${e.src}->${e.dst}`)?{id:e.id,src:e.dst,dst:e.src,weight:e.weight,ref:e.ref}:e);return{acyclic:{nodes:[...t.nodes],edges:u,layout:t.layout,nodeById:new Map(t.nodeById)},reversed:i}}function gLe(e){let t=new Map,n=p(r=>{if(t.has(r))return t.get(r);let i=e.nodeById.get(r);if(!i)return t.set(r,null),null;let a=i.parentId;if(!a)return t.set(r,null),null;let o=n(a)??a;return t.set(r,o),o},`resolve`);for(let t of e.nodes)n(t);return t}function Bw(e){let t=gLe(e);return e=>t.get(e)??null}function Vw(e){let t=[];for(let n of e.layout.nodes??[])n.isGroup&&!n.parentId&&t.push(n.id);return[...new Set(t)].reverse()}function Hw(e,t){let n=Vw(e);if(!t||t.length===0)return n;let r=new Set(n),i=new Set,a=[];for(let e of t)r.has(e)&&!i.has(e)&&(i.add(e),a.push(e));for(let e of n)i.has(e)||a.push(e);return a}function _Le(e,t){let n=Aw(e),r=t?.laneOf??(()=>null),i=t?.rankHint,{preds:a}=Fw(n);for(let e of a.values())e.sort((e,t)=>e.localeCompare(t));let o=Lw(n)??[...n.nodes].sort((e,t)=>e.localeCompare(t)),s=new Map;for(let[e,t]of o.entries())s.set(t,e);let l=new Map,u=new Map;for(let e of n.nodes)u.set(e,[]);for(let e of o){let t=(a.get(e)??[]).filter(e=>l.has(e));if(t.length>0){let n=vLe(e,t,{laneOf:r,rankHint:i,topoIndex:s});l.set(e,n),u.get(n).push(e)}else l.has(e)||l.set(e,null)}for(let e of n.nodes)l.has(e)||l.set(e,null);let d=new Set;for(let e of n.nodes)(l.get(e)??null)===null&&d.add(e);let f=[...d].sort((e,t)=>{let n=s.get(e)??0,r=s.get(t)??0;return n===r?e.localeCompare(t):n-r}),m=yLe(n),h=new Map;for(let[e,t]of m.entries())h.set(e,[...t].sort((e,t)=>e.localeCompare(t)));let g=bLe(h),_=xLe(h),v=new Map;for(let e of n.nodes)v.set(e,[]);for(let e of _)for(let t of e.nodes){let n=v.get(t);n?n.push(e.id):v.set(t,[e.id])}let y=[],b=[],x=new Set,S=p(e=>{if(!x.has(e)){x.add(e),y.push(e);for(let t of u.get(e)??[])S(t);b.push(e)}},`walk`);for(let e of f)S(e);for(let e of o)S(e);return{parent:l,children:u,roots:f,componentOf:g,blocks:_,nodeBlocks:v,adjacency:h,preorder:y,postorder:b,topologicalOrder:o}}function vLe(e,t,n){let r=n.laneOf(e);return[...t].sort((e,t)=>{let i=n.laneOf(e),a=n.laneOf(t),o=i!=null&&i===r;if(o!==(a!=null&&a===r))return o?-1:1;let s=n.rankHint?.[e],l=n.rankHint?.[t];if(s!=null&&l!=null&&s!==l)return l-s;let u=n.topoIndex.get(e)??0,d=n.topoIndex.get(t)??0;return u===d?e.localeCompare(t):u-d})[0]}function yLe(e){let t=new Map;for(let n of e.nodes)t.set(n,new Set);for(let n of e.edges)t.get(n.src).add(n.dst),t.get(n.dst).add(n.src);return t}function bLe(e){let t=new Map,n=0;for(let r of e.keys()){if(t.has(r))continue;let i=[r];for(;i.length>0;){let r=i.pop();if(!t.has(r)){t.set(r,n);for(let n of e.get(r)??[])t.has(n)||i.push(n)}}n++}return t}function xLe(e){let t=new Map,n=new Map,r=[],i=[],a=0,o=p((s,l)=>{t.set(s,++a),n.set(s,a);for(let u of e.get(s)??[])u!==l&&(t.has(u)?(t.get(u)??0)<(t.get(s)??0)&&(r.push([s,u]),n.set(s,Math.min(n.get(s)??a,t.get(u)??a))):(r.push([s,u]),o(u,s),n.set(s,Math.min(n.get(s)??a,n.get(u)??a)),(n.get(u)??0)>=(t.get(s)??0)&&i.push(SLe(s,u,r,i.length))))},`visit`);for(let n of e.keys())t.has(n)||o(n,null);return i}function SLe(e,t,n,r){let i=[],a=new Set;for(;n.length>0;){let r=n.pop();if(i.push(r),a.add(r[0]),a.add(r[1]),r[0]===e&&r[1]===t||r[0]===t&&r[1]===e)break}return{id:r,edges:i,nodes:[...a]}}function CLe(e,t,n){let r=[...e.nodes],i=new Map;for(let[e,t]of r.entries())i.set(t,e);let a=r.length,o=Array(a).fill(-1),s=Array(a).fill(0),l=[],u=new Set;for(let e of r){let t=n.parent.get(e)??null,r=i.get(e);r!=null&&(t??(o[r]=-1,s[r]=0,u.has(e)||(u.add(e),l.push(e))))}for(;l.length>0;){let e=l.shift(),t=i.get(e);if(t==null)continue;let r=n.children.get(e)??[];for(let e of r){if(u.has(e))continue;let n=i.get(e);n!=null&&(o[n]=t,s[n]=s[t]+1,u.add(e),l.push(e))}}for(let e of r){if(u.has(e))continue;let t=i.get(e);t!=null&&(o[t]=-1,s[t]=0,u.add(e))}let d=Math.max(1,Math.ceil(Math.log2(Math.max(1,a)))+1),f=Array.from({length:d},()=>Array(a).fill(-1));for(let e=0;e<a;e++)f[0][e]=o[e];for(let e=1;e<d;e++)for(let t=0;t<a;t++){let n=f[e-1][t];f[e][t]=n===-1?-1:f[e-1][n]}let m=p((e,t)=>{if(e===-1||t===-1)return-1;s[e]<s[t]&&([e,t]=[t,e]);let n=s[e]-s[t];for(let t=0;t<d;t++)if(n>>t&1&&(e=f[t][e],e===-1))return-1;if(e===t)return e;for(let n=d-1;n>=0;n--){let r=f[n][e],i=f[n][t];r!==-1&&i!==-1&&r!==i&&(e=r,t=i)}return f[0][e]},`lcaIndex`),h=Array.from({length:a},()=>new Map);for(let n of e.edges){let e=n.src,r=n.dst,a=t[e],o=t[r];if(a==null||o==null||(a>o&&([e,r]=[r,e],[a,o]=[o,a]),a==null||o==null||a===o))continue;let s=i.get(e),l=i.get(r);if(s==null||l==null)continue;let u=m(s,l);if(u===-1)continue;let d=h[u];for(let e=a;e<o;e++)d.set(e,(d.get(e)??0)+1)}let g=new Map,_=p((e,t)=>{if(t.size!==0)for(let[n,r]of t)e.set(n,(e.get(n)??0)+r)},`mergeInto`),v=new Set,y=p(e=>{let r=i.get(e);v.add(e);let a=r==null?void 0:h[r],o=a?new Map(a):new Map,s=n.children.get(e)??[];for(let n of s){let r=y(n),i=t[e];if(i!=null){let a=g.get(e);a||(a=new Map,g.set(e,a));let o=r.get(i)??0,s=t[n];s!=null&&s>i&&(o+=1),a.set(n,o)}_(o,r)}return o},`dfs`);for(let e of n.roots)v.has(e)||y(e);for(let e of r)v.has(e)||y(e);return g}function wLe(e,t,n){let r=new Map,i=p(e=>{let a=n[e]??0,o=[...t.get(e)??[]];o.sort(Uw(n));for(let e of o){i(e);let t=r.get(e);t!=null&&(a=Math.min(a,t))}r.set(e,a)},`annotate`);for(let t of e)i(t);return r}function Uw(e){return(t,n)=>{let r=e[t]??0,i=e[n]??0;return r===i?t.localeCompare(n):r-i}}function TLe(e,t,n,r){let i=0;for(let e of t){let t=n[e]??0;t>i&&(i=t)}let a=Array.from({length:i+1},()=>[]),o=new Set,s=p(e=>{if(o.has(e))return;o.add(e);let t=n[e]??0;a[t]||(a[t]=[]),a[t].push(e);for(let t of r(e))s(t)},`emit`);for(let t of e)s(t);for(let e of t)if(!o.has(e)){let t=n[e]??0;a[t]||(a[t]=[]),a[t].push(e),o.add(e)}return a}function ELe(e){let t=[];for(let n of e){let e=new Set,r=[];for(let t of n)e.has(t)||(e.add(t),r.push(t));t.push(r)}return t}function DLe(e,t,n,r){return i=>{let a=e.get(i)??[];if(a.length===0)return[];let o=t[i]??0,s=[],l=[],u=n.get(i);for(let e of a){let t=r.get(e)??o;t>o?s.push({child:e,min:t}):l.push(e)}return s.sort((e,t)=>e.min===t.min?e.child.localeCompare(t.child):e.min-t.min),l.sort((e,t)=>{let n=u?.get(e)??0,i=u?.get(t)??0;if(n!==i)return n-i;let a=r.get(e)??o,s=r.get(t)??o;return a===s?e.localeCompare(t):a-s}),[...s.map(e=>e.child),...l]}}function Ww(e,t,n){let r=_Le(e,{rankHint:t,laneOf:n}),{children:i,roots:a}=r;for(let t of e.nodes)i.has(t)||i.set(t,[]);let o=CLe(e,t,r),s=[...a].sort(Uw(t)),l=DLe(i,t,o,wLe(s,i,t)),u=TLe(s,e.nodes,t,l);return u=ELe(u),u}function OLe(e,t,n){let r=new Set(e),i=new Set(t),a=Rw(t),o=[];for(let e of n)r.has(e.src)&&i.has(e.dst)&&o.push(a.get(e.dst));return zw(o)}function Gw(e,t,n){let r=[];for(let e of t){let t=n[e.src],i=n[e.dst];if(t==null||i==null||t===i)continue;let a=e.src,o=e.dst,s=t,l=i;t>i&&(a=e.dst,o=e.src,s=i,l=t);for(let t=s;t<l;t++)r.push({id:`${e.id}@${t}`,src:a,dst:o,ref:e.ref})}let i=0;for(let t=0;t+1<e.length;t++)i+=OLe(e[t],e[t+1],r);return i}function kLe(e,t){let n={...t},{preds:r}=Fw(e),i=Bw(e),a=Gw(Ww(e,n,i),e.edges,n),o=bT.MAX_CROSSING_OPTIMIZATION_PASSES;for(let t=0;t<o;t++){let t=!1,o=[...e.nodes].sort((e,t)=>(n[t]??0)-(n[e]??0));for(let s of o){let o=n[s]??0;if(o===0)continue;let l=0;for(let e of r.get(s)??[])l=Math.max(l,(n[e]??0)+1);if(l>=o)continue;let u=o;n[s]=l;let d=Gw(Ww(e,n,i),e.edges,n);d<a?(a=d,t=!0):n[s]=u}if(!t)break}return n}function ALe(e,t){let n=Bw(e),r=[...e.nodes].sort((e,n)=>(t[e]??0)-(t[n]??0)||e.localeCompare(n));for(let i of r){let r=n(i);if(!r)continue;let a=e.edges.filter(e=>e.src===i);if(a.length===0)continue;let o=!1,s=0;for(let e of a){let t=n(e.dst);t==null||t===r?o=!0:s++}if(s===0||o)continue;let l=0,u=!1;for(let t of e.edges){if(t.dst!==i)continue;let e=n(t.src);e&&(e===r?u=!0:l++)}if(l>0||!u)continue;let d=t[i]??0,f=d+s,p=0;for(let n of e.edges)n.dst===i&&(p=Math.max(p,(t[n.src]??0)+1));let m=Math.max(d,p,f);m!==d&&(t[i]=m)}}function jLe(e,t){let n=Aw(e),r=Lw(n)??[...n.nodes].sort(),i=t?.compactSingleInput??!1,a=Bw(n),o=Object.create(null);for(let e of r){let r=jw(n,e),s=t?.ignoreCrossLaneEdges?r.filter(t=>{let n=a(t.src),r=a(e);return!n||!r||n===r}):r;if(s.length===0)o[e]=0;else if(i&&s.length===1){let t=s[0].src;a(t)===a(e)?o[e]=(o[t]??0)+1:o[e]=o[t]??0}else{let t=-1/0;for(let e of s)t=Math.max(t,(o[e.src]??0)+1);o[e]=t===-1/0?0:t}}return(t?.optimizeRanksByCrossings??!1)&&(o=kLe(n,o)),t?.ignoreCrossLaneEdges&&ALe(n,o),{layers:Ww(n,o,a),rankOf:o,dummy:new Set}}function MLe(e,t){let n=Aw(e),r={...jLe(n,{compactSingleInput:t?.compactSingleInput,ignoreCrossLaneEdges:t?.ignoreCrossLaneEdges,optimizeRanksByCrossings:t?.optimizeRanksByCrossings}).rankOf},i=Bw(n),{preds:a,succs:o}=Fw(n,e=>{if(t?.ignoreCrossLaneEdges){let t=i(e.src),n=i(e.dst);if(t&&n&&t!==n)return!1}return!0}),s=Lw(n)??[...n.nodes],l=[...s].reverse(),u=p((e,t)=>{let n=0;for(let t of a.get(e)??[])n=Math.max(n,(r[t]??0)+1);let i=1/0,s=o.get(e)??[];return s.length>0&&(i=Math.min(...s.map(e=>(r[e]??0)-1))),Number.isFinite(i)||(i=Math.max(n,t)),Math.min(Math.max(t,n),i)},`clampFeasible`),d=bT.GRAVITY_ITERATIONS,f=p(e=>{let t=!1;for(let n of e){let e=a.get(n)??[],i=o.get(n)??[];if(e.length===0&&i.length===0)continue;let s=e.length>0?e.reduce((e,t)=>e+(r[t]??0)+1,0)/e.length:r[n]??0,l=i.length>0?i.reduce((e,t)=>e+(r[t]??0)-1,0)/i.length:r[n]??0,d=Math.round((s+l)/2),f=u(n,d);f!==r[n]&&(r[n]=f,t=!0)}return t},`relaxOrder`);for(let e=0;e<d;e++){let e=f(s),t=f(l);if(!e&&!t)break}for(let e of s){let t=0;for(let n of a.get(e)??[])t=Math.max(t,(r[n]??0)+1);(r[e]??0)<t&&(r[e]=t)}for(let e of l){let t=o.get(e)??[];if(t.length>0){let n=Math.min(...t.map(e=>(r[e]??0)-1));(r[e]??0)>n&&(r[e]=n)}}return{layers:Iw(n,s,r),rankOf:r,dummy:new Set}}function NLe(e){let t=Nw(e),n=Mw(e),r=Pw(t),i=[];for(;r.length>0;){let e=[];for(let a of r){i.push(a);for(let r of n.get(a)??[])t.set(r,(t.get(r)??0)-1),(t.get(r)??0)===0&&e.push(r)}r=e.sort((e,t)=>e.localeCompare(t))}return i.length===e.nodes.length?i:null}function PLe(e,t){let n=Aw(e),r=t?.direction===`LR`?NLe(n)??[...n.nodes].sort():Lw(n)??[...n.nodes].sort(),i=Bw(n),a=p(e=>i(e)??e,`laneOf`),o=Object.create(null),s=new Map,l=p((e,n)=>t?.ignoreCrossLaneEdges??!0?+(a(e)===a(n)):1,`edgeWeight`);for(let e of r){if(n.nodeById.get(e)?.isGroup)continue;let t=jw(n,e),r=0;if(t.length>0)for(let n of t){let t=n.src,i=o[t]??0;r=Math.max(r,i+l(t,e))}let i=a(e),u=s.get(i)??0,d=Math.max(r,u);o[e]=d,s.set(i,d+1)}return{layers:Iw(n,r,o,{skipGroups:!0}),rankOf:o,dummy:new Set}}function FLe(e,t){let n=Aw(t),{rankOf:r}=e,i=e.layers.map(e=>[...e]),a=new Set(e.dummy?[...e.dummy]:[]),o=0,s=new Map(n.nodeById),l=p(e=>{let t=`placeholder-${o++}`,n={id:t,isGroup:!1,isDummy:!0,width:0,height:0};for(s.set(t,n),a.add(t);i.length<=e;)i.push([]);return i[e].push(t),r[t]=e,t},`addDummyAt`),u=[...n.edges].sort((e,t)=>e.id===t.id?e.src===t.src?e.dst.localeCompare(t.dst):e.src.localeCompare(t.src):e.id.localeCompare(t.id)),d=[];for(let e of u){let t=r[e.src]??0,n=r[e.dst]??0;if(n-t<=1){d.push(e);continue}let i=e.src;for(let r=t+1,a=0;r<n;r++,a++){let t=l(r);d.push({id:`${e.id}#${a}`,src:i,dst:t,weight:e.weight,ref:e.ref}),i=t}let a=n-t-2;d.push({id:`${e.id}#${Math.max(a+1,0)}`,src:i,dst:e.dst,weight:e.weight,ref:e.ref})}let f={nodes:[...n.nodes,...[...a].filter(e=>!n.nodes.includes(e))],edges:d,layout:n.layout,nodeById:s};return{layering:{layers:i,rankOf:r,dummy:a},graphWithDummies:f}}function Kw(e){let t=e.length;if(t===0)return 1/0;let n=[...e].sort((e,t)=>e-t);return t%2==1?n[(t-1)/2]:.5*(n[t/2-1]+n[t/2])}function qw(e){return e.length===0?1/0:e.reduce((e,t)=>e+t,0)/e.length}function ILe(e,t,n,r){let i=new Map;for(let t of e)i.set(t,[]);for(let e of n)r===`down`?t.has(e.src)&&i.has(e.dst)&&i.get(e.dst).push(t.get(e.src)):t.has(e.dst)&&i.has(e.src)&&i.get(e.src).push(t.get(e.dst));return i}function LLe(e,t,n){let r=n.get(e)??0,i=n.get(t)??0;return r===i?e.localeCompare(t):r-i}function Jw(e,t,n){let r=new Set(e),i=new Set(t),a=Rw(e),o=Rw(t),s=[];for(let e of n)r.has(e.src)&&i.has(e.dst)&&s.push({u:a.get(e.src),v:o.get(e.dst)});return s.sort((e,t)=>e.u===t.u?e.v-t.v:e.u-t.u),zw(s.map(e=>e.v))}function Yw(e,t,n){return[...e].sort((e,r)=>{let i=Kw(t.get(e)??[]),a=Kw(t.get(r)??[]);return i===a?LLe(e,r,n):isFinite(i)?isFinite(a)?i-a:-1:1})}function Xw(e,t,n,r,i,a){let o=Rw(e),s=Rw(t),l=ILe(t,o,n,r);if(!i||!a||a.length===0)return Yw(t,l,s);let u=new Map;for(let e of t){let t=i(e),n=u.get(t)??[];n.push(e),u.set(t,n)}let d=[];for(let e of a){let t=u.get(e);if(!t||t.length===0)continue;let n=Yw(t,l,s);d.push(...n)}let f=u.get(null);if(f&&f.length>0){let e=Yw(f,l,s);for(let t of e){let e=qw(l.get(t)??[]),n=d.length;if(isFinite(e)){for(let[t,r]of d.entries())if(e<qw(l.get(r)??[])){n=t;break}}d.splice(n,0,t)}}return d}function Zw(e,t,n,r,i){let a=[...t],o=new Set(e),s=new Set(t),l=r?new Set(r):null,u=n.filter(e=>o.has(e.src)&&s.has(e.dst)),d=l?n.filter(e=>s.has(e.src)&&l.has(e.dst)):void 0,f=p(t=>{let n=Jw(e,t,u);return d&&r&&(n+=Jw(t,r,d)),n},`crossingScore`),m=i?new Map:null;if(i&&m)for(let e of t)m.set(e,i(e));let h=!0,g=f(a);for(;h;){h=!1;for(let e=0;e+1<a.length;e++){if(m&&m.get(a[e])!==m.get(a[e+1]))continue;let t=g;[a[e],a[e+1]]=[a[e+1],a[e]];let n=f(a);n<t?(g=n,h=!0):[a[e],a[e+1]]=[a[e+1],a[e]]}}return a}function RLe(e,t,n){let r=e.layers.map(e=>[...e]),i=t.edges,a=Bw(t),o=Hw(t,n?.laneOrder);for(let e=0;e<3;e++){for(let e=1;e<r.length;e++)r[e]=Xw(r[e-1],r[e],i,`down`,a,o),r[e]=Zw(r[e-1],r[e],i,r[e+1],a);for(let e=r.length-2;e>=0;e--)r[e]=Xw(r[e+1],r[e],i,`up`,a,o),r[e]=Zw(r[e+1],r[e],i,r[e-1],a)}return{layers:r}}function zLe(e,t,n){let r=n?.layerGap??xT.DEFAULT_LAYER_GAP,i=n?.nodeGap??xT.DEFAULT_NODE_GAP,a=n?.laneGap??i*2,o=n?.direction??`TB`,s=o===`LR`||o===`RL`,l=e.layers,u=Object.create(null),d=Object.create(null),f=p(e=>t.nodeById.get(e),`getNode`),m=p(e=>f(e)?.width??0,`getWidth`),h=p(e=>f(e)?.height??0,`getHeight`),g=Bw(t),_=Hw(t,n?.laneOrder),v=l.map(e=>e.reduce((e,t)=>Math.max(e,h(t)),0)),y=[];if(s)for(let e=0;e+1<l.length;e++){let t=l[e].reduce((e,t)=>Math.max(e,m(t)),0),n=l[e+1].reduce((e,t)=>Math.max(e,m(t)),0),i=v[e],a=v[e+1],o=i/2+a/2,s=(t+n)/2,u=Math.max(0,s-o-r);y.push(u)}let b=new Set;for(let e of l)for(let t of e)b.add(g(t));let x=b.has(null),S=_.filter(e=>b.has(e)),C=[...x?[null]:[],...S],w=Object.create(null);for(let e of S)w[e]=0;x&&(w.null=0);for(let e of l){let t=Object.create(null),n=[];for(let r of e){let e=g(r);e===null?n.push(r):(t[e]||=[]).push(r)}for(let[e,n]of Object.entries(t)){let t=n.reduce((e,t)=>e+m(t),0)+i*Math.max(0,n.length-1);w[e]=Math.max(w[e]??0,t)}if(x&&n.length){let e=n.reduce((e,t)=>e+m(t),0)+i*Math.max(0,n.length-1);w.null=Math.max(w.null??0,e)}}let T=new Map;{let e=C.map(e=>(e===null?w.null:w[e])??0),t=-(e.reduce((e,t)=>e+t,0)+a*Math.max(0,C.length-1))/2;for(let n=0;n<C.length;n++){let r=C[n],i=e[n]??0,o=t+i/2;T.set(r,o),t+=i,n<C.length-1&&(t+=a)}}let E=0;for(let[e,t]of l.entries()){let n=v[e]??0,a=new Map;for(let e of t){let t=g(e),n=a.get(t)??[];n.push(e),a.set(t,n)}for(let e of C){let t=a.get(e)??[];if(t.length===0)continue;let r=T.get(e);if(t.length===1){let e=t[0];u[e]=r,d[e]=E+n/2}else{let e=t.map(e=>m(e)),a=r-(e.reduce((e,t)=>e+t,0)+i*(t.length-1))/2;for(let[r,o]of t.entries()){let t=e[r];u[o]=a+t/2,d[o]=E+n/2,a+=t+i}}}let o=y[e]??0;E+=n+r+o}let D=new Map;for(let e of t.edges){let t=e.ref.id;D.has(t)||D.set(t,[]),D.get(t).push(e)}for(let[,e]of D){if(e.length===0)continue;let n=e[0].ref,r=n.start,i=n.end;if(r==null||i==null)continue;let a=Math.round(((u[r]??0)+(u[i]??0))/2),o=new Set;for(let t of e)o.add(t.src),o.add(t.dst);for(let e of o)e!==r&&e!==i&&t.nodeById.get(e)?.isDummy&&(u[e]=a)}return{x:u,y:d}}function BLe(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function VLe(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function HLe(e,t){let n=[...e],r=VLe(t);for(let e=n.length-1;e>0;e--){let t=Math.floor(r()*(e+1));[n[e],n[t]]=[n[t],n[e]]}return n}function ULe(e,t){let n=0;for(let[r,i]of e.entries())n+=Math.abs(r-(t.get(i)??r));return n}function Qw(e,t){let n=new Map;for(let[t,r]of e.entries())n.set(r,t);let r=0;for(let{a:e,b:i,weight:a}of t){let t=n.get(e),o=n.get(i);t!=null&&o!=null&&(r+=a*Math.abs(t-o))}return r}function WLe(e){let t=Vw(e);if(t.length<2)return[];let n=new Map(t.map((e,t)=>[e,t])),r=Bw(e),i=new Map;for(let t of e.layout.edges??[]){if(t.isLayoutOnly)continue;let a=typeof t.start==`string`?t.start:void 0,o=typeof t.end==`string`?t.end:void 0;if(!a||!o||!e.nodeById.has(a)||!e.nodeById.has(o))continue;let s=r(a),l=r(o);if(!s||!l||s===l)continue;let u=n.get(s),d=n.get(l);if(u==null||d==null)continue;let[f,p]=u<=d?[s,l]:[l,s],m=`${f}\0${p}`,h=i.get(m);h?h.weight++:i.set(m,{a:f,b:p,weight:1})}return[...i.values()]}function $w(e,t,n){let r=[...e],i=Qw(r,t),a=!0,o=0,s=Math.max(1,r.length);for(;a&&o<s;){a=!1,o++;for(let e=0;e+1<r.length;e++){[r[e],r[e+1]]=[r[e+1],r[e]];let n=Qw(r,t);n<i?(i=n,a=!0):[r[e],r[e+1]]=[r[e+1],r[e]]}}return{order:r,cost:i,sourceDistance:ULe(r,n)}}function GLe(e,t){return e.cost===t.cost?e.sourceDistance<t.sourceDistance:e.cost<t.cost}function KLe(e,t,n){let r=[...t].sort((e,t)=>e.a===t.a?e.b.localeCompare(t.b):e.a.localeCompare(t.a)).map(({a:e,b:t,weight:n})=>`${e}:${t}:${n}`).join(`|`);return BLe(`${e.join(`|`)}#${r}#${n}`)}function qLe(e,t={}){let n=Vw(e);if(n.length<2)return n;let r=WLe(e);if(r.length===0)return n;let i=new Map(n.map((e,t)=>[e,t])),a=$w(n,r,i),o=Math.max(0,t.restarts??ST);for(let e=0;e<o;e++){let t=$w(HLe(n,KLe(n,r,e)),r,i);GLe(t,a)&&(a=t)}return a.order}function JLe(e,t){let n=t?.ignoreCrossLaneEdges??!0,r=t?.optimizeRanksByCrossings??!0,i=Aw(e),a=t?.automaticLaneOrdering?qLe(i,{restarts:ST}):void 0,o=hLe(i),s=o.acyclic,{layering:l,graphWithDummies:u}=FLe(n?PLe(s,{compactSingleInput:t?.compactSingleInput??bT.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:t?.direction}):MLe(s,{compactSingleInput:t?.compactSingleInput??bT.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:r}),s),d=RLe(l,u,{laneOrder:a}),f=zLe(d,u,{layerGap:t?.layerGap,nodeGap:t?.nodeGap,direction:t?.direction,laneOrder:a});return{acyclic:s,reversed:o.reversed,layering:l,ordered:d,coordinates:f}}function eT(e,t,n){let r=e.x??0,i=e.y??0,a=t.x-r,o=t.y-i,s=Math.abs(a),l=Math.abs(o);return s<CT&&l<CT?n:l>CT&&l*3>=s?o>0?`bottom`:`top`:s>CT?a>0?`right`:`left`:n}function tT(e,t){return Math.abs(e.to-t.from)<CT||Math.abs(e.to-t.to)<CT?e.to:e.from}function nT(e,t){return e.orient===`vertical`?{x:e.coord,y:t}:{x:t,y:e.coord}}function YLe(e,t){let n=e.nodes??[],r=e.edges??[],i=[];for(let e of r)e.isLayoutOnly||i.push({...e,__originalEdge:e});let a=new Map,o=new Map,s=[],l=t===`LR`;for(let e of n)a.set(e.id,e);let u=n.filter(e=>e.isGroup&&!e.parentId);for(let e of u){let t={id:e.id},r=p(e=>{o.set(e.id,t),n.filter(t=>t.parentId===e.id).forEach(r)},`assignLane`);r(e)}let d=n.filter(e=>!e.isGroup&&!e.isEdgeLabel).map(e=>{let t=e.width??10,n=e.height??10,r=e.x??0,i=e.y??0,a=oRe;return{nodeId:e.id,minX:r-t/2-a,maxX:r+t/2+a,minY:i-n/2-a,maxY:i+n/2+a,visualXHalfExtent:l?n/2+a:t/2+a}}),f=p((e,t,n,r)=>{let i=s.find(n=>n.orientation===e&&Math.abs(n.coord-t)<1);return i||(i={id:`pipe-${e}-${t.toFixed(0)}`,orientation:e,coord:t,spanMin:n,spanMax:r,tracks:[]},s.push(i)),i.spanMin=Math.min(i.spanMin,n),i.spanMax=Math.max(i.spanMax,r),i},`getOrAddPipe`),m=p((e,t)=>{let n=e.width??10,r=e.height??10,i=e.x??0,a=e.y??0;switch(t){case`top`:return{x:i,y:a-r/2};case`bottom`:return{x:i,y:a+r/2};case`left`:return{x:i-n/2,y:a};case`right`:return{x:i+n/2,y:a}}},`portForSide`),h=p((e,t,n)=>m(e,eT(e,t,n?`bottom`:`top`)),`getOrthogonalPort`),g=[],_=[],v=new Set,y=1e3,b=p((e,t,n)=>{if(g.length===0)return 0;let r=Math.abs(t.y-n.y)<CT,i=Math.abs(t.x-n.x)<CT;if(!r&&!i)return 0;let a=0;if(r){let r=t.y,i=Math.min(t.x,n.x)-CT,o=Math.max(t.x,n.x)+CT;if(o<=i)return 0;for(let t of g)t.edgeIndex!==e&&t.orientation===`vertical`&&(t.pipe.coord<i||t.pipe.coord>o||t.from-CT<=r&&t.to+CT>=r&&(a+=y))}else if(i){let r=t.x,i=Math.min(t.y,n.y)-CT,o=Math.max(t.y,n.y)+CT;if(o<=i)return 0;for(let t of g)t.edgeIndex!==e&&t.orientation===`horizontal`&&(t.pipe.coord<i||t.pipe.coord>o||t.from-CT<=r&&t.to+CT>=r&&(a+=y))}return a},`crossingPenalty`),x=i.map((e,t)=>{if(!e.start||!e.end)return{idx:t,crossLane:0,dx:0,dy:0};let n=a.get(e.start),r=a.get(e.end),i=o.get(e.start),s=o.get(e.end);return{idx:t,crossLane:i&&s&&i.id!==s.id?1:0,dx:n&&r?Math.abs((r.x??0)-(n.x??0)):0,dy:n&&r?Math.abs((r.y??0)-(n.y??0)):0}}).sort((e,t)=>{if(e.crossLane!==t.crossLane)return t.crossLane-e.crossLane;let n=e.dx+e.dy,r=t.dx+t.dy;return Math.abs(n-r)>1?n-r:e.idx-t.idx}).map(e=>e.idx),S=p((e,t,n,r)=>{let i=Math.min(e.x,t.x),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y),s=Math.max(e.y,t.y);return!!d.find(l=>n&&l.nodeId===n||r&&l.nodeId===r?!1:Math.abs(e.x-t.x)>CT?l.minY<e.y&&l.maxY>e.y&&l.maxX>i&&l.minX<a:l.minX<e.x&&l.maxX>e.x&&l.maxY>o&&l.minY<s)},`isSegmentBlocked`),C=new Map,w=new Map;for(let e of i)e.start&&e.end&&e.start!==e.end&&(w.set(e.start,(w.get(e.start)??0)+1),w.set(e.end,(w.get(e.end)??0)+1));let T=p((e,t)=>eT(e,t,`bottom`),`determineSide`),E=new Map;for(let[e,t]of i.entries()){if(!t.start||!t.end||t.start===t.end||t.points&&t.points.length>0)continue;let n=a.get(t.start),r=a.get(t.end);if(!n||!r)continue;let i=(r.x??0)-(n.x??0),o=(r.y??0)-(n.y??0);E.set(e,{edgeIdx:e,srcId:t.start,dstId:t.end,srcSide:T(n,{x:r.x??0,y:r.y??0}),dstSide:T(r,{x:n.x??0,y:n.y??0}),absDx:Math.abs(i),absDy:Math.abs(o),dxSign:Math.sign(i),dySign:Math.sign(o)})}let D=p(e=>e.srcSide===`top`||e.srcSide===`bottom`?e.absDx===0?1/0:e.absDy/e.absDx:e.absDy===0?1/0:e.absDx/e.absDy,`preferenceStrength`),O=p(e=>e.srcSide===`top`||e.srcSide===`bottom`?e.dxSign>=0?`right`:`left`:e.dySign>=0?`bottom`:`top`,`secondarySide`),k=new Map;for(let e of E.values()){let t=`${e.srcId}:${e.srcSide}`;k.has(t)||k.set(t,[]),k.get(t).push(e)}let A=new Map,j=p((e,t)=>`${e}:${t}`,`loadKey`);for(let e of E.values())A.set(j(e.srcId,e.srcSide),(A.get(j(e.srcId,e.srcSide))??0)+1),A.set(j(e.dstId,e.dstSide),(A.get(j(e.dstId,e.dstSide))??0)+1);for(let e of k.values())if(!(e.length<2)){e.sort((e,t)=>{let n=D(e),r=D(t);return Math.abs(n-r)>1e-9?r-n:e.edgeIdx-t.edgeIdx});for(let t=1;t<e.length;t++){let n=e[t],r=O(n),i=A.get(j(n.srcId,n.srcSide))??0,a=A.get(j(n.srcId,r))??0;a>=i||(A.set(j(n.srcId,n.srcSide),i-1),A.set(j(n.srcId,r),a+1),n.srcSide=r)}}let M=p(e=>{let t=e?.shape;return t===`question`||t===`diamond`},`isDiamondNode`),N=new Map;for(let e of E.values())N.has(e.dstId)||N.set(e.dstId,new Set),N.get(e.dstId).add(e.dstSide);for(let e of E.values()){if(!M(a.get(e.srcId)))continue;let t=N.get(e.srcId);if(!t?.has(e.srcSide))continue;let n=O(e);if(t.has(n)||(A.get(j(e.srcId,n))??0)>0)continue;let r=A.get(j(e.srcId,e.srcSide))??0;A.set(j(e.srcId,e.srcSide),Math.max(0,r-1)),A.set(j(e.srcId,n),1),e.srcSide=n}for(let e of E.values()){let{edgeIdx:t,srcId:n,dstId:r,srcSide:i,dstSide:o}=e,s=a.get(n),l=a.get(r),u=`${n}:${i}:src`,d=i===`top`||i===`bottom`?l.x??0:l.y??0;C.has(u)||C.set(u,[]),C.get(u).push({edgeIdx:t,oppositeCoord:d});let f=`${r}:${o}:dst`,p=o===`top`||o===`bottom`?s.x??0:s.y??0;C.has(f)||C.set(f,[]),C.get(f).push({edgeIdx:t,oppositeCoord:p})}let P=new Map;for(let[e,t]of C){if(t.length<2)continue;t.sort((e,t)=>e.oppositeCoord-t.oppositeCoord);let n=e.split(`:`),r=n.slice(0,-2).join(`:`),i=n[n.length-2],o=n[n.length-1],s=a.get(r);if(!s)continue;let l=i===`left`||i===`right`?s.height??10:s.width??10,u=s.shape,d=u===`question`||u===`diamond`?l*.3:l,f=Math.min(20,Math.max(8,d/(t.length+1))),p=-(f*(t.length-1))/2;for(let[e,n]of t.entries()){let t=p+e*f,r=`${n.edgeIdx}:${o}`;P.set(r,t)}}let F=p(e=>!!i[e]?.labelNodeId,`edgeHasLabelNode`),I=p((e,t)=>e?(C.get(`${e}:${t}:src`)??[]).some(({edgeIdx:e})=>F(e))||(C.get(`${e}:${t}:dst`)??[]).some(({edgeIdx:e})=>F(e)):!1,`faceHasLabelNode`),L=p((e,t,n)=>t===`top`||t===`bottom`?{x:e.x+n,y:e.y}:{x:e.x,y:e.y+n},`applyPortOffset`),R=p((e,t,n)=>{let r=E.get(e),i={x:n.x??0,y:n.y??0},a={x:t.x??0,y:t.y??0},o=r?.srcSide??T(t,i),s=r?.dstSide??T(n,a),l=r?m(t,r.srcSide):h(t,i,!0),u=r?m(n,r.dstSide):h(n,a,!1),d=P.get(`${e}:src`),f=P.get(`${e}:dst`);return d!==void 0&&(l=L(l,o,d)),f!==void 0&&(u=L(u,s,f)),{pSrcPort:l,pDstPort:u,srcSide:o,dstSide:s}},`portsForEdge`);for(let e of x){let t=i[e];if(_[e]=[],!t.start||!t.end||t.points&&t.points.length>0||t.start===t.end)continue;let n=a.get(t.start),r=a.get(t.end);if(!n||!r)continue;let{pSrcPort:o,pDstPort:u,srcSide:m,dstSide:h}=R(e,n,r),y={...o},x={...u},T=m===`top`||m===`bottom`,E=h===`top`||h===`bottom`;T?y.y=o.y>(n.y??0)?o.y+DT:o.y-DT:y.x=o.x>(n.x??0)?o.x+DT:o.x-DT,E?x.y=u.y>(r.y??0)?u.y+DT:u.y-DT:x.x=u.x>(r.x??0)?u.x+DT:u.x-DT;let D=p((e,t)=>{for(let n of d)if(!t.includes(n.nodeId)&&e.x>n.minX&&e.x<n.maxX&&e.y>n.minY&&e.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},`isPointInObstacle`),O=p((e,t,n,r,i)=>{if(i){let i=e.y>(t.y??0);return{x:(n.x??0)>=e.x?r.maxX+wT:r.minX-wT,y:i?r.maxY+TT:r.minY-TT,leavesPositiveSide:i}}let a=e.x>(t.x??0),o=(n.y??0)>=e.y;return{x:a?r.maxX+wT:r.minX-wT,y:o?r.maxY+TT:r.minY-TT,leavesPositiveSide:a}},`obstacleDetour`),k=[],A=[t.start,t.end],j=D(y,A);if(j.inside&&j.obstacle){let e=j.obstacle;if(T){let t=O(o,n,r,e,!0);y.x=t.x,y.y=t.y;let i=t.leavesPositiveSide?Math.min(e.minY-2,o.y+DT):Math.max(e.maxY+2,o.y-DT);k=[{x:o.x,y:i},{x:t.x,y:i},{x:t.x,y:t.y}]}else{let t=O(o,n,r,e,!1),i=t.leavesPositiveSide?Math.min(e.minX-2,o.x+DT):Math.max(e.maxX+2,o.x-DT);y.x=t.x,y.y=t.y,k=[{x:i,y:o.y},{x:i,y:t.y},{x:t.x,y:t.y}]}}let M=[],N=D(x,A);if(N.inside&&N.obstacle){let e=N.obstacle;if(E){let t=O(u,r,n,e,!0);x.x=t.x,x.y=t.y,M=[{x:t.x,y:t.y},{x:u.x,y:t.y}]}else{let t=O(u,r,n,e,!1);x.x=t.x,x.y=t.y,M=[{x:t.x,y:t.y},{x:t.x,y:u.y}]}}if(k.length===0&&M.length===0){let n=wT,r=Math.abs(y.x-x.x)<n,i=Math.abs(y.y-x.y)<n,a=P.get(`${e}:src`)!==void 0||P.get(`${e}:dst`)!==void 0,s=(C.get(`${t.start??``}:${m}:src`)?.length??0)+(C.get(`${t.start??``}:${m}:dst`)?.length??0),l=(C.get(`${t.end??``}:${h}:src`)?.length??0)+(C.get(`${t.end??``}:${h}:dst`)?.length??0),d=s>1||l>1,f=w.get(t.start??``)??0,p=w.get(t.end??``)??0,_=s>1&&I(t.start,m)||l>1&&I(t.end,h);if((r||i)&&!a&&(!d||d&&!_&&(s<=1||f<=2)&&(l<=1||p<=2))&&!S(o,u,t.start,t.end)){t.points=[{...o},{...y},{...x},{...u}],v.add(e);let n=i?`horizontal`:`vertical`,r=i?o.y:o.x,a=i?Math.min(o.x,u.x):Math.min(o.y,u.y),s=i?Math.max(o.x,u.x):Math.max(o.y,u.y),l={id:`fast-path-${n}-${r.toFixed(0)}-${e}`,orientation:n,coord:r,spanMin:a,spanMax:s,tracks:[]};g.push({edgeIndex:e,segmentIndex:0,orientation:n,pipe:l,trackIndex:0,from:a,to:s});continue}}y.x=f(`vertical`,y.x,y.y,y.y).coord,x.x=f(`vertical`,x.x,x.y,x.y).coord;let F=Math.min(y.x,x.x)-50,L=Math.max(y.x,x.x)+50,ee=Math.min(y.y,x.y)-50,z=Math.max(y.y,x.y)+50;for(let e of d){let t=Math.min(y.x,x.x),n=Math.max(y.x,x.x),r=Math.min(y.y,x.y),i=Math.max(y.y,x.y);e.minX<n&&e.maxX>t&&e.minY<i&&e.maxY>r&&(F=Math.min(F,e.minX-ET),L=Math.max(L,e.maxX+ET),ee=Math.min(ee,e.minY-ET),z=Math.max(z,e.maxY+ET))}for(let e of d){if(e.maxX<F||e.minX>L||e.maxY<ee||e.minY>z)continue;let t=wT;f(`horizontal`,e.minY-t,F,L),f(`horizontal`,e.maxY+t,F,L);let n=TT;f(`vertical`,e.minX-n,ee,z),f(`vertical`,e.maxX+n,ee,z)}f(`horizontal`,y.y,F,L),f(`horizontal`,x.y,F,L);let B=s.filter(e=>e.orientation===`horizontal`&&e.coord>=ee&&e.coord<=z),V=s.filter(e=>e.orientation===`vertical`&&e.coord>=F&&e.coord<=L),te=p((e,t)=>`${e.toFixed(1)},${t.toFixed(1)}`,`getKey`),ne=te(y.x,y.y),re=te(x.x,x.y),ie=new Map,ae=new Map,oe=new Map,se=new Set,ce=[];ie.set(ne,0),oe.set(ne,`n`),ce.push({key:ne,f:Math.hypot(x.x-y.x,x.y-y.y),pt:y}),se.add(ne);let le=[],ue=p((e,n)=>S(e,n,t.start,t.end),`checkSegmentBlocked`),de={x:x.x,y:y.y},fe=ue(y,de),pe=ue(de,x),me=fe||pe,he={x:y.x,y:x.y},ge=ue(y,he),_e=ue(he,x);if(me?ge||_e||(le=Math.abs(y.x-x.x)<CT?[y,x]:[y,he,x]):le=Math.abs(y.y-x.y)<CT||Math.abs(y.x-x.x)<CT?[y,x]:[y,de,x],le.length===0)for(;ce.length>0;){ce.sort((e,t)=>e.f-t.f);let n=ce.shift();if(se.delete(n.key),n.key===re){let e=re,t=x;for(le=[t];ae.has(e);){let n=ae.get(e);le.unshift(n),t=n,e=te(n.x,n.y)}break}let r=n.pt.x,i=n.pt.y,a=V.sort((e,t)=>e.coord-t.coord),o=a.findIndex(e=>Math.abs(e.coord-r)<1),s=B.sort((e,t)=>e.coord-t.coord),l=s.findIndex(e=>Math.abs(e.coord-i)<1),u=[];o>0&&u.push({x:a[o-1].coord,y:i}),o>=0&&o<a.length-1&&u.push({x:a[o+1].coord,y:i}),l>0&&u.push({x:r,y:s[l-1].coord}),l>=0&&l<s.length-1&&u.push({x:r,y:s[l+1].coord});for(let a of u){let o=Math.min(r,a.x),s=Math.max(r,a.x),l=Math.min(i,a.y),u=Math.max(i,a.y);if(d.some(e=>e.nodeId===t.start||e.nodeId===t.end?!1:o===s?e.minX<r&&e.maxX>r&&e.maxY>l&&e.minY<u:e.minY<i&&e.maxY>i&&e.maxX>o&&e.minX<s))continue;let f=te(a.x,a.y),p=Math.abs(a.x-r)+Math.abs(a.y-i),m=b(e,n.pt,a),h=0,g=x.x-y.x,_=x.y-y.y,v=a.x-r,S=a.y-i;(_>10&&S<-5||_<-10&&S>5)&&(h=Math.abs(S)*100),(g>10&&v<-5||g<-10&&v>5)&&(h+=Math.abs(v)*50);let C=0,w=oe.get(n.key)??`n`,T=Math.abs(v)>CT?`h`:`v`;w!==`n`&&w!==T&&(C=50);let E=p+m+h+C,D=(ie.get(n.key)??1/0)+E,O=Math.abs(x.x-a.x)+Math.abs(x.y-a.y);if(D<(ie.get(f)??1/0)){if(ae.set(f,n.pt),ie.set(f,D),oe.set(f,T),!se.has(f))ce.push({key:f,f:D+O,pt:a}),se.add(f);else{let e=ce.findIndex(e=>e.key===f);e!==-1&&(ce[e].f=D+O)}}}}if(le.length===0&&(le=[y,{x:y.x,y:x.y},x]),le.length>4){let e=le[0],t=le[le.length-1],n=Math.min(e.x,t.x),r=Math.max(e.x,t.x),i=Math.min(e.y,t.y),a=Math.max(e.y,t.y);for(let e of le)n=Math.min(n,e.x),r=Math.max(r,e.x),i=Math.min(i,e.y),a=Math.max(a,e.y);let o=r>Math.max(e.x,t.x),s=n<Math.min(e.x,t.x);if(l){let i=TT;if(o){let n=Math.max(e.x,t.x),a=Math.min(e.y,t.y),o=Math.max(e.y,t.y),s=d.filter(e=>e.minX<n&&e.maxX>n&&e.minY<o&&e.maxY>a);if(s.length>0){let n=Math.max(e.x,t.x);for(let e of s){let t=(e.minX+e.maxX)/2;if(e.visualXHalfExtent===void 0||isNaN(e.visualXHalfExtent))continue;let r=t+e.visualXHalfExtent+i;n=Math.max(n,r)}isNaN(n)||(r=n)}}if(s){let r=d.filter(n=>n.minX<Math.min(e.x,t.x)+i&&n.minY<Math.max(e.y,t.y)&&n.maxY>Math.min(e.y,t.y));if(r.length>0){let a=Math.min(e.x,t.x);for(let e of r){let t=(e.minX+e.maxX)/2-e.visualXHalfExtent-i;a=Math.min(a,t)}n=a}}}let u=p(n=>{let r=t.y>e.y,i=d.filter(n=>{let r=Math.min(e.x,t.x)<n.maxX&&Math.max(e.x,t.x)>n.minX,i=Math.min(e.y,t.y)<n.maxY&&Math.max(e.y,t.y)>n.minY;return r&&i}),a=i;if(l&&i.length>0){let e=i.filter(e=>e.minX<n&&e.maxX>n);e.length>0&&(a=e)}if(a.length===0)return t.y;let o=wT;if(r){let e=Math.max(...a.map(e=>e.maxY))+o;if(e<t.y-CT)return e}else{let e=Math.min(...a.map(e=>e.minY))-o;if(e>t.y+CT)return e}return t.y},`findBestReturnY`),f=p(n=>{let r=u(n),i={x:n,y:e.y},a={x:n,y:r},o={x:t.x,y:r},s=ue(e,i),l=ue(i,a),d=ue(a,o),f=r!==t.y&&ue(o,t);return!s&&!l&&!d&&!f?Math.abs(r-t.y)<CT?[e,i,a,t]:[e,i,a,o,t]:null},`trySimplifyWithDetourX`),m=o&&!s?f(r):s&&!o?f(n):null;m&&(le=m)}let ve=[o,...k,...le,...M.reverse(),u];if(ve.length>=3){let e=ve[ve.length-1],t=ve[ve.length-2],n=ve[ve.length-3],r=Math.abs(n.y-t.y)<CT&&Math.abs(t.y-e.y)<CT,i=Math.abs(n.x-t.x)<CT&&Math.abs(t.x-e.x)<CT;if(r){let r=Math.sign(t.x-n.x),i=Math.sign(e.x-n.x);r!==0&&r===i&&Math.abs(t.x-n.x)>Math.abs(e.x-n.x)&&ve.splice(-2,1)}else if(i){let r=Math.sign(t.y-n.y),i=Math.sign(e.y-n.y);r!==0&&r===i&&Math.abs(t.y-n.y)>Math.abs(e.y-n.y)&&ve.splice(-2,1)}}let ye=[ve[0]];for(let e=1;e<ve.length-1;e++){if(e===1){ye.push(ve[e]);continue}let t=ye[ye.length-1],n=ve[e],r=ve[e+1];if(Math.abs(t.y-n.y)<CT&&Math.abs(n.y-r.y)<CT){if(n.x>t.x!=r.x>n.x){ye.push(n);continue}continue}if(Math.abs(t.x-n.x)<CT&&Math.abs(n.x-r.x)<CT){if(n.y>t.y!=r.y>n.y){ye.push(n);continue}continue}ye.push(n)}ye.push(ve[ve.length-1]);for(let t=0;t<ye.length-1;t++){let n=ye[t],r=ye[t+1],i=Math.abs(n.x-r.x)<CT?`vertical`:`horizontal`,a=i===`vertical`?n.x:n.y,o=i===`vertical`?Math.min(n.y,r.y):Math.min(n.x,r.x),s=i===`vertical`?Math.max(n.y,r.y):Math.max(n.x,r.x),l=f(i,a,o,s),u={edgeIndex:e,segmentIndex:t,orientation:i,pipe:l,trackIndex:0,from:o,to:s};g.push(u),_[e].push(g.length-1),l.tracks[0]||(l.tracks[0]={index:0,coord:l.coord,segments:[]}),l.tracks[0].segments.push({edgeIndex:e,segmentIndex:t,from:o,to:s})}}let ee=p((e,t)=>e.from<t.to&&t.from<e.to,`segmentsOverlap`),z=p((e,t,n,r)=>{let i=!r.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&ee(n,e)),a=!n.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&ee(n,t));return i&&a?(e.trackIndex=r.index,t.trackIndex=n.index,n.segments=[...n.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),{edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to}],r.segments=[...r.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),{edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to}],!0):!1},`trySwapSegmentsAcrossTracks`),B=p(e=>{let t=e.tracks.length;return e.tracks[t]={index:t,coord:e.coord,segments:[]},t},`createNewTrack`),V=p((e,t)=>{let n=e.pipe.tracks[e.trackIndex];n.segments=n.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),e.trackIndex=t,e.pipe.tracks[t].segments.push({edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to})},`moveSegmentToTrack`),te=p((e,t)=>{let n=_[e.edgeIndex];for(let r of n){let n=g[r];n.pipe===e.pipe&&V(n,t)}},`moveSegmentChainToTrack`),ne=p(e=>{let t=_[e.edgeIndex],n=t.indexOf(g.indexOf(e)),r=[];return n>0&&r.push(g[t[n-1]]),n<t.length-1&&r.push(g[t[n+1]]),r},`getAdjacentSegmentsAlongEdge`),re=p((e,t)=>{if(e.orientation===t.orientation)return!1;let n=e.orientation===`horizontal`?e:t,r=e.orientation===`horizontal`?t:e;return r.pipe.coord>n.from&&r.pipe.coord<n.to&&n.pipe.coord>r.from&&n.pipe.coord<r.to},`haveAnyCrossing`),ie=p((e,t)=>{for(let n of e.tracks)if(!n.segments.some(e=>(e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex)&&ee(e,t)))return n.index;return-1},`findAvailableTrack`),ae=p((e,t)=>{if(e.trackIndex===t.trackIndex)return ee(e,t);let n=ne(e),r=ne(t);return n.some(e=>r.some(t=>re(e,t)))},`segmentsConflict`),oe=p((e,t,n)=>{if(z(e,t,e.pipe.tracks[e.trackIndex],t.pipe.tracks[t.trackIndex]))return;let r=ie(e.pipe,t);n(t,r===-1?B(e.pipe):r)},`resolveTrackConflict`),se=p(e=>{let t=0;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){let i=e[n],a=e[r];i.pipe===a.pipe&&ae(i,a)&&(t++,oe(i,a,te))}return t},`resolveHandleConflicts`),ce=new Map,le=p(e=>{if(ce.has(e))return ce.get(e);let t=_[e];if(t.length===0){let t={dest:0,deviation:0,base:0,delta:0};return ce.set(e,t),t}let n=g[t[0]].pipe.coord,r=n;for(let e=1;e<t.length;e++){let i=g[t[e]];if(i.orientation===`horizontal`){let e=i.from,t=i.to;r=Math.abs(e-n)>Math.abs(t-n)?e:t;break}}let i=Math.abs(r-n),a={dest:r,deviation:i,base:n,delta:r-n};return ce.set(e,a),a},`getDestInfo`),ue=p(()=>{let e=0,t=new Map;for(let[e,n]of i.entries())_[e].length!==0&&n.start&&(t.has(n.start)||t.set(n.start,[]),t.get(n.start).push(e));let n=p(e=>{let t=i[e];if(!t.start||!t.end)return 0;let n=a.get(t.start),r=a.get(t.end);if(!n||!r)return 0;let o=(r.x??0)-(n.x??0),s=(r.y??0)-(n.y??0);return Math.abs(o)+Math.abs(s)},`getEdgeDistance`);for(let r of t.values()){r.sort((e,t)=>{let r=le(e),i=le(t);if(Math.abs(r.deviation-i.deviation)>1)return r.deviation-i.deviation;if(Math.abs(r.dest-i.dest)>1)return r.dest-i.dest;let a=n(e),o=n(t);if(Math.abs(a-o)>1)return o-a;let s=_[e].length,l=_[t].length;if(s!==l)return s-l;if(s===1){let n=_[e][0],r=_[t][0];if(g[n]&&g[r]){let e=g[n],t=g[r],i=Math.abs(e.to-e.from),a=Math.abs(t.to-t.from);if(Math.abs(i-a)>1)return i-a}}return 0});let t=r.map(e=>g[_[e][0]]);e+=se(t)}return e},`fixSourceHandleCrossings`),de=p(()=>{let e=0,t=new Map;for(let[e,n]of i.entries())_[e].length!==0&&n.end&&(t.has(n.end)||t.set(n.end,[]),t.get(n.end).push(e));for(let n of t.values()){n.sort((e,t)=>{let n=p(e=>{let t=_[e];if(t.length<2)return 0;let n=g[t[t.length-2]];return Math.abs(n.to-n.from)},`getDist`),r=n(e),i=n(t);return Math.abs(r-i)>.1?r-i:e-t});let t=n.map(e=>g[_[e][_[e].length-1]]);e+=se(t)}return e},`fixTargetHandleCrossings`),fe=p(()=>{let e=0;for(let t of s){let n=[];for(let e of t.tracks)for(let t of e.segments){let e=_[t.edgeIndex].find(e=>g[e].segmentIndex===t.segmentIndex);e!==void 0&&n.push(g[e])}n.sort((e,t)=>e.edgeIndex-t.edgeIndex||e.segmentIndex-t.segmentIndex);for(let t=0;t<n.length;t++)for(let r=t+1;r<n.length;r++){let i=n[t],a=n[r];ae(i,a)&&(e++,oe(i,a,V))}}return e},`fixPipeCrossings`),pe=0;for(;pe<10;){let e=0;if(e+=ue(),e+=de(),e+=fe(),e===0)break;pe++}let me=new Map;for(let e of s){let t=[];e.tracks.forEach(e=>{e.segments.forEach(n=>{t.push({edgeIndex:n.edgeIndex,segmentIndex:n.segmentIndex,trackIndex:e.index,from:n.from,to:n.to})})}),t.sort((e,t)=>e.from-t.from);let n=[];if(t.length>0){let e=[t[0]],r=t[0].to;for(let i=1;i<t.length;i++){let a=t[i];a.from<r?(e.push(a),r=Math.max(r,a.to)):(n.push(e),e=[a],r=a.to)}n.push(e)}for(let t of n){let n=new Set;t.forEach(e=>n.add(e.trackIndex));let r=new Map;t.forEach(e=>{let t=le(e.edgeIndex);r.set(e.trackIndex,(r.get(e.trackIndex)??0)+t.delta)});let i=[...n].filter(e=>(r.get(e)??0)<-1),a=[...n].filter(e=>(r.get(e)??0)>1),o=[...n].filter(e=>Math.abs(r.get(e)??0)<=1);i.sort((e,t)=>(r.get(t)??0)-(r.get(e)??0)),a.sort((e,t)=>(r.get(e)??0)-(r.get(t)??0));let s=p((n,r)=>{t.filter(e=>e.trackIndex===n).forEach(t=>{let n=v.has(t.edgeIndex)?e.coord:r;me.set(`${t.edgeIndex}-${t.segmentIndex}`,n)})},`assignCoord`),l=0;for(let t of i)l++,s(t,e.coord-l*OT);if(o.length===0&&n.size>0){let e=[...n].sort((e,t)=>Math.abs(r.get(e)??0)-Math.abs(r.get(t)??0))[0],t=i.indexOf(e);t!==-1&&i.splice(t,1);let s=a.indexOf(e);s!==-1&&a.splice(s,1),o.push(e)}let u=0;for(let t of o){if(u===0)s(t,e.coord);else{let n=u%2==1?1:-1,r=Math.ceil(u/2);s(t,e.coord+n*r*OT*.5)}u++}let d=0;for(let t of a)d++,s(t,e.coord+d*OT)}}for(let[e,t]of i.entries()){let n=_[e]??[];if(n.length===0)continue;let r=[],{pSrcPort:i,pDstPort:o}=R(e,a.get(t.start),a.get(t.end)),s=n.map(e=>{let t=g[e],n=me.get(`${t.edgeIndex}-${t.segmentIndex}`)??t.pipe.coord;return{orient:t.orientation,coord:n,from:t.from,to:t.to}});r.push(i);for(let e=0;e<s.length;e++){let t=s[e],n=r[r.length-1],i=t.orient===`vertical`?n.y:n.x,a=t.orient===`vertical`?n.x:n.y,o=s[e+1],l=e<s.length-1;if(Math.abs(a-t.coord)>CT&&r.push(nT(t,i)),l&&o.orient===t.orient){if(Math.abs(t.coord-o.coord)>CT){let e=t.orient===`vertical`?(i+o.from)/2:tT(t,o);r.push(nT(t,e),nT(o,e))}else(e===0||e===s.length-2)&&r.push(nT(t,tT(t,o)))}else if(l)r.push(nT(t,o.coord));else{let e=Math.abs(t.from-i)<Math.abs(t.to-i)?t.to:t.from;r.push(nT(t,e))}}let l=r[r.length-1];(Math.abs(l.x-o.x)>CT||Math.abs(l.y-o.y)>CT)&&r.push(o);let u=[];r.length>0&&u.push(r[0]);for(let e=1;e<r.length;e++){let t=r[e],n=u[u.length-1];(Math.abs(t.x-n.x)>CT||Math.abs(t.y-n.y)>CT)&&u.push(t)}t.points=u}for(let e of i){let t=e.__originalEdge;t&&e.points&&(t.points=e.points)}e.edges=(e.edges??[]).filter(e=>!e.isLayoutOnly);let he=p((e,t)=>{let n=t.x??0,r=t.y??0,i=t.width??0,a=t.height??0;if(i<=0||a<=0)return e;let o=n-i/2,s=n+i/2,l=r-a/2,u=r+a/2;if(e.x<o||e.x>s||e.y<l||e.y>u)return e;let d=e.x-o,f=s-e.x,p=e.y-l,m=u-e.y,h=Math.min(d,f,p,m);return h===d?{x:o,y:e.y}:h===f?{x:s,y:e.y}:h===p?{x:e.x,y:l}:{x:e.x,y:u}},`nodeBoundaryClamp`);for(let t of e.edges){let e=t.points;if(!e||e.length<2)continue;let n=t.start,r=t.end,i=n?a.get(n):void 0,o=r?a.get(r):void 0;i&&(e[0]=he(e[0],i)),o&&(e[e.length-1]=he(e[e.length-1],o))}return e}function XLe(e){return e.direction??`TB`}function ZLe(e){let t=PIe(e),n=e.config.flowchart?.nodeSpacing??40,r=e.config.flowchart?.rankSpacing??100,i=e.config.swimlane?.ignoreCrossLaneEdges??!0,a=e.config.swimlane?.optimizeRanksByCrossings??!0,o=e.config.swimlane?.automaticLaneOrdering??!1,s=XLe(e),{ordered:l,coordinates:u}=JLe(t,{nodeGap:n,layerGap:r,ignoreCrossLaneEdges:i,optimizeRanksByCrossings:a,automaticLaneOrdering:o,direction:s});FIe(t,l,u,{nodeGap:n,layerGap:r});for(let t of e.edges??[])delete t.points;YLe(e,s);for(let t of e.edges??[])(!t.curve||t.curve===`basis`)&&(t.curve=`rounded`);return pLe(e,s),fLe(e),s}function QLe(e){NIe(e);let t=IIe(e);e.nodes=t.nodes,e.edges=t.edges}var rT,$Le,iT,eRe,aT,oT,tRe,sT,cT,lT,nRe,uT,dT,fT,pT,mT,rRe,hT,gT,_T,vT,yT,iRe,aRe,bT,xT,ST,CT,oRe,wT,TT,ET,DT,OT,sRe,cRe=o((()=>{kIe(),fNe(),w_(),U_(),b_(),h_(),Zf(),Th(),up(),Sm(),Vs(),S(),h(),p(jIe,`applySwimlaneLineJumps`),rT=`__swimlane_default__`,$Le=21,iT=20,p(CC,`topLaneHorizontalPadding`),p(MIe,`assignTopLaneTitleRect`),p(NIe,`prepareLayoutForSwimlanes`),p(PIe,`toGraphView`),p(FIe,`writeBackToLayoutData`),eRe=`[EdgeLabelNodes]`,p(IIe,`createEdgeLabelNodes`),aT=.001,p(wC,`measuredNodeRect`),p(TC,`nodeBoundsInfoFor`),p(EC,`samePoint`),p(DC,`sameX`),p(OC,`sameY`),p(kC,`isHorizontalSegment`),p(AC,`isVerticalSegment`),p(jC,`overlapLength`),p(MC,`sameAxisSegmentOverlapLength`),p(NC,`orthogonalSegmentsForPoints`),p(PC,`countOrthogonalBends`),p(FC,`dedupeConsecutivePoints`),p(IC,`classifyThreeSegmentRoute`),p(LC,`segmentBoundsOverlapRect`),p(RC,`pointInsideRect`),p(LIe,`rectContainsRect`),p(zC,`rectsOverlap`),p(BC,`inflateRect`),p(VC,`rectFromCenterSize`),p(HC,`rectOfNodeBounds`),p(UC,`portForRectSide`),p(WC,`buildOrthogonalPortPath`),p(GC,`buildSameSideTrackPath`),p(KC,`collectRealNodeBounds`),p(qC,`collectNodeRectEntries`),p(RIe,`collectLayoutNodeRects`),p(JC,`getNodePairGeometry`),p(YC,`segmentHitsAnyRect`),p(XC,`orthogonalSegmentsCross`),p(zIe,`sameAxisSegmentsOverlap`),p(ZC,`segmentConflictsWithAnyEdge`),p(QC,`orthogonalSegmentsStrictlyCross`),p($C,`strictlyBetween`),p(BIe,`isCollinearIntermediate`),p(VIe,`simplifyPolylineOnce`),p(ew,`orthogonalizePolyline`),p(tw,`simplifyPolyline`),oT=.001,tRe=.5,sT=4,p(nw,`endpointContextFor`),p(HIe,`segmentEnterPoint`),p(rw,`clipEndpoint`),p(UIe,`clipEdgeEndpointsToNodeBoundaries`),p(iw,`snapEndpointToBoundary`),p(aw,`firstDistinctAdjacent`),p(ow,`cornerClearanceRange`),p(sw,`clampToCornerClearance`),p(WIe,`intersectRanges`),p(cw,`clearanceRangeForSide`),p(lw,`terminalSideForSegment`),p(uw,`isHorizontalSide`),p(GIe,`straightClearanceRange`),p(dw,`clearStraightEndpointCornerAxis`),p(fw,`clearStraightEndpointCornerConnections`),p(KIe,`cornerClearedEndpoint`),p(qIe,`moveCollinearEndpointRun`),p(pw,`clearEndpointCornerConnection`),p(mw,`borderSideForSegment`),p(hw,`leavesOutward`),p(gw,`collapseOwnBorderStub`),p(JIe,`snapAndCollapseEndpoints`),p(_w,`prepareEdgeEndpointsForRenderer`),p(vw,`buildNodeMap`),p(YIe,`resolveTopLevelGroupId`),p(yw,`groupDepth`),p(bw,`boundsForChildren`),p(XIe,`applyGroupBounds`),p(ZIe,`recomputeNestedGroupBounds`),p(xw,`mirrorAxis`),p(QIe,`applyBtDirectionTransform`),p($Ie,`applyLrDirectionTransform`),cT=1e-6,lT=8,nRe=[0,lT,-lT,2*lT,-2*lT],p(eLe,`portSwapToLShape`),p(tLe,`collapseShortTerminalStub`),uT=.001,dT=8,fT=NC,pT=p((e,t)=>DC(e,t,uT)||OC(e,t,uT),`orthogonallyAligned`),p(nLe,`separateSharedRenderedTerminalLanes`),p(rLe,`collapseRedundantRectangularDoglegs`),p(Sw,`liftObstacleHuggingSameSideRails`),p(Cw,`liftTopLaneTitleBandsAboveRails`),p(ww,`shiftLeftLaneTitleBandsLeftOfRails`),p(iLe,`swapDestinationTerminalTailsToReduceCrossings`),p(aLe,`reassignCrossingExternalRailChannels`),p(oLe,`shortcutRedundantOrthogonalJogs`),p(sLe,`resolveRenderedOrthogonalCrossings`),mT=.001,rRe=8,p(cLe,`simplifyDetouredEdges`),hT=.001,gT=10,_T=7,p(Tw,`markerClearanceRectFor`),p(lLe,`normalizeRect`),p(Ew,`labelOverlapsOwnMarker`),p(Dw,`anchorLabelsToPolyline`),vT=1e-6,yT=4,iRe=3,p(Ow,`pairKey`),p(uLe,`straightenCollinearSiblingDetours`),p(kw,`nudgeSharedInteriorSubpaths`),p(dLe,`segmentsIntersect`),p(fLe,`validateSwimlanesLayout`),p(pLe,`postProcessSwimlaneLayout`),p(Aw,`normalizeGraph`),p(jw,`incoming`),p(mLe,`buildSuccessorMap`),p(Mw,`buildSortedSuccessorMap`),p(Nw,`buildInDegreeMap`),p(Pw,`sortedZeroInDegreeNodes`),p(Fw,`buildPredecessorSuccessorMaps`),p(Iw,`buildLayersFromRanks`),p(Lw,`topoSortIfAcyclic`),p(Rw,`buildLayerIndex`),p(zw,`countInversions`),p(hLe,`removeCycles_DFS`),p(gLe,`buildTopLaneMap`),p(Bw,`createTopLaneResolver`),p(Vw,`buildTopLaneOrder`),p(Hw,`resolveTopLaneOrder`),aRe={EPSILON:1e-6},bT={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},xT={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40},p(_Le,`buildDrivingTree`),p(vLe,`chooseParent`),p(yLe,`buildAdjacency`),p(bLe,`assignComponents`),p(xLe,`computeBlocks`),p(SLe,`popBlock`),p(CLe,`computeSubtreeCrossCounts`),p(wLe,`annotateMinimumLayers`),p(Uw,`compareByRankThenId`),p(TLe,`emitNodesInTreeOrder`),p(ELe,`deduplicateLayers`),p(DLe,`createChildOrderer`),p(Ww,`buildMultitreeLayerOrder`),p(OLe,`countCrossingsBetweenAdjacent`),p(Gw,`totalCrossings`),p(kLe,`optimizeRanksByCrossings`),p(ALe,`adjustCrossLaneSources`),p(jLe,`assignLayers_LongestPath`),p(MLe,`assignLayers_Gravity`),p(NLe,`topoSortByGenerationIfAcyclic`),p(PLe,`assignLayers_LaneAwareCompact`),p(FLe,`makeProperLayering`),p(Kw,`median`),p(qw,`barycenter`),p(ILe,`neighborPositionsFor`),p(LLe,`currentOrderTieBreak`),p(Jw,`countCrossingsBetweenAdjacent`),p(Yw,`sortByHeuristic`),p(Xw,`reorderLayer`),p(Zw,`transposeImprove`),p(RLe,`orderLayers`),p(zLe,`assignCoordinates`),ST=8,p(BLe,`hashString`),p(VLe,`mulberry32`),p(HLe,`deterministicShuffle`),p(ULe,`sourceDistance`),p(Qw,`laneArrangementCost`),p(WLe,`buildWeightedLaneEdges`),p($w,`greedySwitch`),p(GLe,`isBetterCandidate`),p(KLe,`seedForRestart`),p(qLe,`optimizeTopLaneOrder`),p(JLe,`sugiyamaLayout`),CT=aRe.EPSILON,oRe=8,wT=15,TT=15,ET=25,DT=20,OT=10,p(eT,`chooseOrthogonalSide`),p(tT,`sharedLineEndpointCoord`),p(nT,`pointOnLine`),p(YLe,`routeEdgesOrthogonal`),p(XLe,`getSwimlaneDirection`),p(ZLe,`runSwimlaneLayoutCore`),p(QLe,`prepareSwimlaneLayout`),sRe=kS({prepareLayout:QLe,runLayoutCore:ZLe,afterPaint:jIe})}));function kT(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function lRe(e){if(Array.isArray(e))return e}function uRe(e){if(Array.isArray(e))return kT(e)}function AT(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function dRe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,vRe(r.key),r)}}function jT(e,t,n){return t&&dRe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function MT(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=IT(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|