zenml-nightly 0.83.0.dev20250623__py3-none-any.whl → 0.83.1.dev20250625__py3-none-any.whl
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.
- zenml/VERSION +1 -1
- zenml/cli/login.py +21 -3
- zenml/config/__init__.py +13 -2
- zenml/constants.py +0 -1
- zenml/exceptions.py +16 -0
- zenml/integrations/airflow/orchestrators/airflow_orchestrator.py +15 -6
- zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py +54 -58
- zenml/integrations/azure/orchestrators/azureml_orchestrator.py +28 -19
- zenml/integrations/databricks/orchestrators/databricks_orchestrator.py +19 -63
- zenml/integrations/gcp/orchestrators/vertex_orchestrator.py +36 -61
- zenml/integrations/hyperai/orchestrators/hyperai_orchestrator.py +19 -22
- zenml/integrations/kubeflow/orchestrators/kubeflow_orchestrator.py +28 -31
- zenml/integrations/kubernetes/orchestrators/kubernetes_orchestrator.py +33 -20
- zenml/integrations/lightning/orchestrators/lightning_orchestrator.py +25 -100
- zenml/integrations/skypilot/orchestrators/skypilot_base_vm_orchestrator.py +19 -8
- zenml/integrations/skypilot/utils.py +17 -13
- zenml/integrations/tekton/orchestrators/tekton_orchestrator.py +28 -12
- zenml/models/v2/core/step_run.py +1 -0
- zenml/orchestrators/__init__.py +2 -0
- zenml/orchestrators/base_orchestrator.py +137 -66
- zenml/orchestrators/input_utils.py +5 -13
- zenml/orchestrators/local/local_orchestrator.py +19 -9
- zenml/orchestrators/local_docker/local_docker_orchestrator.py +15 -5
- zenml/orchestrators/publish_utils.py +24 -0
- zenml/orchestrators/step_run_utils.py +1 -2
- zenml/pipelines/run_utils.py +12 -7
- zenml/step_operators/step_operator_entrypoint_configuration.py +1 -1
- zenml/zen_server/dashboard/assets/{404-DmJUgorp.js → 404-B5eko6XL.js} +1 -1
- zenml/zen_server/dashboard/assets/{@reactflow-8OCk19Fi.js → @reactflow-B_iCtR7X.js} +1 -1
- zenml/zen_server/dashboard/assets/{AlertDialogDropdownItem-CZW4QyWn.js → AlertDialogDropdownItem-DsOmO1FH.js} +1 -1
- zenml/zen_server/dashboard/assets/{ButtonGroup-DFWWFGUE.js → ButtonGroup-4sPZDv70.js} +1 -1
- zenml/zen_server/dashboard/assets/{CodeSnippet-D2HkkAGr.js → CodeSnippet-Ctplhzdc.js} +1 -1
- zenml/zen_server/dashboard/assets/{CollapsibleCard-CnS09ljw.js → CollapsibleCard-CBKenz9f.js} +1 -1
- zenml/zen_server/dashboard/assets/{ComponentBadge-CDgdd0Ks.js → ComponentBadge-Cnecw3qz.js} +1 -1
- zenml/zen_server/dashboard/assets/{ComponentIcon-CbbOc7lb.js → ComponentIcon-CMiVW-O6.js} +1 -1
- zenml/zen_server/dashboard/assets/{DeleteAlertDialog-VIOMDLmx.js → DeleteAlertDialog-DEI0YDzP.js} +1 -1
- zenml/zen_server/dashboard/assets/{DialogItem-ClFCqxEp.js → DialogItem-CRCDpYU6.js} +1 -1
- zenml/zen_server/dashboard/assets/{Error-CQzjbDcN.js → Error-BG6f_WRd.js} +1 -1
- zenml/zen_server/dashboard/assets/{ExecutionStatus-CWreILP0.js → ExecutionStatus-BuhNAE9w.js} +1 -1
- zenml/zen_server/dashboard/assets/{Helpbox-CiKxG5_X.js → Helpbox-DtUG2Bf_.js} +1 -1
- zenml/zen_server/dashboard/assets/{Infobox-CGxFvqzi.js → Infobox-CSBRrM6r.js} +1 -1
- zenml/zen_server/dashboard/assets/{LeftSideMenu-DCsKdIjC.js → LeftSideMenu-DPsCCK3z.js} +1 -1
- zenml/zen_server/dashboard/assets/{NestedCollapsible-3M4llYtH.js → NestedCollapsible-CMuDIJlp.js} +1 -1
- zenml/zen_server/dashboard/assets/{NumberBox-C0mQktmV.js → NumberBox-DtCv7jh3.js} +1 -1
- zenml/zen_server/dashboard/assets/Pagination-CWnEpSpN.js +1 -0
- zenml/zen_server/dashboard/assets/{Partials-DSjkttlz.js → Partials-CfHD6OH5.js} +1 -1
- zenml/zen_server/dashboard/assets/{ProCta-Dm5cWKpS.js → ProCta-CNyp04C8.js} +1 -1
- zenml/zen_server/dashboard/assets/{ProviderIcon-DPwMR6nF.js → ProviderIcon-DHejyg7C.js} +1 -1
- zenml/zen_server/dashboard/assets/{ProviderRadio-DEDNRgAb.js → ProviderRadio-tGtie8Gc.js} +1 -1
- zenml/zen_server/dashboard/assets/RunsBody-mYwMcWWj.js +1 -0
- zenml/zen_server/dashboard/assets/SearchField-BtUi6cYl.js +1 -0
- zenml/zen_server/dashboard/assets/{SecretTooltip-CZTRnaCV.js → SecretTooltip-B5u1UsQ9.js} +1 -1
- zenml/zen_server/dashboard/assets/{SetPassword-BjNGDC5e.js → SetPassword-BmbgL_ed.js} +1 -1
- zenml/zen_server/dashboard/assets/{SheetHeader-CASpN2Lz.js → SheetHeader-DkH7aG9K.js} +1 -1
- zenml/zen_server/dashboard/assets/StackComponentList-Bi8BKqCu.js +1 -0
- zenml/zen_server/dashboard/assets/StackList-Cvxapo0p.js +1 -0
- zenml/zen_server/dashboard/assets/{StackName-ojLC6xdl.js → StackName-CFSZL8ec.js} +1 -1
- zenml/zen_server/dashboard/assets/Tabs-D4dv48ry.js +1 -0
- zenml/zen_server/dashboard/assets/{Tick-BPrWnNlN.js → Tick-Qquvr4P3.js} +1 -1
- zenml/zen_server/dashboard/assets/{UpdatePasswordSchemas-CNfKDo2Q.js → UpdatePasswordSchemas-D_DCETSO.js} +1 -1
- zenml/zen_server/dashboard/assets/{UsageReason-Cb-mpV8M.js → UsageReason-DhiUV1bu.js} +1 -1
- zenml/zen_server/dashboard/assets/{Wizard-Dg8Pmn5A.js → Wizard-BHvY75u_.js} +1 -1
- zenml/zen_server/dashboard/assets/{WizardFooter-BcNDIvlQ.js → WizardFooter-FQm8y-jP.js} +1 -1
- zenml/zen_server/dashboard/assets/{all-pipeline-runs-query-DCdax7I5.js → all-pipeline-runs-query-DpKw9WL9.js} +1 -1
- zenml/zen_server/dashboard/assets/{bulk-delete-C_kpIB9A.js → bulk-delete-CzYA--cC.js} +1 -1
- zenml/zen_server/dashboard/assets/{configuration-form-B2hmKGnF.js → configuration-form-DSoMMiPE.js} +1 -1
- zenml/zen_server/dashboard/assets/{constants-1EZZxtay.js → constants-DTfsIqHy.js} +1 -1
- zenml/zen_server/dashboard/assets/{create-stack-TKmMtrkQ.js → create-stack-BpZrmKDu.js} +1 -1
- zenml/zen_server/dashboard/assets/{delete-run-CCR9md_s.js → delete-run-BkyDsKQc.js} +1 -1
- zenml/zen_server/dashboard/assets/elk-worker.min-BdOC9sib.js +6263 -0
- zenml/zen_server/dashboard/assets/expand-full-BPiXpch2.js +1 -0
- zenml/zen_server/dashboard/assets/{form-DFJkaFDX.js → form-BgtamtJm.js} +1 -1
- zenml/zen_server/dashboard/assets/{form-schemas-CrznJVzA.js → form-schemas-dyDkAxXP.js} +1 -1
- zenml/zen_server/dashboard/assets/{index-BjUu1mP4.js → index-BBt0LDtR.js} +1 -1
- zenml/zen_server/dashboard/assets/index-BfNISy0X.css +1 -0
- zenml/zen_server/dashboard/assets/{index-BFqbGSck.js → index-BgEfQ3_G.js} +4 -4
- zenml/zen_server/dashboard/assets/{index-U992soPJ.js → index-eoDB_1XX.js} +1 -1
- zenml/zen_server/dashboard/assets/{layout-Do9YI4QX.js → layout-o1x87a3q.js} +1 -1
- zenml/zen_server/dashboard/assets/{login-mutation-D3tFP6Wm.js → login-mutation-C1hvP_cX.js} +1 -1
- zenml/zen_server/dashboard/assets/page-4xUZpMN0.js +31 -0
- zenml/zen_server/dashboard/assets/page-4zc4xPv2.js +2 -0
- zenml/zen_server/dashboard/assets/page-B0104V6C.js +1 -0
- zenml/zen_server/dashboard/assets/page-BNJsjvof.js +1 -0
- zenml/zen_server/dashboard/assets/{page-sJjNT9xA.js → page-BPQ66vR-.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-CAJ8B0vb.js → page-BQgSZ2nH.js} +1 -1
- zenml/zen_server/dashboard/assets/page-BXl2ZX6J.js +1 -0
- zenml/zen_server/dashboard/assets/{page-CtiuMP_r.js → page-BxeZrG_t.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-Cal6XQ4U.js → page-C2A-2Cj_.js} +1 -1
- zenml/zen_server/dashboard/assets/page-C2i-C7jv.js +1 -0
- zenml/zen_server/dashboard/assets/{page-DJIGaUQ9.js → page-C3JfJxuR.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-ChGcZI_6.js → page-CESEqC2L.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-DCcuPZ8P.js → page-CF8cTZ7l.js} +1 -1
- zenml/zen_server/dashboard/assets/page-CKjsimVu.js +1 -0
- zenml/zen_server/dashboard/assets/{page-DNjKHjnH.js → page-COLzBwff.js} +1 -1
- zenml/zen_server/dashboard/assets/page-COifg5fa.js +1 -0
- zenml/zen_server/dashboard/assets/{page-CnbIYE80.js → page-CQeJuA8T.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-DKK6ulgy.js → page-CcjWEjre.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-9RjCitFH.js → page-CefGLeWy.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-DUKbOhaD.js → page-CfxpV3j4.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-D9Hfx6GV.js → page-ClcUzawe.js} +1 -1
- zenml/zen_server/dashboard/assets/page-Ct_LB3zo.js +1 -0
- zenml/zen_server/dashboard/assets/page-D-ZWUMYY.js +1 -0
- zenml/zen_server/dashboard/assets/{page-CUaMMoPG.js → page-D-tJ_Y0a.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-CdZCmszX.js → page-DHrvih9u.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-DUK0Nd_1.js → page-DMhaHZDw.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-CAUYrfui.js → page-DOCOmmKn.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-akLcPcKw.js → page-DcQmxKLp.js} +1 -1
- zenml/zen_server/dashboard/assets/page-Dh4GRWw5.js +1 -0
- zenml/zen_server/dashboard/assets/{page-DwVPpCFg.js → page-DiHZK-1w.js} +1 -1
- zenml/zen_server/dashboard/assets/page-Dn7ZNapg.js +1 -0
- zenml/zen_server/dashboard/assets/page-Dy4vSQY7.js +1 -0
- zenml/zen_server/dashboard/assets/{page-CN7lkvXr.js → page-QrvWQwZb.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-BrT0_zSJ.js → page-RF3Fup0q.js} +1 -1
- zenml/zen_server/dashboard/assets/page-WuvCrN47.js +1 -0
- zenml/zen_server/dashboard/assets/{page-Be3R2uYn.js → page-_WnHBI1F.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-C210HcBA.js → page-ghjVNgVE.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-BCrKmYIZ.js → page-iDsDiDXw.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-ClvmVesa.js → page-rVhXI5ZO.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-DEohTSz6.js → page-uxjMX8Iq.js} +1 -1
- zenml/zen_server/dashboard/assets/{persist-Dec_w7aB.js → persist-BsdEtCkd.js} +1 -1
- zenml/zen_server/dashboard/assets/{persist-DWMWVP-y.js → persist-CFPbMcJX.js} +1 -1
- zenml/zen_server/dashboard/assets/{resource-tyes-list-o2LXiMay.js → resource-tyes-list-79FqS3LY.js} +1 -1
- zenml/zen_server/dashboard/assets/{resource-type-tooltip-DwHrJstL.js → resource-type-tooltip-BL9ZTRKi.js} +1 -1
- zenml/zen_server/dashboard/assets/{service-connectors-DSEMwJ5A.js → service-connectors-Q8h7-_rG.js} +1 -1
- zenml/zen_server/dashboard/assets/{service-jxtvgks0.js → service-k-9Vsb30.js} +1 -1
- zenml/zen_server/dashboard/assets/{sharedSchema-BXzg0EZz.js → sharedSchema-C_HkejsG.js} +1 -1
- zenml/zen_server/dashboard/assets/{stack-detail-query-Cm0fsgo-.js → stack-detail-query-CNmVZ0Bo.js} +1 -1
- zenml/zen_server/dashboard/assets/{update-current-user-mutation-D5MjcQ6F.js → update-current-user-mutation-Ca-Lmwuj.js} +1 -1
- zenml/zen_server/dashboard/assets/{update-server-settings-mutation-CmnxdxiK.js → update-server-settings-mutation-Bwe3gUt4.js} +1 -1
- zenml/zen_server/dashboard/index.html +4 -4
- zenml/zen_stores/migrations/versions/0.83.1_release.py +23 -0
- zenml/zen_stores/rest_zen_store.py +147 -128
- zenml/zen_stores/sql_zen_store.py +27 -17
- {zenml_nightly-0.83.0.dev20250623.dist-info → zenml_nightly-0.83.1.dev20250625.dist-info}/METADATA +5 -9
- {zenml_nightly-0.83.0.dev20250623.dist-info → zenml_nightly-0.83.1.dev20250625.dist-info}/RECORD +138 -134
- zenml/zen_server/dashboard/assets/RunsBody-BRBn1e2O.js +0 -1
- zenml/zen_server/dashboard/assets/SearchField-DY6-UbRT.js +0 -1
- zenml/zen_server/dashboard/assets/StackComponentList-Be1pQt9m.js +0 -1
- zenml/zen_server/dashboard/assets/StackList-BdiR5DvR.js +0 -1
- zenml/zen_server/dashboard/assets/Tabs-DNSKblCM.js +0 -1
- zenml/zen_server/dashboard/assets/index-DuhuqTCI.css +0 -1
- zenml/zen_server/dashboard/assets/page-B0PsXWiT.js +0 -1
- zenml/zen_server/dashboard/assets/page-BcRI3-aR.js +0 -29
- zenml/zen_server/dashboard/assets/page-BgknnddT.js +0 -1
- zenml/zen_server/dashboard/assets/page-Bs3W2FDi.js +0 -1
- zenml/zen_server/dashboard/assets/page-C6KaiZ_W.js +0 -1
- zenml/zen_server/dashboard/assets/page-CHxVhF3x.js +0 -1
- zenml/zen_server/dashboard/assets/page-CktmtZ8Z.js +0 -1
- zenml/zen_server/dashboard/assets/page-CoXzjeEY.js +0 -1
- zenml/zen_server/dashboard/assets/page-D9iuB88h.js +0 -1
- zenml/zen_server/dashboard/assets/page-DYOucPtA.js +0 -1
- zenml/zen_server/dashboard/assets/page-DpqRelAy.js +0 -1
- zenml/zen_server/dashboard/assets/page-XURWnYZP.js +0 -1
- zenml/zen_server/dashboard/assets/page-abw-2oeW.js +0 -1
- zenml/zen_server/dashboard/assets/page-n9ejQ2V3.js +0 -2
- {zenml_nightly-0.83.0.dev20250623.dist-info → zenml_nightly-0.83.1.dev20250625.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.83.0.dev20250623.dist-info → zenml_nightly-0.83.1.dev20250625.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.83.0.dev20250623.dist-info → zenml_nightly-0.83.1.dev20250625.dist-info}/entry_points.txt +0 -0
@@ -14,4 +14,4 @@ import{b as to,g as ts,c as R,r as E}from"./@radix-Cdvw4jJ8.js";function ft(t){i
|
|
14
14
|
*
|
15
15
|
* This source code is licensed under the MIT license found in the
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
17
|
-
*/var ur;function rs(){if(ur)return dn;ur=1;var t=to(),e=ns();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,a=t.useDebugValue;return dn.useSyncExternalStoreWithSelector=function(l,u,f,h,g){var x=s(null);if(x.current===null){var p={hasValue:!1,value:null};x.current=p}else p=x.current;x=c(function(){function m(C){if(!b){if(b=!0,N=C,C=h(C),g!==void 0&&p.hasValue){var z=p.value;if(g(z,C))return y=z}return y=C}if(z=y,r(N,C))return z;var H=h(C);return g!==void 0&&g(z,H)?z:(N=C,y=H)}var b=!1,N,y,M=f===void 0?null:f;return[function(){return m(u())},M===null?void 0:function(){return m(M())}]},[u,f,h,g]);var _=o(l,x[0],x[1]);return i(function(){p.hasValue=!0,p.value=_},[_]),a(_),_},dn}var lr;function os(){return lr||(lr=1,fn.exports=rs()),fn.exports}var is=os();const ss=ts(is),cs={},fr=t=>{let e;const n=new Set,r=(u,f)=>{const h=typeof u=="function"?u(e):u;if(!Object.is(h,e)){const g=e;e=f??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(x=>x(e,g))}},o=()=>e,a={setState:r,getState:o,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(cs?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=e=t(r,o,a);return a},as=t=>t?fr(t):fr,{useDebugValue:us}=R,{useSyncExternalStoreWithSelector:ls}=ss,fs=t=>t;function eo(t,e=fs,n){const r=ls(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return us(r),r}const dr=(t,e)=>{const n=as(t),r=(o,s=e)=>eo(n,o,s);return Object.assign(r,n),r},ds=(t,e)=>t?dr(t,e):dr;function ot(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,o]of t)if(!Object.is(o,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}var hs={value:()=>{}};function en(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Fe(n)}function Fe(t){this._=t}function gs(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Fe.prototype=en.prototype={constructor:Fe,on:function(t,e){var n=this._,r=gs(t+"",n),o,s=-1,i=r.length;if(arguments.length<2){for(;++s<i;)if((o=(t=r[s]).type)&&(o=ps(n[o],t.name)))return o;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<i;)if(o=(t=r[s]).type)n[o]=hr(n[o],t.name,e);else if(e==null)for(o in n)n[o]=hr(n[o],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Fe(t)},call:function(t,e){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,s;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],r=0,o=s.length;r<o;++r)s[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,s=r.length;o<s;++o)r[o].value.apply(e,n)}};function ps(t,e){for(var n=0,r=t.length,o;n<r;++n)if((o=t[n]).name===e)return o.value}function hr(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=hs,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var En="http://www.w3.org/1999/xhtml";const gr={svg:"http://www.w3.org/2000/svg",xhtml:En,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nn(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),gr.hasOwnProperty(e)?{space:gr[e],local:t}:t}function ms(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===En&&e.documentElement.namespaceURI===En?e.createElement(t):e.createElementNS(n,t)}}function ys(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function no(t){var e=nn(t);return(e.local?ys:ms)(e)}function xs(){}function Bn(t){return t==null?xs:function(){return this.querySelector(t)}}function ws(t){typeof t!="function"&&(t=Bn(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var s=e[o],i=s.length,c=r[o]=new Array(i),a,l,u=0;u<i;++u)(a=s[u])&&(l=t.call(a,a.__data__,u,s))&&("__data__"in a&&(l.__data__=a.__data__),c[u]=l);return new ct(r,this._parents)}function vs(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function _s(){return[]}function ro(t){return t==null?_s:function(){return this.querySelectorAll(t)}}function bs(t){return function(){return vs(t.apply(this,arguments))}}function Ss(t){typeof t=="function"?t=bs(t):t=ro(t);for(var e=this._groups,n=e.length,r=[],o=[],s=0;s<n;++s)for(var i=e[s],c=i.length,a,l=0;l<c;++l)(a=i[l])&&(r.push(t.call(a,a.__data__,l,i)),o.push(a));return new ct(r,o)}function oo(t){return function(){return this.matches(t)}}function io(t){return function(e){return e.matches(t)}}var Es=Array.prototype.find;function Ns(t){return function(){return Es.call(this.children,t)}}function As(){return this.firstElementChild}function Ms(t){return this.select(t==null?As:Ns(typeof t=="function"?t:io(t)))}var $s=Array.prototype.filter;function Ts(){return Array.from(this.children)}function Cs(t){return function(){return $s.call(this.children,t)}}function ks(t){return this.selectAll(t==null?Ts:Cs(typeof t=="function"?t:io(t)))}function Is(t){typeof t!="function"&&(t=oo(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var s=e[o],i=s.length,c=r[o]=[],a,l=0;l<i;++l)(a=s[l])&&t.call(a,a.__data__,l,s)&&c.push(a);return new ct(r,this._parents)}function so(t){return new Array(t.length)}function Rs(){return new ct(this._enter||this._groups.map(so),this._parents)}function qe(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}qe.prototype={constructor:qe,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 zs(t){return function(){return t}}function Ds(t,e,n,r,o,s){for(var i=0,c,a=e.length,l=s.length;i<l;++i)(c=e[i])?(c.__data__=s[i],r[i]=c):n[i]=new qe(t,s[i]);for(;i<a;++i)(c=e[i])&&(o[i]=c)}function Ps(t,e,n,r,o,s,i){var c,a,l=new Map,u=e.length,f=s.length,h=new Array(u),g;for(c=0;c<u;++c)(a=e[c])&&(h[c]=g=i.call(a,a.__data__,c,e)+"",l.has(g)?o[c]=a:l.set(g,a));for(c=0;c<f;++c)g=i.call(t,s[c],c,s)+"",(a=l.get(g))?(r[c]=a,a.__data__=s[c],l.delete(g)):n[c]=new qe(t,s[c]);for(c=0;c<u;++c)(a=e[c])&&l.get(h[c])===a&&(o[c]=a)}function Hs(t){return t.__data__}function Ls(t,e){if(!arguments.length)return Array.from(this,Hs);var n=e?Ps:Ds,r=this._parents,o=this._groups;typeof t!="function"&&(t=zs(t));for(var s=o.length,i=new Array(s),c=new Array(s),a=new Array(s),l=0;l<s;++l){var u=r[l],f=o[l],h=f.length,g=Vs(t.call(u,u&&u.__data__,l,r)),x=g.length,p=c[l]=new Array(x),_=i[l]=new Array(x),m=a[l]=new Array(h);n(u,f,p,_,m,g,e);for(var b=0,N=0,y,M;b<x;++b)if(y=p[b]){for(b>=N&&(N=b+1);!(M=_[N])&&++N<x;);y._next=M||null}}return i=new ct(i,r),i._enter=c,i._exit=a,i}function Vs(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Bs(){return new ct(this._exit||this._groups.map(so),this._parents)}function Fs(t,e,n){var r=this.enter(),o=this,s=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(o=e(o),o&&(o=o.selection())),n==null?s.remove():n(s),r&&o?r.merge(o).order():o}function Os(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,s=r.length,i=Math.min(o,s),c=new Array(o),a=0;a<i;++a)for(var l=n[a],u=r[a],f=l.length,h=c[a]=new Array(f),g,x=0;x<f;++x)(g=l[x]||u[x])&&(h[x]=g);for(;a<o;++a)c[a]=n[a];return new ct(c,this._parents)}function Xs(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],o=r.length-1,s=r[o],i;--o>=0;)(i=r[o])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Ys(t){t||(t=qs);function e(f,h){return f&&h?t(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,o=new Array(r),s=0;s<r;++s){for(var i=n[s],c=i.length,a=o[s]=new Array(c),l,u=0;u<c;++u)(l=i[u])&&(a[u]=l);a.sort(e)}return new ct(o,this._parents).order()}function qs(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Us(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Ws(){return Array.from(this)}function Zs(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,s=r.length;o<s;++o){var i=r[o];if(i)return i}return null}function Gs(){let t=0;for(const e of this)++t;return t}function Ks(){return!this.node()}function Qs(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],s=0,i=o.length,c;s<i;++s)(c=o[s])&&t.call(c,c.__data__,s,o);return this}function Js(t){return function(){this.removeAttribute(t)}}function js(t){return function(){this.removeAttributeNS(t.space,t.local)}}function tc(t,e){return function(){this.setAttribute(t,e)}}function ec(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function nc(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function rc(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 oc(t,e){var n=nn(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?js:Js:typeof e=="function"?n.local?rc:nc:n.local?ec:tc)(n,e))}function co(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ic(t){return function(){this.style.removeProperty(t)}}function sc(t,e,n){return function(){this.style.setProperty(t,e,n)}}function cc(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function ac(t,e,n){return arguments.length>1?this.each((e==null?ic:typeof e=="function"?cc:sc)(t,e,n??"")):ae(this.node(),t)}function ae(t,e){return t.style.getPropertyValue(e)||co(t).getComputedStyle(t,null).getPropertyValue(e)}function uc(t){return function(){delete this[t]}}function lc(t,e){return function(){this[t]=e}}function fc(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function dc(t,e){return arguments.length>1?this.each((e==null?uc:typeof e=="function"?fc:lc)(t,e)):this.node()[t]}function ao(t){return t.trim().split(/^|\s+/)}function Fn(t){return t.classList||new uo(t)}function uo(t){this._node=t,this._names=ao(t.getAttribute("class")||"")}uo.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 lo(t,e){for(var n=Fn(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function fo(t,e){for(var n=Fn(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function hc(t){return function(){lo(this,t)}}function gc(t){return function(){fo(this,t)}}function pc(t,e){return function(){(e.apply(this,arguments)?lo:fo)(this,t)}}function mc(t,e){var n=ao(t+"");if(arguments.length<2){for(var r=Fn(this.node()),o=-1,s=n.length;++o<s;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof e=="function"?pc:e?hc:gc)(n,e))}function yc(){this.textContent=""}function xc(t){return function(){this.textContent=t}}function wc(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function vc(t){return arguments.length?this.each(t==null?yc:(typeof t=="function"?wc:xc)(t)):this.node().textContent}function _c(){this.innerHTML=""}function bc(t){return function(){this.innerHTML=t}}function Sc(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ec(t){return arguments.length?this.each(t==null?_c:(typeof t=="function"?Sc:bc)(t)):this.node().innerHTML}function Nc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ac(){return this.each(Nc)}function Mc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $c(){return this.each(Mc)}function Tc(t){var e=typeof t=="function"?t:no(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Cc(){return null}function kc(t,e){var n=typeof t=="function"?t:no(t),r=e==null?Cc:typeof e=="function"?e:Bn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Ic(){var t=this.parentNode;t&&t.removeChild(this)}function Rc(){return this.each(Ic)}function zc(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Dc(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Pc(t){return this.select(t?Dc:zc)}function Hc(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Lc(t){return function(e){t.call(this,e,this.__data__)}}function Vc(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function Bc(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,o=e.length,s;n<o;++n)s=e[n],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++r]=s;++r?e.length=r:delete this.__on}}}function Fc(t,e,n){return function(){var r=this.__on,o,s=Lc(e);if(r){for(var i=0,c=r.length;i<c;++i)if((o=r[i]).type===t.type&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=s,o.options=n),o.value=e;return}}this.addEventListener(t.type,s,n),o={type:t.type,name:t.name,value:e,listener:s,options:n},r?r.push(o):this.__on=[o]}}function Oc(t,e,n){var r=Vc(t+""),o,s=r.length,i;if(arguments.length<2){var c=this.node().__on;if(c){for(var a=0,l=c.length,u;a<l;++a)for(o=0,u=c[a];o<s;++o)if((i=r[o]).type===u.type&&i.name===u.name)return u.value}return}for(c=e?Fc:Bc,o=0;o<s;++o)this.each(c(r[o],e,n));return this}function ho(t,e,n){var r=co(t),o=r.CustomEvent;typeof o=="function"?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function Xc(t,e){return function(){return ho(this,t,e)}}function Yc(t,e){return function(){return ho(this,t,e.apply(this,arguments))}}function qc(t,e){return this.each((typeof e=="function"?Yc:Xc)(t,e))}function*Uc(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,s=r.length,i;o<s;++o)(i=r[o])&&(yield i)}var go=[null];function ct(t,e){this._groups=t,this._parents=e}function Te(){return new ct([[document.documentElement]],go)}function Wc(){return this}ct.prototype=Te.prototype={constructor:ct,select:ws,selectAll:Ss,selectChild:Ms,selectChildren:ks,filter:Is,data:Ls,enter:Rs,exit:Bs,join:Fs,merge:Os,selection:Wc,order:Xs,sort:Ys,call:Us,nodes:Ws,node:Zs,size:Gs,empty:Ks,each:Qs,attr:oc,style:ac,property:dc,classed:mc,text:vc,html:Ec,raise:Ac,lower:$c,append:Tc,insert:kc,remove:Rc,clone:Pc,datum:Hc,on:Oc,dispatch:qc,[Symbol.iterator]:Uc};function pt(t){return typeof t=="string"?new ct([[document.querySelector(t)]],[document.documentElement]):new ct([[t]],go)}function Zc(t){let e;for(;e=t.sourceEvent;)t=e;return t}function vt(t,e){if(t=Zc(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]}const Gc={passive:!1},be={capture:!0,passive:!1};function pn(t){t.stopImmediatePropagation()}function oe(t){t.preventDefault(),t.stopImmediatePropagation()}function po(t){var e=t.document.documentElement,n=pt(t).on("dragstart.drag",oe,be);"onselectstart"in e?n.on("selectstart.drag",oe,be):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function mo(t,e){var n=t.document.documentElement,r=pt(t).on("dragstart.drag",null);e&&(r.on("click.drag",oe,be),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Ie=t=>()=>t;function Nn(t,{sourceEvent:e,subject:n,target:r,identifier:o,active:s,x:i,y:c,dx:a,dy:l,dispatch:u}){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:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Nn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Kc(t){return!t.ctrlKey&&!t.button}function Qc(){return this.parentNode}function Jc(t,e){return e??{x:t.x,y:t.y}}function jc(){return navigator.maxTouchPoints||"ontouchstart"in this}function ta(){var t=Kc,e=Qc,n=Jc,r=jc,o={},s=en("start","drag","end"),i=0,c,a,l,u,f=0;function h(y){y.on("mousedown.drag",g).filter(r).on("touchstart.drag",_).on("touchmove.drag",m,Gc).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(y,M){if(!(u||!t.call(this,y,M))){var C=N(this,e.call(this,y,M),y,M,"mouse");C&&(pt(y.view).on("mousemove.drag",x,be).on("mouseup.drag",p,be),po(y.view),pn(y),l=!1,c=y.clientX,a=y.clientY,C("start",y))}}function x(y){if(oe(y),!l){var M=y.clientX-c,C=y.clientY-a;l=M*M+C*C>f}o.mouse("drag",y)}function p(y){pt(y.view).on("mousemove.drag mouseup.drag",null),mo(y.view,l),oe(y),o.mouse("end",y)}function _(y,M){if(t.call(this,y,M)){var C=y.changedTouches,z=e.call(this,y,M),H=C.length,T,L;for(T=0;T<H;++T)(L=N(this,z,y,M,C[T].identifier,C[T]))&&(pn(y),L("start",y,C[T]))}}function m(y){var M=y.changedTouches,C=M.length,z,H;for(z=0;z<C;++z)(H=o[M[z].identifier])&&(oe(y),H("drag",y,M[z]))}function b(y){var M=y.changedTouches,C=M.length,z,H;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),z=0;z<C;++z)(H=o[M[z].identifier])&&(pn(y),H("end",y,M[z]))}function N(y,M,C,z,H,T){var L=s.copy(),P=vt(T||C,M),B,V,d;if((d=n.call(y,new Nn("beforestart",{sourceEvent:C,target:h,identifier:H,active:i,x:P[0],y:P[1],dx:0,dy:0,dispatch:L}),z))!=null)return B=d.x-P[0]||0,V=d.y-P[1]||0,function S(v,$,k){var w=P,A;switch(v){case"start":o[H]=S,A=i++;break;case"end":delete o[H],--i;case"drag":P=vt(k||$,M),A=i;break}L.call(v,y,new Nn(v,{sourceEvent:$,subject:d,target:h,identifier:H,active:A,x:P[0]+B,y:P[1]+V,dx:P[0]-w[0],dy:P[1]-w[1],dispatch:L}),z)}}return h.filter=function(y){return arguments.length?(t=typeof y=="function"?y:Ie(!!y),h):t},h.container=function(y){return arguments.length?(e=typeof y=="function"?y:Ie(y),h):e},h.subject=function(y){return arguments.length?(n=typeof y=="function"?y:Ie(y),h):n},h.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:Ie(!!y),h):r},h.on=function(){var y=s.on.apply(s,arguments);return y===s?h:y},h.clickDistance=function(y){return arguments.length?(f=(y=+y)*y,h):Math.sqrt(f)},h}function On(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function yo(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Ce(){}var Se=.7,Ue=1/Se,ie="\\s*([+-]?\\d+)\\s*",Ee="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_t="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ea=/^#([0-9a-f]{3,8})$/,na=new RegExp(`^rgb\\(${ie},${ie},${ie}\\)$`),ra=new RegExp(`^rgb\\(${_t},${_t},${_t}\\)$`),oa=new RegExp(`^rgba\\(${ie},${ie},${ie},${Ee}\\)$`),ia=new RegExp(`^rgba\\(${_t},${_t},${_t},${Ee}\\)$`),sa=new RegExp(`^hsl\\(${Ee},${_t},${_t}\\)$`),ca=new RegExp(`^hsla\\(${Ee},${_t},${_t},${Ee}\\)$`),pr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};On(Ce,Ne,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:mr,formatHex:mr,formatHex8:aa,formatHsl:ua,formatRgb:yr,toString:yr});function mr(){return this.rgb().formatHex()}function aa(){return this.rgb().formatHex8()}function ua(){return xo(this).formatHsl()}function yr(){return this.rgb().formatRgb()}function Ne(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ea.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?xr(e):n===3?new it(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Re(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Re(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=na.exec(t))?new it(e[1],e[2],e[3],1):(e=ra.exec(t))?new it(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=oa.exec(t))?Re(e[1],e[2],e[3],e[4]):(e=ia.exec(t))?Re(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=sa.exec(t))?_r(e[1],e[2]/100,e[3]/100,1):(e=ca.exec(t))?_r(e[1],e[2]/100,e[3]/100,e[4]):pr.hasOwnProperty(t)?xr(pr[t]):t==="transparent"?new it(NaN,NaN,NaN,0):null}function xr(t){return new it(t>>16&255,t>>8&255,t&255,1)}function Re(t,e,n,r){return r<=0&&(t=e=n=NaN),new it(t,e,n,r)}function la(t){return t instanceof Ce||(t=Ne(t)),t?(t=t.rgb(),new it(t.r,t.g,t.b,t.opacity)):new it}function An(t,e,n,r){return arguments.length===1?la(t):new it(t,e,n,r??1)}function it(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}On(it,An,yo(Ce,{brighter(t){return t=t==null?Ue:Math.pow(Ue,t),new it(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Se:Math.pow(Se,t),new it(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new it(qt(this.r),qt(this.g),qt(this.b),We(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:wr,formatHex:wr,formatHex8:fa,formatRgb:vr,toString:vr}));function wr(){return`#${Xt(this.r)}${Xt(this.g)}${Xt(this.b)}`}function fa(){return`#${Xt(this.r)}${Xt(this.g)}${Xt(this.b)}${Xt((isNaN(this.opacity)?1:this.opacity)*255)}`}function vr(){const t=We(this.opacity);return`${t===1?"rgb(":"rgba("}${qt(this.r)}, ${qt(this.g)}, ${qt(this.b)}${t===1?")":`, ${t})`}`}function We(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function qt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Xt(t){return t=qt(t),(t<16?"0":"")+t.toString(16)}function _r(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new mt(t,e,n,r)}function xo(t){if(t instanceof mt)return new mt(t.h,t.s,t.l,t.opacity);if(t instanceof Ce||(t=Ne(t)),!t)return new mt;if(t instanceof mt)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),s=Math.max(e,n,r),i=NaN,c=s-o,a=(s+o)/2;return c?(e===s?i=(n-r)/c+(n<r)*6:n===s?i=(r-e)/c+2:i=(e-n)/c+4,c/=a<.5?s+o:2-s-o,i*=60):c=a>0&&a<1?0:i,new mt(i,c,a,t.opacity)}function da(t,e,n,r){return arguments.length===1?xo(t):new mt(t,e,n,r??1)}function mt(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}On(mt,da,yo(Ce,{brighter(t){return t=t==null?Ue:Math.pow(Ue,t),new mt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Se:Math.pow(Se,t),new mt(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new it(mn(t>=240?t-240:t+120,o,r),mn(t,o,r),mn(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new mt(br(this.h),ze(this.s),ze(this.l),We(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=We(this.opacity);return`${t===1?"hsl(":"hsla("}${br(this.h)}, ${ze(this.s)*100}%, ${ze(this.l)*100}%${t===1?")":`, ${t})`}`}}));function br(t){return t=(t||0)%360,t<0?t+360:t}function ze(t){return Math.max(0,Math.min(1,t||0))}function mn(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const wo=t=>()=>t;function ha(t,e){return function(n){return t+n*e}}function ga(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function pa(t){return(t=+t)==1?vo:function(e,n){return n-e?ga(e,n,t):wo(isNaN(e)?n:e)}}function vo(t,e){var n=e-t;return n?ha(t,n):wo(isNaN(t)?e:t)}const Sr=function t(e){var n=pa(e);function r(o,s){var i=n((o=An(o)).r,(s=An(s)).r),c=n(o.g,s.g),a=n(o.b,s.b),l=vo(o.opacity,s.opacity);return function(u){return o.r=i(u),o.g=c(u),o.b=a(u),o.opacity=l(u),o+""}}return r.gamma=t,r}(1);function Ct(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Mn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yn=new RegExp(Mn.source,"g");function ma(t){return function(){return t}}function ya(t){return function(e){return t(e)+""}}function xa(t,e){var n=Mn.lastIndex=yn.lastIndex=0,r,o,s,i=-1,c=[],a=[];for(t=t+"",e=e+"";(r=Mn.exec(t))&&(o=yn.exec(e));)(s=o.index)>n&&(s=e.slice(n,s),c[i]?c[i]+=s:c[++i]=s),(r=r[0])===(o=o[0])?c[i]?c[i]+=o:c[++i]=o:(c[++i]=null,a.push({i,x:Ct(r,o)})),n=yn.lastIndex;return n<e.length&&(s=e.slice(n),c[i]?c[i]+=s:c[++i]=s),c.length<2?a[0]?ya(a[0].x):ma(e):(e=a.length,function(l){for(var u=0,f;u<e;++u)c[(f=a[u]).i]=f.x(l);return c.join("")})}var Er=180/Math.PI,$n={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _o(t,e,n,r,o,s){var i,c,a;return(i=Math.sqrt(t*t+e*e))&&(t/=i,e/=i),(a=t*n+e*r)&&(n-=t*a,r-=e*a),(c=Math.sqrt(n*n+r*r))&&(n/=c,r/=c,a/=c),t*r<e*n&&(t=-t,e=-e,a=-a,i=-i),{translateX:o,translateY:s,rotate:Math.atan2(e,t)*Er,skewX:Math.atan(a)*Er,scaleX:i,scaleY:c}}var De;function wa(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?$n:_o(e.a,e.b,e.c,e.d,e.e,e.f)}function va(t){return t==null||(De||(De=document.createElementNS("http://www.w3.org/2000/svg","g")),De.setAttribute("transform",t),!(t=De.transform.baseVal.consolidate()))?$n:(t=t.matrix,_o(t.a,t.b,t.c,t.d,t.e,t.f))}function bo(t,e,n,r){function o(l){return l.length?l.pop()+" ":""}function s(l,u,f,h,g,x){if(l!==f||u!==h){var p=g.push("translate(",null,e,null,n);x.push({i:p-4,x:Ct(l,f)},{i:p-2,x:Ct(u,h)})}else(f||h)&&g.push("translate("+f+e+h+n)}function i(l,u,f,h){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),h.push({i:f.push(o(f)+"rotate(",null,r)-2,x:Ct(l,u)})):u&&f.push(o(f)+"rotate("+u+r)}function c(l,u,f,h){l!==u?h.push({i:f.push(o(f)+"skewX(",null,r)-2,x:Ct(l,u)}):u&&f.push(o(f)+"skewX("+u+r)}function a(l,u,f,h,g,x){if(l!==f||u!==h){var p=g.push(o(g)+"scale(",null,",",null,")");x.push({i:p-4,x:Ct(l,f)},{i:p-2,x:Ct(u,h)})}else(f!==1||h!==1)&&g.push(o(g)+"scale("+f+","+h+")")}return function(l,u){var f=[],h=[];return l=t(l),u=t(u),s(l.translateX,l.translateY,u.translateX,u.translateY,f,h),i(l.rotate,u.rotate,f,h),c(l.skewX,u.skewX,f,h),a(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,h),l=u=null,function(g){for(var x=-1,p=h.length,_;++x<p;)f[(_=h[x]).i]=_.x(g);return f.join("")}}}var _a=bo(wa,"px, ","px)","deg)"),ba=bo(va,", ",")",")"),Sa=1e-12;function Nr(t){return((t=Math.exp(t))+1/t)/2}function Ea(t){return((t=Math.exp(t))-1/t)/2}function Na(t){return((t=Math.exp(2*t))-1)/(t+1)}const Aa=function t(e,n,r){function o(s,i){var c=s[0],a=s[1],l=s[2],u=i[0],f=i[1],h=i[2],g=u-c,x=f-a,p=g*g+x*x,_,m;if(p<Sa)m=Math.log(h/l)/e,_=function(z){return[c+z*g,a+z*x,l*Math.exp(e*z*m)]};else{var b=Math.sqrt(p),N=(h*h-l*l+r*p)/(2*l*n*b),y=(h*h-l*l-r*p)/(2*h*n*b),M=Math.log(Math.sqrt(N*N+1)-N),C=Math.log(Math.sqrt(y*y+1)-y);m=(C-M)/e,_=function(z){var H=z*m,T=Nr(M),L=l/(n*b)*(T*Na(e*H+M)-Ea(M));return[c+L*g,a+L*x,l*T/Nr(e*H+M)]}}return _.duration=m*1e3*e/Math.SQRT2,_}return o.rho=function(s){var i=Math.max(.001,+s),c=i*i,a=c*c;return t(i,c,a)},o}(Math.SQRT2,2,4);var ue=0,ve=0,pe=0,So=1e3,Ze,_e,Ge=0,Ut=0,rn=0,Ae=typeof performance=="object"&&performance.now?performance:Date,Eo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Xn(){return Ut||(Eo(Ma),Ut=Ae.now()+rn)}function Ma(){Ut=0}function Ke(){this._call=this._time=this._next=null}Ke.prototype=No.prototype={constructor:Ke,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Xn():+n)+(e==null?0:+e),!this._next&&_e!==this&&(_e?_e._next=this:Ze=this,_e=this),this._call=t,this._time=n,Tn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Tn())}};function No(t,e,n){var r=new Ke;return r.restart(t,e,n),r}function $a(){Xn(),++ue;for(var t=Ze,e;t;)(e=Ut-t._time)>=0&&t._call.call(void 0,e),t=t._next;--ue}function Ar(){Ut=(Ge=Ae.now())+rn,ue=ve=0;try{$a()}finally{ue=0,Ca(),Ut=0}}function Ta(){var t=Ae.now(),e=t-Ge;e>So&&(rn-=e,Ge=t)}function Ca(){for(var t,e=Ze,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ze=n);_e=t,Tn(r)}function Tn(t){if(!ue){ve&&(ve=clearTimeout(ve));var e=t-Ut;e>24?(t<1/0&&(ve=setTimeout(Ar,t-Ae.now()-rn)),pe&&(pe=clearInterval(pe))):(pe||(Ge=Ae.now(),pe=setInterval(Ta,So)),ue=1,Eo(Ar))}}function Mr(t,e,n){var r=new Ke;return e=e==null?0:+e,r.restart(o=>{r.stop(),t(o+e)},e,n),r}var ka=en("start","end","cancel","interrupt"),Ia=[],Ao=0,$r=1,Cn=2,Oe=3,Tr=4,kn=5,Xe=6;function on(t,e,n,r,o,s){var i=t.__transition;if(!i)t.__transition={};else if(n in i)return;Ra(t,n,{name:e,index:r,group:o,on:ka,tween:Ia,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Ao})}function Yn(t,e){var n=yt(t,e);if(n.state>Ao)throw new Error("too late; already scheduled");return n}function bt(t,e){var n=yt(t,e);if(n.state>Oe)throw new Error("too late; already running");return n}function yt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Ra(t,e,n){var r=t.__transition,o;r[e]=n,n.timer=No(s,0,n.time);function s(l){n.state=$r,n.timer.restart(i,n.delay,n.time),n.delay<=l&&i(l-n.delay)}function i(l){var u,f,h,g;if(n.state!==$r)return a();for(u in r)if(g=r[u],g.name===n.name){if(g.state===Oe)return Mr(i);g.state===Tr?(g.state=Xe,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete r[u]):+u<e&&(g.state=Xe,g.timer.stop(),g.on.call("cancel",t,t.__data__,g.index,g.group),delete r[u])}if(Mr(function(){n.state===Oe&&(n.state=Tr,n.timer.restart(c,n.delay,n.time),c(l))}),n.state=Cn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Cn){for(n.state=Oe,o=new Array(h=n.tween.length),u=0,f=-1;u<h;++u)(g=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(o[++f]=g);o.length=f+1}}function c(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(a),n.state=kn,1),f=-1,h=o.length;++f<h;)o[f].call(t,u);n.state===kn&&(n.on.call("end",t,t.__data__,n.index,n.group),a())}function a(){n.state=Xe,n.timer.stop(),delete r[e];for(var l in r)return;delete t.__transition}}function Ye(t,e){var n=t.__transition,r,o,s=!0,i;if(n){e=e==null?null:e+"";for(i in n){if((r=n[i]).name!==e){s=!1;continue}o=r.state>Cn&&r.state<kn,r.state=Xe,r.timer.stop(),r.on.call(o?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[i]}s&&delete t.__transition}}function za(t){return this.each(function(){Ye(this,t)})}function Da(t,e){var n,r;return function(){var o=bt(this,t),s=o.tween;if(s!==n){r=n=s;for(var i=0,c=r.length;i<c;++i)if(r[i].name===e){r=r.slice(),r.splice(i,1);break}}o.tween=r}}function Pa(t,e,n){var r,o;if(typeof n!="function")throw new Error;return function(){var s=bt(this,t),i=s.tween;if(i!==r){o=(r=i).slice();for(var c={name:e,value:n},a=0,l=o.length;a<l;++a)if(o[a].name===e){o[a]=c;break}a===l&&o.push(c)}s.tween=o}}function Ha(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=yt(this.node(),n).tween,o=0,s=r.length,i;o<s;++o)if((i=r[o]).name===t)return i.value;return null}return this.each((e==null?Da:Pa)(n,t,e))}function qn(t,e,n){var r=t._id;return t.each(function(){var o=bt(this,r);(o.value||(o.value={}))[e]=n.apply(this,arguments)}),function(o){return yt(o,r).value[e]}}function Mo(t,e){var n;return(typeof e=="number"?Ct:e instanceof Ne?Sr:(n=Ne(e))?(e=n,Sr):xa)(t,e)}function La(t){return function(){this.removeAttribute(t)}}function Va(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ba(t,e,n){var r,o=n+"",s;return function(){var i=this.getAttribute(t);return i===o?null:i===r?s:s=e(r=i,n)}}function Fa(t,e,n){var r,o=n+"",s;return function(){var i=this.getAttributeNS(t.space,t.local);return i===o?null:i===r?s:s=e(r=i,n)}}function Oa(t,e,n){var r,o,s;return function(){var i,c=n(this),a;return c==null?void this.removeAttribute(t):(i=this.getAttribute(t),a=c+"",i===a?null:i===r&&a===o?s:(o=a,s=e(r=i,c)))}}function Xa(t,e,n){var r,o,s;return function(){var i,c=n(this),a;return c==null?void this.removeAttributeNS(t.space,t.local):(i=this.getAttributeNS(t.space,t.local),a=c+"",i===a?null:i===r&&a===o?s:(o=a,s=e(r=i,c)))}}function Ya(t,e){var n=nn(t),r=n==="transform"?ba:Mo;return this.attrTween(t,typeof e=="function"?(n.local?Xa:Oa)(n,r,qn(this,"attr."+t,e)):e==null?(n.local?Va:La)(n):(n.local?Fa:Ba)(n,r,e))}function qa(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Ua(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Wa(t,e){var n,r;function o(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&Ua(t,s)),n}return o._value=e,o}function Za(t,e){var n,r;function o(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&qa(t,s)),n}return o._value=e,o}function Ga(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 r=nn(t);return this.tween(n,(r.local?Wa:Za)(r,e))}function Ka(t,e){return function(){Yn(this,t).delay=+e.apply(this,arguments)}}function Qa(t,e){return e=+e,function(){Yn(this,t).delay=e}}function Ja(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Ka:Qa)(e,t)):yt(this.node(),e).delay}function ja(t,e){return function(){bt(this,t).duration=+e.apply(this,arguments)}}function tu(t,e){return e=+e,function(){bt(this,t).duration=e}}function eu(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?ja:tu)(e,t)):yt(this.node(),e).duration}function nu(t,e){if(typeof e!="function")throw new Error;return function(){bt(this,t).ease=e}}function ru(t){var e=this._id;return arguments.length?this.each(nu(e,t)):yt(this.node(),e).ease}function ou(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;bt(this,t).ease=n}}function iu(t){if(typeof t!="function")throw new Error;return this.each(ou(this._id,t))}function su(t){typeof t!="function"&&(t=oo(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var s=e[o],i=s.length,c=r[o]=[],a,l=0;l<i;++l)(a=s[l])&&t.call(a,a.__data__,l,s)&&c.push(a);return new Mt(r,this._parents,this._name,this._id)}function cu(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,s=Math.min(r,o),i=new Array(r),c=0;c<s;++c)for(var a=e[c],l=n[c],u=a.length,f=i[c]=new Array(u),h,g=0;g<u;++g)(h=a[g]||l[g])&&(f[g]=h);for(;c<r;++c)i[c]=e[c];return new Mt(i,this._parents,this._name,this._id)}function au(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 uu(t,e,n){var r,o,s=au(e)?Yn:bt;return function(){var i=s(this,t),c=i.on;c!==r&&(o=(r=c).copy()).on(e,n),i.on=o}}function lu(t,e){var n=this._id;return arguments.length<2?yt(this.node(),n).on.on(t):this.each(uu(n,t,e))}function fu(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function du(){return this.on("end.remove",fu(this._id))}function hu(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Bn(t));for(var r=this._groups,o=r.length,s=new Array(o),i=0;i<o;++i)for(var c=r[i],a=c.length,l=s[i]=new Array(a),u,f,h=0;h<a;++h)(u=c[h])&&(f=t.call(u,u.__data__,h,c))&&("__data__"in u&&(f.__data__=u.__data__),l[h]=f,on(l[h],e,n,h,l,yt(u,n)));return new Mt(s,this._parents,e,n)}function gu(t){var e=this._name,n=this._id;typeof t!="function"&&(t=ro(t));for(var r=this._groups,o=r.length,s=[],i=[],c=0;c<o;++c)for(var a=r[c],l=a.length,u,f=0;f<l;++f)if(u=a[f]){for(var h=t.call(u,u.__data__,f,a),g,x=yt(u,n),p=0,_=h.length;p<_;++p)(g=h[p])&&on(g,e,n,p,h,x);s.push(h),i.push(u)}return new Mt(s,i,e,n)}var pu=Te.prototype.constructor;function mu(){return new pu(this._groups,this._parents)}function yu(t,e){var n,r,o;return function(){var s=ae(this,t),i=(this.style.removeProperty(t),ae(this,t));return s===i?null:s===n&&i===r?o:o=e(n=s,r=i)}}function $o(t){return function(){this.style.removeProperty(t)}}function xu(t,e,n){var r,o=n+"",s;return function(){var i=ae(this,t);return i===o?null:i===r?s:s=e(r=i,n)}}function wu(t,e,n){var r,o,s;return function(){var i=ae(this,t),c=n(this),a=c+"";return c==null&&(a=c=(this.style.removeProperty(t),ae(this,t))),i===a?null:i===r&&a===o?s:(o=a,s=e(r=i,c))}}function vu(t,e){var n,r,o,s="style."+e,i="end."+s,c;return function(){var a=bt(this,t),l=a.on,u=a.value[s]==null?c||(c=$o(e)):void 0;(l!==n||o!==u)&&(r=(n=l).copy()).on(i,o=u),a.on=r}}function _u(t,e,n){var r=(t+="")=="transform"?_a:Mo;return e==null?this.styleTween(t,yu(t,r)).on("end.style."+t,$o(t)):typeof e=="function"?this.styleTween(t,wu(t,r,qn(this,"style."+t,e))).each(vu(this._id,t)):this.styleTween(t,xu(t,r,e),n).on("end.style."+t,null)}function bu(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Su(t,e,n){var r,o;function s(){var i=e.apply(this,arguments);return i!==o&&(r=(o=i)&&bu(t,i,n)),r}return s._value=e,s}function Eu(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,Su(t,e,n??""))}function Nu(t){return function(){this.textContent=t}}function Au(t){return function(){var e=t(this);this.textContent=e??""}}function Mu(t){return this.tween("text",typeof t=="function"?Au(qn(this,"text",t)):Nu(t==null?"":t+""))}function $u(t){return function(e){this.textContent=t.call(this,e)}}function Tu(t){var e,n;function r(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&$u(o)),e}return r._value=t,r}function Cu(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,Tu(t))}function ku(){for(var t=this._name,e=this._id,n=To(),r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],c=i.length,a,l=0;l<c;++l)if(a=i[l]){var u=yt(a,e);on(a,t,n,l,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Mt(r,this._parents,t,n)}function Iu(){var t,e,n=this,r=n._id,o=n.size();return new Promise(function(s,i){var c={value:i},a={value:function(){--o===0&&s()}};n.each(function(){var l=bt(this,r),u=l.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(c),e._.interrupt.push(c),e._.end.push(a)),l.on=e}),o===0&&s()})}var Ru=0;function Mt(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function To(){return++Ru}var Nt=Te.prototype;Mt.prototype={constructor:Mt,select:hu,selectAll:gu,selectChild:Nt.selectChild,selectChildren:Nt.selectChildren,filter:su,merge:cu,selection:mu,transition:ku,call:Nt.call,nodes:Nt.nodes,node:Nt.node,size:Nt.size,empty:Nt.empty,each:Nt.each,on:lu,attr:Ya,attrTween:Ga,style:_u,styleTween:Eu,text:Mu,textTween:Cu,remove:du,tween:Ha,delay:Ja,duration:eu,ease:ru,easeVarying:iu,end:Iu,[Symbol.iterator]:Nt[Symbol.iterator]};function zu(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Du={time:null,delay:0,duration:250,ease:zu};function Pu(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 Hu(t){var e,n;t instanceof Mt?(e=t._id,t=t._name):(e=To(),(n=Du).time=Xn(),t=t==null?null:t+"");for(var r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],c=i.length,a,l=0;l<c;++l)(a=i[l])&&on(a,t,e,l,i,n||Pu(a,e));return new Mt(r,this._parents,t,e)}Te.prototype.interrupt=za;Te.prototype.transition=Hu;const Pe=t=>()=>t;function Lu(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){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:r,enumerable:!0,configurable:!0},_:{value:o}})}function At(t,e,n){this.k=t,this.x=e,this.y=n}At.prototype={constructor:At,scale:function(t){return t===1?this:new At(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new At(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 Rt=new At(1,0,0);At.prototype;function xn(t){t.stopImmediatePropagation()}function me(t){t.preventDefault(),t.stopImmediatePropagation()}function Vu(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Bu(){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 Cr(){return this.__zoom||Rt}function Fu(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Ou(){return navigator.maxTouchPoints||"ontouchstart"in this}function Xu(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],i=t.invertY(e[1][1])-n[1][1];return t.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Yu(){var t=Vu,e=Bu,n=Xu,r=Fu,o=Ou,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],c=250,a=Aa,l=en("start","zoom","end"),u,f,h,g=500,x=150,p=0,_=10;function m(d){d.property("__zoom",Cr).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",L).filter(o).on("touchstart.zoom",P).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(d,S,v,$){var k=d.selection?d.selection():d;k.property("__zoom",Cr),d!==k?M(d,S,v,$):k.interrupt().each(function(){C(this,arguments).event($).start().zoom(null,typeof S=="function"?S.apply(this,arguments):S).end()})},m.scaleBy=function(d,S,v,$){m.scaleTo(d,function(){var k=this.__zoom.k,w=typeof S=="function"?S.apply(this,arguments):S;return k*w},v,$)},m.scaleTo=function(d,S,v,$){m.transform(d,function(){var k=e.apply(this,arguments),w=this.__zoom,A=v==null?y(k):typeof v=="function"?v.apply(this,arguments):v,I=w.invert(A),D=typeof S=="function"?S.apply(this,arguments):S;return n(N(b(w,D),A,I),k,i)},v,$)},m.translateBy=function(d,S,v,$){m.transform(d,function(){return n(this.__zoom.translate(typeof S=="function"?S.apply(this,arguments):S,typeof v=="function"?v.apply(this,arguments):v),e.apply(this,arguments),i)},null,$)},m.translateTo=function(d,S,v,$,k){m.transform(d,function(){var w=e.apply(this,arguments),A=this.__zoom,I=$==null?y(w):typeof $=="function"?$.apply(this,arguments):$;return n(Rt.translate(I[0],I[1]).scale(A.k).translate(typeof S=="function"?-S.apply(this,arguments):-S,typeof v=="function"?-v.apply(this,arguments):-v),w,i)},$,k)};function b(d,S){return S=Math.max(s[0],Math.min(s[1],S)),S===d.k?d:new At(S,d.x,d.y)}function N(d,S,v){var $=S[0]-v[0]*d.k,k=S[1]-v[1]*d.k;return $===d.x&&k===d.y?d:new At(d.k,$,k)}function y(d){return[(+d[0][0]+ +d[1][0])/2,(+d[0][1]+ +d[1][1])/2]}function M(d,S,v,$){d.on("start.zoom",function(){C(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event($).end()}).tween("zoom",function(){var k=this,w=arguments,A=C(k,w).event($),I=e.apply(k,w),D=v==null?y(I):typeof v=="function"?v.apply(k,w):v,O=Math.max(I[1][0]-I[0][0],I[1][1]-I[0][1]),F=k.__zoom,q=typeof S=="function"?S.apply(k,w):S,W=a(F.invert(D).concat(O/F.k),q.invert(D).concat(O/q.k));return function(Z){if(Z===1)Z=q;else{var G=W(Z),J=O/G[2];Z=new At(J,D[0]-G[0]*J,D[1]-G[1]*J)}A.zoom(null,Z)}})}function C(d,S,v){return!v&&d.__zooming||new z(d,S)}function z(d,S){this.that=d,this.args=S,this.active=0,this.sourceEvent=null,this.extent=e.apply(d,S),this.taps=0}z.prototype={event:function(d){return d&&(this.sourceEvent=d),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(d,S){return this.mouse&&d!=="mouse"&&(this.mouse[1]=S.invert(this.mouse[0])),this.touch0&&d!=="touch"&&(this.touch0[1]=S.invert(this.touch0[0])),this.touch1&&d!=="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(d){var S=pt(this.that).datum();l.call(d,this.that,new Lu(d,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),S)}};function H(d,...S){if(!t.apply(this,arguments))return;var v=C(this,S).event(d),$=this.__zoom,k=Math.max(s[0],Math.min(s[1],$.k*Math.pow(2,r.apply(this,arguments)))),w=vt(d);if(v.wheel)(v.mouse[0][0]!==w[0]||v.mouse[0][1]!==w[1])&&(v.mouse[1]=$.invert(v.mouse[0]=w)),clearTimeout(v.wheel);else{if($.k===k)return;v.mouse=[w,$.invert(w)],Ye(this),v.start()}me(d),v.wheel=setTimeout(A,x),v.zoom("mouse",n(N(b($,k),v.mouse[0],v.mouse[1]),v.extent,i));function A(){v.wheel=null,v.end()}}function T(d,...S){if(h||!t.apply(this,arguments))return;var v=d.currentTarget,$=C(this,S,!0).event(d),k=pt(d.view).on("mousemove.zoom",D,!0).on("mouseup.zoom",O,!0),w=vt(d,v),A=d.clientX,I=d.clientY;po(d.view),xn(d),$.mouse=[w,this.__zoom.invert(w)],Ye(this),$.start();function D(F){if(me(F),!$.moved){var q=F.clientX-A,W=F.clientY-I;$.moved=q*q+W*W>p}$.event(F).zoom("mouse",n(N($.that.__zoom,$.mouse[0]=vt(F,v),$.mouse[1]),$.extent,i))}function O(F){k.on("mousemove.zoom mouseup.zoom",null),mo(F.view,$.moved),me(F),$.event(F).end()}}function L(d,...S){if(t.apply(this,arguments)){var v=this.__zoom,$=vt(d.changedTouches?d.changedTouches[0]:d,this),k=v.invert($),w=v.k*(d.shiftKey?.5:2),A=n(N(b(v,w),$,k),e.apply(this,S),i);me(d),c>0?pt(this).transition().duration(c).call(M,A,$,d):pt(this).call(m.transform,A,$,d)}}function P(d,...S){if(t.apply(this,arguments)){var v=d.touches,$=v.length,k=C(this,S,d.changedTouches.length===$).event(d),w,A,I,D;for(xn(d),A=0;A<$;++A)I=v[A],D=vt(I,this),D=[D,this.__zoom.invert(D),I.identifier],k.touch0?!k.touch1&&k.touch0[2]!==D[2]&&(k.touch1=D,k.taps=0):(k.touch0=D,w=!0,k.taps=1+!!u);u&&(u=clearTimeout(u)),w&&(k.taps<2&&(f=D[0],u=setTimeout(function(){u=null},g)),Ye(this),k.start())}}function B(d,...S){if(this.__zooming){var v=C(this,S).event(d),$=d.changedTouches,k=$.length,w,A,I,D;for(me(d),w=0;w<k;++w)A=$[w],I=vt(A,this),v.touch0&&v.touch0[2]===A.identifier?v.touch0[0]=I:v.touch1&&v.touch1[2]===A.identifier&&(v.touch1[0]=I);if(A=v.that.__zoom,v.touch1){var O=v.touch0[0],F=v.touch0[1],q=v.touch1[0],W=v.touch1[1],Z=(Z=q[0]-O[0])*Z+(Z=q[1]-O[1])*Z,G=(G=W[0]-F[0])*G+(G=W[1]-F[1])*G;A=b(A,Math.sqrt(Z/G)),I=[(O[0]+q[0])/2,(O[1]+q[1])/2],D=[(F[0]+W[0])/2,(F[1]+W[1])/2]}else if(v.touch0)I=v.touch0[0],D=v.touch0[1];else return;v.zoom("touch",n(N(A,I,D),v.extent,i))}}function V(d,...S){if(this.__zooming){var v=C(this,S).event(d),$=d.changedTouches,k=$.length,w,A;for(xn(d),h&&clearTimeout(h),h=setTimeout(function(){h=null},g),w=0;w<k;++w)A=$[w],v.touch0&&v.touch0[2]===A.identifier?delete v.touch0:v.touch1&&v.touch1[2]===A.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(A=vt(A,this),Math.hypot(f[0]-A[0],f[1]-A[1])<_)){var I=pt(this).on("dblclick.zoom");I&&I.apply(this,arguments)}}}return m.wheelDelta=function(d){return arguments.length?(r=typeof d=="function"?d:Pe(+d),m):r},m.filter=function(d){return arguments.length?(t=typeof d=="function"?d:Pe(!!d),m):t},m.touchable=function(d){return arguments.length?(o=typeof d=="function"?d:Pe(!!d),m):o},m.extent=function(d){return arguments.length?(e=typeof d=="function"?d:Pe([[+d[0][0],+d[0][1]],[+d[1][0],+d[1][1]]]),m):e},m.scaleExtent=function(d){return arguments.length?(s[0]=+d[0],s[1]=+d[1],m):[s[0],s[1]]},m.translateExtent=function(d){return arguments.length?(i[0][0]=+d[0][0],i[1][0]=+d[1][0],i[0][1]=+d[0][1],i[1][1]=+d[1][1],m):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},m.constrain=function(d){return arguments.length?(n=d,m):n},m.duration=function(d){return arguments.length?(c=+d,m):c},m.interpolate=function(d){return arguments.length?(a=d,m):a},m.on=function(){var d=l.on.apply(l,arguments);return d===l?m:d},m.clickDistance=function(d){return arguments.length?(p=(d=+d)*d,m):Math.sqrt(p)},m.tapDistance=function(d){return arguments.length?(_=+d,m):_},m}const sn=E.createContext(null),qu=sn.Provider,$t={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.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 React Flow 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,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,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.`},Co=$t.error001();function tt(t,e){const n=E.useContext(sn);if(n===null)throw new Error(Co);return eo(n,t,e)}const nt=()=>{const t=E.useContext(sn);if(t===null)throw new Error(Co);return E.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},Uu=t=>t.userSelectionActive?"none":"all";function Wu({position:t,children:e,className:n,style:r,...o}){const s=tt(Uu),i=`${t}`.split("-");return R.createElement("div",{className:ft(["react-flow__panel",n,...i]),style:{...r,pointerEvents:s},...o},e)}function Zu({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:R.createElement(Wu,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},R.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const Gu=({x:t,y:e,label:n,labelStyle:r={},labelShowBg:o=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:c=2,children:a,className:l,...u})=>{const f=E.useRef(null),[h,g]=E.useState({x:0,y:0,width:0,height:0}),x=ft(["react-flow__edge-textwrapper",l]);return E.useEffect(()=>{if(f.current){const p=f.current.getBBox();g({x:p.x,y:p.y,width:p.width,height:p.height})}},[n]),typeof n>"u"||!n?null:R.createElement("g",{transform:`translate(${t-h.width/2} ${e-h.height/2})`,className:x,visibility:h.width?"visible":"hidden",...u},o&&R.createElement("rect",{width:h.width+2*i[0],x:-i[0],y:-i[1],height:h.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:c,ry:c}),R.createElement("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:f,style:r},n),a)};var Ku=E.memo(Gu);const Un=t=>({width:t.offsetWidth,height:t.offsetHeight}),le=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Wn=(t={x:0,y:0},e)=>({x:le(t.x,e[0][0],e[1][0]),y:le(t.y,e[0][1],e[1][1])}),kr=(t,e,n)=>t<e?le(Math.abs(t-e),1,50)/50:t>n?-le(Math.abs(t-n),1,50)/50:0,ko=(t,e)=>{const n=kr(t.x,35,e.width-35)*20,r=kr(t.y,35,e.height-35)*20;return[n,r]},Io=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Qu=(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)}),Zn=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),Ju=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),Ir=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),In=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},ju=t=>lt(t.width)&<(t.height)&<(t.x)&<(t.y),lt=t=>!isNaN(t)&&isFinite(t),j=Symbol.for("internals"),Ro=["Enter"," ","Escape"],tl=(t,e)=>{},el=t=>"nativeEvent"in t;function Rn(t){var o,s;const e=el(t)?t.nativeEvent:t,n=((s=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:s[0])||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const zo=t=>"clientX"in t,zt=(t,e)=>{var s,i;const n=zo(t),r=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,o=n?t.clientY:(i=t.touches)==null?void 0:i[0].clientY;return{x:r-((e==null?void 0:e.left)??0),y:o-((e==null?void 0:e.top)??0)}},Qe=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},ke=({id:t,path:e,labelX:n,labelY:r,label:o,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:l,style:u,markerEnd:f,markerStart:h,interactionWidth:g=20})=>R.createElement(R.Fragment,null,R.createElement("path",{id:t,style:u,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:f,markerStart:h}),g&&R.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:g,className:"react-flow__edge-interaction"}),o&<(n)&<(r)?R.createElement(Ku,{x:n,y:r,label:o,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:l}):null);ke.displayName="BaseEdge";function ye(t,e,n){return n===void 0?n:r=>{const o=e().edges.find(s=>s.id===t);o&&n(r,{...o})}}function Do({sourceX:t,sourceY:e,targetX:n,targetY:r}){const o=Math.abs(n-t)/2,s=n<t?n+o:n-o,i=Math.abs(r-e)/2,c=r<e?r+i:r-i;return[s,c,o,i]}function Po({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:o,sourceControlY:s,targetControlX:i,targetControlY:c}){const a=t*.125+o*.375+i*.375+n*.125,l=e*.125+s*.375+c*.375+r*.125,u=Math.abs(a-t),f=Math.abs(l-e);return[a,l,u,f]}var Wt;(function(t){t.Strict="strict",t.Loose="loose"})(Wt||(Wt={}));var Yt;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(Yt||(Yt={}));var Me;(function(t){t.Partial="partial",t.Full="full"})(Me||(Me={}));var It;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(It||(It={}));var Je;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Je||(Je={}));var X;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(X||(X={}));function Rr({pos:t,x1:e,y1:n,x2:r,y2:o}){return t===X.Left||t===X.Right?[.5*(e+r),n]:[e,.5*(n+o)]}function Ho({sourceX:t,sourceY:e,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:s=X.Top}){const[i,c]=Rr({pos:n,x1:t,y1:e,x2:r,y2:o}),[a,l]=Rr({pos:s,x1:r,y1:o,x2:t,y2:e}),[u,f,h,g]=Po({sourceX:t,sourceY:e,targetX:r,targetY:o,sourceControlX:i,sourceControlY:c,targetControlX:a,targetControlY:l});return[`M${t},${e} C${i},${c} ${a},${l} ${r},${o}`,u,f,h,g]}const Gn=E.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:o=X.Bottom,targetPosition:s=X.Top,label:i,labelStyle:c,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:x,interactionWidth:p})=>{const[_,m,b]=Ho({sourceX:t,sourceY:e,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return R.createElement(ke,{path:_,labelX:m,labelY:b,label:i,labelStyle:c,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:x,interactionWidth:p})});Gn.displayName="SimpleBezierEdge";const zr={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},nl=({source:t,sourcePosition:e=X.Bottom,target:n})=>e===X.Left||e===X.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},Dr=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function rl({source:t,sourcePosition:e=X.Bottom,target:n,targetPosition:r=X.Top,center:o,offset:s}){const i=zr[e],c=zr[r],a={x:t.x+i.x*s,y:t.y+i.y*s},l={x:n.x+c.x*s,y:n.y+c.y*s},u=nl({source:a,sourcePosition:e,target:l}),f=u.x!==0?"x":"y",h=u[f];let g=[],x,p;const _={x:0,y:0},m={x:0,y:0},[b,N,y,M]=Do({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[f]*c[f]===-1){x=o.x??b,p=o.y??N;const z=[{x,y:a.y},{x,y:l.y}],H=[{x:a.x,y:p},{x:l.x,y:p}];i[f]===h?g=f==="x"?z:H:g=f==="x"?H:z}else{const z=[{x:a.x,y:l.y}],H=[{x:l.x,y:a.y}];if(f==="x"?g=i.x===h?H:z:g=i.y===h?z:H,e===r){const V=Math.abs(t[f]-n[f]);if(V<=s){const d=Math.min(s-1,s-V);i[f]===h?_[f]=(a[f]>t[f]?-1:1)*d:m[f]=(l[f]>n[f]?-1:1)*d}}if(e!==r){const V=f==="x"?"y":"x",d=i[f]===c[V],S=a[V]>l[V],v=a[V]<l[V];(i[f]===1&&(!d&&S||d&&v)||i[f]!==1&&(!d&&v||d&&S))&&(g=f==="x"?z:H)}const T={x:a.x+_.x,y:a.y+_.y},L={x:l.x+m.x,y:l.y+m.y},P=Math.max(Math.abs(T.x-g[0].x),Math.abs(L.x-g[0].x)),B=Math.max(Math.abs(T.y-g[0].y),Math.abs(L.y-g[0].y));P>=B?(x=(T.x+L.x)/2,p=g[0].y):(x=g[0].x,p=(T.y+L.y)/2)}return[[t,{x:a.x+_.x,y:a.y+_.y},...g,{x:l.x+m.x,y:l.y+m.y},n],x,p,y,M]}function ol(t,e,n,r){const o=Math.min(Dr(t,e)/2,Dr(e,n)/2,r),{x:s,y:i}=e;if(t.x===s&&s===n.x||t.y===i&&i===n.y)return`L${s} ${i}`;if(t.y===i){const l=t.x<n.x?-1:1,u=t.y<n.y?1:-1;return`L ${s+o*l},${i}Q ${s},${i} ${s},${i+o*u}`}const c=t.x<n.x?1:-1,a=t.y<n.y?-1:1;return`L ${s},${i+o*a}Q ${s},${i} ${s+o*c},${i}`}function zn({sourceX:t,sourceY:e,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:s=X.Top,borderRadius:i=5,centerX:c,centerY:a,offset:l=20}){const[u,f,h,g,x]=rl({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:o},targetPosition:s,center:{x:c,y:a},offset:l});return[u.reduce((_,m,b)=>{let N="";return b>0&&b<u.length-1?N=ol(u[b-1],m,u[b+1],i):N=`${b===0?"M":"L"}${m.x} ${m.y}`,_+=N,_},""),f,h,g,x]}const cn=E.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:o,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:l,style:u,sourcePosition:f=X.Bottom,targetPosition:h=X.Top,markerEnd:g,markerStart:x,pathOptions:p,interactionWidth:_})=>{const[m,b,N]=zn({sourceX:t,sourceY:e,sourcePosition:f,targetX:n,targetY:r,targetPosition:h,borderRadius:p==null?void 0:p.borderRadius,offset:p==null?void 0:p.offset});return R.createElement(ke,{path:m,labelX:b,labelY:N,label:o,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:l,style:u,markerEnd:g,markerStart:x,interactionWidth:_})});cn.displayName="SmoothStepEdge";const Kn=E.memo(t=>{var e;return R.createElement(cn,{...t,pathOptions:E.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});Kn.displayName="StepEdge";function il({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[o,s,i,c]=Do({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,o,s,i,c]}const Qn=E.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:o,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:l,style:u,markerEnd:f,markerStart:h,interactionWidth:g})=>{const[x,p,_]=il({sourceX:t,sourceY:e,targetX:n,targetY:r});return R.createElement(ke,{path:x,labelX:p,labelY:_,label:o,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:l,style:u,markerEnd:f,markerStart:h,interactionWidth:g})});Qn.displayName="StraightEdge";function He(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function Pr({pos:t,x1:e,y1:n,x2:r,y2:o,c:s}){switch(t){case X.Left:return[e-He(e-r,s),n];case X.Right:return[e+He(r-e,s),n];case X.Top:return[e,n-He(n-o,s)];case X.Bottom:return[e,n+He(o-n,s)]}}function Lo({sourceX:t,sourceY:e,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:s=X.Top,curvature:i=.25}){const[c,a]=Pr({pos:n,x1:t,y1:e,x2:r,y2:o,c:i}),[l,u]=Pr({pos:s,x1:r,y1:o,x2:t,y2:e,c:i}),[f,h,g,x]=Po({sourceX:t,sourceY:e,targetX:r,targetY:o,sourceControlX:c,sourceControlY:a,targetControlX:l,targetControlY:u});return[`M${t},${e} C${c},${a} ${l},${u} ${r},${o}`,f,h,g,x]}const je=E.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:o=X.Bottom,targetPosition:s=X.Top,label:i,labelStyle:c,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:x,pathOptions:p,interactionWidth:_})=>{const[m,b,N]=Lo({sourceX:t,sourceY:e,sourcePosition:o,targetX:n,targetY:r,targetPosition:s,curvature:p==null?void 0:p.curvature});return R.createElement(ke,{path:m,labelX:b,labelY:N,label:i,labelStyle:c,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:x,interactionWidth:_})});je.displayName="BezierEdge";const Jn=E.createContext(null),sl=Jn.Provider;Jn.Consumer;const cl=()=>E.useContext(Jn),al=t=>"id"in t&&"source"in t&&"target"in t,ul=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${n}${r||""}`,Dn=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`,ll=(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)),fl=(t,e)=>{if(!t.source||!t.target)return e;let n;return al(t)?n={...t}:n={...t,id:ul(t)},ll(n,e)?e:e.concat(n)},Pn=({x:t,y:e},[n,r,o],s,[i,c])=>{const a={x:(t-n)/o,y:(e-r)/o};return s?{x:i*Math.round(a.x/i),y:c*Math.round(a.y/c)}:a},Vo=({x:t,y:e},[n,r,o])=>({x:t*o+n,y:e*o+r}),se=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],r=(t.height??0)*e[1],o={x:t.position.x-n,y:t.position.y-r};return{...o,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-r}:o}},jn=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,o)=>{const{x:s,y:i}=se(o,e).positionAbsolute;return Qu(r,Zn({x:s,y:i,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ju(n)},Bo=(t,e,[n,r,o]=[0,0,1],s=!1,i=!1,c=[0,0])=>{const a={x:(e.x-n)/o,y:(e.y-r)/o,width:e.width/o,height:e.height/o},l=[];return t.forEach(u=>{const{width:f,height:h,selectable:g=!0,hidden:x=!1}=u;if(i&&!g||x)return!1;const{positionAbsolute:p}=se(u,c),_={x:p.x,y:p.y,width:f||0,height:h||0},m=In(a,_),b=typeof f>"u"||typeof h>"u"||f===null||h===null,N=s&&m>0,y=(f||0)*(h||0);(b||N||m>=y||u.dragging)&&l.push(u)}),l},Fo=(t,e)=>{const n=t.map(r=>r.id);return e.filter(r=>n.includes(r.source)||n.includes(r.target))},Oo=(t,e,n,r,o,s=.1)=>{const i=e/(t.width*(1+s)),c=n/(t.height*(1+s)),a=Math.min(i,c),l=le(a,r,o),u=t.x+t.width/2,f=t.y+t.height/2,h=e/2-u*l,g=n/2-f*l;return{x:h,y:g,zoom:l}},Ot=(t,e=0)=>t.transition().duration(e);function Hr(t,e,n,r){return(e[n]||[]).reduce((o,s)=>{var i,c;return`${t.id}-${s.id}-${n}`!==r&&o.push({id:s.id||null,type:n,nodeId:t.id,x:(((i=t.positionAbsolute)==null?void 0:i.x)??0)+s.x+s.width/2,y:(((c=t.positionAbsolute)==null?void 0:c.y)??0)+s.y+s.height/2}),o},[])}function dl(t,e,n,r,o,s){const{x:i,y:c}=zt(t),l=e.elementsFromPoint(i,c).find(x=>x.classList.contains("react-flow__handle"));if(l){const x=l.getAttribute("data-nodeid");if(x){const p=tr(void 0,l),_=l.getAttribute("data-handleid"),m=s({nodeId:x,id:_,type:p});if(m){const b=o.find(N=>N.nodeId===x&&N.type===p&&N.id===_);return{handle:{id:_,type:p,nodeId:x,x:(b==null?void 0:b.x)||n.x,y:(b==null?void 0:b.y)||n.y},validHandleResult:m}}}}let u=[],f=1/0;if(o.forEach(x=>{const p=Math.sqrt((x.x-n.x)**2+(x.y-n.y)**2);if(p<=r){const _=s(x);p<=f&&(p<f?u=[{handle:x,validHandleResult:_}]:p===f&&u.push({handle:x,validHandleResult:_}),f=p)}}),!u.length)return{handle:null,validHandleResult:Xo()};if(u.length===1)return u[0];const h=u.some(({validHandleResult:x})=>x.isValid),g=u.some(({handle:x})=>x.type==="target");return u.find(({handle:x,validHandleResult:p})=>g?x.type==="target":h?p.isValid:!0)||u[0]}const hl={source:null,target:null,sourceHandle:null,targetHandle:null},Xo=()=>({handleDomNode:null,isValid:!1,connection:hl,endHandle:null});function Yo(t,e,n,r,o,s,i){const c=o==="target",a=i.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),l={...Xo(),handleDomNode:a};if(a){const u=tr(void 0,a),f=a.getAttribute("data-nodeid"),h=a.getAttribute("data-handleid"),g=a.classList.contains("connectable"),x=a.classList.contains("connectableend"),p={source:c?f:n,sourceHandle:c?h:r,target:c?n:f,targetHandle:c?r:h};l.connection=p,g&&x&&(e===Wt.Strict?c&&u==="source"||!c&&u==="target":f!==n||h!==r)&&(l.endHandle={nodeId:f,handleId:h,type:u},l.isValid=s(p))}return l}function gl({nodes:t,nodeId:e,handleId:n,handleType:r}){return t.reduce((o,s)=>{if(s[j]){const{handleBounds:i}=s[j];let c=[],a=[];i&&(c=Hr(s,i,"source",`${e}-${n}-${r}`),a=Hr(s,i,"target",`${e}-${n}-${r}`)),o.push(...c,...a)}return o},[])}function tr(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function wn(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function pl(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function qo({event:t,handleId:e,nodeId:n,onConnect:r,isTarget:o,getState:s,setState:i,isValidConnection:c,edgeUpdaterType:a,onReconnectEnd:l}){const u=Io(t.target),{connectionMode:f,domNode:h,autoPanOnConnect:g,connectionRadius:x,onConnectStart:p,panBy:_,getNodes:m,cancelConnection:b}=s();let N=0,y;const{x:M,y:C}=zt(t),z=u==null?void 0:u.elementFromPoint(M,C),H=tr(a,z),T=h==null?void 0:h.getBoundingClientRect();if(!T||!H)return;let L,P=zt(t,T),B=!1,V=null,d=!1,S=null;const v=gl({nodes:m(),nodeId:n,handleId:e,handleType:H}),$=()=>{if(!g)return;const[A,I]=ko(P,T);_({x:A,y:I}),N=requestAnimationFrame($)};i({connectionPosition:P,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:H,connectionStartHandle:{nodeId:n,handleId:e,type:H},connectionEndHandle:null}),p==null||p(t,{nodeId:n,handleId:e,handleType:H});function k(A){const{transform:I}=s();P=zt(A,T);const{handle:D,validHandleResult:O}=dl(A,u,Pn(P,I,!1,[1,1]),x,v,F=>Yo(F,f,n,e,o?"target":"source",c,u));if(y=D,B||($(),B=!0),S=O.handleDomNode,V=O.connection,d=O.isValid,i({connectionPosition:y&&d?Vo({x:y.x,y:y.y},I):P,connectionStatus:pl(!!y,d),connectionEndHandle:O.endHandle}),!y&&!d&&!S)return wn(L);V.source!==V.target&&S&&(wn(L),L=S,S.classList.add("connecting","react-flow__handle-connecting"),S.classList.toggle("valid",d),S.classList.toggle("react-flow__handle-valid",d))}function w(A){var I,D;(y||S)&&V&&d&&(r==null||r(V)),(D=(I=s()).onConnectEnd)==null||D.call(I,A),a&&(l==null||l(A)),wn(L),b(),cancelAnimationFrame(N),B=!1,d=!1,V=null,S=null,u.removeEventListener("mousemove",k),u.removeEventListener("mouseup",w),u.removeEventListener("touchmove",k),u.removeEventListener("touchend",w)}u.addEventListener("mousemove",k),u.addEventListener("mouseup",w),u.addEventListener("touchmove",k),u.addEventListener("touchend",w)}const Lr=()=>!0,ml=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),yl=(t,e,n)=>r=>{const{connectionStartHandle:o,connectionEndHandle:s,connectionClickStartHandle:i}=r;return{connecting:(o==null?void 0:o.nodeId)===t&&(o==null?void 0:o.handleId)===e&&(o==null?void 0:o.type)===n||(s==null?void 0:s.nodeId)===t&&(s==null?void 0:s.handleId)===e&&(s==null?void 0:s.type)===n,clickConnecting:(i==null?void 0:i.nodeId)===t&&(i==null?void 0:i.handleId)===e&&(i==null?void 0:i.type)===n}},Uo=E.forwardRef(({type:t="source",position:e=X.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:s=!0,id:i,onConnect:c,children:a,className:l,onMouseDown:u,onTouchStart:f,...h},g)=>{var T,L;const x=i||null,p=t==="target",_=nt(),m=cl(),{connectOnClick:b,noPanClassName:N}=tt(ml,ot),{connecting:y,clickConnecting:M}=tt(yl(m,x,t),ot);m||(L=(T=_.getState()).onError)==null||L.call(T,"010",$t.error010());const C=P=>{const{defaultEdgeOptions:B,onConnect:V,hasDefaultEdges:d}=_.getState(),S={...B,...P};if(d){const{edges:v,setEdges:$}=_.getState();$(fl(S,v))}V==null||V(S),c==null||c(S)},z=P=>{if(!m)return;const B=zo(P);o&&(B&&P.button===0||!B)&&qo({event:P,handleId:x,nodeId:m,onConnect:C,isTarget:p,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||Lr}),B?u==null||u(P):f==null||f(P)},H=P=>{const{onClickConnectStart:B,onClickConnectEnd:V,connectionClickStartHandle:d,connectionMode:S,isValidConnection:v}=_.getState();if(!m||!d&&!o)return;if(!d){B==null||B(P,{nodeId:m,handleId:x,handleType:t}),_.setState({connectionClickStartHandle:{nodeId:m,type:t,handleId:x}});return}const $=Io(P.target),k=n||v||Lr,{connection:w,isValid:A}=Yo({nodeId:m,id:x,type:t},S,d.nodeId,d.handleId||null,d.type,k,$);A&&C(w),V==null||V(P),_.setState({connectionClickStartHandle:null})};return R.createElement("div",{"data-handleid":x,"data-nodeid":m,"data-handlepos":e,"data-id":`${m}-${x}-${t}`,className:ft(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",N,l,{source:!p,target:p,connectable:r,connectablestart:o,connectableend:s,connecting:M,connectionindicator:r&&(o&&!y||s&&y)}]),onMouseDown:z,onTouchStart:z,onClick:b?H:void 0,ref:g,...h},a)});Uo.displayName="Handle";var tn=E.memo(Uo);const Wo=({data:t,isConnectable:e,targetPosition:n=X.Top,sourcePosition:r=X.Bottom})=>R.createElement(R.Fragment,null,R.createElement(tn,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,R.createElement(tn,{type:"source",position:r,isConnectable:e}));Wo.displayName="DefaultNode";var Hn=E.memo(Wo);const Zo=({data:t,isConnectable:e,sourcePosition:n=X.Bottom})=>R.createElement(R.Fragment,null,t==null?void 0:t.label,R.createElement(tn,{type:"source",position:n,isConnectable:e}));Zo.displayName="InputNode";var Go=E.memo(Zo);const Ko=({data:t,isConnectable:e,targetPosition:n=X.Top})=>R.createElement(R.Fragment,null,R.createElement(tn,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);Ko.displayName="OutputNode";var Qo=E.memo(Ko);const er=()=>null;er.displayName="GroupNode";const xl=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Le=t=>t.id;function wl(t,e){return ot(t.selectedNodes.map(Le),e.selectedNodes.map(Le))&&ot(t.selectedEdges.map(Le),e.selectedEdges.map(Le))}const Jo=E.memo(({onSelectionChange:t})=>{const e=nt(),{selectedNodes:n,selectedEdges:r}=tt(xl,wl);return E.useEffect(()=>{const o={nodes:n,edges:r};t==null||t(o),e.getState().onSelectionChange.forEach(s=>s(o))},[n,r,t]),null});Jo.displayName="SelectionListener";const vl=t=>!!t.onSelectionChange;function _l({onSelectionChange:t}){const e=tt(vl);return t||e?R.createElement(Jo,{onSelectionChange:t}):null}const bl=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function jt(t,e){E.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function U(t,e,n){E.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const Sl=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:o,onConnectStart:s,onConnectEnd:i,onClickConnectStart:c,onClickConnectEnd:a,nodesDraggable:l,nodesConnectable:u,nodesFocusable:f,edgesFocusable:h,edgesUpdatable:g,elevateNodesOnSelect:x,minZoom:p,maxZoom:_,nodeExtent:m,onNodesChange:b,onEdgesChange:N,elementsSelectable:y,connectionMode:M,snapGrid:C,snapToGrid:z,translateExtent:H,connectOnClick:T,defaultEdgeOptions:L,fitView:P,fitViewOptions:B,onNodesDelete:V,onEdgesDelete:d,onNodeDrag:S,onNodeDragStart:v,onNodeDragStop:$,onSelectionDrag:k,onSelectionDragStart:w,onSelectionDragStop:A,noPanClassName:I,nodeOrigin:D,rfId:O,autoPanOnConnect:F,autoPanOnNodeDrag:q,onError:W,connectionRadius:Z,isValidConnection:G,nodeDragThreshold:J})=>{const{setNodes:K,setEdges:dt,setDefaultNodesAndEdges:at,setMinZoom:ht,setMaxZoom:ut,setTranslateExtent:et,setNodeExtent:xt,reset:Q}=tt(bl,ot),Y=nt();return E.useEffect(()=>{const st=r==null?void 0:r.map(Dt=>({...Dt,...L}));return at(n,st),()=>{Q()}},[]),U("defaultEdgeOptions",L,Y.setState),U("connectionMode",M,Y.setState),U("onConnect",o,Y.setState),U("onConnectStart",s,Y.setState),U("onConnectEnd",i,Y.setState),U("onClickConnectStart",c,Y.setState),U("onClickConnectEnd",a,Y.setState),U("nodesDraggable",l,Y.setState),U("nodesConnectable",u,Y.setState),U("nodesFocusable",f,Y.setState),U("edgesFocusable",h,Y.setState),U("edgesUpdatable",g,Y.setState),U("elementsSelectable",y,Y.setState),U("elevateNodesOnSelect",x,Y.setState),U("snapToGrid",z,Y.setState),U("snapGrid",C,Y.setState),U("onNodesChange",b,Y.setState),U("onEdgesChange",N,Y.setState),U("connectOnClick",T,Y.setState),U("fitViewOnInit",P,Y.setState),U("fitViewOnInitOptions",B,Y.setState),U("onNodesDelete",V,Y.setState),U("onEdgesDelete",d,Y.setState),U("onNodeDrag",S,Y.setState),U("onNodeDragStart",v,Y.setState),U("onNodeDragStop",$,Y.setState),U("onSelectionDrag",k,Y.setState),U("onSelectionDragStart",w,Y.setState),U("onSelectionDragStop",A,Y.setState),U("noPanClassName",I,Y.setState),U("nodeOrigin",D,Y.setState),U("rfId",O,Y.setState),U("autoPanOnConnect",F,Y.setState),U("autoPanOnNodeDrag",q,Y.setState),U("onError",W,Y.setState),U("connectionRadius",Z,Y.setState),U("isValidConnection",G,Y.setState),U("nodeDragThreshold",J,Y.setState),jt(t,K),jt(e,dt),jt(p,ht),jt(_,ut),jt(H,et),jt(m,xt),null},Vr={display:"none"},El={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},jo="react-flow__node-desc",ti="react-flow__edge-desc",Nl="react-flow__aria-live",Al=t=>t.ariaLiveMessage;function Ml({rfId:t}){const e=tt(Al);return R.createElement("div",{id:`${Nl}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:El},e)}function $l({rfId:t,disableKeyboardA11y:e}){return R.createElement(R.Fragment,null,R.createElement("div",{id:`${jo}-${t}`,style:Vr},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),R.createElement("div",{id:`${ti}-${t}`,style:Vr},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&R.createElement(Ml,{rfId:t}))}var $e=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,r]=E.useState(!1),o=E.useRef(!1),s=E.useRef(new Set([])),[i,c]=E.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(f=>typeof f=="string").map(f=>f.split("+")),u=l.reduce((f,h)=>f.concat(...h),[]);return[l,u]}return[[],[]]},[t]);return E.useEffect(()=>{const a=typeof document<"u"?document:null,l=(e==null?void 0:e.target)||a;if(t!==null){const u=g=>{if(o.current=g.ctrlKey||g.metaKey||g.shiftKey,(!o.current||o.current&&!e.actInsideInputWithModifier)&&Rn(g))return!1;const p=Fr(g.code,c);s.current.add(g[p]),Br(i,s.current,!1)&&(g.preventDefault(),r(!0))},f=g=>{if((!o.current||o.current&&!e.actInsideInputWithModifier)&&Rn(g))return!1;const p=Fr(g.code,c);Br(i,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(g[p]),g.key==="Meta"&&s.current.clear(),o.current=!1},h=()=>{s.current.clear(),r(!1)};return l==null||l.addEventListener("keydown",u),l==null||l.addEventListener("keyup",f),window.addEventListener("blur",h),()=>{l==null||l.removeEventListener("keydown",u),l==null||l.removeEventListener("keyup",f),window.removeEventListener("blur",h)}}},[t,r]),n};function Br(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(o=>e.has(o)))}function Fr(t,e){return e.includes(t)?"code":"key"}function ei(t,e,n,r){var c,a;const o=t.parentNode||t.parentId;if(!o)return n;const s=e.get(o),i=se(s,r);return ei(s,e,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((c=s[j])==null?void 0:c.z)??0)>(n.z??0)?((a=s[j])==null?void 0:a.z)??0:n.z??0},r)}function ni(t,e,n){t.forEach(r=>{var s;const o=r.parentNode||r.parentId;if(o&&!t.has(o))throw new Error(`Parent node ${o} not found`);if(o||n!=null&&n[r.id]){const{x:i,y:c,z:a}=ei(r,t,{...r.position,z:((s=r[j])==null?void 0:s.z)??0},e);r.positionAbsolute={x:i,y:c},r[j].z=a,n!=null&&n[r.id]&&(r[j].isParent=!0)}})}function vn(t,e,n,r){const o=new Map,s={},i=r?1e3:0;return t.forEach(c=>{var g;const a=(lt(c.zIndex)?c.zIndex:0)+(c.selected?i:0),l=e.get(c.id),u={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},f=c.parentNode||c.parentId;f&&(s[f]=!0);const h=(l==null?void 0:l.type)&&(l==null?void 0:l.type)!==c.type;Object.defineProperty(u,j,{enumerable:!1,value:{handleBounds:h||(g=l==null?void 0:l[j])==null?void 0:g.handleBounds,z:a}}),o.set(c.id,u)}),ni(o,n,s),o}function ri(t,e={}){const{getNodes:n,width:r,height:o,minZoom:s,maxZoom:i,d3Zoom:c,d3Selection:a,fitViewOnInitDone:l,fitViewOnInit:u,nodeOrigin:f}=t(),h=e.initial&&!l&&u;if(c&&a&&(h||!e.initial)){const x=n().filter(_=>{var b;const m=e.includeHiddenNodes?_.width&&_.height:!_.hidden;return(b=e.nodes)!=null&&b.length?m&&e.nodes.some(N=>N.id===_.id):m}),p=x.every(_=>_.width&&_.height);if(x.length>0&&p){const _=jn(x,f),{x:m,y:b,zoom:N}=Oo(_,r,o,e.minZoom??s,e.maxZoom??i,e.padding??.1),y=Rt.translate(m,b).scale(N);return typeof e.duration=="number"&&e.duration>0?c.transform(Ot(a,e.duration),y):c.transform(a,y),!0}}return!1}function Tl(t,e){return t.forEach(n=>{const r=e.get(n.id);r&&e.set(r.id,{...r,[j]:r[j],selected:n.selected})}),new Map(e)}function Cl(t,e){return e.map(n=>{const r=t.find(o=>o.id===n.id);return r&&(n.selected=r.selected),n})}function Ve({changedNodes:t,changedEdges:e,get:n,set:r}){const{nodeInternals:o,edges:s,onNodesChange:i,onEdgesChange:c,hasDefaultNodes:a,hasDefaultEdges:l}=n();t!=null&&t.length&&(a&&r({nodeInternals:Tl(t,o)}),i==null||i(t)),e!=null&&e.length&&(l&&r({edges:Cl(e,s)}),c==null||c(e))}const te=()=>{},kl={zoomIn:te,zoomOut:te,zoomTo:te,getZoom:()=>1,setViewport:te,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:te,fitBounds:te,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},Il=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),Rl=()=>{const t=nt(),{d3Zoom:e,d3Selection:n}=tt(Il,ot);return E.useMemo(()=>n&&e?{zoomIn:o=>e.scaleBy(Ot(n,o==null?void 0:o.duration),1.2),zoomOut:o=>e.scaleBy(Ot(n,o==null?void 0:o.duration),1/1.2),zoomTo:(o,s)=>e.scaleTo(Ot(n,s==null?void 0:s.duration),o),getZoom:()=>t.getState().transform[2],setViewport:(o,s)=>{const[i,c,a]=t.getState().transform,l=Rt.translate(o.x??i,o.y??c).scale(o.zoom??a);e.transform(Ot(n,s==null?void 0:s.duration),l)},getViewport:()=>{const[o,s,i]=t.getState().transform;return{x:o,y:s,zoom:i}},fitView:o=>ri(t.getState,o),setCenter:(o,s,i)=>{const{width:c,height:a,maxZoom:l}=t.getState(),u=typeof(i==null?void 0:i.zoom)<"u"?i.zoom:l,f=c/2-o*u,h=a/2-s*u,g=Rt.translate(f,h).scale(u);e.transform(Ot(n,i==null?void 0:i.duration),g)},fitBounds:(o,s)=>{const{width:i,height:c,minZoom:a,maxZoom:l}=t.getState(),{x:u,y:f,zoom:h}=Oo(o,i,c,a,l,(s==null?void 0:s.padding)??.1),g=Rt.translate(u,f).scale(h);e.transform(Ot(n,s==null?void 0:s.duration),g)},project:o=>{const{transform:s,snapToGrid:i,snapGrid:c}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Pn(o,s,i,c)},screenToFlowPosition:o=>{const{transform:s,snapToGrid:i,snapGrid:c,domNode:a}=t.getState();if(!a)return o;const{x:l,y:u}=a.getBoundingClientRect(),f={x:o.x-l,y:o.y-u};return Pn(f,s,i,c)},flowToScreenPosition:o=>{const{transform:s,domNode:i}=t.getState();if(!i)return o;const{x:c,y:a}=i.getBoundingClientRect(),l=Vo(o,s);return{x:l.x+c,y:l.y+a}},viewportInitialized:!0}:kl,[e,n])};function oi(){const t=Rl(),e=nt(),n=E.useCallback(()=>e.getState().getNodes().map(p=>({...p})),[]),r=E.useCallback(p=>e.getState().nodeInternals.get(p),[]),o=E.useCallback(()=>{const{edges:p=[]}=e.getState();return p.map(_=>({..._}))},[]),s=E.useCallback(p=>{const{edges:_=[]}=e.getState();return _.find(m=>m.id===p)},[]),i=E.useCallback(p=>{const{getNodes:_,setNodes:m,hasDefaultNodes:b,onNodesChange:N}=e.getState(),y=_(),M=typeof p=="function"?p(y):p;if(b)m(M);else if(N){const C=M.length===0?y.map(z=>({type:"remove",id:z.id})):M.map(z=>({item:z,type:"reset"}));N(C)}},[]),c=E.useCallback(p=>{const{edges:_=[],setEdges:m,hasDefaultEdges:b,onEdgesChange:N}=e.getState(),y=typeof p=="function"?p(_):p;if(b)m(y);else if(N){const M=y.length===0?_.map(C=>({type:"remove",id:C.id})):y.map(C=>({item:C,type:"reset"}));N(M)}},[]),a=E.useCallback(p=>{const _=Array.isArray(p)?p:[p],{getNodes:m,setNodes:b,hasDefaultNodes:N,onNodesChange:y}=e.getState();if(N){const C=[...m(),..._];b(C)}else if(y){const M=_.map(C=>({item:C,type:"add"}));y(M)}},[]),l=E.useCallback(p=>{const _=Array.isArray(p)?p:[p],{edges:m=[],setEdges:b,hasDefaultEdges:N,onEdgesChange:y}=e.getState();if(N)b([...m,..._]);else if(y){const M=_.map(C=>({item:C,type:"add"}));y(M)}},[]),u=E.useCallback(()=>{const{getNodes:p,edges:_=[],transform:m}=e.getState(),[b,N,y]=m;return{nodes:p().map(M=>({...M})),edges:_.map(M=>({...M})),viewport:{x:b,y:N,zoom:y}}},[]),f=E.useCallback(({nodes:p,edges:_})=>{const{nodeInternals:m,getNodes:b,edges:N,hasDefaultNodes:y,hasDefaultEdges:M,onNodesDelete:C,onEdgesDelete:z,onNodesChange:H,onEdgesChange:T}=e.getState(),L=(p||[]).map(S=>S.id),P=(_||[]).map(S=>S.id),B=b().reduce((S,v)=>{const $=v.parentNode||v.parentId,k=!L.includes(v.id)&&$&&S.find(A=>A.id===$);return(typeof v.deletable=="boolean"?v.deletable:!0)&&(L.includes(v.id)||k)&&S.push(v),S},[]),V=N.filter(S=>typeof S.deletable=="boolean"?S.deletable:!0),d=V.filter(S=>P.includes(S.id));if(B||d){const S=Fo(B,V),v=[...d,...S],$=v.reduce((k,w)=>(k.includes(w.id)||k.push(w.id),k),[]);if((M||y)&&(M&&e.setState({edges:N.filter(k=>!$.includes(k.id))}),y&&(B.forEach(k=>{m.delete(k.id)}),e.setState({nodeInternals:new Map(m)}))),$.length>0&&(z==null||z(v),T&&T($.map(k=>({id:k,type:"remove"})))),B.length>0&&(C==null||C(B),H)){const k=B.map(w=>({id:w.id,type:"remove"}));H(k)}}},[]),h=E.useCallback(p=>{const _=ju(p),m=_?null:e.getState().nodeInternals.get(p.id);return!_&&!m?[null,null,_]:[_?p:Ir(m),m,_]},[]),g=E.useCallback((p,_=!0,m)=>{const[b,N,y]=h(p);return b?(m||e.getState().getNodes()).filter(M=>{if(!y&&(M.id===N.id||!M.positionAbsolute))return!1;const C=Ir(M),z=In(C,b);return _&&z>0||z>=b.width*b.height}):[]},[]),x=E.useCallback((p,_,m=!0)=>{const[b]=h(p);if(!b)return!1;const N=In(b,_);return m&&N>0||N>=b.width*b.height},[]);return E.useMemo(()=>({...t,getNodes:n,getNode:r,getEdges:o,getEdge:s,setNodes:i,setEdges:c,addNodes:a,addEdges:l,toObject:u,deleteElements:f,getIntersectingNodes:g,isNodeIntersecting:x}),[t,n,r,o,s,i,c,a,l,u,f,g,x])}const zl={actInsideInputWithModifier:!1};var Dl=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=nt(),{deleteElements:r}=oi(),o=$e(t,zl),s=$e(e);E.useEffect(()=>{if(o){const{edges:i,getNodes:c}=n.getState(),a=c().filter(u=>u.selected),l=i.filter(u=>u.selected);r({nodes:a,edges:l}),n.setState({nodesSelectionActive:!1})}},[o]),E.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])};function Pl(t){const e=nt();E.useEffect(()=>{let n;const r=()=>{var s,i;if(!t.current)return;const o=Un(t.current);(o.height===0||o.width===0)&&((i=(s=e.getState()).onError)==null||i.call(s,"004",$t.error004())),e.setState({width:o.width||500,height:o.height||500})};return r(),window.addEventListener("resize",r),t.current&&(n=new ResizeObserver(()=>r()),n.observe(t.current)),()=>{window.removeEventListener("resize",r),n&&t.current&&n.unobserve(t.current)}},[])}const nr={position:"absolute",width:"100%",height:"100%",top:0,left:0},Hl=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,Be=t=>({x:t.x,y:t.y,zoom:t.k}),ee=(t,e)=>t.target.closest(`.${e}`),Or=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Xr=t=>{const e=t.ctrlKey&&Qe()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},Ll=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),Vl=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:o=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:c=.5,panOnScrollMode:a=Yt.Free,zoomOnDoubleClick:l=!0,elementsSelectable:u,panOnDrag:f=!0,defaultViewport:h,translateExtent:g,minZoom:x,maxZoom:p,zoomActivationKeyCode:_,preventScrolling:m=!0,children:b,noWheelClassName:N,noPanClassName:y})=>{const M=E.useRef(),C=nt(),z=E.useRef(!1),H=E.useRef(!1),T=E.useRef(null),L=E.useRef({x:0,y:0,zoom:0}),{d3Zoom:P,d3Selection:B,d3ZoomHandler:V,userSelectionActive:d}=tt(Ll,ot),S=$e(_),v=E.useRef(0),$=E.useRef(!1),k=E.useRef();return Pl(T),E.useEffect(()=>{if(T.current){const w=T.current.getBoundingClientRect(),A=Yu().scaleExtent([x,p]).translateExtent(g),I=pt(T.current).call(A),D=Rt.translate(h.x,h.y).scale(le(h.zoom,x,p)),O=[[0,0],[w.width,w.height]],F=A.constrain()(D,O,g);A.transform(I,F),A.wheelDelta(Xr),C.setState({d3Zoom:A,d3Selection:I,d3ZoomHandler:I.on("wheel.zoom"),transform:[F.x,F.y,F.k],domNode:T.current.closest(".react-flow")})}},[]),E.useEffect(()=>{B&&P&&(i&&!S&&!d?B.on("wheel.zoom",w=>{if(ee(w,N))return!1;w.preventDefault(),w.stopImmediatePropagation();const A=B.property("__zoom").k||1;if(w.ctrlKey&&s){const G=vt(w),J=Xr(w),K=A*Math.pow(2,J);P.scaleTo(B,K,G,w);return}const I=w.deltaMode===1?20:1;let D=a===Yt.Vertical?0:w.deltaX*I,O=a===Yt.Horizontal?0:w.deltaY*I;!Qe()&&w.shiftKey&&a!==Yt.Vertical&&(D=w.deltaY*I,O=0),P.translateBy(B,-(D/A)*c,-(O/A)*c,{internal:!0});const F=Be(B.property("__zoom")),{onViewportChangeStart:q,onViewportChange:W,onViewportChangeEnd:Z}=C.getState();clearTimeout(k.current),$.current||($.current=!0,e==null||e(w,F),q==null||q(F)),$.current&&(t==null||t(w,F),W==null||W(F),k.current=setTimeout(()=>{n==null||n(w,F),Z==null||Z(F),$.current=!1},150))},{passive:!1}):typeof V<"u"&&B.on("wheel.zoom",function(w,A){if(!m&&w.type==="wheel"&&!w.ctrlKey||ee(w,N))return null;w.preventDefault(),V.call(this,w,A)},{passive:!1}))},[d,i,a,B,P,V,S,s,m,N,e,t,n]),E.useEffect(()=>{P&&P.on("start",w=>{var D,O;if(!w.sourceEvent||w.sourceEvent.internal)return null;v.current=(D=w.sourceEvent)==null?void 0:D.button;const{onViewportChangeStart:A}=C.getState(),I=Be(w.transform);z.current=!0,L.current=I,((O=w.sourceEvent)==null?void 0:O.type)==="mousedown"&&C.setState({paneDragging:!0}),A==null||A(I),e==null||e(w.sourceEvent,I)})},[P,e]),E.useEffect(()=>{P&&(d&&!z.current?P.on("zoom",null):d||P.on("zoom",w=>{var I;const{onViewportChange:A}=C.getState();if(C.setState({transform:[w.transform.x,w.transform.y,w.transform.k]}),H.current=!!(r&&Or(f,v.current??0)),(t||A)&&!((I=w.sourceEvent)!=null&&I.internal)){const D=Be(w.transform);A==null||A(D),t==null||t(w.sourceEvent,D)}}))},[d,P,t,f,r]),E.useEffect(()=>{P&&P.on("end",w=>{if(!w.sourceEvent||w.sourceEvent.internal)return null;const{onViewportChangeEnd:A}=C.getState();if(z.current=!1,C.setState({paneDragging:!1}),r&&Or(f,v.current??0)&&!H.current&&r(w.sourceEvent),H.current=!1,(n||A)&&Hl(L.current,w.transform)){const I=Be(w.transform);L.current=I,clearTimeout(M.current),M.current=setTimeout(()=>{A==null||A(I),n==null||n(w.sourceEvent,I)},i?150:0)}})},[P,i,f,n,r]),E.useEffect(()=>{P&&P.filter(w=>{const A=S||o,I=s&&w.ctrlKey;if((f===!0||Array.isArray(f)&&f.includes(1))&&w.button===1&&w.type==="mousedown"&&(ee(w,"react-flow__node")||ee(w,"react-flow__edge")))return!0;if(!f&&!A&&!i&&!l&&!s||d||!l&&w.type==="dblclick"||ee(w,N)&&w.type==="wheel"||ee(w,y)&&(w.type!=="wheel"||i&&w.type==="wheel"&&!S)||!s&&w.ctrlKey&&w.type==="wheel"||!A&&!i&&!I&&w.type==="wheel"||!f&&(w.type==="mousedown"||w.type==="touchstart")||Array.isArray(f)&&!f.includes(w.button)&&w.type==="mousedown")return!1;const D=Array.isArray(f)&&f.includes(w.button)||!w.button||w.button<=1;return(!w.ctrlKey||w.type==="wheel")&&D})},[d,P,o,s,i,l,f,u,S]),R.createElement("div",{className:"react-flow__renderer",ref:T,style:nr},b)},Bl=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function Fl(){const{userSelectionActive:t,userSelectionRect:e}=tt(Bl,ot);return t&&e?R.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function Yr(t,e){const n=e.parentNode||e.parentId,r=t.find(o=>o.id===n);if(r){const o=e.position.x+e.width-r.width,s=e.position.y+e.height-r.height;if(o>0||s>0||e.position.x<0||e.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,o>0&&(r.style.width+=o),s>0&&(r.style.height+=s),e.position.x<0){const i=Math.abs(e.position.x);r.position.x=r.position.x-i,r.style.width+=i,e.position.x=0}if(e.position.y<0){const i=Math.abs(e.position.y);r.position.y=r.position.y-i,r.style.height+=i,e.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function ii(t,e){if(t.some(r=>r.type==="reset"))return t.filter(r=>r.type==="reset").map(r=>r.item);const n=t.filter(r=>r.type==="add").map(r=>r.item);return e.reduce((r,o)=>{const s=t.filter(c=>c.id===o.id);if(s.length===0)return r.push(o),r;const i={...o};for(const c of s)if(c)switch(c.type){case"select":{i.selected=c.selected;break}case"position":{typeof c.position<"u"&&(i.position=c.position),typeof c.positionAbsolute<"u"&&(i.positionAbsolute=c.positionAbsolute),typeof c.dragging<"u"&&(i.dragging=c.dragging),i.expandParent&&Yr(r,i);break}case"dimensions":{typeof c.dimensions<"u"&&(i.width=c.dimensions.width,i.height=c.dimensions.height),typeof c.updateStyle<"u"&&(i.style={...i.style||{},...c.dimensions}),typeof c.resizing=="boolean"&&(i.resizing=c.resizing),i.expandParent&&Yr(r,i);break}case"remove":return r}return r.push(i),r},n)}function si(t,e){return ii(t,e)}function Ol(t,e){return ii(t,e)}const kt=(t,e)=>({id:t,type:"select",selected:e});function re(t,e){return t.reduce((n,r)=>{const o=e.includes(r.id);return!r.selected&&o?(r.selected=!0,n.push(kt(r.id,!0))):r.selected&&!o&&(r.selected=!1,n.push(kt(r.id,!1))),n},[])}const _n=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},Xl=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),ci=E.memo(({isSelecting:t,selectionMode:e=Me.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:o,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:c,onPaneMouseEnter:a,onPaneMouseMove:l,onPaneMouseLeave:u,children:f})=>{const h=E.useRef(null),g=nt(),x=E.useRef(0),p=E.useRef(0),_=E.useRef(),{userSelectionActive:m,elementsSelectable:b,dragging:N}=tt(Xl,ot),y=()=>{g.setState({userSelectionActive:!1,userSelectionRect:null}),x.current=0,p.current=0},M=V=>{s==null||s(V),g.getState().resetSelectedElements(),g.setState({nodesSelectionActive:!1})},C=V=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){V.preventDefault();return}i==null||i(V)},z=c?V=>c(V):void 0,H=V=>{const{resetSelectedElements:d,domNode:S}=g.getState();if(_.current=S==null?void 0:S.getBoundingClientRect(),!b||!t||V.button!==0||V.target!==h.current||!_.current)return;const{x:v,y:$}=zt(V,_.current);d(),g.setState({userSelectionRect:{width:0,height:0,startX:v,startY:$,x:v,y:$}}),r==null||r(V)},T=V=>{const{userSelectionRect:d,nodeInternals:S,edges:v,transform:$,onNodesChange:k,onEdgesChange:w,nodeOrigin:A,getNodes:I}=g.getState();if(!t||!_.current||!d)return;g.setState({userSelectionActive:!0,nodesSelectionActive:!1});const D=zt(V,_.current),O=d.startX??0,F=d.startY??0,q={...d,x:D.x<O?D.x:O,y:D.y<F?D.y:F,width:Math.abs(D.x-O),height:Math.abs(D.y-F)},W=I(),Z=Bo(S,q,$,e===Me.Partial,!0,A),G=Fo(Z,v).map(K=>K.id),J=Z.map(K=>K.id);if(x.current!==J.length){x.current=J.length;const K=re(W,J);K.length&&(k==null||k(K))}if(p.current!==G.length){p.current=G.length;const K=re(v,G);K.length&&(w==null||w(K))}g.setState({userSelectionRect:q})},L=V=>{if(V.button!==0)return;const{userSelectionRect:d}=g.getState();!m&&d&&V.target===h.current&&(M==null||M(V)),g.setState({nodesSelectionActive:x.current>0}),y(),o==null||o(V)},P=V=>{m&&(g.setState({nodesSelectionActive:x.current>0}),o==null||o(V)),y()},B=b&&(t||m);return R.createElement("div",{className:ft(["react-flow__pane",{dragging:N,selection:t}]),onClick:B?void 0:_n(M,h),onContextMenu:_n(C,h),onWheel:_n(z,h),onMouseEnter:B?void 0:a,onMouseDown:B?H:void 0,onMouseMove:B?T:l,onMouseUp:B?L:void 0,onMouseLeave:B?P:u,ref:h,style:nr},f,R.createElement(Fl,null))});ci.displayName="Pane";function ai(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const r=e.get(n);return r?r.selected?!0:ai(r,e):!1}function qr(t,e,n){let r=t;do{if(r!=null&&r.matches(e))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function Yl(t,e,n,r){return Array.from(t.values()).filter(o=>(o.selected||o.id===r)&&(!o.parentNode||o.parentId||!ai(o,t))&&(o.draggable||e&&typeof o.draggable>"u")).map(o=>{var s,i;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=o.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((i=o.positionAbsolute)==null?void 0:i.y)??0)},delta:{x:0,y:0},extent:o.extent,parentNode:o.parentNode||o.parentId,parentId:o.parentNode||o.parentId,width:o.width,height:o.height,expandParent:o.expandParent}})}function ql(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function ui(t,e,n,r,o=[0,0],s){const i=ql(t,t.extent||r);let c=i;const a=t.parentNode||t.parentId;if(t.extent==="parent"&&!t.expandParent)if(a&&t.width&&t.height){const f=n.get(a),{x:h,y:g}=se(f,o).positionAbsolute;c=f&<(h)&<(g)&<(f.width)&<(f.height)?[[h+t.width*o[0],g+t.height*o[1]],[h+f.width-t.width+t.width*o[0],g+f.height-t.height+t.height*o[1]]]:c}else s==null||s("005",$t.error005()),c=i;else if(t.extent&&a&&t.extent!=="parent"){const f=n.get(a),{x:h,y:g}=se(f,o).positionAbsolute;c=[[t.extent[0][0]+h,t.extent[0][1]+g],[t.extent[1][0]+h,t.extent[1][1]+g]]}let l={x:0,y:0};if(a){const f=n.get(a);l=se(f,o).positionAbsolute}const u=c&&c!=="parent"?Wn(e,c):e;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function bn({nodeId:t,dragItems:e,nodeInternals:n}){const r=e.map(o=>({...n.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[t?r.find(o=>o.id===t):r[0],r]}const Ur=(t,e,n,r)=>{const o=e.querySelectorAll(t);if(!o||!o.length)return null;const s=Array.from(o),i=e.getBoundingClientRect(),c={x:i.width*r[0],y:i.height*r[1]};return s.map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),position:a.getAttribute("data-handlepos"),x:(l.left-i.left-c.x)/n,y:(l.top-i.top-c.y)/n,...Un(a)}})};function xe(t,e,n){return n===void 0?n:r=>{const o=e().nodeInternals.get(t);o&&n(r,{...o})}}function Ln({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:s,multiSelectionActive:i,nodeInternals:c,onError:a}=e.getState(),l=c.get(t);if(!l){a==null||a("012",$t.error012(t));return}e.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&i)&&(s({nodes:[l],edges:[]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):o([t])}function Ul(){const t=nt();return E.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:o,snapToGrid:s}=t.getState(),i=n.touches?n.touches[0].clientX:n.clientX,c=n.touches?n.touches[0].clientY:n.clientY,a={x:(i-r[0])/r[2],y:(c-r[1])/r[2]};return{xSnapped:s?o[0]*Math.round(a.x/o[0]):a.x,ySnapped:s?o[1]*Math.round(a.y/o[1]):a.y,...a}},[])}function Sn(t){return(e,n,r)=>t==null?void 0:t(e,r)}function li({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:s,selectNodesOnDrag:i}){const c=nt(),[a,l]=E.useState(!1),u=E.useRef([]),f=E.useRef({x:null,y:null}),h=E.useRef(0),g=E.useRef(null),x=E.useRef({x:0,y:0}),p=E.useRef(null),_=E.useRef(!1),m=E.useRef(!1),b=E.useRef(!1),N=Ul();return E.useEffect(()=>{if(t!=null&&t.current){const y=pt(t.current),M=({x:H,y:T})=>{const{nodeInternals:L,onNodeDrag:P,onSelectionDrag:B,updateNodePositions:V,nodeExtent:d,snapGrid:S,snapToGrid:v,nodeOrigin:$,onError:k}=c.getState();f.current={x:H,y:T};let w=!1,A={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&d){const D=jn(u.current,$);A=Zn(D)}if(u.current=u.current.map(D=>{const O={x:H-D.distance.x,y:T-D.distance.y};v&&(O.x=S[0]*Math.round(O.x/S[0]),O.y=S[1]*Math.round(O.y/S[1]));const F=[[d[0][0],d[0][1]],[d[1][0],d[1][1]]];u.current.length>1&&d&&!D.extent&&(F[0][0]=D.positionAbsolute.x-A.x+d[0][0],F[1][0]=D.positionAbsolute.x+(D.width??0)-A.x2+d[1][0],F[0][1]=D.positionAbsolute.y-A.y+d[0][1],F[1][1]=D.positionAbsolute.y+(D.height??0)-A.y2+d[1][1]);const q=ui(D,O,L,F,$,k);return w=w||D.position.x!==q.position.x||D.position.y!==q.position.y,D.position=q.position,D.positionAbsolute=q.positionAbsolute,D}),!w)return;V(u.current,!0,!0),l(!0);const I=o?P:Sn(B);if(I&&p.current){const[D,O]=bn({nodeId:o,dragItems:u.current,nodeInternals:L});I(p.current,D,O)}},C=()=>{if(!g.current)return;const[H,T]=ko(x.current,g.current);if(H!==0||T!==0){const{transform:L,panBy:P}=c.getState();f.current.x=(f.current.x??0)-H/L[2],f.current.y=(f.current.y??0)-T/L[2],P({x:H,y:T})&&M(f.current)}h.current=requestAnimationFrame(C)},z=H=>{var $;const{nodeInternals:T,multiSelectionActive:L,nodesDraggable:P,unselectNodesAndEdges:B,onNodeDragStart:V,onSelectionDragStart:d}=c.getState();m.current=!0;const S=o?V:Sn(d);(!i||!s)&&!L&&o&&(($=T.get(o))!=null&&$.selected||B()),o&&s&&i&&Ln({id:o,store:c,nodeRef:t});const v=N(H);if(f.current=v,u.current=Yl(T,P,v,o),S&&u.current){const[k,w]=bn({nodeId:o,dragItems:u.current,nodeInternals:T});S(H.sourceEvent,k,w)}};if(e)y.on(".drag",null);else{const H=ta().on("start",T=>{const{domNode:L,nodeDragThreshold:P}=c.getState();P===0&&z(T),b.current=!1;const B=N(T);f.current=B,g.current=(L==null?void 0:L.getBoundingClientRect())||null,x.current=zt(T.sourceEvent,g.current)}).on("drag",T=>{var V,d;const L=N(T),{autoPanOnNodeDrag:P,nodeDragThreshold:B}=c.getState();if(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1&&(b.current=!0),!b.current){if(!_.current&&m.current&&P&&(_.current=!0,C()),!m.current){const S=L.xSnapped-(((V=f==null?void 0:f.current)==null?void 0:V.x)??0),v=L.ySnapped-(((d=f==null?void 0:f.current)==null?void 0:d.y)??0);Math.sqrt(S*S+v*v)>B&&z(T)}(f.current.x!==L.xSnapped||f.current.y!==L.ySnapped)&&u.current&&m.current&&(p.current=T.sourceEvent,x.current=zt(T.sourceEvent,g.current),M(L))}}).on("end",T=>{if(!(!m.current||b.current)&&(l(!1),_.current=!1,m.current=!1,cancelAnimationFrame(h.current),u.current)){const{updateNodePositions:L,nodeInternals:P,onNodeDragStop:B,onSelectionDragStop:V}=c.getState(),d=o?B:Sn(V);if(L(u.current,!1,!1),d){const[S,v]=bn({nodeId:o,dragItems:u.current,nodeInternals:P});d(T.sourceEvent,S,v)}}}).filter(T=>{const L=T.target;return!T.button&&(!n||!qr(L,`.${n}`,t))&&(!r||qr(L,r,t))});return y.call(H),()=>{y.on(".drag",null)}}}},[t,e,n,r,s,c,o,i,N]),a}function fi(){const t=nt();return E.useCallback(n=>{const{nodeInternals:r,nodeExtent:o,updateNodePositions:s,getNodes:i,snapToGrid:c,snapGrid:a,onError:l,nodesDraggable:u}=t.getState(),f=i().filter(b=>b.selected&&(b.draggable||u&&typeof b.draggable>"u")),h=c?a[0]:5,g=c?a[1]:5,x=n.isShiftPressed?4:1,p=n.x*h*x,_=n.y*g*x,m=f.map(b=>{if(b.positionAbsolute){const N={x:b.positionAbsolute.x+p,y:b.positionAbsolute.y+_};c&&(N.x=a[0]*Math.round(N.x/a[0]),N.y=a[1]*Math.round(N.y/a[1]));const{positionAbsolute:y,position:M}=ui(b,N,r,o,void 0,l);b.position=M,b.positionAbsolute=y}return b});s(m,!0,!1)},[])}const ce={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var we=t=>{const e=({id:n,type:r,data:o,xPos:s,yPos:i,xPosOrigin:c,yPosOrigin:a,selected:l,onClick:u,onMouseEnter:f,onMouseMove:h,onMouseLeave:g,onContextMenu:x,onDoubleClick:p,style:_,className:m,isDraggable:b,isSelectable:N,isConnectable:y,isFocusable:M,selectNodesOnDrag:C,sourcePosition:z,targetPosition:H,hidden:T,resizeObserver:L,dragHandle:P,zIndex:B,isParent:V,noDragClassName:d,noPanClassName:S,initialized:v,disableKeyboardA11y:$,ariaLabel:k,rfId:w,hasHandleBounds:A})=>{const I=nt(),D=E.useRef(null),O=E.useRef(null),F=E.useRef(z),q=E.useRef(H),W=E.useRef(r),Z=N||b||u||f||h||g,G=fi(),J=xe(n,I.getState,f),K=xe(n,I.getState,h),dt=xe(n,I.getState,g),at=xe(n,I.getState,x),ht=xe(n,I.getState,p),ut=Q=>{const{nodeDragThreshold:Y}=I.getState();if(N&&(!C||!b||Y>0)&&Ln({id:n,store:I,nodeRef:D}),u){const st=I.getState().nodeInternals.get(n);st&&u(Q,{...st})}},et=Q=>{if(!Rn(Q)&&!$)if(Ro.includes(Q.key)&&N){const Y=Q.key==="Escape";Ln({id:n,store:I,unselect:Y,nodeRef:D})}else b&&l&&Object.prototype.hasOwnProperty.call(ce,Q.key)&&(I.setState({ariaLiveMessage:`Moved selected node ${Q.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),G({x:ce[Q.key].x,y:ce[Q.key].y,isShiftPressed:Q.shiftKey}))};E.useEffect(()=>()=>{O.current&&(L==null||L.unobserve(O.current),O.current=null)},[]),E.useEffect(()=>{if(D.current&&!T){const Q=D.current;(!v||!A||O.current!==Q)&&(O.current&&(L==null||L.unobserve(O.current)),L==null||L.observe(Q),O.current=Q)}},[T,v,A]),E.useEffect(()=>{const Q=W.current!==r,Y=F.current!==z,st=q.current!==H;D.current&&(Q||Y||st)&&(Q&&(W.current=r),Y&&(F.current=z),st&&(q.current=H),I.getState().updateNodeDimensions([{id:n,nodeElement:D.current,forceUpdate:!0}]))},[n,r,z,H]);const xt=li({nodeRef:D,disabled:T||!b,noDragClassName:d,handleSelector:P,nodeId:n,isSelectable:N,selectNodesOnDrag:C});return T?null:R.createElement("div",{className:ft(["react-flow__node",`react-flow__node-${r}`,{[S]:b},m,{selected:l,selectable:N,parent:V,dragging:xt}]),ref:D,style:{zIndex:B,transform:`translate(${c}px,${a}px)`,pointerEvents:Z?"all":"none",visibility:v?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:J,onMouseMove:K,onMouseLeave:dt,onContextMenu:at,onClick:ut,onDoubleClick:ht,onKeyDown:M?et:void 0,tabIndex:M?0:void 0,role:M?"button":void 0,"aria-describedby":$?void 0:`${jo}-${w}`,"aria-label":k},R.createElement(sl,{value:n},R.createElement(t,{id:n,data:o,type:r,xPos:s,yPos:i,selected:l,isConnectable:y,sourcePosition:z,targetPosition:H,dragging:xt,dragHandle:P,zIndex:B})))};return e.displayName="NodeWrapper",E.memo(e)};const Wl=t=>{const e=t.getNodes().filter(n=>n.selected);return{...jn(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function Zl({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=nt(),{width:o,height:s,x:i,y:c,transformString:a,userSelectionActive:l}=tt(Wl,ot),u=fi(),f=E.useRef(null);if(E.useEffect(()=>{var x;n||(x=f.current)==null||x.focus({preventScroll:!0})},[n]),li({nodeRef:f}),l||!o||!s)return null;const h=t?x=>{const p=r.getState().getNodes().filter(_=>_.selected);t(x,p)}:void 0,g=x=>{Object.prototype.hasOwnProperty.call(ce,x.key)&&u({x:ce[x.key].x,y:ce[x.key].y,isShiftPressed:x.shiftKey})};return R.createElement("div",{className:ft(["react-flow__nodesselection","react-flow__container",e]),style:{transform:a}},R.createElement("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:o,height:s,top:c,left:i}}))}var Gl=E.memo(Zl);const Kl=t=>t.nodesSelectionActive,di=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:c,onMove:a,onMoveStart:l,onMoveEnd:u,selectionKeyCode:f,selectionOnDrag:h,selectionMode:g,onSelectionStart:x,onSelectionEnd:p,multiSelectionKeyCode:_,panActivationKeyCode:m,zoomActivationKeyCode:b,elementsSelectable:N,zoomOnScroll:y,zoomOnPinch:M,panOnScroll:C,panOnScrollSpeed:z,panOnScrollMode:H,zoomOnDoubleClick:T,panOnDrag:L,defaultViewport:P,translateExtent:B,minZoom:V,maxZoom:d,preventScrolling:S,onSelectionContextMenu:v,noWheelClassName:$,noPanClassName:k,disableKeyboardA11y:w})=>{const A=tt(Kl),I=$e(f),D=$e(m),O=D||L,F=D||C,q=I||h&&O!==!0;return Dl({deleteKeyCode:c,multiSelectionKeyCode:_}),R.createElement(Vl,{onMove:a,onMoveStart:l,onMoveEnd:u,onPaneContextMenu:s,elementsSelectable:N,zoomOnScroll:y,zoomOnPinch:M,panOnScroll:F,panOnScrollSpeed:z,panOnScrollMode:H,zoomOnDoubleClick:T,panOnDrag:!I&&O,defaultViewport:P,translateExtent:B,minZoom:V,maxZoom:d,zoomActivationKeyCode:b,preventScrolling:S,noWheelClassName:$,noPanClassName:k},R.createElement(ci,{onSelectionStart:x,onSelectionEnd:p,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:O,isSelecting:!!q,selectionMode:g},t,A&&R.createElement(Gl,{onSelectionContextMenu:v,noPanClassName:k,disableKeyboardA11y:w})))};di.displayName="FlowRenderer";var Ql=E.memo(di);function Jl(t){return tt(E.useCallback(n=>t?Bo(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function jl(t){const e={input:we(t.input||Go),default:we(t.default||Hn),output:we(t.output||Qo),group:we(t.group||er)},n={},r=Object.keys(t).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,s)=>(o[s]=we(t[s]||Hn),o),n);return{...e,...r}}const tf=({x:t,y:e,width:n,height:r,origin:o})=>!n||!r?{x:t,y:e}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:t,y:e}:{x:t-n*o[0],y:e-r*o[1]},ef=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),hi=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,updateNodeDimensions:s,onError:i}=tt(ef,ot),c=Jl(t.onlyRenderVisibleElements),a=E.useRef(),l=E.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const u=new ResizeObserver(f=>{const h=f.map(g=>({id:g.target.getAttribute("data-id"),nodeElement:g.target,forceUpdate:!0}));s(h)});return a.current=u,u},[]);return E.useEffect(()=>()=>{var u;(u=a==null?void 0:a.current)==null||u.disconnect()},[]),R.createElement("div",{className:"react-flow__nodes",style:nr},c.map(u=>{var M,C,z;let f=u.type||"default";t.nodeTypes[f]||(i==null||i("003",$t.error003(f)),f="default");const h=t.nodeTypes[f]||t.nodeTypes.default,g=!!(u.draggable||e&&typeof u.draggable>"u"),x=!!(u.selectable||o&&typeof u.selectable>"u"),p=!!(u.connectable||n&&typeof u.connectable>"u"),_=!!(u.focusable||r&&typeof u.focusable>"u"),m=t.nodeExtent?Wn(u.positionAbsolute,t.nodeExtent):u.positionAbsolute,b=(m==null?void 0:m.x)??0,N=(m==null?void 0:m.y)??0,y=tf({x:b,y:N,width:u.width??0,height:u.height??0,origin:t.nodeOrigin});return R.createElement(h,{key:u.id,id:u.id,className:u.className,style:u.style,type:f,data:u.data,sourcePosition:u.sourcePosition||X.Bottom,targetPosition:u.targetPosition||X.Top,hidden:u.hidden,xPos:b,yPos:N,xPosOrigin:y.x,yPosOrigin:y.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!u.selected,isDraggable:g,isSelectable:x,isConnectable:p,isFocusable:_,resizeObserver:l,dragHandle:u.dragHandle,zIndex:((M=u[j])==null?void 0:M.z)??0,isParent:!!((C=u[j])!=null&&C.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!u.width&&!!u.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:u.ariaLabel,hasHandleBounds:!!((z=u[j])!=null&&z.handleBounds)})}))};hi.displayName="NodeRenderer";var nf=E.memo(hi);const rf=(t,e,n)=>n===X.Left?t-e:n===X.Right?t+e:t,of=(t,e,n)=>n===X.Top?t-e:n===X.Bottom?t+e:t,Wr="react-flow__edgeupdater",Zr=({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:s,onMouseOut:i,type:c})=>R.createElement("circle",{onMouseDown:o,onMouseEnter:s,onMouseOut:i,className:ft([Wr,`${Wr}-${c}`]),cx:rf(e,r,t),cy:of(n,r,t),r,stroke:"transparent",fill:"transparent"}),sf=()=>!0;var ne=t=>{const e=({id:n,className:r,type:o,data:s,onClick:i,onEdgeDoubleClick:c,selected:a,animated:l,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:p,style:_,source:m,target:b,sourceX:N,sourceY:y,targetX:M,targetY:C,sourcePosition:z,targetPosition:H,elementsSelectable:T,hidden:L,sourceHandleId:P,targetHandleId:B,onContextMenu:V,onMouseEnter:d,onMouseMove:S,onMouseLeave:v,reconnectRadius:$,onReconnect:k,onReconnectStart:w,onReconnectEnd:A,markerEnd:I,markerStart:D,rfId:O,ariaLabel:F,isFocusable:q,isReconnectable:W,pathOptions:Z,interactionWidth:G,disableKeyboardA11y:J})=>{const K=E.useRef(null),[dt,at]=E.useState(!1),[ht,ut]=E.useState(!1),et=nt(),xt=E.useMemo(()=>`url('#${Dn(D,O)}')`,[D,O]),Q=E.useMemo(()=>`url('#${Dn(I,O)}')`,[I,O]);if(L)return null;const Y=rt=>{var wt;const{edges:gt,addSelectedEdges:Lt,unselectNodesAndEdges:Vt,multiSelectionActive:Bt}=et.getState(),Et=gt.find(he=>he.id===n);Et&&(T&&(et.setState({nodesSelectionActive:!1}),Et.selected&&Bt?(Vt({nodes:[],edges:[Et]}),(wt=K.current)==null||wt.blur()):Lt([n])),i&&i(rt,Et))},st=ye(n,et.getState,c),Dt=ye(n,et.getState,V),fe=ye(n,et.getState,d),Zt=ye(n,et.getState,S),Gt=ye(n,et.getState,v),St=(rt,gt)=>{if(rt.button!==0)return;const{edges:Lt,isValidConnection:Vt}=et.getState(),Bt=gt?b:m,Et=(gt?B:P)||null,wt=gt?"target":"source",he=Vt||sf,an=gt,ge=Lt.find(Ft=>Ft.id===n);ut(!0),w==null||w(rt,ge,wt);const un=Ft=>{ut(!1),A==null||A(Ft,ge,wt)};qo({event:rt,handleId:Et,nodeId:Bt,onConnect:Ft=>k==null?void 0:k(ge,Ft),isTarget:an,getState:et.getState,setState:et.setState,isValidConnection:he,edgeUpdaterType:wt,onReconnectEnd:un})},Kt=rt=>St(rt,!0),Pt=rt=>St(rt,!1),Ht=()=>at(!0),Qt=()=>at(!1),Jt=!T&&!i,de=rt=>{var gt;if(!J&&Ro.includes(rt.key)&&T){const{unselectNodesAndEdges:Lt,addSelectedEdges:Vt,edges:Bt}=et.getState();rt.key==="Escape"?((gt=K.current)==null||gt.blur(),Lt({edges:[Bt.find(wt=>wt.id===n)]})):Vt([n])}};return R.createElement("g",{className:ft(["react-flow__edge",`react-flow__edge-${o}`,r,{selected:a,animated:l,inactive:Jt,updating:dt}]),onClick:Y,onDoubleClick:st,onContextMenu:Dt,onMouseEnter:fe,onMouseMove:Zt,onMouseLeave:Gt,onKeyDown:q?de:void 0,tabIndex:q?0:void 0,role:q?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":F===null?void 0:F||`Edge from ${m} to ${b}`,"aria-describedby":q?`${ti}-${O}`:void 0,ref:K},!ht&&R.createElement(t,{id:n,source:m,target:b,selected:a,animated:l,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:p,data:s,style:_,sourceX:N,sourceY:y,targetX:M,targetY:C,sourcePosition:z,targetPosition:H,sourceHandleId:P,targetHandleId:B,markerStart:xt,markerEnd:Q,pathOptions:Z,interactionWidth:G}),W&&R.createElement(R.Fragment,null,(W==="source"||W===!0)&&R.createElement(Zr,{position:z,centerX:N,centerY:y,radius:$,onMouseDown:Kt,onMouseEnter:Ht,onMouseOut:Qt,type:"source"}),(W==="target"||W===!0)&&R.createElement(Zr,{position:H,centerX:M,centerY:C,radius:$,onMouseDown:Pt,onMouseEnter:Ht,onMouseOut:Qt,type:"target"})))};return e.displayName="EdgeWrapper",E.memo(e)};function cf(t){const e={default:ne(t.default||je),straight:ne(t.bezier||Qn),step:ne(t.step||Kn),smoothstep:ne(t.step||cn),simplebezier:ne(t.simplebezier||Gn)},n={},r=Object.keys(t).filter(o=>!["default","bezier"].includes(o)).reduce((o,s)=>(o[s]=ne(t[s]||je),o),n);return{...e,...r}}function Gr(t,e,n=null){const r=((n==null?void 0:n.x)||0)+e.x,o=((n==null?void 0:n.y)||0)+e.y,s=(n==null?void 0:n.width)||e.width,i=(n==null?void 0:n.height)||e.height;switch(t){case X.Top:return{x:r+s/2,y:o};case X.Right:return{x:r+s,y:o+i/2};case X.Bottom:return{x:r+s/2,y:o+i};case X.Left:return{x:r,y:o+i/2}}}function Kr(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const af=(t,e,n,r,o,s)=>{const i=Gr(n,t,e),c=Gr(s,r,o);return{sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}};function uf({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:r,targetWidth:o,targetHeight:s,width:i,height:c,transform:a}){const l={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+o),y2:Math.max(t.y+r,e.y+s)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const u=Zn({x:(0-a[0])/a[2],y:(0-a[1])/a[2],width:i/a[2],height:c/a[2]}),f=Math.max(0,Math.min(u.x2,l.x2)-Math.max(u.x,l.x)),h=Math.max(0,Math.min(u.y2,l.y2)-Math.max(u.y,l.y));return Math.ceil(f*h)>0}function Qr(t){var r,o,s,i,c;const e=((r=t==null?void 0:t[j])==null?void 0:r.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&typeof((o=t==null?void 0:t.positionAbsolute)==null?void 0:o.x)<"u"&&typeof((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)<"u";return[{x:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.x)||0,y:((c=t==null?void 0:t.positionAbsolute)==null?void 0:c.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const lf=[{level:0,isMaxLevel:!0,edges:[]}];function ff(t,e,n=!1){let r=-1;const o=t.reduce((i,c)=>{var u,f;const a=lt(c.zIndex);let l=a?c.zIndex:0;if(n){const h=e.get(c.target),g=e.get(c.source),x=c.selected||(h==null?void 0:h.selected)||(g==null?void 0:g.selected),p=Math.max(((u=g==null?void 0:g[j])==null?void 0:u.z)||0,((f=h==null?void 0:h[j])==null?void 0:f.z)||0,1e3);l=(a?c.zIndex:0)+(x?p:0)}return i[l]?i[l].push(c):i[l]=[c],r=l>r?l:r,i},{}),s=Object.entries(o).map(([i,c])=>{const a=+i;return{edges:c,level:a,isMaxLevel:a===r}});return s.length===0?lf:s}function df(t,e,n){const r=tt(E.useCallback(o=>t?o.edges.filter(s=>{const i=e.get(s.source),c=e.get(s.target);return(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&uf({sourcePos:i.positionAbsolute||{x:0,y:0},targetPos:c.positionAbsolute||{x:0,y:0},sourceWidth:i.width,sourceHeight:i.height,targetWidth:c.width,targetHeight:c.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e]));return ff(r,e,n)}const hf=({color:t="none",strokeWidth:e=1})=>R.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),gf=({color:t="none",strokeWidth:e=1})=>R.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Jr={[Je.Arrow]:hf,[Je.ArrowClosed]:gf};function pf(t){const e=nt();return E.useMemo(()=>{var o,s;return Object.prototype.hasOwnProperty.call(Jr,t)?Jr[t]:((s=(o=e.getState()).onError)==null||s.call(o,"009",$t.error009(t)),null)},[t])}const mf=({id:t,type:e,color:n,width:r=12.5,height:o=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:c="auto-start-reverse"})=>{const a=pf(e);return a?R.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0"},R.createElement(a,{color:n,strokeWidth:i})):null},yf=({defaultColor:t,rfId:e})=>n=>{const r=[];return n.edges.reduce((o,s)=>([s.markerStart,s.markerEnd].forEach(i=>{if(i&&typeof i=="object"){const c=Dn(i,e);r.includes(c)||(o.push({id:c,color:i.color||t,...i}),r.push(c))}}),o),[]).sort((o,s)=>o.id.localeCompare(s.id))},gi=({defaultColor:t,rfId:e})=>{const n=tt(E.useCallback(yf({defaultColor:t,rfId:e}),[t,e]),(r,o)=>!(r.length!==o.length||r.some((s,i)=>s.id!==o[i].id)));return R.createElement("defs",null,n.map(r=>R.createElement(mf,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};gi.displayName="MarkerDefinitions";var xf=E.memo(gi);const wf=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),pi=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:r,edgeTypes:o,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:c,onEdgeMouseMove:a,onEdgeMouseLeave:l,onEdgeClick:u,onEdgeDoubleClick:f,onReconnect:h,onReconnectStart:g,onReconnectEnd:x,reconnectRadius:p,children:_,disableKeyboardA11y:m})=>{const{edgesFocusable:b,edgesUpdatable:N,elementsSelectable:y,width:M,height:C,connectionMode:z,nodeInternals:H,onError:T}=tt(wf,ot),L=df(e,H,n);return M?R.createElement(R.Fragment,null,L.map(({level:P,edges:B,isMaxLevel:V})=>R.createElement("svg",{key:P,style:{zIndex:P},width:M,height:C,className:"react-flow__edges react-flow__container"},V&&R.createElement(xf,{defaultColor:t,rfId:r}),R.createElement("g",null,B.map(d=>{const[S,v,$]=Qr(H.get(d.source)),[k,w,A]=Qr(H.get(d.target));if(!$||!A)return null;let I=d.type||"default";o[I]||(T==null||T("011",$t.error011(I)),I="default");const D=o[I]||o.default,O=z===Wt.Strict?w.target:(w.target??[]).concat(w.source??[]),F=Kr(v.source,d.sourceHandle),q=Kr(O,d.targetHandle),W=(F==null?void 0:F.position)||X.Bottom,Z=(q==null?void 0:q.position)||X.Top,G=!!(d.focusable||b&&typeof d.focusable>"u"),J=d.reconnectable||d.updatable,K=typeof h<"u"&&(J||N&&typeof J>"u");if(!F||!q)return T==null||T("008",$t.error008(F,d)),null;const{sourceX:dt,sourceY:at,targetX:ht,targetY:ut}=af(S,F,W,k,q,Z);return R.createElement(D,{key:d.id,id:d.id,className:ft([d.className,s]),type:I,data:d.data,selected:!!d.selected,animated:!!d.animated,hidden:!!d.hidden,label:d.label,labelStyle:d.labelStyle,labelShowBg:d.labelShowBg,labelBgStyle:d.labelBgStyle,labelBgPadding:d.labelBgPadding,labelBgBorderRadius:d.labelBgBorderRadius,style:d.style,source:d.source,target:d.target,sourceHandleId:d.sourceHandle,targetHandleId:d.targetHandle,markerEnd:d.markerEnd,markerStart:d.markerStart,sourceX:dt,sourceY:at,targetX:ht,targetY:ut,sourcePosition:W,targetPosition:Z,elementsSelectable:y,onContextMenu:i,onMouseEnter:c,onMouseMove:a,onMouseLeave:l,onClick:u,onEdgeDoubleClick:f,onReconnect:h,onReconnectStart:g,onReconnectEnd:x,reconnectRadius:p,rfId:r,ariaLabel:d.ariaLabel,isFocusable:G,isReconnectable:K,pathOptions:"pathOptions"in d?d.pathOptions:void 0,interactionWidth:d.interactionWidth,disableKeyboardA11y:m})})))),_):null};pi.displayName="EdgeRenderer";var vf=E.memo(pi);const _f=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function bf({children:t}){const e=tt(_f);return R.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function Sf(t){const e=oi(),n=E.useRef(!1);E.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const Ef={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top},mi=({nodeId:t,handleType:e,style:n,type:r=It.Bezier,CustomComponent:o,connectionStatus:s})=>{var C,z,H;const{fromNode:i,handleId:c,toX:a,toY:l,connectionMode:u}=tt(E.useCallback(T=>({fromNode:T.nodeInternals.get(t),handleId:T.connectionHandleId,toX:(T.connectionPosition.x-T.transform[0])/T.transform[2],toY:(T.connectionPosition.y-T.transform[1])/T.transform[2],connectionMode:T.connectionMode}),[t]),ot),f=(C=i==null?void 0:i[j])==null?void 0:C.handleBounds;let h=f==null?void 0:f[e];if(u===Wt.Loose&&(h=h||(f==null?void 0:f[e==="source"?"target":"source"])),!i||!h)return null;const g=c?h.find(T=>T.id===c):h[0],x=g?g.x+g.width/2:(i.width??0)/2,p=g?g.y+g.height/2:i.height??0,_=(((z=i.positionAbsolute)==null?void 0:z.x)??0)+x,m=(((H=i.positionAbsolute)==null?void 0:H.y)??0)+p,b=g==null?void 0:g.position,N=b?Ef[b]:null;if(!b||!N)return null;if(o)return R.createElement(o,{connectionLineType:r,connectionLineStyle:n,fromNode:i,fromHandle:g,fromX:_,fromY:m,toX:a,toY:l,fromPosition:b,toPosition:N,connectionStatus:s});let y="";const M={sourceX:_,sourceY:m,sourcePosition:b,targetX:a,targetY:l,targetPosition:N};return r===It.Bezier?[y]=Lo(M):r===It.Step?[y]=zn({...M,borderRadius:0}):r===It.SmoothStep?[y]=zn(M):r===It.SimpleBezier?[y]=Ho(M):y=`M${_},${m} ${a},${l}`,R.createElement("path",{d:y,fill:"none",className:"react-flow__connection-path",style:n})};mi.displayName="ConnectionLine";const Nf=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function Af({containerStyle:t,style:e,type:n,component:r}){const{nodeId:o,handleType:s,nodesConnectable:i,width:c,height:a,connectionStatus:l}=tt(Nf,ot);return!(o&&s&&c&&i)?null:R.createElement("svg",{style:t,width:c,height:a,className:"react-flow__edges react-flow__connectionline react-flow__container"},R.createElement("g",{className:ft(["react-flow__connection",l])},R.createElement(mi,{nodeId:o,handleType:s,style:e,type:n,CustomComponent:r,connectionStatus:l})))}function jr(t,e){return E.useRef(null),nt(),E.useMemo(()=>e(t),[t])}const yi=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:r,onMoveEnd:o,onInit:s,onNodeClick:i,onEdgeClick:c,onNodeDoubleClick:a,onEdgeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:f,onNodeMouseLeave:h,onNodeContextMenu:g,onSelectionContextMenu:x,onSelectionStart:p,onSelectionEnd:_,connectionLineType:m,connectionLineStyle:b,connectionLineComponent:N,connectionLineContainerStyle:y,selectionKeyCode:M,selectionOnDrag:C,selectionMode:z,multiSelectionKeyCode:H,panActivationKeyCode:T,zoomActivationKeyCode:L,deleteKeyCode:P,onlyRenderVisibleElements:B,elementsSelectable:V,selectNodesOnDrag:d,defaultViewport:S,translateExtent:v,minZoom:$,maxZoom:k,preventScrolling:w,defaultMarkerColor:A,zoomOnScroll:I,zoomOnPinch:D,panOnScroll:O,panOnScrollSpeed:F,panOnScrollMode:q,zoomOnDoubleClick:W,panOnDrag:Z,onPaneClick:G,onPaneMouseEnter:J,onPaneMouseMove:K,onPaneMouseLeave:dt,onPaneScroll:at,onPaneContextMenu:ht,onEdgeContextMenu:ut,onEdgeMouseEnter:et,onEdgeMouseMove:xt,onEdgeMouseLeave:Q,onReconnect:Y,onReconnectStart:st,onReconnectEnd:Dt,reconnectRadius:fe,noDragClassName:Zt,noWheelClassName:Gt,noPanClassName:St,elevateEdgesOnSelect:Kt,disableKeyboardA11y:Pt,nodeOrigin:Ht,nodeExtent:Qt,rfId:Jt})=>{const de=jr(t,jl),rt=jr(e,cf);return Sf(s),R.createElement(Ql,{onPaneClick:G,onPaneMouseEnter:J,onPaneMouseMove:K,onPaneMouseLeave:dt,onPaneContextMenu:ht,onPaneScroll:at,deleteKeyCode:P,selectionKeyCode:M,selectionOnDrag:C,selectionMode:z,onSelectionStart:p,onSelectionEnd:_,multiSelectionKeyCode:H,panActivationKeyCode:T,zoomActivationKeyCode:L,elementsSelectable:V,onMove:n,onMoveStart:r,onMoveEnd:o,zoomOnScroll:I,zoomOnPinch:D,zoomOnDoubleClick:W,panOnScroll:O,panOnScrollSpeed:F,panOnScrollMode:q,panOnDrag:Z,defaultViewport:S,translateExtent:v,minZoom:$,maxZoom:k,onSelectionContextMenu:x,preventScrolling:w,noDragClassName:Zt,noWheelClassName:Gt,noPanClassName:St,disableKeyboardA11y:Pt},R.createElement(bf,null,R.createElement(vf,{edgeTypes:rt,onEdgeClick:c,onEdgeDoubleClick:l,onlyRenderVisibleElements:B,onEdgeContextMenu:ut,onEdgeMouseEnter:et,onEdgeMouseMove:xt,onEdgeMouseLeave:Q,onReconnect:Y,onReconnectStart:st,onReconnectEnd:Dt,reconnectRadius:fe,defaultMarkerColor:A,noPanClassName:St,elevateEdgesOnSelect:!!Kt,disableKeyboardA11y:Pt,rfId:Jt},R.createElement(Af,{style:b,type:m,component:N,containerStyle:y})),R.createElement("div",{className:"react-flow__edgelabel-renderer"}),R.createElement(nf,{nodeTypes:de,onNodeClick:i,onNodeDoubleClick:a,onNodeMouseEnter:u,onNodeMouseMove:f,onNodeMouseLeave:h,onNodeContextMenu:g,selectNodesOnDrag:d,onlyRenderVisibleElements:B,noPanClassName:St,noDragClassName:Zt,disableKeyboardA11y:Pt,nodeOrigin:Ht,nodeExtent:Qt,rfId:Jt})))};yi.displayName="GraphView";var Mf=E.memo(yi);const Vn=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Tt={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Vn,nodeExtent:Vn,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Wt.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:tl,isValidConnection:void 0},$f=()=>ds((t,e)=>({...Tt,setNodes:n=>{const{nodeInternals:r,nodeOrigin:o,elevateNodesOnSelect:s}=e();t({nodeInternals:vn(n,r,o,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=e();t({edges:n.map(o=>({...r,...o}))})},setDefaultNodesAndEdges:(n,r)=>{const o=typeof n<"u",s=typeof r<"u",i=o?vn(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:i,edges:s?r:[],hasDefaultNodes:o,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:o,fitViewOnInit:s,fitViewOnInitDone:i,fitViewOnInitOptions:c,domNode:a,nodeOrigin:l}=e(),u=a==null?void 0:a.querySelector(".react-flow__viewport");if(!u)return;const f=window.getComputedStyle(u),{m22:h}=new window.DOMMatrixReadOnly(f.transform),g=n.reduce((p,_)=>{const m=o.get(_.id);if(m!=null&&m.hidden)o.set(m.id,{...m,[j]:{...m[j],handleBounds:void 0}});else if(m){const b=Un(_.nodeElement);!!(b.width&&b.height&&(m.width!==b.width||m.height!==b.height||_.forceUpdate))&&(o.set(m.id,{...m,[j]:{...m[j],handleBounds:{source:Ur(".source",_.nodeElement,h,l),target:Ur(".target",_.nodeElement,h,l)}},...b}),p.push({id:m.id,type:"dimensions",dimensions:b}))}return p},[]);ni(o,l);const x=i||s&&!i&&ri(e,{initial:!0,...c});t({nodeInternals:new Map(o),fitViewOnInitDone:x}),(g==null?void 0:g.length)>0&&(r==null||r(g))},updateNodePositions:(n,r=!0,o=!1)=>{const{triggerNodeChanges:s}=e(),i=n.map(c=>{const a={id:c.id,type:"position",dragging:o};return r&&(a.positionAbsolute=c.positionAbsolute,a.position=c.position),a});s(i)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:o,hasDefaultNodes:s,nodeOrigin:i,getNodes:c,elevateNodesOnSelect:a}=e();if(n!=null&&n.length){if(s){const l=si(n,c()),u=vn(l,o,i,a);t({nodeInternals:u})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:o,getNodes:s}=e();let i,c=null;r?i=n.map(a=>kt(a,!0)):(i=re(s(),n),c=re(o,[])),Ve({changedNodes:i,changedEdges:c,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:o,getNodes:s}=e();let i,c=null;r?i=n.map(a=>kt(a,!0)):(i=re(o,n),c=re(s(),[])),Ve({changedNodes:c,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:o,getNodes:s}=e(),i=n||s(),c=r||o,a=i.map(u=>(u.selected=!1,kt(u.id,!1))),l=c.map(u=>kt(u.id,!1));Ve({changedNodes:a,changedEdges:l,get:e,set:t})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:o}=e();r==null||r.scaleExtent([n,o]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:o}=e();r==null||r.scaleExtent([o,n]),t({maxZoom:n})},setTranslateExtent:n=>{var r;(r=e().d3Zoom)==null||r.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=e(),s=r().filter(c=>c.selected).map(c=>kt(c.id,!1)),i=n.filter(c=>c.selected).map(c=>kt(c.id,!1));Ve({changedNodes:s,changedEdges:i,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:r}=e();r.forEach(o=>{o.positionAbsolute=Wn(o.position,n)}),t({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:o,height:s,d3Zoom:i,d3Selection:c,translateExtent:a}=e();if(!i||!c||!n.x&&!n.y)return!1;const l=Rt.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),u=[[0,0],[o,s]],f=i==null?void 0:i.constrain()(l,u,a);return i.transform(c,f),r[0]!==f.x||r[1]!==f.y||r[2]!==f.k},cancelConnection:()=>t({connectionNodeId:Tt.connectionNodeId,connectionHandleId:Tt.connectionHandleId,connectionHandleType:Tt.connectionHandleType,connectionStatus:Tt.connectionStatus,connectionStartHandle:Tt.connectionStartHandle,connectionEndHandle:Tt.connectionEndHandle}),reset:()=>t({...Tt})}),Object.is),xi=({children:t})=>{const e=E.useRef(null);return e.current||(e.current=$f()),R.createElement(qu,{value:e.current},t)};xi.displayName="ReactFlowProvider";const wi=({children:t})=>E.useContext(sn)?R.createElement(R.Fragment,null,t):R.createElement(xi,null,t);wi.displayName="ReactFlowWrapper";const Tf={input:Go,default:Hn,output:Qo,group:er},Cf={default:je,straight:Qn,step:Kn,smoothstep:cn,simplebezier:Gn},kf=[0,0],If=[15,15],Rf={x:0,y:0,zoom:1},zf={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Df=E.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:s=Tf,edgeTypes:i=Cf,onNodeClick:c,onEdgeClick:a,onInit:l,onMove:u,onMoveStart:f,onMoveEnd:h,onConnect:g,onConnectStart:x,onConnectEnd:p,onClickConnectStart:_,onClickConnectEnd:m,onNodeMouseEnter:b,onNodeMouseMove:N,onNodeMouseLeave:y,onNodeContextMenu:M,onNodeDoubleClick:C,onNodeDragStart:z,onNodeDrag:H,onNodeDragStop:T,onNodesDelete:L,onEdgesDelete:P,onSelectionChange:B,onSelectionDragStart:V,onSelectionDrag:d,onSelectionDragStop:S,onSelectionContextMenu:v,onSelectionStart:$,onSelectionEnd:k,connectionMode:w=Wt.Strict,connectionLineType:A=It.Bezier,connectionLineStyle:I,connectionLineComponent:D,connectionLineContainerStyle:O,deleteKeyCode:F="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:W=!1,selectionMode:Z=Me.Full,panActivationKeyCode:G="Space",multiSelectionKeyCode:J=Qe()?"Meta":"Control",zoomActivationKeyCode:K=Qe()?"Meta":"Control",snapToGrid:dt=!1,snapGrid:at=If,onlyRenderVisibleElements:ht=!1,selectNodesOnDrag:ut=!0,nodesDraggable:et,nodesConnectable:xt,nodesFocusable:Q,nodeOrigin:Y=kf,edgesFocusable:st,edgesUpdatable:Dt,elementsSelectable:fe,defaultViewport:Zt=Rf,minZoom:Gt=.5,maxZoom:St=2,translateExtent:Kt=Vn,preventScrolling:Pt=!0,nodeExtent:Ht,defaultMarkerColor:Qt="#b1b1b7",zoomOnScroll:Jt=!0,zoomOnPinch:de=!0,panOnScroll:rt=!1,panOnScrollSpeed:gt=.5,panOnScrollMode:Lt=Yt.Free,zoomOnDoubleClick:Vt=!0,panOnDrag:Bt=!0,onPaneClick:Et,onPaneMouseEnter:wt,onPaneMouseMove:he,onPaneMouseLeave:an,onPaneScroll:ge,onPaneContextMenu:un,children:rr,onEdgeContextMenu:Ft,onEdgeDoubleClick:_i,onEdgeMouseEnter:bi,onEdgeMouseMove:Si,onEdgeMouseLeave:Ei,onEdgeUpdate:Ni,onEdgeUpdateStart:Ai,onEdgeUpdateEnd:Mi,onReconnect:$i,onReconnectStart:Ti,onReconnectEnd:Ci,reconnectRadius:ki=10,edgeUpdaterRadius:Ii=10,onNodesChange:Ri,onEdgesChange:zi,noDragClassName:Di="nodrag",noWheelClassName:Pi="nowheel",noPanClassName:or="nopan",fitView:Hi=!1,fitViewOptions:Li,connectOnClick:Vi=!0,attributionPosition:Bi,proOptions:Fi,defaultEdgeOptions:Oi,elevateNodesOnSelect:Xi=!0,elevateEdgesOnSelect:Yi=!1,disableKeyboardA11y:ir=!1,autoPanOnConnect:qi=!0,autoPanOnNodeDrag:Ui=!0,connectionRadius:Wi=20,isValidConnection:Zi,onError:Gi,style:Ki,id:sr,nodeDragThreshold:Qi,...Ji},ji)=>{const ln=sr||"1";return R.createElement("div",{...Ji,style:{...Ki,...zf},ref:ji,className:ft(["react-flow",o]),"data-testid":"rf__wrapper",id:sr},R.createElement(wi,null,R.createElement(Mf,{onInit:l,onMove:u,onMoveStart:f,onMoveEnd:h,onNodeClick:c,onEdgeClick:a,onNodeMouseEnter:b,onNodeMouseMove:N,onNodeMouseLeave:y,onNodeContextMenu:M,onNodeDoubleClick:C,nodeTypes:s,edgeTypes:i,connectionLineType:A,connectionLineStyle:I,connectionLineComponent:D,connectionLineContainerStyle:O,selectionKeyCode:q,selectionOnDrag:W,selectionMode:Z,deleteKeyCode:F,multiSelectionKeyCode:J,panActivationKeyCode:G,zoomActivationKeyCode:K,onlyRenderVisibleElements:ht,selectNodesOnDrag:ut,defaultViewport:Zt,translateExtent:Kt,minZoom:Gt,maxZoom:St,preventScrolling:Pt,zoomOnScroll:Jt,zoomOnPinch:de,zoomOnDoubleClick:Vt,panOnScroll:rt,panOnScrollSpeed:gt,panOnScrollMode:Lt,panOnDrag:Bt,onPaneClick:Et,onPaneMouseEnter:wt,onPaneMouseMove:he,onPaneMouseLeave:an,onPaneScroll:ge,onPaneContextMenu:un,onSelectionContextMenu:v,onSelectionStart:$,onSelectionEnd:k,onEdgeContextMenu:Ft,onEdgeDoubleClick:_i,onEdgeMouseEnter:bi,onEdgeMouseMove:Si,onEdgeMouseLeave:Ei,onReconnect:$i??Ni,onReconnectStart:Ti??Ai,onReconnectEnd:Ci??Mi,reconnectRadius:ki??Ii,defaultMarkerColor:Qt,noDragClassName:Di,noWheelClassName:Pi,noPanClassName:or,elevateEdgesOnSelect:Yi,rfId:ln,disableKeyboardA11y:ir,nodeOrigin:Y,nodeExtent:Ht}),R.createElement(Sl,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:g,onConnectStart:x,onConnectEnd:p,onClickConnectStart:_,onClickConnectEnd:m,nodesDraggable:et,nodesConnectable:xt,nodesFocusable:Q,edgesFocusable:st,edgesUpdatable:Dt,elementsSelectable:fe,elevateNodesOnSelect:Xi,minZoom:Gt,maxZoom:St,nodeExtent:Ht,onNodesChange:Ri,onEdgesChange:zi,snapToGrid:dt,snapGrid:at,connectionMode:w,translateExtent:Kt,connectOnClick:Vi,defaultEdgeOptions:Oi,fitView:Hi,fitViewOptions:Li,onNodesDelete:L,onEdgesDelete:P,onNodeDragStart:z,onNodeDrag:H,onNodeDragStop:T,onSelectionDrag:d,onSelectionDragStart:V,onSelectionDragStop:S,noPanClassName:or,nodeOrigin:Y,rfId:ln,autoPanOnConnect:qi,autoPanOnNodeDrag:Ui,onError:Gi,connectionRadius:Wi,isValidConnection:Zi,nodeDragThreshold:Qi}),R.createElement(_l,{onSelectionChange:B}),rr,R.createElement(Zu,{proOptions:Fi,position:Bi}),R.createElement($l,{rfId:ln,disableKeyboardA11y:ir})))});Df.displayName="ReactFlow";const Pf=t=>t.getNodes();function Lf(){return tt(Pf,ot)}function vi(t){return e=>{const[n,r]=E.useState(e),o=E.useCallback(s=>r(i=>t(s,i)),[]);return[n,r,o]}}const Vf=vi(si),Bf=vi(Ol);export{ke as B,tn as H,X as P,xi as R,cn as S,oi as a,Lf as b,Vf as c,Bf as d,Df as e,tt as u};
|
17
|
+
*/var ur;function rs(){if(ur)return dn;ur=1;var t=to(),e=ns();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,a=t.useDebugValue;return dn.useSyncExternalStoreWithSelector=function(l,u,f,h,g){var x=s(null);if(x.current===null){var p={hasValue:!1,value:null};x.current=p}else p=x.current;x=c(function(){function m(C){if(!b){if(b=!0,N=C,C=h(C),g!==void 0&&p.hasValue){var z=p.value;if(g(z,C))return y=z}return y=C}if(z=y,r(N,C))return z;var H=h(C);return g!==void 0&&g(z,H)?z:(N=C,y=H)}var b=!1,N,y,M=f===void 0?null:f;return[function(){return m(u())},M===null?void 0:function(){return m(M())}]},[u,f,h,g]);var _=o(l,x[0],x[1]);return i(function(){p.hasValue=!0,p.value=_},[_]),a(_),_},dn}var lr;function os(){return lr||(lr=1,fn.exports=rs()),fn.exports}var is=os();const ss=ts(is),cs={},fr=t=>{let e;const n=new Set,r=(u,f)=>{const h=typeof u=="function"?u(e):u;if(!Object.is(h,e)){const g=e;e=f??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(x=>x(e,g))}},o=()=>e,a={setState:r,getState:o,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(cs?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=e=t(r,o,a);return a},as=t=>t?fr(t):fr,{useDebugValue:us}=R,{useSyncExternalStoreWithSelector:ls}=ss,fs=t=>t;function eo(t,e=fs,n){const r=ls(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return us(r),r}const dr=(t,e)=>{const n=as(t),r=(o,s=e)=>eo(n,o,s);return Object.assign(r,n),r},ds=(t,e)=>t?dr(t,e):dr;function it(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,o]of t)if(!Object.is(o,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}var hs={value:()=>{}};function en(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Fe(n)}function Fe(t){this._=t}function gs(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Fe.prototype=en.prototype={constructor:Fe,on:function(t,e){var n=this._,r=gs(t+"",n),o,s=-1,i=r.length;if(arguments.length<2){for(;++s<i;)if((o=(t=r[s]).type)&&(o=ps(n[o],t.name)))return o;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<i;)if(o=(t=r[s]).type)n[o]=hr(n[o],t.name,e);else if(e==null)for(o in n)n[o]=hr(n[o],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Fe(t)},call:function(t,e){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,s;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],r=0,o=s.length;r<o;++r)s[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,s=r.length;o<s;++o)r[o].value.apply(e,n)}};function ps(t,e){for(var n=0,r=t.length,o;n<r;++n)if((o=t[n]).name===e)return o.value}function hr(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=hs,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var En="http://www.w3.org/1999/xhtml";const gr={svg:"http://www.w3.org/2000/svg",xhtml:En,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nn(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),gr.hasOwnProperty(e)?{space:gr[e],local:t}:t}function ms(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===En&&e.documentElement.namespaceURI===En?e.createElement(t):e.createElementNS(n,t)}}function ys(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function no(t){var e=nn(t);return(e.local?ys:ms)(e)}function xs(){}function Bn(t){return t==null?xs:function(){return this.querySelector(t)}}function ws(t){typeof t!="function"&&(t=Bn(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var s=e[o],i=s.length,c=r[o]=new Array(i),a,l,u=0;u<i;++u)(a=s[u])&&(l=t.call(a,a.__data__,u,s))&&("__data__"in a&&(l.__data__=a.__data__),c[u]=l);return new ct(r,this._parents)}function vs(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function _s(){return[]}function ro(t){return t==null?_s:function(){return this.querySelectorAll(t)}}function bs(t){return function(){return vs(t.apply(this,arguments))}}function Ss(t){typeof t=="function"?t=bs(t):t=ro(t);for(var e=this._groups,n=e.length,r=[],o=[],s=0;s<n;++s)for(var i=e[s],c=i.length,a,l=0;l<c;++l)(a=i[l])&&(r.push(t.call(a,a.__data__,l,i)),o.push(a));return new ct(r,o)}function oo(t){return function(){return this.matches(t)}}function io(t){return function(e){return e.matches(t)}}var Es=Array.prototype.find;function Ns(t){return function(){return Es.call(this.children,t)}}function As(){return this.firstElementChild}function Ms(t){return this.select(t==null?As:Ns(typeof t=="function"?t:io(t)))}var $s=Array.prototype.filter;function Ts(){return Array.from(this.children)}function Cs(t){return function(){return $s.call(this.children,t)}}function ks(t){return this.selectAll(t==null?Ts:Cs(typeof t=="function"?t:io(t)))}function Is(t){typeof t!="function"&&(t=oo(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var s=e[o],i=s.length,c=r[o]=[],a,l=0;l<i;++l)(a=s[l])&&t.call(a,a.__data__,l,s)&&c.push(a);return new ct(r,this._parents)}function so(t){return new Array(t.length)}function Rs(){return new ct(this._enter||this._groups.map(so),this._parents)}function qe(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}qe.prototype={constructor:qe,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 zs(t){return function(){return t}}function Ds(t,e,n,r,o,s){for(var i=0,c,a=e.length,l=s.length;i<l;++i)(c=e[i])?(c.__data__=s[i],r[i]=c):n[i]=new qe(t,s[i]);for(;i<a;++i)(c=e[i])&&(o[i]=c)}function Ps(t,e,n,r,o,s,i){var c,a,l=new Map,u=e.length,f=s.length,h=new Array(u),g;for(c=0;c<u;++c)(a=e[c])&&(h[c]=g=i.call(a,a.__data__,c,e)+"",l.has(g)?o[c]=a:l.set(g,a));for(c=0;c<f;++c)g=i.call(t,s[c],c,s)+"",(a=l.get(g))?(r[c]=a,a.__data__=s[c],l.delete(g)):n[c]=new qe(t,s[c]);for(c=0;c<u;++c)(a=e[c])&&l.get(h[c])===a&&(o[c]=a)}function Hs(t){return t.__data__}function Ls(t,e){if(!arguments.length)return Array.from(this,Hs);var n=e?Ps:Ds,r=this._parents,o=this._groups;typeof t!="function"&&(t=zs(t));for(var s=o.length,i=new Array(s),c=new Array(s),a=new Array(s),l=0;l<s;++l){var u=r[l],f=o[l],h=f.length,g=Vs(t.call(u,u&&u.__data__,l,r)),x=g.length,p=c[l]=new Array(x),_=i[l]=new Array(x),m=a[l]=new Array(h);n(u,f,p,_,m,g,e);for(var b=0,N=0,y,M;b<x;++b)if(y=p[b]){for(b>=N&&(N=b+1);!(M=_[N])&&++N<x;);y._next=M||null}}return i=new ct(i,r),i._enter=c,i._exit=a,i}function Vs(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Bs(){return new ct(this._exit||this._groups.map(so),this._parents)}function Fs(t,e,n){var r=this.enter(),o=this,s=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(o=e(o),o&&(o=o.selection())),n==null?s.remove():n(s),r&&o?r.merge(o).order():o}function Os(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,s=r.length,i=Math.min(o,s),c=new Array(o),a=0;a<i;++a)for(var l=n[a],u=r[a],f=l.length,h=c[a]=new Array(f),g,x=0;x<f;++x)(g=l[x]||u[x])&&(h[x]=g);for(;a<o;++a)c[a]=n[a];return new ct(c,this._parents)}function Xs(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],o=r.length-1,s=r[o],i;--o>=0;)(i=r[o])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Ys(t){t||(t=qs);function e(f,h){return f&&h?t(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,o=new Array(r),s=0;s<r;++s){for(var i=n[s],c=i.length,a=o[s]=new Array(c),l,u=0;u<c;++u)(l=i[u])&&(a[u]=l);a.sort(e)}return new ct(o,this._parents).order()}function qs(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Us(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Ws(){return Array.from(this)}function Zs(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,s=r.length;o<s;++o){var i=r[o];if(i)return i}return null}function Gs(){let t=0;for(const e of this)++t;return t}function Ks(){return!this.node()}function Qs(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],s=0,i=o.length,c;s<i;++s)(c=o[s])&&t.call(c,c.__data__,s,o);return this}function Js(t){return function(){this.removeAttribute(t)}}function js(t){return function(){this.removeAttributeNS(t.space,t.local)}}function tc(t,e){return function(){this.setAttribute(t,e)}}function ec(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function nc(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function rc(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 oc(t,e){var n=nn(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?js:Js:typeof e=="function"?n.local?rc:nc:n.local?ec:tc)(n,e))}function co(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ic(t){return function(){this.style.removeProperty(t)}}function sc(t,e,n){return function(){this.style.setProperty(t,e,n)}}function cc(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function ac(t,e,n){return arguments.length>1?this.each((e==null?ic:typeof e=="function"?cc:sc)(t,e,n??"")):ae(this.node(),t)}function ae(t,e){return t.style.getPropertyValue(e)||co(t).getComputedStyle(t,null).getPropertyValue(e)}function uc(t){return function(){delete this[t]}}function lc(t,e){return function(){this[t]=e}}function fc(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function dc(t,e){return arguments.length>1?this.each((e==null?uc:typeof e=="function"?fc:lc)(t,e)):this.node()[t]}function ao(t){return t.trim().split(/^|\s+/)}function Fn(t){return t.classList||new uo(t)}function uo(t){this._node=t,this._names=ao(t.getAttribute("class")||"")}uo.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 lo(t,e){for(var n=Fn(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function fo(t,e){for(var n=Fn(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function hc(t){return function(){lo(this,t)}}function gc(t){return function(){fo(this,t)}}function pc(t,e){return function(){(e.apply(this,arguments)?lo:fo)(this,t)}}function mc(t,e){var n=ao(t+"");if(arguments.length<2){for(var r=Fn(this.node()),o=-1,s=n.length;++o<s;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof e=="function"?pc:e?hc:gc)(n,e))}function yc(){this.textContent=""}function xc(t){return function(){this.textContent=t}}function wc(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function vc(t){return arguments.length?this.each(t==null?yc:(typeof t=="function"?wc:xc)(t)):this.node().textContent}function _c(){this.innerHTML=""}function bc(t){return function(){this.innerHTML=t}}function Sc(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ec(t){return arguments.length?this.each(t==null?_c:(typeof t=="function"?Sc:bc)(t)):this.node().innerHTML}function Nc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ac(){return this.each(Nc)}function Mc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $c(){return this.each(Mc)}function Tc(t){var e=typeof t=="function"?t:no(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Cc(){return null}function kc(t,e){var n=typeof t=="function"?t:no(t),r=e==null?Cc:typeof e=="function"?e:Bn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Ic(){var t=this.parentNode;t&&t.removeChild(this)}function Rc(){return this.each(Ic)}function zc(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Dc(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Pc(t){return this.select(t?Dc:zc)}function Hc(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Lc(t){return function(e){t.call(this,e,this.__data__)}}function Vc(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function Bc(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,o=e.length,s;n<o;++n)s=e[n],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++r]=s;++r?e.length=r:delete this.__on}}}function Fc(t,e,n){return function(){var r=this.__on,o,s=Lc(e);if(r){for(var i=0,c=r.length;i<c;++i)if((o=r[i]).type===t.type&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=s,o.options=n),o.value=e;return}}this.addEventListener(t.type,s,n),o={type:t.type,name:t.name,value:e,listener:s,options:n},r?r.push(o):this.__on=[o]}}function Oc(t,e,n){var r=Vc(t+""),o,s=r.length,i;if(arguments.length<2){var c=this.node().__on;if(c){for(var a=0,l=c.length,u;a<l;++a)for(o=0,u=c[a];o<s;++o)if((i=r[o]).type===u.type&&i.name===u.name)return u.value}return}for(c=e?Fc:Bc,o=0;o<s;++o)this.each(c(r[o],e,n));return this}function ho(t,e,n){var r=co(t),o=r.CustomEvent;typeof o=="function"?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function Xc(t,e){return function(){return ho(this,t,e)}}function Yc(t,e){return function(){return ho(this,t,e.apply(this,arguments))}}function qc(t,e){return this.each((typeof e=="function"?Yc:Xc)(t,e))}function*Uc(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,s=r.length,i;o<s;++o)(i=r[o])&&(yield i)}var go=[null];function ct(t,e){this._groups=t,this._parents=e}function Te(){return new ct([[document.documentElement]],go)}function Wc(){return this}ct.prototype=Te.prototype={constructor:ct,select:ws,selectAll:Ss,selectChild:Ms,selectChildren:ks,filter:Is,data:Ls,enter:Rs,exit:Bs,join:Fs,merge:Os,selection:Wc,order:Xs,sort:Ys,call:Us,nodes:Ws,node:Zs,size:Gs,empty:Ks,each:Qs,attr:oc,style:ac,property:dc,classed:mc,text:vc,html:Ec,raise:Ac,lower:$c,append:Tc,insert:kc,remove:Rc,clone:Pc,datum:Hc,on:Oc,dispatch:qc,[Symbol.iterator]:Uc};function pt(t){return typeof t=="string"?new ct([[document.querySelector(t)]],[document.documentElement]):new ct([[t]],go)}function Zc(t){let e;for(;e=t.sourceEvent;)t=e;return t}function vt(t,e){if(t=Zc(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]}const Gc={passive:!1},be={capture:!0,passive:!1};function pn(t){t.stopImmediatePropagation()}function oe(t){t.preventDefault(),t.stopImmediatePropagation()}function po(t){var e=t.document.documentElement,n=pt(t).on("dragstart.drag",oe,be);"onselectstart"in e?n.on("selectstart.drag",oe,be):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function mo(t,e){var n=t.document.documentElement,r=pt(t).on("dragstart.drag",null);e&&(r.on("click.drag",oe,be),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Ie=t=>()=>t;function Nn(t,{sourceEvent:e,subject:n,target:r,identifier:o,active:s,x:i,y:c,dx:a,dy:l,dispatch:u}){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:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Nn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Kc(t){return!t.ctrlKey&&!t.button}function Qc(){return this.parentNode}function Jc(t,e){return e??{x:t.x,y:t.y}}function jc(){return navigator.maxTouchPoints||"ontouchstart"in this}function ta(){var t=Kc,e=Qc,n=Jc,r=jc,o={},s=en("start","drag","end"),i=0,c,a,l,u,f=0;function h(y){y.on("mousedown.drag",g).filter(r).on("touchstart.drag",_).on("touchmove.drag",m,Gc).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(y,M){if(!(u||!t.call(this,y,M))){var C=N(this,e.call(this,y,M),y,M,"mouse");C&&(pt(y.view).on("mousemove.drag",x,be).on("mouseup.drag",p,be),po(y.view),pn(y),l=!1,c=y.clientX,a=y.clientY,C("start",y))}}function x(y){if(oe(y),!l){var M=y.clientX-c,C=y.clientY-a;l=M*M+C*C>f}o.mouse("drag",y)}function p(y){pt(y.view).on("mousemove.drag mouseup.drag",null),mo(y.view,l),oe(y),o.mouse("end",y)}function _(y,M){if(t.call(this,y,M)){var C=y.changedTouches,z=e.call(this,y,M),H=C.length,T,L;for(T=0;T<H;++T)(L=N(this,z,y,M,C[T].identifier,C[T]))&&(pn(y),L("start",y,C[T]))}}function m(y){var M=y.changedTouches,C=M.length,z,H;for(z=0;z<C;++z)(H=o[M[z].identifier])&&(oe(y),H("drag",y,M[z]))}function b(y){var M=y.changedTouches,C=M.length,z,H;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),z=0;z<C;++z)(H=o[M[z].identifier])&&(pn(y),H("end",y,M[z]))}function N(y,M,C,z,H,T){var L=s.copy(),P=vt(T||C,M),B,V,d;if((d=n.call(y,new Nn("beforestart",{sourceEvent:C,target:h,identifier:H,active:i,x:P[0],y:P[1],dx:0,dy:0,dispatch:L}),z))!=null)return B=d.x-P[0]||0,V=d.y-P[1]||0,function S(v,$,k){var w=P,A;switch(v){case"start":o[H]=S,A=i++;break;case"end":delete o[H],--i;case"drag":P=vt(k||$,M),A=i;break}L.call(v,y,new Nn(v,{sourceEvent:$,subject:d,target:h,identifier:H,active:A,x:P[0]+B,y:P[1]+V,dx:P[0]-w[0],dy:P[1]-w[1],dispatch:L}),z)}}return h.filter=function(y){return arguments.length?(t=typeof y=="function"?y:Ie(!!y),h):t},h.container=function(y){return arguments.length?(e=typeof y=="function"?y:Ie(y),h):e},h.subject=function(y){return arguments.length?(n=typeof y=="function"?y:Ie(y),h):n},h.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:Ie(!!y),h):r},h.on=function(){var y=s.on.apply(s,arguments);return y===s?h:y},h.clickDistance=function(y){return arguments.length?(f=(y=+y)*y,h):Math.sqrt(f)},h}function On(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function yo(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Ce(){}var Se=.7,Ue=1/Se,ie="\\s*([+-]?\\d+)\\s*",Ee="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_t="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ea=/^#([0-9a-f]{3,8})$/,na=new RegExp(`^rgb\\(${ie},${ie},${ie}\\)$`),ra=new RegExp(`^rgb\\(${_t},${_t},${_t}\\)$`),oa=new RegExp(`^rgba\\(${ie},${ie},${ie},${Ee}\\)$`),ia=new RegExp(`^rgba\\(${_t},${_t},${_t},${Ee}\\)$`),sa=new RegExp(`^hsl\\(${Ee},${_t},${_t}\\)$`),ca=new RegExp(`^hsla\\(${Ee},${_t},${_t},${Ee}\\)$`),pr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};On(Ce,Ne,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:mr,formatHex:mr,formatHex8:aa,formatHsl:ua,formatRgb:yr,toString:yr});function mr(){return this.rgb().formatHex()}function aa(){return this.rgb().formatHex8()}function ua(){return xo(this).formatHsl()}function yr(){return this.rgb().formatRgb()}function Ne(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ea.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?xr(e):n===3?new ot(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Re(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Re(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=na.exec(t))?new ot(e[1],e[2],e[3],1):(e=ra.exec(t))?new ot(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=oa.exec(t))?Re(e[1],e[2],e[3],e[4]):(e=ia.exec(t))?Re(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=sa.exec(t))?_r(e[1],e[2]/100,e[3]/100,1):(e=ca.exec(t))?_r(e[1],e[2]/100,e[3]/100,e[4]):pr.hasOwnProperty(t)?xr(pr[t]):t==="transparent"?new ot(NaN,NaN,NaN,0):null}function xr(t){return new ot(t>>16&255,t>>8&255,t&255,1)}function Re(t,e,n,r){return r<=0&&(t=e=n=NaN),new ot(t,e,n,r)}function la(t){return t instanceof Ce||(t=Ne(t)),t?(t=t.rgb(),new ot(t.r,t.g,t.b,t.opacity)):new ot}function An(t,e,n,r){return arguments.length===1?la(t):new ot(t,e,n,r??1)}function ot(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}On(ot,An,yo(Ce,{brighter(t){return t=t==null?Ue:Math.pow(Ue,t),new ot(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Se:Math.pow(Se,t),new ot(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ot(qt(this.r),qt(this.g),qt(this.b),We(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:wr,formatHex:wr,formatHex8:fa,formatRgb:vr,toString:vr}));function wr(){return`#${Xt(this.r)}${Xt(this.g)}${Xt(this.b)}`}function fa(){return`#${Xt(this.r)}${Xt(this.g)}${Xt(this.b)}${Xt((isNaN(this.opacity)?1:this.opacity)*255)}`}function vr(){const t=We(this.opacity);return`${t===1?"rgb(":"rgba("}${qt(this.r)}, ${qt(this.g)}, ${qt(this.b)}${t===1?")":`, ${t})`}`}function We(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function qt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Xt(t){return t=qt(t),(t<16?"0":"")+t.toString(16)}function _r(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new mt(t,e,n,r)}function xo(t){if(t instanceof mt)return new mt(t.h,t.s,t.l,t.opacity);if(t instanceof Ce||(t=Ne(t)),!t)return new mt;if(t instanceof mt)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),s=Math.max(e,n,r),i=NaN,c=s-o,a=(s+o)/2;return c?(e===s?i=(n-r)/c+(n<r)*6:n===s?i=(r-e)/c+2:i=(e-n)/c+4,c/=a<.5?s+o:2-s-o,i*=60):c=a>0&&a<1?0:i,new mt(i,c,a,t.opacity)}function da(t,e,n,r){return arguments.length===1?xo(t):new mt(t,e,n,r??1)}function mt(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}On(mt,da,yo(Ce,{brighter(t){return t=t==null?Ue:Math.pow(Ue,t),new mt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Se:Math.pow(Se,t),new mt(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new ot(mn(t>=240?t-240:t+120,o,r),mn(t,o,r),mn(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new mt(br(this.h),ze(this.s),ze(this.l),We(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=We(this.opacity);return`${t===1?"hsl(":"hsla("}${br(this.h)}, ${ze(this.s)*100}%, ${ze(this.l)*100}%${t===1?")":`, ${t})`}`}}));function br(t){return t=(t||0)%360,t<0?t+360:t}function ze(t){return Math.max(0,Math.min(1,t||0))}function mn(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const wo=t=>()=>t;function ha(t,e){return function(n){return t+n*e}}function ga(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function pa(t){return(t=+t)==1?vo:function(e,n){return n-e?ga(e,n,t):wo(isNaN(e)?n:e)}}function vo(t,e){var n=e-t;return n?ha(t,n):wo(isNaN(t)?e:t)}const Sr=function t(e){var n=pa(e);function r(o,s){var i=n((o=An(o)).r,(s=An(s)).r),c=n(o.g,s.g),a=n(o.b,s.b),l=vo(o.opacity,s.opacity);return function(u){return o.r=i(u),o.g=c(u),o.b=a(u),o.opacity=l(u),o+""}}return r.gamma=t,r}(1);function Ct(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Mn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yn=new RegExp(Mn.source,"g");function ma(t){return function(){return t}}function ya(t){return function(e){return t(e)+""}}function xa(t,e){var n=Mn.lastIndex=yn.lastIndex=0,r,o,s,i=-1,c=[],a=[];for(t=t+"",e=e+"";(r=Mn.exec(t))&&(o=yn.exec(e));)(s=o.index)>n&&(s=e.slice(n,s),c[i]?c[i]+=s:c[++i]=s),(r=r[0])===(o=o[0])?c[i]?c[i]+=o:c[++i]=o:(c[++i]=null,a.push({i,x:Ct(r,o)})),n=yn.lastIndex;return n<e.length&&(s=e.slice(n),c[i]?c[i]+=s:c[++i]=s),c.length<2?a[0]?ya(a[0].x):ma(e):(e=a.length,function(l){for(var u=0,f;u<e;++u)c[(f=a[u]).i]=f.x(l);return c.join("")})}var Er=180/Math.PI,$n={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _o(t,e,n,r,o,s){var i,c,a;return(i=Math.sqrt(t*t+e*e))&&(t/=i,e/=i),(a=t*n+e*r)&&(n-=t*a,r-=e*a),(c=Math.sqrt(n*n+r*r))&&(n/=c,r/=c,a/=c),t*r<e*n&&(t=-t,e=-e,a=-a,i=-i),{translateX:o,translateY:s,rotate:Math.atan2(e,t)*Er,skewX:Math.atan(a)*Er,scaleX:i,scaleY:c}}var De;function wa(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?$n:_o(e.a,e.b,e.c,e.d,e.e,e.f)}function va(t){return t==null||(De||(De=document.createElementNS("http://www.w3.org/2000/svg","g")),De.setAttribute("transform",t),!(t=De.transform.baseVal.consolidate()))?$n:(t=t.matrix,_o(t.a,t.b,t.c,t.d,t.e,t.f))}function bo(t,e,n,r){function o(l){return l.length?l.pop()+" ":""}function s(l,u,f,h,g,x){if(l!==f||u!==h){var p=g.push("translate(",null,e,null,n);x.push({i:p-4,x:Ct(l,f)},{i:p-2,x:Ct(u,h)})}else(f||h)&&g.push("translate("+f+e+h+n)}function i(l,u,f,h){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),h.push({i:f.push(o(f)+"rotate(",null,r)-2,x:Ct(l,u)})):u&&f.push(o(f)+"rotate("+u+r)}function c(l,u,f,h){l!==u?h.push({i:f.push(o(f)+"skewX(",null,r)-2,x:Ct(l,u)}):u&&f.push(o(f)+"skewX("+u+r)}function a(l,u,f,h,g,x){if(l!==f||u!==h){var p=g.push(o(g)+"scale(",null,",",null,")");x.push({i:p-4,x:Ct(l,f)},{i:p-2,x:Ct(u,h)})}else(f!==1||h!==1)&&g.push(o(g)+"scale("+f+","+h+")")}return function(l,u){var f=[],h=[];return l=t(l),u=t(u),s(l.translateX,l.translateY,u.translateX,u.translateY,f,h),i(l.rotate,u.rotate,f,h),c(l.skewX,u.skewX,f,h),a(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,h),l=u=null,function(g){for(var x=-1,p=h.length,_;++x<p;)f[(_=h[x]).i]=_.x(g);return f.join("")}}}var _a=bo(wa,"px, ","px)","deg)"),ba=bo(va,", ",")",")"),Sa=1e-12;function Nr(t){return((t=Math.exp(t))+1/t)/2}function Ea(t){return((t=Math.exp(t))-1/t)/2}function Na(t){return((t=Math.exp(2*t))-1)/(t+1)}const Aa=function t(e,n,r){function o(s,i){var c=s[0],a=s[1],l=s[2],u=i[0],f=i[1],h=i[2],g=u-c,x=f-a,p=g*g+x*x,_,m;if(p<Sa)m=Math.log(h/l)/e,_=function(z){return[c+z*g,a+z*x,l*Math.exp(e*z*m)]};else{var b=Math.sqrt(p),N=(h*h-l*l+r*p)/(2*l*n*b),y=(h*h-l*l-r*p)/(2*h*n*b),M=Math.log(Math.sqrt(N*N+1)-N),C=Math.log(Math.sqrt(y*y+1)-y);m=(C-M)/e,_=function(z){var H=z*m,T=Nr(M),L=l/(n*b)*(T*Na(e*H+M)-Ea(M));return[c+L*g,a+L*x,l*T/Nr(e*H+M)]}}return _.duration=m*1e3*e/Math.SQRT2,_}return o.rho=function(s){var i=Math.max(.001,+s),c=i*i,a=c*c;return t(i,c,a)},o}(Math.SQRT2,2,4);var ue=0,ve=0,pe=0,So=1e3,Ze,_e,Ge=0,Ut=0,rn=0,Ae=typeof performance=="object"&&performance.now?performance:Date,Eo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Xn(){return Ut||(Eo(Ma),Ut=Ae.now()+rn)}function Ma(){Ut=0}function Ke(){this._call=this._time=this._next=null}Ke.prototype=No.prototype={constructor:Ke,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Xn():+n)+(e==null?0:+e),!this._next&&_e!==this&&(_e?_e._next=this:Ze=this,_e=this),this._call=t,this._time=n,Tn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Tn())}};function No(t,e,n){var r=new Ke;return r.restart(t,e,n),r}function $a(){Xn(),++ue;for(var t=Ze,e;t;)(e=Ut-t._time)>=0&&t._call.call(void 0,e),t=t._next;--ue}function Ar(){Ut=(Ge=Ae.now())+rn,ue=ve=0;try{$a()}finally{ue=0,Ca(),Ut=0}}function Ta(){var t=Ae.now(),e=t-Ge;e>So&&(rn-=e,Ge=t)}function Ca(){for(var t,e=Ze,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ze=n);_e=t,Tn(r)}function Tn(t){if(!ue){ve&&(ve=clearTimeout(ve));var e=t-Ut;e>24?(t<1/0&&(ve=setTimeout(Ar,t-Ae.now()-rn)),pe&&(pe=clearInterval(pe))):(pe||(Ge=Ae.now(),pe=setInterval(Ta,So)),ue=1,Eo(Ar))}}function Mr(t,e,n){var r=new Ke;return e=e==null?0:+e,r.restart(o=>{r.stop(),t(o+e)},e,n),r}var ka=en("start","end","cancel","interrupt"),Ia=[],Ao=0,$r=1,Cn=2,Oe=3,Tr=4,kn=5,Xe=6;function on(t,e,n,r,o,s){var i=t.__transition;if(!i)t.__transition={};else if(n in i)return;Ra(t,n,{name:e,index:r,group:o,on:ka,tween:Ia,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Ao})}function Yn(t,e){var n=yt(t,e);if(n.state>Ao)throw new Error("too late; already scheduled");return n}function bt(t,e){var n=yt(t,e);if(n.state>Oe)throw new Error("too late; already running");return n}function yt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Ra(t,e,n){var r=t.__transition,o;r[e]=n,n.timer=No(s,0,n.time);function s(l){n.state=$r,n.timer.restart(i,n.delay,n.time),n.delay<=l&&i(l-n.delay)}function i(l){var u,f,h,g;if(n.state!==$r)return a();for(u in r)if(g=r[u],g.name===n.name){if(g.state===Oe)return Mr(i);g.state===Tr?(g.state=Xe,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete r[u]):+u<e&&(g.state=Xe,g.timer.stop(),g.on.call("cancel",t,t.__data__,g.index,g.group),delete r[u])}if(Mr(function(){n.state===Oe&&(n.state=Tr,n.timer.restart(c,n.delay,n.time),c(l))}),n.state=Cn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Cn){for(n.state=Oe,o=new Array(h=n.tween.length),u=0,f=-1;u<h;++u)(g=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(o[++f]=g);o.length=f+1}}function c(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(a),n.state=kn,1),f=-1,h=o.length;++f<h;)o[f].call(t,u);n.state===kn&&(n.on.call("end",t,t.__data__,n.index,n.group),a())}function a(){n.state=Xe,n.timer.stop(),delete r[e];for(var l in r)return;delete t.__transition}}function Ye(t,e){var n=t.__transition,r,o,s=!0,i;if(n){e=e==null?null:e+"";for(i in n){if((r=n[i]).name!==e){s=!1;continue}o=r.state>Cn&&r.state<kn,r.state=Xe,r.timer.stop(),r.on.call(o?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[i]}s&&delete t.__transition}}function za(t){return this.each(function(){Ye(this,t)})}function Da(t,e){var n,r;return function(){var o=bt(this,t),s=o.tween;if(s!==n){r=n=s;for(var i=0,c=r.length;i<c;++i)if(r[i].name===e){r=r.slice(),r.splice(i,1);break}}o.tween=r}}function Pa(t,e,n){var r,o;if(typeof n!="function")throw new Error;return function(){var s=bt(this,t),i=s.tween;if(i!==r){o=(r=i).slice();for(var c={name:e,value:n},a=0,l=o.length;a<l;++a)if(o[a].name===e){o[a]=c;break}a===l&&o.push(c)}s.tween=o}}function Ha(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=yt(this.node(),n).tween,o=0,s=r.length,i;o<s;++o)if((i=r[o]).name===t)return i.value;return null}return this.each((e==null?Da:Pa)(n,t,e))}function qn(t,e,n){var r=t._id;return t.each(function(){var o=bt(this,r);(o.value||(o.value={}))[e]=n.apply(this,arguments)}),function(o){return yt(o,r).value[e]}}function Mo(t,e){var n;return(typeof e=="number"?Ct:e instanceof Ne?Sr:(n=Ne(e))?(e=n,Sr):xa)(t,e)}function La(t){return function(){this.removeAttribute(t)}}function Va(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ba(t,e,n){var r,o=n+"",s;return function(){var i=this.getAttribute(t);return i===o?null:i===r?s:s=e(r=i,n)}}function Fa(t,e,n){var r,o=n+"",s;return function(){var i=this.getAttributeNS(t.space,t.local);return i===o?null:i===r?s:s=e(r=i,n)}}function Oa(t,e,n){var r,o,s;return function(){var i,c=n(this),a;return c==null?void this.removeAttribute(t):(i=this.getAttribute(t),a=c+"",i===a?null:i===r&&a===o?s:(o=a,s=e(r=i,c)))}}function Xa(t,e,n){var r,o,s;return function(){var i,c=n(this),a;return c==null?void this.removeAttributeNS(t.space,t.local):(i=this.getAttributeNS(t.space,t.local),a=c+"",i===a?null:i===r&&a===o?s:(o=a,s=e(r=i,c)))}}function Ya(t,e){var n=nn(t),r=n==="transform"?ba:Mo;return this.attrTween(t,typeof e=="function"?(n.local?Xa:Oa)(n,r,qn(this,"attr."+t,e)):e==null?(n.local?Va:La)(n):(n.local?Fa:Ba)(n,r,e))}function qa(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Ua(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Wa(t,e){var n,r;function o(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&Ua(t,s)),n}return o._value=e,o}function Za(t,e){var n,r;function o(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&qa(t,s)),n}return o._value=e,o}function Ga(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 r=nn(t);return this.tween(n,(r.local?Wa:Za)(r,e))}function Ka(t,e){return function(){Yn(this,t).delay=+e.apply(this,arguments)}}function Qa(t,e){return e=+e,function(){Yn(this,t).delay=e}}function Ja(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Ka:Qa)(e,t)):yt(this.node(),e).delay}function ja(t,e){return function(){bt(this,t).duration=+e.apply(this,arguments)}}function tu(t,e){return e=+e,function(){bt(this,t).duration=e}}function eu(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?ja:tu)(e,t)):yt(this.node(),e).duration}function nu(t,e){if(typeof e!="function")throw new Error;return function(){bt(this,t).ease=e}}function ru(t){var e=this._id;return arguments.length?this.each(nu(e,t)):yt(this.node(),e).ease}function ou(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;bt(this,t).ease=n}}function iu(t){if(typeof t!="function")throw new Error;return this.each(ou(this._id,t))}function su(t){typeof t!="function"&&(t=oo(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var s=e[o],i=s.length,c=r[o]=[],a,l=0;l<i;++l)(a=s[l])&&t.call(a,a.__data__,l,s)&&c.push(a);return new Mt(r,this._parents,this._name,this._id)}function cu(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,s=Math.min(r,o),i=new Array(r),c=0;c<s;++c)for(var a=e[c],l=n[c],u=a.length,f=i[c]=new Array(u),h,g=0;g<u;++g)(h=a[g]||l[g])&&(f[g]=h);for(;c<r;++c)i[c]=e[c];return new Mt(i,this._parents,this._name,this._id)}function au(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 uu(t,e,n){var r,o,s=au(e)?Yn:bt;return function(){var i=s(this,t),c=i.on;c!==r&&(o=(r=c).copy()).on(e,n),i.on=o}}function lu(t,e){var n=this._id;return arguments.length<2?yt(this.node(),n).on.on(t):this.each(uu(n,t,e))}function fu(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function du(){return this.on("end.remove",fu(this._id))}function hu(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Bn(t));for(var r=this._groups,o=r.length,s=new Array(o),i=0;i<o;++i)for(var c=r[i],a=c.length,l=s[i]=new Array(a),u,f,h=0;h<a;++h)(u=c[h])&&(f=t.call(u,u.__data__,h,c))&&("__data__"in u&&(f.__data__=u.__data__),l[h]=f,on(l[h],e,n,h,l,yt(u,n)));return new Mt(s,this._parents,e,n)}function gu(t){var e=this._name,n=this._id;typeof t!="function"&&(t=ro(t));for(var r=this._groups,o=r.length,s=[],i=[],c=0;c<o;++c)for(var a=r[c],l=a.length,u,f=0;f<l;++f)if(u=a[f]){for(var h=t.call(u,u.__data__,f,a),g,x=yt(u,n),p=0,_=h.length;p<_;++p)(g=h[p])&&on(g,e,n,p,h,x);s.push(h),i.push(u)}return new Mt(s,i,e,n)}var pu=Te.prototype.constructor;function mu(){return new pu(this._groups,this._parents)}function yu(t,e){var n,r,o;return function(){var s=ae(this,t),i=(this.style.removeProperty(t),ae(this,t));return s===i?null:s===n&&i===r?o:o=e(n=s,r=i)}}function $o(t){return function(){this.style.removeProperty(t)}}function xu(t,e,n){var r,o=n+"",s;return function(){var i=ae(this,t);return i===o?null:i===r?s:s=e(r=i,n)}}function wu(t,e,n){var r,o,s;return function(){var i=ae(this,t),c=n(this),a=c+"";return c==null&&(a=c=(this.style.removeProperty(t),ae(this,t))),i===a?null:i===r&&a===o?s:(o=a,s=e(r=i,c))}}function vu(t,e){var n,r,o,s="style."+e,i="end."+s,c;return function(){var a=bt(this,t),l=a.on,u=a.value[s]==null?c||(c=$o(e)):void 0;(l!==n||o!==u)&&(r=(n=l).copy()).on(i,o=u),a.on=r}}function _u(t,e,n){var r=(t+="")=="transform"?_a:Mo;return e==null?this.styleTween(t,yu(t,r)).on("end.style."+t,$o(t)):typeof e=="function"?this.styleTween(t,wu(t,r,qn(this,"style."+t,e))).each(vu(this._id,t)):this.styleTween(t,xu(t,r,e),n).on("end.style."+t,null)}function bu(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Su(t,e,n){var r,o;function s(){var i=e.apply(this,arguments);return i!==o&&(r=(o=i)&&bu(t,i,n)),r}return s._value=e,s}function Eu(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,Su(t,e,n??""))}function Nu(t){return function(){this.textContent=t}}function Au(t){return function(){var e=t(this);this.textContent=e??""}}function Mu(t){return this.tween("text",typeof t=="function"?Au(qn(this,"text",t)):Nu(t==null?"":t+""))}function $u(t){return function(e){this.textContent=t.call(this,e)}}function Tu(t){var e,n;function r(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&$u(o)),e}return r._value=t,r}function Cu(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,Tu(t))}function ku(){for(var t=this._name,e=this._id,n=To(),r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],c=i.length,a,l=0;l<c;++l)if(a=i[l]){var u=yt(a,e);on(a,t,n,l,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Mt(r,this._parents,t,n)}function Iu(){var t,e,n=this,r=n._id,o=n.size();return new Promise(function(s,i){var c={value:i},a={value:function(){--o===0&&s()}};n.each(function(){var l=bt(this,r),u=l.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(c),e._.interrupt.push(c),e._.end.push(a)),l.on=e}),o===0&&s()})}var Ru=0;function Mt(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function To(){return++Ru}var Nt=Te.prototype;Mt.prototype={constructor:Mt,select:hu,selectAll:gu,selectChild:Nt.selectChild,selectChildren:Nt.selectChildren,filter:su,merge:cu,selection:mu,transition:ku,call:Nt.call,nodes:Nt.nodes,node:Nt.node,size:Nt.size,empty:Nt.empty,each:Nt.each,on:lu,attr:Ya,attrTween:Ga,style:_u,styleTween:Eu,text:Mu,textTween:Cu,remove:du,tween:Ha,delay:Ja,duration:eu,ease:ru,easeVarying:iu,end:Iu,[Symbol.iterator]:Nt[Symbol.iterator]};function zu(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Du={time:null,delay:0,duration:250,ease:zu};function Pu(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 Hu(t){var e,n;t instanceof Mt?(e=t._id,t=t._name):(e=To(),(n=Du).time=Xn(),t=t==null?null:t+"");for(var r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],c=i.length,a,l=0;l<c;++l)(a=i[l])&&on(a,t,e,l,i,n||Pu(a,e));return new Mt(r,this._parents,t,e)}Te.prototype.interrupt=za;Te.prototype.transition=Hu;const Pe=t=>()=>t;function Lu(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){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:r,enumerable:!0,configurable:!0},_:{value:o}})}function At(t,e,n){this.k=t,this.x=e,this.y=n}At.prototype={constructor:At,scale:function(t){return t===1?this:new At(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new At(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 Rt=new At(1,0,0);At.prototype;function xn(t){t.stopImmediatePropagation()}function me(t){t.preventDefault(),t.stopImmediatePropagation()}function Vu(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Bu(){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 Cr(){return this.__zoom||Rt}function Fu(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Ou(){return navigator.maxTouchPoints||"ontouchstart"in this}function Xu(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],i=t.invertY(e[1][1])-n[1][1];return t.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Yu(){var t=Vu,e=Bu,n=Xu,r=Fu,o=Ou,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],c=250,a=Aa,l=en("start","zoom","end"),u,f,h,g=500,x=150,p=0,_=10;function m(d){d.property("__zoom",Cr).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",L).filter(o).on("touchstart.zoom",P).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(d,S,v,$){var k=d.selection?d.selection():d;k.property("__zoom",Cr),d!==k?M(d,S,v,$):k.interrupt().each(function(){C(this,arguments).event($).start().zoom(null,typeof S=="function"?S.apply(this,arguments):S).end()})},m.scaleBy=function(d,S,v,$){m.scaleTo(d,function(){var k=this.__zoom.k,w=typeof S=="function"?S.apply(this,arguments):S;return k*w},v,$)},m.scaleTo=function(d,S,v,$){m.transform(d,function(){var k=e.apply(this,arguments),w=this.__zoom,A=v==null?y(k):typeof v=="function"?v.apply(this,arguments):v,I=w.invert(A),D=typeof S=="function"?S.apply(this,arguments):S;return n(N(b(w,D),A,I),k,i)},v,$)},m.translateBy=function(d,S,v,$){m.transform(d,function(){return n(this.__zoom.translate(typeof S=="function"?S.apply(this,arguments):S,typeof v=="function"?v.apply(this,arguments):v),e.apply(this,arguments),i)},null,$)},m.translateTo=function(d,S,v,$,k){m.transform(d,function(){var w=e.apply(this,arguments),A=this.__zoom,I=$==null?y(w):typeof $=="function"?$.apply(this,arguments):$;return n(Rt.translate(I[0],I[1]).scale(A.k).translate(typeof S=="function"?-S.apply(this,arguments):-S,typeof v=="function"?-v.apply(this,arguments):-v),w,i)},$,k)};function b(d,S){return S=Math.max(s[0],Math.min(s[1],S)),S===d.k?d:new At(S,d.x,d.y)}function N(d,S,v){var $=S[0]-v[0]*d.k,k=S[1]-v[1]*d.k;return $===d.x&&k===d.y?d:new At(d.k,$,k)}function y(d){return[(+d[0][0]+ +d[1][0])/2,(+d[0][1]+ +d[1][1])/2]}function M(d,S,v,$){d.on("start.zoom",function(){C(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event($).end()}).tween("zoom",function(){var k=this,w=arguments,A=C(k,w).event($),I=e.apply(k,w),D=v==null?y(I):typeof v=="function"?v.apply(k,w):v,O=Math.max(I[1][0]-I[0][0],I[1][1]-I[0][1]),F=k.__zoom,q=typeof S=="function"?S.apply(k,w):S,W=a(F.invert(D).concat(O/F.k),q.invert(D).concat(O/q.k));return function(Z){if(Z===1)Z=q;else{var G=W(Z),J=O/G[2];Z=new At(J,D[0]-G[0]*J,D[1]-G[1]*J)}A.zoom(null,Z)}})}function C(d,S,v){return!v&&d.__zooming||new z(d,S)}function z(d,S){this.that=d,this.args=S,this.active=0,this.sourceEvent=null,this.extent=e.apply(d,S),this.taps=0}z.prototype={event:function(d){return d&&(this.sourceEvent=d),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(d,S){return this.mouse&&d!=="mouse"&&(this.mouse[1]=S.invert(this.mouse[0])),this.touch0&&d!=="touch"&&(this.touch0[1]=S.invert(this.touch0[0])),this.touch1&&d!=="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(d){var S=pt(this.that).datum();l.call(d,this.that,new Lu(d,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),S)}};function H(d,...S){if(!t.apply(this,arguments))return;var v=C(this,S).event(d),$=this.__zoom,k=Math.max(s[0],Math.min(s[1],$.k*Math.pow(2,r.apply(this,arguments)))),w=vt(d);if(v.wheel)(v.mouse[0][0]!==w[0]||v.mouse[0][1]!==w[1])&&(v.mouse[1]=$.invert(v.mouse[0]=w)),clearTimeout(v.wheel);else{if($.k===k)return;v.mouse=[w,$.invert(w)],Ye(this),v.start()}me(d),v.wheel=setTimeout(A,x),v.zoom("mouse",n(N(b($,k),v.mouse[0],v.mouse[1]),v.extent,i));function A(){v.wheel=null,v.end()}}function T(d,...S){if(h||!t.apply(this,arguments))return;var v=d.currentTarget,$=C(this,S,!0).event(d),k=pt(d.view).on("mousemove.zoom",D,!0).on("mouseup.zoom",O,!0),w=vt(d,v),A=d.clientX,I=d.clientY;po(d.view),xn(d),$.mouse=[w,this.__zoom.invert(w)],Ye(this),$.start();function D(F){if(me(F),!$.moved){var q=F.clientX-A,W=F.clientY-I;$.moved=q*q+W*W>p}$.event(F).zoom("mouse",n(N($.that.__zoom,$.mouse[0]=vt(F,v),$.mouse[1]),$.extent,i))}function O(F){k.on("mousemove.zoom mouseup.zoom",null),mo(F.view,$.moved),me(F),$.event(F).end()}}function L(d,...S){if(t.apply(this,arguments)){var v=this.__zoom,$=vt(d.changedTouches?d.changedTouches[0]:d,this),k=v.invert($),w=v.k*(d.shiftKey?.5:2),A=n(N(b(v,w),$,k),e.apply(this,S),i);me(d),c>0?pt(this).transition().duration(c).call(M,A,$,d):pt(this).call(m.transform,A,$,d)}}function P(d,...S){if(t.apply(this,arguments)){var v=d.touches,$=v.length,k=C(this,S,d.changedTouches.length===$).event(d),w,A,I,D;for(xn(d),A=0;A<$;++A)I=v[A],D=vt(I,this),D=[D,this.__zoom.invert(D),I.identifier],k.touch0?!k.touch1&&k.touch0[2]!==D[2]&&(k.touch1=D,k.taps=0):(k.touch0=D,w=!0,k.taps=1+!!u);u&&(u=clearTimeout(u)),w&&(k.taps<2&&(f=D[0],u=setTimeout(function(){u=null},g)),Ye(this),k.start())}}function B(d,...S){if(this.__zooming){var v=C(this,S).event(d),$=d.changedTouches,k=$.length,w,A,I,D;for(me(d),w=0;w<k;++w)A=$[w],I=vt(A,this),v.touch0&&v.touch0[2]===A.identifier?v.touch0[0]=I:v.touch1&&v.touch1[2]===A.identifier&&(v.touch1[0]=I);if(A=v.that.__zoom,v.touch1){var O=v.touch0[0],F=v.touch0[1],q=v.touch1[0],W=v.touch1[1],Z=(Z=q[0]-O[0])*Z+(Z=q[1]-O[1])*Z,G=(G=W[0]-F[0])*G+(G=W[1]-F[1])*G;A=b(A,Math.sqrt(Z/G)),I=[(O[0]+q[0])/2,(O[1]+q[1])/2],D=[(F[0]+W[0])/2,(F[1]+W[1])/2]}else if(v.touch0)I=v.touch0[0],D=v.touch0[1];else return;v.zoom("touch",n(N(A,I,D),v.extent,i))}}function V(d,...S){if(this.__zooming){var v=C(this,S).event(d),$=d.changedTouches,k=$.length,w,A;for(xn(d),h&&clearTimeout(h),h=setTimeout(function(){h=null},g),w=0;w<k;++w)A=$[w],v.touch0&&v.touch0[2]===A.identifier?delete v.touch0:v.touch1&&v.touch1[2]===A.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(A=vt(A,this),Math.hypot(f[0]-A[0],f[1]-A[1])<_)){var I=pt(this).on("dblclick.zoom");I&&I.apply(this,arguments)}}}return m.wheelDelta=function(d){return arguments.length?(r=typeof d=="function"?d:Pe(+d),m):r},m.filter=function(d){return arguments.length?(t=typeof d=="function"?d:Pe(!!d),m):t},m.touchable=function(d){return arguments.length?(o=typeof d=="function"?d:Pe(!!d),m):o},m.extent=function(d){return arguments.length?(e=typeof d=="function"?d:Pe([[+d[0][0],+d[0][1]],[+d[1][0],+d[1][1]]]),m):e},m.scaleExtent=function(d){return arguments.length?(s[0]=+d[0],s[1]=+d[1],m):[s[0],s[1]]},m.translateExtent=function(d){return arguments.length?(i[0][0]=+d[0][0],i[1][0]=+d[1][0],i[0][1]=+d[0][1],i[1][1]=+d[1][1],m):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},m.constrain=function(d){return arguments.length?(n=d,m):n},m.duration=function(d){return arguments.length?(c=+d,m):c},m.interpolate=function(d){return arguments.length?(a=d,m):a},m.on=function(){var d=l.on.apply(l,arguments);return d===l?m:d},m.clickDistance=function(d){return arguments.length?(p=(d=+d)*d,m):Math.sqrt(p)},m.tapDistance=function(d){return arguments.length?(_=+d,m):_},m}const sn=E.createContext(null),qu=sn.Provider,$t={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.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 React Flow 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,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,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.`},Co=$t.error001();function tt(t,e){const n=E.useContext(sn);if(n===null)throw new Error(Co);return eo(n,t,e)}const nt=()=>{const t=E.useContext(sn);if(t===null)throw new Error(Co);return E.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},Uu=t=>t.userSelectionActive?"none":"all";function Wu({position:t,children:e,className:n,style:r,...o}){const s=tt(Uu),i=`${t}`.split("-");return R.createElement("div",{className:ft(["react-flow__panel",n,...i]),style:{...r,pointerEvents:s},...o},e)}function Zu({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:R.createElement(Wu,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},R.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const Gu=({x:t,y:e,label:n,labelStyle:r={},labelShowBg:o=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:c=2,children:a,className:l,...u})=>{const f=E.useRef(null),[h,g]=E.useState({x:0,y:0,width:0,height:0}),x=ft(["react-flow__edge-textwrapper",l]);return E.useEffect(()=>{if(f.current){const p=f.current.getBBox();g({x:p.x,y:p.y,width:p.width,height:p.height})}},[n]),typeof n>"u"||!n?null:R.createElement("g",{transform:`translate(${t-h.width/2} ${e-h.height/2})`,className:x,visibility:h.width?"visible":"hidden",...u},o&&R.createElement("rect",{width:h.width+2*i[0],x:-i[0],y:-i[1],height:h.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:c,ry:c}),R.createElement("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:f,style:r},n),a)};var Ku=E.memo(Gu);const Un=t=>({width:t.offsetWidth,height:t.offsetHeight}),le=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Wn=(t={x:0,y:0},e)=>({x:le(t.x,e[0][0],e[1][0]),y:le(t.y,e[0][1],e[1][1])}),kr=(t,e,n)=>t<e?le(Math.abs(t-e),1,50)/50:t>n?-le(Math.abs(t-n),1,50)/50:0,ko=(t,e)=>{const n=kr(t.x,35,e.width-35)*20,r=kr(t.y,35,e.height-35)*20;return[n,r]},Io=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Qu=(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)}),Zn=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),Ju=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),Ir=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),In=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},ju=t=>lt(t.width)&<(t.height)&<(t.x)&<(t.y),lt=t=>!isNaN(t)&&isFinite(t),j=Symbol.for("internals"),Ro=["Enter"," ","Escape"],tl=(t,e)=>{},el=t=>"nativeEvent"in t;function Rn(t){var o,s;const e=el(t)?t.nativeEvent:t,n=((s=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:s[0])||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const zo=t=>"clientX"in t,zt=(t,e)=>{var s,i;const n=zo(t),r=n?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,o=n?t.clientY:(i=t.touches)==null?void 0:i[0].clientY;return{x:r-((e==null?void 0:e.left)??0),y:o-((e==null?void 0:e.top)??0)}},Qe=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},ke=({id:t,path:e,labelX:n,labelY:r,label:o,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:l,style:u,markerEnd:f,markerStart:h,interactionWidth:g=20})=>R.createElement(R.Fragment,null,R.createElement("path",{id:t,style:u,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:f,markerStart:h}),g&&R.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:g,className:"react-flow__edge-interaction"}),o&<(n)&<(r)?R.createElement(Ku,{x:n,y:r,label:o,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:l}):null);ke.displayName="BaseEdge";function ye(t,e,n){return n===void 0?n:r=>{const o=e().edges.find(s=>s.id===t);o&&n(r,{...o})}}function Do({sourceX:t,sourceY:e,targetX:n,targetY:r}){const o=Math.abs(n-t)/2,s=n<t?n+o:n-o,i=Math.abs(r-e)/2,c=r<e?r+i:r-i;return[s,c,o,i]}function Po({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:o,sourceControlY:s,targetControlX:i,targetControlY:c}){const a=t*.125+o*.375+i*.375+n*.125,l=e*.125+s*.375+c*.375+r*.125,u=Math.abs(a-t),f=Math.abs(l-e);return[a,l,u,f]}var Wt;(function(t){t.Strict="strict",t.Loose="loose"})(Wt||(Wt={}));var Yt;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(Yt||(Yt={}));var Me;(function(t){t.Partial="partial",t.Full="full"})(Me||(Me={}));var It;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(It||(It={}));var Je;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Je||(Je={}));var X;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(X||(X={}));function Rr({pos:t,x1:e,y1:n,x2:r,y2:o}){return t===X.Left||t===X.Right?[.5*(e+r),n]:[e,.5*(n+o)]}function Ho({sourceX:t,sourceY:e,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:s=X.Top}){const[i,c]=Rr({pos:n,x1:t,y1:e,x2:r,y2:o}),[a,l]=Rr({pos:s,x1:r,y1:o,x2:t,y2:e}),[u,f,h,g]=Po({sourceX:t,sourceY:e,targetX:r,targetY:o,sourceControlX:i,sourceControlY:c,targetControlX:a,targetControlY:l});return[`M${t},${e} C${i},${c} ${a},${l} ${r},${o}`,u,f,h,g]}const Gn=E.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:o=X.Bottom,targetPosition:s=X.Top,label:i,labelStyle:c,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:x,interactionWidth:p})=>{const[_,m,b]=Ho({sourceX:t,sourceY:e,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return R.createElement(ke,{path:_,labelX:m,labelY:b,label:i,labelStyle:c,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:x,interactionWidth:p})});Gn.displayName="SimpleBezierEdge";const zr={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},nl=({source:t,sourcePosition:e=X.Bottom,target:n})=>e===X.Left||e===X.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},Dr=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function rl({source:t,sourcePosition:e=X.Bottom,target:n,targetPosition:r=X.Top,center:o,offset:s}){const i=zr[e],c=zr[r],a={x:t.x+i.x*s,y:t.y+i.y*s},l={x:n.x+c.x*s,y:n.y+c.y*s},u=nl({source:a,sourcePosition:e,target:l}),f=u.x!==0?"x":"y",h=u[f];let g=[],x,p;const _={x:0,y:0},m={x:0,y:0},[b,N,y,M]=Do({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[f]*c[f]===-1){x=o.x??b,p=o.y??N;const z=[{x,y:a.y},{x,y:l.y}],H=[{x:a.x,y:p},{x:l.x,y:p}];i[f]===h?g=f==="x"?z:H:g=f==="x"?H:z}else{const z=[{x:a.x,y:l.y}],H=[{x:l.x,y:a.y}];if(f==="x"?g=i.x===h?H:z:g=i.y===h?z:H,e===r){const V=Math.abs(t[f]-n[f]);if(V<=s){const d=Math.min(s-1,s-V);i[f]===h?_[f]=(a[f]>t[f]?-1:1)*d:m[f]=(l[f]>n[f]?-1:1)*d}}if(e!==r){const V=f==="x"?"y":"x",d=i[f]===c[V],S=a[V]>l[V],v=a[V]<l[V];(i[f]===1&&(!d&&S||d&&v)||i[f]!==1&&(!d&&v||d&&S))&&(g=f==="x"?z:H)}const T={x:a.x+_.x,y:a.y+_.y},L={x:l.x+m.x,y:l.y+m.y},P=Math.max(Math.abs(T.x-g[0].x),Math.abs(L.x-g[0].x)),B=Math.max(Math.abs(T.y-g[0].y),Math.abs(L.y-g[0].y));P>=B?(x=(T.x+L.x)/2,p=g[0].y):(x=g[0].x,p=(T.y+L.y)/2)}return[[t,{x:a.x+_.x,y:a.y+_.y},...g,{x:l.x+m.x,y:l.y+m.y},n],x,p,y,M]}function ol(t,e,n,r){const o=Math.min(Dr(t,e)/2,Dr(e,n)/2,r),{x:s,y:i}=e;if(t.x===s&&s===n.x||t.y===i&&i===n.y)return`L${s} ${i}`;if(t.y===i){const l=t.x<n.x?-1:1,u=t.y<n.y?1:-1;return`L ${s+o*l},${i}Q ${s},${i} ${s},${i+o*u}`}const c=t.x<n.x?1:-1,a=t.y<n.y?-1:1;return`L ${s},${i+o*a}Q ${s},${i} ${s+o*c},${i}`}function zn({sourceX:t,sourceY:e,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:s=X.Top,borderRadius:i=5,centerX:c,centerY:a,offset:l=20}){const[u,f,h,g,x]=rl({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:o},targetPosition:s,center:{x:c,y:a},offset:l});return[u.reduce((_,m,b)=>{let N="";return b>0&&b<u.length-1?N=ol(u[b-1],m,u[b+1],i):N=`${b===0?"M":"L"}${m.x} ${m.y}`,_+=N,_},""),f,h,g,x]}const cn=E.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:o,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:l,style:u,sourcePosition:f=X.Bottom,targetPosition:h=X.Top,markerEnd:g,markerStart:x,pathOptions:p,interactionWidth:_})=>{const[m,b,N]=zn({sourceX:t,sourceY:e,sourcePosition:f,targetX:n,targetY:r,targetPosition:h,borderRadius:p==null?void 0:p.borderRadius,offset:p==null?void 0:p.offset});return R.createElement(ke,{path:m,labelX:b,labelY:N,label:o,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:l,style:u,markerEnd:g,markerStart:x,interactionWidth:_})});cn.displayName="SmoothStepEdge";const Kn=E.memo(t=>{var e;return R.createElement(cn,{...t,pathOptions:E.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});Kn.displayName="StepEdge";function il({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[o,s,i,c]=Do({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,o,s,i,c]}const Qn=E.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:o,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:l,style:u,markerEnd:f,markerStart:h,interactionWidth:g})=>{const[x,p,_]=il({sourceX:t,sourceY:e,targetX:n,targetY:r});return R.createElement(ke,{path:x,labelX:p,labelY:_,label:o,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:l,style:u,markerEnd:f,markerStart:h,interactionWidth:g})});Qn.displayName="StraightEdge";function He(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function Pr({pos:t,x1:e,y1:n,x2:r,y2:o,c:s}){switch(t){case X.Left:return[e-He(e-r,s),n];case X.Right:return[e+He(r-e,s),n];case X.Top:return[e,n-He(n-o,s)];case X.Bottom:return[e,n+He(o-n,s)]}}function Lo({sourceX:t,sourceY:e,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:s=X.Top,curvature:i=.25}){const[c,a]=Pr({pos:n,x1:t,y1:e,x2:r,y2:o,c:i}),[l,u]=Pr({pos:s,x1:r,y1:o,x2:t,y2:e,c:i}),[f,h,g,x]=Po({sourceX:t,sourceY:e,targetX:r,targetY:o,sourceControlX:c,sourceControlY:a,targetControlX:l,targetControlY:u});return[`M${t},${e} C${c},${a} ${l},${u} ${r},${o}`,f,h,g,x]}const je=E.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:o=X.Bottom,targetPosition:s=X.Top,label:i,labelStyle:c,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:x,pathOptions:p,interactionWidth:_})=>{const[m,b,N]=Lo({sourceX:t,sourceY:e,sourcePosition:o,targetX:n,targetY:r,targetPosition:s,curvature:p==null?void 0:p.curvature});return R.createElement(ke,{path:m,labelX:b,labelY:N,label:i,labelStyle:c,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:x,interactionWidth:_})});je.displayName="BezierEdge";const Jn=E.createContext(null),sl=Jn.Provider;Jn.Consumer;const cl=()=>E.useContext(Jn),al=t=>"id"in t&&"source"in t&&"target"in t,ul=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${n}${r||""}`,Dn=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`,ll=(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)),fl=(t,e)=>{if(!t.source||!t.target)return e;let n;return al(t)?n={...t}:n={...t,id:ul(t)},ll(n,e)?e:e.concat(n)},Pn=({x:t,y:e},[n,r,o],s,[i,c])=>{const a={x:(t-n)/o,y:(e-r)/o};return s?{x:i*Math.round(a.x/i),y:c*Math.round(a.y/c)}:a},Vo=({x:t,y:e},[n,r,o])=>({x:t*o+n,y:e*o+r}),se=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],r=(t.height??0)*e[1],o={x:t.position.x-n,y:t.position.y-r};return{...o,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-r}:o}},jn=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,o)=>{const{x:s,y:i}=se(o,e).positionAbsolute;return Qu(r,Zn({x:s,y:i,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ju(n)},Bo=(t,e,[n,r,o]=[0,0,1],s=!1,i=!1,c=[0,0])=>{const a={x:(e.x-n)/o,y:(e.y-r)/o,width:e.width/o,height:e.height/o},l=[];return t.forEach(u=>{const{width:f,height:h,selectable:g=!0,hidden:x=!1}=u;if(i&&!g||x)return!1;const{positionAbsolute:p}=se(u,c),_={x:p.x,y:p.y,width:f||0,height:h||0},m=In(a,_),b=typeof f>"u"||typeof h>"u"||f===null||h===null,N=s&&m>0,y=(f||0)*(h||0);(b||N||m>=y||u.dragging)&&l.push(u)}),l},Fo=(t,e)=>{const n=t.map(r=>r.id);return e.filter(r=>n.includes(r.source)||n.includes(r.target))},Oo=(t,e,n,r,o,s=.1)=>{const i=e/(t.width*(1+s)),c=n/(t.height*(1+s)),a=Math.min(i,c),l=le(a,r,o),u=t.x+t.width/2,f=t.y+t.height/2,h=e/2-u*l,g=n/2-f*l;return{x:h,y:g,zoom:l}},Ot=(t,e=0)=>t.transition().duration(e);function Hr(t,e,n,r){return(e[n]||[]).reduce((o,s)=>{var i,c;return`${t.id}-${s.id}-${n}`!==r&&o.push({id:s.id||null,type:n,nodeId:t.id,x:(((i=t.positionAbsolute)==null?void 0:i.x)??0)+s.x+s.width/2,y:(((c=t.positionAbsolute)==null?void 0:c.y)??0)+s.y+s.height/2}),o},[])}function dl(t,e,n,r,o,s){const{x:i,y:c}=zt(t),l=e.elementsFromPoint(i,c).find(x=>x.classList.contains("react-flow__handle"));if(l){const x=l.getAttribute("data-nodeid");if(x){const p=tr(void 0,l),_=l.getAttribute("data-handleid"),m=s({nodeId:x,id:_,type:p});if(m){const b=o.find(N=>N.nodeId===x&&N.type===p&&N.id===_);return{handle:{id:_,type:p,nodeId:x,x:(b==null?void 0:b.x)||n.x,y:(b==null?void 0:b.y)||n.y},validHandleResult:m}}}}let u=[],f=1/0;if(o.forEach(x=>{const p=Math.sqrt((x.x-n.x)**2+(x.y-n.y)**2);if(p<=r){const _=s(x);p<=f&&(p<f?u=[{handle:x,validHandleResult:_}]:p===f&&u.push({handle:x,validHandleResult:_}),f=p)}}),!u.length)return{handle:null,validHandleResult:Xo()};if(u.length===1)return u[0];const h=u.some(({validHandleResult:x})=>x.isValid),g=u.some(({handle:x})=>x.type==="target");return u.find(({handle:x,validHandleResult:p})=>g?x.type==="target":h?p.isValid:!0)||u[0]}const hl={source:null,target:null,sourceHandle:null,targetHandle:null},Xo=()=>({handleDomNode:null,isValid:!1,connection:hl,endHandle:null});function Yo(t,e,n,r,o,s,i){const c=o==="target",a=i.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),l={...Xo(),handleDomNode:a};if(a){const u=tr(void 0,a),f=a.getAttribute("data-nodeid"),h=a.getAttribute("data-handleid"),g=a.classList.contains("connectable"),x=a.classList.contains("connectableend"),p={source:c?f:n,sourceHandle:c?h:r,target:c?n:f,targetHandle:c?r:h};l.connection=p,g&&x&&(e===Wt.Strict?c&&u==="source"||!c&&u==="target":f!==n||h!==r)&&(l.endHandle={nodeId:f,handleId:h,type:u},l.isValid=s(p))}return l}function gl({nodes:t,nodeId:e,handleId:n,handleType:r}){return t.reduce((o,s)=>{if(s[j]){const{handleBounds:i}=s[j];let c=[],a=[];i&&(c=Hr(s,i,"source",`${e}-${n}-${r}`),a=Hr(s,i,"target",`${e}-${n}-${r}`)),o.push(...c,...a)}return o},[])}function tr(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function wn(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function pl(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function qo({event:t,handleId:e,nodeId:n,onConnect:r,isTarget:o,getState:s,setState:i,isValidConnection:c,edgeUpdaterType:a,onReconnectEnd:l}){const u=Io(t.target),{connectionMode:f,domNode:h,autoPanOnConnect:g,connectionRadius:x,onConnectStart:p,panBy:_,getNodes:m,cancelConnection:b}=s();let N=0,y;const{x:M,y:C}=zt(t),z=u==null?void 0:u.elementFromPoint(M,C),H=tr(a,z),T=h==null?void 0:h.getBoundingClientRect();if(!T||!H)return;let L,P=zt(t,T),B=!1,V=null,d=!1,S=null;const v=gl({nodes:m(),nodeId:n,handleId:e,handleType:H}),$=()=>{if(!g)return;const[A,I]=ko(P,T);_({x:A,y:I}),N=requestAnimationFrame($)};i({connectionPosition:P,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:H,connectionStartHandle:{nodeId:n,handleId:e,type:H},connectionEndHandle:null}),p==null||p(t,{nodeId:n,handleId:e,handleType:H});function k(A){const{transform:I}=s();P=zt(A,T);const{handle:D,validHandleResult:O}=dl(A,u,Pn(P,I,!1,[1,1]),x,v,F=>Yo(F,f,n,e,o?"target":"source",c,u));if(y=D,B||($(),B=!0),S=O.handleDomNode,V=O.connection,d=O.isValid,i({connectionPosition:y&&d?Vo({x:y.x,y:y.y},I):P,connectionStatus:pl(!!y,d),connectionEndHandle:O.endHandle}),!y&&!d&&!S)return wn(L);V.source!==V.target&&S&&(wn(L),L=S,S.classList.add("connecting","react-flow__handle-connecting"),S.classList.toggle("valid",d),S.classList.toggle("react-flow__handle-valid",d))}function w(A){var I,D;(y||S)&&V&&d&&(r==null||r(V)),(D=(I=s()).onConnectEnd)==null||D.call(I,A),a&&(l==null||l(A)),wn(L),b(),cancelAnimationFrame(N),B=!1,d=!1,V=null,S=null,u.removeEventListener("mousemove",k),u.removeEventListener("mouseup",w),u.removeEventListener("touchmove",k),u.removeEventListener("touchend",w)}u.addEventListener("mousemove",k),u.addEventListener("mouseup",w),u.addEventListener("touchmove",k),u.addEventListener("touchend",w)}const Lr=()=>!0,ml=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),yl=(t,e,n)=>r=>{const{connectionStartHandle:o,connectionEndHandle:s,connectionClickStartHandle:i}=r;return{connecting:(o==null?void 0:o.nodeId)===t&&(o==null?void 0:o.handleId)===e&&(o==null?void 0:o.type)===n||(s==null?void 0:s.nodeId)===t&&(s==null?void 0:s.handleId)===e&&(s==null?void 0:s.type)===n,clickConnecting:(i==null?void 0:i.nodeId)===t&&(i==null?void 0:i.handleId)===e&&(i==null?void 0:i.type)===n}},Uo=E.forwardRef(({type:t="source",position:e=X.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:s=!0,id:i,onConnect:c,children:a,className:l,onMouseDown:u,onTouchStart:f,...h},g)=>{var T,L;const x=i||null,p=t==="target",_=nt(),m=cl(),{connectOnClick:b,noPanClassName:N}=tt(ml,it),{connecting:y,clickConnecting:M}=tt(yl(m,x,t),it);m||(L=(T=_.getState()).onError)==null||L.call(T,"010",$t.error010());const C=P=>{const{defaultEdgeOptions:B,onConnect:V,hasDefaultEdges:d}=_.getState(),S={...B,...P};if(d){const{edges:v,setEdges:$}=_.getState();$(fl(S,v))}V==null||V(S),c==null||c(S)},z=P=>{if(!m)return;const B=zo(P);o&&(B&&P.button===0||!B)&&qo({event:P,handleId:x,nodeId:m,onConnect:C,isTarget:p,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||Lr}),B?u==null||u(P):f==null||f(P)},H=P=>{const{onClickConnectStart:B,onClickConnectEnd:V,connectionClickStartHandle:d,connectionMode:S,isValidConnection:v}=_.getState();if(!m||!d&&!o)return;if(!d){B==null||B(P,{nodeId:m,handleId:x,handleType:t}),_.setState({connectionClickStartHandle:{nodeId:m,type:t,handleId:x}});return}const $=Io(P.target),k=n||v||Lr,{connection:w,isValid:A}=Yo({nodeId:m,id:x,type:t},S,d.nodeId,d.handleId||null,d.type,k,$);A&&C(w),V==null||V(P),_.setState({connectionClickStartHandle:null})};return R.createElement("div",{"data-handleid":x,"data-nodeid":m,"data-handlepos":e,"data-id":`${m}-${x}-${t}`,className:ft(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",N,l,{source:!p,target:p,connectable:r,connectablestart:o,connectableend:s,connecting:M,connectionindicator:r&&(o&&!y||s&&y)}]),onMouseDown:z,onTouchStart:z,onClick:b?H:void 0,ref:g,...h},a)});Uo.displayName="Handle";var tn=E.memo(Uo);const Wo=({data:t,isConnectable:e,targetPosition:n=X.Top,sourcePosition:r=X.Bottom})=>R.createElement(R.Fragment,null,R.createElement(tn,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,R.createElement(tn,{type:"source",position:r,isConnectable:e}));Wo.displayName="DefaultNode";var Hn=E.memo(Wo);const Zo=({data:t,isConnectable:e,sourcePosition:n=X.Bottom})=>R.createElement(R.Fragment,null,t==null?void 0:t.label,R.createElement(tn,{type:"source",position:n,isConnectable:e}));Zo.displayName="InputNode";var Go=E.memo(Zo);const Ko=({data:t,isConnectable:e,targetPosition:n=X.Top})=>R.createElement(R.Fragment,null,R.createElement(tn,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);Ko.displayName="OutputNode";var Qo=E.memo(Ko);const er=()=>null;er.displayName="GroupNode";const xl=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Le=t=>t.id;function wl(t,e){return it(t.selectedNodes.map(Le),e.selectedNodes.map(Le))&&it(t.selectedEdges.map(Le),e.selectedEdges.map(Le))}const Jo=E.memo(({onSelectionChange:t})=>{const e=nt(),{selectedNodes:n,selectedEdges:r}=tt(xl,wl);return E.useEffect(()=>{const o={nodes:n,edges:r};t==null||t(o),e.getState().onSelectionChange.forEach(s=>s(o))},[n,r,t]),null});Jo.displayName="SelectionListener";const vl=t=>!!t.onSelectionChange;function _l({onSelectionChange:t}){const e=tt(vl);return t||e?R.createElement(Jo,{onSelectionChange:t}):null}const bl=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function jt(t,e){E.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function U(t,e,n){E.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const Sl=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:o,onConnectStart:s,onConnectEnd:i,onClickConnectStart:c,onClickConnectEnd:a,nodesDraggable:l,nodesConnectable:u,nodesFocusable:f,edgesFocusable:h,edgesUpdatable:g,elevateNodesOnSelect:x,minZoom:p,maxZoom:_,nodeExtent:m,onNodesChange:b,onEdgesChange:N,elementsSelectable:y,connectionMode:M,snapGrid:C,snapToGrid:z,translateExtent:H,connectOnClick:T,defaultEdgeOptions:L,fitView:P,fitViewOptions:B,onNodesDelete:V,onEdgesDelete:d,onNodeDrag:S,onNodeDragStart:v,onNodeDragStop:$,onSelectionDrag:k,onSelectionDragStart:w,onSelectionDragStop:A,noPanClassName:I,nodeOrigin:D,rfId:O,autoPanOnConnect:F,autoPanOnNodeDrag:q,onError:W,connectionRadius:Z,isValidConnection:G,nodeDragThreshold:J})=>{const{setNodes:K,setEdges:dt,setDefaultNodesAndEdges:at,setMinZoom:ht,setMaxZoom:ut,setTranslateExtent:et,setNodeExtent:xt,reset:Q}=tt(bl,it),Y=nt();return E.useEffect(()=>{const st=r==null?void 0:r.map(Dt=>({...Dt,...L}));return at(n,st),()=>{Q()}},[]),U("defaultEdgeOptions",L,Y.setState),U("connectionMode",M,Y.setState),U("onConnect",o,Y.setState),U("onConnectStart",s,Y.setState),U("onConnectEnd",i,Y.setState),U("onClickConnectStart",c,Y.setState),U("onClickConnectEnd",a,Y.setState),U("nodesDraggable",l,Y.setState),U("nodesConnectable",u,Y.setState),U("nodesFocusable",f,Y.setState),U("edgesFocusable",h,Y.setState),U("edgesUpdatable",g,Y.setState),U("elementsSelectable",y,Y.setState),U("elevateNodesOnSelect",x,Y.setState),U("snapToGrid",z,Y.setState),U("snapGrid",C,Y.setState),U("onNodesChange",b,Y.setState),U("onEdgesChange",N,Y.setState),U("connectOnClick",T,Y.setState),U("fitViewOnInit",P,Y.setState),U("fitViewOnInitOptions",B,Y.setState),U("onNodesDelete",V,Y.setState),U("onEdgesDelete",d,Y.setState),U("onNodeDrag",S,Y.setState),U("onNodeDragStart",v,Y.setState),U("onNodeDragStop",$,Y.setState),U("onSelectionDrag",k,Y.setState),U("onSelectionDragStart",w,Y.setState),U("onSelectionDragStop",A,Y.setState),U("noPanClassName",I,Y.setState),U("nodeOrigin",D,Y.setState),U("rfId",O,Y.setState),U("autoPanOnConnect",F,Y.setState),U("autoPanOnNodeDrag",q,Y.setState),U("onError",W,Y.setState),U("connectionRadius",Z,Y.setState),U("isValidConnection",G,Y.setState),U("nodeDragThreshold",J,Y.setState),jt(t,K),jt(e,dt),jt(p,ht),jt(_,ut),jt(H,et),jt(m,xt),null},Vr={display:"none"},El={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},jo="react-flow__node-desc",ti="react-flow__edge-desc",Nl="react-flow__aria-live",Al=t=>t.ariaLiveMessage;function Ml({rfId:t}){const e=tt(Al);return R.createElement("div",{id:`${Nl}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:El},e)}function $l({rfId:t,disableKeyboardA11y:e}){return R.createElement(R.Fragment,null,R.createElement("div",{id:`${jo}-${t}`,style:Vr},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),R.createElement("div",{id:`${ti}-${t}`,style:Vr},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&R.createElement(Ml,{rfId:t}))}var $e=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,r]=E.useState(!1),o=E.useRef(!1),s=E.useRef(new Set([])),[i,c]=E.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(f=>typeof f=="string").map(f=>f.split("+")),u=l.reduce((f,h)=>f.concat(...h),[]);return[l,u]}return[[],[]]},[t]);return E.useEffect(()=>{const a=typeof document<"u"?document:null,l=(e==null?void 0:e.target)||a;if(t!==null){const u=g=>{if(o.current=g.ctrlKey||g.metaKey||g.shiftKey,(!o.current||o.current&&!e.actInsideInputWithModifier)&&Rn(g))return!1;const p=Fr(g.code,c);s.current.add(g[p]),Br(i,s.current,!1)&&(g.preventDefault(),r(!0))},f=g=>{if((!o.current||o.current&&!e.actInsideInputWithModifier)&&Rn(g))return!1;const p=Fr(g.code,c);Br(i,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(g[p]),g.key==="Meta"&&s.current.clear(),o.current=!1},h=()=>{s.current.clear(),r(!1)};return l==null||l.addEventListener("keydown",u),l==null||l.addEventListener("keyup",f),window.addEventListener("blur",h),()=>{l==null||l.removeEventListener("keydown",u),l==null||l.removeEventListener("keyup",f),window.removeEventListener("blur",h)}}},[t,r]),n};function Br(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(o=>e.has(o)))}function Fr(t,e){return e.includes(t)?"code":"key"}function ei(t,e,n,r){var c,a;const o=t.parentNode||t.parentId;if(!o)return n;const s=e.get(o),i=se(s,r);return ei(s,e,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((c=s[j])==null?void 0:c.z)??0)>(n.z??0)?((a=s[j])==null?void 0:a.z)??0:n.z??0},r)}function ni(t,e,n){t.forEach(r=>{var s;const o=r.parentNode||r.parentId;if(o&&!t.has(o))throw new Error(`Parent node ${o} not found`);if(o||n!=null&&n[r.id]){const{x:i,y:c,z:a}=ei(r,t,{...r.position,z:((s=r[j])==null?void 0:s.z)??0},e);r.positionAbsolute={x:i,y:c},r[j].z=a,n!=null&&n[r.id]&&(r[j].isParent=!0)}})}function vn(t,e,n,r){const o=new Map,s={},i=r?1e3:0;return t.forEach(c=>{var g;const a=(lt(c.zIndex)?c.zIndex:0)+(c.selected?i:0),l=e.get(c.id),u={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},f=c.parentNode||c.parentId;f&&(s[f]=!0);const h=(l==null?void 0:l.type)&&(l==null?void 0:l.type)!==c.type;Object.defineProperty(u,j,{enumerable:!1,value:{handleBounds:h||(g=l==null?void 0:l[j])==null?void 0:g.handleBounds,z:a}}),o.set(c.id,u)}),ni(o,n,s),o}function ri(t,e={}){const{getNodes:n,width:r,height:o,minZoom:s,maxZoom:i,d3Zoom:c,d3Selection:a,fitViewOnInitDone:l,fitViewOnInit:u,nodeOrigin:f}=t(),h=e.initial&&!l&&u;if(c&&a&&(h||!e.initial)){const x=n().filter(_=>{var b;const m=e.includeHiddenNodes?_.width&&_.height:!_.hidden;return(b=e.nodes)!=null&&b.length?m&&e.nodes.some(N=>N.id===_.id):m}),p=x.every(_=>_.width&&_.height);if(x.length>0&&p){const _=jn(x,f),{x:m,y:b,zoom:N}=Oo(_,r,o,e.minZoom??s,e.maxZoom??i,e.padding??.1),y=Rt.translate(m,b).scale(N);return typeof e.duration=="number"&&e.duration>0?c.transform(Ot(a,e.duration),y):c.transform(a,y),!0}}return!1}function Tl(t,e){return t.forEach(n=>{const r=e.get(n.id);r&&e.set(r.id,{...r,[j]:r[j],selected:n.selected})}),new Map(e)}function Cl(t,e){return e.map(n=>{const r=t.find(o=>o.id===n.id);return r&&(n.selected=r.selected),n})}function Ve({changedNodes:t,changedEdges:e,get:n,set:r}){const{nodeInternals:o,edges:s,onNodesChange:i,onEdgesChange:c,hasDefaultNodes:a,hasDefaultEdges:l}=n();t!=null&&t.length&&(a&&r({nodeInternals:Tl(t,o)}),i==null||i(t)),e!=null&&e.length&&(l&&r({edges:Cl(e,s)}),c==null||c(e))}const te=()=>{},kl={zoomIn:te,zoomOut:te,zoomTo:te,getZoom:()=>1,setViewport:te,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:te,fitBounds:te,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},Il=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),Rl=()=>{const t=nt(),{d3Zoom:e,d3Selection:n}=tt(Il,it);return E.useMemo(()=>n&&e?{zoomIn:o=>e.scaleBy(Ot(n,o==null?void 0:o.duration),1.2),zoomOut:o=>e.scaleBy(Ot(n,o==null?void 0:o.duration),1/1.2),zoomTo:(o,s)=>e.scaleTo(Ot(n,s==null?void 0:s.duration),o),getZoom:()=>t.getState().transform[2],setViewport:(o,s)=>{const[i,c,a]=t.getState().transform,l=Rt.translate(o.x??i,o.y??c).scale(o.zoom??a);e.transform(Ot(n,s==null?void 0:s.duration),l)},getViewport:()=>{const[o,s,i]=t.getState().transform;return{x:o,y:s,zoom:i}},fitView:o=>ri(t.getState,o),setCenter:(o,s,i)=>{const{width:c,height:a,maxZoom:l}=t.getState(),u=typeof(i==null?void 0:i.zoom)<"u"?i.zoom:l,f=c/2-o*u,h=a/2-s*u,g=Rt.translate(f,h).scale(u);e.transform(Ot(n,i==null?void 0:i.duration),g)},fitBounds:(o,s)=>{const{width:i,height:c,minZoom:a,maxZoom:l}=t.getState(),{x:u,y:f,zoom:h}=Oo(o,i,c,a,l,(s==null?void 0:s.padding)??.1),g=Rt.translate(u,f).scale(h);e.transform(Ot(n,s==null?void 0:s.duration),g)},project:o=>{const{transform:s,snapToGrid:i,snapGrid:c}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Pn(o,s,i,c)},screenToFlowPosition:o=>{const{transform:s,snapToGrid:i,snapGrid:c,domNode:a}=t.getState();if(!a)return o;const{x:l,y:u}=a.getBoundingClientRect(),f={x:o.x-l,y:o.y-u};return Pn(f,s,i,c)},flowToScreenPosition:o=>{const{transform:s,domNode:i}=t.getState();if(!i)return o;const{x:c,y:a}=i.getBoundingClientRect(),l=Vo(o,s);return{x:l.x+c,y:l.y+a}},viewportInitialized:!0}:kl,[e,n])};function oi(){const t=Rl(),e=nt(),n=E.useCallback(()=>e.getState().getNodes().map(p=>({...p})),[]),r=E.useCallback(p=>e.getState().nodeInternals.get(p),[]),o=E.useCallback(()=>{const{edges:p=[]}=e.getState();return p.map(_=>({..._}))},[]),s=E.useCallback(p=>{const{edges:_=[]}=e.getState();return _.find(m=>m.id===p)},[]),i=E.useCallback(p=>{const{getNodes:_,setNodes:m,hasDefaultNodes:b,onNodesChange:N}=e.getState(),y=_(),M=typeof p=="function"?p(y):p;if(b)m(M);else if(N){const C=M.length===0?y.map(z=>({type:"remove",id:z.id})):M.map(z=>({item:z,type:"reset"}));N(C)}},[]),c=E.useCallback(p=>{const{edges:_=[],setEdges:m,hasDefaultEdges:b,onEdgesChange:N}=e.getState(),y=typeof p=="function"?p(_):p;if(b)m(y);else if(N){const M=y.length===0?_.map(C=>({type:"remove",id:C.id})):y.map(C=>({item:C,type:"reset"}));N(M)}},[]),a=E.useCallback(p=>{const _=Array.isArray(p)?p:[p],{getNodes:m,setNodes:b,hasDefaultNodes:N,onNodesChange:y}=e.getState();if(N){const C=[...m(),..._];b(C)}else if(y){const M=_.map(C=>({item:C,type:"add"}));y(M)}},[]),l=E.useCallback(p=>{const _=Array.isArray(p)?p:[p],{edges:m=[],setEdges:b,hasDefaultEdges:N,onEdgesChange:y}=e.getState();if(N)b([...m,..._]);else if(y){const M=_.map(C=>({item:C,type:"add"}));y(M)}},[]),u=E.useCallback(()=>{const{getNodes:p,edges:_=[],transform:m}=e.getState(),[b,N,y]=m;return{nodes:p().map(M=>({...M})),edges:_.map(M=>({...M})),viewport:{x:b,y:N,zoom:y}}},[]),f=E.useCallback(({nodes:p,edges:_})=>{const{nodeInternals:m,getNodes:b,edges:N,hasDefaultNodes:y,hasDefaultEdges:M,onNodesDelete:C,onEdgesDelete:z,onNodesChange:H,onEdgesChange:T}=e.getState(),L=(p||[]).map(S=>S.id),P=(_||[]).map(S=>S.id),B=b().reduce((S,v)=>{const $=v.parentNode||v.parentId,k=!L.includes(v.id)&&$&&S.find(A=>A.id===$);return(typeof v.deletable=="boolean"?v.deletable:!0)&&(L.includes(v.id)||k)&&S.push(v),S},[]),V=N.filter(S=>typeof S.deletable=="boolean"?S.deletable:!0),d=V.filter(S=>P.includes(S.id));if(B||d){const S=Fo(B,V),v=[...d,...S],$=v.reduce((k,w)=>(k.includes(w.id)||k.push(w.id),k),[]);if((M||y)&&(M&&e.setState({edges:N.filter(k=>!$.includes(k.id))}),y&&(B.forEach(k=>{m.delete(k.id)}),e.setState({nodeInternals:new Map(m)}))),$.length>0&&(z==null||z(v),T&&T($.map(k=>({id:k,type:"remove"})))),B.length>0&&(C==null||C(B),H)){const k=B.map(w=>({id:w.id,type:"remove"}));H(k)}}},[]),h=E.useCallback(p=>{const _=ju(p),m=_?null:e.getState().nodeInternals.get(p.id);return!_&&!m?[null,null,_]:[_?p:Ir(m),m,_]},[]),g=E.useCallback((p,_=!0,m)=>{const[b,N,y]=h(p);return b?(m||e.getState().getNodes()).filter(M=>{if(!y&&(M.id===N.id||!M.positionAbsolute))return!1;const C=Ir(M),z=In(C,b);return _&&z>0||z>=b.width*b.height}):[]},[]),x=E.useCallback((p,_,m=!0)=>{const[b]=h(p);if(!b)return!1;const N=In(b,_);return m&&N>0||N>=b.width*b.height},[]);return E.useMemo(()=>({...t,getNodes:n,getNode:r,getEdges:o,getEdge:s,setNodes:i,setEdges:c,addNodes:a,addEdges:l,toObject:u,deleteElements:f,getIntersectingNodes:g,isNodeIntersecting:x}),[t,n,r,o,s,i,c,a,l,u,f,g,x])}const zl={actInsideInputWithModifier:!1};var Dl=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=nt(),{deleteElements:r}=oi(),o=$e(t,zl),s=$e(e);E.useEffect(()=>{if(o){const{edges:i,getNodes:c}=n.getState(),a=c().filter(u=>u.selected),l=i.filter(u=>u.selected);r({nodes:a,edges:l}),n.setState({nodesSelectionActive:!1})}},[o]),E.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])};function Pl(t){const e=nt();E.useEffect(()=>{let n;const r=()=>{var s,i;if(!t.current)return;const o=Un(t.current);(o.height===0||o.width===0)&&((i=(s=e.getState()).onError)==null||i.call(s,"004",$t.error004())),e.setState({width:o.width||500,height:o.height||500})};return r(),window.addEventListener("resize",r),t.current&&(n=new ResizeObserver(()=>r()),n.observe(t.current)),()=>{window.removeEventListener("resize",r),n&&t.current&&n.unobserve(t.current)}},[])}const nr={position:"absolute",width:"100%",height:"100%",top:0,left:0},Hl=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,Be=t=>({x:t.x,y:t.y,zoom:t.k}),ee=(t,e)=>t.target.closest(`.${e}`),Or=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Xr=t=>{const e=t.ctrlKey&&Qe()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},Ll=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),Vl=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:o=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:c=.5,panOnScrollMode:a=Yt.Free,zoomOnDoubleClick:l=!0,elementsSelectable:u,panOnDrag:f=!0,defaultViewport:h,translateExtent:g,minZoom:x,maxZoom:p,zoomActivationKeyCode:_,preventScrolling:m=!0,children:b,noWheelClassName:N,noPanClassName:y})=>{const M=E.useRef(),C=nt(),z=E.useRef(!1),H=E.useRef(!1),T=E.useRef(null),L=E.useRef({x:0,y:0,zoom:0}),{d3Zoom:P,d3Selection:B,d3ZoomHandler:V,userSelectionActive:d}=tt(Ll,it),S=$e(_),v=E.useRef(0),$=E.useRef(!1),k=E.useRef();return Pl(T),E.useEffect(()=>{if(T.current){const w=T.current.getBoundingClientRect(),A=Yu().scaleExtent([x,p]).translateExtent(g),I=pt(T.current).call(A),D=Rt.translate(h.x,h.y).scale(le(h.zoom,x,p)),O=[[0,0],[w.width,w.height]],F=A.constrain()(D,O,g);A.transform(I,F),A.wheelDelta(Xr),C.setState({d3Zoom:A,d3Selection:I,d3ZoomHandler:I.on("wheel.zoom"),transform:[F.x,F.y,F.k],domNode:T.current.closest(".react-flow")})}},[]),E.useEffect(()=>{B&&P&&(i&&!S&&!d?B.on("wheel.zoom",w=>{if(ee(w,N))return!1;w.preventDefault(),w.stopImmediatePropagation();const A=B.property("__zoom").k||1;if(w.ctrlKey&&s){const G=vt(w),J=Xr(w),K=A*Math.pow(2,J);P.scaleTo(B,K,G,w);return}const I=w.deltaMode===1?20:1;let D=a===Yt.Vertical?0:w.deltaX*I,O=a===Yt.Horizontal?0:w.deltaY*I;!Qe()&&w.shiftKey&&a!==Yt.Vertical&&(D=w.deltaY*I,O=0),P.translateBy(B,-(D/A)*c,-(O/A)*c,{internal:!0});const F=Be(B.property("__zoom")),{onViewportChangeStart:q,onViewportChange:W,onViewportChangeEnd:Z}=C.getState();clearTimeout(k.current),$.current||($.current=!0,e==null||e(w,F),q==null||q(F)),$.current&&(t==null||t(w,F),W==null||W(F),k.current=setTimeout(()=>{n==null||n(w,F),Z==null||Z(F),$.current=!1},150))},{passive:!1}):typeof V<"u"&&B.on("wheel.zoom",function(w,A){if(!m&&w.type==="wheel"&&!w.ctrlKey||ee(w,N))return null;w.preventDefault(),V.call(this,w,A)},{passive:!1}))},[d,i,a,B,P,V,S,s,m,N,e,t,n]),E.useEffect(()=>{P&&P.on("start",w=>{var D,O;if(!w.sourceEvent||w.sourceEvent.internal)return null;v.current=(D=w.sourceEvent)==null?void 0:D.button;const{onViewportChangeStart:A}=C.getState(),I=Be(w.transform);z.current=!0,L.current=I,((O=w.sourceEvent)==null?void 0:O.type)==="mousedown"&&C.setState({paneDragging:!0}),A==null||A(I),e==null||e(w.sourceEvent,I)})},[P,e]),E.useEffect(()=>{P&&(d&&!z.current?P.on("zoom",null):d||P.on("zoom",w=>{var I;const{onViewportChange:A}=C.getState();if(C.setState({transform:[w.transform.x,w.transform.y,w.transform.k]}),H.current=!!(r&&Or(f,v.current??0)),(t||A)&&!((I=w.sourceEvent)!=null&&I.internal)){const D=Be(w.transform);A==null||A(D),t==null||t(w.sourceEvent,D)}}))},[d,P,t,f,r]),E.useEffect(()=>{P&&P.on("end",w=>{if(!w.sourceEvent||w.sourceEvent.internal)return null;const{onViewportChangeEnd:A}=C.getState();if(z.current=!1,C.setState({paneDragging:!1}),r&&Or(f,v.current??0)&&!H.current&&r(w.sourceEvent),H.current=!1,(n||A)&&Hl(L.current,w.transform)){const I=Be(w.transform);L.current=I,clearTimeout(M.current),M.current=setTimeout(()=>{A==null||A(I),n==null||n(w.sourceEvent,I)},i?150:0)}})},[P,i,f,n,r]),E.useEffect(()=>{P&&P.filter(w=>{const A=S||o,I=s&&w.ctrlKey;if((f===!0||Array.isArray(f)&&f.includes(1))&&w.button===1&&w.type==="mousedown"&&(ee(w,"react-flow__node")||ee(w,"react-flow__edge")))return!0;if(!f&&!A&&!i&&!l&&!s||d||!l&&w.type==="dblclick"||ee(w,N)&&w.type==="wheel"||ee(w,y)&&(w.type!=="wheel"||i&&w.type==="wheel"&&!S)||!s&&w.ctrlKey&&w.type==="wheel"||!A&&!i&&!I&&w.type==="wheel"||!f&&(w.type==="mousedown"||w.type==="touchstart")||Array.isArray(f)&&!f.includes(w.button)&&w.type==="mousedown")return!1;const D=Array.isArray(f)&&f.includes(w.button)||!w.button||w.button<=1;return(!w.ctrlKey||w.type==="wheel")&&D})},[d,P,o,s,i,l,f,u,S]),R.createElement("div",{className:"react-flow__renderer",ref:T,style:nr},b)},Bl=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function Fl(){const{userSelectionActive:t,userSelectionRect:e}=tt(Bl,it);return t&&e?R.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function Yr(t,e){const n=e.parentNode||e.parentId,r=t.find(o=>o.id===n);if(r){const o=e.position.x+e.width-r.width,s=e.position.y+e.height-r.height;if(o>0||s>0||e.position.x<0||e.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,o>0&&(r.style.width+=o),s>0&&(r.style.height+=s),e.position.x<0){const i=Math.abs(e.position.x);r.position.x=r.position.x-i,r.style.width+=i,e.position.x=0}if(e.position.y<0){const i=Math.abs(e.position.y);r.position.y=r.position.y-i,r.style.height+=i,e.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function ii(t,e){if(t.some(r=>r.type==="reset"))return t.filter(r=>r.type==="reset").map(r=>r.item);const n=t.filter(r=>r.type==="add").map(r=>r.item);return e.reduce((r,o)=>{const s=t.filter(c=>c.id===o.id);if(s.length===0)return r.push(o),r;const i={...o};for(const c of s)if(c)switch(c.type){case"select":{i.selected=c.selected;break}case"position":{typeof c.position<"u"&&(i.position=c.position),typeof c.positionAbsolute<"u"&&(i.positionAbsolute=c.positionAbsolute),typeof c.dragging<"u"&&(i.dragging=c.dragging),i.expandParent&&Yr(r,i);break}case"dimensions":{typeof c.dimensions<"u"&&(i.width=c.dimensions.width,i.height=c.dimensions.height),typeof c.updateStyle<"u"&&(i.style={...i.style||{},...c.dimensions}),typeof c.resizing=="boolean"&&(i.resizing=c.resizing),i.expandParent&&Yr(r,i);break}case"remove":return r}return r.push(i),r},n)}function si(t,e){return ii(t,e)}function Ol(t,e){return ii(t,e)}const kt=(t,e)=>({id:t,type:"select",selected:e});function re(t,e){return t.reduce((n,r)=>{const o=e.includes(r.id);return!r.selected&&o?(r.selected=!0,n.push(kt(r.id,!0))):r.selected&&!o&&(r.selected=!1,n.push(kt(r.id,!1))),n},[])}const _n=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},Xl=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),ci=E.memo(({isSelecting:t,selectionMode:e=Me.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:o,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:c,onPaneMouseEnter:a,onPaneMouseMove:l,onPaneMouseLeave:u,children:f})=>{const h=E.useRef(null),g=nt(),x=E.useRef(0),p=E.useRef(0),_=E.useRef(),{userSelectionActive:m,elementsSelectable:b,dragging:N}=tt(Xl,it),y=()=>{g.setState({userSelectionActive:!1,userSelectionRect:null}),x.current=0,p.current=0},M=V=>{s==null||s(V),g.getState().resetSelectedElements(),g.setState({nodesSelectionActive:!1})},C=V=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){V.preventDefault();return}i==null||i(V)},z=c?V=>c(V):void 0,H=V=>{const{resetSelectedElements:d,domNode:S}=g.getState();if(_.current=S==null?void 0:S.getBoundingClientRect(),!b||!t||V.button!==0||V.target!==h.current||!_.current)return;const{x:v,y:$}=zt(V,_.current);d(),g.setState({userSelectionRect:{width:0,height:0,startX:v,startY:$,x:v,y:$}}),r==null||r(V)},T=V=>{const{userSelectionRect:d,nodeInternals:S,edges:v,transform:$,onNodesChange:k,onEdgesChange:w,nodeOrigin:A,getNodes:I}=g.getState();if(!t||!_.current||!d)return;g.setState({userSelectionActive:!0,nodesSelectionActive:!1});const D=zt(V,_.current),O=d.startX??0,F=d.startY??0,q={...d,x:D.x<O?D.x:O,y:D.y<F?D.y:F,width:Math.abs(D.x-O),height:Math.abs(D.y-F)},W=I(),Z=Bo(S,q,$,e===Me.Partial,!0,A),G=Fo(Z,v).map(K=>K.id),J=Z.map(K=>K.id);if(x.current!==J.length){x.current=J.length;const K=re(W,J);K.length&&(k==null||k(K))}if(p.current!==G.length){p.current=G.length;const K=re(v,G);K.length&&(w==null||w(K))}g.setState({userSelectionRect:q})},L=V=>{if(V.button!==0)return;const{userSelectionRect:d}=g.getState();!m&&d&&V.target===h.current&&(M==null||M(V)),g.setState({nodesSelectionActive:x.current>0}),y(),o==null||o(V)},P=V=>{m&&(g.setState({nodesSelectionActive:x.current>0}),o==null||o(V)),y()},B=b&&(t||m);return R.createElement("div",{className:ft(["react-flow__pane",{dragging:N,selection:t}]),onClick:B?void 0:_n(M,h),onContextMenu:_n(C,h),onWheel:_n(z,h),onMouseEnter:B?void 0:a,onMouseDown:B?H:void 0,onMouseMove:B?T:l,onMouseUp:B?L:void 0,onMouseLeave:B?P:u,ref:h,style:nr},f,R.createElement(Fl,null))});ci.displayName="Pane";function ai(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const r=e.get(n);return r?r.selected?!0:ai(r,e):!1}function qr(t,e,n){let r=t;do{if(r!=null&&r.matches(e))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function Yl(t,e,n,r){return Array.from(t.values()).filter(o=>(o.selected||o.id===r)&&(!o.parentNode||o.parentId||!ai(o,t))&&(o.draggable||e&&typeof o.draggable>"u")).map(o=>{var s,i;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=o.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((i=o.positionAbsolute)==null?void 0:i.y)??0)},delta:{x:0,y:0},extent:o.extent,parentNode:o.parentNode||o.parentId,parentId:o.parentNode||o.parentId,width:o.width,height:o.height,expandParent:o.expandParent}})}function ql(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function ui(t,e,n,r,o=[0,0],s){const i=ql(t,t.extent||r);let c=i;const a=t.parentNode||t.parentId;if(t.extent==="parent"&&!t.expandParent)if(a&&t.width&&t.height){const f=n.get(a),{x:h,y:g}=se(f,o).positionAbsolute;c=f&<(h)&<(g)&<(f.width)&<(f.height)?[[h+t.width*o[0],g+t.height*o[1]],[h+f.width-t.width+t.width*o[0],g+f.height-t.height+t.height*o[1]]]:c}else s==null||s("005",$t.error005()),c=i;else if(t.extent&&a&&t.extent!=="parent"){const f=n.get(a),{x:h,y:g}=se(f,o).positionAbsolute;c=[[t.extent[0][0]+h,t.extent[0][1]+g],[t.extent[1][0]+h,t.extent[1][1]+g]]}let l={x:0,y:0};if(a){const f=n.get(a);l=se(f,o).positionAbsolute}const u=c&&c!=="parent"?Wn(e,c):e;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function bn({nodeId:t,dragItems:e,nodeInternals:n}){const r=e.map(o=>({...n.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[t?r.find(o=>o.id===t):r[0],r]}const Ur=(t,e,n,r)=>{const o=e.querySelectorAll(t);if(!o||!o.length)return null;const s=Array.from(o),i=e.getBoundingClientRect(),c={x:i.width*r[0],y:i.height*r[1]};return s.map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),position:a.getAttribute("data-handlepos"),x:(l.left-i.left-c.x)/n,y:(l.top-i.top-c.y)/n,...Un(a)}})};function xe(t,e,n){return n===void 0?n:r=>{const o=e().nodeInternals.get(t);o&&n(r,{...o})}}function Ln({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:s,multiSelectionActive:i,nodeInternals:c,onError:a}=e.getState(),l=c.get(t);if(!l){a==null||a("012",$t.error012(t));return}e.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&i)&&(s({nodes:[l],edges:[]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):o([t])}function Ul(){const t=nt();return E.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:o,snapToGrid:s}=t.getState(),i=n.touches?n.touches[0].clientX:n.clientX,c=n.touches?n.touches[0].clientY:n.clientY,a={x:(i-r[0])/r[2],y:(c-r[1])/r[2]};return{xSnapped:s?o[0]*Math.round(a.x/o[0]):a.x,ySnapped:s?o[1]*Math.round(a.y/o[1]):a.y,...a}},[])}function Sn(t){return(e,n,r)=>t==null?void 0:t(e,r)}function li({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:s,selectNodesOnDrag:i}){const c=nt(),[a,l]=E.useState(!1),u=E.useRef([]),f=E.useRef({x:null,y:null}),h=E.useRef(0),g=E.useRef(null),x=E.useRef({x:0,y:0}),p=E.useRef(null),_=E.useRef(!1),m=E.useRef(!1),b=E.useRef(!1),N=Ul();return E.useEffect(()=>{if(t!=null&&t.current){const y=pt(t.current),M=({x:H,y:T})=>{const{nodeInternals:L,onNodeDrag:P,onSelectionDrag:B,updateNodePositions:V,nodeExtent:d,snapGrid:S,snapToGrid:v,nodeOrigin:$,onError:k}=c.getState();f.current={x:H,y:T};let w=!1,A={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&d){const D=jn(u.current,$);A=Zn(D)}if(u.current=u.current.map(D=>{const O={x:H-D.distance.x,y:T-D.distance.y};v&&(O.x=S[0]*Math.round(O.x/S[0]),O.y=S[1]*Math.round(O.y/S[1]));const F=[[d[0][0],d[0][1]],[d[1][0],d[1][1]]];u.current.length>1&&d&&!D.extent&&(F[0][0]=D.positionAbsolute.x-A.x+d[0][0],F[1][0]=D.positionAbsolute.x+(D.width??0)-A.x2+d[1][0],F[0][1]=D.positionAbsolute.y-A.y+d[0][1],F[1][1]=D.positionAbsolute.y+(D.height??0)-A.y2+d[1][1]);const q=ui(D,O,L,F,$,k);return w=w||D.position.x!==q.position.x||D.position.y!==q.position.y,D.position=q.position,D.positionAbsolute=q.positionAbsolute,D}),!w)return;V(u.current,!0,!0),l(!0);const I=o?P:Sn(B);if(I&&p.current){const[D,O]=bn({nodeId:o,dragItems:u.current,nodeInternals:L});I(p.current,D,O)}},C=()=>{if(!g.current)return;const[H,T]=ko(x.current,g.current);if(H!==0||T!==0){const{transform:L,panBy:P}=c.getState();f.current.x=(f.current.x??0)-H/L[2],f.current.y=(f.current.y??0)-T/L[2],P({x:H,y:T})&&M(f.current)}h.current=requestAnimationFrame(C)},z=H=>{var $;const{nodeInternals:T,multiSelectionActive:L,nodesDraggable:P,unselectNodesAndEdges:B,onNodeDragStart:V,onSelectionDragStart:d}=c.getState();m.current=!0;const S=o?V:Sn(d);(!i||!s)&&!L&&o&&(($=T.get(o))!=null&&$.selected||B()),o&&s&&i&&Ln({id:o,store:c,nodeRef:t});const v=N(H);if(f.current=v,u.current=Yl(T,P,v,o),S&&u.current){const[k,w]=bn({nodeId:o,dragItems:u.current,nodeInternals:T});S(H.sourceEvent,k,w)}};if(e)y.on(".drag",null);else{const H=ta().on("start",T=>{const{domNode:L,nodeDragThreshold:P}=c.getState();P===0&&z(T),b.current=!1;const B=N(T);f.current=B,g.current=(L==null?void 0:L.getBoundingClientRect())||null,x.current=zt(T.sourceEvent,g.current)}).on("drag",T=>{var V,d;const L=N(T),{autoPanOnNodeDrag:P,nodeDragThreshold:B}=c.getState();if(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1&&(b.current=!0),!b.current){if(!_.current&&m.current&&P&&(_.current=!0,C()),!m.current){const S=L.xSnapped-(((V=f==null?void 0:f.current)==null?void 0:V.x)??0),v=L.ySnapped-(((d=f==null?void 0:f.current)==null?void 0:d.y)??0);Math.sqrt(S*S+v*v)>B&&z(T)}(f.current.x!==L.xSnapped||f.current.y!==L.ySnapped)&&u.current&&m.current&&(p.current=T.sourceEvent,x.current=zt(T.sourceEvent,g.current),M(L))}}).on("end",T=>{if(!(!m.current||b.current)&&(l(!1),_.current=!1,m.current=!1,cancelAnimationFrame(h.current),u.current)){const{updateNodePositions:L,nodeInternals:P,onNodeDragStop:B,onSelectionDragStop:V}=c.getState(),d=o?B:Sn(V);if(L(u.current,!1,!1),d){const[S,v]=bn({nodeId:o,dragItems:u.current,nodeInternals:P});d(T.sourceEvent,S,v)}}}).filter(T=>{const L=T.target;return!T.button&&(!n||!qr(L,`.${n}`,t))&&(!r||qr(L,r,t))});return y.call(H),()=>{y.on(".drag",null)}}}},[t,e,n,r,s,c,o,i,N]),a}function fi(){const t=nt();return E.useCallback(n=>{const{nodeInternals:r,nodeExtent:o,updateNodePositions:s,getNodes:i,snapToGrid:c,snapGrid:a,onError:l,nodesDraggable:u}=t.getState(),f=i().filter(b=>b.selected&&(b.draggable||u&&typeof b.draggable>"u")),h=c?a[0]:5,g=c?a[1]:5,x=n.isShiftPressed?4:1,p=n.x*h*x,_=n.y*g*x,m=f.map(b=>{if(b.positionAbsolute){const N={x:b.positionAbsolute.x+p,y:b.positionAbsolute.y+_};c&&(N.x=a[0]*Math.round(N.x/a[0]),N.y=a[1]*Math.round(N.y/a[1]));const{positionAbsolute:y,position:M}=ui(b,N,r,o,void 0,l);b.position=M,b.positionAbsolute=y}return b});s(m,!0,!1)},[])}const ce={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var we=t=>{const e=({id:n,type:r,data:o,xPos:s,yPos:i,xPosOrigin:c,yPosOrigin:a,selected:l,onClick:u,onMouseEnter:f,onMouseMove:h,onMouseLeave:g,onContextMenu:x,onDoubleClick:p,style:_,className:m,isDraggable:b,isSelectable:N,isConnectable:y,isFocusable:M,selectNodesOnDrag:C,sourcePosition:z,targetPosition:H,hidden:T,resizeObserver:L,dragHandle:P,zIndex:B,isParent:V,noDragClassName:d,noPanClassName:S,initialized:v,disableKeyboardA11y:$,ariaLabel:k,rfId:w,hasHandleBounds:A})=>{const I=nt(),D=E.useRef(null),O=E.useRef(null),F=E.useRef(z),q=E.useRef(H),W=E.useRef(r),Z=N||b||u||f||h||g,G=fi(),J=xe(n,I.getState,f),K=xe(n,I.getState,h),dt=xe(n,I.getState,g),at=xe(n,I.getState,x),ht=xe(n,I.getState,p),ut=Q=>{const{nodeDragThreshold:Y}=I.getState();if(N&&(!C||!b||Y>0)&&Ln({id:n,store:I,nodeRef:D}),u){const st=I.getState().nodeInternals.get(n);st&&u(Q,{...st})}},et=Q=>{if(!Rn(Q)&&!$)if(Ro.includes(Q.key)&&N){const Y=Q.key==="Escape";Ln({id:n,store:I,unselect:Y,nodeRef:D})}else b&&l&&Object.prototype.hasOwnProperty.call(ce,Q.key)&&(I.setState({ariaLiveMessage:`Moved selected node ${Q.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),G({x:ce[Q.key].x,y:ce[Q.key].y,isShiftPressed:Q.shiftKey}))};E.useEffect(()=>()=>{O.current&&(L==null||L.unobserve(O.current),O.current=null)},[]),E.useEffect(()=>{if(D.current&&!T){const Q=D.current;(!v||!A||O.current!==Q)&&(O.current&&(L==null||L.unobserve(O.current)),L==null||L.observe(Q),O.current=Q)}},[T,v,A]),E.useEffect(()=>{const Q=W.current!==r,Y=F.current!==z,st=q.current!==H;D.current&&(Q||Y||st)&&(Q&&(W.current=r),Y&&(F.current=z),st&&(q.current=H),I.getState().updateNodeDimensions([{id:n,nodeElement:D.current,forceUpdate:!0}]))},[n,r,z,H]);const xt=li({nodeRef:D,disabled:T||!b,noDragClassName:d,handleSelector:P,nodeId:n,isSelectable:N,selectNodesOnDrag:C});return T?null:R.createElement("div",{className:ft(["react-flow__node",`react-flow__node-${r}`,{[S]:b},m,{selected:l,selectable:N,parent:V,dragging:xt}]),ref:D,style:{zIndex:B,transform:`translate(${c}px,${a}px)`,pointerEvents:Z?"all":"none",visibility:v?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:J,onMouseMove:K,onMouseLeave:dt,onContextMenu:at,onClick:ut,onDoubleClick:ht,onKeyDown:M?et:void 0,tabIndex:M?0:void 0,role:M?"button":void 0,"aria-describedby":$?void 0:`${jo}-${w}`,"aria-label":k},R.createElement(sl,{value:n},R.createElement(t,{id:n,data:o,type:r,xPos:s,yPos:i,selected:l,isConnectable:y,sourcePosition:z,targetPosition:H,dragging:xt,dragHandle:P,zIndex:B})))};return e.displayName="NodeWrapper",E.memo(e)};const Wl=t=>{const e=t.getNodes().filter(n=>n.selected);return{...jn(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function Zl({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=nt(),{width:o,height:s,x:i,y:c,transformString:a,userSelectionActive:l}=tt(Wl,it),u=fi(),f=E.useRef(null);if(E.useEffect(()=>{var x;n||(x=f.current)==null||x.focus({preventScroll:!0})},[n]),li({nodeRef:f}),l||!o||!s)return null;const h=t?x=>{const p=r.getState().getNodes().filter(_=>_.selected);t(x,p)}:void 0,g=x=>{Object.prototype.hasOwnProperty.call(ce,x.key)&&u({x:ce[x.key].x,y:ce[x.key].y,isShiftPressed:x.shiftKey})};return R.createElement("div",{className:ft(["react-flow__nodesselection","react-flow__container",e]),style:{transform:a}},R.createElement("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:o,height:s,top:c,left:i}}))}var Gl=E.memo(Zl);const Kl=t=>t.nodesSelectionActive,di=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:c,onMove:a,onMoveStart:l,onMoveEnd:u,selectionKeyCode:f,selectionOnDrag:h,selectionMode:g,onSelectionStart:x,onSelectionEnd:p,multiSelectionKeyCode:_,panActivationKeyCode:m,zoomActivationKeyCode:b,elementsSelectable:N,zoomOnScroll:y,zoomOnPinch:M,panOnScroll:C,panOnScrollSpeed:z,panOnScrollMode:H,zoomOnDoubleClick:T,panOnDrag:L,defaultViewport:P,translateExtent:B,minZoom:V,maxZoom:d,preventScrolling:S,onSelectionContextMenu:v,noWheelClassName:$,noPanClassName:k,disableKeyboardA11y:w})=>{const A=tt(Kl),I=$e(f),D=$e(m),O=D||L,F=D||C,q=I||h&&O!==!0;return Dl({deleteKeyCode:c,multiSelectionKeyCode:_}),R.createElement(Vl,{onMove:a,onMoveStart:l,onMoveEnd:u,onPaneContextMenu:s,elementsSelectable:N,zoomOnScroll:y,zoomOnPinch:M,panOnScroll:F,panOnScrollSpeed:z,panOnScrollMode:H,zoomOnDoubleClick:T,panOnDrag:!I&&O,defaultViewport:P,translateExtent:B,minZoom:V,maxZoom:d,zoomActivationKeyCode:b,preventScrolling:S,noWheelClassName:$,noPanClassName:k},R.createElement(ci,{onSelectionStart:x,onSelectionEnd:p,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:O,isSelecting:!!q,selectionMode:g},t,A&&R.createElement(Gl,{onSelectionContextMenu:v,noPanClassName:k,disableKeyboardA11y:w})))};di.displayName="FlowRenderer";var Ql=E.memo(di);function Jl(t){return tt(E.useCallback(n=>t?Bo(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function jl(t){const e={input:we(t.input||Go),default:we(t.default||Hn),output:we(t.output||Qo),group:we(t.group||er)},n={},r=Object.keys(t).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,s)=>(o[s]=we(t[s]||Hn),o),n);return{...e,...r}}const tf=({x:t,y:e,width:n,height:r,origin:o})=>!n||!r?{x:t,y:e}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:t,y:e}:{x:t-n*o[0],y:e-r*o[1]},ef=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),hi=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,updateNodeDimensions:s,onError:i}=tt(ef,it),c=Jl(t.onlyRenderVisibleElements),a=E.useRef(),l=E.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const u=new ResizeObserver(f=>{const h=f.map(g=>({id:g.target.getAttribute("data-id"),nodeElement:g.target,forceUpdate:!0}));s(h)});return a.current=u,u},[]);return E.useEffect(()=>()=>{var u;(u=a==null?void 0:a.current)==null||u.disconnect()},[]),R.createElement("div",{className:"react-flow__nodes",style:nr},c.map(u=>{var M,C,z;let f=u.type||"default";t.nodeTypes[f]||(i==null||i("003",$t.error003(f)),f="default");const h=t.nodeTypes[f]||t.nodeTypes.default,g=!!(u.draggable||e&&typeof u.draggable>"u"),x=!!(u.selectable||o&&typeof u.selectable>"u"),p=!!(u.connectable||n&&typeof u.connectable>"u"),_=!!(u.focusable||r&&typeof u.focusable>"u"),m=t.nodeExtent?Wn(u.positionAbsolute,t.nodeExtent):u.positionAbsolute,b=(m==null?void 0:m.x)??0,N=(m==null?void 0:m.y)??0,y=tf({x:b,y:N,width:u.width??0,height:u.height??0,origin:t.nodeOrigin});return R.createElement(h,{key:u.id,id:u.id,className:u.className,style:u.style,type:f,data:u.data,sourcePosition:u.sourcePosition||X.Bottom,targetPosition:u.targetPosition||X.Top,hidden:u.hidden,xPos:b,yPos:N,xPosOrigin:y.x,yPosOrigin:y.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!u.selected,isDraggable:g,isSelectable:x,isConnectable:p,isFocusable:_,resizeObserver:l,dragHandle:u.dragHandle,zIndex:((M=u[j])==null?void 0:M.z)??0,isParent:!!((C=u[j])!=null&&C.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!u.width&&!!u.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:u.ariaLabel,hasHandleBounds:!!((z=u[j])!=null&&z.handleBounds)})}))};hi.displayName="NodeRenderer";var nf=E.memo(hi);const rf=(t,e,n)=>n===X.Left?t-e:n===X.Right?t+e:t,of=(t,e,n)=>n===X.Top?t-e:n===X.Bottom?t+e:t,Wr="react-flow__edgeupdater",Zr=({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:s,onMouseOut:i,type:c})=>R.createElement("circle",{onMouseDown:o,onMouseEnter:s,onMouseOut:i,className:ft([Wr,`${Wr}-${c}`]),cx:rf(e,r,t),cy:of(n,r,t),r,stroke:"transparent",fill:"transparent"}),sf=()=>!0;var ne=t=>{const e=({id:n,className:r,type:o,data:s,onClick:i,onEdgeDoubleClick:c,selected:a,animated:l,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:p,style:_,source:m,target:b,sourceX:N,sourceY:y,targetX:M,targetY:C,sourcePosition:z,targetPosition:H,elementsSelectable:T,hidden:L,sourceHandleId:P,targetHandleId:B,onContextMenu:V,onMouseEnter:d,onMouseMove:S,onMouseLeave:v,reconnectRadius:$,onReconnect:k,onReconnectStart:w,onReconnectEnd:A,markerEnd:I,markerStart:D,rfId:O,ariaLabel:F,isFocusable:q,isReconnectable:W,pathOptions:Z,interactionWidth:G,disableKeyboardA11y:J})=>{const K=E.useRef(null),[dt,at]=E.useState(!1),[ht,ut]=E.useState(!1),et=nt(),xt=E.useMemo(()=>`url('#${Dn(D,O)}')`,[D,O]),Q=E.useMemo(()=>`url('#${Dn(I,O)}')`,[I,O]);if(L)return null;const Y=rt=>{var wt;const{edges:gt,addSelectedEdges:Lt,unselectNodesAndEdges:Vt,multiSelectionActive:Bt}=et.getState(),Et=gt.find(he=>he.id===n);Et&&(T&&(et.setState({nodesSelectionActive:!1}),Et.selected&&Bt?(Vt({nodes:[],edges:[Et]}),(wt=K.current)==null||wt.blur()):Lt([n])),i&&i(rt,Et))},st=ye(n,et.getState,c),Dt=ye(n,et.getState,V),fe=ye(n,et.getState,d),Zt=ye(n,et.getState,S),Gt=ye(n,et.getState,v),St=(rt,gt)=>{if(rt.button!==0)return;const{edges:Lt,isValidConnection:Vt}=et.getState(),Bt=gt?b:m,Et=(gt?B:P)||null,wt=gt?"target":"source",he=Vt||sf,an=gt,ge=Lt.find(Ft=>Ft.id===n);ut(!0),w==null||w(rt,ge,wt);const un=Ft=>{ut(!1),A==null||A(Ft,ge,wt)};qo({event:rt,handleId:Et,nodeId:Bt,onConnect:Ft=>k==null?void 0:k(ge,Ft),isTarget:an,getState:et.getState,setState:et.setState,isValidConnection:he,edgeUpdaterType:wt,onReconnectEnd:un})},Kt=rt=>St(rt,!0),Pt=rt=>St(rt,!1),Ht=()=>at(!0),Qt=()=>at(!1),Jt=!T&&!i,de=rt=>{var gt;if(!J&&Ro.includes(rt.key)&&T){const{unselectNodesAndEdges:Lt,addSelectedEdges:Vt,edges:Bt}=et.getState();rt.key==="Escape"?((gt=K.current)==null||gt.blur(),Lt({edges:[Bt.find(wt=>wt.id===n)]})):Vt([n])}};return R.createElement("g",{className:ft(["react-flow__edge",`react-flow__edge-${o}`,r,{selected:a,animated:l,inactive:Jt,updating:dt}]),onClick:Y,onDoubleClick:st,onContextMenu:Dt,onMouseEnter:fe,onMouseMove:Zt,onMouseLeave:Gt,onKeyDown:q?de:void 0,tabIndex:q?0:void 0,role:q?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":F===null?void 0:F||`Edge from ${m} to ${b}`,"aria-describedby":q?`${ti}-${O}`:void 0,ref:K},!ht&&R.createElement(t,{id:n,source:m,target:b,selected:a,animated:l,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:p,data:s,style:_,sourceX:N,sourceY:y,targetX:M,targetY:C,sourcePosition:z,targetPosition:H,sourceHandleId:P,targetHandleId:B,markerStart:xt,markerEnd:Q,pathOptions:Z,interactionWidth:G}),W&&R.createElement(R.Fragment,null,(W==="source"||W===!0)&&R.createElement(Zr,{position:z,centerX:N,centerY:y,radius:$,onMouseDown:Kt,onMouseEnter:Ht,onMouseOut:Qt,type:"source"}),(W==="target"||W===!0)&&R.createElement(Zr,{position:H,centerX:M,centerY:C,radius:$,onMouseDown:Pt,onMouseEnter:Ht,onMouseOut:Qt,type:"target"})))};return e.displayName="EdgeWrapper",E.memo(e)};function cf(t){const e={default:ne(t.default||je),straight:ne(t.bezier||Qn),step:ne(t.step||Kn),smoothstep:ne(t.step||cn),simplebezier:ne(t.simplebezier||Gn)},n={},r=Object.keys(t).filter(o=>!["default","bezier"].includes(o)).reduce((o,s)=>(o[s]=ne(t[s]||je),o),n);return{...e,...r}}function Gr(t,e,n=null){const r=((n==null?void 0:n.x)||0)+e.x,o=((n==null?void 0:n.y)||0)+e.y,s=(n==null?void 0:n.width)||e.width,i=(n==null?void 0:n.height)||e.height;switch(t){case X.Top:return{x:r+s/2,y:o};case X.Right:return{x:r+s,y:o+i/2};case X.Bottom:return{x:r+s/2,y:o+i};case X.Left:return{x:r,y:o+i/2}}}function Kr(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const af=(t,e,n,r,o,s)=>{const i=Gr(n,t,e),c=Gr(s,r,o);return{sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}};function uf({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:r,targetWidth:o,targetHeight:s,width:i,height:c,transform:a}){const l={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+o),y2:Math.max(t.y+r,e.y+s)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const u=Zn({x:(0-a[0])/a[2],y:(0-a[1])/a[2],width:i/a[2],height:c/a[2]}),f=Math.max(0,Math.min(u.x2,l.x2)-Math.max(u.x,l.x)),h=Math.max(0,Math.min(u.y2,l.y2)-Math.max(u.y,l.y));return Math.ceil(f*h)>0}function Qr(t){var r,o,s,i,c;const e=((r=t==null?void 0:t[j])==null?void 0:r.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&typeof((o=t==null?void 0:t.positionAbsolute)==null?void 0:o.x)<"u"&&typeof((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)<"u";return[{x:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.x)||0,y:((c=t==null?void 0:t.positionAbsolute)==null?void 0:c.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const lf=[{level:0,isMaxLevel:!0,edges:[]}];function ff(t,e,n=!1){let r=-1;const o=t.reduce((i,c)=>{var u,f;const a=lt(c.zIndex);let l=a?c.zIndex:0;if(n){const h=e.get(c.target),g=e.get(c.source),x=c.selected||(h==null?void 0:h.selected)||(g==null?void 0:g.selected),p=Math.max(((u=g==null?void 0:g[j])==null?void 0:u.z)||0,((f=h==null?void 0:h[j])==null?void 0:f.z)||0,1e3);l=(a?c.zIndex:0)+(x?p:0)}return i[l]?i[l].push(c):i[l]=[c],r=l>r?l:r,i},{}),s=Object.entries(o).map(([i,c])=>{const a=+i;return{edges:c,level:a,isMaxLevel:a===r}});return s.length===0?lf:s}function df(t,e,n){const r=tt(E.useCallback(o=>t?o.edges.filter(s=>{const i=e.get(s.source),c=e.get(s.target);return(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&uf({sourcePos:i.positionAbsolute||{x:0,y:0},targetPos:c.positionAbsolute||{x:0,y:0},sourceWidth:i.width,sourceHeight:i.height,targetWidth:c.width,targetHeight:c.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[t,e]));return ff(r,e,n)}const hf=({color:t="none",strokeWidth:e=1})=>R.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),gf=({color:t="none",strokeWidth:e=1})=>R.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Jr={[Je.Arrow]:hf,[Je.ArrowClosed]:gf};function pf(t){const e=nt();return E.useMemo(()=>{var o,s;return Object.prototype.hasOwnProperty.call(Jr,t)?Jr[t]:((s=(o=e.getState()).onError)==null||s.call(o,"009",$t.error009(t)),null)},[t])}const mf=({id:t,type:e,color:n,width:r=12.5,height:o=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:c="auto-start-reverse"})=>{const a=pf(e);return a?R.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0"},R.createElement(a,{color:n,strokeWidth:i})):null},yf=({defaultColor:t,rfId:e})=>n=>{const r=[];return n.edges.reduce((o,s)=>([s.markerStart,s.markerEnd].forEach(i=>{if(i&&typeof i=="object"){const c=Dn(i,e);r.includes(c)||(o.push({id:c,color:i.color||t,...i}),r.push(c))}}),o),[]).sort((o,s)=>o.id.localeCompare(s.id))},gi=({defaultColor:t,rfId:e})=>{const n=tt(E.useCallback(yf({defaultColor:t,rfId:e}),[t,e]),(r,o)=>!(r.length!==o.length||r.some((s,i)=>s.id!==o[i].id)));return R.createElement("defs",null,n.map(r=>R.createElement(mf,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};gi.displayName="MarkerDefinitions";var xf=E.memo(gi);const wf=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),pi=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:r,edgeTypes:o,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:c,onEdgeMouseMove:a,onEdgeMouseLeave:l,onEdgeClick:u,onEdgeDoubleClick:f,onReconnect:h,onReconnectStart:g,onReconnectEnd:x,reconnectRadius:p,children:_,disableKeyboardA11y:m})=>{const{edgesFocusable:b,edgesUpdatable:N,elementsSelectable:y,width:M,height:C,connectionMode:z,nodeInternals:H,onError:T}=tt(wf,it),L=df(e,H,n);return M?R.createElement(R.Fragment,null,L.map(({level:P,edges:B,isMaxLevel:V})=>R.createElement("svg",{key:P,style:{zIndex:P},width:M,height:C,className:"react-flow__edges react-flow__container"},V&&R.createElement(xf,{defaultColor:t,rfId:r}),R.createElement("g",null,B.map(d=>{const[S,v,$]=Qr(H.get(d.source)),[k,w,A]=Qr(H.get(d.target));if(!$||!A)return null;let I=d.type||"default";o[I]||(T==null||T("011",$t.error011(I)),I="default");const D=o[I]||o.default,O=z===Wt.Strict?w.target:(w.target??[]).concat(w.source??[]),F=Kr(v.source,d.sourceHandle),q=Kr(O,d.targetHandle),W=(F==null?void 0:F.position)||X.Bottom,Z=(q==null?void 0:q.position)||X.Top,G=!!(d.focusable||b&&typeof d.focusable>"u"),J=d.reconnectable||d.updatable,K=typeof h<"u"&&(J||N&&typeof J>"u");if(!F||!q)return T==null||T("008",$t.error008(F,d)),null;const{sourceX:dt,sourceY:at,targetX:ht,targetY:ut}=af(S,F,W,k,q,Z);return R.createElement(D,{key:d.id,id:d.id,className:ft([d.className,s]),type:I,data:d.data,selected:!!d.selected,animated:!!d.animated,hidden:!!d.hidden,label:d.label,labelStyle:d.labelStyle,labelShowBg:d.labelShowBg,labelBgStyle:d.labelBgStyle,labelBgPadding:d.labelBgPadding,labelBgBorderRadius:d.labelBgBorderRadius,style:d.style,source:d.source,target:d.target,sourceHandleId:d.sourceHandle,targetHandleId:d.targetHandle,markerEnd:d.markerEnd,markerStart:d.markerStart,sourceX:dt,sourceY:at,targetX:ht,targetY:ut,sourcePosition:W,targetPosition:Z,elementsSelectable:y,onContextMenu:i,onMouseEnter:c,onMouseMove:a,onMouseLeave:l,onClick:u,onEdgeDoubleClick:f,onReconnect:h,onReconnectStart:g,onReconnectEnd:x,reconnectRadius:p,rfId:r,ariaLabel:d.ariaLabel,isFocusable:G,isReconnectable:K,pathOptions:"pathOptions"in d?d.pathOptions:void 0,interactionWidth:d.interactionWidth,disableKeyboardA11y:m})})))),_):null};pi.displayName="EdgeRenderer";var vf=E.memo(pi);const _f=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function bf({children:t}){const e=tt(_f);return R.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function Sf(t){const e=oi(),n=E.useRef(!1);E.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const Ef={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top},mi=({nodeId:t,handleType:e,style:n,type:r=It.Bezier,CustomComponent:o,connectionStatus:s})=>{var C,z,H;const{fromNode:i,handleId:c,toX:a,toY:l,connectionMode:u}=tt(E.useCallback(T=>({fromNode:T.nodeInternals.get(t),handleId:T.connectionHandleId,toX:(T.connectionPosition.x-T.transform[0])/T.transform[2],toY:(T.connectionPosition.y-T.transform[1])/T.transform[2],connectionMode:T.connectionMode}),[t]),it),f=(C=i==null?void 0:i[j])==null?void 0:C.handleBounds;let h=f==null?void 0:f[e];if(u===Wt.Loose&&(h=h||(f==null?void 0:f[e==="source"?"target":"source"])),!i||!h)return null;const g=c?h.find(T=>T.id===c):h[0],x=g?g.x+g.width/2:(i.width??0)/2,p=g?g.y+g.height/2:i.height??0,_=(((z=i.positionAbsolute)==null?void 0:z.x)??0)+x,m=(((H=i.positionAbsolute)==null?void 0:H.y)??0)+p,b=g==null?void 0:g.position,N=b?Ef[b]:null;if(!b||!N)return null;if(o)return R.createElement(o,{connectionLineType:r,connectionLineStyle:n,fromNode:i,fromHandle:g,fromX:_,fromY:m,toX:a,toY:l,fromPosition:b,toPosition:N,connectionStatus:s});let y="";const M={sourceX:_,sourceY:m,sourcePosition:b,targetX:a,targetY:l,targetPosition:N};return r===It.Bezier?[y]=Lo(M):r===It.Step?[y]=zn({...M,borderRadius:0}):r===It.SmoothStep?[y]=zn(M):r===It.SimpleBezier?[y]=Ho(M):y=`M${_},${m} ${a},${l}`,R.createElement("path",{d:y,fill:"none",className:"react-flow__connection-path",style:n})};mi.displayName="ConnectionLine";const Nf=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function Af({containerStyle:t,style:e,type:n,component:r}){const{nodeId:o,handleType:s,nodesConnectable:i,width:c,height:a,connectionStatus:l}=tt(Nf,it);return!(o&&s&&c&&i)?null:R.createElement("svg",{style:t,width:c,height:a,className:"react-flow__edges react-flow__connectionline react-flow__container"},R.createElement("g",{className:ft(["react-flow__connection",l])},R.createElement(mi,{nodeId:o,handleType:s,style:e,type:n,CustomComponent:r,connectionStatus:l})))}function jr(t,e){return E.useRef(null),nt(),E.useMemo(()=>e(t),[t])}const yi=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:r,onMoveEnd:o,onInit:s,onNodeClick:i,onEdgeClick:c,onNodeDoubleClick:a,onEdgeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:f,onNodeMouseLeave:h,onNodeContextMenu:g,onSelectionContextMenu:x,onSelectionStart:p,onSelectionEnd:_,connectionLineType:m,connectionLineStyle:b,connectionLineComponent:N,connectionLineContainerStyle:y,selectionKeyCode:M,selectionOnDrag:C,selectionMode:z,multiSelectionKeyCode:H,panActivationKeyCode:T,zoomActivationKeyCode:L,deleteKeyCode:P,onlyRenderVisibleElements:B,elementsSelectable:V,selectNodesOnDrag:d,defaultViewport:S,translateExtent:v,minZoom:$,maxZoom:k,preventScrolling:w,defaultMarkerColor:A,zoomOnScroll:I,zoomOnPinch:D,panOnScroll:O,panOnScrollSpeed:F,panOnScrollMode:q,zoomOnDoubleClick:W,panOnDrag:Z,onPaneClick:G,onPaneMouseEnter:J,onPaneMouseMove:K,onPaneMouseLeave:dt,onPaneScroll:at,onPaneContextMenu:ht,onEdgeContextMenu:ut,onEdgeMouseEnter:et,onEdgeMouseMove:xt,onEdgeMouseLeave:Q,onReconnect:Y,onReconnectStart:st,onReconnectEnd:Dt,reconnectRadius:fe,noDragClassName:Zt,noWheelClassName:Gt,noPanClassName:St,elevateEdgesOnSelect:Kt,disableKeyboardA11y:Pt,nodeOrigin:Ht,nodeExtent:Qt,rfId:Jt})=>{const de=jr(t,jl),rt=jr(e,cf);return Sf(s),R.createElement(Ql,{onPaneClick:G,onPaneMouseEnter:J,onPaneMouseMove:K,onPaneMouseLeave:dt,onPaneContextMenu:ht,onPaneScroll:at,deleteKeyCode:P,selectionKeyCode:M,selectionOnDrag:C,selectionMode:z,onSelectionStart:p,onSelectionEnd:_,multiSelectionKeyCode:H,panActivationKeyCode:T,zoomActivationKeyCode:L,elementsSelectable:V,onMove:n,onMoveStart:r,onMoveEnd:o,zoomOnScroll:I,zoomOnPinch:D,zoomOnDoubleClick:W,panOnScroll:O,panOnScrollSpeed:F,panOnScrollMode:q,panOnDrag:Z,defaultViewport:S,translateExtent:v,minZoom:$,maxZoom:k,onSelectionContextMenu:x,preventScrolling:w,noDragClassName:Zt,noWheelClassName:Gt,noPanClassName:St,disableKeyboardA11y:Pt},R.createElement(bf,null,R.createElement(vf,{edgeTypes:rt,onEdgeClick:c,onEdgeDoubleClick:l,onlyRenderVisibleElements:B,onEdgeContextMenu:ut,onEdgeMouseEnter:et,onEdgeMouseMove:xt,onEdgeMouseLeave:Q,onReconnect:Y,onReconnectStart:st,onReconnectEnd:Dt,reconnectRadius:fe,defaultMarkerColor:A,noPanClassName:St,elevateEdgesOnSelect:!!Kt,disableKeyboardA11y:Pt,rfId:Jt},R.createElement(Af,{style:b,type:m,component:N,containerStyle:y})),R.createElement("div",{className:"react-flow__edgelabel-renderer"}),R.createElement(nf,{nodeTypes:de,onNodeClick:i,onNodeDoubleClick:a,onNodeMouseEnter:u,onNodeMouseMove:f,onNodeMouseLeave:h,onNodeContextMenu:g,selectNodesOnDrag:d,onlyRenderVisibleElements:B,noPanClassName:St,noDragClassName:Zt,disableKeyboardA11y:Pt,nodeOrigin:Ht,nodeExtent:Qt,rfId:Jt})))};yi.displayName="GraphView";var Mf=E.memo(yi);const Vn=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Tt={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Vn,nodeExtent:Vn,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Wt.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:tl,isValidConnection:void 0},$f=()=>ds((t,e)=>({...Tt,setNodes:n=>{const{nodeInternals:r,nodeOrigin:o,elevateNodesOnSelect:s}=e();t({nodeInternals:vn(n,r,o,s)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=e();t({edges:n.map(o=>({...r,...o}))})},setDefaultNodesAndEdges:(n,r)=>{const o=typeof n<"u",s=typeof r<"u",i=o?vn(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:i,edges:s?r:[],hasDefaultNodes:o,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:o,fitViewOnInit:s,fitViewOnInitDone:i,fitViewOnInitOptions:c,domNode:a,nodeOrigin:l}=e(),u=a==null?void 0:a.querySelector(".react-flow__viewport");if(!u)return;const f=window.getComputedStyle(u),{m22:h}=new window.DOMMatrixReadOnly(f.transform),g=n.reduce((p,_)=>{const m=o.get(_.id);if(m!=null&&m.hidden)o.set(m.id,{...m,[j]:{...m[j],handleBounds:void 0}});else if(m){const b=Un(_.nodeElement);!!(b.width&&b.height&&(m.width!==b.width||m.height!==b.height||_.forceUpdate))&&(o.set(m.id,{...m,[j]:{...m[j],handleBounds:{source:Ur(".source",_.nodeElement,h,l),target:Ur(".target",_.nodeElement,h,l)}},...b}),p.push({id:m.id,type:"dimensions",dimensions:b}))}return p},[]);ni(o,l);const x=i||s&&!i&&ri(e,{initial:!0,...c});t({nodeInternals:new Map(o),fitViewOnInitDone:x}),(g==null?void 0:g.length)>0&&(r==null||r(g))},updateNodePositions:(n,r=!0,o=!1)=>{const{triggerNodeChanges:s}=e(),i=n.map(c=>{const a={id:c.id,type:"position",dragging:o};return r&&(a.positionAbsolute=c.positionAbsolute,a.position=c.position),a});s(i)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:o,hasDefaultNodes:s,nodeOrigin:i,getNodes:c,elevateNodesOnSelect:a}=e();if(n!=null&&n.length){if(s){const l=si(n,c()),u=vn(l,o,i,a);t({nodeInternals:u})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:o,getNodes:s}=e();let i,c=null;r?i=n.map(a=>kt(a,!0)):(i=re(s(),n),c=re(o,[])),Ve({changedNodes:i,changedEdges:c,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:o,getNodes:s}=e();let i,c=null;r?i=n.map(a=>kt(a,!0)):(i=re(o,n),c=re(s(),[])),Ve({changedNodes:c,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:o,getNodes:s}=e(),i=n||s(),c=r||o,a=i.map(u=>(u.selected=!1,kt(u.id,!1))),l=c.map(u=>kt(u.id,!1));Ve({changedNodes:a,changedEdges:l,get:e,set:t})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:o}=e();r==null||r.scaleExtent([n,o]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:o}=e();r==null||r.scaleExtent([o,n]),t({maxZoom:n})},setTranslateExtent:n=>{var r;(r=e().d3Zoom)==null||r.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=e(),s=r().filter(c=>c.selected).map(c=>kt(c.id,!1)),i=n.filter(c=>c.selected).map(c=>kt(c.id,!1));Ve({changedNodes:s,changedEdges:i,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:r}=e();r.forEach(o=>{o.positionAbsolute=Wn(o.position,n)}),t({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:o,height:s,d3Zoom:i,d3Selection:c,translateExtent:a}=e();if(!i||!c||!n.x&&!n.y)return!1;const l=Rt.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),u=[[0,0],[o,s]],f=i==null?void 0:i.constrain()(l,u,a);return i.transform(c,f),r[0]!==f.x||r[1]!==f.y||r[2]!==f.k},cancelConnection:()=>t({connectionNodeId:Tt.connectionNodeId,connectionHandleId:Tt.connectionHandleId,connectionHandleType:Tt.connectionHandleType,connectionStatus:Tt.connectionStatus,connectionStartHandle:Tt.connectionStartHandle,connectionEndHandle:Tt.connectionEndHandle}),reset:()=>t({...Tt})}),Object.is),xi=({children:t})=>{const e=E.useRef(null);return e.current||(e.current=$f()),R.createElement(qu,{value:e.current},t)};xi.displayName="ReactFlowProvider";const wi=({children:t})=>E.useContext(sn)?R.createElement(R.Fragment,null,t):R.createElement(xi,null,t);wi.displayName="ReactFlowWrapper";const Tf={input:Go,default:Hn,output:Qo,group:er},Cf={default:je,straight:Qn,step:Kn,smoothstep:cn,simplebezier:Gn},kf=[0,0],If=[15,15],Rf={x:0,y:0,zoom:1},zf={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Df=E.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:s=Tf,edgeTypes:i=Cf,onNodeClick:c,onEdgeClick:a,onInit:l,onMove:u,onMoveStart:f,onMoveEnd:h,onConnect:g,onConnectStart:x,onConnectEnd:p,onClickConnectStart:_,onClickConnectEnd:m,onNodeMouseEnter:b,onNodeMouseMove:N,onNodeMouseLeave:y,onNodeContextMenu:M,onNodeDoubleClick:C,onNodeDragStart:z,onNodeDrag:H,onNodeDragStop:T,onNodesDelete:L,onEdgesDelete:P,onSelectionChange:B,onSelectionDragStart:V,onSelectionDrag:d,onSelectionDragStop:S,onSelectionContextMenu:v,onSelectionStart:$,onSelectionEnd:k,connectionMode:w=Wt.Strict,connectionLineType:A=It.Bezier,connectionLineStyle:I,connectionLineComponent:D,connectionLineContainerStyle:O,deleteKeyCode:F="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:W=!1,selectionMode:Z=Me.Full,panActivationKeyCode:G="Space",multiSelectionKeyCode:J=Qe()?"Meta":"Control",zoomActivationKeyCode:K=Qe()?"Meta":"Control",snapToGrid:dt=!1,snapGrid:at=If,onlyRenderVisibleElements:ht=!1,selectNodesOnDrag:ut=!0,nodesDraggable:et,nodesConnectable:xt,nodesFocusable:Q,nodeOrigin:Y=kf,edgesFocusable:st,edgesUpdatable:Dt,elementsSelectable:fe,defaultViewport:Zt=Rf,minZoom:Gt=.5,maxZoom:St=2,translateExtent:Kt=Vn,preventScrolling:Pt=!0,nodeExtent:Ht,defaultMarkerColor:Qt="#b1b1b7",zoomOnScroll:Jt=!0,zoomOnPinch:de=!0,panOnScroll:rt=!1,panOnScrollSpeed:gt=.5,panOnScrollMode:Lt=Yt.Free,zoomOnDoubleClick:Vt=!0,panOnDrag:Bt=!0,onPaneClick:Et,onPaneMouseEnter:wt,onPaneMouseMove:he,onPaneMouseLeave:an,onPaneScroll:ge,onPaneContextMenu:un,children:rr,onEdgeContextMenu:Ft,onEdgeDoubleClick:_i,onEdgeMouseEnter:bi,onEdgeMouseMove:Si,onEdgeMouseLeave:Ei,onEdgeUpdate:Ni,onEdgeUpdateStart:Ai,onEdgeUpdateEnd:Mi,onReconnect:$i,onReconnectStart:Ti,onReconnectEnd:Ci,reconnectRadius:ki=10,edgeUpdaterRadius:Ii=10,onNodesChange:Ri,onEdgesChange:zi,noDragClassName:Di="nodrag",noWheelClassName:Pi="nowheel",noPanClassName:or="nopan",fitView:Hi=!1,fitViewOptions:Li,connectOnClick:Vi=!0,attributionPosition:Bi,proOptions:Fi,defaultEdgeOptions:Oi,elevateNodesOnSelect:Xi=!0,elevateEdgesOnSelect:Yi=!1,disableKeyboardA11y:ir=!1,autoPanOnConnect:qi=!0,autoPanOnNodeDrag:Ui=!0,connectionRadius:Wi=20,isValidConnection:Zi,onError:Gi,style:Ki,id:sr,nodeDragThreshold:Qi,...Ji},ji)=>{const ln=sr||"1";return R.createElement("div",{...Ji,style:{...Ki,...zf},ref:ji,className:ft(["react-flow",o]),"data-testid":"rf__wrapper",id:sr},R.createElement(wi,null,R.createElement(Mf,{onInit:l,onMove:u,onMoveStart:f,onMoveEnd:h,onNodeClick:c,onEdgeClick:a,onNodeMouseEnter:b,onNodeMouseMove:N,onNodeMouseLeave:y,onNodeContextMenu:M,onNodeDoubleClick:C,nodeTypes:s,edgeTypes:i,connectionLineType:A,connectionLineStyle:I,connectionLineComponent:D,connectionLineContainerStyle:O,selectionKeyCode:q,selectionOnDrag:W,selectionMode:Z,deleteKeyCode:F,multiSelectionKeyCode:J,panActivationKeyCode:G,zoomActivationKeyCode:K,onlyRenderVisibleElements:ht,selectNodesOnDrag:ut,defaultViewport:Zt,translateExtent:Kt,minZoom:Gt,maxZoom:St,preventScrolling:Pt,zoomOnScroll:Jt,zoomOnPinch:de,zoomOnDoubleClick:Vt,panOnScroll:rt,panOnScrollSpeed:gt,panOnScrollMode:Lt,panOnDrag:Bt,onPaneClick:Et,onPaneMouseEnter:wt,onPaneMouseMove:he,onPaneMouseLeave:an,onPaneScroll:ge,onPaneContextMenu:un,onSelectionContextMenu:v,onSelectionStart:$,onSelectionEnd:k,onEdgeContextMenu:Ft,onEdgeDoubleClick:_i,onEdgeMouseEnter:bi,onEdgeMouseMove:Si,onEdgeMouseLeave:Ei,onReconnect:$i??Ni,onReconnectStart:Ti??Ai,onReconnectEnd:Ci??Mi,reconnectRadius:ki??Ii,defaultMarkerColor:Qt,noDragClassName:Di,noWheelClassName:Pi,noPanClassName:or,elevateEdgesOnSelect:Yi,rfId:ln,disableKeyboardA11y:ir,nodeOrigin:Y,nodeExtent:Ht}),R.createElement(Sl,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:g,onConnectStart:x,onConnectEnd:p,onClickConnectStart:_,onClickConnectEnd:m,nodesDraggable:et,nodesConnectable:xt,nodesFocusable:Q,edgesFocusable:st,edgesUpdatable:Dt,elementsSelectable:fe,elevateNodesOnSelect:Xi,minZoom:Gt,maxZoom:St,nodeExtent:Ht,onNodesChange:Ri,onEdgesChange:zi,snapToGrid:dt,snapGrid:at,connectionMode:w,translateExtent:Kt,connectOnClick:Vi,defaultEdgeOptions:Oi,fitView:Hi,fitViewOptions:Li,onNodesDelete:L,onEdgesDelete:P,onNodeDragStart:z,onNodeDrag:H,onNodeDragStop:T,onSelectionDrag:d,onSelectionDragStart:V,onSelectionDragStop:S,noPanClassName:or,nodeOrigin:Y,rfId:ln,autoPanOnConnect:qi,autoPanOnNodeDrag:Ui,onError:Gi,connectionRadius:Wi,isValidConnection:Zi,nodeDragThreshold:Qi}),R.createElement(_l,{onSelectionChange:B}),rr,R.createElement(Zu,{proOptions:Fi,position:Bi}),R.createElement($l,{rfId:ln,disableKeyboardA11y:ir})))});Df.displayName="ReactFlow";function vi(t){return e=>{const[n,r]=E.useState(e),o=E.useCallback(s=>r(i=>t(s,i)),[]);return[n,r,o]}}const Hf=vi(si),Lf=vi(Ol);export{ke as B,tn as H,X as P,xi as R,oi as a,Hf as b,Lf as c,Df as d,tt as u};
|