@testver/testver 1.4.2 → 1.5.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/LICENSE +88 -69
- package/README.md +6 -2
- package/bin/testver.js +9 -1
- package/dist/index.js +52650 -35771
- package/package.json +179 -178
- package/src/ui/static/agents/antigravity.svg +76 -0
- package/src/ui/static/agents/codex.svg +3 -0
- package/src/ui/static/agents/gemini.svg +1 -0
- package/src/ui/static/agents/opencode.svg +4 -0
- package/src/ui/static/agents/vscode.svg +17 -0
- package/src/ui/static/assets/AIPanel-RWO8Cd9w.js +32 -0
- package/src/ui/static/assets/AIRecordPanel-DnreS585.js +40 -0
- package/src/ui/static/assets/AIStreamUI-C1gHJtlF.js +9 -0
- package/src/ui/static/assets/{AITestGenPage-D3t2gPAA.js → AITestGenPage-C8bWUelu.js} +5 -5
- package/src/ui/static/assets/APITestingPage-DwL67hqL.js +19 -0
- package/src/ui/static/assets/AboutPage-CynLB95E.js +1 -0
- package/src/ui/static/assets/AccessTokensTab-BdevOmpE.js +1 -0
- package/src/ui/static/assets/AdvancedPage-BeM7aB8b.js +3 -0
- package/src/ui/static/assets/{AnalyticsPage-64mYNK2v.js → AnalyticsPage-C5ddYfRk.js} +1 -1
- package/src/ui/static/assets/AuditLogPage-DYcUdJoj.js +1 -0
- package/src/ui/static/assets/ChangesSummary-BjNMwGIZ.js +3 -0
- package/src/ui/static/assets/{CodeMapPage-B1ezmnlE.js → CodeMapPage-BQOEtv-R.js} +3 -3
- package/src/ui/static/assets/{ConfirmDialog-t7mpeeSN.js → ConfirmDialog-D_N9188T.js} +1 -1
- package/src/ui/static/assets/{CoveragePage-YMmCbiBk.js → CoveragePage-8bDSphY1.js} +2 -2
- package/src/ui/static/assets/{CronBuilder-Nk-K-_8I.js → CronBuilder-C7_JADb7.js} +1 -1
- package/src/ui/static/assets/{Dashboard-BDVxO2V4.js → Dashboard-B22yRPyV.js} +1 -1
- package/src/ui/static/assets/{DefectsPage-l8yGeCyR.js → DefectsPage-Arv4Ac-b.js} +72 -72
- package/src/ui/static/assets/{EmptyState-D1T3JWUr.js → EmptyState-BShNSbLf.js} +1 -1
- package/src/ui/static/assets/{ExportButton-Dt5RhL-h.js → ExportButton-xrS_AnfS.js} +1 -1
- package/src/ui/static/assets/{FileViewer-CrKgh_cB.js → FileViewer-Bcr9T1jW.js} +18 -18
- package/src/ui/static/assets/{GitPage-_4nCEzkJ.js → GitPage-DXL2Sv40.js} +12 -12
- package/src/ui/static/assets/{ImportExportPage-BcR7IQi9.js → ImportExportPage-BcjzRd7T.js} +36 -36
- package/src/ui/static/assets/{JiraPushDialog-C2sP4_4h.js → JiraPushDialog-DNYU9Ce0.js} +1 -1
- package/src/ui/static/assets/{KpiTile-inmeEsy3.js → KpiTile-BKlWqjgN.js} +1 -1
- package/src/ui/static/assets/{LiveExecutionView-D5BRe9jq.js → LiveExecutionView-1LlyEDEe.js} +1 -1
- package/src/ui/static/assets/{ManagePage-B8iG6Q0B.js → ManagePage-SvRQ6L19.js} +1 -1
- package/src/ui/static/assets/{MediaModal-C5n6sHYi.js → MediaModal-Dyy_iHl9.js} +1 -1
- package/src/ui/static/assets/MobileRunPicker-Cf5rm469.js +1 -0
- package/src/ui/static/assets/MobileRunTarget-C4M4YJJh.js +6 -0
- package/src/ui/static/assets/{ModuleExplorer-VGcmK167.js → ModuleExplorer-BKVbxFZK.js} +1 -1
- package/src/ui/static/assets/{OutputPage-B_1nPPxE.js → OutputPage-Bi-28tJi.js} +1 -1
- package/src/ui/static/assets/PipelinesPanel-BtO3iSJ4.js +1 -0
- package/src/ui/static/assets/{ProfilePage-y7tJNNFd.js → ProfilePage-BgZ4VDC-.js} +1 -1
- package/src/ui/static/assets/{ProjectExplorer-DbfGhRq0.js → ProjectExplorer-BVGbmVP7.js} +1 -1
- package/src/ui/static/assets/{RemoteFileStrip-WuRKtx_h.js → RemoteFileStrip-dzPInzgb.js} +1 -1
- package/src/ui/static/assets/{ReportCard-G52Q6-2i.js → ReportCard-LOf1PXlb.js} +2 -2
- package/src/ui/static/assets/{ReportFullView-Bt8UFP2J.js → ReportFullView-Ce4OI8lf.js} +1 -1
- package/src/ui/static/assets/{ReportsPage-DMtDi73Q.js → ReportsPage-DFxCQ8cY.js} +48 -48
- package/src/ui/static/assets/{ResultsPage-BI9jpK2N.js → ResultsPage-DD-uj8gk.js} +115 -115
- package/src/ui/static/assets/{RunState-ifC4zi6M.js → RunState-DDwFB4tA.js} +1 -1
- package/src/ui/static/assets/{RunTargets-C7vpCbck.js → RunTargets-CkIpY3v3.js} +1 -1
- package/src/ui/static/assets/ScriptMappingPage-DQQoR6sR.js +1 -0
- package/src/ui/static/assets/{SearchableDevicePicker-BYxYJNWl.js → SearchableDevicePicker-CenIxD7b.js} +1 -1
- package/src/ui/static/assets/{SettingsPage-DSISg7r7.js → SettingsPage-DAV_0y0m.js} +83 -83
- package/src/ui/static/assets/{SharedReportView-BOqKGJmR.js → SharedReportView-CqSLFKT1.js} +1 -1
- package/src/ui/static/assets/{SourcesPage-CgqtYGBi.js → SourcesPage-BvqC9oKw.js} +14 -14
- package/src/ui/static/assets/TestExplorerPage-Bdnll77k.js +7 -0
- package/src/ui/static/assets/{TestManagementPage-wqYTKP7W.js → TestManagementPage-CCNE688A.js} +10 -10
- package/src/ui/static/assets/{TestPlansPage-DOKX9p6z.js → TestPlansPage-T6D25i6-.js} +5 -5
- package/src/ui/static/assets/{TestverCreditsDetail-cSW0SpNx.js → TestverCreditsDetail-BKpt4oLW.js} +1 -1
- package/src/ui/static/assets/{TestverCreditsRing-DpMzl3h7.js → TestverCreditsRing-CoDk5eAS.js} +1 -1
- package/src/ui/static/assets/TestverMcpPage-Dte0qSXp.js +34 -0
- package/src/ui/static/assets/{UncommittedDiffViewer-BxS0zi-p.js → UncommittedDiffViewer-BNroxCoo.js} +2 -2
- package/src/ui/static/assets/{UserManagementPage-B5d0uDU_.js → UserManagementPage-BU4MuDJZ.js} +10 -10
- package/src/ui/static/assets/{WorkflowsPage-Bk0DFnFS.js → WorkflowsPage-BP5k7AqE.js} +83 -83
- package/src/ui/static/assets/clipboard-BIEd7Ccc.js +1 -0
- package/src/ui/static/assets/{hiddenLlmProviders-CdhhNa5G.js → hiddenLlmProviders-BPORgy-e.js} +1 -1
- package/src/ui/static/assets/index-BlA8ntjb.js +47 -0
- package/src/ui/static/assets/index-Co4_SlGD.css +1 -0
- package/src/ui/static/assets/{index-DpQhqcHv.js → index-DLmlY2Ol.js} +1 -1
- package/src/ui/static/assets/{reportMeta-AKcU_qwq.js → reportMeta-B9ZRW6ts.js} +1 -1
- package/src/ui/static/assets/runSelected-BoPm1sz-.js +1 -0
- package/src/ui/static/assets/{useChartTheme-BFz2QcND.js → useChartTheme-CTIe6M63.js} +1 -1
- package/src/ui/static/assets/{useDebouncedValue-BsHptIvX.js → useDebouncedValue-C9odz7b2.js} +1 -1
- package/src/ui/static/assets/{useFeatureFlags-DNkIctil.js → useFeatureFlags-B4Otsv-N.js} +1 -1
- package/src/ui/static/assets/{useJiraConnector-D5ysBBvz.js → useJiraConnector--JZhbYrT.js} +1 -1
- package/src/ui/static/assets/{useOwnership-U0AfKBRo.js → useOwnership-BhPOiYzy.js} +1 -1
- package/src/ui/static/assets/useSuites-GN_K2mHc.js +1 -0
- package/src/ui/static/assets/{useTabParam-ChbOedP1.js → useTabParam-CyYAP90W.js} +1 -1
- package/src/ui/static/assets/{useTestExplorer-DT8frjCK.js → useTestExplorer-BGhkGHKy.js} +1 -1
- package/src/ui/static/assets/{useTestLifecycle-OcwQaB1s.js → useTestLifecycle-DX5ES6x8.js} +1 -1
- package/src/ui/static/assets/{useTestManagement-Xm4Bcx3u.js → useTestManagement-ommXjx0q.js} +2 -2
- package/src/ui/static/assets/useTestResults-DWjvm8gm.js +1 -0
- package/src/ui/static/assets/{vendor-charts-DWFQlmCz.js → vendor-charts-By5uZ93z.js} +1 -1
- package/src/ui/static/assets/{vendor-flow-YGpC9U9I.js → vendor-flow-B61ZV-pm.js} +1 -1
- package/src/ui/static/assets/{vendor-icons-BKPiFyYV.js → vendor-icons-Cm92aSc5.js} +1426 -1421
- package/src/ui/static/assets/vendor-query-DkZSMtfn.js +1 -0
- package/src/ui/static/assets/{vendor-quill-W-RoQfb6.js → vendor-quill-xJF2Jvjc.js} +1 -1
- package/src/ui/static/assets/{vendor-react-CTbHBddL.js → vendor-react-DOVfxdUy.js} +1 -1
- package/src/ui/static/index.html +479 -479
- package/src/ui/static/assets/AIPanel-B_R-CbrF.js +0 -32
- package/src/ui/static/assets/AIRecordPanel-BRQWIU5h.js +0 -40
- package/src/ui/static/assets/AIStreamUI-C3D989_6.js +0 -9
- package/src/ui/static/assets/APITestingPage-Cmwkiiys.js +0 -19
- package/src/ui/static/assets/AboutPage-CjEqKB-q.js +0 -1
- package/src/ui/static/assets/AdvancedPage-4kAcpE8Y.js +0 -3
- package/src/ui/static/assets/AuditLogPage-BQjOzQje.js +0 -1
- package/src/ui/static/assets/ChangesSummary-CY_Vb27i.js +0 -2
- package/src/ui/static/assets/DiffViewer-BIU09a_i.js +0 -2
- package/src/ui/static/assets/MobileRunPicker-0h-N2c6d.js +0 -1
- package/src/ui/static/assets/MobileRunTarget-Bo_xekig.js +0 -6
- package/src/ui/static/assets/PipelinesPanel-PmmPu8pj.js +0 -1
- package/src/ui/static/assets/ScriptMappingPage-7vHuvhQw.js +0 -1
- package/src/ui/static/assets/TestExplorerPage-gYLhCD4d.js +0 -7
- package/src/ui/static/assets/index-BYVxKLrT.js +0 -47
- package/src/ui/static/assets/index-C2KJt7SI.css +0 -1
- package/src/ui/static/assets/runSelected-WlgnZcSF.js +0 -1
- package/src/ui/static/assets/useSuites-DyfN9HVv.js +0 -1
- package/src/ui/static/assets/useTestResults-D5EwGIX9.js +0 -1
- package/src/ui/static/assets/vendor-query-BrzmPFT3.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Xo,g as $s,R as Ts,r as $,j as I}from"./vendor-react-CTbHBddL.js";import{i as zs,c as jn,a as Yn,b as Ds,d as Ls,e as Hs,f as ve,g as Ze}from"./vendor-charts-DWFQlmCz.js";function st(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,o;n<t.length;n++)(o=st(t[n]))!==""&&(e+=(e&&" ")+o);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var Rs={value:()=>{}};function ze(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new _e(n)}function _e(t){this._=t}function Vs(t,e){return t.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}_e.prototype=ze.prototype={constructor:_e,on:function(t,e){var n=this._,o=Vs(t+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(t=o[i]).type)&&(r=Bs(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(r=(t=o[i]).type)n[r]=Xn(n[r],t.name,e);else if(e==null)for(r in n)n[r]=Xn(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new _e(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],o=0,r=i.length;o<r;++o)i[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)}};function Bs(t,e){for(var n=0,o=t.length,r;n<o;++n)if((r=t[n]).name===e)return r.value}function Xn(t,e,n){for(var o=0,r=t.length;o<r;++o)if(t[o].name===e){t[o]=Rs,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var cn="http://www.w3.org/1999/xhtml";const Wn={svg:"http://www.w3.org/2000/svg",xhtml:cn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function De(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Wn.hasOwnProperty(e)?{space:Wn[e],local:t}:t}function Fs(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===cn&&e.documentElement.namespaceURI===cn?e.createElement(t):e.createElementNS(n,t)}}function Os(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Wo(t){var e=De(t);return(e.local?Os:Fs)(e)}function js(){}function wn(t){return t==null?js:function(){return this.querySelector(t)}}function Ys(t){typeof t!="function"&&(t=wn(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=new Array(s),c,l,d=0;d<s;++d)(c=i[d])&&(l=t.call(c,c.__data__,d,i))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new ct(o,this._parents)}function Xs(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Ws(){return[]}function Go(t){return t==null?Ws:function(){return this.querySelectorAll(t)}}function Gs(t){return function(){return Xs(t.apply(this,arguments))}}function qs(t){typeof t=="function"?t=Gs(t):t=Go(t);for(var e=this._groups,n=e.length,o=[],r=[],i=0;i<n;++i)for(var s=e[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(t.call(c,c.__data__,l,s)),r.push(c));return new ct(o,r)}function qo(t){return function(){return this.matches(t)}}function Zo(t){return function(e){return e.matches(t)}}var Zs=Array.prototype.find;function Us(t){return function(){return Zs.call(this.children,t)}}function Ks(){return this.firstElementChild}function Qs(t){return this.select(t==null?Ks:Us(typeof t=="function"?t:Zo(t)))}var Js=Array.prototype.filter;function ta(){return Array.from(this.children)}function ea(t){return function(){return Js.call(this.children,t)}}function na(t){return this.selectAll(t==null?ta:ea(typeof t=="function"?t:Zo(t)))}function oa(t){typeof t!="function"&&(t=qo(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&t.call(c,c.__data__,l,i)&&a.push(c);return new ct(o,this._parents)}function Uo(t){return new Array(t.length)}function ra(){return new ct(this._enter||this._groups.map(Uo),this._parents)}function Ce(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ce.prototype={constructor:Ce,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function ia(t){return function(){return t}}function sa(t,e,n,o,r,i){for(var s=0,a,c=e.length,l=i.length;s<l;++s)(a=e[s])?(a.__data__=i[s],o[s]=a):n[s]=new Ce(t,i[s]);for(;s<c;++s)(a=e[s])&&(r[s]=a)}function aa(t,e,n,o,r,i,s){var a,c,l=new Map,d=e.length,f=i.length,u=new Array(d),h;for(a=0;a<d;++a)(c=e[a])&&(u[a]=h=s.call(c,c.__data__,a,e)+"",l.has(h)?r[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(t,i[a],a,i)+"",(c=l.get(h))?(o[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new Ce(t,i[a]);for(a=0;a<d;++a)(c=e[a])&&l.get(u[a])===c&&(r[a]=c)}function ca(t){return t.__data__}function ua(t,e){if(!arguments.length)return Array.from(this,ca);var n=e?aa:sa,o=this._parents,r=this._groups;typeof t!="function"&&(t=ia(t));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var d=o[l],f=r[l],u=f.length,h=la(t.call(d,d&&d.__data__,l,o)),g=h.length,v=a[l]=new Array(g),x=s[l]=new Array(g),m=c[l]=new Array(u);n(d,f,v,x,m,h,e);for(var _=0,p=0,w,C;_<g;++_)if(w=v[_]){for(_>=p&&(p=_+1);!(C=x[p])&&++p<g;);w._next=C||null}}return s=new ct(s,o),s._enter=a,s._exit=c,s}function la(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function da(){return new ct(this._exit||this._groups.map(Uo),this._parents)}function fa(t,e,n){var o=this.enter(),r=this,i=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function ha(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],d=o[c],f=l.length,u=a[c]=new Array(f),h,g=0;g<f;++g)(h=l[g]||d[g])&&(u[g]=h);for(;c<r;++c)a[c]=n[c];return new ct(a,this._parents)}function ga(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function pa(t){t||(t=ma);function e(f,u){return f&&u?t(f.__data__,u.__data__):!f-!u}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,d=0;d<a;++d)(l=s[d])&&(c[d]=l);c.sort(e)}return new ct(r,this._parents).order()}function ma(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ya(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function xa(){return Array.from(this)}function wa(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function va(){let t=0;for(const e of this)++t;return t}function _a(){return!this.node()}function ba(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r=e[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&t.call(a,a.__data__,i,r);return this}function Ea(t){return function(){this.removeAttribute(t)}}function Sa(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ca(t,e){return function(){this.setAttribute(t,e)}}function Na(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Ma(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Aa(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ia(t,e){var n=De(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?Sa:Ea:typeof e=="function"?n.local?Aa:Ma:n.local?Na:Ca)(n,e))}function Ko(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ka(t){return function(){this.style.removeProperty(t)}}function Pa(t,e,n){return function(){this.style.setProperty(t,e,n)}}function $a(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function Ta(t,e,n){return arguments.length>1?this.each((e==null?ka:typeof e=="function"?$a:Pa)(t,e,n??"")):jt(this.node(),t)}function jt(t,e){return t.style.getPropertyValue(e)||Ko(t).getComputedStyle(t,null).getPropertyValue(e)}function za(t){return function(){delete this[t]}}function Da(t,e){return function(){this[t]=e}}function La(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Ha(t,e){return arguments.length>1?this.each((e==null?za:typeof e=="function"?La:Da)(t,e)):this.node()[t]}function Qo(t){return t.trim().split(/^|\s+/)}function vn(t){return t.classList||new Jo(t)}function Jo(t){this._node=t,this._names=Qo(t.getAttribute("class")||"")}Jo.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function tr(t,e){for(var n=vn(t),o=-1,r=e.length;++o<r;)n.add(e[o])}function er(t,e){for(var n=vn(t),o=-1,r=e.length;++o<r;)n.remove(e[o])}function Ra(t){return function(){tr(this,t)}}function Va(t){return function(){er(this,t)}}function Ba(t,e){return function(){(e.apply(this,arguments)?tr:er)(this,t)}}function Fa(t,e){var n=Qo(t+"");if(arguments.length<2){for(var o=vn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?Ba:e?Ra:Va)(n,e))}function Oa(){this.textContent=""}function ja(t){return function(){this.textContent=t}}function Ya(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Xa(t){return arguments.length?this.each(t==null?Oa:(typeof t=="function"?Ya:ja)(t)):this.node().textContent}function Wa(){this.innerHTML=""}function Ga(t){return function(){this.innerHTML=t}}function qa(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Za(t){return arguments.length?this.each(t==null?Wa:(typeof t=="function"?qa:Ga)(t)):this.node().innerHTML}function Ua(){this.nextSibling&&this.parentNode.appendChild(this)}function Ka(){return this.each(Ua)}function Qa(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ja(){return this.each(Qa)}function tc(t){var e=typeof t=="function"?t:Wo(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function ec(){return null}function nc(t,e){var n=typeof t=="function"?t:Wo(t),o=e==null?ec:typeof e=="function"?e:wn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function oc(){var t=this.parentNode;t&&t.removeChild(this)}function rc(){return this.each(oc)}function ic(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function sc(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ac(t){return this.select(t?sc:ic)}function cc(t){return arguments.length?this.property("__data__",t):this.node().__data__}function uc(t){return function(e){t.call(this,e,this.__data__)}}function lc(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function dc(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,r=e.length,i;n<r;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++o]=i;++o?e.length=o:delete this.__on}}}function fc(t,e,n){return function(){var o=this.__on,r,i=uc(e);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=e;return}}this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function hc(t,e,n){var o=lc(t+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(r=0,d=a[c];r<i;++r)if((s=o[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=e?fc:dc,r=0;r<i;++r)this.each(a(o[r],e,n));return this}function nr(t,e,n){var o=Ko(t),r=o.CustomEvent;typeof r=="function"?r=new r(e,n):(r=o.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function gc(t,e){return function(){return nr(this,t,e)}}function pc(t,e){return function(){return nr(this,t,e.apply(this,arguments))}}function mc(t,e){return this.each((typeof e=="function"?pc:gc)(t,e))}function*yc(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var or=[null];function ct(t,e){this._groups=t,this._parents=e}function ce(){return new ct([[document.documentElement]],or)}function xc(){return this}ct.prototype=ce.prototype={constructor:ct,select:Ys,selectAll:qs,selectChild:Qs,selectChildren:na,filter:oa,data:ua,enter:ra,exit:da,join:fa,merge:ha,selection:xc,order:ga,sort:pa,call:ya,nodes:xa,node:wa,size:va,empty:_a,each:ba,attr:Ia,style:Ta,property:Ha,classed:Fa,text:Xa,html:Za,raise:Ka,lower:Ja,append:tc,insert:nc,remove:rc,clone:ac,datum:cc,on:hc,dispatch:mc,[Symbol.iterator]:yc};function at(t){return typeof t=="string"?new ct([[document.querySelector(t)]],[document.documentElement]):new ct([[t]],or)}function wc(t){let e;for(;e=t.sourceEvent;)t=e;return t}function dt(t,e){if(t=wc(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const vc={passive:!1},ee={capture:!0,passive:!1};function Ue(t){t.stopImmediatePropagation()}function Ot(t){t.preventDefault(),t.stopImmediatePropagation()}function rr(t){var e=t.document.documentElement,n=at(t).on("dragstart.drag",Ot,ee);"onselectstart"in e?n.on("selectstart.drag",Ot,ee):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function ir(t,e){var n=t.document.documentElement,o=at(t).on("dragstart.drag",null);e&&(o.on("click.drag",Ot,ee),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const ge=t=>()=>t;function un(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}un.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function _c(t){return!t.ctrlKey&&!t.button}function bc(){return this.parentNode}function Ec(t,e){return e??{x:t.x,y:t.y}}function Sc(){return navigator.maxTouchPoints||"ontouchstart"in this}function sr(){var t=_c,e=bc,n=Ec,o=Sc,r={},i=ze("start","drag","end"),s=0,a,c,l,d,f=0;function u(w){w.on("mousedown.drag",h).filter(o).on("touchstart.drag",x).on("touchmove.drag",m,vc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,C){if(!(d||!t.call(this,w,C))){var b=p(this,e.call(this,w,C),w,C,"mouse");b&&(at(w.view).on("mousemove.drag",g,ee).on("mouseup.drag",v,ee),rr(w.view),Ue(w),l=!1,a=w.clientX,c=w.clientY,b("start",w))}}function g(w){if(Ot(w),!l){var C=w.clientX-a,b=w.clientY-c;l=C*C+b*b>f}r.mouse("drag",w)}function v(w){at(w.view).on("mousemove.drag mouseup.drag",null),ir(w.view,l),Ot(w),r.mouse("end",w)}function x(w,C){if(t.call(this,w,C)){var b=w.changedTouches,M=e.call(this,w,C),P=b.length,k,B;for(k=0;k<P;++k)(B=p(this,M,w,C,b[k].identifier,b[k]))&&(Ue(w),B("start",w,b[k]))}}function m(w){var C=w.changedTouches,b=C.length,M,P;for(M=0;M<b;++M)(P=r[C[M].identifier])&&(Ot(w),P("drag",w,C[M]))}function _(w){var C=w.changedTouches,b=C.length,M,P;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),M=0;M<b;++M)(P=r[C[M].identifier])&&(Ue(w),P("end",w,C[M]))}function p(w,C,b,M,P,k){var B=i.copy(),z=dt(k||b,C),V,R,y;if((y=n.call(w,new un("beforestart",{sourceEvent:b,target:u,identifier:P,active:s,x:z[0],y:z[1],dx:0,dy:0,dispatch:B}),M))!=null)return V=y.x-z[0]||0,R=y.y-z[1]||0,function S(E,A,T){var N=z,D;switch(E){case"start":r[P]=S,D=s++;break;case"end":delete r[P],--s;case"drag":z=dt(T||A,C),D=s;break}B.call(E,w,new un(E,{sourceEvent:A,subject:y,target:u,identifier:P,active:D,x:z[0]+V,y:z[1]+R,dx:z[0]-N[0],dy:z[1]-N[1],dispatch:B}),M)}}return u.filter=function(w){return arguments.length?(t=typeof w=="function"?w:ge(!!w),u):t},u.container=function(w){return arguments.length?(e=typeof w=="function"?w:ge(w),u):e},u.subject=function(w){return arguments.length?(n=typeof w=="function"?w:ge(w),u):n},u.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:ge(!!w),u):o},u.on=function(){var w=i.on.apply(i,arguments);return w===i?u:w},u.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,u):Math.sqrt(f)},u}var Yt=0,Qt=0,Ut=0,ar=1e3,Ne,Jt,Me=0,Lt=0,Le=0,ne=typeof performance=="object"&&performance.now?performance:Date,cr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function _n(){return Lt||(cr(Cc),Lt=ne.now()+Le)}function Cc(){Lt=0}function Ae(){this._call=this._time=this._next=null}Ae.prototype=ur.prototype={constructor:Ae,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?_n():+n)+(e==null?0:+e),!this._next&&Jt!==this&&(Jt?Jt._next=this:Ne=this,Jt=this),this._call=t,this._time=n,ln()},stop:function(){this._call&&(this._call=null,this._time=1/0,ln())}};function ur(t,e,n){var o=new Ae;return o.restart(t,e,n),o}function Nc(){_n(),++Yt;for(var t=Ne,e;t;)(e=Lt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Yt}function Gn(){Lt=(Me=ne.now())+Le,Yt=Qt=0;try{Nc()}finally{Yt=0,Ac(),Lt=0}}function Mc(){var t=ne.now(),e=t-Me;e>ar&&(Le-=e,Me=t)}function Ac(){for(var t,e=Ne,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ne=n);Jt=t,ln(o)}function ln(t){if(!Yt){Qt&&(Qt=clearTimeout(Qt));var e=t-Lt;e>24?(t<1/0&&(Qt=setTimeout(Gn,t-ne.now()-Le)),Ut&&(Ut=clearInterval(Ut))):(Ut||(Me=ne.now(),Ut=setInterval(Mc,ar)),Yt=1,cr(Gn))}}function qn(t,e,n){var o=new Ae;return e=e==null?0:+e,o.restart(r=>{o.stop(),t(r+e)},e,n),o}var Ic=ze("start","end","cancel","interrupt"),kc=[],lr=0,Zn=1,dn=2,be=3,Un=4,fn=5,Ee=6;function He(t,e,n,o,r,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Pc(t,n,{name:e,index:o,group:r,on:Ic,tween:kc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:lr})}function bn(t,e){var n=pt(t,e);if(n.state>lr)throw new Error("too late; already scheduled");return n}function wt(t,e){var n=pt(t,e);if(n.state>be)throw new Error("too late; already running");return n}function pt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Pc(t,e,n){var o=t.__transition,r;o[e]=n,n.timer=ur(i,0,n.time);function i(l){n.state=Zn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var d,f,u,h;if(n.state!==Zn)return c();for(d in o)if(h=o[d],h.name===n.name){if(h.state===be)return qn(s);h.state===Un?(h.state=Ee,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete o[d]):+d<e&&(h.state=Ee,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete o[d])}if(qn(function(){n.state===be&&(n.state=Un,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=dn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===dn){for(n.state=be,r=new Array(u=n.tween.length),d=0,f=-1;d<u;++d)(h=n.tween[d].value.call(t,t.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=fn,1),f=-1,u=r.length;++f<u;)r[f].call(t,d);n.state===fn&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Ee,n.timer.stop(),delete o[e];for(var l in o)return;delete t.__transition}}function Se(t,e){var n=t.__transition,o,r,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((o=n[s]).name!==e){i=!1;continue}r=o.state>dn&&o.state<fn,o.state=Ee,o.timer.stop(),o.on.call(r?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[s]}i&&delete t.__transition}}function $c(t){return this.each(function(){Se(this,t)})}function Tc(t,e){var n,o;return function(){var r=wt(this,t),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===e){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function zc(t,e,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=wt(this,t),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:e,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===e){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function Dc(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=pt(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===t)return s.value;return null}return this.each((e==null?Tc:zc)(n,t,e))}function En(t,e,n){var o=t._id;return t.each(function(){var r=wt(this,o);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return pt(r,o).value[e]}}function dr(t,e){var n;return(typeof e=="number"?zs:e instanceof jn?Yn:(n=jn(e))?(e=n,Yn):Ds)(t,e)}function Lc(t){return function(){this.removeAttribute(t)}}function Hc(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Rc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttribute(t);return s===r?null:s===o?i:i=e(o=s,n)}}function Vc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===r?null:s===o?i:i=e(o=s,n)}}function Bc(t,e,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a)))}}function Fc(t,e,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a)))}}function Oc(t,e){var n=De(t),o=n==="transform"?Ls:dr;return this.attrTween(t,typeof e=="function"?(n.local?Fc:Bc)(n,o,En(this,"attr."+t,e)):e==null?(n.local?Hc:Lc)(n):(n.local?Vc:Rc)(n,o,e))}function jc(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Yc(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Xc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&Yc(t,i)),n}return r._value=e,r}function Wc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&jc(t,i)),n}return r._value=e,r}function Gc(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=De(t);return this.tween(n,(o.local?Xc:Wc)(o,e))}function qc(t,e){return function(){bn(this,t).delay=+e.apply(this,arguments)}}function Zc(t,e){return e=+e,function(){bn(this,t).delay=e}}function Uc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?qc:Zc)(e,t)):pt(this.node(),e).delay}function Kc(t,e){return function(){wt(this,t).duration=+e.apply(this,arguments)}}function Qc(t,e){return e=+e,function(){wt(this,t).duration=e}}function Jc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Kc:Qc)(e,t)):pt(this.node(),e).duration}function tu(t,e){if(typeof e!="function")throw new Error;return function(){wt(this,t).ease=e}}function eu(t){var e=this._id;return arguments.length?this.each(tu(e,t)):pt(this.node(),e).ease}function nu(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;wt(this,t).ease=n}}function ou(t){if(typeof t!="function")throw new Error;return this.each(nu(this._id,t))}function ru(t){typeof t!="function"&&(t=qo(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&t.call(c,c.__data__,l,i)&&a.push(c);return new Ct(o,this._parents,this._name,this._id)}function iu(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=e[a],l=n[a],d=c.length,f=s[a]=new Array(d),u,h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;a<o;++a)s[a]=e[a];return new Ct(s,this._parents,this._name,this._id)}function su(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function au(t,e,n){var o,r,i=su(e)?bn:wt;return function(){var s=i(this,t),a=s.on;a!==o&&(r=(o=a).copy()).on(e,n),s.on=r}}function cu(t,e){var n=this._id;return arguments.length<2?pt(this.node(),n).on.on(t):this.each(au(n,t,e))}function uu(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function lu(){return this.on("end.remove",uu(this._id))}function du(t){var e=this._name,n=this._id;typeof t!="function"&&(t=wn(t));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),d,f,u=0;u<c;++u)(d=a[u])&&(f=t.call(d,d.__data__,u,a))&&("__data__"in d&&(f.__data__=d.__data__),l[u]=f,He(l[u],e,n,u,l,pt(d,n)));return new Ct(i,this._parents,e,n)}function fu(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Go(t));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,d,f=0;f<l;++f)if(d=c[f]){for(var u=t.call(d,d.__data__,f,c),h,g=pt(d,n),v=0,x=u.length;v<x;++v)(h=u[v])&&He(h,e,n,v,u,g);i.push(u),s.push(d)}return new Ct(i,s,e,n)}var hu=ce.prototype.constructor;function gu(){return new hu(this._groups,this._parents)}function pu(t,e){var n,o,r;return function(){var i=jt(this,t),s=(this.style.removeProperty(t),jt(this,t));return i===s?null:i===n&&s===o?r:r=e(n=i,o=s)}}function fr(t){return function(){this.style.removeProperty(t)}}function mu(t,e,n){var o,r=n+"",i;return function(){var s=jt(this,t);return s===r?null:s===o?i:i=e(o=s,n)}}function yu(t,e,n){var o,r,i;return function(){var s=jt(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),jt(this,t))),s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a))}}function xu(t,e){var n,o,r,i="style."+e,s="end."+i,a;return function(){var c=wt(this,t),l=c.on,d=c.value[i]==null?a||(a=fr(e)):void 0;(l!==n||r!==d)&&(o=(n=l).copy()).on(s,r=d),c.on=o}}function wu(t,e,n){var o=(t+="")=="transform"?Hs:dr;return e==null?this.styleTween(t,pu(t,o)).on("end.style."+t,fr(t)):typeof e=="function"?this.styleTween(t,yu(t,o,En(this,"style."+t,e))).each(xu(this._id,t)):this.styleTween(t,mu(t,o,e),n).on("end.style."+t,null)}function vu(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function _u(t,e,n){var o,r;function i(){var s=e.apply(this,arguments);return s!==r&&(o=(r=s)&&vu(t,s,n)),o}return i._value=e,i}function bu(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,_u(t,e,n??""))}function Eu(t){return function(){this.textContent=t}}function Su(t){return function(){var e=t(this);this.textContent=e??""}}function Cu(t){return this.tween("text",typeof t=="function"?Su(En(this,"text",t)):Eu(t==null?"":t+""))}function Nu(t){return function(e){this.textContent=t.call(this,e)}}function Mu(t){var e,n;function o(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&Nu(r)),e}return o._value=t,o}function Au(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Mu(t))}function Iu(){for(var t=this._name,e=this._id,n=hr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var d=pt(c,e);He(c,t,n,l,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ct(o,this._parents,t,n)}function ku(){var t,e,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=wt(this,o),d=l.on;d!==t&&(e=(t=d).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),l.on=e}),r===0&&i()})}var Pu=0;function Ct(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function hr(){return++Pu}var Et=ce.prototype;Ct.prototype={constructor:Ct,select:du,selectAll:fu,selectChild:Et.selectChild,selectChildren:Et.selectChildren,filter:ru,merge:iu,selection:gu,transition:Iu,call:Et.call,nodes:Et.nodes,node:Et.node,size:Et.size,empty:Et.empty,each:Et.each,on:cu,attr:Oc,attrTween:Gc,style:wu,styleTween:bu,text:Cu,textTween:Au,remove:lu,tween:Dc,delay:Uc,duration:Jc,ease:eu,easeVarying:ou,end:ku,[Symbol.iterator]:Et[Symbol.iterator]};function $u(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Tu={time:null,delay:0,duration:250,ease:$u};function zu(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Du(t){var e,n;t instanceof Ct?(e=t._id,t=t._name):(e=hr(),(n=Tu).time=_n(),t=t==null?null:t+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&He(c,t,e,l,s,n||zu(c,e));return new Ct(o,this._parents,t,e)}ce.prototype.interrupt=$c;ce.prototype.transition=Du;const pe=t=>()=>t;function Lu(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function St(t,e,n){this.k=t,this.x=e,this.y=n}St.prototype={constructor:St,scale:function(t){return t===1?this:new St(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new St(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Re=new St(1,0,0);gr.prototype=St.prototype;function gr(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Re;return t.__zoom}function Ke(t){t.stopImmediatePropagation()}function Kt(t){t.preventDefault(),t.stopImmediatePropagation()}function Hu(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Ru(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Kn(){return this.__zoom||Re}function Vu(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Bu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fu(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function pr(){var t=Hu,e=Ru,n=Fu,o=Vu,r=Bu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=ve,l=ze("start","zoom","end"),d,f,u,h=500,g=150,v=0,x=10;function m(y){y.property("__zoom",Kn).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",z).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,S,E,A){var T=y.selection?y.selection():y;T.property("__zoom",Kn),y!==T?C(y,S,E,A):T.interrupt().each(function(){b(this,arguments).event(A).start().zoom(null,typeof S=="function"?S.apply(this,arguments):S).end()})},m.scaleBy=function(y,S,E,A){m.scaleTo(y,function(){var T=this.__zoom.k,N=typeof S=="function"?S.apply(this,arguments):S;return T*N},E,A)},m.scaleTo=function(y,S,E,A){m.transform(y,function(){var T=e.apply(this,arguments),N=this.__zoom,D=E==null?w(T):typeof E=="function"?E.apply(this,arguments):E,L=N.invert(D),F=typeof S=="function"?S.apply(this,arguments):S;return n(p(_(N,F),D,L),T,s)},E,A)},m.translateBy=function(y,S,E,A){m.transform(y,function(){return n(this.__zoom.translate(typeof S=="function"?S.apply(this,arguments):S,typeof E=="function"?E.apply(this,arguments):E),e.apply(this,arguments),s)},null,A)},m.translateTo=function(y,S,E,A,T){m.transform(y,function(){var N=e.apply(this,arguments),D=this.__zoom,L=A==null?w(N):typeof A=="function"?A.apply(this,arguments):A;return n(Re.translate(L[0],L[1]).scale(D.k).translate(typeof S=="function"?-S.apply(this,arguments):-S,typeof E=="function"?-E.apply(this,arguments):-E),N,s)},A,T)};function _(y,S){return S=Math.max(i[0],Math.min(i[1],S)),S===y.k?y:new St(S,y.x,y.y)}function p(y,S,E){var A=S[0]-E[0]*y.k,T=S[1]-E[1]*y.k;return A===y.x&&T===y.y?y:new St(y.k,A,T)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function C(y,S,E,A){y.on("start.zoom",function(){b(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(A).end()}).tween("zoom",function(){var T=this,N=arguments,D=b(T,N).event(A),L=e.apply(T,N),F=E==null?w(L):typeof E=="function"?E.apply(T,N):E,Y=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),j=T.__zoom,q=typeof S=="function"?S.apply(T,N):S,J=c(j.invert(F).concat(Y/j.k),q.invert(F).concat(Y/q.k));return function(G){if(G===1)G=q;else{var H=J(G),O=Y/H[2];G=new St(O,F[0]-H[0]*O,F[1]-H[1]*O)}D.zoom(null,G)}})}function b(y,S,E){return!E&&y.__zooming||new M(y,S)}function M(y,S){this.that=y,this.args=S,this.active=0,this.sourceEvent=null,this.extent=e.apply(y,S),this.taps=0}M.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,S){return this.mouse&&y!=="mouse"&&(this.mouse[1]=S.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=S.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=S.invert(this.touch1[0])),this.that.__zoom=S,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var S=at(this.that).datum();l.call(y,this.that,new Lu(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),S)}};function P(y,...S){if(!t.apply(this,arguments))return;var E=b(this,S).event(y),A=this.__zoom,T=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,o.apply(this,arguments)))),N=dt(y);if(E.wheel)(E.mouse[0][0]!==N[0]||E.mouse[0][1]!==N[1])&&(E.mouse[1]=A.invert(E.mouse[0]=N)),clearTimeout(E.wheel);else{if(A.k===T)return;E.mouse=[N,A.invert(N)],Se(this),E.start()}Kt(y),E.wheel=setTimeout(D,g),E.zoom("mouse",n(p(_(A,T),E.mouse[0],E.mouse[1]),E.extent,s));function D(){E.wheel=null,E.end()}}function k(y,...S){if(u||!t.apply(this,arguments))return;var E=y.currentTarget,A=b(this,S,!0).event(y),T=at(y.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",Y,!0),N=dt(y,E),D=y.clientX,L=y.clientY;rr(y.view),Ke(y),A.mouse=[N,this.__zoom.invert(N)],Se(this),A.start();function F(j){if(Kt(j),!A.moved){var q=j.clientX-D,J=j.clientY-L;A.moved=q*q+J*J>v}A.event(j).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=dt(j,E),A.mouse[1]),A.extent,s))}function Y(j){T.on("mousemove.zoom mouseup.zoom",null),ir(j.view,A.moved),Kt(j),A.event(j).end()}}function B(y,...S){if(t.apply(this,arguments)){var E=this.__zoom,A=dt(y.changedTouches?y.changedTouches[0]:y,this),T=E.invert(A),N=E.k*(y.shiftKey?.5:2),D=n(p(_(E,N),A,T),e.apply(this,S),s);Kt(y),a>0?at(this).transition().duration(a).call(C,D,A,y):at(this).call(m.transform,D,A,y)}}function z(y,...S){if(t.apply(this,arguments)){var E=y.touches,A=E.length,T=b(this,S,y.changedTouches.length===A).event(y),N,D,L,F;for(Ke(y),D=0;D<A;++D)L=E[D],F=dt(L,this),F=[F,this.__zoom.invert(F),L.identifier],T.touch0?!T.touch1&&T.touch0[2]!==F[2]&&(T.touch1=F,T.taps=0):(T.touch0=F,N=!0,T.taps=1+!!d);d&&(d=clearTimeout(d)),N&&(T.taps<2&&(f=F[0],d=setTimeout(function(){d=null},h)),Se(this),T.start())}}function V(y,...S){if(this.__zooming){var E=b(this,S).event(y),A=y.changedTouches,T=A.length,N,D,L,F;for(Kt(y),N=0;N<T;++N)D=A[N],L=dt(D,this),E.touch0&&E.touch0[2]===D.identifier?E.touch0[0]=L:E.touch1&&E.touch1[2]===D.identifier&&(E.touch1[0]=L);if(D=E.that.__zoom,E.touch1){var Y=E.touch0[0],j=E.touch0[1],q=E.touch1[0],J=E.touch1[1],G=(G=q[0]-Y[0])*G+(G=q[1]-Y[1])*G,H=(H=J[0]-j[0])*H+(H=J[1]-j[1])*H;D=_(D,Math.sqrt(G/H)),L=[(Y[0]+q[0])/2,(Y[1]+q[1])/2],F=[(j[0]+J[0])/2,(j[1]+J[1])/2]}else if(E.touch0)L=E.touch0[0],F=E.touch0[1];else return;E.zoom("touch",n(p(D,L,F),E.extent,s))}}function R(y,...S){if(this.__zooming){var E=b(this,S).event(y),A=y.changedTouches,T=A.length,N,D;for(Ke(y),u&&clearTimeout(u),u=setTimeout(function(){u=null},h),N=0;N<T;++N)D=A[N],E.touch0&&E.touch0[2]===D.identifier?delete E.touch0:E.touch1&&E.touch1[2]===D.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(D=dt(D,this),Math.hypot(f[0]-D[0],f[1]-D[1])<x)){var L=at(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:pe(+y),m):o},m.filter=function(y){return arguments.length?(t=typeof y=="function"?y:pe(!!y),m):t},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:pe(!!y),m):r},m.extent=function(y){return arguments.length?(e=typeof y=="function"?y:pe([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):e},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(v=(y=+y)*y,m):Math.sqrt(v)},m.tapDistance=function(y){return arguments.length?(x=+y,m):x},m}const gt={error001:(t="react")=>`Seems like you have not used ${t==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${t}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:o}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:t=>`Edge with id "${t}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},oe=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],mr=["Enter"," ","Escape"],yr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Xt;(function(t){t.Strict="strict",t.Loose="loose"})(Xt||(Xt={}));var Dt;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(Dt||(Dt={}));var re;(function(t){t.Partial="partial",t.Full="full"})(re||(re={}));const xr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var It;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(It||(It={}));var Ie;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Ie||(Ie={}));var W;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(W||(W={}));const Qn={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top},wr=t=>!!t&&typeof t=="object"&&"id"in t&&"source"in t&&"target"in t,Ou=t=>!!t&&typeof t=="object"&&"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Sn=t=>!!t&&typeof t=="object"&&"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),ue=(t,e=[0,0])=>{const{width:n,height:o}=mt(t),r=t.origin??e,i=n*r[0],s=o*r[1];return{x:t.position.x-i,y:t.position.y-s}},ju=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};let n=!1;const o=t.reduce((r,i)=>{const s=typeof i=="string";let a=!e.nodeLookup&&!s?i:void 0;return e.nodeLookup&&(a=s?e.nodeLookup.get(i):Sn(i)?i:e.nodeLookup.get(i.id)),a?(n=!0,Ve(r,ke(a,e.nodeOrigin))):r},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Be(o):{x:0,y:0,width:0,height:0}},le=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return t.forEach(r=>{(e.filter===void 0||e.filter(r))&&(n=Ve(n,ke(r)),o=!0)}),o?Be(n):{x:0,y:0,width:0,height:0}},Cn=(t,e,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(e.x-n)/r,c=(e.y-o)/r,l=e.width/r,d=e.height/r,f=[];for(const u of t.values()){const{measured:h,selectable:g=!0,hidden:v=!1}=u;if(s&&!g||v)continue;const x=h.width??u.width??u.initialWidth??0,m=h.height??u.height??u.initialHeight??0,{x:_,y:p}=u.internals.positionAbsolute,w=Er(a,c,l,d,_,p,x,m),C=x*m,b=i&&w>0;(!u.internals.handleBounds||b||w>=C||u.dragging)&&f.push(u)}return f},Yu=(t,e)=>{const n=new Set;return t.forEach(o=>{n.add(o.id)}),e.filter(o=>n.has(o.source)||n.has(o.target))};function Xu(t,e){const n=new Map,o=e!=null&&e.nodes?new Set(e.nodes.map(r=>r.id)):null;return t.forEach(r=>{let i;if(e!=null&&e.includeHiddenNodes){const{width:s,height:a}=mt(r);i=s>0&&a>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Wu({nodes:t,width:e,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(t.size===0)return!0;const a=Xu(t,s),c=le(a),l=Mn(c,e,n,(s==null?void 0:s.minZoom)??r,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await o.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),!0}function vr({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(t),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o;let f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",gt.error005());else{const{width:h,height:g}=mt(a);h&&g&&(f=[[c,l],[c+h,l+g]])}else a&&Rt(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const u=Rt(f)?Ht(e,f,s.measured):e;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",gt.error015())),{position:{x:u.x-c+(s.measured.width??0)*d[0],y:u.y-l+(s.measured.height??0)*d[1]},positionAbsolute:u}}async function Gu({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(t.map(u=>u.id)),s=[];for(const u of n){if(u.deletable===!1)continue;const h=i.has(u.id),g=!h&&u.parentId&&s.find(v=>v.id===u.parentId);(h||g)&&s.push(u)}const a=new Set(e.map(u=>u.id)),c=o.filter(u=>u.deletable!==!1),d=Yu(s,c);for(const u of c)a.has(u.id)&&!d.find(g=>g.id===u.id)&&d.push(u);if(!r)return{edges:d,nodes:s};const f=await r({nodes:s,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:s}:{edges:[],nodes:[]}:f}const Wt=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Ht=(t={x:0,y:0},e,n)=>({x:Wt(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:Wt(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function _r(t,e,n){const{width:o,height:r}=mt(n),{x:i,y:s}=n.internals.positionAbsolute;return Ht(t,[[i,s],[i+o,s+r]],e)}const Jn=(t,e,n)=>t<e?Wt(Math.abs(t-e),1,e)/e:t>n?-Wt(Math.abs(t-n),1,e)/e:0,Nn=(t,e,n=15,o=40)=>{const r=Jn(t.x,o,e.width-o)*n,i=Jn(t.y,o,e.height-o)*n;return[r,i]},Ve=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),hn=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Be=({x:t,y:e,x2:n,y2:o})=>({x:t,y:e,width:n-t,height:o-e}),ie=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=Sn(t)?t.internals.positionAbsolute:ue(t,e);return{x:n,y:o,width:((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},ke=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=Sn(t)?t.internals.positionAbsolute:ue(t,e);return{x:n,y:o,x2:n+(((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0),y2:o+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},br=(t,e)=>Be(Ve(hn(t),hn(e))),Er=(t,e,n,o,r,i,s,a)=>{const c=Math.max(0,Math.min(t+n,r+s)-Math.max(t,r)),l=Math.max(0,Math.min(e+o,i+a)-Math.max(e,i));return Math.ceil(c*l)},Pe=(t,e)=>Er(t.x,t.y,t.width,t.height,e.x,e.y,e.width,e.height),to=t=>ft(t.width)&&ft(t.height)&&ft(t.x)&&ft(t.y),ft=t=>!isNaN(t)&&isFinite(t),Sr=(t,e)=>(n,o)=>{},de=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),fe=({x:t,y:e},[n,o,r],i=!1,s=[1,1])=>{const a={x:(t-n)/r,y:(e-o)/r};return i?de(a,s):a},Gt=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o});function Bt(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function qu(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=Bt(t,n),r=Bt(t,e);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof t=="object"){const o=Bt(t.top??t.y??0,n),r=Bt(t.bottom??t.y??0,n),i=Bt(t.left??t.x??0,e),s=Bt(t.right??t.x??0,e);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Zu(t,e,n,o,r,i){const{x:s,y:a}=Gt(t,[e,n,o]),{x:c,y:l}=Gt({x:t.x+t.width,y:t.y+t.height},[e,n,o]),d=r-c,f=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(f)}}const Mn=(t,e,n,o,r,i)=>{const s=qu(i,e,n),a=(e-s.x)/t.width,c=(n-s.y)/t.height,l=Math.min(a,c),d=Wt(l,o,r),f=t.x+t.width/2,u=t.y+t.height/2,h=e/2-f*d,g=n/2-u*d,v=Zu(t,h,g,d,e,n),x={left:Math.min(v.left-s.left,0),top:Math.min(v.top-s.top,0),right:Math.min(v.right-s.right,0),bottom:Math.min(v.bottom-s.bottom,0)};return{x:h-x.left+x.right,y:g-x.top+x.bottom,zoom:d}},se=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Rt(t){return t!=null&&t!=="parent"}function mt(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function Cr(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function Nr(t,e={width:0,height:0},n,o,r){const i={...t},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function eo(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function Uu(){let t,e;return{promise:new Promise((o,r)=>{t=o,e=r}),resolve:t,reject:e}}function Ku(t){return{...yr,...t||{}}}function Mr(t){return t===null?null:t?"valid":"invalid"}function te(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ht(t),a=fe({x:i-((r==null?void 0:r.left)??0),y:s-((r==null?void 0:r.top)??0)},o),{x:c,y:l}=n?de(a,e):a;return{xSnapped:c,ySnapped:l,...a}}const An=t=>({width:t.offsetWidth,height:t.offsetHeight}),Ar=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Qu=["INPUT","SELECT","TEXTAREA"];function Ir(t){var o,r;const e=((r=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:r[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:Qu.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const kr=t=>"clientX"in t,ht=(t,e)=>{var i,s;const n=kr(t),o=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,r=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},no=(t,e,n,o,r)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...An(s)}})};function Pr({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=t*.125+r*.375+s*.375+n*.125,l=e*.125+i*.375+a*.375+o*.125,d=Math.abs(c-t),f=Math.abs(l-e);return[c,l,d,f]}function me(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function oo({pos:t,x1:e,y1:n,x2:o,y2:r,c:i}){switch(t){case W.Left:return[e-me(e-o,i),n];case W.Right:return[e+me(o-e,i),n];case W.Top:return[e,n-me(n-r,i)];case W.Bottom:return[e,n+me(r-n,i)]}}function $r({sourceX:t,sourceY:e,sourcePosition:n=W.Bottom,targetX:o,targetY:r,targetPosition:i=W.Top,curvature:s=.25}){const[a,c]=oo({pos:n,x1:t,y1:e,x2:o,y2:r,c:s}),[l,d]=oo({pos:i,x1:o,y1:r,x2:t,y2:e,c:s}),[f,u,h,g]=Pr({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${t},${e} C${a},${c} ${l},${d} ${o},${r}`,f,u,h,g]}function Tr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,i=n<t?n+r:n-r,s=Math.abs(o-e)/2,a=o<e?o+s:o-s;return[i,a,r,s]}function Ju({sourceNode:t,targetNode:e,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(t.parentId||r&&t.selected?t.internals.z:0,e.parentId||r&&e.selected?e.internals.z:0);return s+a}function tl({sourceNode:t,targetNode:e,width:n,height:o,transform:r}){const i=Ve(ke(t),ke(e));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Pe(s,Be(i))>0}const el=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`xy-edge__${t}${e||""}-${n}${o||""}`,nl=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),ol=(t,e,n={})=>{var i;if(!t.source||!t.target)return(i=n.onError)==null||i.call(n,"006",gt.error006()),e;const o=n.getEdgeId||el;let r;return wr(t)?r={...t}:r={...t,id:o(t)},nl(r,e)?e:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,e.concat(r))};function zr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const[r,i,s,a]=Tr({sourceX:t,sourceY:e,targetX:n,targetY:o});return[`M ${t},${e}L ${n},${o}`,r,i,s,a]}const ro={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},rl=({source:t,sourcePosition:e=W.Bottom,target:n})=>e===W.Left||e===W.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},io=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function il({source:t,sourcePosition:e=W.Bottom,target:n,targetPosition:o=W.Top,center:r,offset:i,stepPosition:s}){const a=ro[e],c=ro[o],l={x:t.x+a.x*i,y:t.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=rl({source:l,sourcePosition:e,target:d}),u=f.x!==0?"x":"y",h=f[u];let g=[],v,x;const m={x:0,y:0},_={x:0,y:0},[,,p,w]=Tr({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[u]*c[u]===-1){u==="x"?(v=r.x??l.x+(d.x-l.x)*s,x=r.y??(l.y+d.y)/2):(v=r.x??(l.x+d.x)/2,x=r.y??l.y+(d.y-l.y)*s);const P=[{x:v,y:l.y},{x:v,y:d.y}],k=[{x:l.x,y:x},{x:d.x,y:x}];a[u]===h?g=u==="x"?P:k:g=u==="x"?k:P}else{const P=[{x:l.x,y:d.y}],k=[{x:d.x,y:l.y}];if(u==="x"?g=a.x===h?k:P:g=a.y===h?P:k,e===o){const y=Math.abs(t[u]-n[u]);if(y<=i){const S=Math.min(i-1,i-y);a[u]===h?m[u]=(l[u]>t[u]?-1:1)*S:_[u]=(d[u]>n[u]?-1:1)*S}}if(e!==o){const y=u==="x"?"y":"x",S=a[u]===c[y],E=l[y]>d[y],A=l[y]<d[y];(a[u]===1&&(!S&&E||S&&A)||a[u]!==1&&(!S&&A||S&&E))&&(g=u==="x"?P:k)}const B={x:l.x+m.x,y:l.y+m.y},z={x:d.x+_.x,y:d.y+_.y},V=Math.max(Math.abs(B.x-g[0].x),Math.abs(z.x-g[0].x)),R=Math.max(Math.abs(B.y-g[0].y),Math.abs(z.y-g[0].y));V>=R?(v=(B.x+z.x)/2,x=g[0].y):(v=g[0].x,x=(B.y+z.y)/2)}const C={x:l.x+m.x,y:l.y+m.y},b={x:d.x+_.x,y:d.y+_.y};return[[t,...C.x!==g[0].x||C.y!==g[0].y?[C]:[],...g,...b.x!==g[g.length-1].x||b.y!==g[g.length-1].y?[b]:[],n],v,x,p,w]}function sl(t,e,n,o){const r=Math.min(io(t,e)/2,io(e,n)/2,o),{x:i,y:s}=e;if(t.x===i&&i===n.x||t.y===s&&s===n.y)return`L${i} ${s}`;if(t.y===s){const l=t.x<n.x?-1:1,d=t.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*d}`}const a=t.x<n.x?1:-1,c=t.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function gn({sourceX:t,sourceY:e,sourcePosition:n=W.Bottom,targetX:o,targetY:r,targetPosition:i=W.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[f,u,h,g,v]=il({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:d});let x=`M${f[0].x} ${f[0].y}`;for(let m=1;m<f.length-1;m++)x+=sl(f[m-1],f[m],f[m+1],s);return x+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[x,u,h,g,v]}function so(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function al(t){var f;const{sourceNode:e,targetNode:n}=t;if(!so(e)||!so(n))return null;const o=e.internals.handleBounds||ao(e.handles),r=n.internals.handleBounds||ao(n.handles),i=co((o==null?void 0:o.source)??[],t.sourceHandle),s=co(t.connectionMode===Xt.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),t.targetHandle);if(!i||!s)return(f=t.onError)==null||f.call(t,"008",gt.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(i==null?void 0:i.position)||W.Bottom,c=(s==null?void 0:s.position)||W.Top,l=Vt(e,i,a),d=Vt(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function ao(t){if(!t)return null;const e=[],n=[];for(const o of t)o.width=o.width??1,o.height=o.height??1,o.type==="source"?e.push(o):o.type==="target"&&n.push(o);return{source:e,target:n}}function Vt(t,e,n=W.Left,o=!1){const r=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:s,height:a}=e??mt(t);if(o)return{x:r+s/2,y:i+a/2};switch((e==null?void 0:e.position)??n){case W.Top:return{x:r+s/2,y:i};case W.Right:return{x:r+s,y:i+a/2};case W.Bottom:return{x:r+s/2,y:i+a};case W.Left:return{x:r,y:i+a/2}}}function co(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function pn(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`:""}function cl(t,{id:e,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return t.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const l=pn(c,e);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Dr=1e3,ul=10,In={nodeOrigin:[0,0],nodeExtent:oe,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ll={...In,checkEquality:!0};function kn(t,e){const n={...t};for(const o in e)e[o]!==void 0&&(n[o]=e[o]);return n}function dl(t,e,n){const o=kn(In,n);for(const r of t.values())if(r.parentId)$n(r,t,e,o);else{const i=ue(r,o.nodeOrigin),s=Rt(r.extent)?r.extent:o.nodeExtent,a=Ht(i,s,mt(r));r.internals.positionAbsolute=a}}function fl(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],o=[];for(const r of t.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:t.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Pn(t){return t==="manual"}function mn(t,e,n,o={}){var d,f;const r=kn(ll,o),i={i:0},s=new Map(e),a=r!=null&&r.elevateNodesOnSelect&&!Pn(r.zIndexMode)?Dr:0;let c=t.length>0,l=!1;e.clear(),n.clear();for(const u of t){let h=s.get(u.id);if(r.checkEquality&&u===(h==null?void 0:h.internals.userNode))e.set(u.id,h);else{const g=ue(u,r.nodeOrigin),v=Rt(u.extent)?u.extent:r.nodeExtent,x=Ht(g,v,mt(u));h={...r.defaults,...u,measured:{width:(d=u.measured)==null?void 0:d.width,height:(f=u.measured)==null?void 0:f.height},internals:{positionAbsolute:x,handleBounds:fl(u,h),z:Lr(u,a,r.zIndexMode),userNode:u}},e.set(u.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),u.parentId&&$n(h,e,n,o,i),l||(l=u.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function hl(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function $n(t,e,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=kn(In,o),l=t.parentId,d=e.get(l);if(!d){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}hl(t,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*ul),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const f=i&&!Pn(c)?Dr:0,{x:u,y:h,z:g}=gl(t,d,s,a,f,c),{positionAbsolute:v}=t.internals,x=u!==v.x||h!==v.y;(x||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:x?{x:u,y:h}:v,z:g}})}function Lr(t,e,n){const o=ft(t.zIndex)?t.zIndex:0;return Pn(n)?o:o+(t.selected?e:0)}function gl(t,e,n,o,r,i){const{x:s,y:a}=e.internals.positionAbsolute,c=mt(t),l=ue(t,n),d=Rt(t.extent)?Ht(l,t.extent,c):l;let f=Ht({x:s+d.x,y:a+d.y},o,c);t.extent==="parent"&&(f=_r(f,c,e));const u=Lr(t,r,i),h=e.internals.z??0;return{x:f.x,y:f.y,z:h>=u?h+1:u}}function Tn(t,e,n,o=[0,0]){var s;const r=[],i=new Map;for(const a of t){const c=e.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??ie(c),d=br(l,a.rect);i.set(a.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var p;const d=c.internals.positionAbsolute,f=mt(c),u=c.origin??o,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,v=Math.max(f.width,Math.round(a.width)),x=Math.max(f.height,Math.round(a.height)),m=(v-f.width)*u[0],_=(x-f.height)*u[1];(h>0||g>0||m||_)&&(r.push({id:l,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+_}}),(p=n.get(l))==null||p.forEach(w=>{t.some(C=>C.id===w.id)||r.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+g}})})),(f.width<a.width||f.height<a.height||h||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:v+(h?u[0]*h-m:0),height:x+(g?u[1]*g-_:0)}})}),r}function pl(t,e,n,o,r,i,s){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],d=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(d.transform),u=[];for(const h of t.values()){const g=e.get(h.id);if(!g)continue;if(g.hidden){e.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const v=An(h.nodeElement),x=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(x||!g.internals.handleBounds||h.force))){const _=h.nodeElement.getBoundingClientRect(),p=Rt(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;if(g.parentId&&g.extent==="parent"){const b=e.get(g.parentId);b&&(w=_r(w,v,b))}else p&&(w=Ht(w,p,v));const C={...g,measured:v,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:no("source",h.nodeElement,_,f,g.id),target:no("target",h.nodeElement,_,f,g.id)}}};e.set(g.id,C),g.parentId&&$n(C,e,n,{nodeOrigin:r,zIndexMode:s}),c=!0,x&&(l.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&u.push({id:g.id,parentId:g.parentId,rect:ie(C,r)}))}}if(u.length>0){const h=Tn(u,e,n,r);l.push(...h)}return{changes:l,updatedInternals:c}}async function ml({delta:t,panZoom:e,transform:n,translateExtent:o,width:r,height:i}){if(!e||!t.x&&!t.y)return!1;const s=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function uo(t,e,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,e)),s=`${r}-${t}`;const c=o.get(s)||new Map;if(o.set(s,c.set(n,e)),i){s=`${r}-${t}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,e))}}function Hr(t,e,n){t.clear(),e.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,d=`${i}-${a}--${r}-${s}`;uo("source",c,d,t,r,s),uo("target",c,l,t,i,a),e.set(o.id,o)}}function Rr(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:Rr(n,e):!1}function lo(t,e,n){var r;let o=t;do{if((r=o==null?void 0:o.matches)!=null&&r.call(o,e))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function yl(t,e,n,o){const r=new Map;for(const[i,s]of t)if((s.selected||s.id===o)&&(!s.parentId||!Rr(s,t))&&(s.draggable||e&&typeof s.draggable>"u")){const a=t.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Qe({nodeId:t,dragItems:e,nodeLookup:n,dragging:o=!0}){var s,a,c;const r=[];for(const[l,d]of e){const f=(s=n.get(l))==null?void 0:s.internals.userNode;f&&r.push({...f,position:d.position,dragging:o})}if(!t)return[r[0],r];const i=(a=n.get(t))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=e.get(t))==null?void 0:c.position)||i.position,dragging:o}:r[0],r]}function xl({dragItems:t,snapGrid:e,x:n,y:o}){const r=t.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=de(i,e);return{x:s.x-i.x,y:s.y-i.y}}function wl({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},d=null,f=!1,u=null,h=!1,g=!1,v=null;function x({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:C,nodeId:b,nodeClickDistance:M=0}){u=at(w);function P({x:V,y:R}){const{nodeLookup:y,nodeExtent:S,snapGrid:E,snapToGrid:A,nodeOrigin:T,onNodeDrag:N,onSelectionDrag:D,onError:L,updateNodePositions:F}=e();i={x:V,y:R};let Y=!1;const j=a.size>1,q=j&&S?hn(le(a)):null,J=j&&A?xl({dragItems:a,snapGrid:E,x:V,y:R}):null;for(const[G,H]of a){if(!y.has(G))continue;let O={x:V-H.distance.x,y:R-H.distance.y};A&&(O=J?{x:Math.round(O.x+J.x),y:Math.round(O.y+J.y)}:de(O,E));let Z=null;if(j&&S&&!H.extent&&q){const{positionAbsolute:K}=H.internals,Q=K.x-q.x+S[0][0],tt=K.x+H.measured.width-q.x2+S[1][0],et=K.y-q.y+S[0][1],ot=K.y+H.measured.height-q.y2+S[1][1];Z=[[Q,et],[tt,ot]]}const{position:U,positionAbsolute:X}=vr({nodeId:G,nextPosition:O,nodeLookup:y,nodeExtent:Z||S,nodeOrigin:T,onError:L});Y=Y||H.position.x!==U.x||H.position.y!==U.y,H.position=U,H.internals.positionAbsolute=X}if(g=g||Y,!!Y&&(F(a,!0),v&&(o||N||!b&&D))){const[G,H]=Qe({nodeId:b,dragItems:a,nodeLookup:y});o==null||o(v,a,G,H),N==null||N(v,G,H),b||D==null||D(v,H)}}async function k(){if(!d)return;const{transform:V,panBy:R,autoPanSpeed:y,autoPanOnNodeDrag:S}=e();if(!S){c=!1,cancelAnimationFrame(s);return}const[E,A]=Nn(l,d,y);(E!==0||A!==0)&&(i.x=(i.x??0)-E/V[2],i.y=(i.y??0)-A/V[2],await R({x:E,y:A})&&P(i)),s=requestAnimationFrame(k)}function B(V){var j;const{nodeLookup:R,multiSelectionActive:y,nodesDraggable:S,transform:E,snapGrid:A,snapToGrid:T,selectNodesOnDrag:N,onNodeDragStart:D,onSelectionDragStart:L,unselectNodesAndEdges:F}=e();f=!0,(!N||!C)&&!y&&b&&((j=R.get(b))!=null&&j.selected||F()),C&&N&&b&&(t==null||t(b));const Y=te(V.sourceEvent,{transform:E,snapGrid:A,snapToGrid:T,containerBounds:d});if(i=Y,a=yl(R,S,Y,b),a.size>0&&(n||D||!b&&L)){const[q,J]=Qe({nodeId:b,dragItems:a,nodeLookup:R});n==null||n(V.sourceEvent,a,q,J),D==null||D(V.sourceEvent,q,J),b||L==null||L(V.sourceEvent,J)}}const z=sr().clickDistance(M).on("start",V=>{const{domNode:R,nodeDragThreshold:y,transform:S,snapGrid:E,snapToGrid:A}=e();d=(R==null?void 0:R.getBoundingClientRect())||null,h=!1,g=!1,v=V.sourceEvent,y===0&&B(V),i=te(V.sourceEvent,{transform:S,snapGrid:E,snapToGrid:A,containerBounds:d}),l=ht(V.sourceEvent,d)}).on("drag",V=>{const{autoPanOnNodeDrag:R,transform:y,snapGrid:S,snapToGrid:E,nodeDragThreshold:A,nodeLookup:T}=e(),N=te(V.sourceEvent,{transform:y,snapGrid:S,snapToGrid:E,containerBounds:d});if(v=V.sourceEvent,(V.sourceEvent.type==="touchmove"&&V.sourceEvent.touches.length>1||b&&!T.has(b))&&(h=!0),!h){if(!c&&R&&f&&(c=!0,k()),!f){const D=ht(V.sourceEvent,d),L=D.x-l.x,F=D.y-l.y;Math.sqrt(L*L+F*F)>A&&B(V)}(i.x!==N.xSnapped||i.y!==N.ySnapped)&&a&&f&&(l=ht(V.sourceEvent,d),P(N))}}).on("end",V=>{if(!f||h){h&&a.size>0&&e().updateNodePositions(a,!1);return}if(c=!1,f=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:R,updateNodePositions:y,onNodeDragStop:S,onSelectionDragStop:E}=e();if(g&&(y(a,!1),g=!1),r||S||!b&&E){const[A,T]=Qe({nodeId:b,dragItems:a,nodeLookup:R,dragging:!1});r==null||r(V.sourceEvent,a,A,T),S==null||S(V.sourceEvent,A,T),b||E==null||E(V.sourceEvent,T)}}}).filter(V=>{const R=V.target;return!V.button&&(!_||!lo(R,`.${_}`,w))&&(!p||lo(R,p,w))});u.call(z)}function m(){u==null||u.on(".drag",null)}return{update:x,destroy:m}}function vl(t,e,n){const o=[],r={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())Pe(r,ie(i))>0&&o.push(i);return o}const _l=250;function bl(t,e,n,o){var a,c;let r=[],i=1/0;const s=vl(t,n,e+_l);for(const l of s){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(o.nodeId===f.nodeId&&o.type===f.type&&o.id===f.id)continue;const{x:u,y:h}=Vt(l,f,f.position,!0),g=Math.sqrt(Math.pow(u-t.x,2)+Math.pow(h-t.y,2));g>e||(g<i?(r=[{...f,x:u,y:h}],i=g):g===i&&r.push({...f,x:u,y:h}))}}if(!r.length)return null;if(r.length>1){const l=o.type==="source"?"target":"source";return r.find(d=>d.type===l)??r[0]}return r[0]}function Vr(t,e,n,o,r,i=!1){var l,d,f;const s=o.get(t);if(!s)return null;const a=r==="strict"?(l=s.internals.handleBounds)==null?void 0:l[e]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((f=s.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?a==null?void 0:a.find(u=>u.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Vt(s,c,c.position,!0)}:c}function Br(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function El(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const Fr=()=>!0;function Sl(t,{connectionMode:e,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:f,panBy:u,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:x,isValidConnection:m=Fr,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:C,autoPanSpeed:b,dragThreshold:M=1,handleDomNode:P}){const k=Ar(t.target);let B=0,z;const{x:V,y:R}=ht(t),y=Br(i,P),S=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!S||!y)return;const A=Vr(r,y,o,c,e);if(!A)return;let T=ht(t,S),N=!1,D=null,L=!1,F=null;function Y(){if(!d||!S)return;const[U,X]=Nn(T,S,b);u({x:U,y:X}),B=requestAnimationFrame(Y)}const j={...A,nodeId:r,type:y,position:A.position},q=c.get(r);let G={inProgress:!0,isValid:null,from:Vt(q,j,W.Left,!0),fromHandle:j,fromPosition:j.position,fromNode:q,to:T,toHandle:null,toPosition:Qn[j.position],toNode:null,pointer:T};function H(){E=!0,p(G),g==null||g(t,{nodeId:r,handleId:o,handleType:y})}M===0&&H();function O(U){if(!E){const{x:ot,y:ut}=ht(U),yt=ot-V,xt=ut-R;if(!(yt*yt+xt*xt>M*M))return;H()}if(!C()||!j){Z(U);return}const X=w();T=ht(U,S),z=bl(fe(T,X,!1,[1,1]),n,c,j),N||(Y(),N=!0);const K=Or(U,{handle:z,connectionMode:e,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:k,lib:l,flowId:f,nodeLookup:c});F=K.handleDomNode,D=K.connection,L=El(!!z,K.isValid);const Q=c.get(r),tt=Q?Vt(Q,j,W.Left,!0):G.from,et={...G,from:tt,isValid:L,to:K.toHandle&&L?Gt({x:K.toHandle.x,y:K.toHandle.y},X):T,toHandle:K.toHandle,toPosition:L&&K.toHandle?K.toHandle.position:Qn[j.position],toNode:K.toHandle?c.get(K.toHandle.nodeId):null,pointer:T};p(et),G=et}function Z(U){if(!("touches"in U&&U.touches.length>0)){if(E){(z||F)&&D&&L&&(v==null||v(D));const{inProgress:X,...K}=G,Q={...K,toPosition:G.toHandle?G.toPosition:null};x==null||x(U,Q),i&&(_==null||_(U,Q))}h(),cancelAnimationFrame(B),N=!1,L=!1,D=null,F=null,k.removeEventListener("mousemove",O),k.removeEventListener("mouseup",Z),k.removeEventListener("touchmove",O),k.removeEventListener("touchend",Z)}}k.addEventListener("mousemove",O),k.addEventListener("mouseup",Z),k.addEventListener("touchmove",O),k.addEventListener("touchend",Z)}function Or(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=Fr,nodeLookup:d}){const f=i==="target",u=e?s.querySelector(`.${a}-flow__handle[data-id="${c}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:h,y:g}=ht(t),v=s.elementFromPoint(h,g),x=v!=null&&v.classList.contains(`${a}-flow__handle`)?v:u,m={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const _=Br(void 0,x),p=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),C=x.classList.contains("connectable"),b=x.classList.contains("connectableend");if(!p||!_)return m;const M={source:f?p:o,sourceHandle:f?w:r,target:f?o:p,targetHandle:f?r:w};m.connection=M;const k=C&&b&&(n===Xt.Strict?f&&_==="source"||!f&&_==="target":p!==o||w!==r);m.isValid=k&&l(M),m.toHandle=Vr(p,_,w,d,n,!0)}return m}const yn={onPointerDown:Sl,isValid:Or};function Cl({domNode:t,panZoom:e,getTransform:n,getViewScale:o}){const r=at(t);function i({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:f=!0,zoomable:u=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!e)return;const w=n(),C=p.sourceEvent.ctrlKey&&se()?10:1,b=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*d,M=w[2]*Math.pow(2,b*C);e.scaleTo(M)};let v=[0,0];const x=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(v=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!e)return;const C=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],b=[C[0]-v[0],C[1]-v[1]];v=C;const M=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),P={x:w[0]-b[0]*M,y:w[1]-b[1]*M},k=[[0,0],[c,l]];e.setViewportConstrained({x:P.x,y:P.y,zoom:w[2]},k,a)},_=pr().on("start",x).on("zoom",f?m:null).on("zoom.wheel",u?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:dt}}const Fe=t=>({x:t.x,y:t.y,zoom:t.k}),Je=({x:t,y:e,zoom:n})=>Re.translate(t,e).scale(n),At=(t,e)=>t.target.closest(`.${e}`),jr=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Nl=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,tn=(t,e=0,n=Nl,o=()=>{})=>{const r=typeof e=="number"&&e>0;return r||o(),r?t.transition().duration(e).ease(n).on("end",o):t},Yr=t=>{const e=t.ctrlKey&&se()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function Ml({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(At(d,e))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&s){const x=dt(d),m=Yr(d),_=f*Math.pow(2,m);o.scaleTo(n,_,x,d);return}const u=d.deltaMode===1?20:1;let h=r===Dt.Vertical?0:d.deltaX*u,g=r===Dt.Horizontal?0:d.deltaY*u;!se()&&d.shiftKey&&r!==Dt.Vertical&&(h=d.deltaY*u,g=0),o.translateBy(n,-(h/f)*i,-(g/f)*i,{internal:!0});const v=Fe(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?c==null||c(d,v):(t.isPanScrolling=!0,a==null||a(d,v)),t.panScrollTimeout=setTimeout(()=>{l==null||l(d,v),t.isPanScrolling=!1},150)}}function Al({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!e&&i&&!o.ctrlKey,a=At(o,t);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Il({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return o=>{var i,s,a;if((i=o.sourceEvent)!=null&&i.internal)return;const r=Fe(o.transform);t.mouseButton=((s=o.sourceEvent)==null?void 0:s.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=r,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),n&&(n==null||n(o.sourceEvent,r))}}function kl({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{var s,a;t.usedRightMouseButton=!!(n&&jr(e,t.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!((a=i.sourceEvent)!=null&&a.internal)&&(r==null||r(i.sourceEvent,Fe(i.transform)))}}function Pl({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,i&&jr(e,t.mouseButton??0)&&!t.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),t.usedRightMouseButton=!1,o(!1),r)){const c=Fe(s.transform);t.prevViewport=c,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{r==null||r(s.sourceEvent,c)},n?150:0)}}}function $l({panActivationKeyPressed:t,zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:l,lib:d,connectionInProgress:f}){return u=>{var m;const h=e||n,g=o&&u.ctrlKey,v=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(At(u,`${d}-flow__node`)||At(u,`${d}-flow__edge`)||At(u,`${d}-flow__selection`)||At(u,`${d}-flow__nodesselection`)))return!0;if(!r&&!h&&!i&&!s&&!o||a||f&&!v||At(u,c)&&v||At(u,l)&&(!v||i&&v&&!e)||!o&&u.ctrlKey&&v)return!1;if(!o&&u.type==="touchstart"&&((m=u.touches)==null?void 0:m.length)>1)return u.preventDefault(),!1;if(!h&&!i&&!g&&v||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||v||t)&&x}}function Tl({domNode:t,minZoom:e,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=t.getBoundingClientRect();let f=[[0,0],[d.width,d.height]];const u=typeof ResizeObserver<"u"?new ResizeObserver(R=>{const y=R[0];y&&(f=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null;u==null||u.observe(t);const h=pr().extent(()=>f).scaleExtent([e,n]).translateExtent(o),g=at(t).call(h);w({x:r.x,y:r.y,zoom:Wt(r.zoom,e,n)},[[0,0],[d.width,d.height]],o);const v=g.on("wheel.zoom"),x=g.on("dblclick.zoom");h.wheelDelta(Yr);async function m(R,y){return g?new Promise(S=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?Ze:ve).transform(tn(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>S(!0)),R)}):!1}function _({noWheelClassName:R,noPanClassName:y,onPaneContextMenu:S,userSelectionActive:E,panOnScroll:A,panOnDrag:T,panOnScrollMode:N,panOnScrollSpeed:D,preventScrolling:L,zoomOnPinch:F,zoomOnScroll:Y,zoomOnDoubleClick:j,panActivationKeyPressed:q=!1,zoomActivationKeyPressed:J,lib:G,onTransformChange:H,connectionInProgress:O,paneClickDistance:Z,selectionOnDrag:U}){E&&!l.isZoomingOrPanning&&p();const X=A&&!J&&!E;h.clickDistance(U?1/0:!ft(Z)||Z<0?0:Z);const K=X?Ml({zoomPanValues:l,noWheelClassName:R,d3Selection:g,d3Zoom:h,panOnScrollMode:N,panOnScrollSpeed:D,zoomOnPinch:F,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Al({noWheelClassName:R,preventScrolling:L,d3ZoomHandler:v});g.on("wheel.zoom",K,{passive:!1});const Q=Il({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});h.on("start",Q);const tt=kl({zoomPanValues:l,panOnDrag:T,onPaneContextMenu:!!S,onPanZoom:i,onTransformChange:H});h.on("zoom",tt);const et=Pl({zoomPanValues:l,panOnDrag:T,panOnScroll:A,onPaneContextMenu:S,onPanZoomEnd:a,onDraggingChange:c});h.on("end",et);const ot=$l({panActivationKeyPressed:q,zoomActivationKeyPressed:J,panOnDrag:T,zoomOnScroll:Y,panOnScroll:A,zoomOnDoubleClick:j,zoomOnPinch:F,userSelectionActive:E,noPanClassName:y,noWheelClassName:R,lib:G,connectionInProgress:O});h.filter(ot),j?g.on("dblclick.zoom",x):g.on("dblclick.zoom",null)}function p(){h.on("zoom",null)}async function w(R,y,S){const E=Je(R),A=h==null?void 0:h.constrain()(E,y,S);return A&&await m(A),A}async function C(R,y){const S=Je(R);return await m(S,y),S}function b(R){if(g){const y=Je(R),S=g.property("__zoom");(S.k!==R.zoom||S.x!==R.x||S.y!==R.y)&&(h==null||h.transform(g,y,null,{sync:!0}))}}function M(){const R=g?gr(g.node()):{x:0,y:0,k:1};return{x:R.x,y:R.y,zoom:R.k}}async function P(R,y){return g?new Promise(S=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?Ze:ve).scaleTo(tn(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>S(!0)),R)}):!1}async function k(R,y){return g?new Promise(S=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?Ze:ve).scaleBy(tn(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>S(!0)),R)}):!1}function B(R){h==null||h.scaleExtent(R)}function z(R){h==null||h.translateExtent(R)}function V(R){const y=!ft(R)||R<0?0:R;h==null||h.clickDistance(y)}return{update:_,destroy:p,setViewport:C,setViewportConstrained:w,getViewport:M,scaleTo:P,scaleBy:k,setScaleExtent:B,setTranslateExtent:z,syncViewport:b,setClickDistance:V}}var qt;(function(t){t.Line="line",t.Handle="handle"})(qt||(qt={}));function zl({width:t,prevWidth:e,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=t-e,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function fo(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),o=t.includes("left"),r=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:o,affectsY:r}}function Nt(t,e){return Math.max(0,e-t)}function Mt(t,e){return Math.max(0,t-e)}function ye(t,e,n){return Math.max(0,e-t,t-n)}function ho(t,e){return t?!e:e}function Dl(t,e,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=e;const{isHorizontal:d,isVertical:f}=e,u=d&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:x,minHeight:m,maxHeight:_}=o,{x:p,y:w,width:C,height:b,aspectRatio:M}=t;let P=Math.floor(d?h-t.pointerX:0),k=Math.floor(f?g-t.pointerY:0);const B=C+(c?-P:P),z=b+(l?-k:k),V=-i[0]*C,R=-i[1]*b;let y=ye(B,v,x),S=ye(z,m,_);if(s){let T=0,N=0;c&&P<0?T=Nt(p+P+V,s[0][0]):!c&&P>0&&(T=Mt(p+B+V,s[1][0])),l&&k<0?N=Nt(w+k+R,s[0][1]):!l&&k>0&&(N=Mt(w+z+R,s[1][1])),y=Math.max(y,T),S=Math.max(S,N)}if(a){let T=0,N=0;c&&P>0?T=Mt(p+P,a[0][0]):!c&&P<0&&(T=Nt(p+B,a[1][0])),l&&k>0?N=Mt(w+k,a[0][1]):!l&&k<0&&(N=Nt(w+z,a[1][1])),y=Math.max(y,T),S=Math.max(S,N)}if(r){if(d){const T=ye(B/M,m,_)*M;if(y=Math.max(y,T),s){let N=0;!c&&!l||c&&!l&&u?N=Mt(w+R+B/M,s[1][1])*M:N=Nt(w+R+(c?P:-P)/M,s[0][1])*M,y=Math.max(y,N)}if(a){let N=0;!c&&!l||c&&!l&&u?N=Nt(w+B/M,a[1][1])*M:N=Mt(w+(c?P:-P)/M,a[0][1])*M,y=Math.max(y,N)}}if(f){const T=ye(z*M,v,x)/M;if(S=Math.max(S,T),s){let N=0;!c&&!l||l&&!c&&u?N=Mt(p+z*M+V,s[1][0])/M:N=Nt(p+(l?k:-k)*M+V,s[0][0])/M,S=Math.max(S,N)}if(a){let N=0;!c&&!l||l&&!c&&u?N=Nt(p+z*M,a[1][0])/M:N=Mt(p+(l?k:-k)*M,a[0][0])/M,S=Math.max(S,N)}}}k=k+(k<0?S:-S),P=P+(P<0?y:-y),r&&(u?B>z*M?k=(ho(c,l)?-P:P)/M:P=(ho(c,l)?-k:k)*M:d?(k=P/M,l=c):(P=k*M,c=l));const E=c?p+P:p,A=l?w+k:w;return{width:C+(c?-P:P),height:b+(l?-k:k),x:i[0]*P*(c?-1:1)+E,y:i[1]*k*(l?-1:1)+A}}const Xr={width:0,height:0,x:0,y:0},Ll={...Xr,pointerX:0,pointerY:0,aspectRatio:1};function Hl(t,e,n){const o=e.position.x+t.position.x,r=e.position.y+t.position.y,i=t.measured.width??0,s=t.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Rl({domNode:t,nodeId:e,getStoreItems:n,onChange:o,onEnd:r}){const i=at(t);let s={controlDirection:fo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:d,keepAspectRatio:f,resizeDirection:u,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:x}){let m={...Xr},_={...Ll};s={boundaries:d,resizeDirection:u,keepAspectRatio:f,controlDirection:fo(l)};let p,w=null,C=[],b,M,P;const k=sr().on("start",B=>{const{nodeLookup:z,transform:V,snapGrid:R,snapToGrid:y,nodeOrigin:S,paneDomNode:E}=n();if(p=z.get(e),!p)return;w=(E==null?void 0:E.getBoundingClientRect())??null;const{xSnapped:A,ySnapped:T}=te(B.sourceEvent,{transform:V,snapGrid:R,snapToGrid:y,containerBounds:w});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...m,pointerX:A,pointerY:T,aspectRatio:m.width/m.height},b=void 0,M=Rt(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(b=z.get(p.parentId)),b&&p.extent==="parent"&&(M=[[0,0],[b.measured.width,b.measured.height]]),C=[],P=void 0;for(const[N,D]of z)if(D.parentId===e&&(C.push({id:N,position:{...D.position},extent:D.extent}),D.extent==="parent"||D.expandParent)){const L=Hl(D,p,D.origin??S);P?P=[[Math.min(L[0][0],P[0][0]),Math.min(L[0][1],P[0][1])],[Math.max(L[1][0],P[1][0]),Math.max(L[1][1],P[1][1])]]:P=L}h==null||h(B,{...m})}).on("drag",B=>{const{transform:z,snapGrid:V,snapToGrid:R,nodeOrigin:y}=n(),S=te(B.sourceEvent,{transform:z,snapGrid:V,snapToGrid:R,containerBounds:w}),E=[];if(!p)return;const{x:A,y:T,width:N,height:D}=m,L={},F=p.origin??y,{width:Y,height:j,x:q,y:J}=Dl(_,s.controlDirection,S,s.boundaries,s.keepAspectRatio,F,M,P),G=Y!==N,H=j!==D,O=q!==A&&G,Z=J!==T&&H;if(!O&&!Z&&!G&&!H)return;const U={prevValues:{...m},startX:_.x,startY:_.y,childNodes:C.map(tt=>({...tt,position:{...tt.position}}))};if((O||Z||F[0]===1||F[1]===1)&&(L.x=O?q:m.x,L.y=Z?J:m.y,m.x=L.x,m.y=L.y,C.length>0)){const tt=q-A,et=J-T;for(const ot of C)ot.position={x:ot.position.x-tt+F[0]*(Y-N),y:ot.position.y-et+F[1]*(j-D)},E.push(ot)}if((G||H)&&(L.width=G&&(!s.resizeDirection||s.resizeDirection==="horizontal")?Y:m.width,L.height=H&&(!s.resizeDirection||s.resizeDirection==="vertical")?j:m.height,m.width=L.width,m.height=L.height),b&&p.expandParent){const tt=F[0]*(L.width??0);L.x&&L.x<tt&&(m.x=tt,_.x=_.x-(L.x-tt));const et=F[1]*(L.height??0);L.y&&L.y<et&&(m.y=et,_.y=_.y-(L.y-et))}const X=zl({width:m.width,prevWidth:N,height:m.height,prevHeight:D,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),K={...m,direction:X};if((x==null?void 0:x(B,K))===!1){m=U.prevValues,_.x=U.startX,_.y=U.startY,C.forEach((tt,et)=>{tt.position=U.childNodes[et].position});return}g==null||g(B,K),o(L,E)}).on("end",B=>{v==null||v(B,{...m}),r==null||r({...m})});i.call(k)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var en={exports:{}},nn={},on={exports:{}},rn={};/**
|
|
1
|
+
import{a as Xo,g as $s,R as Ts,r as $,j as I}from"./vendor-react-DOVfxdUy.js";import{i as zs,c as jn,a as Yn,b as Ds,d as Ls,e as Hs,f as ve,g as Ze}from"./vendor-charts-By5uZ93z.js";function st(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,o;n<t.length;n++)(o=st(t[n]))!==""&&(e+=(e&&" ")+o);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var Rs={value:()=>{}};function ze(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new _e(n)}function _e(t){this._=t}function Vs(t,e){return t.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}_e.prototype=ze.prototype={constructor:_e,on:function(t,e){var n=this._,o=Vs(t+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(t=o[i]).type)&&(r=Bs(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(r=(t=o[i]).type)n[r]=Xn(n[r],t.name,e);else if(e==null)for(r in n)n[r]=Xn(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new _e(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],o=0,r=i.length;o<r;++o)i[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)}};function Bs(t,e){for(var n=0,o=t.length,r;n<o;++n)if((r=t[n]).name===e)return r.value}function Xn(t,e,n){for(var o=0,r=t.length;o<r;++o)if(t[o].name===e){t[o]=Rs,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var cn="http://www.w3.org/1999/xhtml";const Wn={svg:"http://www.w3.org/2000/svg",xhtml:cn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function De(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Wn.hasOwnProperty(e)?{space:Wn[e],local:t}:t}function Fs(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===cn&&e.documentElement.namespaceURI===cn?e.createElement(t):e.createElementNS(n,t)}}function Os(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Wo(t){var e=De(t);return(e.local?Os:Fs)(e)}function js(){}function wn(t){return t==null?js:function(){return this.querySelector(t)}}function Ys(t){typeof t!="function"&&(t=wn(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=new Array(s),c,l,d=0;d<s;++d)(c=i[d])&&(l=t.call(c,c.__data__,d,i))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new ct(o,this._parents)}function Xs(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Ws(){return[]}function Go(t){return t==null?Ws:function(){return this.querySelectorAll(t)}}function Gs(t){return function(){return Xs(t.apply(this,arguments))}}function qs(t){typeof t=="function"?t=Gs(t):t=Go(t);for(var e=this._groups,n=e.length,o=[],r=[],i=0;i<n;++i)for(var s=e[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(t.call(c,c.__data__,l,s)),r.push(c));return new ct(o,r)}function qo(t){return function(){return this.matches(t)}}function Zo(t){return function(e){return e.matches(t)}}var Zs=Array.prototype.find;function Us(t){return function(){return Zs.call(this.children,t)}}function Ks(){return this.firstElementChild}function Qs(t){return this.select(t==null?Ks:Us(typeof t=="function"?t:Zo(t)))}var Js=Array.prototype.filter;function ta(){return Array.from(this.children)}function ea(t){return function(){return Js.call(this.children,t)}}function na(t){return this.selectAll(t==null?ta:ea(typeof t=="function"?t:Zo(t)))}function oa(t){typeof t!="function"&&(t=qo(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&t.call(c,c.__data__,l,i)&&a.push(c);return new ct(o,this._parents)}function Uo(t){return new Array(t.length)}function ra(){return new ct(this._enter||this._groups.map(Uo),this._parents)}function Ce(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ce.prototype={constructor:Ce,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function ia(t){return function(){return t}}function sa(t,e,n,o,r,i){for(var s=0,a,c=e.length,l=i.length;s<l;++s)(a=e[s])?(a.__data__=i[s],o[s]=a):n[s]=new Ce(t,i[s]);for(;s<c;++s)(a=e[s])&&(r[s]=a)}function aa(t,e,n,o,r,i,s){var a,c,l=new Map,d=e.length,f=i.length,u=new Array(d),h;for(a=0;a<d;++a)(c=e[a])&&(u[a]=h=s.call(c,c.__data__,a,e)+"",l.has(h)?r[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(t,i[a],a,i)+"",(c=l.get(h))?(o[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new Ce(t,i[a]);for(a=0;a<d;++a)(c=e[a])&&l.get(u[a])===c&&(r[a]=c)}function ca(t){return t.__data__}function ua(t,e){if(!arguments.length)return Array.from(this,ca);var n=e?aa:sa,o=this._parents,r=this._groups;typeof t!="function"&&(t=ia(t));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var d=o[l],f=r[l],u=f.length,h=la(t.call(d,d&&d.__data__,l,o)),g=h.length,v=a[l]=new Array(g),x=s[l]=new Array(g),m=c[l]=new Array(u);n(d,f,v,x,m,h,e);for(var _=0,p=0,w,C;_<g;++_)if(w=v[_]){for(_>=p&&(p=_+1);!(C=x[p])&&++p<g;);w._next=C||null}}return s=new ct(s,o),s._enter=a,s._exit=c,s}function la(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function da(){return new ct(this._exit||this._groups.map(Uo),this._parents)}function fa(t,e,n){var o=this.enter(),r=this,i=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function ha(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],d=o[c],f=l.length,u=a[c]=new Array(f),h,g=0;g<f;++g)(h=l[g]||d[g])&&(u[g]=h);for(;c<r;++c)a[c]=n[c];return new ct(a,this._parents)}function ga(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function pa(t){t||(t=ma);function e(f,u){return f&&u?t(f.__data__,u.__data__):!f-!u}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,d=0;d<a;++d)(l=s[d])&&(c[d]=l);c.sort(e)}return new ct(r,this._parents).order()}function ma(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ya(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function xa(){return Array.from(this)}function wa(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function va(){let t=0;for(const e of this)++t;return t}function _a(){return!this.node()}function ba(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r=e[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&t.call(a,a.__data__,i,r);return this}function Ea(t){return function(){this.removeAttribute(t)}}function Sa(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ca(t,e){return function(){this.setAttribute(t,e)}}function Na(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Ma(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Aa(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ia(t,e){var n=De(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?Sa:Ea:typeof e=="function"?n.local?Aa:Ma:n.local?Na:Ca)(n,e))}function Ko(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ka(t){return function(){this.style.removeProperty(t)}}function Pa(t,e,n){return function(){this.style.setProperty(t,e,n)}}function $a(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function Ta(t,e,n){return arguments.length>1?this.each((e==null?ka:typeof e=="function"?$a:Pa)(t,e,n??"")):jt(this.node(),t)}function jt(t,e){return t.style.getPropertyValue(e)||Ko(t).getComputedStyle(t,null).getPropertyValue(e)}function za(t){return function(){delete this[t]}}function Da(t,e){return function(){this[t]=e}}function La(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Ha(t,e){return arguments.length>1?this.each((e==null?za:typeof e=="function"?La:Da)(t,e)):this.node()[t]}function Qo(t){return t.trim().split(/^|\s+/)}function vn(t){return t.classList||new Jo(t)}function Jo(t){this._node=t,this._names=Qo(t.getAttribute("class")||"")}Jo.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function tr(t,e){for(var n=vn(t),o=-1,r=e.length;++o<r;)n.add(e[o])}function er(t,e){for(var n=vn(t),o=-1,r=e.length;++o<r;)n.remove(e[o])}function Ra(t){return function(){tr(this,t)}}function Va(t){return function(){er(this,t)}}function Ba(t,e){return function(){(e.apply(this,arguments)?tr:er)(this,t)}}function Fa(t,e){var n=Qo(t+"");if(arguments.length<2){for(var o=vn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?Ba:e?Ra:Va)(n,e))}function Oa(){this.textContent=""}function ja(t){return function(){this.textContent=t}}function Ya(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Xa(t){return arguments.length?this.each(t==null?Oa:(typeof t=="function"?Ya:ja)(t)):this.node().textContent}function Wa(){this.innerHTML=""}function Ga(t){return function(){this.innerHTML=t}}function qa(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Za(t){return arguments.length?this.each(t==null?Wa:(typeof t=="function"?qa:Ga)(t)):this.node().innerHTML}function Ua(){this.nextSibling&&this.parentNode.appendChild(this)}function Ka(){return this.each(Ua)}function Qa(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ja(){return this.each(Qa)}function tc(t){var e=typeof t=="function"?t:Wo(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function ec(){return null}function nc(t,e){var n=typeof t=="function"?t:Wo(t),o=e==null?ec:typeof e=="function"?e:wn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function oc(){var t=this.parentNode;t&&t.removeChild(this)}function rc(){return this.each(oc)}function ic(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function sc(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ac(t){return this.select(t?sc:ic)}function cc(t){return arguments.length?this.property("__data__",t):this.node().__data__}function uc(t){return function(e){t.call(this,e,this.__data__)}}function lc(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function dc(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,r=e.length,i;n<r;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++o]=i;++o?e.length=o:delete this.__on}}}function fc(t,e,n){return function(){var o=this.__on,r,i=uc(e);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=e;return}}this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function hc(t,e,n){var o=lc(t+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(r=0,d=a[c];r<i;++r)if((s=o[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=e?fc:dc,r=0;r<i;++r)this.each(a(o[r],e,n));return this}function nr(t,e,n){var o=Ko(t),r=o.CustomEvent;typeof r=="function"?r=new r(e,n):(r=o.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function gc(t,e){return function(){return nr(this,t,e)}}function pc(t,e){return function(){return nr(this,t,e.apply(this,arguments))}}function mc(t,e){return this.each((typeof e=="function"?pc:gc)(t,e))}function*yc(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var or=[null];function ct(t,e){this._groups=t,this._parents=e}function ce(){return new ct([[document.documentElement]],or)}function xc(){return this}ct.prototype=ce.prototype={constructor:ct,select:Ys,selectAll:qs,selectChild:Qs,selectChildren:na,filter:oa,data:ua,enter:ra,exit:da,join:fa,merge:ha,selection:xc,order:ga,sort:pa,call:ya,nodes:xa,node:wa,size:va,empty:_a,each:ba,attr:Ia,style:Ta,property:Ha,classed:Fa,text:Xa,html:Za,raise:Ka,lower:Ja,append:tc,insert:nc,remove:rc,clone:ac,datum:cc,on:hc,dispatch:mc,[Symbol.iterator]:yc};function at(t){return typeof t=="string"?new ct([[document.querySelector(t)]],[document.documentElement]):new ct([[t]],or)}function wc(t){let e;for(;e=t.sourceEvent;)t=e;return t}function dt(t,e){if(t=wc(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const vc={passive:!1},ee={capture:!0,passive:!1};function Ue(t){t.stopImmediatePropagation()}function Ot(t){t.preventDefault(),t.stopImmediatePropagation()}function rr(t){var e=t.document.documentElement,n=at(t).on("dragstart.drag",Ot,ee);"onselectstart"in e?n.on("selectstart.drag",Ot,ee):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function ir(t,e){var n=t.document.documentElement,o=at(t).on("dragstart.drag",null);e&&(o.on("click.drag",Ot,ee),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const ge=t=>()=>t;function un(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}un.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function _c(t){return!t.ctrlKey&&!t.button}function bc(){return this.parentNode}function Ec(t,e){return e??{x:t.x,y:t.y}}function Sc(){return navigator.maxTouchPoints||"ontouchstart"in this}function sr(){var t=_c,e=bc,n=Ec,o=Sc,r={},i=ze("start","drag","end"),s=0,a,c,l,d,f=0;function u(w){w.on("mousedown.drag",h).filter(o).on("touchstart.drag",x).on("touchmove.drag",m,vc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,C){if(!(d||!t.call(this,w,C))){var b=p(this,e.call(this,w,C),w,C,"mouse");b&&(at(w.view).on("mousemove.drag",g,ee).on("mouseup.drag",v,ee),rr(w.view),Ue(w),l=!1,a=w.clientX,c=w.clientY,b("start",w))}}function g(w){if(Ot(w),!l){var C=w.clientX-a,b=w.clientY-c;l=C*C+b*b>f}r.mouse("drag",w)}function v(w){at(w.view).on("mousemove.drag mouseup.drag",null),ir(w.view,l),Ot(w),r.mouse("end",w)}function x(w,C){if(t.call(this,w,C)){var b=w.changedTouches,M=e.call(this,w,C),P=b.length,k,B;for(k=0;k<P;++k)(B=p(this,M,w,C,b[k].identifier,b[k]))&&(Ue(w),B("start",w,b[k]))}}function m(w){var C=w.changedTouches,b=C.length,M,P;for(M=0;M<b;++M)(P=r[C[M].identifier])&&(Ot(w),P("drag",w,C[M]))}function _(w){var C=w.changedTouches,b=C.length,M,P;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),M=0;M<b;++M)(P=r[C[M].identifier])&&(Ue(w),P("end",w,C[M]))}function p(w,C,b,M,P,k){var B=i.copy(),z=dt(k||b,C),V,R,y;if((y=n.call(w,new un("beforestart",{sourceEvent:b,target:u,identifier:P,active:s,x:z[0],y:z[1],dx:0,dy:0,dispatch:B}),M))!=null)return V=y.x-z[0]||0,R=y.y-z[1]||0,function S(E,A,T){var N=z,D;switch(E){case"start":r[P]=S,D=s++;break;case"end":delete r[P],--s;case"drag":z=dt(T||A,C),D=s;break}B.call(E,w,new un(E,{sourceEvent:A,subject:y,target:u,identifier:P,active:D,x:z[0]+V,y:z[1]+R,dx:z[0]-N[0],dy:z[1]-N[1],dispatch:B}),M)}}return u.filter=function(w){return arguments.length?(t=typeof w=="function"?w:ge(!!w),u):t},u.container=function(w){return arguments.length?(e=typeof w=="function"?w:ge(w),u):e},u.subject=function(w){return arguments.length?(n=typeof w=="function"?w:ge(w),u):n},u.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:ge(!!w),u):o},u.on=function(){var w=i.on.apply(i,arguments);return w===i?u:w},u.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,u):Math.sqrt(f)},u}var Yt=0,Qt=0,Ut=0,ar=1e3,Ne,Jt,Me=0,Lt=0,Le=0,ne=typeof performance=="object"&&performance.now?performance:Date,cr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function _n(){return Lt||(cr(Cc),Lt=ne.now()+Le)}function Cc(){Lt=0}function Ae(){this._call=this._time=this._next=null}Ae.prototype=ur.prototype={constructor:Ae,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?_n():+n)+(e==null?0:+e),!this._next&&Jt!==this&&(Jt?Jt._next=this:Ne=this,Jt=this),this._call=t,this._time=n,ln()},stop:function(){this._call&&(this._call=null,this._time=1/0,ln())}};function ur(t,e,n){var o=new Ae;return o.restart(t,e,n),o}function Nc(){_n(),++Yt;for(var t=Ne,e;t;)(e=Lt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Yt}function Gn(){Lt=(Me=ne.now())+Le,Yt=Qt=0;try{Nc()}finally{Yt=0,Ac(),Lt=0}}function Mc(){var t=ne.now(),e=t-Me;e>ar&&(Le-=e,Me=t)}function Ac(){for(var t,e=Ne,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ne=n);Jt=t,ln(o)}function ln(t){if(!Yt){Qt&&(Qt=clearTimeout(Qt));var e=t-Lt;e>24?(t<1/0&&(Qt=setTimeout(Gn,t-ne.now()-Le)),Ut&&(Ut=clearInterval(Ut))):(Ut||(Me=ne.now(),Ut=setInterval(Mc,ar)),Yt=1,cr(Gn))}}function qn(t,e,n){var o=new Ae;return e=e==null?0:+e,o.restart(r=>{o.stop(),t(r+e)},e,n),o}var Ic=ze("start","end","cancel","interrupt"),kc=[],lr=0,Zn=1,dn=2,be=3,Un=4,fn=5,Ee=6;function He(t,e,n,o,r,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Pc(t,n,{name:e,index:o,group:r,on:Ic,tween:kc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:lr})}function bn(t,e){var n=pt(t,e);if(n.state>lr)throw new Error("too late; already scheduled");return n}function wt(t,e){var n=pt(t,e);if(n.state>be)throw new Error("too late; already running");return n}function pt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Pc(t,e,n){var o=t.__transition,r;o[e]=n,n.timer=ur(i,0,n.time);function i(l){n.state=Zn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var d,f,u,h;if(n.state!==Zn)return c();for(d in o)if(h=o[d],h.name===n.name){if(h.state===be)return qn(s);h.state===Un?(h.state=Ee,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete o[d]):+d<e&&(h.state=Ee,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete o[d])}if(qn(function(){n.state===be&&(n.state=Un,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=dn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===dn){for(n.state=be,r=new Array(u=n.tween.length),d=0,f=-1;d<u;++d)(h=n.tween[d].value.call(t,t.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=fn,1),f=-1,u=r.length;++f<u;)r[f].call(t,d);n.state===fn&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Ee,n.timer.stop(),delete o[e];for(var l in o)return;delete t.__transition}}function Se(t,e){var n=t.__transition,o,r,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((o=n[s]).name!==e){i=!1;continue}r=o.state>dn&&o.state<fn,o.state=Ee,o.timer.stop(),o.on.call(r?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[s]}i&&delete t.__transition}}function $c(t){return this.each(function(){Se(this,t)})}function Tc(t,e){var n,o;return function(){var r=wt(this,t),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===e){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function zc(t,e,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=wt(this,t),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:e,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===e){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function Dc(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=pt(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===t)return s.value;return null}return this.each((e==null?Tc:zc)(n,t,e))}function En(t,e,n){var o=t._id;return t.each(function(){var r=wt(this,o);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return pt(r,o).value[e]}}function dr(t,e){var n;return(typeof e=="number"?zs:e instanceof jn?Yn:(n=jn(e))?(e=n,Yn):Ds)(t,e)}function Lc(t){return function(){this.removeAttribute(t)}}function Hc(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Rc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttribute(t);return s===r?null:s===o?i:i=e(o=s,n)}}function Vc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===r?null:s===o?i:i=e(o=s,n)}}function Bc(t,e,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a)))}}function Fc(t,e,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a)))}}function Oc(t,e){var n=De(t),o=n==="transform"?Ls:dr;return this.attrTween(t,typeof e=="function"?(n.local?Fc:Bc)(n,o,En(this,"attr."+t,e)):e==null?(n.local?Hc:Lc)(n):(n.local?Vc:Rc)(n,o,e))}function jc(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Yc(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Xc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&Yc(t,i)),n}return r._value=e,r}function Wc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&jc(t,i)),n}return r._value=e,r}function Gc(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=De(t);return this.tween(n,(o.local?Xc:Wc)(o,e))}function qc(t,e){return function(){bn(this,t).delay=+e.apply(this,arguments)}}function Zc(t,e){return e=+e,function(){bn(this,t).delay=e}}function Uc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?qc:Zc)(e,t)):pt(this.node(),e).delay}function Kc(t,e){return function(){wt(this,t).duration=+e.apply(this,arguments)}}function Qc(t,e){return e=+e,function(){wt(this,t).duration=e}}function Jc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Kc:Qc)(e,t)):pt(this.node(),e).duration}function tu(t,e){if(typeof e!="function")throw new Error;return function(){wt(this,t).ease=e}}function eu(t){var e=this._id;return arguments.length?this.each(tu(e,t)):pt(this.node(),e).ease}function nu(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;wt(this,t).ease=n}}function ou(t){if(typeof t!="function")throw new Error;return this.each(nu(this._id,t))}function ru(t){typeof t!="function"&&(t=qo(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&t.call(c,c.__data__,l,i)&&a.push(c);return new Ct(o,this._parents,this._name,this._id)}function iu(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=e[a],l=n[a],d=c.length,f=s[a]=new Array(d),u,h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;a<o;++a)s[a]=e[a];return new Ct(s,this._parents,this._name,this._id)}function su(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function au(t,e,n){var o,r,i=su(e)?bn:wt;return function(){var s=i(this,t),a=s.on;a!==o&&(r=(o=a).copy()).on(e,n),s.on=r}}function cu(t,e){var n=this._id;return arguments.length<2?pt(this.node(),n).on.on(t):this.each(au(n,t,e))}function uu(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function lu(){return this.on("end.remove",uu(this._id))}function du(t){var e=this._name,n=this._id;typeof t!="function"&&(t=wn(t));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),d,f,u=0;u<c;++u)(d=a[u])&&(f=t.call(d,d.__data__,u,a))&&("__data__"in d&&(f.__data__=d.__data__),l[u]=f,He(l[u],e,n,u,l,pt(d,n)));return new Ct(i,this._parents,e,n)}function fu(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Go(t));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,d,f=0;f<l;++f)if(d=c[f]){for(var u=t.call(d,d.__data__,f,c),h,g=pt(d,n),v=0,x=u.length;v<x;++v)(h=u[v])&&He(h,e,n,v,u,g);i.push(u),s.push(d)}return new Ct(i,s,e,n)}var hu=ce.prototype.constructor;function gu(){return new hu(this._groups,this._parents)}function pu(t,e){var n,o,r;return function(){var i=jt(this,t),s=(this.style.removeProperty(t),jt(this,t));return i===s?null:i===n&&s===o?r:r=e(n=i,o=s)}}function fr(t){return function(){this.style.removeProperty(t)}}function mu(t,e,n){var o,r=n+"",i;return function(){var s=jt(this,t);return s===r?null:s===o?i:i=e(o=s,n)}}function yu(t,e,n){var o,r,i;return function(){var s=jt(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),jt(this,t))),s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a))}}function xu(t,e){var n,o,r,i="style."+e,s="end."+i,a;return function(){var c=wt(this,t),l=c.on,d=c.value[i]==null?a||(a=fr(e)):void 0;(l!==n||r!==d)&&(o=(n=l).copy()).on(s,r=d),c.on=o}}function wu(t,e,n){var o=(t+="")=="transform"?Hs:dr;return e==null?this.styleTween(t,pu(t,o)).on("end.style."+t,fr(t)):typeof e=="function"?this.styleTween(t,yu(t,o,En(this,"style."+t,e))).each(xu(this._id,t)):this.styleTween(t,mu(t,o,e),n).on("end.style."+t,null)}function vu(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function _u(t,e,n){var o,r;function i(){var s=e.apply(this,arguments);return s!==r&&(o=(r=s)&&vu(t,s,n)),o}return i._value=e,i}function bu(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,_u(t,e,n??""))}function Eu(t){return function(){this.textContent=t}}function Su(t){return function(){var e=t(this);this.textContent=e??""}}function Cu(t){return this.tween("text",typeof t=="function"?Su(En(this,"text",t)):Eu(t==null?"":t+""))}function Nu(t){return function(e){this.textContent=t.call(this,e)}}function Mu(t){var e,n;function o(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&Nu(r)),e}return o._value=t,o}function Au(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Mu(t))}function Iu(){for(var t=this._name,e=this._id,n=hr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var d=pt(c,e);He(c,t,n,l,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ct(o,this._parents,t,n)}function ku(){var t,e,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=wt(this,o),d=l.on;d!==t&&(e=(t=d).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),l.on=e}),r===0&&i()})}var Pu=0;function Ct(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function hr(){return++Pu}var Et=ce.prototype;Ct.prototype={constructor:Ct,select:du,selectAll:fu,selectChild:Et.selectChild,selectChildren:Et.selectChildren,filter:ru,merge:iu,selection:gu,transition:Iu,call:Et.call,nodes:Et.nodes,node:Et.node,size:Et.size,empty:Et.empty,each:Et.each,on:cu,attr:Oc,attrTween:Gc,style:wu,styleTween:bu,text:Cu,textTween:Au,remove:lu,tween:Dc,delay:Uc,duration:Jc,ease:eu,easeVarying:ou,end:ku,[Symbol.iterator]:Et[Symbol.iterator]};function $u(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Tu={time:null,delay:0,duration:250,ease:$u};function zu(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Du(t){var e,n;t instanceof Ct?(e=t._id,t=t._name):(e=hr(),(n=Tu).time=_n(),t=t==null?null:t+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&He(c,t,e,l,s,n||zu(c,e));return new Ct(o,this._parents,t,e)}ce.prototype.interrupt=$c;ce.prototype.transition=Du;const pe=t=>()=>t;function Lu(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function St(t,e,n){this.k=t,this.x=e,this.y=n}St.prototype={constructor:St,scale:function(t){return t===1?this:new St(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new St(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Re=new St(1,0,0);gr.prototype=St.prototype;function gr(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Re;return t.__zoom}function Ke(t){t.stopImmediatePropagation()}function Kt(t){t.preventDefault(),t.stopImmediatePropagation()}function Hu(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Ru(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Kn(){return this.__zoom||Re}function Vu(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Bu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fu(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function pr(){var t=Hu,e=Ru,n=Fu,o=Vu,r=Bu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=ve,l=ze("start","zoom","end"),d,f,u,h=500,g=150,v=0,x=10;function m(y){y.property("__zoom",Kn).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",z).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,S,E,A){var T=y.selection?y.selection():y;T.property("__zoom",Kn),y!==T?C(y,S,E,A):T.interrupt().each(function(){b(this,arguments).event(A).start().zoom(null,typeof S=="function"?S.apply(this,arguments):S).end()})},m.scaleBy=function(y,S,E,A){m.scaleTo(y,function(){var T=this.__zoom.k,N=typeof S=="function"?S.apply(this,arguments):S;return T*N},E,A)},m.scaleTo=function(y,S,E,A){m.transform(y,function(){var T=e.apply(this,arguments),N=this.__zoom,D=E==null?w(T):typeof E=="function"?E.apply(this,arguments):E,L=N.invert(D),F=typeof S=="function"?S.apply(this,arguments):S;return n(p(_(N,F),D,L),T,s)},E,A)},m.translateBy=function(y,S,E,A){m.transform(y,function(){return n(this.__zoom.translate(typeof S=="function"?S.apply(this,arguments):S,typeof E=="function"?E.apply(this,arguments):E),e.apply(this,arguments),s)},null,A)},m.translateTo=function(y,S,E,A,T){m.transform(y,function(){var N=e.apply(this,arguments),D=this.__zoom,L=A==null?w(N):typeof A=="function"?A.apply(this,arguments):A;return n(Re.translate(L[0],L[1]).scale(D.k).translate(typeof S=="function"?-S.apply(this,arguments):-S,typeof E=="function"?-E.apply(this,arguments):-E),N,s)},A,T)};function _(y,S){return S=Math.max(i[0],Math.min(i[1],S)),S===y.k?y:new St(S,y.x,y.y)}function p(y,S,E){var A=S[0]-E[0]*y.k,T=S[1]-E[1]*y.k;return A===y.x&&T===y.y?y:new St(y.k,A,T)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function C(y,S,E,A){y.on("start.zoom",function(){b(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(A).end()}).tween("zoom",function(){var T=this,N=arguments,D=b(T,N).event(A),L=e.apply(T,N),F=E==null?w(L):typeof E=="function"?E.apply(T,N):E,Y=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),j=T.__zoom,q=typeof S=="function"?S.apply(T,N):S,J=c(j.invert(F).concat(Y/j.k),q.invert(F).concat(Y/q.k));return function(G){if(G===1)G=q;else{var H=J(G),O=Y/H[2];G=new St(O,F[0]-H[0]*O,F[1]-H[1]*O)}D.zoom(null,G)}})}function b(y,S,E){return!E&&y.__zooming||new M(y,S)}function M(y,S){this.that=y,this.args=S,this.active=0,this.sourceEvent=null,this.extent=e.apply(y,S),this.taps=0}M.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,S){return this.mouse&&y!=="mouse"&&(this.mouse[1]=S.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=S.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=S.invert(this.touch1[0])),this.that.__zoom=S,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var S=at(this.that).datum();l.call(y,this.that,new Lu(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),S)}};function P(y,...S){if(!t.apply(this,arguments))return;var E=b(this,S).event(y),A=this.__zoom,T=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,o.apply(this,arguments)))),N=dt(y);if(E.wheel)(E.mouse[0][0]!==N[0]||E.mouse[0][1]!==N[1])&&(E.mouse[1]=A.invert(E.mouse[0]=N)),clearTimeout(E.wheel);else{if(A.k===T)return;E.mouse=[N,A.invert(N)],Se(this),E.start()}Kt(y),E.wheel=setTimeout(D,g),E.zoom("mouse",n(p(_(A,T),E.mouse[0],E.mouse[1]),E.extent,s));function D(){E.wheel=null,E.end()}}function k(y,...S){if(u||!t.apply(this,arguments))return;var E=y.currentTarget,A=b(this,S,!0).event(y),T=at(y.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",Y,!0),N=dt(y,E),D=y.clientX,L=y.clientY;rr(y.view),Ke(y),A.mouse=[N,this.__zoom.invert(N)],Se(this),A.start();function F(j){if(Kt(j),!A.moved){var q=j.clientX-D,J=j.clientY-L;A.moved=q*q+J*J>v}A.event(j).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=dt(j,E),A.mouse[1]),A.extent,s))}function Y(j){T.on("mousemove.zoom mouseup.zoom",null),ir(j.view,A.moved),Kt(j),A.event(j).end()}}function B(y,...S){if(t.apply(this,arguments)){var E=this.__zoom,A=dt(y.changedTouches?y.changedTouches[0]:y,this),T=E.invert(A),N=E.k*(y.shiftKey?.5:2),D=n(p(_(E,N),A,T),e.apply(this,S),s);Kt(y),a>0?at(this).transition().duration(a).call(C,D,A,y):at(this).call(m.transform,D,A,y)}}function z(y,...S){if(t.apply(this,arguments)){var E=y.touches,A=E.length,T=b(this,S,y.changedTouches.length===A).event(y),N,D,L,F;for(Ke(y),D=0;D<A;++D)L=E[D],F=dt(L,this),F=[F,this.__zoom.invert(F),L.identifier],T.touch0?!T.touch1&&T.touch0[2]!==F[2]&&(T.touch1=F,T.taps=0):(T.touch0=F,N=!0,T.taps=1+!!d);d&&(d=clearTimeout(d)),N&&(T.taps<2&&(f=F[0],d=setTimeout(function(){d=null},h)),Se(this),T.start())}}function V(y,...S){if(this.__zooming){var E=b(this,S).event(y),A=y.changedTouches,T=A.length,N,D,L,F;for(Kt(y),N=0;N<T;++N)D=A[N],L=dt(D,this),E.touch0&&E.touch0[2]===D.identifier?E.touch0[0]=L:E.touch1&&E.touch1[2]===D.identifier&&(E.touch1[0]=L);if(D=E.that.__zoom,E.touch1){var Y=E.touch0[0],j=E.touch0[1],q=E.touch1[0],J=E.touch1[1],G=(G=q[0]-Y[0])*G+(G=q[1]-Y[1])*G,H=(H=J[0]-j[0])*H+(H=J[1]-j[1])*H;D=_(D,Math.sqrt(G/H)),L=[(Y[0]+q[0])/2,(Y[1]+q[1])/2],F=[(j[0]+J[0])/2,(j[1]+J[1])/2]}else if(E.touch0)L=E.touch0[0],F=E.touch0[1];else return;E.zoom("touch",n(p(D,L,F),E.extent,s))}}function R(y,...S){if(this.__zooming){var E=b(this,S).event(y),A=y.changedTouches,T=A.length,N,D;for(Ke(y),u&&clearTimeout(u),u=setTimeout(function(){u=null},h),N=0;N<T;++N)D=A[N],E.touch0&&E.touch0[2]===D.identifier?delete E.touch0:E.touch1&&E.touch1[2]===D.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(D=dt(D,this),Math.hypot(f[0]-D[0],f[1]-D[1])<x)){var L=at(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:pe(+y),m):o},m.filter=function(y){return arguments.length?(t=typeof y=="function"?y:pe(!!y),m):t},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:pe(!!y),m):r},m.extent=function(y){return arguments.length?(e=typeof y=="function"?y:pe([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):e},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(v=(y=+y)*y,m):Math.sqrt(v)},m.tapDistance=function(y){return arguments.length?(x=+y,m):x},m}const gt={error001:(t="react")=>`Seems like you have not used ${t==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${t}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:o}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:t=>`Edge with id "${t}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},oe=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],mr=["Enter"," ","Escape"],yr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Xt;(function(t){t.Strict="strict",t.Loose="loose"})(Xt||(Xt={}));var Dt;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(Dt||(Dt={}));var re;(function(t){t.Partial="partial",t.Full="full"})(re||(re={}));const xr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var It;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(It||(It={}));var Ie;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Ie||(Ie={}));var W;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(W||(W={}));const Qn={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top},wr=t=>!!t&&typeof t=="object"&&"id"in t&&"source"in t&&"target"in t,Ou=t=>!!t&&typeof t=="object"&&"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Sn=t=>!!t&&typeof t=="object"&&"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),ue=(t,e=[0,0])=>{const{width:n,height:o}=mt(t),r=t.origin??e,i=n*r[0],s=o*r[1];return{x:t.position.x-i,y:t.position.y-s}},ju=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};let n=!1;const o=t.reduce((r,i)=>{const s=typeof i=="string";let a=!e.nodeLookup&&!s?i:void 0;return e.nodeLookup&&(a=s?e.nodeLookup.get(i):Sn(i)?i:e.nodeLookup.get(i.id)),a?(n=!0,Ve(r,ke(a,e.nodeOrigin))):r},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Be(o):{x:0,y:0,width:0,height:0}},le=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return t.forEach(r=>{(e.filter===void 0||e.filter(r))&&(n=Ve(n,ke(r)),o=!0)}),o?Be(n):{x:0,y:0,width:0,height:0}},Cn=(t,e,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(e.x-n)/r,c=(e.y-o)/r,l=e.width/r,d=e.height/r,f=[];for(const u of t.values()){const{measured:h,selectable:g=!0,hidden:v=!1}=u;if(s&&!g||v)continue;const x=h.width??u.width??u.initialWidth??0,m=h.height??u.height??u.initialHeight??0,{x:_,y:p}=u.internals.positionAbsolute,w=Er(a,c,l,d,_,p,x,m),C=x*m,b=i&&w>0;(!u.internals.handleBounds||b||w>=C||u.dragging)&&f.push(u)}return f},Yu=(t,e)=>{const n=new Set;return t.forEach(o=>{n.add(o.id)}),e.filter(o=>n.has(o.source)||n.has(o.target))};function Xu(t,e){const n=new Map,o=e!=null&&e.nodes?new Set(e.nodes.map(r=>r.id)):null;return t.forEach(r=>{let i;if(e!=null&&e.includeHiddenNodes){const{width:s,height:a}=mt(r);i=s>0&&a>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Wu({nodes:t,width:e,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(t.size===0)return!0;const a=Xu(t,s),c=le(a),l=Mn(c,e,n,(s==null?void 0:s.minZoom)??r,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await o.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),!0}function vr({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(t),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o;let f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",gt.error005());else{const{width:h,height:g}=mt(a);h&&g&&(f=[[c,l],[c+h,l+g]])}else a&&Rt(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const u=Rt(f)?Ht(e,f,s.measured):e;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",gt.error015())),{position:{x:u.x-c+(s.measured.width??0)*d[0],y:u.y-l+(s.measured.height??0)*d[1]},positionAbsolute:u}}async function Gu({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(t.map(u=>u.id)),s=[];for(const u of n){if(u.deletable===!1)continue;const h=i.has(u.id),g=!h&&u.parentId&&s.find(v=>v.id===u.parentId);(h||g)&&s.push(u)}const a=new Set(e.map(u=>u.id)),c=o.filter(u=>u.deletable!==!1),d=Yu(s,c);for(const u of c)a.has(u.id)&&!d.find(g=>g.id===u.id)&&d.push(u);if(!r)return{edges:d,nodes:s};const f=await r({nodes:s,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:s}:{edges:[],nodes:[]}:f}const Wt=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Ht=(t={x:0,y:0},e,n)=>({x:Wt(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:Wt(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function _r(t,e,n){const{width:o,height:r}=mt(n),{x:i,y:s}=n.internals.positionAbsolute;return Ht(t,[[i,s],[i+o,s+r]],e)}const Jn=(t,e,n)=>t<e?Wt(Math.abs(t-e),1,e)/e:t>n?-Wt(Math.abs(t-n),1,e)/e:0,Nn=(t,e,n=15,o=40)=>{const r=Jn(t.x,o,e.width-o)*n,i=Jn(t.y,o,e.height-o)*n;return[r,i]},Ve=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),hn=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Be=({x:t,y:e,x2:n,y2:o})=>({x:t,y:e,width:n-t,height:o-e}),ie=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=Sn(t)?t.internals.positionAbsolute:ue(t,e);return{x:n,y:o,width:((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},ke=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=Sn(t)?t.internals.positionAbsolute:ue(t,e);return{x:n,y:o,x2:n+(((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0),y2:o+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},br=(t,e)=>Be(Ve(hn(t),hn(e))),Er=(t,e,n,o,r,i,s,a)=>{const c=Math.max(0,Math.min(t+n,r+s)-Math.max(t,r)),l=Math.max(0,Math.min(e+o,i+a)-Math.max(e,i));return Math.ceil(c*l)},Pe=(t,e)=>Er(t.x,t.y,t.width,t.height,e.x,e.y,e.width,e.height),to=t=>ft(t.width)&&ft(t.height)&&ft(t.x)&&ft(t.y),ft=t=>!isNaN(t)&&isFinite(t),Sr=(t,e)=>(n,o)=>{},de=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),fe=({x:t,y:e},[n,o,r],i=!1,s=[1,1])=>{const a={x:(t-n)/r,y:(e-o)/r};return i?de(a,s):a},Gt=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o});function Bt(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function qu(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=Bt(t,n),r=Bt(t,e);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof t=="object"){const o=Bt(t.top??t.y??0,n),r=Bt(t.bottom??t.y??0,n),i=Bt(t.left??t.x??0,e),s=Bt(t.right??t.x??0,e);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Zu(t,e,n,o,r,i){const{x:s,y:a}=Gt(t,[e,n,o]),{x:c,y:l}=Gt({x:t.x+t.width,y:t.y+t.height},[e,n,o]),d=r-c,f=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(f)}}const Mn=(t,e,n,o,r,i)=>{const s=qu(i,e,n),a=(e-s.x)/t.width,c=(n-s.y)/t.height,l=Math.min(a,c),d=Wt(l,o,r),f=t.x+t.width/2,u=t.y+t.height/2,h=e/2-f*d,g=n/2-u*d,v=Zu(t,h,g,d,e,n),x={left:Math.min(v.left-s.left,0),top:Math.min(v.top-s.top,0),right:Math.min(v.right-s.right,0),bottom:Math.min(v.bottom-s.bottom,0)};return{x:h-x.left+x.right,y:g-x.top+x.bottom,zoom:d}},se=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Rt(t){return t!=null&&t!=="parent"}function mt(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function Cr(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function Nr(t,e={width:0,height:0},n,o,r){const i={...t},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function eo(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function Uu(){let t,e;return{promise:new Promise((o,r)=>{t=o,e=r}),resolve:t,reject:e}}function Ku(t){return{...yr,...t||{}}}function Mr(t){return t===null?null:t?"valid":"invalid"}function te(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ht(t),a=fe({x:i-((r==null?void 0:r.left)??0),y:s-((r==null?void 0:r.top)??0)},o),{x:c,y:l}=n?de(a,e):a;return{xSnapped:c,ySnapped:l,...a}}const An=t=>({width:t.offsetWidth,height:t.offsetHeight}),Ar=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Qu=["INPUT","SELECT","TEXTAREA"];function Ir(t){var o,r;const e=((r=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:r[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:Qu.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const kr=t=>"clientX"in t,ht=(t,e)=>{var i,s;const n=kr(t),o=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,r=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},no=(t,e,n,o,r)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...An(s)}})};function Pr({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=t*.125+r*.375+s*.375+n*.125,l=e*.125+i*.375+a*.375+o*.125,d=Math.abs(c-t),f=Math.abs(l-e);return[c,l,d,f]}function me(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function oo({pos:t,x1:e,y1:n,x2:o,y2:r,c:i}){switch(t){case W.Left:return[e-me(e-o,i),n];case W.Right:return[e+me(o-e,i),n];case W.Top:return[e,n-me(n-r,i)];case W.Bottom:return[e,n+me(r-n,i)]}}function $r({sourceX:t,sourceY:e,sourcePosition:n=W.Bottom,targetX:o,targetY:r,targetPosition:i=W.Top,curvature:s=.25}){const[a,c]=oo({pos:n,x1:t,y1:e,x2:o,y2:r,c:s}),[l,d]=oo({pos:i,x1:o,y1:r,x2:t,y2:e,c:s}),[f,u,h,g]=Pr({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${t},${e} C${a},${c} ${l},${d} ${o},${r}`,f,u,h,g]}function Tr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,i=n<t?n+r:n-r,s=Math.abs(o-e)/2,a=o<e?o+s:o-s;return[i,a,r,s]}function Ju({sourceNode:t,targetNode:e,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(t.parentId||r&&t.selected?t.internals.z:0,e.parentId||r&&e.selected?e.internals.z:0);return s+a}function tl({sourceNode:t,targetNode:e,width:n,height:o,transform:r}){const i=Ve(ke(t),ke(e));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Pe(s,Be(i))>0}const el=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`xy-edge__${t}${e||""}-${n}${o||""}`,nl=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),ol=(t,e,n={})=>{var i;if(!t.source||!t.target)return(i=n.onError)==null||i.call(n,"006",gt.error006()),e;const o=n.getEdgeId||el;let r;return wr(t)?r={...t}:r={...t,id:o(t)},nl(r,e)?e:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,e.concat(r))};function zr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const[r,i,s,a]=Tr({sourceX:t,sourceY:e,targetX:n,targetY:o});return[`M ${t},${e}L ${n},${o}`,r,i,s,a]}const ro={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},rl=({source:t,sourcePosition:e=W.Bottom,target:n})=>e===W.Left||e===W.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},io=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function il({source:t,sourcePosition:e=W.Bottom,target:n,targetPosition:o=W.Top,center:r,offset:i,stepPosition:s}){const a=ro[e],c=ro[o],l={x:t.x+a.x*i,y:t.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=rl({source:l,sourcePosition:e,target:d}),u=f.x!==0?"x":"y",h=f[u];let g=[],v,x;const m={x:0,y:0},_={x:0,y:0},[,,p,w]=Tr({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[u]*c[u]===-1){u==="x"?(v=r.x??l.x+(d.x-l.x)*s,x=r.y??(l.y+d.y)/2):(v=r.x??(l.x+d.x)/2,x=r.y??l.y+(d.y-l.y)*s);const P=[{x:v,y:l.y},{x:v,y:d.y}],k=[{x:l.x,y:x},{x:d.x,y:x}];a[u]===h?g=u==="x"?P:k:g=u==="x"?k:P}else{const P=[{x:l.x,y:d.y}],k=[{x:d.x,y:l.y}];if(u==="x"?g=a.x===h?k:P:g=a.y===h?P:k,e===o){const y=Math.abs(t[u]-n[u]);if(y<=i){const S=Math.min(i-1,i-y);a[u]===h?m[u]=(l[u]>t[u]?-1:1)*S:_[u]=(d[u]>n[u]?-1:1)*S}}if(e!==o){const y=u==="x"?"y":"x",S=a[u]===c[y],E=l[y]>d[y],A=l[y]<d[y];(a[u]===1&&(!S&&E||S&&A)||a[u]!==1&&(!S&&A||S&&E))&&(g=u==="x"?P:k)}const B={x:l.x+m.x,y:l.y+m.y},z={x:d.x+_.x,y:d.y+_.y},V=Math.max(Math.abs(B.x-g[0].x),Math.abs(z.x-g[0].x)),R=Math.max(Math.abs(B.y-g[0].y),Math.abs(z.y-g[0].y));V>=R?(v=(B.x+z.x)/2,x=g[0].y):(v=g[0].x,x=(B.y+z.y)/2)}const C={x:l.x+m.x,y:l.y+m.y},b={x:d.x+_.x,y:d.y+_.y};return[[t,...C.x!==g[0].x||C.y!==g[0].y?[C]:[],...g,...b.x!==g[g.length-1].x||b.y!==g[g.length-1].y?[b]:[],n],v,x,p,w]}function sl(t,e,n,o){const r=Math.min(io(t,e)/2,io(e,n)/2,o),{x:i,y:s}=e;if(t.x===i&&i===n.x||t.y===s&&s===n.y)return`L${i} ${s}`;if(t.y===s){const l=t.x<n.x?-1:1,d=t.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*d}`}const a=t.x<n.x?1:-1,c=t.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function gn({sourceX:t,sourceY:e,sourcePosition:n=W.Bottom,targetX:o,targetY:r,targetPosition:i=W.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[f,u,h,g,v]=il({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:d});let x=`M${f[0].x} ${f[0].y}`;for(let m=1;m<f.length-1;m++)x+=sl(f[m-1],f[m],f[m+1],s);return x+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[x,u,h,g,v]}function so(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function al(t){var f;const{sourceNode:e,targetNode:n}=t;if(!so(e)||!so(n))return null;const o=e.internals.handleBounds||ao(e.handles),r=n.internals.handleBounds||ao(n.handles),i=co((o==null?void 0:o.source)??[],t.sourceHandle),s=co(t.connectionMode===Xt.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),t.targetHandle);if(!i||!s)return(f=t.onError)==null||f.call(t,"008",gt.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(i==null?void 0:i.position)||W.Bottom,c=(s==null?void 0:s.position)||W.Top,l=Vt(e,i,a),d=Vt(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function ao(t){if(!t)return null;const e=[],n=[];for(const o of t)o.width=o.width??1,o.height=o.height??1,o.type==="source"?e.push(o):o.type==="target"&&n.push(o);return{source:e,target:n}}function Vt(t,e,n=W.Left,o=!1){const r=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:s,height:a}=e??mt(t);if(o)return{x:r+s/2,y:i+a/2};switch((e==null?void 0:e.position)??n){case W.Top:return{x:r+s/2,y:i};case W.Right:return{x:r+s,y:i+a/2};case W.Bottom:return{x:r+s/2,y:i+a};case W.Left:return{x:r,y:i+a/2}}}function co(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function pn(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`:""}function cl(t,{id:e,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return t.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const l=pn(c,e);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Dr=1e3,ul=10,In={nodeOrigin:[0,0],nodeExtent:oe,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ll={...In,checkEquality:!0};function kn(t,e){const n={...t};for(const o in e)e[o]!==void 0&&(n[o]=e[o]);return n}function dl(t,e,n){const o=kn(In,n);for(const r of t.values())if(r.parentId)$n(r,t,e,o);else{const i=ue(r,o.nodeOrigin),s=Rt(r.extent)?r.extent:o.nodeExtent,a=Ht(i,s,mt(r));r.internals.positionAbsolute=a}}function fl(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],o=[];for(const r of t.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:t.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Pn(t){return t==="manual"}function mn(t,e,n,o={}){var d,f;const r=kn(ll,o),i={i:0},s=new Map(e),a=r!=null&&r.elevateNodesOnSelect&&!Pn(r.zIndexMode)?Dr:0;let c=t.length>0,l=!1;e.clear(),n.clear();for(const u of t){let h=s.get(u.id);if(r.checkEquality&&u===(h==null?void 0:h.internals.userNode))e.set(u.id,h);else{const g=ue(u,r.nodeOrigin),v=Rt(u.extent)?u.extent:r.nodeExtent,x=Ht(g,v,mt(u));h={...r.defaults,...u,measured:{width:(d=u.measured)==null?void 0:d.width,height:(f=u.measured)==null?void 0:f.height},internals:{positionAbsolute:x,handleBounds:fl(u,h),z:Lr(u,a,r.zIndexMode),userNode:u}},e.set(u.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),u.parentId&&$n(h,e,n,o,i),l||(l=u.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function hl(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function $n(t,e,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=kn(In,o),l=t.parentId,d=e.get(l);if(!d){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}hl(t,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*ul),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const f=i&&!Pn(c)?Dr:0,{x:u,y:h,z:g}=gl(t,d,s,a,f,c),{positionAbsolute:v}=t.internals,x=u!==v.x||h!==v.y;(x||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:x?{x:u,y:h}:v,z:g}})}function Lr(t,e,n){const o=ft(t.zIndex)?t.zIndex:0;return Pn(n)?o:o+(t.selected?e:0)}function gl(t,e,n,o,r,i){const{x:s,y:a}=e.internals.positionAbsolute,c=mt(t),l=ue(t,n),d=Rt(t.extent)?Ht(l,t.extent,c):l;let f=Ht({x:s+d.x,y:a+d.y},o,c);t.extent==="parent"&&(f=_r(f,c,e));const u=Lr(t,r,i),h=e.internals.z??0;return{x:f.x,y:f.y,z:h>=u?h+1:u}}function Tn(t,e,n,o=[0,0]){var s;const r=[],i=new Map;for(const a of t){const c=e.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??ie(c),d=br(l,a.rect);i.set(a.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var p;const d=c.internals.positionAbsolute,f=mt(c),u=c.origin??o,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,v=Math.max(f.width,Math.round(a.width)),x=Math.max(f.height,Math.round(a.height)),m=(v-f.width)*u[0],_=(x-f.height)*u[1];(h>0||g>0||m||_)&&(r.push({id:l,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+_}}),(p=n.get(l))==null||p.forEach(w=>{t.some(C=>C.id===w.id)||r.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+g}})})),(f.width<a.width||f.height<a.height||h||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:v+(h?u[0]*h-m:0),height:x+(g?u[1]*g-_:0)}})}),r}function pl(t,e,n,o,r,i,s){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],d=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(d.transform),u=[];for(const h of t.values()){const g=e.get(h.id);if(!g)continue;if(g.hidden){e.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const v=An(h.nodeElement),x=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(x||!g.internals.handleBounds||h.force))){const _=h.nodeElement.getBoundingClientRect(),p=Rt(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;if(g.parentId&&g.extent==="parent"){const b=e.get(g.parentId);b&&(w=_r(w,v,b))}else p&&(w=Ht(w,p,v));const C={...g,measured:v,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:no("source",h.nodeElement,_,f,g.id),target:no("target",h.nodeElement,_,f,g.id)}}};e.set(g.id,C),g.parentId&&$n(C,e,n,{nodeOrigin:r,zIndexMode:s}),c=!0,x&&(l.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&u.push({id:g.id,parentId:g.parentId,rect:ie(C,r)}))}}if(u.length>0){const h=Tn(u,e,n,r);l.push(...h)}return{changes:l,updatedInternals:c}}async function ml({delta:t,panZoom:e,transform:n,translateExtent:o,width:r,height:i}){if(!e||!t.x&&!t.y)return!1;const s=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function uo(t,e,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,e)),s=`${r}-${t}`;const c=o.get(s)||new Map;if(o.set(s,c.set(n,e)),i){s=`${r}-${t}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,e))}}function Hr(t,e,n){t.clear(),e.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,d=`${i}-${a}--${r}-${s}`;uo("source",c,d,t,r,s),uo("target",c,l,t,i,a),e.set(o.id,o)}}function Rr(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:Rr(n,e):!1}function lo(t,e,n){var r;let o=t;do{if((r=o==null?void 0:o.matches)!=null&&r.call(o,e))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function yl(t,e,n,o){const r=new Map;for(const[i,s]of t)if((s.selected||s.id===o)&&(!s.parentId||!Rr(s,t))&&(s.draggable||e&&typeof s.draggable>"u")){const a=t.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Qe({nodeId:t,dragItems:e,nodeLookup:n,dragging:o=!0}){var s,a,c;const r=[];for(const[l,d]of e){const f=(s=n.get(l))==null?void 0:s.internals.userNode;f&&r.push({...f,position:d.position,dragging:o})}if(!t)return[r[0],r];const i=(a=n.get(t))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=e.get(t))==null?void 0:c.position)||i.position,dragging:o}:r[0],r]}function xl({dragItems:t,snapGrid:e,x:n,y:o}){const r=t.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=de(i,e);return{x:s.x-i.x,y:s.y-i.y}}function wl({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},d=null,f=!1,u=null,h=!1,g=!1,v=null;function x({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:C,nodeId:b,nodeClickDistance:M=0}){u=at(w);function P({x:V,y:R}){const{nodeLookup:y,nodeExtent:S,snapGrid:E,snapToGrid:A,nodeOrigin:T,onNodeDrag:N,onSelectionDrag:D,onError:L,updateNodePositions:F}=e();i={x:V,y:R};let Y=!1;const j=a.size>1,q=j&&S?hn(le(a)):null,J=j&&A?xl({dragItems:a,snapGrid:E,x:V,y:R}):null;for(const[G,H]of a){if(!y.has(G))continue;let O={x:V-H.distance.x,y:R-H.distance.y};A&&(O=J?{x:Math.round(O.x+J.x),y:Math.round(O.y+J.y)}:de(O,E));let Z=null;if(j&&S&&!H.extent&&q){const{positionAbsolute:K}=H.internals,Q=K.x-q.x+S[0][0],tt=K.x+H.measured.width-q.x2+S[1][0],et=K.y-q.y+S[0][1],ot=K.y+H.measured.height-q.y2+S[1][1];Z=[[Q,et],[tt,ot]]}const{position:U,positionAbsolute:X}=vr({nodeId:G,nextPosition:O,nodeLookup:y,nodeExtent:Z||S,nodeOrigin:T,onError:L});Y=Y||H.position.x!==U.x||H.position.y!==U.y,H.position=U,H.internals.positionAbsolute=X}if(g=g||Y,!!Y&&(F(a,!0),v&&(o||N||!b&&D))){const[G,H]=Qe({nodeId:b,dragItems:a,nodeLookup:y});o==null||o(v,a,G,H),N==null||N(v,G,H),b||D==null||D(v,H)}}async function k(){if(!d)return;const{transform:V,panBy:R,autoPanSpeed:y,autoPanOnNodeDrag:S}=e();if(!S){c=!1,cancelAnimationFrame(s);return}const[E,A]=Nn(l,d,y);(E!==0||A!==0)&&(i.x=(i.x??0)-E/V[2],i.y=(i.y??0)-A/V[2],await R({x:E,y:A})&&P(i)),s=requestAnimationFrame(k)}function B(V){var j;const{nodeLookup:R,multiSelectionActive:y,nodesDraggable:S,transform:E,snapGrid:A,snapToGrid:T,selectNodesOnDrag:N,onNodeDragStart:D,onSelectionDragStart:L,unselectNodesAndEdges:F}=e();f=!0,(!N||!C)&&!y&&b&&((j=R.get(b))!=null&&j.selected||F()),C&&N&&b&&(t==null||t(b));const Y=te(V.sourceEvent,{transform:E,snapGrid:A,snapToGrid:T,containerBounds:d});if(i=Y,a=yl(R,S,Y,b),a.size>0&&(n||D||!b&&L)){const[q,J]=Qe({nodeId:b,dragItems:a,nodeLookup:R});n==null||n(V.sourceEvent,a,q,J),D==null||D(V.sourceEvent,q,J),b||L==null||L(V.sourceEvent,J)}}const z=sr().clickDistance(M).on("start",V=>{const{domNode:R,nodeDragThreshold:y,transform:S,snapGrid:E,snapToGrid:A}=e();d=(R==null?void 0:R.getBoundingClientRect())||null,h=!1,g=!1,v=V.sourceEvent,y===0&&B(V),i=te(V.sourceEvent,{transform:S,snapGrid:E,snapToGrid:A,containerBounds:d}),l=ht(V.sourceEvent,d)}).on("drag",V=>{const{autoPanOnNodeDrag:R,transform:y,snapGrid:S,snapToGrid:E,nodeDragThreshold:A,nodeLookup:T}=e(),N=te(V.sourceEvent,{transform:y,snapGrid:S,snapToGrid:E,containerBounds:d});if(v=V.sourceEvent,(V.sourceEvent.type==="touchmove"&&V.sourceEvent.touches.length>1||b&&!T.has(b))&&(h=!0),!h){if(!c&&R&&f&&(c=!0,k()),!f){const D=ht(V.sourceEvent,d),L=D.x-l.x,F=D.y-l.y;Math.sqrt(L*L+F*F)>A&&B(V)}(i.x!==N.xSnapped||i.y!==N.ySnapped)&&a&&f&&(l=ht(V.sourceEvent,d),P(N))}}).on("end",V=>{if(!f||h){h&&a.size>0&&e().updateNodePositions(a,!1);return}if(c=!1,f=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:R,updateNodePositions:y,onNodeDragStop:S,onSelectionDragStop:E}=e();if(g&&(y(a,!1),g=!1),r||S||!b&&E){const[A,T]=Qe({nodeId:b,dragItems:a,nodeLookup:R,dragging:!1});r==null||r(V.sourceEvent,a,A,T),S==null||S(V.sourceEvent,A,T),b||E==null||E(V.sourceEvent,T)}}}).filter(V=>{const R=V.target;return!V.button&&(!_||!lo(R,`.${_}`,w))&&(!p||lo(R,p,w))});u.call(z)}function m(){u==null||u.on(".drag",null)}return{update:x,destroy:m}}function vl(t,e,n){const o=[],r={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())Pe(r,ie(i))>0&&o.push(i);return o}const _l=250;function bl(t,e,n,o){var a,c;let r=[],i=1/0;const s=vl(t,n,e+_l);for(const l of s){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(o.nodeId===f.nodeId&&o.type===f.type&&o.id===f.id)continue;const{x:u,y:h}=Vt(l,f,f.position,!0),g=Math.sqrt(Math.pow(u-t.x,2)+Math.pow(h-t.y,2));g>e||(g<i?(r=[{...f,x:u,y:h}],i=g):g===i&&r.push({...f,x:u,y:h}))}}if(!r.length)return null;if(r.length>1){const l=o.type==="source"?"target":"source";return r.find(d=>d.type===l)??r[0]}return r[0]}function Vr(t,e,n,o,r,i=!1){var l,d,f;const s=o.get(t);if(!s)return null;const a=r==="strict"?(l=s.internals.handleBounds)==null?void 0:l[e]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((f=s.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?a==null?void 0:a.find(u=>u.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Vt(s,c,c.position,!0)}:c}function Br(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function El(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const Fr=()=>!0;function Sl(t,{connectionMode:e,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:f,panBy:u,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:x,isValidConnection:m=Fr,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:C,autoPanSpeed:b,dragThreshold:M=1,handleDomNode:P}){const k=Ar(t.target);let B=0,z;const{x:V,y:R}=ht(t),y=Br(i,P),S=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!S||!y)return;const A=Vr(r,y,o,c,e);if(!A)return;let T=ht(t,S),N=!1,D=null,L=!1,F=null;function Y(){if(!d||!S)return;const[U,X]=Nn(T,S,b);u({x:U,y:X}),B=requestAnimationFrame(Y)}const j={...A,nodeId:r,type:y,position:A.position},q=c.get(r);let G={inProgress:!0,isValid:null,from:Vt(q,j,W.Left,!0),fromHandle:j,fromPosition:j.position,fromNode:q,to:T,toHandle:null,toPosition:Qn[j.position],toNode:null,pointer:T};function H(){E=!0,p(G),g==null||g(t,{nodeId:r,handleId:o,handleType:y})}M===0&&H();function O(U){if(!E){const{x:ot,y:ut}=ht(U),yt=ot-V,xt=ut-R;if(!(yt*yt+xt*xt>M*M))return;H()}if(!C()||!j){Z(U);return}const X=w();T=ht(U,S),z=bl(fe(T,X,!1,[1,1]),n,c,j),N||(Y(),N=!0);const K=Or(U,{handle:z,connectionMode:e,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:k,lib:l,flowId:f,nodeLookup:c});F=K.handleDomNode,D=K.connection,L=El(!!z,K.isValid);const Q=c.get(r),tt=Q?Vt(Q,j,W.Left,!0):G.from,et={...G,from:tt,isValid:L,to:K.toHandle&&L?Gt({x:K.toHandle.x,y:K.toHandle.y},X):T,toHandle:K.toHandle,toPosition:L&&K.toHandle?K.toHandle.position:Qn[j.position],toNode:K.toHandle?c.get(K.toHandle.nodeId):null,pointer:T};p(et),G=et}function Z(U){if(!("touches"in U&&U.touches.length>0)){if(E){(z||F)&&D&&L&&(v==null||v(D));const{inProgress:X,...K}=G,Q={...K,toPosition:G.toHandle?G.toPosition:null};x==null||x(U,Q),i&&(_==null||_(U,Q))}h(),cancelAnimationFrame(B),N=!1,L=!1,D=null,F=null,k.removeEventListener("mousemove",O),k.removeEventListener("mouseup",Z),k.removeEventListener("touchmove",O),k.removeEventListener("touchend",Z)}}k.addEventListener("mousemove",O),k.addEventListener("mouseup",Z),k.addEventListener("touchmove",O),k.addEventListener("touchend",Z)}function Or(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=Fr,nodeLookup:d}){const f=i==="target",u=e?s.querySelector(`.${a}-flow__handle[data-id="${c}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:h,y:g}=ht(t),v=s.elementFromPoint(h,g),x=v!=null&&v.classList.contains(`${a}-flow__handle`)?v:u,m={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const _=Br(void 0,x),p=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),C=x.classList.contains("connectable"),b=x.classList.contains("connectableend");if(!p||!_)return m;const M={source:f?p:o,sourceHandle:f?w:r,target:f?o:p,targetHandle:f?r:w};m.connection=M;const k=C&&b&&(n===Xt.Strict?f&&_==="source"||!f&&_==="target":p!==o||w!==r);m.isValid=k&&l(M),m.toHandle=Vr(p,_,w,d,n,!0)}return m}const yn={onPointerDown:Sl,isValid:Or};function Cl({domNode:t,panZoom:e,getTransform:n,getViewScale:o}){const r=at(t);function i({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:f=!0,zoomable:u=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!e)return;const w=n(),C=p.sourceEvent.ctrlKey&&se()?10:1,b=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*d,M=w[2]*Math.pow(2,b*C);e.scaleTo(M)};let v=[0,0];const x=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(v=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!e)return;const C=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],b=[C[0]-v[0],C[1]-v[1]];v=C;const M=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),P={x:w[0]-b[0]*M,y:w[1]-b[1]*M},k=[[0,0],[c,l]];e.setViewportConstrained({x:P.x,y:P.y,zoom:w[2]},k,a)},_=pr().on("start",x).on("zoom",f?m:null).on("zoom.wheel",u?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:dt}}const Fe=t=>({x:t.x,y:t.y,zoom:t.k}),Je=({x:t,y:e,zoom:n})=>Re.translate(t,e).scale(n),At=(t,e)=>t.target.closest(`.${e}`),jr=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Nl=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,tn=(t,e=0,n=Nl,o=()=>{})=>{const r=typeof e=="number"&&e>0;return r||o(),r?t.transition().duration(e).ease(n).on("end",o):t},Yr=t=>{const e=t.ctrlKey&&se()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function Ml({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(At(d,e))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&s){const x=dt(d),m=Yr(d),_=f*Math.pow(2,m);o.scaleTo(n,_,x,d);return}const u=d.deltaMode===1?20:1;let h=r===Dt.Vertical?0:d.deltaX*u,g=r===Dt.Horizontal?0:d.deltaY*u;!se()&&d.shiftKey&&r!==Dt.Vertical&&(h=d.deltaY*u,g=0),o.translateBy(n,-(h/f)*i,-(g/f)*i,{internal:!0});const v=Fe(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?c==null||c(d,v):(t.isPanScrolling=!0,a==null||a(d,v)),t.panScrollTimeout=setTimeout(()=>{l==null||l(d,v),t.isPanScrolling=!1},150)}}function Al({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!e&&i&&!o.ctrlKey,a=At(o,t);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Il({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return o=>{var i,s,a;if((i=o.sourceEvent)!=null&&i.internal)return;const r=Fe(o.transform);t.mouseButton=((s=o.sourceEvent)==null?void 0:s.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=r,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),n&&(n==null||n(o.sourceEvent,r))}}function kl({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{var s,a;t.usedRightMouseButton=!!(n&&jr(e,t.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!((a=i.sourceEvent)!=null&&a.internal)&&(r==null||r(i.sourceEvent,Fe(i.transform)))}}function Pl({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,i&&jr(e,t.mouseButton??0)&&!t.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),t.usedRightMouseButton=!1,o(!1),r)){const c=Fe(s.transform);t.prevViewport=c,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{r==null||r(s.sourceEvent,c)},n?150:0)}}}function $l({panActivationKeyPressed:t,zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:l,lib:d,connectionInProgress:f}){return u=>{var m;const h=e||n,g=o&&u.ctrlKey,v=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(At(u,`${d}-flow__node`)||At(u,`${d}-flow__edge`)||At(u,`${d}-flow__selection`)||At(u,`${d}-flow__nodesselection`)))return!0;if(!r&&!h&&!i&&!s&&!o||a||f&&!v||At(u,c)&&v||At(u,l)&&(!v||i&&v&&!e)||!o&&u.ctrlKey&&v)return!1;if(!o&&u.type==="touchstart"&&((m=u.touches)==null?void 0:m.length)>1)return u.preventDefault(),!1;if(!h&&!i&&!g&&v||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||v||t)&&x}}function Tl({domNode:t,minZoom:e,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=t.getBoundingClientRect();let f=[[0,0],[d.width,d.height]];const u=typeof ResizeObserver<"u"?new ResizeObserver(R=>{const y=R[0];y&&(f=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null;u==null||u.observe(t);const h=pr().extent(()=>f).scaleExtent([e,n]).translateExtent(o),g=at(t).call(h);w({x:r.x,y:r.y,zoom:Wt(r.zoom,e,n)},[[0,0],[d.width,d.height]],o);const v=g.on("wheel.zoom"),x=g.on("dblclick.zoom");h.wheelDelta(Yr);async function m(R,y){return g?new Promise(S=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?Ze:ve).transform(tn(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>S(!0)),R)}):!1}function _({noWheelClassName:R,noPanClassName:y,onPaneContextMenu:S,userSelectionActive:E,panOnScroll:A,panOnDrag:T,panOnScrollMode:N,panOnScrollSpeed:D,preventScrolling:L,zoomOnPinch:F,zoomOnScroll:Y,zoomOnDoubleClick:j,panActivationKeyPressed:q=!1,zoomActivationKeyPressed:J,lib:G,onTransformChange:H,connectionInProgress:O,paneClickDistance:Z,selectionOnDrag:U}){E&&!l.isZoomingOrPanning&&p();const X=A&&!J&&!E;h.clickDistance(U?1/0:!ft(Z)||Z<0?0:Z);const K=X?Ml({zoomPanValues:l,noWheelClassName:R,d3Selection:g,d3Zoom:h,panOnScrollMode:N,panOnScrollSpeed:D,zoomOnPinch:F,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Al({noWheelClassName:R,preventScrolling:L,d3ZoomHandler:v});g.on("wheel.zoom",K,{passive:!1});const Q=Il({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});h.on("start",Q);const tt=kl({zoomPanValues:l,panOnDrag:T,onPaneContextMenu:!!S,onPanZoom:i,onTransformChange:H});h.on("zoom",tt);const et=Pl({zoomPanValues:l,panOnDrag:T,panOnScroll:A,onPaneContextMenu:S,onPanZoomEnd:a,onDraggingChange:c});h.on("end",et);const ot=$l({panActivationKeyPressed:q,zoomActivationKeyPressed:J,panOnDrag:T,zoomOnScroll:Y,panOnScroll:A,zoomOnDoubleClick:j,zoomOnPinch:F,userSelectionActive:E,noPanClassName:y,noWheelClassName:R,lib:G,connectionInProgress:O});h.filter(ot),j?g.on("dblclick.zoom",x):g.on("dblclick.zoom",null)}function p(){h.on("zoom",null)}async function w(R,y,S){const E=Je(R),A=h==null?void 0:h.constrain()(E,y,S);return A&&await m(A),A}async function C(R,y){const S=Je(R);return await m(S,y),S}function b(R){if(g){const y=Je(R),S=g.property("__zoom");(S.k!==R.zoom||S.x!==R.x||S.y!==R.y)&&(h==null||h.transform(g,y,null,{sync:!0}))}}function M(){const R=g?gr(g.node()):{x:0,y:0,k:1};return{x:R.x,y:R.y,zoom:R.k}}async function P(R,y){return g?new Promise(S=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?Ze:ve).scaleTo(tn(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>S(!0)),R)}):!1}async function k(R,y){return g?new Promise(S=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?Ze:ve).scaleBy(tn(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>S(!0)),R)}):!1}function B(R){h==null||h.scaleExtent(R)}function z(R){h==null||h.translateExtent(R)}function V(R){const y=!ft(R)||R<0?0:R;h==null||h.clickDistance(y)}return{update:_,destroy:p,setViewport:C,setViewportConstrained:w,getViewport:M,scaleTo:P,scaleBy:k,setScaleExtent:B,setTranslateExtent:z,syncViewport:b,setClickDistance:V}}var qt;(function(t){t.Line="line",t.Handle="handle"})(qt||(qt={}));function zl({width:t,prevWidth:e,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=t-e,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function fo(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),o=t.includes("left"),r=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:o,affectsY:r}}function Nt(t,e){return Math.max(0,e-t)}function Mt(t,e){return Math.max(0,t-e)}function ye(t,e,n){return Math.max(0,e-t,t-n)}function ho(t,e){return t?!e:e}function Dl(t,e,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=e;const{isHorizontal:d,isVertical:f}=e,u=d&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:x,minHeight:m,maxHeight:_}=o,{x:p,y:w,width:C,height:b,aspectRatio:M}=t;let P=Math.floor(d?h-t.pointerX:0),k=Math.floor(f?g-t.pointerY:0);const B=C+(c?-P:P),z=b+(l?-k:k),V=-i[0]*C,R=-i[1]*b;let y=ye(B,v,x),S=ye(z,m,_);if(s){let T=0,N=0;c&&P<0?T=Nt(p+P+V,s[0][0]):!c&&P>0&&(T=Mt(p+B+V,s[1][0])),l&&k<0?N=Nt(w+k+R,s[0][1]):!l&&k>0&&(N=Mt(w+z+R,s[1][1])),y=Math.max(y,T),S=Math.max(S,N)}if(a){let T=0,N=0;c&&P>0?T=Mt(p+P,a[0][0]):!c&&P<0&&(T=Nt(p+B,a[1][0])),l&&k>0?N=Mt(w+k,a[0][1]):!l&&k<0&&(N=Nt(w+z,a[1][1])),y=Math.max(y,T),S=Math.max(S,N)}if(r){if(d){const T=ye(B/M,m,_)*M;if(y=Math.max(y,T),s){let N=0;!c&&!l||c&&!l&&u?N=Mt(w+R+B/M,s[1][1])*M:N=Nt(w+R+(c?P:-P)/M,s[0][1])*M,y=Math.max(y,N)}if(a){let N=0;!c&&!l||c&&!l&&u?N=Nt(w+B/M,a[1][1])*M:N=Mt(w+(c?P:-P)/M,a[0][1])*M,y=Math.max(y,N)}}if(f){const T=ye(z*M,v,x)/M;if(S=Math.max(S,T),s){let N=0;!c&&!l||l&&!c&&u?N=Mt(p+z*M+V,s[1][0])/M:N=Nt(p+(l?k:-k)*M+V,s[0][0])/M,S=Math.max(S,N)}if(a){let N=0;!c&&!l||l&&!c&&u?N=Nt(p+z*M,a[1][0])/M:N=Mt(p+(l?k:-k)*M,a[0][0])/M,S=Math.max(S,N)}}}k=k+(k<0?S:-S),P=P+(P<0?y:-y),r&&(u?B>z*M?k=(ho(c,l)?-P:P)/M:P=(ho(c,l)?-k:k)*M:d?(k=P/M,l=c):(P=k*M,c=l));const E=c?p+P:p,A=l?w+k:w;return{width:C+(c?-P:P),height:b+(l?-k:k),x:i[0]*P*(c?-1:1)+E,y:i[1]*k*(l?-1:1)+A}}const Xr={width:0,height:0,x:0,y:0},Ll={...Xr,pointerX:0,pointerY:0,aspectRatio:1};function Hl(t,e,n){const o=e.position.x+t.position.x,r=e.position.y+t.position.y,i=t.measured.width??0,s=t.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Rl({domNode:t,nodeId:e,getStoreItems:n,onChange:o,onEnd:r}){const i=at(t);let s={controlDirection:fo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:d,keepAspectRatio:f,resizeDirection:u,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:x}){let m={...Xr},_={...Ll};s={boundaries:d,resizeDirection:u,keepAspectRatio:f,controlDirection:fo(l)};let p,w=null,C=[],b,M,P;const k=sr().on("start",B=>{const{nodeLookup:z,transform:V,snapGrid:R,snapToGrid:y,nodeOrigin:S,paneDomNode:E}=n();if(p=z.get(e),!p)return;w=(E==null?void 0:E.getBoundingClientRect())??null;const{xSnapped:A,ySnapped:T}=te(B.sourceEvent,{transform:V,snapGrid:R,snapToGrid:y,containerBounds:w});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...m,pointerX:A,pointerY:T,aspectRatio:m.width/m.height},b=void 0,M=Rt(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(b=z.get(p.parentId)),b&&p.extent==="parent"&&(M=[[0,0],[b.measured.width,b.measured.height]]),C=[],P=void 0;for(const[N,D]of z)if(D.parentId===e&&(C.push({id:N,position:{...D.position},extent:D.extent}),D.extent==="parent"||D.expandParent)){const L=Hl(D,p,D.origin??S);P?P=[[Math.min(L[0][0],P[0][0]),Math.min(L[0][1],P[0][1])],[Math.max(L[1][0],P[1][0]),Math.max(L[1][1],P[1][1])]]:P=L}h==null||h(B,{...m})}).on("drag",B=>{const{transform:z,snapGrid:V,snapToGrid:R,nodeOrigin:y}=n(),S=te(B.sourceEvent,{transform:z,snapGrid:V,snapToGrid:R,containerBounds:w}),E=[];if(!p)return;const{x:A,y:T,width:N,height:D}=m,L={},F=p.origin??y,{width:Y,height:j,x:q,y:J}=Dl(_,s.controlDirection,S,s.boundaries,s.keepAspectRatio,F,M,P),G=Y!==N,H=j!==D,O=q!==A&&G,Z=J!==T&&H;if(!O&&!Z&&!G&&!H)return;const U={prevValues:{...m},startX:_.x,startY:_.y,childNodes:C.map(tt=>({...tt,position:{...tt.position}}))};if((O||Z||F[0]===1||F[1]===1)&&(L.x=O?q:m.x,L.y=Z?J:m.y,m.x=L.x,m.y=L.y,C.length>0)){const tt=q-A,et=J-T;for(const ot of C)ot.position={x:ot.position.x-tt+F[0]*(Y-N),y:ot.position.y-et+F[1]*(j-D)},E.push(ot)}if((G||H)&&(L.width=G&&(!s.resizeDirection||s.resizeDirection==="horizontal")?Y:m.width,L.height=H&&(!s.resizeDirection||s.resizeDirection==="vertical")?j:m.height,m.width=L.width,m.height=L.height),b&&p.expandParent){const tt=F[0]*(L.width??0);L.x&&L.x<tt&&(m.x=tt,_.x=_.x-(L.x-tt));const et=F[1]*(L.height??0);L.y&&L.y<et&&(m.y=et,_.y=_.y-(L.y-et))}const X=zl({width:m.width,prevWidth:N,height:m.height,prevHeight:D,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),K={...m,direction:X};if((x==null?void 0:x(B,K))===!1){m=U.prevValues,_.x=U.startX,_.y=U.startY,C.forEach((tt,et)=>{tt.position=U.childNodes[et].position});return}g==null||g(B,K),o(L,E)}).on("end",B=>{v==null||v(B,{...m}),r==null||r({...m})});i.call(k)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var en={exports:{}},nn={},on={exports:{}},rn={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* use-sync-external-store-shim.production.js
|
|
4
4
|
*
|